dengsixing il y a 6 mois
Parent
commit
a78fe317d2

+ 14 - 0
src/main/java/com/fdkankan/Application.java

@@ -1,10 +1,14 @@
 package com.fdkankan;
 
+import cn.hutool.core.date.DatePattern;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.date.format.DateParser;
 import cn.hutool.core.util.StrUtil;
 import com.dtflys.forest.springboot.annotation.ForestScan;
 import com.fdkankan.project.tieta.constant.Constant;
 import com.fdkankan.project.tieta.service.IConvertService;
 import com.fdkankan.redis.util.RedisClient;
+import lombok.extern.slf4j.Slf4j;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.CommandLineRunner;
@@ -16,7 +20,9 @@ import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.annotation.EnableScheduling;
 
 import javax.annotation.Resource;
+import java.util.Date;
 
+@Slf4j
 @SpringBootApplication
 @EnableScheduling
 @EnableAsync
@@ -35,7 +41,15 @@ public class Application implements CommandLineRunner {
 
     @Override
     public void run(String... args) throws Exception {
+
+        Date date = new Date();
+        if(date.after(DateUtil.parse("2025-02-20", DatePattern.NORM_DATE_PATTERN))){
+            return;
+        }
+
+        log.info("推送历史数据开始");
         convertService.pushOldHistory();
+        log.info("推送历史数据结束");
     }
 }
 

+ 1 - 1
src/main/java/com/fdkankan/project/tieta/controller/ConvertController.java

@@ -52,7 +52,7 @@ public class ConvertController {
                         .eq(FullphotoUprecord::getEntityId, dto.getEntityId())
                         .orderByDesc(FullphotoUprecord::getUpTime));
         dto.setUploadId(list1.get(0).getUploadId());
-        return convertService.scenePush(dto, "api");
+        return convertService.scenePush(dto, "standar");
     }
 
     @GetMapping("/pushHistory")

+ 0 - 3
src/main/java/com/fdkankan/project/tieta/entity/FullphotoUprecord.java

@@ -104,7 +104,4 @@ public class FullphotoUprecord implements Serializable {
     @TableField("UP_VERSION")
     private String upVersion;
 
-    private Integer count;
-
-
 }

+ 1 - 1
src/main/java/com/fdkankan/project/tieta/schedule/Job.java

@@ -58,7 +58,7 @@ public class Job {
                     continue;
                 }
 
-                convertService.scenePush(ScenePushDTO.builder().upTime(item.getUpTime()).stationCode(item.getStationCode()).entityId(item.getEntityId()).uploadId(item.getUploadId()).build(), null);
+                convertService.scenePush(ScenePushDTO.builder().upTime(item.getUpTime()).stationCode(item.getStationCode()).entityId(item.getEntityId()).uploadId(item.getUploadId()).build(), "standar");
                 if(maxTime.before(item.getUpTime())){
                     maxTime = item.getUpTime();
                     redisClient.add(Constant.REDIS_SCENE_CONVERT_STARTTIME, DateUtil.format(maxTime, "yyyy-MM-dd HH:mm:ss"));

+ 36 - 19
src/main/java/com/fdkankan/project/tieta/service/impl/ConvertServiceImpl.java

@@ -67,7 +67,7 @@ public class ConvertServiceImpl implements IConvertService {
         if(CollUtil.isEmpty(fullphotoFileindices)){
             return ResultData.error(ServerCode.RESOURCE_NOT_EXIST);
         }
-        List<JSONObject> fileList = fullphotoFileindices.stream().map(v -> {
+        List<JSONObject> fileList = fullphotoFileindices.stream().filter(v->StrUtil.isNotEmpty(v.getFileUrl())).map(v -> {
             JSONObject item = new JSONObject();
             item.put("fileName", v.getFileName());
             item.put("fileType", v.getFileType());
@@ -116,27 +116,44 @@ public class ConvertServiceImpl implements IConvertService {
         List<FullphotoUprecord> list = fullphotoUprecordService.list(new LambdaQueryWrapper<FullphotoUprecord>().select(FullphotoUprecord::getStationCode, FullphotoUprecord::getEntityId).groupBy(FullphotoUprecord::getStationCode, FullphotoUprecord::getEntityId));
         for (FullphotoUprecord fullphotoUprecord : list) {
 
-            List<FullphotoUprecord> list1 = fullphotoUprecordService.list(
-                    new LambdaQueryWrapper<FullphotoUprecord>()
-                            .eq(FullphotoUprecord::getStationCode, fullphotoUprecord.getStationCode())
-                            .eq(FullphotoUprecord::getEntityId, fullphotoUprecord.getEntityId())
-                            .orderByDesc(FullphotoUprecord::getUpTime));
+            try {
+                List<FullphotoUprecord> list1 = fullphotoUprecordService.list(
+                        new LambdaQueryWrapper<FullphotoUprecord>()
+                                .eq(FullphotoUprecord::getStationCode, fullphotoUprecord.getStationCode())
+                                .eq(FullphotoUprecord::getEntityId, fullphotoUprecord.getEntityId())
+                                .orderByDesc(FullphotoUprecord::getUpTime));
 
-            for(int i = 0; i < list1.size(); i++){
-                FullphotoUprecord fullphotoUprecord1 = list1.get(i);
-                ScenePushDTO scenePushDTO = new ScenePushDTO();
-                scenePushDTO.setStationCode(fullphotoUprecord1.getStationCode());
-                scenePushDTO.setEntityId(fullphotoUprecord1.getEntityId());
-                scenePushDTO.setUpTime(fullphotoUprecord1.getUpTime());
-                scenePushDTO.setUploadId(fullphotoUprecord1.getUploadId());
-                String convertType = null;
-                if(i == 0){
-                    convertType = "upTime";//默认vr系统已经是
-                }else{
-                    convertType = "old";
+                for(int i = 0; i < list1.size(); i++){
+                    FullphotoUprecord fullphotoUprecord1 = list1.get(i);
+                    ScenePushDTO scenePushDTO = new ScenePushDTO();
+                    scenePushDTO.setStationCode(fullphotoUprecord1.getStationCode());
+                    scenePushDTO.setEntityId(fullphotoUprecord1.getEntityId());
+                    scenePushDTO.setUpTime(fullphotoUprecord1.getUpTime());
+                    scenePushDTO.setUploadId(fullphotoUprecord1.getUploadId());
+                    String convertType = null;
+                    Boolean push = false;
+                    if(i == 0){
+                        convertType = "upTime";//默认vr系统已经是
+                        push = true;
+                    }else{
+                        convertType = "old";
+                        List<FullphotoFileindex> objList = fullphotoFileindexService.list(
+                                new LambdaQueryWrapper<FullphotoFileindex>()
+                                        .eq(FullphotoFileindex::getUploadId, fullphotoUprecord1.getUploadId())
+                                        .eq(FullphotoFileindex::getFileType, "11"));
+                        if(CollUtil.isNotEmpty(objList)){
+                            push = true;
+                        }
+                    }
+                    //如果是更新上传时间或者是历史且有obj才推送
+                    if(push){
+                        this.scenePush(scenePushDTO, convertType);
+                    }
                 }
-                this.scenePush(scenePushDTO, convertType);
+            }catch (Exception e){
+                log.warn("资源系统数据异常, stationcode:{}, entityId:{}", fullphotoUprecord.getStationCode(), fullphotoUprecord.getEntityId(), e);
             }
+
         }