瀏覽代碼

增加静态文件路径

xiewenjie 3 年之前
父節點
當前提交
b53631eae1

+ 49 - 7
sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/testController.java

@@ -2,10 +2,15 @@ package com.fdkk.sxz.webApi.controller;
 
 import cn.hutool.core.collection.CollUtil;
 import com.fdkk.sxz.base.BaseController;
+import com.fdkk.sxz.base.Result;
+import com.fdkk.sxz.entity.RenovationPartsDetailEntity;
+import com.fdkk.sxz.entity.custuom.CustomComponentEntity;
 import com.fdkk.sxz.entity.custuom.CustomProductFirstclassifyEntity;
 import com.fdkk.sxz.util.OkHttpUtils;
 import com.fdkk.sxz.util.RedisUtil;
-import com.fdkk.sxz.base.Result;
+import com.fdkk.sxz.util.UploadToOssUtil;
+import com.fdkk.sxz.webApi.service.IRenovationPartsDetailService;
+import com.fdkk.sxz.webApi.service.custom.ICustomComponentService;
 import com.fdkk.sxz.webApi.service.custom.ICustomProductFirstclassifyService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -18,7 +23,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.Arrays;
+import java.util.List;
 
 @Slf4j
 @RestController
@@ -35,6 +40,41 @@ public class testController extends BaseController {
     @Autowired
     private CacheChannel cacheChannel;
 
+    @Autowired
+    private IRenovationPartsDetailService renovationPartsDetailService;
+
+    @Autowired
+    private UploadToOssUtil uploadToOssUtil;
+
+    @Autowired
+    private ICustomComponentService customComponentService;
+
+
+    /**
+     * 替换所有为空的路径
+     *
+     * @return
+     */
+    @ApiOperation("cleanMviewPath")
+    @RequestMapping(value = "/cleanMviewPath", method = RequestMethod.POST)
+
+    public Result cleanMviewPath() {
+        List<RenovationPartsDetailEntity> list = renovationPartsDetailService.list();
+        for (RenovationPartsDetailEntity renovationPartsDetailEntity : list) {
+            if (!uploadToOssUtil.existFileToOSS(renovationPartsDetailEntity.getMviewPath(), "4d-tjw")) {
+                renovationPartsDetailEntity.setMviewPath(null);
+                renovationPartsDetailService.updateById(renovationPartsDetailEntity);
+            }
+        }
+        List<CustomComponentEntity> list1 = customComponentService.list();
+        for (CustomComponentEntity customComponentEntity : list1) {
+            if (!uploadToOssUtil.existFileToOSS(customComponentEntity.getMviewPath(), "4d-tjw")) {
+                customComponentEntity.setMviewPath(null);
+                customComponentService.updateById(customComponentEntity);
+            }
+        }
+        return success();
+    }
 
     /**
      * 测试redis
@@ -52,6 +92,7 @@ public class testController extends BaseController {
         redisUtil.set(key, val);
         return success(redisUtil.get(key));
     }
+
     /**
      * 测试redis
      *
@@ -65,19 +106,20 @@ public class testController extends BaseController {
     @RequestMapping(value = "/jetcache", method = RequestMethod.POST)
     public Result jetcache(Long id) {
         CustomProductFirstclassifyEntity byId = customProductFirstclassifyService.findById(id);
-        byId.setName(byId.getName()+"1");
-        cacheChannel.get("CustomProductFirstclassifyEntity","3CustomProductFirstclassifyEntity");
+        byId.setName(byId.getName() + "1");
+        cacheChannel.get("CustomProductFirstclassifyEntity", "3CustomProductFirstclassifyEntity");
 
 
-        CustomProductFirstclassifyEntity byId1 = customProductFirstclassifyService.findById(id+1);
+        CustomProductFirstclassifyEntity byId1 = customProductFirstclassifyService.findById(id + 1);
 
-         customProductFirstclassifyService.updateById(byId);
+        customProductFirstclassifyService.updateById(byId);
 
 //        customProductFirstclassifyService.removeById(byId.getId());
-        cacheChannel.set("asd", "AAA",123);
+        cacheChannel.set("asd", "AAA", 123);
 
         return success(CollUtil.newArrayList(byId, byId1));
     }
+
     /**
      * 测试redis
      *

+ 6 - 3
sxz-core/src/main/java/com/fdkk/sxz/webApi/mapper/IRenovationPartsDetailMapper.java

@@ -18,7 +18,8 @@ import java.util.List;
 public interface IRenovationPartsDetailMapper extends IBaseMapper<RenovationPartsDetailEntity> {
 
     @Select("<script>" +
-            "select id, key_word as keyWord, type, description, img, high_img as highImg, path, name, zh_name as zhName, parts_type_id as partsTypeId, has_toolbag as hasToolbag " +
+            "select id, key_word as keyWord, type, description, img, high_img as highImg, path, name, zh_name as zhName, parts_type_id as partsTypeId, has_toolbag as hasToolbag ,mview_path as " +
+            "mviewPath " +
             "from tb_renovation_parts_detail where parts_type_id = #{partsTypeId} and rec_status = 'A' and is_show = 1 and examine = 1" +
             "<if test= 'colorId != null'> " +
             " and parts_color_id = #{colorId} " +
@@ -29,10 +30,12 @@ public interface IRenovationPartsDetailMapper extends IBaseMapper<RenovationPart
             "</script>")
     List<ResponseRenovationPartsDetail> findDetailByTypeId(@Param("partsTypeId") Long partsTypeId, @Param("colorId") Long colorId, @Param("classifyId") Long classifyId);
 
-    @Select("select id, key_word as keyWord, type, description, img, high_img as highImg, path, name, zh_name as zhName, has_toolbag as hasToolbag from tb_renovation_parts_detail where name = #{name} and rec_status = 'A' and is_show = 1 and examine = 1 ")
+    @Select("select id, key_word as keyWord, type, description, img, high_img as highImg, path, name, zh_name as zhName, has_toolbag as hasToolbag from tb_renovation_parts_detail where name = " +
+            "#{name} and rec_status = 'A' and is_show = 1 and examine = 1 ")
     ResponseRenovationPartsDetail findByName(String name);
 
-    @Select("select id,parts_type_id AS partsTypeId, key_word as keyWord, type, description, img, high_img as highImg, path, name, zh_name as zhName, has_toolbag as hasToolbag from tb_renovation_parts_detail where key_word like CONCAT('%', #{keyWord}, '%') and rec_status = 'A' and is_show = 1 and examine = 1 ")
+    @Select("select id,parts_type_id AS partsTypeId, key_word as keyWord, type, description, img, high_img as highImg, path, name, zh_name as zhName, has_toolbag as hasToolbag from " +
+            "tb_renovation_parts_detail where key_word like CONCAT('%', #{keyWord}, '%') and rec_status = 'A' and is_show = 1 and examine = 1 ")
     List<ResponseRenovationPartsDetail> findByKeyWord(String keyWord);
 
     @Select("<script> " +

+ 2 - 0
sxz-modules/src/main/java/com/fdkk/sxz/vo/response/ResponseRenovationPartsDetail.java

@@ -33,4 +33,6 @@ public class ResponseRenovationPartsDetail {
     private ResponseRenovationPartsSize size;
 
     private Integer hasToolbag;
+
+    private String mviewPath = "";
 }