From a4047b6048ebfe09e66a765b58ea12b5bd0e2e6e Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期一, 28 十一月 2022 16:18:10 +0800
Subject: [PATCH] 店铺管理优化

---
 ycl-platform/src/main/java/com/ycl/entity/store/StoreInfo.java                  |    2 
 ycl-platform/src/main/java/com/ycl/vo/store/StoreInfoVO.java                    |    4 
 ycl-platform/src/main/java/com/ycl/service/store/StoreInfoService.java          |   11 ++-
 ycl-platform/src/main/java/com/ycl/controller/store/StoreInfoController.java    |   20 +++++-
 ycl-platform/src/main/java/com/ycl/entity/store/StoreScoreRule.java             |    2 
 ycl-platform/src/main/java/com/ycl/entity/store/StoreScore.java                 |   57 +++++++++++++++++++
 ycl-common/src/main/java/com/ycl/vo/store/StoreScoreRuleVO.java                 |    2 
 ycl-platform/src/main/java/com/ycl/dto/store/UmsStoreInfoParam.java             |    7 +-
 ycl-platform/src/main/java/com/ycl/mapper/store/StoreScoreMapper.java           |   17 +++++
 ycl-platform/src/main/java/com/ycl/service/store/impl/StoreInfoServiceImpl.java |   21 ++++++-
 ycl-platform/src/main/resources/mapper/store/StoreScoreMapper.xml               |   17 +++++
 11 files changed, 141 insertions(+), 19 deletions(-)

diff --git a/ycl-common/src/main/java/com/ycl/vo/store/StoreScoreRuleVO.java b/ycl-common/src/main/java/com/ycl/vo/store/StoreScoreRuleVO.java
index af5e190..80af2d7 100644
--- a/ycl-common/src/main/java/com/ycl/vo/store/StoreScoreRuleVO.java
+++ b/ycl-common/src/main/java/com/ycl/vo/store/StoreScoreRuleVO.java
@@ -21,6 +21,6 @@
 
         @NotBlank(message = "鎵e垎椤逛笉鑳戒负绌�")
         @ApiModelProperty("鎵i櫎鍒嗘暟")
-        private BigDecimal markScore;
+        private Double markScore;
     }
 }
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 f85e5ab..2657d6e 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
@@ -8,6 +8,7 @@
 import com.ycl.controller.video.common.util.UtilNumber;
 import com.ycl.dto.store.UmsStoreInfoParam;
 import com.ycl.entity.store.StoreInfo;
+import com.ycl.entity.store.StoreScore;
 import com.ycl.service.store.StoreInfoService;
 import com.ycl.service.video.impl.IVideoPointService;
 import com.ycl.vo.store.StoreInfoVO;
@@ -75,16 +76,16 @@
     public CommonResult<StoreInfo> add(@Validated @RequestBody UmsStoreInfoParam umsStoreInfoParam) {
         StoreInfo storeInfo = StoreInfo.builder()
                 .owner(umsStoreInfoParam.getOwner())
-                .storeName(umsStoreInfoParam.getStorename())
+                .storeName(umsStoreInfoParam.getStoreName())
                 .contact(umsStoreInfoParam.getContact())
-                .storeAddress(umsStoreInfoParam.getStoreaddr())
+                .storeAddress(umsStoreInfoParam.getStoreAddress())
                 .storePhoto(umsStoreInfoParam.getStorephoto())
                 .idCardInfo(umsStoreInfoParam.getIdcardinfo())
                 .storeNumber(utilNumber.createShopCode())
-                .storeScore(umsStoreInfoParam.getStorescore())
                 .type(umsStoreInfoParam.getType())
                 .description(umsStoreInfoParam.getDescription())
-                .videoId(umsStoreInfoParam.getVideoId())
+                .videoId(umsStoreInfoParam.getRelationVideo())
+                .storeScore(100.0)
                 .build();
         boolean success = storeInfoService.save(storeInfo);
         if (success) {
@@ -132,5 +133,16 @@
             return CommonResult.failed();
         }
     }
