Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

yjwang 1 месяц назад
Родитель
Сommit
8f910f59c7

+ 13 - 1
fs-company/src/main/java/com/fs/company/controller/crm/CrmCustomerAnalyzeController.java

@@ -45,6 +45,18 @@ public class CrmCustomerAnalyzeController extends BaseController
         return getDataTable(list);
     }
 
+    /**
+     * 查询所有客户(根据客户分组取客户最新一条数据)
+     */
+    @GetMapping("/listAll")
+    public TableDataInfo listAll(CrmCustomerAnalyze crmCustomerAnalyze)
+    {
+        startPage();
+        List<CrmCustomerAnalyze> list = crmCustomerAnalyzeService.selectCrmCustomerAnalyzeListAll(crmCustomerAnalyze);
+        return getDataTable(list);
+    }
+
+
     /**
      * 导出客户聊天记录分析列表
      */
@@ -54,7 +66,7 @@ public class CrmCustomerAnalyzeController extends BaseController
     public AjaxResult export(CrmCustomerAnalyze crmCustomerAnalyze)
     {
         List<CrmCustomerAnalyze> list = crmCustomerAnalyzeService.selectCrmCustomerAnalyzeList(crmCustomerAnalyze);
-        ExcelUtil<CrmCustomerAnalyze> util = new ExcelUtil<CrmCustomerAnalyze>(CrmCustomerAnalyze.class);
+        ExcelUtil<CrmCustomerAnalyze> util = new ExcelUtil<>(CrmCustomerAnalyze.class);
         return util.exportExcel(list, "客户聊天记录分析数据");
     }
 

+ 2 - 3
fs-service/src/main/java/com/fs/crm/domain/CrmCustomerAnalyze.java

@@ -38,8 +38,8 @@ public class CrmCustomerAnalyze extends BaseEntity{
     @Excel(name = "沟通总结")
     private String communicationSummary;
 
-    /** 流失风险等级 0:无风险;1:低风险;2:中风险;3:高风险 */
-    @Excel(name = "流失风险等级 0:无风险;1:低风险;2:中风险;3:高风险")
+    /** 流失风险等级 0:未知;1:无风险;2:低风险;3:中风险;4:高风险 */
+    @Excel(name = "流失风险等级 0:未知;1:无风险;2:低风险;3:中风险;4:高风险")
     private Long attritionLevel;
 
     /** 流失风险等级提示 */
@@ -66,5 +66,4 @@ public class CrmCustomerAnalyze extends BaseEntity{
     @Excel(name = "预留字符串型字段")
     private String reserveStr;
 
-
 }

+ 2 - 0
fs-service/src/main/java/com/fs/crm/mapper/CrmCustomerAnalyzeMapper.java

@@ -63,4 +63,6 @@ public interface CrmCustomerAnalyzeMapper extends BaseMapper<CrmCustomerAnalyze>
     CrmCustomerAnalyze selectLatestOne(@Param("customerId") Long customerId);
 
     int updateCustomerPortrait(@Param("customerId") Long customerId,@Param("customerPortrait") String customerPortrait);
+
+    List<CrmCustomerAnalyze> selectCrmCustomerAnalyzeListAll(CrmCustomerAnalyze crmCustomerAnalyze);
 }

+ 2 - 2
fs-service/src/main/java/com/fs/crm/mapper/CrmCustomerMapper.java

@@ -354,7 +354,7 @@ public interface CrmCustomerMapper extends BaseMapper<CrmCustomer> {
             ") ca ON TRUE " +
 //            "where is_line=0 " +
             "where 1=1 " +
-            "<if test = 'maps.attritionLevel != null and maps.attritionLevel != \"\" '> " +
+            "<if test = 'maps.attritionLevel != null'> " +
             "and ca.attrition_level = #{maps.attritionLevel} " +
             "</if>" +
             "<if test = 'maps.intentionDegreeGt != null'> " +
@@ -500,7 +500,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>" +
-            "<if test = 'maps.attritionLevel != null and maps.attritionLevel != \"\" '> " +
+            "<if test = 'maps.attritionLevel != null'> " +
             "and ca.attrition_level = #{maps.attritionLevel} " +
             "</if>" +
             "<if test = 'maps.intentionDegreeGt != null'> " +

+ 2 - 0
fs-service/src/main/java/com/fs/crm/service/ICrmCustomerAnalyzeService.java

@@ -60,4 +60,6 @@ public interface ICrmCustomerAnalyzeService extends IService<CrmCustomerAnalyze>
     int deleteCrmCustomerAnalyzeById(Long id);
 
     void aiGeneratedCustomerPortrait(String customerId, String dataJson,String logId);
+
+    List<CrmCustomerAnalyze> selectCrmCustomerAnalyzeListAll(CrmCustomerAnalyze crmCustomerAnalyze);
 }

