Quellcode durchsuchen

用户行为优化1.0.4

huangzhiguo vor 1 Jahr
Ursprung
Commit
e0d0de8bfe
19 geänderte Dateien mit 728 neuen und 144 gelöschten Zeilen
  1. 3 3
      src/main/java/com/caimei365/manager/controller/caimei/user/CmMarketShopApi.java
  2. 127 27
      src/main/java/com/caimei365/manager/controller/caimei/user/CustomerApi.java
  3. 56 4
      src/main/java/com/caimei365/manager/dao/user/CustomerServiceDao.java
  4. 8 0
      src/main/java/com/caimei365/manager/entity/caimei/CmBehaviorRecord.java
  5. 12 0
      src/main/java/com/caimei365/manager/entity/caimei/cmUser/CmPageShopInfo.java
  6. 12 0
      src/main/java/com/caimei365/manager/entity/caimei/cmUser/CmPageShopKeyword.java
  7. 4 0
      src/main/java/com/caimei365/manager/entity/caimei/cmUser/CmRoosInformation.java
  8. 4 0
      src/main/java/com/caimei365/manager/entity/caimei/cmUser/CmShopInfo.java
  9. 4 0
      src/main/java/com/caimei365/manager/entity/caimei/cmUser/CmShopKeyword.java
  10. 4 0
      src/main/java/com/caimei365/manager/entity/caimei/cmUser/CmShopPopUp.java
  11. 57 0
      src/main/java/com/caimei365/manager/entity/caimei/cmUser/CmShopProduct.java
  12. 13 4
      src/main/java/com/caimei365/manager/entity/caimei/product/Product.java
  13. 63 8
      src/main/java/com/caimei365/manager/service/caimei/user/CustomerService.java
  14. 2 0
      src/main/java/com/caimei365/manager/service/caimei/user/impl/CmBehaviorRecordServiceImpl.java
  15. 12 0
      src/main/java/com/caimei365/manager/service/caimei/user/impl/CmMarketShopServiceImpl.java
  16. 145 12
      src/main/java/com/caimei365/manager/service/caimei/user/impl/CustomerServiceImpl.java
  17. 87 73
      src/main/resources/mapper/CmBehaciorRecordDao.xml
  18. 1 1
      src/main/resources/mapper/user/CmMarketShopDao.xml
  19. 114 12
      src/main/resources/mapper/user/CustomerServiceDao.xml

+ 3 - 3
src/main/java/com/caimei365/manager/controller/caimei/user/CmMarketShopApi.java

