dengsixing 9 ay önce
ebeveyn
işleme
3e3a6470e4
20 değiştirilmiş dosya ile 2074 ekleme ve 240 silme
  1. 6 2
      src/main/java/com/fdkankan/modeldemo/Application.java
  2. 2 0
      src/main/java/com/fdkankan/modeldemo/bean/TagBean.java
  3. 5 0
      src/main/java/com/fdkankan/modeldemo/bean/TietaResBean.java
  4. 6 4
      src/main/java/com/fdkankan/modeldemo/constant/Constant.java
  5. 16 0
      src/main/java/com/fdkankan/modeldemo/constant/ServerCode.java
  6. 8 5
      src/main/java/com/fdkankan/modeldemo/controller/SceneController.java
  7. 10 0
      src/main/java/com/fdkankan/modeldemo/dto/SendConvertDTO.java
  8. 8 3
      src/main/java/com/fdkankan/modeldemo/httpclient/HttpClient.java
  9. 19 83
      src/main/java/com/fdkankan/modeldemo/mq/ConvertListener.java
  10. 4 0
      src/main/java/com/fdkankan/modeldemo/service/IConvertService.java
  11. 4 0
      src/main/java/com/fdkankan/modeldemo/service/impl/ConvertServiceImpl.java
  12. 12 34
      src/main/java/com/fdkankan/modeldemo/service/impl/FYunFileServiceImpl.java
  13. 36 0
      src/main/java/com/fdkankan/modeldemo/service/impl/SceneFileMappingServiceImpl.java
  14. 6 0
      src/main/java/com/fdkankan/modeldemo/service/impl/SceneServiceImpl.java
  15. 21 59
      src/main/java/com/fdkankan/modeldemo/utils/CmdUtils.java
  16. 28 29
      src/main/java/com/fdkankan/modeldemo/utils/FdfsUtil.java
  17. 6 0
      src/main/java/com/fdkankan/modeldemo/utils/HttpUtilExt.java
  18. 21 21
      src/main/java/com/fdkankan/modeldemo/utils/StreamGobblerLine.java
  19. 249 0
      src/main/java/com/fdkankan/rabbitmq/util/ConvertListenerUtil.java
  20. 1607 0
      src/main/java/com/fdkankan/rabbitmq/util/JsonFormatUtil.java

+ 6 - 2
src/main/java/com/fdkankan/modeldemo/Application.java

@@ -7,15 +7,19 @@ import org.springframework.context.annotation.ComponentScan;
 import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.annotation.EnableScheduling;
 
+// 标注这是一个 Spring Boot 应用程序
 @SpringBootApplication
+// 启用定时任务调度
 @EnableScheduling
+// 扫描指定包及其子包中的组件
 @ComponentScan(basePackages = {"com.fdkankan.*"})
+// 扫描 MyBatis 映射器接口
 @MapperScan("com.fdkankan.modeldemo.mapper")
+// 启用异步方法执行
 @EnableAsync
 public class Application {
     public static void main(String[] args) {
+        // 启动 Spring Boot 应用程序
         SpringApplication.run(Application.class, args);
     }
 }
-
-

+ 2 - 0
src/main/java/com/fdkankan/modeldemo/bean/TagBean.java

@@ -20,8 +20,10 @@ import lombok.NoArgsConstructor;
 @AllArgsConstructor
 public class TagBean {
 
+    // 创建时间
     private Long createTime;
 
+    // 标签信息
     private JSONObject tag;
 
 }

+ 5 - 0
src/main/java/com/fdkankan/modeldemo/bean/TietaResBean.java

@@ -5,8 +5,13 @@ import lombok.Data;
 @Data
 public class TietaResBean<T> {
 
+    // 响应代码
     private String code;
+    
+    // 响应消息
     private String mes;
+    
+    // 响应数据
     private T data;
 
 }

+ 6 - 4
src/main/java/com/fdkankan/modeldemo/constant/Constant.java

@@ -2,21 +2,23 @@ package com.fdkankan.modeldemo.constant;
 
 public class Constant {
 
+    // 队列场景转换
     public static final String QUEUE_SCENE_CONVERT = "queue-scene-convert-2";
 
+    // 数据视图路径
     public static final String DATA_VIEW_PATH =  "scene_view_data/%s/data/";
+    
     /**
-     * 场景图片
+     * 场景图片路径
      */
     public static final String IMG_VIEW_PATH =  "scene_view_data/%s/images/";
 
     /**
-     * 用户目录
+     * 用户目录路径
      */
     public static final String USER_VIEW_PATH =  "scene_view_data/%s/user/";
 
+    // Redis 场景转换中
     public static final String REDIS_SCENE_CONVERT_ING = "scene:converting:%s";
 
-
-
 }

+ 16 - 0
src/main/java/com/fdkankan/modeldemo/constant/ServerCode.java

@@ -1,32 +1,48 @@
 package com.fdkankan.modeldemo.constant;
 