+ 6 - 0
fs-service/src/main/java/com/fs/crm/service/impl/CrmCustomerAnalyzeServiceImpl.java

@@ -150,6 +150,12 @@ public class CrmCustomerAnalyzeServiceImpl extends ServiceImpl<CrmCustomerAnalyz
             baseMapper.updateCustomerPortrait(Long.valueOf(customerId),userInfo.toString());
         }
     }
+
+    @Override
+    public List<CrmCustomerAnalyze> selectCrmCustomerAnalyzeListAll(CrmCustomerAnalyze crmCustomerAnalyze) {
+        return baseMapper.selectCrmCustomerAnalyzeListAll(crmCustomerAnalyze);
+    }
+
     private Map<String, Object> buildRequestParam(Long customerId,
                                                          String communication) {
         Map<String, Object> requestParam = new HashMap<>();

+ 2 - 2
fs-service/src/main/java/com/fs/crm/vo/CrmLineCustomerListQueryVO.java

@@ -106,8 +106,8 @@ public class CrmLineCustomerListQueryVO implements Serializable
     /** 非重客户Id(重客户最早录入手机号码的客户id) */
     private Long dCustomerId;
 
-    /** 流失风险等级 0:无风险;1:低风险;2:中风险;3:高风险 */
-    @Excel(name = "流失风险等级 0:无风险;1:低风险;2:中风险;3:高风险")
+    /** 流失风险等级 0:未知;1:无风险;2:低风险;3:中风险;4:高风险 */
+    @Excel(name = "流失风险等级 0:未知;1:无风险;2:低风险;3:中风险;4:高风险")
     private Long attritionLevel;
     /** 意向度 */
     @Excel(name = "意向度")

+ 32 - 0
fs-service/src/main/resources/mapper/crm/CrmCustomerAnalyzeMapper.xml

@@ -42,6 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="reserveInt != null "> and reserve_int = #{reserveInt}</if>
             <if test="reserveStr != null  and reserveStr != ''"> and reserve_str = #{reserveStr}</if>
         </where>
+        order by create_time desc
     </select>
 
     <select id="selectCrmCustomerAnalyzeById" parameterType="Long" resultMap="CrmCustomerAnalyzeResult">
@@ -129,4 +130,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
+
+    <select id="selectCrmCustomerAnalyzeListAll" resultType="com.fs.crm.domain.CrmCustomerAnalyze">
+        select a.*, c.customer_name as customerName
+        from (SELECT t.*
+              FROM (SELECT id,
+                           customer_id,
+                           customer_portrait_json,
+                           attrition_level,
+                           intention_degree,
+                           create_time,
+                           ROW_NUMBER() OVER ( PARTITION BY customer_id ORDER BY create_time DESC, id DESC ) AS rn
+                    FROM crm_customer_analyze) t
+              WHERE t.rn = 1
+              ORDER BY t.create_time desc) a
+                 left join crm_customer c on a.customer_id = c.customer_id
+        <where>
+            <if test="customerId != null "> and a.customer_id = #{customerId}</if>
+            <if test="customerName != null  and customerName != ''"> and c.customer_name like concat('%', #{customerName}, '%')</if>
+            <if test="customerPortraitJson != null  and customerPortraitJson != ''"> and a.customer_portrait_json = #{customerPortraitJson}</if>
+            <if test="communicationAbstract != null  and communicationAbstract != ''"> and a.communication_abstract = #{communicationAbstract}</if>
+            <if test="communicationSummary != null  and communicationSummary != ''"> and a.communication_summary = #{communicationSummary}</if>
+            <if test="attritionLevel != null "> and a.attrition_level = #{attritionLevel}</if>
+            <if test="attritionLevelPrompt != null  and attritionLevelPrompt != ''"> and a.attrition_level_prompt like concat('%', #{attritionLevelPrompt}, '%')</if>
+            <if test="customerFocusJson != null  and customerFocusJson != ''"> and a.customer_focus_json = #{customerFocusJson}</if>
+            <if test="intentionDegree != null "> and a.intention_degree = #{intentionDegree}</if>
+            <if test="aiChatRecord != null  and aiChatRecord != ''"> and a.ai_chat_record = #{aiChatRecord}</if>
+            <if test="reserveInt != null "> and a.reserve_int = #{reserveInt}</if>
+            <if test="reserveStr != null  and reserveStr != ''"> and a.reserve_str = #{reserveStr}</if>
+        </where>
+        order by a.create_time desc
+    </select>
 </mapper>