lyhzzz 1 mesiac pred
rodič
commit
7f79726eaa

+ 1 - 1
pom.xml

@@ -107,7 +107,7 @@
         </dependency>
         <dependency>
             <groupId>com.fdkankan</groupId>
-            <artifactId>4dkankan-utils-fyun-s3</artifactId>
+            <artifactId>4dkankan-utils-fyun-oss</artifactId>
             <version>3.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>

+ 10 - 9
src/main/java/com/fdkankan/fusion/httpClient/SignInterceptor.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.dtflys.forest.http.ForestRequest;
 import com.dtflys.forest.interceptor.Interceptor;
 import com.dtflys.forest.reflection.ForestMethod;
+import com.fdkankan.sign.RsaUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -16,17 +17,17 @@ import java.util.Date;
 @Slf4j
 public class SignInterceptor implements Interceptor<JSONObject> {
 
-//    @Value("${fusion.sign.publicKey}")
-//    public String publicKey;
-//    @Value("${fusion.sign.appid}")
-//    public String appId;
+    @Value("${fusion.sign.publicKey}")
+    public String publicKey;
+    @Value("${fusion.sign.appid}")
+    public String appId;
     @Override
     public void onInvokeMethod(ForestRequest request, ForestMethod method, Object[] args) {
-//        JSONObject playload = new JSONObject();
-//        playload.put("appId", appId);
-//        playload.put("timestamp", new Date().getTime());
-//        request.addHeader("appId", appId);
-//        request.addHeader("sign", RsaUtils.encipher(playload.toJSONString(), publicKey));
+        JSONObject playload = new JSONObject();
+        playload.put("appId", appId);
+        playload.put("timestamp", new Date().getTime());
+        request.addHeader("appId", appId);
+        request.addHeader("sign", RsaUtils.encipher(playload.toJSONString(), publicKey));
 
     }
 }

+ 184 - 0
src/main/java/com/fdkankan/fusion/task/TaskService.java

@@ -70,6 +70,190 @@ public class TaskService {
             }
         }
 