+
+    @ApiOperation("鏍规嵁id鑾峰彇闂ㄥ簵绉垎璇︽儏")
+    @RequestMapping(value = "/{id}/storeScore", method = RequestMethod.GET)
+    @ResponseBody
+    @LogSave(operationType = "闂ㄥ簵绉垎璇︽儏", contain = "闂ㄥ簵绉垎璇︽儏")
+    public CommonResult<Page<StoreScore>> getScoreList(@PathVariable Long id,
+                                                       @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
+                                                       @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
+        Page<StoreScore> page = storeInfoService.getScoreList(id, pageSize, pageNum);
+        return CommonResult.success(page);
+    }
 }
 
diff --git a/ycl-platform/src/main/java/com/ycl/dto/store/UmsStoreInfoParam.java b/ycl-platform/src/main/java/com/ycl/dto/store/UmsStoreInfoParam.java
index 9d449bd..25bb703 100644
--- a/ycl-platform/src/main/java/com/ycl/dto/store/UmsStoreInfoParam.java
+++ b/ycl-platform/src/main/java/com/ycl/dto/store/UmsStoreInfoParam.java
@@ -23,7 +23,7 @@
 
     @NotBlank(message = "闂ㄥ簵鍚嶇О涓嶈兘涓虹┖")
     @ApiModelProperty("闂ㄥ簵鍚嶇О")
-    private String storename;
+    private String storeName;
 
     @NotBlank(message = "鎵嬫満鍙蜂笉鑳戒负绌�")
     @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "鎵嬫満鍙锋牸寮忔湁璇�")
@@ -31,7 +31,7 @@
     private String contact;
 
     @ApiModelProperty("鍦板潃")
-    private String storeaddr;
+    private String storeAddress;
 
     @ApiModelProperty("鐓х墖")
     private String storephoto;
@@ -51,6 +51,5 @@
     private String description;
 
     @ApiModelProperty("鎽勫儚澶�")
-    @TableField("video_id")
-    private String videoId;
+    private String relationVideo;
 }
diff --git a/ycl-platform/src/main/java/com/ycl/entity/store/StoreInfo.java b/ycl-platform/src/main/java/com/ycl/entity/store/StoreInfo.java
index dfcb354..611099d 100644
--- a/ycl-platform/src/main/java/com/ycl/entity/store/StoreInfo.java
+++ b/ycl-platform/src/main/java/com/ycl/entity/store/StoreInfo.java
@@ -67,7 +67,7 @@
 
     @ApiModelProperty("闂ㄥ簵绉垎")
     @TableField("store_score")
-    private BigDecimal storeScore;
+    private Double storeScore;
 
     @ApiModelProperty("鍏宠仈鎽勫儚鐐逛綅")
     @TableField(" relation_video")
