lyhzzz 3 days ago
parent
commit
e0fa72f095

+ 1 - 1
src/main/java/com/fdkankan/fusion/controller/CaseTagController.java

@@ -35,7 +35,7 @@ public class CaseTagController {
     @PostMapping("/add")
     public ResultData add(@RequestBody CaseTag caseTag){
         if(caseTag.getHotIconId()==null ||  StringUtils.isEmpty(caseTag.getHotIconUrl())
-              ||caseTag.getCaseId() == null  || StringUtils.isEmpty(caseTag.getTagTitle())){
+              ||caseTag.getFusionId() == null  || StringUtils.isEmpty(caseTag.getTagTitle())){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
         //新增时取消icon上次使用标识,增加使用次数,设置新的上次使用标识

+ 26 - 0
src/main/java/com/fdkankan/fusion/task/InitService.java

@@ -6,6 +6,7 @@ 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.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.fdkankan.fusion.common.util.LocalToOssUtil;
 import com.fdkankan.fusion.common.util.MyFileUtils;
 import com.fdkankan.fusion.config.CacheUtil;
@@ -56,8 +57,10 @@ public class InitService {
         writerStateFile();
         delRedisKey();
         cleanRedisKey();
+        updateHotIcon();
     }
 
+
     public void getSettingJson() {
         CacheUtil.settingPath = settingPath;
         String s = FileUtil.readUtf8String(new File(settingPath));
@@ -214,5 +217,28 @@ public class InitService {
         }
 
     }
+    private void updateHotIcon() {
+        LambdaQueryWrapper<HotIcon> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(HotIcon::getIconTitle,"其他");
+        List<HotIcon> list = hotIconService.list(wrapper);
+        if(list.isEmpty()){
+            HotIcon hotIcon = new HotIcon();
+            hotIcon.setIconTitle("其他");
+            hotIcon.setIsSystem(1);
+            hotIcon.setSort(2);
+            hotIconService.save(hotIcon);
+
+            List<HotIcon> list1 = hotIconService.list();
+            for (HotIcon icon : list1) {
+                if(icon.getIconId().equals(hotIcon.getIconId())){
+                    continue;
+                }
+                icon.setParentId(hotIcon.getIconId());
+                hotIconService.updateById(icon);
+
+            }
+
+        }
+    }
 
 }