+        updateFusion();
+        updateCaseSetting();
+        updateHotIcon();
+        updateCaseTag();
+        updateGuide();
+        updatePath();
+        updateAnimation();
+        updateImg();
+        updateImgTag();
+    }
+
+    private void updateImg() {
+        LambdaQueryWrapper<CaseImg> wrapper = new LambdaQueryWrapper<>();
+        wrapper.isNull(CaseImg::getParentId);
+        wrapper.eq(CaseImg::getType,0);
+        List<CaseImg> list = caseImgService.list();
+        if(list.isEmpty()){
+            return;
+        }
+        for (CaseImg caseImg : list) {
+            List<CaseImg> caseImgList = caseImgService.getByCaseId(caseImg.getCaseId(), 1);
+            if(caseImgList.isEmpty()){
+                continue;
+            }
+            CaseImg parent = caseImgList.get(0);
+            caseImg.setParentId(parent.getId());
+            caseImgService.updateById(caseImg);
+        }
+
+    }
+
+    private void updateImgTag() {
+
+        LambdaQueryWrapper<CaseImgTag> wrapper = new LambdaQueryWrapper<>();
+        wrapper.isNull(CaseImgTag::getImgId);
+        List<CaseImgTag> list2 = caseImgTagService.list(wrapper);
+        if(list2.isEmpty()){
+            return;
+        }
+        for (CaseImgTag caseImgTag : list2) {
+            List<CaseImg> caseImgList = caseImgService.getByCaseId(caseImgTag.getCaseId(), 1);
+            if(caseImgList.isEmpty()){
+                continue;
+            }
+            CaseImg caseImg = caseImgList.get(0);
+            caseImgTag.setImgId(caseImg.getId());
+            caseImgTagService.updateById(caseImgTag);
+        }
+    }
+
+    private void updateFusion(){
+        List<CaseFusion> list = caseFusionService.list();
+        List<CaseFusion> collect = list.stream().filter(e -> e.getSysUserId() == null).collect(Collectors.toList());
+        for (CaseFusion caseFusion : collect) {
+            CaseEntity caseEntity = caseService.getById(caseFusion.getCaseId());
+            if(caseEntity != null){
+                caseFusion.setFusionTitle(caseEntity.getCaseTitle());
+                caseFusion.setLatAndLong(caseEntity.getLatAndLong());
+                TmUser tmUser = tmUserService.getByUserName(caseEntity.getUserName());
+                if(tmUser != null){
+                    caseFusion.setSysUserId(tmUser.getId());
+                }
+                caseFusionService.updateById(caseFusion);
+            }
+        }
+        List<CaseFusion> collect1 = list.stream().filter(e -> e.getCaseId() != null).collect(Collectors.toList());
+        for (CaseFusion caseFusion : collect1) {
+            List<CaseFusionRelation> caseFusionRelations = caseFusionRelationService.getByCaseId(caseFusion.getCaseId());
+            if(caseFusionRelations == null || caseFusionRelations.isEmpty()){
+                CaseFusionRelation caseFusionRelation = new CaseFusionRelation();
+                caseFusionRelation.setCaseId(caseFusion.getCaseId());
+                caseFusionRelation.setFusionId(caseFusion.getFusionId());
+                caseFusionRelationService.save(caseFusionRelation);
+            }
+            LambdaUpdateWrapper<CaseFusion> wrapper = new LambdaUpdateWrapper<>();
+            wrapper.eq(CaseFusion::getFusionId,caseFusion.getFusionId());
+            wrapper.set(CaseFusion::getCaseId,null);
+            caseFusionService.update(wrapper);
+        }
+    }
+
+    @Autowired
+    ICaseFilesTypeService caseFilesTypeService;
+    @Autowired
+    IHotIconService hotIconService;
+    @Autowired
+    IDictService dictService;
+    @Autowired
+    ICommonUploadService commonUploadService;
+    @Autowired
+    IDictFileService dictFileService;
+
+
+    private void updateCaseSetting() {
+        List<CaseSettings> list = caseSettingsService.list();
+        List<CaseSettings> collect = list.stream().filter(e -> e.getFusionId() == null).collect(Collectors.toList());
+        for (CaseSettings caseSettings : collect) {
+            List<CaseFusion> listByCaseId = caseFusionService.getListByCaseId(caseSettings.getCaseId());
+            if(!listByCaseId.isEmpty()){
+                LambdaUpdateWrapper<CaseSettings> wrapper = new LambdaUpdateWrapper<>();
+                wrapper.eq(CaseSettings::getSettingsId,caseSettings.getSettingsId());
+                wrapper.set(CaseSettings::getFusionId,listByCaseId.get(0).getFusionId());
+                caseSettingsService.update(wrapper);
+            }
+        }
+    }
+
+    private void updateHotIcon() {
+        List<HotIcon> list = hotIconService.list();
+        List<HotIcon> collect = list.stream().filter(e -> e.getFusionId() == null).collect(Collectors.toList());
+        for (HotIcon entity : collect) {
+            List<CaseFusion> listByCaseId = caseFusionService.getListByCaseId(entity.getCaseId());
+            if(!listByCaseId.isEmpty()){
+                LambdaUpdateWrapper<HotIcon> wrapper = new LambdaUpdateWrapper<>();
+                wrapper.eq(HotIcon::getIconId,entity.getIconId());
+                wrapper.set(HotIcon::getFusionId,listByCaseId.get(0).getFusionId());
+                hotIconService.update(wrapper);
+            }
+        }
+    }
+    @Autowired
+    ICaseTagService caseTagService;
+    private void updateCaseTag() {
+        List<CaseTag> list = caseTagService.list();
+        List<CaseTag> collect = list.stream().filter(e -> e.getFusionId() == null).collect(Collectors.toList());
+        for (CaseTag entity : collect) {
+            List<CaseFusion> listByCaseId = caseFusionService.getListByCaseId(entity.getCaseId());
+            if(!listByCaseId.isEmpty()){
+                LambdaUpdateWrapper<CaseTag> wrapper = new LambdaUpdateWrapper<>();
+                wrapper.eq(CaseTag::getTagId,entity.getTagId());
+                wrapper.set(CaseTag::getFusionId,listByCaseId.get(0).getFusionId());
+                caseTagService.update(wrapper);
+            }
+        }
+    }
+
+    @Autowired
+    IFusionGuideService fusionGuideService;
+    private void updateGuide() {
+        List<FusionGuide> list = fusionGuideService.list();
+        List<FusionGuide> collect = list.stream().filter(e -> e.getFusionId() == null).collect(Collectors.toList());
+        for (FusionGuide entity : collect) {
+            List<CaseFusion> listByCaseId = caseFusionService.getListByCaseId(entity.getCaseId());
+            if(!listByCaseId.isEmpty()){
+                LambdaUpdateWrapper<FusionGuide> wrapper = new LambdaUpdateWrapper<>();
+                wrapper.eq(FusionGuide::getFusionGuideId,entity.getFusionGuideId());
+                wrapper.set(FusionGuide::getFusionId,listByCaseId.get(0).getFusionId());
+                fusionGuideService.update(wrapper);
+            }
+        }
+    }
+
+
+    @Autowired
+    ICasePathService casePathService;
+    private void updatePath() {
+        List<CasePath> list = casePathService.list();
+        List<CasePath> collect = list.stream().filter(e -> e.getFusionId() == null).collect(Collectors.toList());
+        for (CasePath entity : collect) {
+            List<CaseFusion> listByCaseId = caseFusionService.getListByCaseId(entity.getCaseId());
+            if(!listByCaseId.isEmpty()){
+                LambdaUpdateWrapper<CasePath> wrapper = new LambdaUpdateWrapper<>();
+                wrapper.eq(CasePath::getId,entity.getId());
+                wrapper.set(CasePath::getFusionId,listByCaseId.get(0).getFusionId());
+                casePathService.update(wrapper);
+            }
+        }
+    }
+
+    @Autowired
+    ICaseAnimationService caseAnimationService;
+    private void updateAnimation() {
+        List<CaseAnimation> list = caseAnimationService.list();
+        List<CaseAnimation> collect = list.stream().filter(e -> e.getFusionId() == null).collect(Collectors.toList());
+        for (CaseAnimation entity : collect) {
+            List<CaseFusion> listByCaseId = caseFusionService.getListByCaseId(entity.getCaseId());
+            if(!listByCaseId.isEmpty()){
+                LambdaUpdateWrapper<CaseAnimation> wrapper = new LambdaUpdateWrapper<>();
+                wrapper.eq(CaseAnimation::getId,entity.getId());
+                wrapper.set(CaseAnimation::getFusionId,listByCaseId.get(0).getFusionId());
+                caseAnimationService.update(wrapper);
+            }
+        }
     }
 
 }
+

+ 2 - 2
src/main/resources/bootstrap-dl.yml

@@ -4,9 +4,9 @@ spring:
   cloud:
     nacos:
       config:
-        server-addr: 127.0.0.1:8848
+        server-addr: 172.20.1.63:8848
         file-extension: yaml
-        namespace: test
+        namespace: 4dkankan-v4-prod
         extension-configs:
           - data-id: 4dkankan-fusion.yaml
             group: DEFAULT_GROUP

+ 31 - 0
src/main/resources/bootstrap-test.yml

@@ -0,0 +1,31 @@
+spring:
+  application:
+    name: 4dkankan-fusion
+  cloud:
+    nacos:
+      config:
+        server-addr: 172.18.156.39:8848
+        file-extension: yaml
+        namespace: 4dkankan-v4-test
+        extension-configs:
+          - data-id: 4dkankan-fusion.yaml
+            group: DEFAULT_GROUP
+            refresh: true
+          - data-id: common-rabbitmq-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
+          - data-id: forest-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
+          - data-id: common-redis-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
+          - data-id: common-fyun-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
+      discovery:
+        server-addr: ${spring.cloud.nacos.config.server-addr}
+        namespace: ${spring.cloud.nacos.config.namespace}
+
+
+