jinshihui 8 月之前
父節點
當前提交
e52555ba3c

+ 22 - 13
linkwe-chinacoal/src/main/java/com/linkwechat/coal/modules/xxxt/system/controller/CustomerLeadsController.java

@@ -1,5 +1,6 @@
 package com.linkwechat.coal.modules.xxxt.system.controller;
 
+import com.linkwechat.coal.modules.xxxt.system.domain.entity.CustomerLeadsProcess;
 import com.linkwechat.coal.modules.xxxt.system.domain.vo.CustomerLeadsDetailsVo;
 import com.linkwechat.coal.modules.xxxt.system.domain.vo.CustomerLeadsFeedbackVo;
 import com.linkwechat.coal.modules.xxxt.system.service.ICustomerLeadsService;
@@ -7,6 +8,7 @@ import com.linkwechat.common.annotation.Log;
 import com.linkwechat.common.core.controller.BaseController;
 import com.linkwechat.common.core.domain.AjaxResult;
 import com.linkwechat.common.enums.BusinessType;
+import com.linkwechat.common.utils.StringUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -15,6 +17,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.LinkedList;
 import java.util.Map;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -59,7 +62,7 @@ public class CustomerLeadsController extends BaseController {
      * @param userId
      * @return AjaxResult<CustomerLeadsDetailsVo>
      */
-     @ApiOperation(value = "查询客户线索详情", notes = "根据用户ID查询客户线索详情")
+    @ApiOperation(value = "查询客户线索详情", notes = "根据用户ID查询客户线索详情")
     @GetMapping("/detail")
     public AjaxResult<CustomerLeadsDetailsVo> detail(@ApiParam(value = "用户ID", required = true) @RequestParam Long userId) {
         try {
@@ -80,30 +83,33 @@ public class CustomerLeadsController extends BaseController {
 
     /**
      * 查询客户线索反馈列表
-     * @param query
-     * @return 客户线索反馈列表
+     *
+     * @param userId
+     * @return TableDataInfo<CustomerLeadsFeedbackVo> 客户线索反馈列表
      */
-     @ApiOperation(value = "查询客户线索反馈列表", notes = "根据用户ID查询客户线索反馈列表")
+    @ApiOperation(value = "查询客户线索反馈列表", notes = "根据用户ID查询客户线索反馈列表")
     @GetMapping("/feedback")
     public TableDataInfo<CustomerLeadsFeedbackVo> feedbackList(@RequestParam Long userId) {
-        List<CustomerLeads> list = customerLeadsService.selectCustomerLeadsFeedbackList(userId);
-        List<CustomerLeadsFeedbackVo> voList = list.stream().map(item -> {
-            CustomerLeadsFeedbackVo vo = new CustomerLeadsFeedbackVo();
-            BeanUtils.copyProperties(item, vo);
-            vo.setCreatedTime(item.getCreatedTime());
-            return vo;
-        }).collect(Collectors.toList());
-        return getDataTable(voList);
+        List<CustomerLeadsProcess> customerLeadsProcesses = customerLeadsService.selectCustomerLeadsFeedbackList(userId);
+        List<CustomerLeadsFeedbackVo> list = customerLeadsProcesses.stream()
+                .map(process -> {
+                    CustomerLeadsFeedbackVo vo = new CustomerLeadsFeedbackVo();
+                    BeanUtils.copyProperties(process, vo);
+                    vo.setCreatedTime(process.getProcessTime());
+                    return vo;
+                })
+                .collect(Collectors.toList());
+        return getDataTable(list);
     }
 
 
     /**
      * 处理客户线索
+     *
      * @param request
      * @return AjaxResult
      */
     @ApiOperation(value = "处理客户线索", notes = "处理客户线索,更新客户意向和关键信息")
-    @Log(title = "处理客户线索", businessType = BusinessType.UPDATE)
     @PostMapping("/process")
     public AjaxResult processCustomerLeads(@RequestBody CustomerLeadsProcessRequest request) {
         try {
@@ -113,6 +119,9 @@ public class CustomerLeadsController extends BaseController {
             if (request.getCustomerIntent() == null || request.getCustomerIntent().trim().isEmpty()) {
                 return AjaxResult.error("客户意向不能为空");
             }
+            if (request.getKeyInfoDescription() == null || request.getKeyInfoDescription().trim().isEmpty()) {
+                return AjaxResult.error("关键信息描述不能为空");
+            }
 
             boolean result = customerLeadsService.processCustomerLeads(request);
             if (result) {

+ 46 - 0
linkwe-chinacoal/src/main/java/com/linkwechat/coal/modules/xxxt/system/domain/entity/CustomerLeadsProcess.java

@@ -0,0 +1,46 @@
+package com.linkwechat.coal.modules.xxxt.system.domain.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 客户线索处理记录
+ *
+ * @author linkwechat
+ * @since 2025-12-04
+ */
+@Data
+@TableName("customer_leads_process")
+public class CustomerLeadsProcess implements Serializable {
+
+    /**
+     * 主键ID
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 用户ID
+     */
+    private Long userId;
+
+    /**
+     * 客户意图(1: 初步了解 2: 确认投保)
+     */
+    private String customerIntent;
+
+    /**
+     * 关键信息描述
+     */
+    private String keyInfoDescription;
+
+    /**
+     * 处理时间
+     */
+    private Date processTime;
+}

+ 17 - 0
linkwe-chinacoal/src/main/java/com/linkwechat/coal/modules/xxxt/system/mapper/CustomerLeadsProcessMapper.java

@@ -0,0 +1,17 @@
+package com.linkwechat.coal.modules.xxxt.system.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.linkwechat.coal.modules.xxxt.system.domain.entity.CustomerLeads;
+import com.linkwechat.coal.modules.xxxt.system.domain.entity.CustomerLeadsProcess;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 客户线索Mapper接口
+ *
+ * @author linkwechat
+ * @since 2025-12-04
+ */
+@Mapper
+public interface CustomerLeadsProcessMapper extends BaseMapper<CustomerLeadsProcess> {
+
+}

+ 3 - 2
linkwe-chinacoal/src/main/java/com/linkwechat/coal/modules/xxxt/system/service/ICustomerLeadsService.java

@@ -1,6 +1,7 @@
 package com.linkwechat.coal.modules.xxxt.system.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.linkwechat.coal.modules.xxxt.system.domain.entity.CustomerLeads;
+import com.linkwechat.coal.modules.xxxt.system.domain.entity.CustomerLeadsProcess;
 import com.linkwechat.coal.modules.xxxt.system.domain.query.CustomerLeadsQuery;
 import java.util.List;
 import com.linkwechat.coal.modules.xxxt.system.domain.query.CustomerLeadsProcessRequest;
@@ -44,7 +45,7 @@ public interface ICustomerLeadsService extends IService<CustomerLeads> {
      * 查询客户线索反馈列表
      *
      * @param userId 用户ID
-     * @return List<CustomerLeads> 客户线索反馈列表
+     * @return List<CustomerLeadsProcess> 客户线索反馈列表
      */
-    List<CustomerLeads> selectCustomerLeadsFeedbackList(Long userId);
+    List<CustomerLeadsProcess> selectCustomerLeadsFeedbackList(Long userId);
 }

+ 25 - 19
linkwe-chinacoal/src/main/java/com/linkwechat/coal/modules/xxxt/system/service/impl/CustomerLeadsServiceImpl.java

@@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.linkwechat.coal.modules.bdshdb.customer.domain.entity.LocalAppUser;
 import com.linkwechat.coal.modules.bdshdb.customer.service.ILocalAppUserService;
 import com.linkwechat.coal.modules.xxxt.system.domain.entity.CustomerLeads;
+import com.linkwechat.coal.modules.xxxt.system.domain.entity.CustomerLeadsProcess;
 import com.linkwechat.coal.modules.xxxt.system.mapper.CustomerLeadsMapper;
+import com.linkwechat.coal.modules.xxxt.system.mapper.CustomerLeadsProcessMapper;
 import com.linkwechat.coal.modules.xxxt.system.service.ICustomerLeadsService;
 import com.linkwechat.domain.WeUser;
 import com.linkwechat.service.IWeUserService;
@@ -34,6 +36,9 @@ public class CustomerLeadsServiceImpl extends ServiceImpl<CustomerLeadsMapper, C
     @Autowired
     private ILocalAppUserService localAppUserService;
 
+    @Autowired
+    private CustomerLeadsProcessMapper customerLeadsProcessMapper;
+
     /**
      * 从主数据库(SCRM)查询用户
      * @param phone 手机号码
@@ -137,13 +142,15 @@ public class CustomerLeadsServiceImpl extends ServiceImpl<CustomerLeadsMapper, C
     @Override
     public List<CustomerLeads> selectCustomerLeadsList(CustomerLeadsQuery query) {
         LambdaQueryWrapper<CustomerLeads> wrapper = new LambdaQueryWrapper<>();
-
+        //用户ID
         if (query.getUserId() != null) {
             wrapper.eq(CustomerLeads::getUserId, query.getUserId());
         }
+        //客户姓名
         if (StringUtils.isNotEmpty(query.getUserName())) {
             wrapper.like(CustomerLeads::getUserName, query.getUserName());
         }
+        //手机号
         if (StringUtils.isNotEmpty(query.getPhone())) {
             wrapper.eq(CustomerLeads::getPhone, query.getPhone());
         }
@@ -167,26 +174,25 @@ public class CustomerLeadsServiceImpl extends ServiceImpl<CustomerLeadsMapper, C
     @Override
     public boolean processCustomerLeads(CustomerLeadsProcessRequest request) {
         try {
-            if (request.getUserId() == null) {
-                log.warn("处理客户线索失败:用户ID不能为空");
-                return false;
-            }
-
             // 查询客户线索
             CustomerLeads customerLeads = this.getById(request.getUserId());
             if (customerLeads == null) {
-                log.warn("处理客户线索失败:未找到用户ID为 {} 的客户线索", request.getUserId());
+                log.error("处理客户线索失败:未找到用户ID为 {} 的客户线索", request.getUserId());
                 return false;
             }
-
-            // 更新处理信息
-            customerLeads.setProcessingStatus(1); // 1-已处理
             customerLeads.setCustomerIntent(request.getCustomerIntent());
+            //关键信息描述
             customerLeads.setKeyInfoDescription(request.getKeyInfoDescription());
-            customerLeads.setUpdatedBy("system");
-            customerLeads.setUpdatedTime(new Date());
-
-            return this.updateById(customerLeads);
+            //处理状态
+            customerLeads.setProcessingStatus(1);
+            this.updateById(customerLeads);
+
+            CustomerLeadsProcess customerLeadsProcess = new CustomerLeadsProcess();
+            customerLeadsProcess.setUserId(request.getUserId());
+            customerLeadsProcess.setCustomerIntent(request.getCustomerIntent());
+            customerLeadsProcess.setKeyInfoDescription(request.getKeyInfoDescription());
+            customerLeadsProcess.setProcessTime(new Date());
+            return customerLeadsProcessMapper.insert(customerLeadsProcess) > 0;
         } catch (Exception e) {
             log.error("处理客户线索失败: userId={}, error={}", request.getUserId(), e.getMessage(), e);
             return false;
@@ -197,12 +203,12 @@ public class CustomerLeadsServiceImpl extends ServiceImpl<CustomerLeadsMapper, C
      * 查询客户线索反馈列表
      *
      * @param userId 用户ID
-     * @return List<CustomerLeads> 客户线索反馈列表
+     * @return CustomerLeads 客户线索反馈列表
      */
     @Override
-    public List<CustomerLeads> selectCustomerLeadsFeedbackList(Long userId) {
-        LambdaQueryWrapper<CustomerLeads> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(CustomerLeads::getUserId, userId);
-        return this.list(wrapper);
+    public List<CustomerLeadsProcess> selectCustomerLeadsFeedbackList(Long userId) {
+        LambdaQueryWrapper<CustomerLeadsProcess> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(CustomerLeadsProcess::getUserId, userId);
+        return customerLeadsProcessMapper.selectList(wrapper);
     }
 }