Przeglądaj źródła

客户分ABC类、置顶

Long 1 dzień temu
rodzic
commit
0651863bbe

+ 7 - 4
fs-admin/src/main/java/com/fs/crm/controller/CrmCustomerLevelController.java

@@ -1,6 +1,6 @@
 package com.fs.crm.controller;
 
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.*;
 import javax.validation.Valid;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 @RestController
@@ -67,9 +68,11 @@ public class CrmCustomerLevelController extends BaseController {
     }
 
     @GetMapping("/getCustomerLevelOption")
-    public R getCustomerLevelOption() {
-        Wrapper<CrmCustomerLevel> wrapper = Wrappers.<CrmCustomerLevel>lambdaQuery()
-                .eq(CrmCustomerLevel::getStatus, 0);
+    public R getCustomerLevelOption(Integer status) {
+        LambdaQueryWrapper<CrmCustomerLevel> wrapper = Wrappers.lambdaQuery();
+        if (Objects.nonNull(status)) {
+            wrapper.eq(CrmCustomerLevel::getStatus, status);
+        }
         List<OptionsVO> options = customerLevelService.list(wrapper).stream().map(l -> {
             OptionsVO vo = new OptionsVO();
             vo.setDictLabel(l.getName());

+ 7 - 4
fs-company/src/main/java/com/fs/crm/controller/CrmCustomerLevelController.java

@@ -1,6 +1,6 @@
 package com.fs.crm.controller;
 
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.R;
@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 @RestController
@@ -23,9 +24,11 @@ public class CrmCustomerLevelController extends BaseController {
     private final ICrmCustomerLevelService customerLevelService;
 
     @GetMapping("/getCustomerLevelOption")
-    public R getCustomerLevelOption() {
-        Wrapper<CrmCustomerLevel> wrapper = Wrappers.<CrmCustomerLevel>lambdaQuery()
-                .eq(CrmCustomerLevel::getStatus, 0);
+    public R getCustomerLevelOption(Integer status) {
+        LambdaQueryWrapper<CrmCustomerLevel> wrapper = Wrappers.lambdaQuery();
+        if (Objects.nonNull(status)) {
+            wrapper.eq(CrmCustomerLevel::getStatus, status);
+        }
         List<OptionsVO> options = customerLevelService.list(wrapper).stream().map(l -> {
             OptionsVO vo = new OptionsVO();
             vo.setDictLabel(l.getName());

+ 12 - 3
fs-service-system/src/main/java/com/fs/crm/mapper/CrmCustomerMapper.java

@@ -143,6 +143,9 @@ public interface CrmCustomerMapper extends BaseMapper<CrmCustomer>
             "<if test = 'maps.deptId != null  and maps.deptId != 0 '> " +
             "AND (c.dept_id = #{maps.deptId} OR c.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) )) " +
             "</if>" +
+            "<if test = 'maps.customerLevel != null'> " +
+            "and c.customer_level =#{maps.customerLevel} " +
+            "</if>" +
             "${maps.params.dataScope}"+
             " order by c.customer_id desc "+
             "</script>"})
@@ -199,7 +202,7 @@ public interface CrmCustomerMapper extends BaseMapper<CrmCustomer>
             "<if test = 'maps.endTime != null and maps.endTime != \"\" '> " +
             "and date_format(c.create_time,'%y%m%d') &lt;= date_format(#{maps.endTime},'%y%m%d') " +
             "</if>" +
-            " order by c.is_top desc,c.customer_id desc "+
+            " order by c.customer_id desc "+
             "</script>"})
     List<CrmCustomerListVO> selectCrmCustomerListVO(@Param("maps")CrmCustomer crmCustomer);
 
@@ -266,8 +269,11 @@ public interface CrmCustomerMapper extends BaseMapper<CrmCustomer>
             "<if test = 'maps.deptId != null  and maps.deptId != 0 '> " +
             "AND (c.dept_id = #{maps.deptId} OR c.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) )) " +
             "</if>" +
+            "<if test = 'maps.customerLevel != null'> " +
+            "and c.customer_level = #{maps.customerLevel} " +
+            "</if>" +
             "${maps.params.dataScope}"+
-            " order by c.customer_id desc "+
+            " order by c.is_top desc, c.customer_id desc "+
             "</script>"})
     List<CrmCustomerListVO> selectCrmCustomerListQueryParam(@Param("maps")CrmCustomerListQueryParam crmCustomer);
 
@@ -412,7 +418,10 @@ public interface CrmCustomerMapper extends BaseMapper<CrmCustomer>
             "<if test = 'maps.endTime != null and maps.endTime != \"\" '> " +
             "and date_format(c.create_time,'%y%m%d') &lt;= date_format(#{maps.endTime},'%y%m%d') " +
             "</if>" +
-            " order by c.customer_id desc "+
+            "<if test = 'maps.customerLevel != null'> " +
+            "and c.customer_level =#{maps.customerLevel} " +
+            "</if>" +
+            " order by c.is_top desc,c.customer_id desc "+
             "</script>"})
     List<CrmLineCustomerListQueryVO> selectCrmLineCustomerListQuery(@Param("maps")CrmLineCustomerListQueryParam param);
 

+ 4 - 1
fs-service-system/src/main/java/com/fs/crm/param/CrmCustomerListQueryParam.java

@@ -2,7 +2,6 @@ package com.fs.crm.param;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fs.common.annotation.Excel;
-import com.fs.common.core.domain.BaseEntity;
 import com.fs.common.param.BaseQueryParam;
 import lombok.Data;
 
@@ -98,5 +97,9 @@ public class CrmCustomerListQueryParam extends BaseQueryParam
 
     private String[] receiveTimeList;
 
+    /**
+     * 客户级别
+     */
+    private Long customerLevel;
 
 }

