|
@@ -1,15 +1,13 @@
|
|
|
package com.fdkankan.fusion.task;
|
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.fdkankan.fusion.common.util.DateUtils;
|
|
|
import com.fdkankan.fusion.common.util.UploadToOssUtil;
|
|
|
-import com.fdkankan.fusion.entity.CaseLive;
|
|
|
-import com.fdkankan.fusion.entity.CommonUpload;
|
|
|
-import com.fdkankan.fusion.service.ICaseLiveService;
|
|
|
-import com.fdkankan.fusion.service.ICommonUploadService;
|
|
|
-import com.fdkankan.fusion.service.IDictFileService;
|
|
|
-import com.fdkankan.fusion.service.IDictService;
|
|
|
+import com.fdkankan.fusion.entity.*;
|
|
|
+import com.fdkankan.fusion.service.*;
|
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
|
+import io.netty.util.internal.UnstableApi;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
@@ -31,6 +29,10 @@ public class TaskService {
|
|
|
|
|
|
@Autowired
|
|
|
ICaseLiveService caseLiveService;
|
|
|
+ @Autowired
|
|
|
+ ICaseSettingsService caseSettingsService;
|
|
|
+ @Autowired
|
|
|
+ ICaseFusionService caseFusionService;
|
|
|
|
|
|
|
|
|
@Autowired
|
|
@@ -46,8 +48,15 @@ public class TaskService {
|
|
|
}
|
|
|
|
|
|
checkSystemModel();
|
|
|
+ updateCaseSetting();
|
|
|
+ updateHotIcon();
|
|
|
+ updateCaseTag();
|
|
|
+ updateGuide();
|
|
|
+ updatePath();
|
|
|
+ updateAnimation();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Autowired
|
|
|
ICommonUploadService commonUploadService;
|
|
|
@Autowired
|
|
@@ -86,4 +95,99 @@ public class TaskService {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @Autowired
|
|
|
+ IHotIconService hotIconService;
|
|
|
+
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|