@@ -35,7 +35,7 @@ public class CmMarketShopApi {
     @GetMapping("/uploadShopLogo")
     public ResponseJson uploadShopLogo(Integer id, String logo) {
         if (null == id) {
-            return  ResponseJson.error(-1, "供应商营销id不能为空", null);
+            return  ResponseJson.error(-1, "商营销id不能为空", null);
         }
         if (StringUtils.isBlank(logo) || StringUtils.isEmpty(logo)) {
             return  ResponseJson.error(-1, "供应商营销id不能为空", null);
@@ -56,7 +56,7 @@ public class CmMarketShopApi {
                                                                       @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                                                       @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
         if (null == marketId) {
-            return  ResponseJson.error(-1, "供应商营销id不能为空", null);
+            return  ResponseJson.error(-1, "商营销id不能为空", null);
         }
         return marketShopService.getMarketReport(marketId, reportName, pageNum, pageSize);
     }
@@ -126,7 +126,7 @@ public class CmMarketShopApi {
     @GetMapping("/saveReport")
     public ResponseJson saveReport(Integer marketId, Integer id, String reportDate, String reportName, String filePath) throws IOException {
         if (marketId == null) {
-            return ResponseJson.error(-1, "供应商营销Id不能为空", null);
+            return ResponseJson.error(-1, "商营销Id不能为空", null);
         }
         if (StringUtils.isBlank(reportDate) || StringUtils.isEmpty(reportDate)) {
             return ResponseJson.error(-1, "报表时间不能为空", null);

+ 127 - 27
src/main/java/com/caimei365/manager/controller/caimei/user/CustomerApi.java

@@ -7,6 +7,7 @@ import com.caimei365.manager.entity.PaginationVo;
 import com.caimei365.manager.entity.ResponseJson;
 import com.caimei365.manager.entity.caimei.CmShop;
 import com.caimei365.manager.entity.caimei.cmUser.*;
+import com.caimei365.manager.entity.caimei.product.Product;
 import com.caimei365.manager.service.caimei.user.CustomerService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import java.util.List;
 
 /**
  * Description
@@ -87,6 +89,91 @@ public class CustomerApi {
         return customerService.renewCustomerShop(id, status);
     }
 
+    /**
+     * 潜客商品列表
+     * @param id
+     * @param productId
+     * @param productName
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @GetMapping("/getShopProduct")
+    public ResponseJson<PaginationVo<CmShopProduct>> getShopProduct(Integer id, Integer productId, String productName,
+                                                                    @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                                    @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
+        if (null == id) {
+            return ResponseJson.error(-1, "id不能为空", null);
+        }
+        return customerService.getShopProduct(id, productId, productName, pageNum, pageSize);
+    }
+
+    /**
+     * 商品列表
+     * @param shopId
+     * @param productId
+     * @param productName
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @GetMapping("/getProductList")
+    public ResponseJson<PaginationVo<Product>> getProductList(Integer shopId, Integer productId, String productName,
+                                                              @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                              @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
+        if (null == shopId) {
+            return ResponseJson.error(-1, "供应商Id不能为空", null);
+        }
+        return customerService.getProductList(shopId, productId, productName, pageNum, pageSize);
+    }
+
+    /**
+     * 保存潜客供应商统计商品
+     * @param id
+     * @param productIds
+     * @return
+     */
+    @GetMapping("/saveShopProduct")
+    public ResponseJson saveShopProduct(Integer id, String productIds) {
+        if (null == id) {
+            return ResponseJson.error(-1, "潜客供应商统计id不能为空", null);
+        }
+        if (StringUtils.isBlank(productIds)) {
+            return ResponseJson.error(-1, "商品id不能为空", null);
+        }
+        return customerService.saveShopProduct(id, productIds);
+    }
+
+    /**
+     * 设置潜客商品统计状态
+     * @param id
+     * @return
+     */
+    @GetMapping("/renewShopProduct")
+    public ResponseJson renewShopProduct(Integer id, Integer status) {
+        if (null == id) {
+            return ResponseJson.error(-1, "潜客供应商商品统计id不能为空", null);
+        }
+        if (null == status) {
+            return ResponseJson.error(-1, "统计状态不能为空", null);
+        }
+        return customerService.updateProductStatus(id, status);
+    }
+
+    /**
+     * 删除潜客供应商统计商品
+     * @param id
+     * @return
+     */
+    @GetMapping("/deleteShopProduct")
+    public ResponseJson deleteShopProduct(Integer id) {
+        if (null == id) {
+            return ResponseJson.error(-1, "潜客供应商商品统计id不能为空", null);
+        }
+
+        return customerService.updateShopProduct(id);
+    }
+
     /**
      * 游客统计
      * @param cmRoosInformation
@@ -98,8 +185,8 @@ public class CustomerApi {
     public ResponseJson<PaginationVo<CmRoosInformation>> getCmInformationList(CmRoosInformation cmRoosInformation,
                                                                               @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                                                               @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
-        if (null == cmRoosInformation.getShopId()) {
-            return ResponseJson.error(-1, "供应商Id不能为空", null);
+        if (null == cmRoosInformation.getShopProductId()) {
+            return ResponseJson.error(-1, "供应商商品统计Id不能为空", null);
         }
         return customerService.getCmInformationList(cmRoosInformation, pageNum, pageSize);
     }
@@ -168,8 +255,8 @@ public class CustomerApi {
     public ResponseJson<PaginationVo<CmShopInfo>> getShopInfoList(CmShopInfo cmShopInfo,
                                                                   @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                                                   @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
-        if (null == cmShopInfo.getShopId()) {
-            return ResponseJson.error(-1, "供应商Id不能为空", null);
+        if (null == cmShopInfo.getShopProductId()) {
+            return ResponseJson.error(-1, "供应商商品统计Id不能为空", null);
         }
         return customerService.getShopInfoList(cmShopInfo, pageNum, pageSize);
     }
@@ -191,19 +278,19 @@ public class CustomerApi {
 
     /**
      * 添加文章统计
-     * @param shopId
+     * @param shopProductId
      * @param infoIds
      * @return
      */
     @GetMapping("/saveShopInfo")
-    public ResponseJson saveShopInfo(Integer shopId, String infoIds){
-        if (null == shopId) {
-            return ResponseJson.error(-1, "供应商Id不能为空", null);
+    public ResponseJson saveShopInfo(Integer shopProductId, String infoIds){
+        if (null == shopProductId) {
+            return ResponseJson.error(-1, "供应商商品统计Id不能为空", null);
         }
         if (null == infoIds) {
             return ResponseJson.error(-1, "选择文章不能为空", null);
         }
-        return customerService.saveShopInfo(shopId, infoIds);
+        return customerService.saveShopInfo(shopProductId, infoIds);
     }
 
     /**
@@ -247,8 +334,8 @@ public class CustomerApi {
     public ResponseJson<PaginationVo<CmShopKeyword>> getShopKeywordList(CmShopKeyword cmShopKeyword,
                                                                      @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                                                      @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
-        if (null == cmShopKeyword.getShopId()) {
-            return ResponseJson.error(-1, "供应商Id不能为空", null);
+        if (null == cmShopKeyword.getShopProductId()) {
+            return ResponseJson.error(-1, "供应商商品统计Id不能为空", null);
         }
         return customerService.getShopKeywordList(cmShopKeyword, pageNum, pageSize);
     }
@@ -269,19 +356,19 @@ public class CustomerApi {
 
     /**
      * 添加搜索词统计
-     * @param shopId
+     * @param shopProductId
      * @param keyWordIds
      * @return
      */
     @GetMapping("/saveShopKeyword")
-    public ResponseJson saveShopKeyword(Integer shopId, String keyWordIds){
-        if (null == shopId) {
-            return ResponseJson.error(-1, "供应商Id不能为空", null);
+    public ResponseJson saveShopKeyword(Integer shopProductId, String keyWordIds){
+        if (null == shopProductId) {
+            return ResponseJson.error(-1, "供应商商品统计Id不能为空", null);
         }
         if (null == keyWordIds) {
             return ResponseJson.error(-1, "选择搜索词不能为空", null);
         }
-        return customerService.saveShopKeyword(shopId, keyWordIds);
+        return customerService.saveShopKeyword(shopProductId, keyWordIds);
     }
 
     /**
@@ -316,15 +403,15 @@ public class CustomerApi {
 
     /**
      * 弹框信息回显
-     * @param shopId
+     * @param shopProductId
      * @return
      */
     @GetMapping("/getShopPopUp")
-    public ResponseJson<CmShopPopUp> getShopPopUp(Integer shopId) {
-        if (null == shopId) {
-            return ResponseJson.error(-1, "供应商Id不能为空", null);
+    public ResponseJson<CmShopPopUp> getShopPopUp(Integer shopProductId) {
+        if (null == shopProductId) {
+            return ResponseJson.error(-1, "供应商商品统计Id不能为空", null);
         }
-        return customerService.getShopPopUp(shopId);
+        return customerService.getShopPopUp(shopProductId);
     }
 
     /**
@@ -334,8 +421,8 @@ public class CustomerApi {
      */
     @PostMapping("/saveShopPopUp")
     public ResponseJson saveShopPopUp(@RequestBody CmShopPopUp cmShopPopUp) {
-        if (null == cmShopPopUp.getShopId()) {
-            return ResponseJson.error(-1, "供应商Id不能为空", null);
+        if (null == cmShopPopUp.getShopProductId()) {
+            return ResponseJson.error(-1, "供应商商品统计Id不能为空", null);
         }
         if (null == cmShopPopUp.getImage()) {
             return ResponseJson.error(-1, "显示图不能为空", null);
@@ -437,6 +524,19 @@ public class CustomerApi {
         return customerService.delShopAdvertisingImage(id);
     }
 
+    /**
+     * 获取潜客供应商下统计商品
+     * @param shopId
+     * @return
+     */
+    @GetMapping("/getShopProductList")
+    public ResponseJson<List<CmShopProduct>> getShopProductList(Integer shopId) {
+        if (null == shopId) {
+            return ResponseJson.error(-1, "供应商Id不能为空", null);
+        }
+        return customerService.getShopProductList(shopId);
+    }
+
     /**
      * 供应商主页统计
      * @param shopId
@@ -475,13 +575,13 @@ public class CustomerApi {
      * @return
      */
     @GetMapping("/getPageShopInfo")
-    public ResponseJson<PaginationVo<CmPageShopInfo>> getPageShopInfo(Integer shopId, String startTime, String endTime,
+    public ResponseJson<PaginationVo<CmPageShopInfo>> getPageShopInfo(Integer shopId, Integer productId, String startTime, String endTime,
                                                                @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                                                @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
         if (null == shopId) {
             return ResponseJson.error(-1, "供应商Id不能为空", null);
         }
-        return customerService.getPageShopInfo(shopId, startTime, endTime, pageNum, pageSize);
+        return customerService.getPageShopInfo(shopId, productId, startTime, endTime, pageNum, pageSize);
     }
 
     /**
@@ -490,12 +590,12 @@ public class CustomerApi {
      * @return
      */
     @GetMapping("/getPageShopKeyword")
-    public ResponseJson<PaginationVo<CmPageShopKeyword>> getPageShopKeyword(Integer shopId, String startTime, String endTime,
+    public ResponseJson<PaginationVo<CmPageShopKeyword>> getPageShopKeyword(Integer shopId, Integer productId, String startTime, String endTime,
                                                                      @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                                                      @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
         if (null == shopId) {
             return ResponseJson.error(-1, "供应商Id不能为空", null);
         }
-        return customerService.getPageShopKeyword(shopId, startTime, endTime, pageNum, pageSize);
+        return customerService.getPageShopKeyword(shopId, productId, startTime, endTime, pageNum, pageSize);
     }
 }

+ 56 - 4
src/main/java/com/caimei365/manager/dao/user/CustomerServiceDao.java

@@ -2,6 +2,7 @@ package com.caimei365.manager.dao.user;
 
 import com.caimei365.manager.entity.caimei.CmShop;
 import com.caimei365.manager.entity.caimei.cmUser.*;
+import com.caimei365.manager.entity.caimei.product.Product;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -48,6 +49,57 @@ public interface CustomerServiceDao {
      */
     void updateCustomerShop( @Param("id") Integer id, @Param("status") Integer status);
 
+    /**
+     * 潜客收集供应商商品
+     * @param id
+     * @param productId
+     * @param productName
+     * @return
+     */
+    List<CmShopProduct> getShopProduct(@Param("id") Integer id, @Param("productId") Integer productId, @Param("productName") String productName);
+
+    /**
+     * 商品列表
+     * @param shopId
+     * @param productId
+     * @param productName
+     * @return
+     */
+    List<Product> getProductList(@Param("shopId") Integer shopId, @Param("productId") Integer productId, @Param("productName") String productName);
+
+    /**
+     * 潜客供应商商品ids
+     * @param shopId
+     * @return
+     */
+    List<Integer> getProductIds(@Param("shopId") Integer shopId);
+
+    /**
+     * 保存潜客供应商统计商品
+     * @param statisticsId
+     * @param productId
+     */
+    void insertShopProduct(@Param("statisticsId") Integer statisticsId, @Param("productId") Integer productId);
+
+    /**
+     * 设置潜客商品统计状态
+     * @param id
+     */
+    void updateProductStatus(@Param("id") Integer id, @Param("status") Integer status);
+
+    /**
+     * 删除潜客供应商统计商品
+     * @param id
+     */
+    void updateShopProduct(@Param("id") Integer id);
+
+    /**
+     * 获取潜客供应商下统计商品
+     * @param shopId
+     * @return
+     */
+    List<CmShopProduct> getShopProductList(@Param("shopId") Integer shopId);
+
     /**
      * 游客统计列表
      * @param cmRoosInformation
@@ -169,10 +221,10 @@ public interface CustomerServiceDao {
 
     /**
      * 弹框数据回显
-     * @param shopId
+     * @param shopProductId
      * @return
      */
-    CmShopPopUp getShopPopUp(@Param("shopId") Integer shopId);
+    CmShopPopUp getShopPopUp(@Param("shopProductId") Integer shopProductId);
 
     /**
      * 插入弹框数据
@@ -252,13 +304,13 @@ public interface CustomerServiceDao {
      * @param shopId
      * @return
      */
-    List<CmPageShopInfo> getPageShopInfo(@Param("shopId") Integer shopId, @Param("startTime") String startTime, @Param("endTime") String endTime);
+    List<CmPageShopInfo> getPageShopInfo(@Param("shopId") Integer shopId, @Param("productId") Integer productId, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
     /**
      * 供应商搜索词统计
      * @param shopId
      * @return
      */
-    List<CmPageShopKeyword> getPageShopKeyword(@Param("shopId") Integer shopId, @Param("startTime") String startTime, @Param("endTime") String endTime);
+    List<CmPageShopKeyword> getPageShopKeyword(@Param("shopId") Integer shopId, @Param("productId") Integer productId, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
 }

+ 8 - 0
src/main/java/com/caimei365/manager/entity/caimei/CmBehaviorRecord.java

@@ -179,6 +179,14 @@ public class CmBehaviorRecord {
      */
     @ExcelIgnore
     private String registerTime;
+    /**
+     * 注册开始时间--筛选
+     */
+    private String registerStartTime;
+    /**
+     * 注册结束时间--筛选
+     */
+    private String registerEndTime;
     /**
      * 供应商公司名称
      */

+ 12 - 0
src/main/java/com/caimei365/manager/entity/caimei/cmUser/CmPageShopInfo.java

@@ -55,4 +55,16 @@ public class CmPageShopInfo {
      * 时间
      */
     private String accessDate;
+    /**
+     * 商品主图
+     */
+    private String mainImage;
+    /**
+     * 商品名称
+     */
+    private String productName;
+    /**
+     * 商品Id
+     */
+    private Integer productId;
 }

+ 12 - 0
src/main/java/com/caimei365/manager/entity/caimei/cmUser/CmPageShopKeyword.java

@@ -43,4 +43,16 @@ public class CmPageShopKeyword {
      * 时间
      */
     private String accessDate;
+    /**
+     * 商品主图
+     */
+    private String mainImage;
+    /**
+     * 商品名称
+     */
+    private String productName;
+    /**
+     * 商品Id
+     */
+    private Integer productId;
 }

+ 4 - 0
src/main/java/com/caimei365/manager/entity/caimei/cmUser/CmRoosInformation.java

@@ -19,6 +19,10 @@ public class CmRoosInformation {
      * 供应商Id
      */
     private Integer shopId;
+    /**
+     * 营销商品id
+     */
+    private Integer shopProductId;
     /**
      * 跟进状态 0 已跟进 1 未跟进
      */

+ 4 - 0
src/main/java/com/caimei365/manager/entity/caimei/cmUser/CmShopInfo.java

@@ -17,6 +17,10 @@ public class CmShopInfo {
      * 供应商Id
      */
     private Integer shopId;
+    /**
+     * 营销商品id
+     */
+    private Integer shopProductId;
     /**
      * 文章Id
      */

+ 4 - 0
src/main/java/com/caimei365/manager/entity/caimei/cmUser/CmShopKeyword.java

@@ -17,6 +17,10 @@ public class CmShopKeyword {
      * 供应商Id
      */
     private Integer shopId;
+    /**
+     * 营销商品id
+     */
+    private Integer shopProductId;
     /**
      * 搜索词Id
      */

+ 4 - 0
src/main/java/com/caimei365/manager/entity/caimei/cmUser/CmShopPopUp.java

@@ -15,6 +15,10 @@ public class CmShopPopUp {
      * 供应商Id
      */
     private Integer shopId;
+    /**
+     * 营销商品id
+     */
+    private Integer shopProductId;
     /**
      * 图片
      */

+ 57 - 0
src/main/java/com/caimei365/manager/entity/caimei/cmUser/CmShopProduct.java

@@ -0,0 +1,57 @@
+package com.caimei365.manager.entity.caimei.cmUser;
+
+import lombok.Data;
+
+/**
+ * Description
+ *
+ * @author : hzg
+ * @date : 2024/1/3
+ */
+@Data
+public class CmShopProduct {
+    /**
+     * id
+     */
+    private Integer id;
+    /**
+     * 供应商潜客统计Id
+     */
+    private Integer statisticsId;
+    /**
+     * 商品Id
+     */
+    private Integer productId;
+    /**
+     * 统计状态 0 统计 1 不统计
+     */
+    private Integer status;
+    /**
+     * 营销logo
+     */
+    private String logo;
+    /**
+     * 添加时间
+     */
+    private String addTime;
+    /**
+     * 删除标记:0未删除,1已删除
+     */
+    private Integer delFlag;
+    /**
+     * 供应商Id
+     */
+    private Integer shopId;
+    /**
+     * 商品名称
+     */
+    private String productName;
+    /**
+     * 商品图片
+     */
+    private String productImage;
+    /**
+     * 最近报表时间
+     */
+    private String recentlyTime;
+}

+ 13 - 4
src/main/java/com/caimei365/manager/entity/caimei/product/Product.java

@@ -687,11 +687,20 @@ public class Product {
      * 关联标签库字符串
      */
     private String relatedLabels;
-
-    //子订单ID
+    /**
+     * 子订单ID
+     */
     private Integer shopOrderID;
-    //订单商品ID
+    /**
+     * 订单商品ID
+     */
     private Integer orderProductID;
-    //税率
+    /**
+     * 税率
+     */
     private Double taxRate;
+    /**
+     * 是否支持选择
+     */
+    private Boolean flag;
 }

+ 63 - 8
src/main/java/com/caimei365/manager/service/caimei/user/CustomerService.java

@@ -4,6 +4,9 @@ import com.caimei365.manager.entity.PaginationVo;
 import com.caimei365.manager.entity.ResponseJson;
 import com.caimei365.manager.entity.caimei.CmShop;
 import com.caimei365.manager.entity.caimei.cmUser.*;
+import com.caimei365.manager.entity.caimei.product.Product;
+
+import java.util.List;
 
 /**
  * Description
@@ -42,6 +45,51 @@ public interface CustomerService {
      */
     ResponseJson renewCustomerShop(Integer id, Integer status);
 
+    /**
+     * 潜客收集商品列表
+     * @param id
+     * @param productId
+     * @param productName
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    ResponseJson<PaginationVo<CmShopProduct>> getShopProduct(Integer id, Integer productId, String productName, int pageNum, int pageSize);
+
+    /**
+     * 商品列表
+     * @param shopId
+     * @param productId
+     * @param productName
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    ResponseJson<PaginationVo<Product>> getProductList(Integer shopId, Integer productId, String productName, int pageNum, int pageSize);
+
+    /**
+     * 保存潜客供应商统计商品
+     * @param statisticsId
+     * @param productIds
+     * @return
+     */
+    ResponseJson saveShopProduct(Integer statisticsId, String productIds);
+
+    /**
+     * 设置潜客商品统计状态
+     * @param id
+     * @param status
+     * @return
+     */
+    ResponseJson updateProductStatus(Integer id, Integer status);
+
+    /**
+     * 删除潜客供应商统计商品
+     * @param id
+     * @return
+     */
+    ResponseJson updateShopProduct(Integer id);
+
     /**
      * 游客统计
      * @param cmRoosInformation
@@ -94,11 +142,11 @@ public interface CustomerService {
 
     /**
      * 添加文章统计
-     * @param shopId
+     * @param shopProductId
      * @param infoIds
      * @return
      */
-    ResponseJson saveShopInfo(Integer shopId, String infoIds);
+    ResponseJson saveShopInfo(Integer shopProductId, String infoIds);
 
     /**
      * 设置统计状态
@@ -135,11 +183,11 @@ public interface CustomerService {
 
     /**
      * 添加搜索词统计
-     * @param shopId
+     * @param shopProductId
      * @param keyWordIds
      * @return
      */
-    ResponseJson saveShopKeyword(Integer shopId, String keyWordIds);
+    ResponseJson saveShopKeyword(Integer shopProductId, String keyWordIds);
 
     /**
      * 设置统计状态
@@ -158,10 +206,10 @@ public interface CustomerService {
 
     /**
      * 弹框数据回显
-     * @param shopId
+     * @param shopProductId
      * @return
      */
-    ResponseJson<CmShopPopUp> getShopPopUp(Integer shopId);
+    ResponseJson<CmShopPopUp> getShopPopUp(Integer shopProductId);
 
     /**
      * 谈款数据保存
@@ -216,6 +264,13 @@ public interface CustomerService {
      */
     ResponseJson delShopAdvertisingImage(Integer id);
 
+    /**
+     * 获取潜客供应商下统计商品
+     * @param shopId
+     * @return
+     */
+    ResponseJson<List<CmShopProduct>> getShopProductList(Integer shopId);
+
     /**
      * 供应商主页统计
      * @param shopId
@@ -237,13 +292,13 @@ public interface CustomerService {
      * @param shopId
      * @return
      */
-    ResponseJson<PaginationVo<CmPageShopInfo>> getPageShopInfo(Integer shopId, String startTime, String endTime, Integer pageNum, Integer pageSize);
+    ResponseJson<PaginationVo<CmPageShopInfo>> getPageShopInfo(Integer shopId, Integer productId, String startTime, String endTime, Integer pageNum, Integer pageSize);
 
     /**
      * 供应商搜索词统计
      * @param shopId
      * @return
      */
-    ResponseJson<PaginationVo<CmPageShopKeyword>> getPageShopKeyword(Integer shopId, String startTime, String endTime, Integer pageNum, Integer pageSize);
+    ResponseJson<PaginationVo<CmPageShopKeyword>> getPageShopKeyword(Integer shopId, Integer productId, String startTime, String endTime, Integer pageNum, Integer pageSize);
 
 }

+ 2 - 0
src/main/java/com/caimei365/manager/service/caimei/user/impl/CmBehaviorRecordServiceImpl.java

@@ -88,8 +88,10 @@ public class CmBehaviorRecordServiceImpl implements CmBehaviorRecordService {
         cmBehaviorRecord.setBehaviorType(behaviorType);
         PageHelper.startPage(pageNum, pageSize);
         if (cmBehaviorRecord.getTodayType() == 0) {
+            // 今日数据
             list = cmBehaviorRecordDao.findListToday(cmBehaviorRecord);
         } else {
+            // 过往数据
             list = cmBehaviorRecordDao.findList(cmBehaviorRecord);
         }
         // 总时长

+ 12 - 0
src/main/java/com/caimei365/manager/service/caimei/user/impl/CmMarketShopServiceImpl.java

@@ -27,6 +27,9 @@ import org.springframework.web.multipart.commons.CommonsMultipartFile;
 
 import javax.annotation.Resource;
 import java.io.*;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -265,6 +268,15 @@ public class CmMarketShopServiceImpl implements CmMarketShopService {
         }
         File extractFile = new File(extract);
         extractFile.delete();
+        Path path = Paths.get(extract);
+        try {
+            Files.walk(path)
+                    .sorted(Comparator.reverseOrder())
+                    .map(Path::toFile)
+                    .forEach(File::delete);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
         return ResponseJson.success();
     }
 

+ 145 - 12
src/main/java/com/caimei365/manager/service/caimei/user/impl/CustomerServiceImpl.java

@@ -2,12 +2,15 @@ package com.caimei365.manager.service.caimei.user.impl;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.caimei.utils.AppUtils;
+import com.caimei.utils.StringUtil;
 import com.caimei365.manager.config.security.JwtLoginFilter;
 import com.caimei365.manager.dao.user.CustomerServiceDao;
 import com.caimei365.manager.entity.PaginationVo;
 import com.caimei365.manager.entity.ResponseJson;
 import com.caimei365.manager.entity.caimei.CmShop;
 import com.caimei365.manager.entity.caimei.cmUser.*;
+import com.caimei365.manager.entity.caimei.product.Product;
 import com.caimei365.manager.service.caimei.user.CustomerService;
 import com.github.pagehelper.PageHelper;
 import org.springframework.stereotype.Service;
@@ -106,6 +109,113 @@ public class CustomerServiceImpl implements CustomerService {
         return ResponseJson.success();
     }
 
+    /**
+     * 潜客收集商品列表
+     *
+     * @param id
+     * @param productId
+     * @param productName
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @Override
+    public ResponseJson<PaginationVo<CmShopProduct>> getShopProduct(Integer id, Integer productId, String productName, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<CmShopProduct> shopProductList = customerServiceDao.getShopProduct(id, productId, productName);
+        shopProductList.forEach(product -> {
+            if (StringUtil.isNotBlank(product.getProductImage())) {
+                product.setProductImage(AppUtils.getImageURL("product", product.getProductImage(), 0, "wwwServer"));
+                if (!product.getProductImage().contains("https")) {
+                    product.setProductImage("https://admin.caimei365.com/" + product.getProductImage());
+                }
+            }
+        });
+        PaginationVo<CmShopProduct> page = new PaginationVo<>(shopProductList);
+        return ResponseJson.success(page);
+    }
+
+    /**
+     * 商品列表
+     *
+     * @param shopId
+     * @param productId
+     * @param productName
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @Override
+    public ResponseJson<PaginationVo<Product>> getProductList(Integer shopId, Integer productId, String productName, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        // 供应商商品
+        List<Product> productList = customerServiceDao.getProductList(shopId, productId, productName);
+        // 供应商被选中的商品Id集合
+        List<Integer> productIds = customerServiceDao.getProductIds(shopId);
+        productList.forEach(product -> {
+            if (StringUtil.isNotBlank(product.getMainImage())) {
+                product.setMainImage(AppUtils.getImageURL("product", product.getMainImage(), 0, "wwwServer"));
+                if (!product.getMainImage().contains("https")) {
+                    product.setMainImage("https://admin.caimei365.com/" + product.getMainImage());
+                }
+            }
+            if (productIds.contains(product.getProductId())) {
+                product.setFlag(false);
+            } else {
+                product.setFlag(true);
+            }
+        });
+        PaginationVo<Product> page = new PaginationVo<>(productList);
+        return ResponseJson.success(page);
+    }
+
+    /**
+     * 保存潜客供应商统计商品
+     *
+     * @param statisticsId
+     * @param productIds
+     * @return
+     */
+    @Override
+    public ResponseJson saveShopProduct(Integer statisticsId, String productIds) {
+        if (productIds.contains(",")) {
+            // 多商品
+            String[] split = productIds.split(",");
+            for (String productId : split) {
+                customerServiceDao.insertShopProduct(statisticsId, Integer.parseInt(productId));
+            }
+        } else {
+            // 单商品
+            customerServiceDao.insertShopProduct(statisticsId, Integer.parseInt(productIds));
+        }
+        return ResponseJson.success();
+    }
+
+    /**
+     * 设置潜客商品统计状态
+     *
+     * @param id
+     * @param status
+     * @return
+     */
+    @Override
+    public ResponseJson updateProductStatus(Integer id, Integer status) {
+        customerServiceDao.updateProductStatus(id, status);
+        return ResponseJson.success();
+    }
+
+    /**
+     * 删除潜客供应商统计商品
+     *
+     * @param id
+     * @return
+     */
+    @Override
+    public ResponseJson updateShopProduct(Integer id) {
+        customerServiceDao.updateShopProduct(id);
+        return ResponseJson.success();
+    }
+
     /**
      * 游客统计
      *
@@ -242,7 +352,7 @@ public class CustomerServiceImpl implements CustomerService {
      * @return
      */
     @Override
-    public ResponseJson saveShopInfo(Integer shopId, String infoIds) {
+    public ResponseJson saveShopInfo(Integer shopProductId, String infoIds) {
         List<String> infoId = new ArrayList<>();
         if (infoIds.contains(",")) {
             infoId = Arrays.asList(infoIds.split(","));
@@ -251,7 +361,7 @@ public class CustomerServiceImpl implements CustomerService {
         }
         for (String s : infoId) {
             CmShopInfo shopInfo = new CmShopInfo();
-            shopInfo.setShopId(shopId);
+            shopInfo.setShopProductId(shopProductId);
             shopInfo.setInfoId(Integer.parseInt(s));
             shopInfo.setStatus(0);
             shopInfo.setDelFlag(0);
@@ -328,12 +438,12 @@ public class CustomerServiceImpl implements CustomerService {
     /**
      * 添加搜索词统计
      *
-     * @param shopId
+     * @param shopProductId
      * @param keyWordIds
      * @return
      */
     @Override
-    public ResponseJson saveShopKeyword(Integer shopId, String keyWordIds) {
+    public ResponseJson saveShopKeyword(Integer shopProductId, String keyWordIds) {
         List<String> keyWordId = new ArrayList<>();
         if (keyWordIds.contains(",")) {
             keyWordId = Arrays.asList(keyWordIds.split(","));
@@ -342,7 +452,7 @@ public class CustomerServiceImpl implements CustomerService {
         }
         for (String s : keyWordId) {
             CmShopKeyword shopKeyword = new CmShopKeyword();
-            shopKeyword.setShopId(shopId);
+            shopKeyword.setShopProductId(shopProductId);
             shopKeyword.setSearchId(Integer.parseInt(s));
             shopKeyword.setStatus(0);
             shopKeyword.setDelFlag(0);
@@ -379,12 +489,12 @@ public class CustomerServiceImpl implements CustomerService {
     /**
      * 弹框数据回显
      *
-     * @param shopId
+     * @param shopProductId
      * @return
      */
     @Override
-    public ResponseJson<CmShopPopUp> getShopPopUp(Integer shopId) {
-        return ResponseJson.success(customerServiceDao.getShopPopUp(shopId));
+    public ResponseJson<CmShopPopUp> getShopPopUp(Integer shopProductId) {
+        return ResponseJson.success(customerServiceDao.getShopPopUp(shopProductId));
     }
 
     /**
@@ -504,6 +614,17 @@ public class CustomerServiceImpl implements CustomerService {
         return ResponseJson.success();
     }
 
+    /**
+     * 获取潜客供应商下统计商品
+     *
+     * @param shopId
+     * @return
+     */
+    @Override
+    public ResponseJson<List<CmShopProduct>> getShopProductList(Integer shopId) {
+        return ResponseJson.success(customerServiceDao.getShopProductList(shopId));
+    }
+
     /**
      * 供应商主页统计
      *
@@ -551,11 +672,17 @@ public class CustomerServiceImpl implements CustomerService {
      * @return
      */
     @Override
-    public ResponseJson<PaginationVo<CmPageShopInfo>> getPageShopInfo(Integer shopId, String startTime, String endTime, Integer pageNum, Integer pageSize) {
+    public ResponseJson<PaginationVo<CmPageShopInfo>> getPageShopInfo(Integer shopId, Integer productId, String startTime, String endTime, Integer pageNum, Integer pageSize) {
         PageHelper.startPage(pageNum, pageSize);
-        List<CmPageShopInfo> pageShopInfo = customerServiceDao.getPageShopInfo(shopId, startTime, endTime);
+        List<CmPageShopInfo> pageShopInfo = customerServiceDao.getPageShopInfo(shopId, productId, startTime, endTime);
         pageShopInfo.forEach(shop -> {
             shop.setAverage(calculationTime(shop.getAverageDuration().toString()));
+            if (StringUtil.isNotBlank(shop.getMainImage())) {
+                shop.setMainImage(AppUtils.getImageURL("product", shop.getMainImage(), 0, "wwwServer"));
+                if (!shop.getMainImage().contains("https")) {
+                    shop.setMainImage("https://admin.caimei365.com/" + shop.getMainImage());
+                }
+            }
         });
         PaginationVo<CmPageShopInfo> page = new PaginationVo<>(pageShopInfo);
         return ResponseJson.success(page);
@@ -570,11 +697,17 @@ public class CustomerServiceImpl implements CustomerService {
      * @return
      */
     @Override
-    public ResponseJson<PaginationVo<CmPageShopKeyword>> getPageShopKeyword(Integer shopId, String startTime, String endTime, Integer pageNum, Integer pageSize) {
+    public ResponseJson<PaginationVo<CmPageShopKeyword>> getPageShopKeyword(Integer shopId, Integer productId, String startTime, String endTime, Integer pageNum, Integer pageSize) {
         PageHelper.startPage(pageNum, pageSize);
-        List<CmPageShopKeyword> pageShopKeyword = customerServiceDao.getPageShopKeyword(shopId, startTime, endTime);
+        List<CmPageShopKeyword> pageShopKeyword = customerServiceDao.getPageShopKeyword(shopId, productId, startTime, endTime);
         pageShopKeyword.forEach(shop -> {
             shop.setAverage(calculationTime(shop.getAverageDuration().toString()));
+            if (StringUtil.isNotBlank(shop.getMainImage())) {
+                shop.setMainImage(AppUtils.getImageURL("product", shop.getMainImage(), 0, "wwwServer"));
+                if (!shop.getMainImage().contains("https")) {
+                    shop.setMainImage("https://admin.caimei365.com/" + shop.getMainImage());
+                }
+            }
         });
         PaginationVo<CmPageShopKeyword> page = new PaginationVo<>(pageShopKeyword);
         return ResponseJson.success(page);

+ 87 - 73
src/main/resources/mapper/CmBehaciorRecordDao.xml

@@ -39,150 +39,164 @@
 
     <select id="findList" resultType="com.caimei365.manager.entity.caimei.CmBehaviorRecord">
         SELECT
-        IP as ip,
-        userID as userId,
-        clubID as clubId,
-        lastAccessTime,
-        companyType,
-        corporateName,
-        contacts,
-        phoneNumber,
-        spName,
-        number as numbers,
-        consultName,
-        consultMobile,
-        productID,
-        accessTime,
-        accessDuration,
-        accessDate,
-        accessClient,
-        region,
-        label,
-        relevanceShop,
-        addTime
-        FROM cm_behavior_record_index
+        cbri.IP as ip,
+        cbri.userID as userId,
+        cbri.clubID as clubId,
+        cbri.lastAccessTime,
+        cbri.companyType,
+        cbri.corporateName,
+        cbri.contacts,
+        cbri.phoneNumber,
+        cbri.spName,
+        cbri.number as numbers,
+        cbri.consultName,
+        cbri.consultMobile,
+        cbri.productID,
+        cbri.accessTime,
+        cbri.accessDuration,
+        cbri.accessDate,
+        cbri.accessClient,
+        cbri.region,
+        cbri.label,
+        cbri.relevanceShop,
+        cbri.addTime
+        FROM cm_behavior_record_index cbri
+        left join user u on u.userId = cbri.userId
         <where>
-            delFlag = 0
+            cbri.delFlag = 0
             <if test="clubId != null">
-                AND clubId = #{clubId}
+                AND cbri.clubId = #{clubId}
             </if>
             <if test="ip != null and ip != ''">
-                AND IP = #{ip}
+                AND cbri.IP = #{ip}
             </if>
             <if test="corporateName != null and corporateName != ''">
-                AND (corporateName like concat('%',#{corporateName},'%') OR consultName  LIKE concat('%',#{corporateName},'%') or contacts like concat('%',#{corporateName},'%'))
+                AND (cbri.corporateName like concat('%',#{corporateName},'%') OR cbri.consultName LIKE concat('%',#{corporateName},'%') or cbri.contacts like concat('%',#{corporateName},'%'))
             </if>
             <if test="companyType != null and companyType != ''">
-                AND companyType = #{companyType}
+                AND cbri.companyType = #{companyType}
             </if>
             <if test="accessClient != null and accessClient != ''">
-                AND accessClient =#{accessClient}
+                AND cbri.accessClient =#{accessClient}
             </if>
             <if test="contacts != null and contacts != ''">
-                AND (corporateName like concat('%',#{contacts},'%') or contacts like concat('%',#{contacts},'%'))
+                AND (cbri.corporateName like concat('%',#{contacts},'%') or cbri.contacts like concat('%',#{contacts},'%'))
             </if>
             <if test="phoneNumber != null and phoneNumber != ''">
-                AND phoneNumber = #{phoneNumber}
+                AND cbri.phoneNumber = #{phoneNumber}
             </if>
             <if test="spName != null and spName != ''">
-                AND spName = #{spName}
+                AND cbri.spName = #{spName}
             </if>
             <if test="relevanceShop != null and relevanceShop != ''">
-                AND (relevanceShop like concat('%',#{relevanceShop},'%')
+                AND (cbri.relevanceShop like concat('%',#{relevanceShop},'%')
                     <if test="behaviorType == 2">
-                        or behaviorType = #{behaviorType}
+                        or cbri.behaviorType = #{behaviorType}
                     </if>
                     )
             </if>
             <if test="labels != null and labels.size > 0">
                 AND
                 <foreach collection="labels" open="(" close=")" separator="or" item="label">
-                    label like concat('%',#{label},'%')
+                    cbri.label like concat('%',#{label},'%')
                 </foreach>
             </if>
             <if test="pageLabels != null and pageLabels != ''">
-                AND pageLabels like concat('%', #{pageLabels}, '%')
+                AND cbri.pageLabels like concat('%', #{pageLabels}, '%')
             </if>
                 <if test="pageTypes != null and pageTypes != ''">
-                AND pageTypes like concat('%', #{pageTypes}, '%')
+                AND cbri.pageTypes like concat('%', #{pageTypes}, '%')
             </if>
             <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
-                AND accessDate between #{startTime} and #{endTime}
+                AND cbri.accessDate between #{startTime} and #{endTime}
+            </if>
+            <if test="registerStartTime != null and registerStartTime != ''">
+                AND u.registerTime <![CDATA[ >= ]]> #{startTime}
+            </if>
+            <if test="registerEndTime != null and registerEndTime != ''">
+                AND u.registerTime <![CDATA[ <= ]]> #{endTime}
             </if>
         </where>
-        ORDER BY accessTime DESC
+        ORDER BY cbri.accessTime DESC
         <if test="exportType == 1">
             limit 5000
         </if>
     </select>
     <select id="findListToday" resultType="com.caimei365.manager.entity.caimei.CmBehaviorRecord">
         SELECT
-        IP as ip,
-        userID as userId,
-        clubID as clubId,
-        lastAccessTime,
-        companyType,
-        corporateName,
-        contacts,
-        phoneNumber,
-        spName,
-        number as numbers,
-        consultName,
-        consultMobile,
-        accessTime,
-        accessDuration,
-        accessDate,
-        accessClient,
-        region,
-        label,
-        relevanceShop,
-        addTime
-        FROM cm_behavior_record_today
+        cbrt.IP as ip,
+        cbrt.userID as userId,
+        cbrt.clubID as clubId,
+        cbrt.lastAccessTime,
+        cbrt.companyType,
+        cbrt.corporateName,
+        cbrt.contacts,
+        cbrt.phoneNumber,
+        cbrt.spName,
+        cbrt.number as numbers,
+        cbrt.consultName,
+        cbrt.consultMobile,
+        cbrt.accessTime,
+        cbrt.accessDuration,
+        cbrt.accessDate,
+        cbrt.accessClient,
+        cbrt.region,
+        cbrt.label,
+        cbrt.relevanceShop,
+        cbrt.addTime
+        FROM cm_behavior_record_today cbrt
+        left join user u on u.userId = cbrt.userId
         <where>
             <if test="clubId != null">
-                AND clubId = #{clubId}
+                AND cbrt.clubId = #{clubId}
             </if>
             <if test="ip != null and ip != ''">
-                AND IP = #{ip}
+                AND cbrt.IP = #{ip}
             </if>
             <if test="corporateName != null and corporateName != ''">
-                AND (corporateName like concat('%',#{corporateName},'%') OR consultName LIKE concat('%',#{corporateName},'%') or contacts like concat('%',#{corporateName},'%'))
+                AND (cbrt.corporateName like concat('%',#{corporateName},'%') OR cbrt.consultName LIKE concat('%',#{corporateName},'%') or cbrt.contacts like concat('%',#{corporateName},'%'))
             </if>
             <if test="companyType != null and companyType != ''">
-                AND companyType = #{companyType}
+                AND cbrt.companyType = #{companyType}
             </if>
             <if test="accessClient != null and accessClient != ''">
-                AND accessClient =#{accessClient}
+                AND cbrt.accessClient =#{accessClient}
             </if>
             <if test="contacts != null and contacts != ''">
-                AND (corporateName like concat('%',#{contacts},'%') or contacts like concat('%',#{contacts},'%'))
+                AND (cbrt.corporateName like concat('%',#{contacts},'%') or cbrt.contacts like concat('%',#{contacts},'%'))
             </if>
             <if test="phoneNumber != null and phoneNumber != ''">
-                AND phoneNumber = #{phoneNumber}
+                AND cbrt.phoneNumber = #{phoneNumber}
             </if>
             <if test="spName != null and spName != ''">
-                AND spName = #{spName}
+                AND cbrt.spName = #{spName}
             </if>
             <if test="relevanceShop != null and relevanceShop != ''">
-                AND relevanceShop like concat('%',#{relevanceShop},'%')
+                AND cbrt.relevanceShop like concat('%',#{relevanceShop},'%')
             </if>
             <if test="labels != null and labels.size > 0">
                 AND
                 <foreach collection="labels" open="(" close=")" separator="or" item="label">
-                    label like concat('%',#{label},'%')
+                    cbrt.label like concat('%',#{label},'%')
                 </foreach>
             </if>
             <if test="pageLabels != null and pageLabels != ''">
-                AND pageLabels like concat('%', #{pageLabels}, '%')
+                AND cbrt.pageLabels like concat('%', #{pageLabels}, '%')
             </if>
             <if test="pageTypes != null and pageTypes != ''">
-                AND pageTypes like concat('%', #{pageTypes}, '%')
+                AND cbrt.pageTypes like concat('%', #{pageTypes}, '%')
             </if>
             <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
-                AND accessDate between #{startTime} and #{endTime}
+                AND cbrt.accessDate between #{startTime} and #{endTime}
+            </if>
+            <if test="registerStartTime != null and registerStartTime != ''">
+                AND u.registerTime <![CDATA[ >= ]]> #{startTime}
+            </if>
+            <if test="registerEndTime != null and registerEndTime != ''">
+                AND u.registerTime <![CDATA[ <= ]]> #{endTime}
             </if>
         </where>
-        ORDER BY accessTime DESC
+        ORDER BY cbrt.accessTime DESC
     </select>
     <select id="selRegion" resultType="com.caimei365.manager.entity.caimei.CmBehaviorRecord">
         SELECT * FROM cm_behavior_record_ref where accessTime like concat('%',#{accessDate},'%')

+ 1 - 1
src/main/resources/mapper/user/CmMarketShopDao.xml

@@ -3,7 +3,7 @@
 <mapper namespace="com.caimei365.manager.dao.user.CmMarketShopDao">
 
     <update id="updateShopLogo">
-        update cm_shop_statistics
+        update cm_shop_product
         set logo = #{logo}
         where id = #{id}
     </update>

+ 114 - 12
src/main/resources/mapper/user/CustomerServiceDao.xml

@@ -54,6 +54,82 @@
         set status = #{status}
         where id = #{id}
     </update>
+
+    <select id="getShopProduct" resultType="com.caimei365.manager.entity.caimei.cmUser.CmShopProduct">
+        SELECT
+            csp.id,
+            csp.statisticsId,
+            csp.productId,
+            csp.status,
+            csp.logo,
+            csp.addTime,
+            csp.delFlag,
+            css.shopId,
+            p.name AS productName,
+            p.mainImage AS productImage,
+            (SELECT ADDTIME FROM cm_market_report WHERE marketId = csp.id AND delFlag = 0 AND visible = 1 ORDER BY ADDTIME DESC LIMIT 1) AS recentlyTime
+        FROM cm_shop_product csp
+                 LEFT JOIN cm_shop_statistics css ON css.id = csp.statisticsId
+                 LEFT JOIN product p ON csp.productId = p.productId
+        <where>
+            csp.statisticsId = #{id} and csp.delFlag = 0
+            <if test="productId != null">
+                and csp.productId = #{productId}
+            </if>
+            <if test="productName != null and productName != ''">
+                and p.name like concat('%', #{productName},'%')
+            </if>
+        </where>
+        order by csp.addTime desc
+    </select>
+
+    <select id="getProductList" resultType="com.caimei365.manager.entity.caimei.product.Product">
+        SELECT
+            p.productId,
+            p.name as productName,
+            p.mainImage,
+            s.shopId,
+            s.name AS shopName
+        FROM product p
+                 LEFT JOIN cm_organize_product_info copi ON copi.productId = p.productId
+                 LEFT JOIN shop s ON s.shopId = p.shopId
+        <where>
+            copi.organizeId = 0 AND copi.validFlag = 2
+            and p.shopId = #{shopId}
+            <if test="productId != null">
+                and p.productId = #{productId}
+            </if>
+            <if test="productName != null and productName != ''">
+                and p.name like concat('%', #{productName},'%')
+            </if>
+        </where>
+    </select>
+
+    <select id="getProductIds" resultType="java.lang.Integer">
+        select
+            csp.productId
+        from cm_shop_product csp
+        left join cm_shop_statistics css on css.id = csp.statisticsId
+        where css.shopId = #{shopId} and csp.delFlag = 0
+    </select>
+
+    <insert id="insertShopProduct">
+        insert into cm_shop_product (statisticsId, productId, status, addTime, delFlag)
+        values (#{statisticsId}, #{productId}, 1, now(), 0)
+    </insert>
+
+    <update id="updateProductStatus">
+        update cm_shop_product
+        set status = #{status}
+        where id = #{id}
+    </update>
+
+    <update id="updateShopProduct">
+        update cm_shop_product
+        set delFlag = 1
+        where id = #{id}
+    </update>
+
     <select id="getCmInformationList" resultType="com.caimei365.manager.entity.caimei.cmUser.CmRoosInformation">
         SELECT cri.id,
                cri.IP,
@@ -67,7 +143,7 @@
                cri.createTime
         FROM cm_roos_information cri
         <where>
-          shopId = #{shopId}
+            shopProductId = #{shopProductId}
           AND consultName IS NOT NULL
           AND consultMobile IS NOT NULL
             <if test="consultName != null and consultName != ''">
@@ -130,7 +206,7 @@
         FROM cm_shop_info csi
         LEFT JOIN info i ON i.id = csi.infoId
         <where>
-            csi.shopId = #{shopId} and csi.delFlag = 0 and i.delFlag = 0
+            csi.shopProductId = #{shopProductId} and csi.delFlag = 0 and i.delFlag = 0
             <if test="infoId != null">
                 and csi.infoId = #{infoId}
             </if>
@@ -161,8 +237,8 @@
     </select>
 
     <insert id="insertShopInfo">
-        insert into cm_shop_info (shopId, infoId, status, addTime, delFlag)
-        values (#{shopId}, #{infoId}, #{status}, now(), #{delFlag})
+        insert into cm_shop_info (shopProductId, infoId, status, addTime, delFlag)
+        values (#{shopProductId}, #{infoId}, #{status}, now(), #{delFlag})
     </insert>
 
     <update id="updateShopInfoStatus">
@@ -180,7 +256,7 @@
     <select id="getShopKeyword" resultType="com.caimei365.manager.entity.caimei.cmUser.CmShopKeyword">
         SELECT
             csk.id,
-            csk.shopId,
+            csk.shopProductId,
             cusf.keyword,
             cusf.frequency as number,
             cusf.searchTime,
@@ -189,7 +265,7 @@
         FROM cm_shop_keyword csk
                  LEFT JOIN cm_user_search_frequency cusf ON cusf.id = csk.searchId
         <where>
-            csk.shopId = #{shopId}
+            csk.shopProductId = #{shopProductId}
             and csk.delFlag = 0 and cusf.delStatus = 1
             <if test="keyword != null and keyword != ''">
                 and cusf.keyword like concat('%',#{keyword},'%')
@@ -215,8 +291,8 @@
     </select>
 
     <insert id="insertShopKeyword">
-        insert into cm_shop_keyword (shopId, searchId, status, addTime, delFlag)
-        values (#{shopId}, #{searchId}, #{status}, now(), #{delFlag})
+        insert into cm_shop_keyword (shopProductId, searchId, status, addTime, delFlag)
+        values (#{shopProductId}, #{searchId}, #{status}, now(), #{delFlag})
     </insert>
 
     <update id="updateShopKeywordStatus">
@@ -234,18 +310,18 @@
     <select id="getShopPopUp" resultType="com.caimei365.manager.entity.caimei.cmUser.CmShopPopUp">
         select
         id,
-        shopId,
+        shopProductId,
         image,
         guidingOne,
         guidingTwo,
         addTime
         from cm_shop_popUp
-        where shopId = #{shopId}
+        where shopProductId = #{shopProductId}
     </select>
 
     <insert id="insertShopPopUp">
-        insert into cm_shop_popUp(shopId, image, guidingOne, guidingTwo, addTime)
-        values (#{shopId}, #{image}, #{guidingOne}, #{guidingTwo}, now())
+        insert into cm_shop_popUp(shopProductId, image, guidingOne, guidingTwo, addTime)
+        values (#{shopProductId}, #{image}, #{guidingOne}, #{guidingTwo}, now())
     </insert>
 
     <update id="updateShopPopUp">
@@ -322,6 +398,14 @@
         where id = #{id}
     </update>
 
+    <select id="getShopProductList" resultType="com.caimei365.manager.entity.caimei.cmUser.CmShopProduct">
+        select csp.productId, p.name as productName
+        from cm_shop_statistics css
+        left join cm_shop_product csp on csp.statisticsId = css.id
+        left join product p on p.productId = csp.productId
+        where css.shopId = #{shopId} and csp.delFlag = 0
+    </select>
+
     <select id="getPageShop" resultType="com.caimei365.manager.entity.caimei.cmUser.CmPageShop">
         SELECT
             cps.id,
@@ -373,15 +457,24 @@
             i.title,
             i.onlineStatus,
             cpsi.link,
+            p.productId,
+            p.name as productName,
+            p.mainImage,
             IFNULL(SUM(cpsi.accessNumber), 0) AS accessNumber,
             IFNULL(SUM(cpsi.accessDuration), 0) AS accessDuration,
             IFNULL((IFNULL(SUM(cpsi.accessDuration), 0) / IFNULL(SUM(cpsi.accessNumber), 0)), 0) AS averageDuration
         FROM cm_page_shop_info cpsi
         LEFT JOIN info i ON i.id = cpsi.infoId
+        left join cm_shop_statistics css on css.shopId = cpsi.shopId
+        left join cm_shop_product csp on csp.statisticsId = css.id
+        left join product p on p.productId = csp.productId
         WHERE cpsi.shopId = #{shopId}
         <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
             and cpsi.accessDate BETWEEN #{startTime} and #{endTime}
         </if>
+        <if test="productId != null">
+            and csp.productId = #{productId}
+        </if>
         group by cpsi.infoId
     </select>
 
@@ -391,15 +484,24 @@
             cpsk.shopId,
             cusf.keyword,
             cpsk.link,
+            p.productId,
+            p.name as productName,
+            p.mainImage,
             IFNULL(SUM(cpsk.accessNumber), 0) AS accessNumber,
             IFNULL(SUM(cpsk.accessDuration), 0) AS accessDuration,
             IFNULL((IFNULL(SUM(cpsk.accessDuration), 0) / IFNULL(SUM(cpsk.accessNumber), 0)), 0) AS averageDuration
         FROM cm_page_shop_keyword cpsk
         LEFT JOIN cm_user_search_frequency cusf ON cusf.id = cpsk.searchId
+        left join cm_shop_statistics css on css.shopId = cpsk.shopId
+        left join cm_shop_product csp on csp.statisticsId = css.id
+        left join product p on p.productId = csp.productId
         WHERE cpsk.shopId = #{shopId}
         <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
             and cpsk.accessDate BETWEEN #{startTime} and #{endTime}
         </if>
+        <if test="productId != null">
+            and csp.productId = #{productId}
+        </if>
         group by cpsk.searchId
     </select>