+ 3 - 0
fs-service-system/src/main/java/com/fs/crm/param/CrmFullCustomerListQueryParam.java

@@ -87,4 +87,7 @@ public class CrmFullCustomerListQueryParam extends BaseQueryParam
 
     private Integer isPool;
 
+    /** 客户级别 */
+    private Long customerLevel;
+
 }

+ 2 - 0
fs-service-system/src/main/java/com/fs/crm/param/CrmLineCustomerListQueryParam.java

@@ -86,4 +86,6 @@ public class CrmLineCustomerListQueryParam extends BaseQueryParam
     @Excel(name = "标签" )
     private String tags;
 
+    /** 客户级别 */
+    private Long customerLevel;
 }

+ 3 - 0
fs-service-system/src/main/java/com/fs/crm/param/CrmMyCustomerListQueryParam.java

@@ -94,4 +94,7 @@ public class CrmMyCustomerListQueryParam extends BaseQueryParam
     private Integer isHisOrder;
     private String corpId;
 
+    /** 客户级别 */
+    private Long customerLevel;
+
 }

+ 3 - 0
fs-service-system/src/main/java/com/fs/crm/vo/CrmFullCustomerListQueryVO.java

@@ -101,4 +101,7 @@ public class CrmFullCustomerListQueryVO implements Serializable
     private String sourceCode;
     private String pushTime;
     private String pushCode;
+
+    /** 客户级别 */
+    private Long customerLevel;
 }

+ 4 - 0
fs-service-system/src/main/java/com/fs/crm/vo/CrmLineCustomerListQueryVO.java

@@ -106,5 +106,9 @@ public class CrmLineCustomerListQueryVO implements Serializable
     /** 非重客户Id(重客户最早录入手机号码的客户id) */
     private Long dCustomerId;
 
+    /** 客户级别 */
+    private Long customerLevel;
+    /** 是否置顶 0未置顶 1置顶 */
+    private Integer isTop;
 
 }

+ 3 - 0
fs-service-system/src/main/java/com/fs/crm/vo/CrmMyCustomerListQueryVO.java

@@ -123,4 +123,7 @@ public class CrmMyCustomerListQueryVO implements Serializable
     private List<String> assistUser;
     private Long companyUserId;
 
+    /** 客户级别 */
+    private Long customerLevel;
+
 }

+ 8 - 2
fs-service-system/src/main/resources/mapper/crm/CrmCustomerMapper.xml

@@ -302,13 +302,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectCrmMyCustomerListQuery" resultType="com.fs.crm.vo.CrmMyCustomerListQueryVO">
         select cu.*,c.create_time as customer_create_time,c.visit_status,c.remark,c.register_desc,c.register_submit_time,
                c.customer_code,c.customer_name,c.mobile,c.sex,c.weixin,c.address,c.is_receive,c.customer_type,c.source,
-               c.tags,c.receive_time
+               c.tags,c.receive_time,c.customer_level
         from crm_customer_user cu
             inner join crm_customer c on c.customer_user_id=cu.customer_user_id
         where cu.is_pool=0  and c.is_del = 0
         <if test="maps.companyId != null">
             and cu.company_id =#{maps.companyId}
         </if>
+        <if test="maps.customerLevel != null">
+            and c.customer_level =#{maps.customerLevel}
+        </if>
         <if test="maps.companyUserId != null">
             and cu.company_user_id =#{maps.companyUserId}
         </if>
@@ -368,7 +371,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectCrmMyAssistListQuery" resultType="com.fs.crm.vo.CrmMyCustomerListQueryVO">
         select cu.*,c.create_time as customer_create_time,c.visit_status,c.remark,c.register_desc,c.register_submit_time,
         c.customer_code,c.customer_name,c.mobile,c.sex,c.weixin,c.address,c.is_receive,c.customer_type,c.source,
-        c.tags,c.receive_time
+        c.tags,c.receive_time, c.customer_level
         from crm_customer_assist ca
         LEFT JOIN  crm_customer c on c.customer_id=ca.customer_id
         LEFT JOIN crm_customer_user cu on c.customer_user_id=cu.customer_user_id
@@ -379,6 +382,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="maps.companyUserId != null">
             and ca.company_user_id =#{maps.companyUserId}
         </if>
+        <if test="maps.customerLevel != null">
+            and c.customer_level =#{maps.customerLevel}
+        </if>
         <if test="maps.address != null and  maps.address != ''">
             and c.address like CONCAT('%',#{maps.address},'%')
         </if>