diff --git a/ycl-platform/src/main/java/com/ycl/entity/store/StoreScore.java b/ycl-platform/src/main/java/com/ycl/entity/store/StoreScore.java
new file mode 100644
index 0000000..277a933
--- /dev/null
+++ b/ycl-platform/src/main/java/com/ycl/entity/store/StoreScore.java
@@ -0,0 +1,57 @@
+package com.ycl.entity.store;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * @author admin
+ */
+@Data
+@TableName("ums_store_score")
+@NoArgsConstructor
+@AllArgsConstructor
+@ApiModel(value = "StoreScore瀵硅薄", description = "")
+@Builder
+public class StoreScore implements Serializable {
+
+    @ApiModelProperty("涓婚敭")
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @ApiModelProperty("storeId")
+    @TableField(value = "store_id")
+    private Integer storeId;
+
+    @ApiModelProperty("ruleId")
+    @TableField(value = "rule_id")
+    private Integer ruleId;
+
+    @ApiModelProperty("瑙勫垯绫诲埆")
+    @TableField(value = "category")
+    private String category;
+
+    @ApiModelProperty("鎵e垎椤�")
+    @TableField(value = "deduction_item")
+    private String deductionItem;
+
+    @ApiModelProperty("鎵i櫎鍒嗘暟")
+    @TableField(value = "mark_score")
+    private Double markScore;
+
+    @TableField(value = "create_time")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private LocalDateTime createTime;
+}
diff --git a/ycl-platform/src/main/java/com/ycl/entity/store/StoreScoreRule.java b/ycl-platform/src/main/java/com/ycl/entity/store/StoreScoreRule.java
index a42497d..0103ebc 100644
--- a/ycl-platform/src/main/java/com/ycl/entity/store/StoreScoreRule.java
+++ b/ycl-platform/src/main/java/com/ycl/entity/store/StoreScoreRule.java
@@ -41,7 +41,7 @@
     private String deductionItem;
 
     @ApiModelProperty("鎵i櫎鍒嗘暟")
-    private BigDecimal markScore;
+    private Double markScore;
 
 
 }
diff --git a/ycl-platform/src/main/java/com/ycl/mapper/store/StoreScoreMapper.java b/ycl-platform/src/main/java/com/ycl/mapper/store/StoreScoreMapper.java
new file mode 100644
index 0000000..8ec8210
--- /dev/null
+++ b/ycl-platform/src/main/java/com/ycl/mapper/store/StoreScoreMapper.java
@@ -0,0 +1,17 @@
+package com.ycl.mapper.store;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ycl.entity.store.StoreScore;
+import com.ycl.entity.store.StoreScoreRule;
+
+/**
+ * <p>
+ * 鍟嗛摵绉垎绠$悊 Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author lyq
+ * @since 2022-09-14
+ */
+public interface StoreScoreMapper extends BaseMapper<StoreScore> {
+
+}
diff --git a/ycl-platform/src/main/java/com/ycl/service/store/StoreInfoService.java b/ycl-platform/src/main/java/com/ycl/service/store/StoreInfoService.java
index 93bea65..9fd9bd0 100644
--- a/ycl-platform/src/main/java/com/ycl/service/store/StoreInfoService.java
+++ b/ycl-platform/src/main/java/com/ycl/service/store/StoreInfoService.java
@@ -3,12 +3,13 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ycl.entity.store.StoreInfo;
+import com.ycl.entity.store.StoreScore;
 import com.ycl.vo.store.StoreInfoVO;
 import org.springframework.web.multipart.MultipartFile;
 
 /**
  * <p>
- *  鏈嶅姟绫�
+ * 鏈嶅姟绫�
  * </p>
  *
  * @author lyq
@@ -17,17 +18,21 @@
 public interface StoreInfoService extends IService<StoreInfo> {
     /**
      * 鏍规嵁闂ㄥ簵鍚嶇О鍒嗛〉鑾峰彇闂ㄥ簵鍒楄〃鍒楄〃
-     * @param keyword 鍏抽敭瀛�
+     *
+     * @param keyword  鍏抽敭瀛�
      * @param pageSize 椤甸潰澶у皬
-     * @param pageNum 椤电爜
+     * @param pageNum  椤电爜
      * @return 鍒嗛〉瀹炰綋
      */
     Page<StoreInfoVO> list(String keyword, Integer pageSize, Integer pageNum);
 
     /**
      * 璇诲彇excel鏂囦欢鍔ㄦ�佸姞杞芥枃浠�
+     *
      * @param file
      * @return
      */
     boolean addByExcel(MultipartFile file);
+
+    Page<StoreScore> getScoreList(Long storeId, Integer pageSize, Integer pageNum);
 }
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 e13c468..5cf17d1 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
@@ -6,9 +6,11 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ycl.entity.store.StoreInfo;
+import com.ycl.entity.store.StoreScore;
 import com.ycl.enums.common.ResultCode;
 import com.ycl.exception.ApiException;
 import com.ycl.mapper.store.StoreInfoMapper;
