From beb5929ea5ac874f256fce08a679a674ef02868a Mon Sep 17 00:00:00 2001
From: Oliver <1070107765@qq.com>
Date: 星期三, 09 十一月 2022 16:21:08 +0800
Subject: [PATCH] bug修改

---
 ycl-platform/src/main/java/com/ycl/controller/region/SccgRegionController.java    |    8 ++
 ycl-platform/src/main/resources/mapper/store/UmsStoreInfoMapper.xml               |    4 
 ycl-platform/src/main/java/com/ycl/vo/store/StoreInfoVO.java                      |    4 +
 ycl-common/src/main/java/com/ycl/utils/common/LiveTimeMillisecond.java            |  153 ++++++++++++++++++++++++--------------
 ycl-platform/src/main/java/com/ycl/controller/store/StoreInfoController.java      |    4 
 ycl-platform/src/main/java/com/ycl/service/region/impl/SccgRegionServiceImpl.java |    2 
 ycl-platform/src/main/java/com/ycl/service/store/impl/StoreInfoServiceImpl.java   |    8 +
 7 files changed, 119 insertions(+), 64 deletions(-)

diff --git a/ycl-common/src/main/java/com/ycl/utils/common/LiveTimeMillisecond.java b/ycl-common/src/main/java/com/ycl/utils/common/LiveTimeMillisecond.java
index de37e99..8a2599d 100644
--- a/ycl-common/src/main/java/com/ycl/utils/common/LiveTimeMillisecond.java
+++ b/ycl-common/src/main/java/com/ycl/utils/common/LiveTimeMillisecond.java
@@ -1,70 +1,109 @@
 package com.ycl.utils.common;
 
 /**
- *   redis缂撳瓨鏃堕棿
- *      鍗曚綅姣
+ * redis缂撳瓨鏃堕棿
+ * 鍗曚綅姣
+ *
  * @version 1.0
  * @date 2022/9/9
  */
 public enum LiveTimeMillisecond {
 
-                     s1(1000),
-                      /** 5绉� */
-                      s5(5000),
-
-                        /** 10绉� */
-                      s10(10000),
-
-                      /** 1鍒嗛挓 */
-                      s60(60000),
-                        /** 2鍒嗛挓 */
-
-                        s120(120000),
-                      /** 3鍒嗛挓*/
-                      s180(180000),
-
-                      /** 5鍒嗛挓*/
-                      s300(300000),
-
-                     /** 10鍒嗛挓 */
-                      s600(600000),
-
-                     /** 30鍒嗛挓 */
-                      s1800(1800000),
-
-                      /** 1灏忔椂 */
-                      s3600(3600000),
-
-                      /** 2灏忔椂 */
-                      s7200(7200000),
-
-                      /** 3灏忔椂 */
-                      s10800(10800000),
-
-                      /** 4灏忔椂 */
-                      s14400(14400000),
-
-                      /** 12灏忔椂 */
-                      s43200(43200000),
-
-                      /** 涓�澶� */
-                      s86400(86400000),
-                        /** 涓夊ぉ*/
-                      s259200000(259200000),
-
-                      /** 涓冨ぉ */
-                      s604800(604800000),
-
-                      /** 30澶�*/
-                      s2592000(2592000000L),
-
-                     /** 60澶�*/
-                     s5184000(5184000000L),
-                     /**180澶�*/
-                     s15552000(15552000000L);
+    s1(1000),
+    /**
+     * 5绉�
+     */
+    s5(5000),
 
     /**
-     *  瓒呮椂鏃堕棿  鍗曚綅绉�
+     * 10绉�
+     */
+    s10(10000),
+
+    /**
+     * 1鍒嗛挓
+     */
+    s60(60000),
+    /**
+     * 2鍒嗛挓
+     */
+
+    s120(120000),
+    /**
+     * 3鍒嗛挓
+     */
+    s180(180000),
+
+    /**
+     * 5鍒嗛挓
+     */
+    s300(300000),
+
+    /**
+     * 10鍒嗛挓
+     */
+    s600(600000),
+
+    /**
+     * 30鍒嗛挓
+     */
+    s1800(1800000),
+
+    /**
+     * 1灏忔椂
+     */
+    s3600(3600000),
+
+    /**
+     * 2灏忔椂
+     */
+    s7200(7200000),
+
+    /**
+     * 3灏忔椂
+     */
+    s10800(10800000),
+
+    /**
+     * 4灏忔椂
+     */
+    s14400(14400000),
+
+    /**
+     * 12灏忔椂
+     */
+    s43200(43200000),
+
+    /**
+     * 涓�澶�
+     */
+    s86400(86400000),
+    /**
+     * 涓夊ぉ
+     */
+    s259200000(259200000),
+
+    /**
+     * 涓冨ぉ
+     */
+    s604800(604800000),
+
+    /**
+     * 30澶�
+     */
+    s2592000(2592000000L),
+
+    /**
+     * 60澶�
+     */
+    s5184000(5184000000L),
+    /**
+     * 180澶�
+     */
+    s15552000(15552000000L);
+
+    /**
+     * 瓒呮椂鏃堕棿  鍗曚綅绉�
      */
     public long time;
 
diff --git a/ycl-platform/src/main/java/com/ycl/controller/region/SccgRegionController.java b/ycl-platform/src/main/java/com/ycl/controller/region/SccgRegionController.java
index d8bb664..c262b31 100644
--- a/ycl-platform/src/main/java/com/ycl/controller/region/SccgRegionController.java
+++ b/ycl-platform/src/main/java/com/ycl/controller/region/SccgRegionController.java
@@ -7,7 +7,9 @@
 import com.ycl.api.CommonResult;
 import com.ycl.controller.BaseController;
 import com.ycl.entity.region.SccgRegion;
+import com.ycl.service.redis.RedisService;
 import com.ycl.service.region.ISccgRegionService;
+import com.ycl.utils.redis.RedisKey;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -32,6 +34,9 @@
 public class SccgRegionController extends BaseController {
 
     @Resource
+    private RedisService redisService;
+
+    @Resource
     private ISccgRegionService iSccgRegionService;
 
     @ApiOperation("鏍戠粨鏋�")
@@ -45,6 +50,7 @@
     @RequestMapping(value = "/addRegion", method = RequestMethod.POST)
     @ResponseBody
     public CommonResult addRegion(@Validated @RequestBody SccgRegion sccgRegion) {
+        redisService.del(RedisKey.SCCG_REGION);
         return CommonResult.success(iSccgRegionService.save(sccgRegion));
     }
 
@@ -70,6 +76,7 @@
     @RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
     @ResponseBody
     public CommonResult update(@PathVariable Long id, @RequestBody SccgRegion sccgRegion) {
+        redisService.del(RedisKey.SCCG_REGION);
         sccgRegion.setId(id);
         boolean success = iSccgRegionService.updateById(sccgRegion);
         if (success) {
@@ -82,6 +89,7 @@
     @RequestMapping(value = "/delete", method = RequestMethod.POST)
     @ResponseBody
     public CommonResult delete(@RequestParam("ids") List<Long> ids) {
+        redisService.del(RedisKey.SCCG_REGION);
         boolean success = iSccgRegionService.removeBatchByIds(ids);
         if (success) {
             return CommonResult.success(null);
diff --git a/ycl-platform/src/main/java/com/ycl/controller/store/StoreInfoController.java b/ycl-platform/src/main/java/com/ycl/controller/store/StoreInfoController.java
index e52aff9..c56b835 100644
--- a/ycl-platform/src/main/java/com/ycl/controller/store/StoreInfoController.java
+++ b/ycl-platform/src/main/java/com/ycl/controller/store/StoreInfoController.java
@@ -59,12 +59,12 @@
     @ApiOperation("鏍规嵁id鑾峰彇闂ㄥ簵淇℃伅")
     @RequestMapping(value = "/{id}", method = RequestMethod.GET)
     @ResponseBody
-    public CommonResult<StoreInfo> getItem(@PathVariable Long id) {
+    public CommonResult<StoreInfoVO> getItem(@PathVariable Long id) {
         StoreInfo storeInfo = storeInfoService.getById(id);
         StoreInfoVO vo = new StoreInfoVO();
         BeanUtils.copyProperties(storeInfo, vo);
         vo.setVideoPoint(videoPointService.getById(storeInfo.getVideoId()));
-        return CommonResult.success(storeInfo);
+        return CommonResult.success(vo);
     }
 
     @ApiOperation(value = "娣诲姞闂ㄥ簵淇℃伅")
diff --git a/ycl-platform/src/main/java/com/ycl/service/region/impl/SccgRegionServiceImpl.java b/ycl-platform/src/main/java/com/ycl/service/region/impl/SccgRegionServiceImpl.java
index 5759491..02929fd 100644
--- a/ycl-platform/src/main/java/com/ycl/service/region/impl/SccgRegionServiceImpl.java
+++ b/ycl-platform/src/main/java/com/ycl/service/region/impl/SccgRegionServiceImpl.java
@@ -51,7 +51,7 @@
                 return item;
             }).collect(Collectors.toList());
             List<SccgRegion> treeData = getTreeData(collect);
-            redisService.set(RedisKey.SCCG_REGION, JSON.toJSONString(treeData), LiveTimeMillisecond.s5184000.time);
+            redisService.set(RedisKey.SCCG_REGION, JSON.toJSONString(treeData), LiveTimeMillisecond.s3600.time);
             return treeData;
         }
         return JSON.parseArray(result, SccgRegion.class);
diff --git a/ycl-platform/src/main/java/com/ycl/service/store/impl/StoreInfoServiceImpl.java b/ycl-platform/src/main/java/com/ycl/service/store/impl/StoreInfoServiceImpl.java
index 24e84a3..e13c468 100644
--- a/ycl-platform/src/main/java/com/ycl/service/store/impl/StoreInfoServiceImpl.java
+++ b/ycl-platform/src/main/java/com/ycl/service/store/impl/StoreInfoServiceImpl.java
@@ -9,6 +9,7 @@
 import com.ycl.enums.common.ResultCode;
 import com.ycl.exception.ApiException;
 import com.ycl.mapper.store.StoreInfoMapper;
+import com.ycl.mapper.video.VideoPointMapper;
 import com.ycl.service.store.StoreInfoService;
 import com.ycl.utils.ExcelUtils;
 import com.ycl.vo.store.StoreInfoExcelVo;
@@ -38,13 +39,18 @@
     @Resource
     StoreInfoMapper storeInfoMapper;
 
+    @Resource
+    VideoPointMapper videoPointMapper;
+
 
     @Override
     public Page<StoreInfoVO> list(String keyword, Integer pageSize, Integer pageNum) {
         Page<StoreInfo> storeInfoPage = new Page<>();
         storeInfoPage.setSize(pageSize);
         storeInfoPage.setCurrent(pageNum);
-        return storeInfoMapper.selectStorePage(storeInfoPage,keyword);
+        Page<StoreInfoVO> page = storeInfoMapper.selectStorePage(storeInfoPage, keyword);
+        page.getRecords().forEach(x->x.setVideoPoint(videoPointMapper.selectById(x.getVideoId())));
+        return page;
     }
 
     @Override
diff --git a/ycl-platform/src/main/java/com/ycl/vo/store/StoreInfoVO.java b/ycl-platform/src/main/java/com/ycl/vo/store/StoreInfoVO.java
index f3829b9..d4b73db 100644
--- a/ycl-platform/src/main/java/com/ycl/vo/store/StoreInfoVO.java
+++ b/ycl-platform/src/main/java/com/ycl/vo/store/StoreInfoVO.java
@@ -81,6 +81,10 @@
     @TableField("description")
     private String description;
 
+    @ApiModelProperty("鎽勫儚澶碔D")
+    @TableField("video_id")
+    private String videoId;
+
     @ApiModelProperty("鎽勫儚澶�")
     private VideoPoint videoPoint;
 }
diff --git a/ycl-platform/src/main/resources/mapper/store/UmsStoreInfoMapper.xml b/ycl-platform/src/main/resources/mapper/store/UmsStoreInfoMapper.xml
index 1c956d7..abc4a0c 100644
--- a/ycl-platform/src/main/resources/mapper/store/UmsStoreInfoMapper.xml
+++ b/ycl-platform/src/main/resources/mapper/store/UmsStoreInfoMapper.xml
@@ -17,12 +17,10 @@
     <select id="selectStorePage" resultType="com.ycl.vo.store.StoreInfoVO">
         SELECT
             t1.*,
-            t2.`name` as typeName,
-            t3.*
+            t2.`name` as typeName
         FROM
             ums_store_store_info t1
             left JOIN ums_data_dictionary t2 ON t1.type = t2.id
-            left JOIN ums_video_point t3 ON t1.video_id = t3.id
         <where>
             <if test="keyword!=null and keyword!=''">
                 t1.store_name LIKE  CONCAT('%', #{keyword}, '%')

--
Gitblit v1.8.0