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

初始化客户ai分析结构体

peicj 18 часов назад
Родитель
Сommit
27b93ac2b9

+ 103 - 0
fs-company/src/main/java/com/fs/company/controller/crm/CrmCustomerAnalyzeController.java

@@ -0,0 +1,103 @@
+package com.fs.company.controller.crm;
+
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.crm.domain.CrmCustomerAnalyze;
+import com.fs.crm.service.ICrmCustomerAnalyzeService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 客户聊天记录分析Controller
+ * 
+ * @author fs
+ * @date 2026-03-24
+ */
+@RestController
+@RequestMapping("/crm/analyze")
+public class CrmCustomerAnalyzeController extends BaseController
+{
+    @Autowired
+    private ICrmCustomerAnalyzeService crmCustomerAnalyzeService;
+
+    /**
+     * 查询客户聊天记录分析列表
+     */
+    @PreAuthorize("@ss.hasPermi('crm:analyze:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CrmCustomerAnalyze crmCustomerAnalyze)
+    {
+        startPage();
+        List<CrmCustomerAnalyze> list = crmCustomerAnalyzeService.selectCrmCustomerAnalyzeList(crmCustomerAnalyze);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出客户聊天记录分析列表
+     */
+    @PreAuthorize("@ss.hasPermi('crm:analyze:export')")
+    @Log(title = "客户聊天记录分析", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CrmCustomerAnalyze crmCustomerAnalyze)
+    {
+        List<CrmCustomerAnalyze> list = crmCustomerAnalyzeService.selectCrmCustomerAnalyzeList(crmCustomerAnalyze);
+        ExcelUtil<CrmCustomerAnalyze> util = new ExcelUtil<CrmCustomerAnalyze>(CrmCustomerAnalyze.class);
+        return util.exportExcel(list, "客户聊天记录分析数据");
+    }
+
+    /**
+     * 获取客户聊天记录分析详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('crm:analyze:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(crmCustomerAnalyzeService.selectCrmCustomerAnalyzeById(id));
+    }
+
+    /**
+     * 新增客户聊天记录分析
+     */
+    @PreAuthorize("@ss.hasPermi('crm:analyze:add')")
+    @Log(title = "客户聊天记录分析", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CrmCustomerAnalyze crmCustomerAnalyze)
+    {
+        return toAjax(crmCustomerAnalyzeService.insertCrmCustomerAnalyze(crmCustomerAnalyze));
+    }
+
+    /**
+     * 修改客户聊天记录分析
+     */
+    @PreAuthorize("@ss.hasPermi('crm:analyze:edit')")
+    @Log(title = "客户聊天记录分析", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CrmCustomerAnalyze crmCustomerAnalyze)
+    {
+        return toAjax(crmCustomerAnalyzeService.updateCrmCustomerAnalyze(crmCustomerAnalyze));
+    }
+
+    /**
+     * 删除客户聊天记录分析
+     */
+    @PreAuthorize("@ss.hasPermi('crm:analyze:remove')")
+    @Log(title = "客户聊天记录分析", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(crmCustomerAnalyzeService.deleteCrmCustomerAnalyzeByIds(ids));
+    }
+}

+ 66 - 0
fs-service/src/main/java/com/fs/crm/domain/CrmCustomerAnalyze.java

@@ -0,0 +1,66 @@
+package com.fs.crm.domain;
+
+import com.fs.common.annotation.Excel;
+import lombok.Data;
+import com.fs.common.core.domain.BaseEntity;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 客户聊天记录分析对象 crm_customer_analyze
+ *
+ * @author fs
+ * @date 2026-03-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class CrmCustomerAnalyze extends BaseEntity{
+
+    /** 主键 */
+    private Long id;
+
+    /** 客户id */
+    @Excel(name = "客户id")
+    private Long customerId;
+
+    /** 客户姓名 */
+    @Excel(name = "客户姓名")
+    private String customerName;
+
+    /** 客户画像 */
+    @Excel(name = "客户画像")
+    private String customerPortraitJson;
+
+    /** 沟通摘要 */
+    @Excel(name = "沟通摘要")
+    private String communicationAbstract;
+
+    /** 沟通总结 */
+    @Excel(name = "沟通总结")
+    private String communicationSummary;
+
+    /** 流失风险等级 0:无风险;1:低风险;2:中风险;3:高风险 */
+    @Excel(name = "流失风险等级 0:无风险;1:低风险;2:中风险;3:高风险")
+    private Long attritionLevel;
+
+    /** 客户关注点 */
+    @Excel(name = "客户关注点")
+    private String customerFocusJson;
+
+    /** 意向度 */
+    @Excel(name = "意向度")
+    private Long intentionDegree;
+
+    /** ai通话聊天记录 */
+    @Excel(name = "ai通话聊天记录")
+    private String aiChatRecord;
+
+    /** 预留数字型字段 */
+    @Excel(name = "预留数字型字段")
+    private Long reserveInt;
+
+    /** 预留字符串型字段 */
+    @Excel(name = "预留字符串型字段")
+    private String reserveStr;
+
+
+}

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

@@ -0,0 +1,61 @@
+package com.fs.crm.mapper;
+
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fs.crm.domain.CrmCustomerAnalyze;
+
+/**
+ * 客户聊天记录分析Mapper接口
+ * 
+ * @author fs
+ * @date 2026-03-24
+ */
+public interface CrmCustomerAnalyzeMapper extends BaseMapper<CrmCustomerAnalyze>{
+    /**
+     * 查询客户聊天记录分析
+     * 
+     * @param id 客户聊天记录分析主键
+     * @return 客户聊天记录分析
+     */
+    CrmCustomerAnalyze selectCrmCustomerAnalyzeById(Long id);
+
+    /**
+     * 查询客户聊天记录分析列表
+     * 
+     * @param crmCustomerAnalyze 客户聊天记录分析
+     * @return 客户聊天记录分析集合
+     */
+    List<CrmCustomerAnalyze> selectCrmCustomerAnalyzeList(CrmCustomerAnalyze crmCustomerAnalyze);
+
+    /**
+     * 新增客户聊天记录分析
+     * 
+     * @param crmCustomerAnalyze 客户聊天记录分析
+     * @return 结果
+     */
+    int insertCrmCustomerAnalyze(CrmCustomerAnalyze crmCustomerAnalyze);
+
+    /**
+     * 修改客户聊天记录分析
+     * 
+     * @param crmCustomerAnalyze 客户聊天记录分析
+     * @return 结果
+     */
+    int updateCrmCustomerAnalyze(CrmCustomerAnalyze crmCustomerAnalyze);
+
+    /**
+     * 删除客户聊天记录分析
+     * 
+     * @param id 客户聊天记录分析主键
+     * @return 结果
+     */
+    int deleteCrmCustomerAnalyzeById(Long id);
+
+    /**
+     * 批量删除客户聊天记录分析
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteCrmCustomerAnalyzeByIds(Long[] ids);
+}

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

@@ -0,0 +1,61 @@
+package com.fs.crm.service;
+
+import java.util.List;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fs.crm.domain.CrmCustomerAnalyze;
+
+/**
+ * 客户聊天记录分析Service接口
+ * 
+ * @author fs
+ * @date 2026-03-24
+ */
+public interface ICrmCustomerAnalyzeService extends IService<CrmCustomerAnalyze>{
+    /**
+     * 查询客户聊天记录分析
+     * 
+     * @param id 客户聊天记录分析主键
+     * @return 客户聊天记录分析
+     */
+    CrmCustomerAnalyze selectCrmCustomerAnalyzeById(Long id);
+
+    /**
+     * 查询客户聊天记录分析列表
+     * 
+     * @param crmCustomerAnalyze 客户聊天记录分析
+     * @return 客户聊天记录分析集合
+     */
+    List<CrmCustomerAnalyze> selectCrmCustomerAnalyzeList(CrmCustomerAnalyze crmCustomerAnalyze);
+
+    /**
+     * 新增客户聊天记录分析
+     * 
+     * @param crmCustomerAnalyze 客户聊天记录分析
+     * @return 结果
+     */
+    int insertCrmCustomerAnalyze(CrmCustomerAnalyze crmCustomerAnalyze);
+
+    /**
+     * 修改客户聊天记录分析
+     * 
+     * @param crmCustomerAnalyze 客户聊天记录分析
+     * @return 结果
+     */
+    int updateCrmCustomerAnalyze(CrmCustomerAnalyze crmCustomerAnalyze);
+
+    /**
+     * 批量删除客户聊天记录分析
+     * 
+     * @param ids 需要删除的客户聊天记录分析主键集合
+     * @return 结果
+     */
+    int deleteCrmCustomerAnalyzeByIds(Long[] ids);
+
+    /**
+     * 删除客户聊天记录分析信息
+     * 
+     * @param id 客户聊天记录分析主键
+     * @return 结果
+     */
+    int deleteCrmCustomerAnalyzeById(Long id);
+}

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

@@ -0,0 +1,92 @@
+package com.fs.crm.service.impl;
+
+import java.util.List;
+import com.fs.common.utils.DateUtils;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import com.fs.crm.mapper.CrmCustomerAnalyzeMapper;
+import com.fs.crm.domain.CrmCustomerAnalyze;
+import com.fs.crm.service.ICrmCustomerAnalyzeService;
+
+/**
+ * 客户聊天记录分析Service业务层处理
+ * 
+ * @author fs
+ * @date 2026-03-24
+ */
+@Service
+public class CrmCustomerAnalyzeServiceImpl extends ServiceImpl<CrmCustomerAnalyzeMapper, CrmCustomerAnalyze> implements ICrmCustomerAnalyzeService {
+
+    /**
+     * 查询客户聊天记录分析
+     * 
+     * @param id 客户聊天记录分析主键
+     * @return 客户聊天记录分析
+     */
+    @Override
+    public CrmCustomerAnalyze selectCrmCustomerAnalyzeById(Long id)
+    {
+        return baseMapper.selectCrmCustomerAnalyzeById(id);
+    }
+
+    /**
+     * 查询客户聊天记录分析列表
+     * 
+     * @param crmCustomerAnalyze 客户聊天记录分析
+     * @return 客户聊天记录分析
+     */
+    @Override
+    public List<CrmCustomerAnalyze> selectCrmCustomerAnalyzeList(CrmCustomerAnalyze crmCustomerAnalyze)
+    {
+        return baseMapper.selectCrmCustomerAnalyzeList(crmCustomerAnalyze);
+    }
+
+    /**
+     * 新增客户聊天记录分析
+     * 
+     * @param crmCustomerAnalyze 客户聊天记录分析
+     * @return 结果
+     */
+    @Override
+    public int insertCrmCustomerAnalyze(CrmCustomerAnalyze crmCustomerAnalyze)
+    {
+        crmCustomerAnalyze.setCreateTime(DateUtils.getNowDate());
+        return baseMapper.insertCrmCustomerAnalyze(crmCustomerAnalyze);
+    }
+
+    /**
+     * 修改客户聊天记录分析
+     * 
+     * @param crmCustomerAnalyze 客户聊天记录分析
+     * @return 结果
+     */
+    @Override
+    public int updateCrmCustomerAnalyze(CrmCustomerAnalyze crmCustomerAnalyze)
+    {
+        return baseMapper.updateCrmCustomerAnalyze(crmCustomerAnalyze);
+    }
+
+    /**
+     * 批量删除客户聊天记录分析
+     * 
+     * @param ids 需要删除的客户聊天记录分析主键
+     * @return 结果
+     */
+    @Override
+    public int deleteCrmCustomerAnalyzeByIds(Long[] ids)
+    {
+        return baseMapper.deleteCrmCustomerAnalyzeByIds(ids);
+    }
+
+    /**
+     * 删除客户聊天记录分析信息
+     * 
+     * @param id 客户聊天记录分析主键
+     * @return 结果
+     */
+    @Override
+    public int deleteCrmCustomerAnalyzeById(Long id)
+    {
+        return baseMapper.deleteCrmCustomerAnalyzeById(id);
+    }
+}

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

@@ -0,0 +1,114 @@
+<?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.fs.crm.mapper.CrmCustomerAnalyzeMapper">
+    
+    <resultMap type="CrmCustomerAnalyze" id="CrmCustomerAnalyzeResult">
+        <result property="id"    column="id"    />
+        <result property="customerId"    column="customer_id"    />
+        <result property="customerName"    column="customer_name"    />
+        <result property="customerPortraitJson"    column="customer_portrait_json"    />
+        <result property="communicationAbstract"    column="communication_abstract"    />
+        <result property="communicationSummary"    column="communication_summary"    />
+        <result property="attritionLevel"    column="attrition_level"    />
+        <result property="customerFocusJson"    column="customer_focus_json"    />
+        <result property="intentionDegree"    column="intention_degree"    />
+        <result property="aiChatRecord"    column="ai_chat_record"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="remark"    column="remark"    />
+        <result property="reserveInt"    column="reserve_int"    />
+        <result property="reserveStr"    column="reserve_str"    />
+    </resultMap>
+
+    <sql id="selectCrmCustomerAnalyzeVo">
+        select id, customer_id, customer_name, customer_portrait_json, communication_abstract, communication_summary, attrition_level, customer_focus_json, intention_degree, ai_chat_record, create_time, remark, reserve_int, reserve_str from crm_customer_analyze
+    </sql>
+
+    <select id="selectCrmCustomerAnalyzeList" parameterType="CrmCustomerAnalyze" resultMap="CrmCustomerAnalyzeResult">
+        <include refid="selectCrmCustomerAnalyzeVo"/>
+        <where>  
+            <if test="customerId != null "> and customer_id = #{customerId}</if>
+            <if test="customerName != null  and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
+            <if test="customerPortraitJson != null  and customerPortraitJson != ''"> and customer_portrait_json = #{customerPortraitJson}</if>
+            <if test="communicationAbstract != null  and communicationAbstract != ''"> and communication_abstract = #{communicationAbstract}</if>
+            <if test="communicationSummary != null  and communicationSummary != ''"> and communication_summary = #{communicationSummary}</if>
+            <if test="attritionLevel != null "> and attrition_level = #{attritionLevel}</if>
+            <if test="customerFocusJson != null  and customerFocusJson != ''"> and customer_focus_json = #{customerFocusJson}</if>
+            <if test="intentionDegree != null "> and intention_degree = #{intentionDegree}</if>
+            <if test="aiChatRecord != null  and aiChatRecord != ''"> and ai_chat_record = #{aiChatRecord}</if>
+            <if test="reserveInt != null "> and reserve_int = #{reserveInt}</if>
+            <if test="reserveStr != null  and reserveStr != ''"> and reserve_str = #{reserveStr}</if>
+        </where>
+    </select>
+    
+    <select id="selectCrmCustomerAnalyzeById" parameterType="Long" resultMap="CrmCustomerAnalyzeResult">
+        <include refid="selectCrmCustomerAnalyzeVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertCrmCustomerAnalyze" parameterType="CrmCustomerAnalyze" useGeneratedKeys="true" keyProperty="id">
+        insert into crm_customer_analyze
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="customerId != null">customer_id,</if>
+            <if test="customerName != null">customer_name,</if>
+            <if test="customerPortraitJson != null">customer_portrait_json,</if>
+            <if test="communicationAbstract != null">communication_abstract,</if>
+            <if test="communicationSummary != null">communication_summary,</if>
+            <if test="attritionLevel != null">attrition_level,</if>
+            <if test="customerFocusJson != null">customer_focus_json,</if>
+            <if test="intentionDegree != null">intention_degree,</if>
+            <if test="aiChatRecord != null">ai_chat_record,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="remark != null and remark != ''">remark,</if>
+            <if test="reserveInt != null">reserve_int,</if>
+            <if test="reserveStr != null and reserveStr != ''">reserve_str,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="customerId != null">#{customerId},</if>
+            <if test="customerName != null">#{customerName},</if>
+            <if test="customerPortraitJson != null">#{customerPortraitJson},</if>
+            <if test="communicationAbstract != null">#{communicationAbstract},</if>
+            <if test="communicationSummary != null">#{communicationSummary},</if>
+            <if test="attritionLevel != null">#{attritionLevel},</if>
+            <if test="customerFocusJson != null">#{customerFocusJson},</if>
+            <if test="intentionDegree != null">#{intentionDegree},</if>
+            <if test="aiChatRecord != null">#{aiChatRecord},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="remark != null and remark != ''">#{remark},</if>
+            <if test="reserveInt != null">#{reserveInt},</if>
+            <if test="reserveStr != null and reserveStr != ''">#{reserveStr},</if>
+         </trim>
+    </insert>
+
+    <update id="updateCrmCustomerAnalyze" parameterType="CrmCustomerAnalyze">
+        update crm_customer_analyze
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="customerId != null">customer_id = #{customerId},</if>
+            <if test="customerName != null">customer_name = #{customerName},</if>
+            <if test="customerPortraitJson != null">customer_portrait_json = #{customerPortraitJson},</if>
+            <if test="communicationAbstract != null">communication_abstract = #{communicationAbstract},</if>
+            <if test="communicationSummary != null">communication_summary = #{communicationSummary},</if>
+            <if test="attritionLevel != null">attrition_level = #{attritionLevel},</if>
+            <if test="customerFocusJson != null">customer_focus_json = #{customerFocusJson},</if>
+            <if test="intentionDegree != null">intention_degree = #{intentionDegree},</if>
+            <if test="aiChatRecord != null">ai_chat_record = #{aiChatRecord},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="remark != null and remark != ''">remark = #{remark},</if>
+            <if test="reserveInt != null">reserve_int = #{reserveInt},</if>
+            <if test="reserveStr != null and reserveStr != ''">reserve_str = #{reserveStr},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteCrmCustomerAnalyzeById" parameterType="Long">
+        delete from crm_customer_analyze where id = #{id}
+    </delete>
+
+    <delete id="deleteCrmCustomerAnalyzeByIds" parameterType="String">
+        delete from crm_customer_analyze where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>