+import com.ycl.mapper.store.StoreScoreMapper;
 import com.ycl.mapper.video.VideoPointMapper;
 import com.ycl.service.store.StoreInfoService;
 import com.ycl.utils.ExcelUtils;
@@ -42,6 +44,9 @@
     @Resource
     VideoPointMapper videoPointMapper;
 
+    @Resource
+    StoreScoreMapper storeScoreMapper;
+
 
     @Override
     public Page<StoreInfoVO> list(String keyword, Integer pageSize, Integer pageNum) {
@@ -49,7 +54,7 @@
         storeInfoPage.setSize(pageSize);
         storeInfoPage.setCurrent(pageNum);
         Page<StoreInfoVO> page = storeInfoMapper.selectStorePage(storeInfoPage, keyword);
-        page.getRecords().forEach(x->x.setVideoPoint(videoPointMapper.selectById(x.getVideoId())));
+        page.getRecords().forEach(x -> x.setVideoPoint(videoPointMapper.selectById(x.getVideoId())));
         return page;
     }
 
@@ -69,14 +74,24 @@
             List<StoreInfo> infos = new ArrayList<>();
             for (StoreInfoExcelVo data : datas) {
                 StoreInfo info = new StoreInfo();
-                BeanUtils.copyProperties(data,info);
+                BeanUtils.copyProperties(data, info);
                 infos.add(info);
             }
-            BeanUtils.copyProperties(datas,infos);
+            BeanUtils.copyProperties(datas, infos);
             saveBatch(infos);
             return true;
         } catch (Exception e) {
             throw new ApiException(ResultCode.FAILED);
         }
     }
+
+    @Override
+    public Page<StoreScore> getScoreList(Long storeId, Integer pageSize, Integer pageNum) {
+        Page<StoreScore> storeScorePage = new Page<>();
+        storeScorePage.setSize(pageSize);
+        storeScorePage.setCurrent(pageNum);
+        LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<StoreScore>().eq(StoreScore::getStoreId, storeId);
+        Page<StoreScore> page = storeScoreMapper.selectPage(storeScorePage, queryWrapper);
+        return page;
+    }
 }
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 d4b73db..56cb2bc 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
@@ -67,11 +67,11 @@
 
     @ApiModelProperty("闂ㄥ簵绉垎")
     @TableField("store_score")
-    private BigDecimal storeScore;
+    private Double storeScore;
 
     @ApiModelProperty("闂ㄥ簵绉垎")
     @TableField(" relation_video")
-    private BigDecimal relationVideo;
+    private String relationVideo;
 
     @ApiModelProperty("闂ㄥ簵绫诲瀷")
     @TableField("type")
diff --git a/ycl-platform/src/main/resources/mapper/store/StoreScoreMapper.xml b/ycl-platform/src/main/resources/mapper/store/StoreScoreMapper.xml
new file mode 100644
index 0000000..f93d1d4
--- /dev/null
+++ b/ycl-platform/src/main/resources/mapper/store/StoreScoreMapper.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ycl.mapper.store.StoreScoreMapper">
+
+    <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+    <resultMap id="BaseResultMap" type="com.ycl.entity.store.StoreScore">
+        <id column="id" property="id" jdbcType="INTEGER"/>
+
+        <result column="rule_id" property="ruleId" jdbcType="INTEGER"/>
+        <result column="store_id" property="storeId" jdbcType="INTEGER"/>
+        <result column="category" property="category" jdbcType="VARCHAR"/>
+        <result column="deduction_item" property="deductionItem" jdbcType="VARCHAR"/>
+        <result column="mark_score" property="markScore" jdbcType="FLOAT"/>
+        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
+    </resultMap>
+
+</mapper>

--
Gitblit v1.8.0