+/**
+ * 服务器响应码枚举类
+ */
 public enum ServerCode {
 
+	// 操作成功
 	SUCCESS(0, "操作成功"),
+	// 服务器异常
 	SYSTEM_ERROR(-1, "服务器异常"),
+	// 解析请求参数出错
 	PARAM_ERROR(-2, "解析请求参数出错"),
+	// 缺少必要参数
 	PARAM_REQUIRED(-3, "缺少必要参数:%s"),
+	// 跨服务请求失败
 	FEIGN_REQUEST_FAILD(-4, "跨服务请求失败"),
+	// 服务正在关闭
 	SERVER_CLOSING(-5, "服务正在关闭!"),
 
+	// 非法的APP ID
 	APP_ID_ILLEGAL(3100, "非法的APP ID");
 
+	// 响应码
 	private Integer code;
+	// 响应消息
 	private String message;
 
+	// 构造方法
 	private ServerCode(Integer code, String message) {
 		this.code = code;
 		this.message = message;
 	}
 
+	// 获取响应码
 	public Integer code() {
 		return code;
 	}
 
+	// 获取响应消息
 	public String message() {
 		return message;
 	}
 
+	// 格式化响应消息
 	public String formatMessage(Object... args) {
 		return String.format(message, args);
 	}

+ 8 - 5
src/main/java/com/fdkankan/modeldemo/controller/SceneController.java

@@ -1,6 +1,5 @@
 package com.fdkankan.modeldemo.controller;
 
-
 import com.fdkankan.modeldemo.bean.ResultData;
 import com.fdkankan.modeldemo.service.SceneConvertLogService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -23,17 +22,21 @@ public class SceneController {
     @Autowired
     private SceneConvertLogService sceneConvertLogService;
 
+    /**
+     * 健康检查接口
+     * @return ResultData
+     */
     @GetMapping(value = "/ping")
     public ResultData ping(){
         return ResultData.ok();
     }
 
+    /**
+     * 测试接口,返回日志列表
+     * @return ResultData
+     */
     @GetMapping(value = "/test")
     public ResultData test(){
         return ResultData.ok(sceneConvertLogService.list());
     }
-
-
-
-
 }

+ 10 - 0
src/main/java/com/fdkankan/modeldemo/dto/SendConvertDTO.java

@@ -8,13 +8,23 @@ import org.springframework.beans.factory.annotation.Autowired;
 
 import javax.validation.constraints.NotBlank;
 
+/**
+ * 发送转换DTO类
+ */
 @Data
 @Builder
 @NoArgsConstructor
 @AllArgsConstructor
 public class SendConvertDTO {
+    /**
+     * 房间ID,不能为空
+     */
     @NotBlank(message = "roomId不能为空")
     private String roomId;
+
+    /**
+     * URL,不能为空
+     */
     @NotBlank(message = "url不能为空")
     private String url;
 }

+ 8 - 3
src/main/java/com/fdkankan/modeldemo/httpclient/HttpClient.java

@@ -1,6 +1,5 @@
 package com.fdkankan.modeldemo.httpclient;
 
-
 import com.alibaba.fastjson.JSONObject;
 import com.dtflys.forest.annotation.JSONBody;
 import com.dtflys.forest.annotation.Post;
@@ -8,8 +7,14 @@ import com.dtflys.forest.annotation.Var;
 
 public interface HttpClient {
 
-    @Post(url = "{url}", connectTimeout = 30000,  readTimeout = 30000, maxRetryInterval = 3)
+    /**
+     * 发送POST请求,提交JSON数据
+     * 
+     * @param url 请求的URL地址
+     * @param object 要发送的JSON对象
+     * @return 服务器响应的JSON对象
+     */
+    @Post(url = "{url}", connectTimeout = 30000, readTimeout = 30000, maxRetryInterval = 3)
     JSONObject postJson(@Var("url") String url, @JSONBody Object object);
 
-
 }

+ 19 - 83
src/main/java/com/fdkankan/modeldemo/mq/ConvertListener.java

@@ -44,8 +44,7 @@ import java.util.*;
  * <p>
  * TODO
  * </p>
- *
- * @author dengsixing
+ * 场景转换监听器
  * @since 2022/4/19
  **/
 @Slf4j
@@ -70,58 +69,6 @@ public class ConvertListener{
     @Resource
     private RedisClient redisClient;
 
-//    @RabbitListener(
-//            queuesToDeclare = @Queue(Constant.QUEUE_SCENE_CONVERT),
-//            concurrency = "1"
-//    )
-//    public void buildObjScenePreHandler(Channel channel, Message message) throws Exception {
-//        String roomId = null;
-//        try {
-//            String msg = new String(message.getBody(), StandardCharsets.UTF_8);
-//            log.info("msg:{}", msg);
-//            JSONObject jsonObject = JSON.parseObject(msg);
-//            //roomId
-//            roomId = jsonObject.getString("roomId");
-//            String zipUrl = jsonObject.getString("zipUrl");
-//            String zipName = FileUtil.getName(zipUrl);
-//            String dirName = FileUtil.getPrefix(zipName);
-//            log.info("zipUrl:{}", zipUrl);
-//            //下载压缩包
-//            String baseZipPath = "/mnt/scene/convert/";
-//            FileUtil.mkdir(baseZipPath);
-//            HttpUtil.downloadFile(zipUrl, baseZipPath);
-////            FileUtil.copy(zipUrl, baseZipPath, true);
-//
-//            String localZipPath = baseZipPath + zipName;
-//            ZipUtil.unzip(localZipPath, baseZipPath);
-//
-//            String targetPath = "/oss/4dkankan/scene_view_data/" + roomId + "/";
-//            String dataSource = baseZipPath + dirName + "/";
-//            Map<String, String> uploadFileMap = convertUtil.convert(dataSource, roomId);
-//            String finalRoomId = roomId;
-//            uploadFileMap.keySet().stream().forEach(key->{
-//
-//                SceneFileMapping sceneFileMapping = sceneFileMappingService.getByNumAndKey(finalRoomId, key);
-//                if(Objects.isNull(sceneFileMapping)){
-//                    sceneFileMapping = new SceneFileMapping();
-//                }
-//                Map<String, String> mapping = fdfsUtil.uploadFile(uploadFileMap.get(key));
-//                sceneFileMapping.setNum(finalRoomId);
-//                sceneFileMapping.setFileid(mapping.get("file_id"));
-//                sceneFileMapping.setUrl(mapping.get("http_url"));
-//                sceneFileMapping.setKey(key);
-//                sceneFileMappingService.saveOrUpdate(sceneFileMapping);
-//            });
-//
-//        }catch (Exception e){
-//            log.error("convert fail, roomId:{}", roomId, e);
-//        }
-//
-//        channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
-//
-//
-//    }
-
     /**
      * 场景转换监听器
      * @throws Exception
@@ -131,13 +78,13 @@ public class ConvertListener{
             concurrency = "1"
     )
     public void buildObjScenePreHandler(Channel channel, Message message) throws Exception {
-        //开始计时
+        // 开始计时
         TimeInterval timeInterval = new TimeInterval();
         timeInterval.start();
 
-        //获取消息id
+        // 获取消息id
         String messageId = message.getMessageProperties().getMessageId();
-        //消息开始消费,立即ack,防止二次消费
+        // 消息开始消费,立即ack,防止二次消费
         channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
 
         String stationCode = null;
@@ -162,17 +109,17 @@ public class ConvertListener{
                 convertType = "standar";
             }
             if(StrUtil.isNotEmpty(upTimeStr)){
-                //将字符串转为时间格式
+                // 将字符串转为时间格式
                 upTime = DateUtil.parse(upTimeStr, DatePattern.NORM_DATETIME_PATTERN);
-                //将字符串转为YYYYMMDDHHMMSS格式
+                // 将字符串转为YYYYMMDDHHMMSS格式
                 upTimeKey = upTimeStr.replace("-", "").replace(" ", "").replace(":", "");
             }
             fileList = jsonObject.getJSONArray("fileList");
             convertIngKey = String.format(Constant.REDIS_SCENE_CONVERT_ING, messageId);
             String convert = redisClient.get(convertIngKey);
             log.info("-----------------convert:{}-----------------", convert);
-            //铁塔的rabbitmq有问题,简单队列不能负载均衡,所以这里用redis做了一个锁,方式重复消费
-            if(StrUtil.isNotEmpty(convert)){//正在转换,直接丢弃
+            // 铁塔的rabbitmq有问题,简单队列不能负载均衡,所以这里用redis做了一个锁,方式重复消费
+            if(StrUtil.isNotEmpty(convert)){// 正在转换,直接丢弃
                 log.warn("场景正在转换,此消息丢弃, stationCode:{}, entityId:{}", stationCode, entityId);
                 convertIngKey = null;
                 return;
@@ -184,7 +131,7 @@ public class ConvertListener{
             sceneConvertLog.setCreateTime(new Date());
             sceneConvertLog.setConverttype(convertType);
 
-            //只更新上传时间
+            // 只更新上传时间
             if(convertType.equals("upTime")){
 
                 List<Scene> list = sceneService.list(new LambdaQueryWrapper<Scene>().eq(Scene::getNum, entityId).eq(Scene::getStationcode, stationCode));
@@ -197,7 +144,7 @@ public class ConvertListener{
                     });
                     sceneService.updateBatchById(list);
 
-                    //有中高低点位的场景的公有visiontxt文件
+                    // 有中高低点位的场景的公有visiontxt文件
                     List<SceneFileMapping> visionTxt = sceneFileMappingService.getByNumAndKey(list.get(0).getNum(), -1, "scene_view_data/" + list.get(0).getNum() + "/images/vision.txt");
                     if(CollUtil.isNotEmpty(visionTxt)){
                         visionTxt.stream().forEach(v -> v.setUpTime(finalUpTimeKey));
@@ -214,7 +161,7 @@ public class ConvertListener{
                     }
                 }
             }else{
-                //校验文件是否齐全
+                // 校验文件是否齐全
                 boolean exists512 = fileList.stream().anyMatch(v -> {
                     JSONObject obj = (JSONObject) v;
                     return "1".equals(obj.getString(file_type_key));
@@ -230,7 +177,6 @@ public class ConvertListener{
                     return "3".equals(obj.getString(file_type_key));
                 });
 
-
                 dataSource = baseZipPath + stationCode + "_" + entityId + "_" + DateUtil.format(upTime, DatePattern.PURE_DATETIME_PATTERN) + "/";
                 String imagePath = dataSource + "images/";
                 String dataPath = dataSource + "data/";
@@ -246,19 +192,19 @@ public class ConvertListener{
                     String fileName = obj.getString("fileName");
                     String fileType = obj.getString(file_type_key);
                     String fileUrl = obj.getString("fileUrl");
-                    if("7".equals(fileType)){//vision.txt
+                    if("7".equals(fileType)){// vision.txt
                         HttpUtilExt.downloadFileAndCheck(fileUrl, imagePath + fileName, 300000);
                     }
-                    if("1".equals(fileType)){//512图
+                    if("1".equals(fileType)){// 512图
                         HttpUtilExt.downloadFileAndCheck(fileUrl, image512Path + fileName, 300000);
                     }
-                    if("2".equals(fileType)){//4k图
+                    if("2".equals(fileType)){// 4k图
                         HttpUtilExt.downloadFileAndCheck(fileUrl, image4kPath + fileName, 300000);
                         if(!exists512){
                             ImgUtil.scale(new File(image4kPath + fileName), new File(image512Path + fileName), 0.125f);
                         }
                     }
-                    if(!exists4k){//如果资源中没有4k,需要用8k图做一下像素压缩
+                    if(!exists4k){// 如果资源中没有4k,需要用8k图做一下像素压缩
                         if("3".equals(fileType)){
                             HttpUtilExt.downloadFileAndCheck(fileUrl, image8kPath + fileName, 30000);
                             ImgUtil.scale(new File(image8kPath + fileName),new File(image4kPath + fileName), 0.5f);
@@ -267,18 +213,18 @@ public class ConvertListener{
                             }
                         }
                     }
-                    if("11".equals(fileType)){//mesh.obj
+                    if("11".equals(fileType)){// mesh.obj
                         HttpUtilExt.downloadFileAndCheck(fileUrl, meshPath + fileName, 300000);
                     }
-                    if("5".equals(fileType)){//floorplan.json
+                    if("5".equals(fileType)){// floorplan.json
                         HttpUtilExt.downloadFileAndCheck(fileUrl, dataPath + fileName, 300000);
                     }
-                    if("12".equals(fileType)){//scene.json
+                    if("12".equals(fileType)){// scene.json
                         HttpUtilExt.downloadFileAndCheck(fileUrl, dataPath + fileName, 300000);
                     }
                 });
 
-                //转换并上传文件
+                // 转换并上传文件
                 convertUtil.convert(dataSource, entityId, stationCode, upTime, convertType, upTimeKey);
             }
 
@@ -302,15 +248,5 @@ public class ConvertListener{
                 redisClient.del(convertIngKey);
             }
         }
-
-//        channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
     }
-
-//    public boolean checkNead8kPic(JSONArray array){
-//        array.stream().findFirst().stream().anyMatch()
-//
-//
-//
-//    }
-
 }

+ 4 - 0
src/main/java/com/fdkankan/modeldemo/service/IConvertService.java

@@ -2,8 +2,12 @@ package com.fdkankan.modeldemo.service;
 
 import com.fdkankan.modeldemo.dto.SendConvertDTO;
 
+/**
+ * 转换接口类
+ */
 public interface IConvertService {
 
+
     void sendConvert(SendConvertDTO dto);
 
 

+ 4 - 0
src/main/java/com/fdkankan/modeldemo/service/impl/ConvertServiceImpl.java

@@ -13,6 +13,10 @@ public class ConvertServiceImpl implements IConvertService {
     @Autowired
     private RabbitMqProducer mqProducer;
 
+    /**
+     * 发送转换请求
+     * @param dto 包含转换请求数据的DTO
+     */
     @Override
     public void sendConvert(SendConvertDTO dto) {
         mqProducer.sendByWorkQueue(Constant.QUEUE_SCENE_CONVERT, dto);

+ 12 - 34
src/main/java/com/fdkankan/modeldemo/service/impl/FYunFileServiceImpl.java

@@ -27,27 +27,17 @@ public class FYunFileServiceImpl implements FYunFileService {
     @Resource
     private FdfsUtil fdfsUtil;
 
-
-//    @Override
-//    public String getFileContent(String key, Integer subgroup, String upTime) throws IOException {
-//        SceneFileMapping sceneFileMapping = sceneFileMappingService.getByKey(key, subgroup, upTime);
-//        if(Objects.isNull(sceneFileMapping)){
-//            return null;
-//        }
-//        String content = null;
-//        try (InputStream inputStream = customHttpClient.downloadFileToInputStream(sceneFileMapping.getUrl())){
-//            content =  IoUtil.read(inputStream, StandardCharsets.UTF_8);
-//        }
-//        return content;
-//    }
-
     @Override
     public void uploadFile(String num, Integer subgroup, String upTime, byte[] data, String key) {
+        // 获取文件后缀
         String suffix = "." + FileUtil.getSuffix(key);
+        // 创建临时文件
         File tempFile = FileUtil.createTempFile(UUID.fastUUID().toString(), suffix, new File("/temp"), true);
+        // 将数据写入临时文件
         FileUtil.writeBytes(data, tempFile);
+        // 上传文件并获取映射信息
         Map<String, String> mapping = fdfsUtil.uploadFile(tempFile.getAbsolutePath());
-        //添加记录
+        // 添加记录
         SceneFileMapping sceneFileMapping =  sceneFileMappingService.getByKey(key, subgroup, upTime);
         if(Objects.isNull(sceneFileMapping)){
             sceneFileMapping = new SceneFileMapping();
@@ -58,13 +48,15 @@ public class FYunFileServiceImpl implements FYunFileService {
         sceneFileMapping.setKey(key);
         sceneFileMapping.setSubgroup(subgroup);
         sceneFileMapping.setUpTime(upTime);
+        // 保存或更新记录
         sceneFileMappingService.saveOrUpdate(sceneFileMapping);
     }
 
     @Override
     public void uploadFile(String num, Integer subgroup, String upTime, String path, String key) {
+        // 上传文件并获取映射信息
         Map<String, String> mapping = fdfsUtil.uploadFile(path);
-        //添加记录
+        // 添加记录
         SceneFileMapping sceneFileMapping =  sceneFileMappingService.getByKey(key,subgroup,upTime);
         if(Objects.isNull(sceneFileMapping)){
             sceneFileMapping = new SceneFileMapping();
@@ -75,30 +67,16 @@ public class FYunFileServiceImpl implements FYunFileService {
         sceneFileMapping.setKey(key);
         sceneFileMapping.setSubgroup(subgroup);
         sceneFileMapping.setUpTime(upTime);
+        // 保存或更新记录
         sceneFileMappingService.saveOrUpdate(sceneFileMapping);
     }
 
-//    @Override
-//    public void deleteFile(String num, Integer subgroup, String upTime, String key) {
-//        sceneFileMappingService.delByNumAndKey(num, subgroup, upTime, key);
-//    }
-
     public static void main(String[] args) {
+        // 获取文件后缀
         String suffix = "." + FileUtil.getSuffix("/sxx/ttt/adf.json");
+        // 创建临时文件
         File tempFile = FileUtil.createTempFile(UUID.fastUUID().toString(), suffix, new File("D:\\test2"), true);
+        // 将字符串写入临时文件
         FileUtil.writeBytes("nihsd灌灌灌灌".getBytes(StandardCharsets.UTF_8), tempFile);
     }
-
-//    @Override
-//    public String downloadFile(String num, Integer subgroup, String upTime, String key, String dir, String fileName) {
-//        SceneFileMapping sceneFileMapping = sceneFileMappingService.getByKey(key, subgroup,upTime);
-//        if(Objects.isNull(sceneFileMapping)){
-//            return null;
-//        }
-//        customHttpClient.downloadFile(sceneFileMapping.getUrl(), dir, fileName);
-//        if(dir.endsWith("/")){
-//            dir += "/";
-//        }
-//         return dir + fileName;
-//    }
 }

+ 36 - 0
src/main/java/com/fdkankan/modeldemo/service/impl/SceneFileMappingServiceImpl.java

@@ -20,26 +20,62 @@ import java.util.List;
 @Service
 public class SceneFileMappingServiceImpl extends ServiceImpl<SceneFileMappingMapper, SceneFileMapping> implements SceneFileMappingService {
 
+    /**
+     * 根据num、subgroup和key获取SceneFileMapping列表
+     * @param num 编号
+     * @param subgroup 子组
+     * @param key 键
+     * @return SceneFileMapping列表
+     */
     @Override
     public List<SceneFileMapping> getByNumAndKey(String num, Integer subgroup, String key) {
         return this.list(new LambdaQueryWrapper<SceneFileMapping>().eq(SceneFileMapping::getNum, num).eq(SceneFileMapping::getKey, key).eq(SceneFileMapping::getSubgroup, subgroup));
     }
 
+    /**
+     * 根据num和subgroup获取SceneFileMapping列表
+     * @param num 编号
+     * @param subgroup 子组
+     * @return SceneFileMapping列表
+     */
     @Override
     public List<SceneFileMapping> getByNumAndSubgroup(String num, Integer subgroup) {
         return this.list(new LambdaQueryWrapper<SceneFileMapping>().eq(SceneFileMapping::getNum, num).eq(SceneFileMapping::getSubgroup, subgroup));
     }
 
+    /**
+     * 根据num、subgroup、upTimeKey和key获取SceneFileMapping列表
+     * @param num 编号
+     * @param subgroup 子组
+     * @param upTimeKey 更新时间键
+     * @param key 键
+     * @return SceneFileMapping列表
+     */
     @Override
     public List<SceneFileMapping> getByScene(String num, Integer subgroup, String upTimeKey, String key) {
         return this.list(new LambdaQueryWrapper<SceneFileMapping>().eq(SceneFileMapping::getNum, num).eq(SceneFileMapping::getKey, key).eq(SceneFileMapping::getSubgroup, subgroup).eq(SceneFileMapping::getUpTime, upTimeKey));
     }
 
+    /**
+     * 根据num、subgroup、upTimeKey和keyList获取SceneFileMapping列表
+     * @param num 编号
+     * @param subgroup 子组
+     * @param upTimeKey 更新时间键
+     * @param keyList 键列表
+     * @return SceneFileMapping列表
+     */
     @Override
     public List<SceneFileMapping> getBySceneBatch(String num, Integer subgroup, String upTimeKey, List<String> keyList) {
         return this.list(new LambdaQueryWrapper<SceneFileMapping>().eq(SceneFileMapping::getNum, num).in(SceneFileMapping::getKey, keyList).eq(SceneFileMapping::getSubgroup, subgroup).eq(SceneFileMapping::getUpTime, upTimeKey));
     }
 
+    /**
+     * 根据key、subgroup和upTime获取单个SceneFileMapping
+     * @param key 键
+     * @param subgroup 子组
+     * @param upTime 更新时间
+     * @return 单个SceneFileMapping
+     */
     @Override
     public SceneFileMapping getByKey(String key, Integer subgroup, String upTime) {
         return this.getOne(new LambdaQueryWrapper<SceneFileMapping>()

+ 6 - 0
src/main/java/com/fdkankan/modeldemo/service/impl/SceneServiceImpl.java

@@ -18,6 +18,12 @@ import org.springframework.stereotype.Service;
 @Service
 public class SceneServiceImpl extends ServiceImpl<SceneMapper, Scene> implements SceneService {
 
+    /**
+     * 根据编号获取场景
+     * 
+     * @param num 场景编号
+     * @return 场景对象
+     */
     @Override
     public Scene getByNum(String num) {
         return this.getOne(new LambdaQueryWrapper<Scene>().eq(Scene::getNum, num));

+ 21 - 59
src/main/java/com/fdkankan/modeldemo/utils/CmdUtils.java

@@ -7,44 +7,26 @@ import lombok.extern.slf4j.Slf4j;
  */
 public class CmdUtils {
 
-
     /**
-     * 调用算法 xx.sh 脚本
-     * @param command
+     * 调用 shell 脚本
+     * @param command 命令
      */
-//    public static void callshell(String command){
-//        try {
-//            String[] cmd = new String[]{"/bin/sh", "-c", command};
-//            Process process = Runtime.getRuntime().exec(cmd);
-//            StreamGobbler errorGobbler = new StreamGobbler(process.getErrorStream(), "ERROR");
-//            errorGobbler.start();
-//            StreamGobbler outGobbler = new StreamGobbler(process.getInputStream(), "STDOUT");
-//            outGobbler.start();
-//            process.waitFor();
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//        }
-//    }
-
-
-
     public static void callLineSh(String command) throws Exception {
         callLineSh(command, null);
-
     }
 
     /**
-     * 直接java调用命令
-     * @param command
+     * 直接通过 Java 调用命令
+     * @param command 命令
      */
     public static void callLine(String command) throws Exception {
         callLine(command, null);
-
     }
 
     /**
-     * 直接java调用命令
-     * @param command
+     * 直接通过 Java 调用命令
+     * @param command 命令
+     * @param lineSize 日志输出行数,可以为 null
      */
     public static void callLine(String command, Integer lineSize) throws Exception {
         System.out.println("cmd: " + command);
@@ -52,51 +34,31 @@ public class CmdUtils {
         System.out.println("开始运行");
         StreamGobblerLine errorGobbler = new StreamGobblerLine(process.getErrorStream(), "ERROR");
         errorGobbler.start();
-        // 200行打印一次日志
+        // 200 行打印一次日志
         StreamGobblerLine outGobbler = new StreamGobblerLine(process.getInputStream(), "STDOUT", lineSize);
         outGobbler.start();
         process.waitFor();
     }
 
     /**
-     *
+     * 调用 shell 脚本
      * @param command 命令
-     * @param lineSize 日志输出行数 ,可以为null
+     * @param lineSize 日志输出行数,可以为 null
      */
     public static void callLineSh(String command, Integer lineSize) throws Exception {
         try {
-        System.out.println("cmd: " + command);
-        String[] cmd = new String[]{"/bin/sh", "-c", command};
-        Process process = Runtime.getRuntime().exec(cmd);
-        System.out.println("开始运行");
-        StreamGobblerLine errorGobbler = new StreamGobblerLine(process.getErrorStream(), "ERROR");
-        errorGobbler.start();
-        // 200行打印一次日志
-        StreamGobblerLine outGobbler = new StreamGobblerLine(process.getInputStream(), "STDOUT", lineSize);
-        outGobbler.start();
-        process.waitFor();
-        }catch (Exception e){
+            System.out.println("cmd: " + command);
+            String[] cmd = new String[]{"/bin/sh", "-c", command};
+            Process process = Runtime.getRuntime().exec(cmd);
+            System.out.println("开始运行");
+            StreamGobblerLine errorGobbler = new StreamGobblerLine(process.getErrorStream(), "ERROR");
+            errorGobbler.start();
+            // 200 行打印一次日志
+            StreamGobblerLine outGobbler = new StreamGobblerLine(process.getInputStream(), "STDOUT", lineSize);
+            outGobbler.start();
+            process.waitFor();
+        } catch (Exception e) {
             e.printStackTrace();
         }
     }
-
-    /**
-     * 调用sh脚本上传oss
-     */
-//    public static void ossUploadDir(String sceneCode, String uploadDir, String target){
-//
-//        String cmd = CmdConstant.OSSUTIL_UPLOAD_DIR;
-//        cmd = cmd.replaceAll("@sceneCode", sceneCode);
-//        cmd = cmd.replaceAll("@uploadDir", uploadDir);
-//        cmd = cmd.replaceAll("@target", target);
-//
-//        log.info("ossCmd: " + cmd);
-//        long start = System.currentTimeMillis();
-//        CmdUtils.callLineSh(cmd);
-//        long end = System.currentTimeMillis();
-//        log.info("场景码目录:{} 上传完成, 耗时:{} s" , sceneCode, (end-start)/1000 );
-//    }
-
-
-
 }

+ 28 - 29
src/main/java/com/fdkankan/modeldemo/utils/FdfsUtil.java

@@ -39,23 +39,41 @@ public class FdfsUtil {
     @Value("${fdfs.sysCode}")
     private String sysCode;
 
+    /**
+     * 获取签名
+     * @param nonce
+     * @param timestamp
+     * @return
+     */
     public String getSignature(String nonce, String timestamp){
         Map<String, String> headers = new HashMap<>();
         headers.put(TIMESTAMP_KEY, timestamp);
         headers.put(NONCE_KEY, nonce);
         headers.put(SYS_CODE_KEY, sysCode);
+        //发送请求
         HttpRequest httpRequest = HttpRequest.post(address.concat(api_getSignature)).addHeaders(headers).timeout(5000);
         HttpResponse res = httpRequest.execute();
         String resBody = res.body();
+        //关闭流
         res.close();
+        //请求结果转换为bean对象
         TietaResBean<String> tietaResBean = JSON.parseObject(resBody, TietaResBean.class);
         String code = tietaResBean.getCode();
+        //状态吗错误,抛出异常
         if(!FDFS_SUCCESS_CODE.equals(code)){
             throw new RuntimeException("获取签名失败, code:" + code);
         }
         return tietaResBean.getData();
     }
 
+    /**
+     * 上传文件
+     * @param nonce
+     * @param timestamp
+     * @param signature
+     * @param filePath
+     * @return
+     */
     public Map<String, String> uploadFile(String nonce, String timestamp, String signature, String filePath){
 
         Map<String, String> headers = new HashMap<>();
@@ -68,24 +86,34 @@ public class FdfsUtil {
         test.put("visibilityLevel", "1003");
         test.put("file", new File(filePath));
         test.put("userId", "111111");
+        //发送上传请求
         HttpRequest httpRequest = HttpRequest.post(address.concat(api_uploadFile)).form(test).addHeaders(headers).timeout(120000);
         HttpResponse res = httpRequest.execute();
         String resBody = res.body();
         log.info("upload file response : {}", resBody);
         res.close();
+        //str转对象
         TietaResBean<Map<String, String>> tietaResBean = JSON.parseObject(resBody, TietaResBean.class);
         String code = tietaResBean.getCode();
         if(!FDFS_SUCCESS_CODE.equals(code)){
+            //上传失败,抛出异常
             throw new RuntimeException("上传文件失败, code:" + code);
         }
         return tietaResBean.getData();
     }
 
+    /**
+     * 上传文件,其中包括获取签名以及上传文件两步
+     * @param filePath
+     * @return
+     */
     public Map<String, String> uploadFile(String filePath){
         String nonce = UUID.fastUUID().toString();
         String timestamp = String.valueOf(new Date().getTime());
+        //请求获取签名
         String signature = getSignature(nonce, timestamp);
         Map<String, String> stringStringMap = null;
+        //上传文件,失败后重试4次
         for(int i = 0; i< 5; i++){
             try {
                 stringStringMap = uploadFile(nonce, timestamp, signature, filePath);
@@ -102,35 +130,6 @@ public class FdfsUtil {
         return stringStringMap;
     }
 
-    public static void main(String[] args) {
-        Map<String, String> headers = new HashMap<>();
-        headers.put(TIMESTAMP_KEY, "1719389524320");
-        headers.put(NONCE_KEY, "123123");
-        headers.put(SYS_CODE_KEY, "CT00017");
-        headers.put("signature", "3044022062501c9896a919d81d00216379a84c7d89b2d7315a22f89aee2ce7c1185f656c02206d4694fb685247a289e1c0d11e7492311ef66354c64cd2234fa593e02a635074");
-
-        Map<String, Object> test = new HashMap<>();
-        test.put("visibilityLevel", "1003");
-        test.put("file", new File("D:\\四维时代\\中国铁塔\\数据推送示例\\KK-R4YYV4yIZlT\\images\\4k\\ff54999789b970e64e2845a2337954f9.jpg"));
-        test.put("userId", "111111");
-        HttpRequest httpRequest = HttpRequest.post("http://10.180.22.41:8761/ChinatowerFileService/uploadFile/").form(test).addHeaders(headers).timeout(60000);
-        HttpResponse res = httpRequest.execute();
-        String resBody = res.body();
-        res.close();
-        TietaResBean<Map<String, String>> tietaResBean = JSON.parseObject(resBody, TietaResBean.class);
-        String code = tietaResBean.getCode();
-        if(!FDFS_SUCCESS_CODE.equals(code)){
-            throw new RuntimeException("上传文件失败, code:" + code);
-        }
-        Map<String, String> data = tietaResBean.getData();
-        System.out.println(data);
-    }
-
-
-
-
-
-
 
 
 }

+ 6 - 0
src/main/java/com/fdkankan/modeldemo/utils/HttpUtilExt.java

@@ -7,13 +7,19 @@ import net.sf.jsqlparser.statement.create.table.Index;
 
 import java.io.File;
 
+/**
+ * http下载工具类
+ */
 @Slf4j
 public class HttpUtilExt extends HttpUtil {
 
     public static void downloadFileAndCheck(String url, String localPath, int timeout){
+        //循环下载五次,直到成功,5次下载都不成功,直接跳出
         for (int i = 0; i < 5; i++){
             try {
+                //下载
                 downloadFile(url, new File(localPath), timeout);
+                //判断文件是否存在
                 if(FileUtil.exist(localPath) && FileUtil.size(new File(localPath)) > 0){
                     return;
                 }

+ 21 - 21
src/main/java/com/fdkankan/modeldemo/utils/StreamGobblerLine.java

@@ -6,19 +6,22 @@ import java.io.*;
 
 public class StreamGobblerLine extends Thread {
 
-	InputStream is;
-    String type;
-    OutputStream os;
+    InputStream is;  // 输入流
+    String type;  // 类型
+    OutputStream os;  // 输出流
     Integer lineSize;  // 多少行打印日志一次
 
+    // 构造函数,初始化输入流和类型
     public StreamGobblerLine(InputStream is, String type) {
         this(is, type, null, null);
     }
 
+    // 构造函数,初始化输入流、类型和行大小
     public StreamGobblerLine(InputStream is, String type, Integer lineSize) {
         this(is, type, null, lineSize);
     }
 
+    // 构造函数,初始化输入流、类型、重定向输出流和行大小
     StreamGobblerLine(InputStream is, String type, OutputStream redirect, Integer lineSize) {
         this.is = is;
         this.type = type;
@@ -26,6 +29,7 @@ public class StreamGobblerLine extends Thread {
         this.lineSize = lineSize;
     }
 
+    // 线程运行方法
     public void run() {
         System.out.println("run StreamGobblerLine");
 
@@ -38,38 +42,34 @@ public class StreamGobblerLine extends Thread {
 
             isr = new InputStreamReader(is);
             br = new BufferedReader(isr);
-            String line=null;
+            String line = null;
             int i = 1;
-            while ( (line = br.readLine()) != null) {
+            while ((line = br.readLine()) != null) {
                 if (lineSize != null) {
                     if (i % lineSize == 0) {
-                        System.out.println(type + "," + i +" : >" + line);
+                        System.out.println(type + "," + i + " : >" + line);
                     }
                 } else {
-                    System.out.println(type + ","  + i +" : >" + line);
+                    System.out.println(type + "," + i + " : >" + line);
                 }
                 i++;
-
             }
 
             if (pw != null)
                 pw.flush();
         } catch (IOException ioe) {
             ioe.printStackTrace();
-        } finally{
+        } finally {
             try {
-            	if(pw!=null)
-            	{
-            		 pw.close();
-            	}
-            	if(br!=null)
-            	{
-            		br.close();
-            	}
-            	if(isr!=null)
-            	{
-            		isr.close();
-            	}
+                if (pw != null) {
+                    pw.close();
+                }
+                if (br != null) {
+                    br.close();
+                }
+                if (isr != null) {
+                    isr.close();
+                }
             } catch (IOException e) {
                 e.printStackTrace();
             }

+ 249 - 0
src/main/java/com/fdkankan/rabbitmq/util/ConvertListenerUtil.java

@@ -0,0 +1,249 @@
+//package com.fdkankan.rabbitmq.util;
+//
+//import cn.hutool.core.collection.CollUtil;
+//import cn.hutool.core.date.DatePattern;
+//import cn.hutool.core.date.DateUtil;
+//import cn.hutool.core.date.TimeInterval;
+//import cn.hutool.core.exceptions.ExceptionUtil;
+//import cn.hutool.core.img.ImgUtil;
+//import cn.hutool.core.io.FileUtil;
+//import cn.hutool.core.util.StrUtil;
+//import com.alibaba.fastjson.JSON;
+//import com.alibaba.fastjson.JSONArray;
+//import com.alibaba.fastjson.JSONObject;
+//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+//import com.fdkankan.modeldemo.constant.Constant;
+//import com.fdkankan.modeldemo.entity.Scene;
+//import com.fdkankan.modeldemo.entity.SceneConvertLog;
+//import com.fdkankan.modeldemo.entity.SceneFileMapping;
+//import com.fdkankan.modeldemo.service.SceneConvertLogService;
+//import com.fdkankan.modeldemo.service.SceneFileMappingService;
+//import com.fdkankan.modeldemo.service.SceneService;
+//import com.fdkankan.modeldemo.utils.ConvertUtil;
+//import com.fdkankan.modeldemo.utils.FdfsUtil;
+//import com.fdkankan.modeldemo.utils.HttpUtilExt;
+//import com.fdkankan.redis.RedisClient;
+//import com.rabbitmq.client.Channel;
+//import lombok.extern.slf4j.Slf4j;
+//import org.springframework.amqp.core.Message;
+//import org.springframework.amqp.rabbit.annotation.Queue;
+//import org.springframework.amqp.rabbit.annotation.RabbitListener;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Component;
+//
+//import javax.annotation.Resource;
+//import java.io.File;
+//import java.nio.charset.StandardCharsets;
+//import java.util.Date;
+//import java.util.List;
+//
+///**
+// * <p>
+// * TODO
+// * </p>
+// * 场景转换监听器
+// * @since 2022/4/19
+// **/
+//@Slf4j
+//@Component
+//public class ConvertListenerUtil {
+//
+//    public final static String baseZipPath = "/mnt/scene/convert/";
+//
+//    public final static String file_type_key = "fileType";
+//
+//    @Autowired
+//    private ConvertUtil convertUtil;
+//    @Resource
+//    private FdfsUtil fdfsUtil;
+//    @Autowired
+//    private SceneFileMappingService sceneFileMappingService;
+//    @Autowired
+//    private SceneService sceneService;
+//
+//    @Autowired
+//    private SceneConvertLogService sceneConvertLogService;
+//    @Resource
+//    private RedisClient redisClient;
+//
+//    /**
+//     * 场景转换监听器
+//     * @throws Exception
+//     */
+//    @RabbitListener(
+//            queuesToDeclare = @Queue(Constant.QUEUE_SCENE_CONVERT),
+//            concurrency = "1"
+//    )
+//    public void buildObjScenePreHandler(Channel channel, Message message) throws Exception {
+//        // 开始计时
+//        TimeInterval timeInterval = new TimeInterval();
+//        timeInterval.start();
+//
+//        // 获取消息id
+//        String messageId = message.getMessageProperties().getMessageId();
+//        // 消息开始消费,立即ack,防止二次消费
+//        channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
+//
+//        String stationCode = null;
+//        String entityId = null;
+//        Date upTime = null;
+//        JSONArray fileList = null;
+//        SceneConvertLog sceneConvertLog = new SceneConvertLog();
+//        String dataSource = null;
+//        String convertIngKey = null;
+//        String convertType = null;
+//        String upTimeStr = null;
+//        String upTimeKey = null;
+//        try {
+//            String msg = new String(message.getBody(), StandardCharsets.UTF_8);
+//            log.info("msg:{}", msg);
+//            JSONObject jsonObject = JSON.parseObject(msg);
+//            stationCode = jsonObject.getString("stationCode");
+//            entityId = jsonObject.getString("entityId");
+//            upTimeStr = jsonObject.getString("upTime");
+//            convertType = jsonObject.getString("convertType");
+//            if(StrUtil.isEmpty(convertType)){
+//                convertType = "standar";
+//            }
+//            if(StrUtil.isNotEmpty(upTimeStr)){
+//                // 将字符串转为时间格式
+//                upTime = DateUtil.parse(upTimeStr, DatePattern.NORM_DATETIME_PATTERN);
+//                // 将字符串转为YYYYMMDDHHMMSS格式
+//                upTimeKey = upTimeStr.replace("-", "").replace(" ", "").replace(":", "");
+//            }
+//            fileList = jsonObject.getJSONArray("fileList");
+//            convertIngKey = String.format(Constant.REDIS_SCENE_CONVERT_ING, messageId);
+//            String convert = redisClient.get(convertIngKey);
+//            log.info("-----------------convert:{}-----------------", convert);
+//            // 铁塔的rabbitmq有问题,简单队列不能负载均衡,所以这里用redis做了一个锁,方式重复消费
+//            if(StrUtil.isNotEmpty(convert)){// 正在转换,直接丢弃
+//                log.warn("场景正在转换,此消息丢弃, stationCode:{}, entityId:{}", stationCode, entityId);
+//                convertIngKey = null;
+//                return;
+//            }
+//            redisClient.add(convertIngKey, stationCode + "_" + entityId, 60 * 60 * 1000L);
+//
+//            sceneConvertLog.setStationCode(stationCode);
+//            sceneConvertLog.setEntityId(entityId);
+//            sceneConvertLog.setCreateTime(new Date());
+//            sceneConvertLog.setConverttype(convertType);
+//
+//            // 只更新上传时间
+//            if(convertType.equals("upTime")){
+//
+//                List<Scene> list = sceneService.list(new LambdaQueryWrapper<Scene>().eq(Scene::getNum, entityId).eq(Scene::getStationcode, stationCode));
+//                if(CollUtil.isNotEmpty(list)){
+//                    Date finalUpTime = upTime;
+//                    String finalUpTimeKey = upTimeKey;
+//                    list.stream().forEach(v->{
+//                        v.setUpTime(finalUpTime);
+//                        v.setUpTimeKey(finalUpTimeKey);
+//                    });
+//                    sceneService.updateBatchById(list);
+//
+//                    // 有中高低点位的场景的公有visiontxt文件
+//                    List<SceneFileMapping> visionTxt = sceneFileMappingService.getByNumAndKey(list.get(0).getNum(), -1, "scene_view_data/" + list.get(0).getNum() + "/images/vision.txt");
+//                    if(CollUtil.isNotEmpty(visionTxt)){
+//                        visionTxt.stream().forEach(v -> v.setUpTime(finalUpTimeKey));
+//                        sceneFileMappingService.updateBatchById(visionTxt);
+//                    }
+//
+//                    for (Scene scene : list) {
+//                        List<SceneFileMapping> sceneFileMappingList = sceneFileMappingService.getByNumAndSubgroup(scene.getNum(), scene.getSubgroup());
+//                        if(CollUtil.isEmpty(sceneFileMappingList)){
+//                            continue;
+//                        }
+//                        sceneFileMappingList.stream().forEach(v -> v.setUpTime(scene.getUpTimeKey()));
+//                        sceneFileMappingService.updateBatchById(sceneFileMappingList);
+//                    }
+//                }
+//            }else{
+//                // 校验文件是否齐全
+//                boolean exists512 = fileList.stream().anyMatch(v -> {
+//                    JSONObject obj = (JSONObject) v;
+//                    return "1".equals(obj.getString(file_type_key));
+//                });
+//
+//                boolean exists4k = fileList.stream().anyMatch(v -> {
+//                    JSONObject obj = (JSONObject) v;
+//                    return "2".equals(obj.getString(file_type_key));
+//                });
+//
+//                boolean exists8k = fileList.stream().anyMatch(v -> {
+//                    JSONObject obj = (JSONObject) v;
+//                    return "3".equals(obj.getString(file_type_key));
+//                });
+//
+//                dataSource = baseZipPath + stationCode + "_" + entityId + "_" + DateUtil.format(upTime, DatePattern.PURE_DATETIME_PATTERN) + "/";
+//                String imagePath = dataSource + "images/";
+//                String dataPath = dataSource + "data/";
+//                String meshPath = dataPath + "mesh/";
+//                String image512Path = imagePath + "512/";
+//                String image4kPath = imagePath + "4k/";
+//                String image8kPath = imagePath + "8k/";
+//                FileUtil.mkdir(image512Path);
+//                FileUtil.mkdir(image4kPath);
+//
+//                fileList.stream().forEach(o->{
+//                    JSONObject obj = (JSONObject) o;
+//                    String fileName = obj.getString("fileName");
+//                    String fileType = obj.getString(file_type_key);
+//                    String fileUrl = obj.getString("fileUrl");
+//                    if("7".equals(fileType)){// vision.txt
+//                        HttpUtilExt.downloadFileAndCheck(fileUrl, imagePath + fileName, 300000);
+//                    }
+//                    if("1".equals(fileType)){// 512图
+//                        HttpUtilExt.downloadFileAndCheck(fileUrl, image512Path + fileName, 300000);
+//                    }
+//                    if("2".equals(fileType)){// 4k图
+//                        HttpUtilExt.downloadFileAndCheck(fileUrl, image4kPath + fileName, 300000);
+//                        if(!exists512){
+//                            ImgUtil.scale(new File(image4kPath + fileName), new File(image512Path + fileName), 0.125f);
+//                        }
+//                    }
+//                    if(!exists4k){// 如果资源中没有4k,需要用8k图做一下像素压缩
+//                        if("3".equals(fileType)){
+//                            HttpUtilExt.downloadFileAndCheck(fileUrl, image8kPath + fileName, 30000);
+//                            ImgUtil.scale(new File(image8kPath + fileName),new File(image4kPath + fileName), 0.5f);
+//                            if(!exists512){
+//                                ImgUtil.scale(new File(image8kPath + fileName),new File(image512Path + fileName), 0.0625f);
+//                            }
+//                        }
+//                    }
+//                    if("11".equals(fileType)){// mesh.obj
+//                        HttpUtilExt.downloadFileAndCheck(fileUrl, meshPath + fileName, 300000);
+//                    }
+//                    if("5".equals(fileType)){// floorplan.json
+//                        HttpUtilExt.downloadFileAndCheck(fileUrl, dataPath + fileName, 300000);
+//                    }
+//                    if("12".equals(fileType)){// scene.json
+//                        HttpUtilExt.downloadFileAndCheck(fileUrl, dataPath + fileName, 300000);
+//                    }
+//                });
+//
+//                // 转换并上传文件
+//                convertUtil.convert(dataSource, entityId, stationCode, upTime, convertType, upTimeKey);
+//            }
+//
+//            sceneConvertLog.setStatus("1");
+//            sceneConvertLog.setTimeConsuming(String.valueOf(timeInterval.intervalSecond()));
+//            sceneConvertLogService.save(sceneConvertLog);
+//
+//        }catch (Exception e){
+//            log.error("convert fail, stationCode:{}, roomId:{}, upTimeKey:{}", stationCode, entityId, upTimeKey, e);
+//            sceneConvertLog.setStatus("0");
+//            sceneConvertLog.setRemark(ExceptionUtil.stacktraceToString(e, 4000));
+//            sceneConvertLog.setTimeConsuming(String.valueOf(timeInterval.intervalSecond()));
+//            sceneConvertLogService.save(sceneConvertLog);
+//        }finally{
+//            if(dataSource != null){
+//                FileUtil.del(dataSource);
+//                FileUtil.del(dataSource.substring(0, dataSource.lastIndexOf("/")) + "_obj2txt");
+//            }
+//
+//            if(StrUtil.isNotEmpty(convertIngKey)){
+//                redisClient.del(convertIngKey);
+//            }
+//        }
+//    }
+//}

Dosya farkı çok büyük olduğundan ihmal edildi
+ 1607 - 0
src/main/java/com/fdkankan/rabbitmq/util/JsonFormatUtil.java