2 Commits e3e46aafc1 ... 503328dc2a

Author SHA1 Message Date
  ct 503328dc2a Merge remote-tracking branch 'origin/master' 1 week ago
  ct cdeef728e9 add:协作客户 1 week ago

+ 115 - 0
fs-company/src/main/java/com/fs/crm/controller/CrmCustomerAssistController.java

@@ -0,0 +1,115 @@
+package com.fs.crm.controller;
+
+import java.util.List;
+
+import com.fs.crm.param.CrmCustomerAssistDeLParam;
+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.CrmCustomerAssist;
+import com.fs.crm.service.ICrmCustomerAssistService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 客户员工协作Controller
+ *
+ * @author fs
+ * @date 2025-05-27
+ */
+@RestController
+@RequestMapping("/crm/assist")
+public class CrmCustomerAssistController extends BaseController
+{
+    @Autowired
+    private ICrmCustomerAssistService crmCustomerAssistService;
+
+    /**
+     * 查询客户员工协作列表
+     */
+    @PreAuthorize("@ss.hasPermi('crm:assist:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CrmCustomerAssist crmCustomerAssist)
+    {
+        startPage();
+        List<CrmCustomerAssist> list = crmCustomerAssistService.selectCrmCustomerAssistList(crmCustomerAssist);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出客户员工协作列表
+     */
+    @PreAuthorize("@ss.hasPermi('crm:assist:export')")
+    @Log(title = "客户员工协作", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CrmCustomerAssist crmCustomerAssist)
+    {
+        List<CrmCustomerAssist> list = crmCustomerAssistService.selectCrmCustomerAssistList(crmCustomerAssist);
+        ExcelUtil<CrmCustomerAssist> util = new ExcelUtil<CrmCustomerAssist>(CrmCustomerAssist.class);
+        return util.exportExcel(list, "assist");
+    }
+
+    /**
+     * 获取客户员工协作详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('crm:assist:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(crmCustomerAssistService.selectCrmCustomerAssistById(id));
+    }
+
+    /**
+     * 新增客户员工协作
+     */
+    @PreAuthorize("@ss.hasPermi('crm:assist:add')")
+    @Log(title = "客户员工协作", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CrmCustomerAssist crmCustomerAssist)
+    {
+        return toAjax(crmCustomerAssistService.insertCrmCustomerAssist(crmCustomerAssist));
+    }
+
+    /**
+     * 修改客户员工协作
+     */
+    @PreAuthorize("@ss.hasPermi('crm:assist:edit')")
+    @Log(title = "客户员工协作", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CrmCustomerAssist crmCustomerAssist)
+    {
+        return toAjax(crmCustomerAssistService.updateCrmCustomerAssist(crmCustomerAssist));
+    }
+
+    /**
+     * 删除客户员工协作
+     */
+    @Log(title = "客户员工协作", businessType = BusinessType.DELETE)
+    @PostMapping("/remove")
+    public AjaxResult removeByCustomer(@RequestBody CrmCustomerAssistDeLParam param)
+    {
+        return toAjax(crmCustomerAssistService.removeByCustomer(param));
+    }
+
+    /**
+     * 删除客户员工协作
+     */
+    @PreAuthorize("@ss.hasPermi('crm:assist:remove')")
+    @Log(title = "客户员工协作", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(crmCustomerAssistService.deleteCrmCustomerAssistByIds(ids));
+    }
+}

+ 36 - 0
fs-company/src/main/java/com/fs/crm/controller/CrmCustomerController.java

@@ -119,6 +119,29 @@ public class CrmCustomerController extends BaseController
 
     }
 
+    @ApiOperation("获取我的协作客户列表")
+    @PreAuthorize("@ss.hasPermi('crm:customer:assistList')")
+    @GetMapping("/getMyAssistList")
+    public TableDataInfo getMyAssistList(CrmMyCustomerListQueryParam param){
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
+        param.setCompanyUserId(loginUser.getUser().getUserId());
+        param.setCompanyId(loginUser.getCompany().getCompanyId());
+        if(!StringUtils.isEmpty(param.getCreateTimeRange())){
+            param.setCustomerCreateTime(param.getCreateTimeRange().split("--"));
+        }
+        List<CrmMyCustomerListQueryVO> list = crmCustomerService.selectCrmMyAssistListQuery(param);
+        if (list != null) {
+            for (CrmMyCustomerListQueryVO vo : list) {
+                if(vo.getMobile()!=null){
+                    vo.setMobile(vo.getMobile().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
+                }
+            }
+        }
+        return getDataTable(list);
+
+    }
+
     @ApiOperation("获取客户列表")
     @GetMapping("/getCustomerList")
     @PreAuthorize("@ss.hasPermi('crm:customer:list')")
@@ -212,6 +235,19 @@ public class CrmCustomerController extends BaseController
         return crmCustomerService.assignToUser(loginUser.getUsername(),loginUser.getUser().getUserId(),param);
     }
 
+    //添加协作人
+    @PreAuthorize("@ss.hasPermi('crm:customer:assistToUser')")
+    @PostMapping("/assistToUser")
+    public R assistToUser(@RequestBody CrmCustomeAssignParam param)
+    {
+        if(param.getCustomerIds().size()>1000){
+            return R.error("分配数据超出范围,最大1000条");
+        }
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        param.setCompanyId(loginUser.getCompany().getCompanyId());
+        return crmCustomerService.assistToUser(loginUser.getUsername(),loginUser.getUser().getUserId(),param);
+    }
+
 
     @PreAuthorize("@ss.hasPermi('crm:customer:add')")
     @Log(title = "创建客户", businessType = BusinessType.INSERT)

+ 36 - 0
fs-service-system/src/main/java/com/fs/crm/domain/CrmCustomerAssist.java

@@ -0,0 +1,36 @@
+package com.fs.crm.domain;
+
+import com.fs.common.annotation.Excel;
+import com.fs.common.core.domain.BaseEntity;
+import lombok.Data;
+
+/**
+ * 客户员工协作对象 crm_customer_assist
+ *
+ * @author fs
+ * @date 2025-05-27
+ */
+@Data
+public class CrmCustomerAssist extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private Long id;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Long companyId;
+
+    /** 销售ID */
+    @Excel(name = "销售ID")
+    private Long companyUserId;
+
+    /** 销售名字 */
+    @Excel(name = "销售名字")
+    private String companyUserName;
+
+    /** 销售公司ID */
+    @Excel(name = "销售公司ID")
+    private Long customerId;
+}

+ 2 - 1
fs-service-system/src/main/java/com/fs/crm/enums/CustomerLogEnum.java

@@ -13,7 +13,8 @@ public enum CustomerLogEnum {
     RECEIVE(3,"认领"),
     RECOVER(4,"回收"),
     ASSIGN_USER(5,"分配员工"),
-    CANCEL_ASSIGN(6,"撤销分配");
+    CANCEL_ASSIGN(6,"撤销分配"),
+    ASSIST_USER(7,"添加协作人");
 
     private Integer value;
     private String desc;

+ 69 - 0
fs-service-system/src/main/java/com/fs/crm/mapper/CrmCustomerAssistMapper.java

@@ -0,0 +1,69 @@
+package com.fs.crm.mapper;
+
+import java.util.List;
+import com.fs.crm.domain.CrmCustomerAssist;
+import com.fs.crm.param.CrmCustomerAssistDeLParam;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 客户员工协作Mapper接口
+ *
+ * @author fs
+ * @date 2025-05-27
+ */
+public interface CrmCustomerAssistMapper
+{
+    /**
+     * 查询客户员工协作
+     *
+     * @param id 客户员工协作ID
+     * @return 客户员工协作
+     */
+    public CrmCustomerAssist selectCrmCustomerAssistById(Long id);
+
+    /**
+     * 查询客户员工协作列表
+     *
+     * @param crmCustomerAssist 客户员工协作
+     * @return 客户员工协作集合
+     */
+    public List<CrmCustomerAssist> selectCrmCustomerAssistList(CrmCustomerAssist crmCustomerAssist);
+
+    /**
+     * 新增客户员工协作
+     *
+     * @param crmCustomerAssist 客户员工协作
+     * @return 结果
+     */
+    public int insertCrmCustomerAssist(CrmCustomerAssist crmCustomerAssist);
+
+    /**
+     * 修改客户员工协作
+     *
+     * @param crmCustomerAssist 客户员工协作
+     * @return 结果
+     */
+    public int updateCrmCustomerAssist(CrmCustomerAssist crmCustomerAssist);
+
+    /**
+     * 删除客户员工协作
+     *
+     * @param id 客户员工协作ID
+     * @return 结果
+     */
+    public int deleteCrmCustomerAssistById(Long id);
+
+    /**
+     * 批量删除客户员工协作
+     *
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteCrmCustomerAssistByIds(Long[] ids);
+
+    List<String> selectCompanyUserNameByCustomerId(@Param("customerId") Long customerId);
+
+    int removeByCustomer(@Param("maps") CrmCustomerAssistDeLParam param);
+
+    int deleteCrmCustomerAssistByCustomerId(Long customerId);
+}

+ 1 - 57
fs-service-system/src/main/java/com/fs/crm/mapper/CrmCustomerMapper.java

@@ -272,63 +272,6 @@ public interface CrmCustomerMapper extends BaseMapper<CrmCustomer>
     List<CrmCustomerListVO> selectCrmCustomerListQueryParam(@Param("maps")CrmCustomerListQueryParam crmCustomer);
 
 
-    @Select({"<script> " +
-            "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 from crm_customer_user cu inner join crm_customer c on c.customer_user_id=cu.customer_user_id " +
-            "where cu.is_pool=0 " +
-            "<if test = 'maps.companyId != null     '> " +
-            "and cu.company_id =#{maps.companyId} " +
-            "</if>" +
-            "<if test = 'maps.companyUserId != null     '> " +
-            "and cu.company_user_id =#{maps.companyUserId} " +
-            "</if>" +
-            "<if test = 'maps.address != null and  maps.address !=\"\"    '> " +
-            "and c.address like CONCAT('%',#{maps.address},'%') " +
-            "</if>" +
-            "<if test = 'maps.customerCode != null and  maps.customerCode !=\"\"    '> " +
-            "and c.customer_code like CONCAT('%',#{maps.customerCode},'%') " +
-            "</if>" +
-            "<if test = 'maps.customerName != null and  maps.customerName !=\"\"    '> " +
-            "and c.customer_name like CONCAT('%',#{maps.customerName},'%') " +
-            "</if>" +
-            "<if test = 'maps.mobile != null and  maps.mobile !=\"\"    '> " +
-            "and c.mobile like CONCAT('%',#{maps.mobile},'%') " +
-            "</if>" +
-            "<if test = 'maps.status != null and maps.status !=\"\"     '> " +
-            "and c.visit_status IN " +
-            "<foreach collection=\"maps.status.split(',')\"  item='item' index='index'  open='(' separator=',' close=')'> #{item} </foreach>"+
-            "</if>" +
-            "<if test = 'maps.isHisOrder != null and maps.isHisOrder==1      '> " +
-            "and (select ifnull(count(1),0) from crm_customer_his_order h where h.customer_id=c.customer_id )  &gt; 0 " +
-            "</if>" +
-            "<if test = 'maps.isHisOrder != null and maps.isHisOrder==0      '> " +
-            "and (select ifnull(count(1),0) from crm_customer_his_order h where h.customer_id=c.customer_id )  = 0 " +
-            "</if>" +
-            "<if test = 'maps.customerType != null      '> " +
-            "and c.customer_type IN " +
-            "<foreach collection=\"maps.customerType.split(',')\"  item='item' index='index'  open='(' separator=',' close=')'> #{item} </foreach>"+
-            "</if>" +
-            "<if test = 'maps.source != null and maps.source !=\"\"      '> " +
-            "and c.source IN " +
-            "<foreach collection=\"maps.source.split(',')\"  item='item' index='index'  open='(' separator=',' close=')'> #{item} </foreach>"+
-            "</if>" +
-            "<if test = 'maps.tags != null and maps.tags!=\"\"     '> " +
-            "and  " +
-            "<foreach collection=\"maps.tags.split(',')\" item=\"tag\"   open=\"(\" close=\")\" separator=\"OR\">" +
-            "find_in_set(#{tag},c.tags)" +
-            "</foreach> " +
-            "</if>" +
-            "<if test = 'maps.customerCreateTime != null    '> " +
-            " AND date_format(c.create_time,'%y%m%d') &gt;= date_format(#{maps.customerCreateTime[0]},'%y%m%d') " +
-            " AND date_format(c.create_time,'%y%m%d') &lt;= date_format(#{maps.customerCreateTime[1]},'%y%m%d') " +
-            "</if>" +
-            "<if test = 'maps.beginTime != null and maps.beginTime != \"\" '> " +
-            "and date_format(c.receive_time,'%y%m%d') &gt;= date_format(#{maps.beginTime},'%y%m%d') " +
-            "</if>" +
-            "<if test = 'maps.endTime != null and maps.endTime != \"\" '> " +
-            "and date_format(c.receive_time,'%y%m%d') &lt;= date_format(#{maps.endTime},'%y%m%d') " +
-            "</if>" +
-            " order by cu.customer_user_id desc "+
-            "</script>"})
     List<CrmMyCustomerListQueryVO> selectCrmMyCustomerListQuery(@Param("maps")CrmMyCustomerListQueryParam param);
 
 
@@ -669,4 +612,5 @@ public interface CrmCustomerMapper extends BaseMapper<CrmCustomer>
     @Select("select user_id  from  fs_user where phone=#{remarkMobile} limit 1")
     Long selectFsUserByCrmMobile(String remarkMobile);
 
+    List<CrmMyCustomerListQueryVO> selectCrmMyAssistListQuery(@Param("maps") CrmMyCustomerListQueryParam param);
 }

+ 11 - 0
fs-service-system/src/main/java/com/fs/crm/param/CrmCustomerAssistDeLParam.java

@@ -0,0 +1,11 @@
+package com.fs.crm.param;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class CrmCustomerAssistDeLParam {
+    private List<Long> customerIds;
+    private Long companyUserId;
+}

+ 64 - 0
fs-service-system/src/main/java/com/fs/crm/service/ICrmCustomerAssistService.java

@@ -0,0 +1,64 @@
+package com.fs.crm.service;
+
+import java.util.List;
+import com.fs.crm.domain.CrmCustomerAssist;
+import com.fs.crm.param.CrmCustomerAssistDeLParam;
+
+/**
+ * 客户员工协作Service接口
+ *
+ * @author fs
+ * @date 2025-05-27
+ */
+public interface ICrmCustomerAssistService
+{
+    /**
+     * 查询客户员工协作
+     *
+     * @param id 客户员工协作ID
+     * @return 客户员工协作
+     */
+    public CrmCustomerAssist selectCrmCustomerAssistById(Long id);
+
+    /**
+     * 查询客户员工协作列表
+     *
+     * @param crmCustomerAssist 客户员工协作
+     * @return 客户员工协作集合
+     */
+    public List<CrmCustomerAssist> selectCrmCustomerAssistList(CrmCustomerAssist crmCustomerAssist);
+
+    /**
+     * 新增客户员工协作
+     *
+     * @param crmCustomerAssist 客户员工协作
+     * @return 结果
+     */
+    public int insertCrmCustomerAssist(CrmCustomerAssist crmCustomerAssist);
+
+    /**
+     * 修改客户员工协作
+     *
+     * @param crmCustomerAssist 客户员工协作
+     * @return 结果
+     */
+    public int updateCrmCustomerAssist(CrmCustomerAssist crmCustomerAssist);
+
+    /**
+     * 批量删除客户员工协作
+     *
+     * @param ids 需要删除的客户员工协作ID
+     * @return 结果
+     */
+    public int deleteCrmCustomerAssistByIds(Long[] ids);
+
+    /**
+     * 删除客户员工协作信息
+     *
+     * @param id 客户员工协作ID
+     * @return 结果
+     */
+    public int deleteCrmCustomerAssistById(Long id);
+
+    int removeByCustomer(CrmCustomerAssistDeLParam param);
+}

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

@@ -117,6 +117,8 @@ public interface ICrmCustomerService
 
     R assignCompanys(CrmCompanyAssignParam param, String operUserName,Long operUserId);
 
+    R assistToUser(String opeUserName, Long opeUserId, CrmCustomeAssignParam param);
+
 
     int updateCrmCustomerSource(CrmCustomerEditSourceParam param);
 
@@ -137,4 +139,6 @@ public interface ICrmCustomerService
     String importVisitCustomer(List<CrmCustomerVisitImportParam> list,Long companyId);
 
     public List<CrmCustomerListVO> selectCrmCustomer1();
+
+    List<CrmMyCustomerListQueryVO> selectCrmMyAssistListQuery(CrmMyCustomerListQueryParam param);
 }

+ 104 - 0
fs-service-system/src/main/java/com/fs/crm/service/impl/CrmCustomerAssistServiceImpl.java

@@ -0,0 +1,104 @@
+package com.fs.crm.service.impl;
+
+import java.util.List;
+import com.fs.common.utils.DateUtils;
+import com.fs.crm.param.CrmCustomerAssistDeLParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.fs.crm.mapper.CrmCustomerAssistMapper;
+import com.fs.crm.domain.CrmCustomerAssist;
+import com.fs.crm.service.ICrmCustomerAssistService;
+
+/**
+ * 客户员工协作Service业务层处理
+ *
+ * @author fs
+ * @date 2025-05-27
+ */
+@Service
+public class CrmCustomerAssistServiceImpl implements ICrmCustomerAssistService
+{
+    @Autowired
+    private CrmCustomerAssistMapper crmCustomerAssistMapper;
+
+    /**
+     * 查询客户员工协作
+     *
+     * @param id 客户员工协作ID
+     * @return 客户员工协作
+     */
+    @Override
+    public CrmCustomerAssist selectCrmCustomerAssistById(Long id)
+    {
+        return crmCustomerAssistMapper.selectCrmCustomerAssistById(id);
+    }
+
+    /**
+     * 查询客户员工协作列表
+     *
+     * @param crmCustomerAssist 客户员工协作
+     * @return 客户员工协作
+     */
+    @Override
+    public List<CrmCustomerAssist> selectCrmCustomerAssistList(CrmCustomerAssist crmCustomerAssist)
+    {
+        return crmCustomerAssistMapper.selectCrmCustomerAssistList(crmCustomerAssist);
+    }
+
+    /**
+     * 新增客户员工协作
+     *
+     * @param crmCustomerAssist 客户员工协作
+     * @return 结果
+     */
+    @Override
+    public int insertCrmCustomerAssist(CrmCustomerAssist crmCustomerAssist)
+    {
+        crmCustomerAssist.setCreateTime(DateUtils.getNowDate());
+        return crmCustomerAssistMapper.insertCrmCustomerAssist(crmCustomerAssist);
+    }
+
+    /**
+     * 修改客户员工协作
+     *
+     * @param crmCustomerAssist 客户员工协作
+     * @return 结果
+     */
+    @Override
+    public int updateCrmCustomerAssist(CrmCustomerAssist crmCustomerAssist)
+    {
+        return crmCustomerAssistMapper.updateCrmCustomerAssist(crmCustomerAssist);
+    }
+
+    /**
+     * 批量删除客户员工协作
+     *
+     * @param ids 需要删除的客户员工协作ID
+     * @return 结果
+     */
+    @Override
+    public int deleteCrmCustomerAssistByIds(Long[] ids)
+    {
+        return crmCustomerAssistMapper.deleteCrmCustomerAssistByIds(ids);
+    }
+
+    /**
+     * 删除客户员工协作信息
+     *
+     * @param id 客户员工协作ID
+     * @return 结果
+     */
+    @Override
+    public int deleteCrmCustomerAssistById(Long id)
+    {
+        return crmCustomerAssistMapper.deleteCrmCustomerAssistById(id);
+    }
+
+    @Override
+    public int removeByCustomer(CrmCustomerAssistDeLParam param) {
+        if (param.getCustomerIds() == null || param.getCustomerIds().isEmpty()) {
+            return 0;
+        }
+        return crmCustomerAssistMapper.removeByCustomer(param);
+    }
+}

+ 86 - 5
fs-service-system/src/main/java/com/fs/crm/service/impl/CrmCustomerServiceImpl.java

@@ -21,10 +21,7 @@ import com.fs.crm.domain.*;
 import com.fs.crm.dto.CrmCustomerAssignCompanyDTO;
 import com.fs.crm.dto.CrmCustomerAssignUserDTO;
 import com.fs.crm.enums.CustomerLogEnum;
-import com.fs.crm.mapper.CrmCustomerAssignMapper;
-import com.fs.crm.mapper.CrmCustomerLogsMapper;
-import com.fs.crm.mapper.CrmCustomerMapper;
-import com.fs.crm.mapper.CrmCustomerUserMapper;
+import com.fs.crm.mapper.*;
 import com.fs.crm.param.*;
 import com.fs.crm.service.ICrmCustomerService;
 import com.fs.crm.service.ICrmMsgService;
@@ -36,10 +33,12 @@ import com.fs.system.service.ISysDictTypeService;
 import lombok.Synchronized;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.*;
+import java.util.concurrent.CompletableFuture;
 
 /**
  * 客户Service业务层处理
@@ -70,10 +69,14 @@ public class CrmCustomerServiceImpl extends ServiceImpl<CrmCustomerMapper, CrmCu
     @Autowired
     private CrmCustomerAssignMapper assignMapper;
     @Autowired
+    private CrmCustomerAssistMapper assistMapper;
+    @Autowired
     private JpushService jpushService;
 
     @Autowired
     private ISysDictTypeService dictTypeService;
+    @Autowired
+    private ThreadPoolTaskExecutor threadPoolTaskExecutor;
     /**
      * 查询客户
      *
@@ -259,7 +262,21 @@ public class CrmCustomerServiceImpl extends ServiceImpl<CrmCustomerMapper, CrmCu
 
     @Override
     public List<CrmMyCustomerListQueryVO> selectCrmMyCustomerListQuery(CrmMyCustomerListQueryParam param) {
-        return crmCustomerMapper.selectCrmMyCustomerListQuery(param);
+        List<CrmMyCustomerListQueryVO> vos = crmCustomerMapper.selectCrmMyCustomerListQuery(param);
+        if (vos != null && !vos.isEmpty()){
+            List<CompletableFuture<Void>> futures = new ArrayList<>();
+            vos.forEach(vo -> {
+                CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
+                    List<String> companyUserName = assistMapper.selectCompanyUserNameByCustomerId(vo.getCustomerId());
+                    vo.setAssistUser(companyUserName);
+                }, threadPoolTaskExecutor);
+                futures.add(future);
+            });
+            // 等待所有任务完成
+            CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
+        }
+
+        return vos;
     }
 
     @Override
@@ -378,6 +395,8 @@ public class CrmCustomerServiceImpl extends ServiceImpl<CrmCustomerMapper, CrmCu
         customer.setPoolTime(new Date());
         customer.setCustomerUserId(0L);
         crmCustomerMapper.updateCrmCustomer(customer);
+        //删除该客户所有协作人
+        assistMapper.deleteCrmCustomerAssistByCustomerId(crmCustomerUser.getCustomerId());
         //写日志
         CrmCustomerLogs logs=new CrmCustomerLogs();
         logs.setCustomerId(customer.getCustomerId());
@@ -777,6 +796,46 @@ public class CrmCustomerServiceImpl extends ServiceImpl<CrmCustomerMapper, CrmCu
         return R.ok("分配成功");
     }
 
+    @Override
+    public R assistToUser(String opeUserName, Long opeUserId, CrmCustomeAssignParam param) {
+        Integer index=0;
+        for(CrmCustomerAssignUserDTO userDTO:param.getUsers()){
+            CompanyUser companyUser=companyUserMapper.selectCompanyUserById(userDTO.getCompanyUserId());
+            for(int i=0;i<userDTO.getCount();i++){
+                CrmCustomer customer=crmCustomerMapper.selectCrmCustomerById(param.getCustomerIds().get(index));
+                CrmCustomerAssist customerAssist=new CrmCustomerAssist();
+                customerAssist.setCompanyId(param.getCompanyId());
+                customerAssist.setCompanyUserId(userDTO.getCompanyUserId());
+                customerAssist.setCompanyUserName(companyUser.getNickName());
+                customerAssist.setCustomerId(customer.getCustomerId());
+                customerAssist.setCreateTime(new Date());
+                assistMapper.insertCrmCustomerAssist(customerAssist);
+                //写日志
+                CrmCustomerLogs logs=new CrmCustomerLogs();
+                logs.setCustomerId(customer.getCustomerId());
+                logs.setCreateTime(new Date());
+                logs.setLogsType(CustomerLogEnum.ASSIST_USER.getValue());
+                logs.setTitle(CustomerLogEnum.ASSIST_USER.getDesc());
+                logs.setRemark(opeUserName+"为客户"+customer.getCustomerName()+"添加协作人:" + companyUser.getNickName());
+                logs.setCompanyUserId(userDTO.getCompanyUserId());
+                logsMapper.insertCrmCustomerLogs(logs);
+
+                if(StringUtils.isNotEmpty(companyUser.getJpushId())){
+                    Map<String, String> extrasMap=new HashMap<>();
+                    extrasMap.put("customerId",customer.getCustomerId().toString());
+                    extrasMap.put("type","1");
+                    try {
+                        jpushService.sendRegisterIdPush("客户消息","您收到 一个客户协作邀请",extrasMap,companyUser.getJpushId());
+                    } catch (APIConnectionException e) {
+                    } catch (APIRequestException e) {
+                    }
+                }
+                index++;
+            }
+        }
+        return R.ok();
+    }
+
     @Override
     public int updateCrmCustomerSource(CrmCustomerEditSourceParam param) {
         return crmCustomerMapper.updateCrmCustomerSource(param);
@@ -870,4 +929,26 @@ public class CrmCustomerServiceImpl extends ServiceImpl<CrmCustomerMapper, CrmCu
    public List<CrmCustomerListVO> selectCrmCustomer1(){
         return crmCustomerMapper.selectCrmCustomer1();
    }
+
+    @Override
+    public List<CrmMyCustomerListQueryVO> selectCrmMyAssistListQuery(CrmMyCustomerListQueryParam param) {
+        List<CrmMyCustomerListQueryVO> vos = crmCustomerMapper.selectCrmMyAssistListQuery(param);
+
+        if (vos != null && !vos.isEmpty()){
+            List<CompletableFuture<Void>> futures = new ArrayList<>();
+            vos.forEach(vo -> {
+                CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
+                    CompanyUser companyUser = companyUserMapper.selectCompanyUserById(vo.getCompanyUserId());
+                    ArrayList<String> list = new ArrayList<>();
+                    list.add(companyUser.getNickName()+"(" + companyUser.getUserId() + ")");
+                    vo.setAssistUser(list);
+                }, threadPoolTaskExecutor);
+                futures.add(future);
+            });
+            // 等待所有任务完成
+            CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
+        }
+
+        return vos;
+    }
 }

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

@@ -6,6 +6,7 @@ import lombok.Data;
 
 import java.io.Serializable;
 import java.util.Date;
+import java.util.List;
 
 @Data
 public class CrmMyCustomerListQueryVO implements Serializable
@@ -119,4 +120,7 @@ public class CrmMyCustomerListQueryVO implements Serializable
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date receiveTime;
 
+    private List<String> assistUser;
+    private Long companyUserId;
+
 }

+ 93 - 0
fs-service-system/src/main/resources/mapper/crm/CrmCustomerAssistMapper.xml

@@ -0,0 +1,93 @@
+<?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.CrmCustomerAssistMapper">
+
+    <resultMap type="CrmCustomerAssist" id="CrmCustomerAssistResult">
+        <result property="id"    column="id"    />
+        <result property="companyId"    column="company_id"    />
+        <result property="companyUserId"    column="company_user_id"    />
+        <result property="companyUserName"    column="company_user_name"    />
+        <result property="customerId"    column="customer_id"    />
+        <result property="createTime"    column="create_time"    />
+    </resultMap>
+
+    <sql id="selectCrmCustomerAssistVo">
+        select id, company_id, company_user_id,company_user_name, customer_id, create_time from crm_customer_assist
+    </sql>
+
+    <select id="selectCrmCustomerAssistList" parameterType="CrmCustomerAssist" resultMap="CrmCustomerAssistResult">
+        <include refid="selectCrmCustomerAssistVo"/>
+        <where>
+            <if test="companyId != null "> and company_id = #{companyId}</if>
+            <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
+            <if test="companyUserName != null and companyUserName != ''"> and company_user_name = #{companyUserName}</if>
+            <if test="customerId != null "> and customer_id = #{customerId}</if>
+        </where>
+    </select>
+
+    <select id="selectCrmCustomerAssistById" parameterType="Long" resultMap="CrmCustomerAssistResult">
+        <include refid="selectCrmCustomerAssistVo"/>
+        where id = #{id}
+    </select>
+    <select id="selectCompanyUserNameByCustomerId" resultType="java.lang.String">
+        select  CONCAT(company_user_name, '(', company_user_id, ')') AS assistUser
+        from crm_customer_assist
+        where customer_id = #{customerId}
+    </select>
+
+    <insert id="insertCrmCustomerAssist" parameterType="CrmCustomerAssist" useGeneratedKeys="true" keyProperty="id">
+        insert into crm_customer_assist
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="companyId != null">company_id,</if>
+            <if test="companyUserId != null">company_user_id,</if>
+            <if test="companyUserName != null">company_user_name,</if>
+            <if test="customerId != null">customer_id,</if>
+            <if test="createTime != null">create_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="companyId != null">#{companyId},</if>
+            <if test="companyUserId != null">#{companyUserId},</if>
+            <if test="companyUserName != null">#{companyUserName},</if>
+            <if test="customerId != null">#{customerId},</if>
+            <if test="createTime != null">#{createTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateCrmCustomerAssist" parameterType="CrmCustomerAssist">
+        update crm_customer_assist
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="companyId != null">company_id = #{companyId},</if>
+            <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
+            <if test="companyUserName != null">company_user_name = #{companyUserName},</if>
+            <if test="customerId != null">customer_id = #{customerId},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteCrmCustomerAssistById" parameterType="Long">
+        delete from crm_customer_assist where id = #{id}
+    </delete>
+
+    <delete id="deleteCrmCustomerAssistByIds" parameterType="String">
+        delete from crm_customer_assist where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+    <delete id="removeByCustomer">
+        delete from crm_customer_assist where customer_id in
+        <foreach collection="maps.customerIds" item="customerId" open="(" separator="," close=")">
+            #{customerId}
+        </foreach>
+        <if test="maps.companyUserId != null">
+            and company_user_id = #{maps.companyUserId}
+        </if>
+    </delete>
+    <delete id="deleteCrmCustomerAssistByCustomerId">
+        delete from crm_customer_assist where customer_id = #{customerId}
+    </delete>
+
+</mapper>

+ 133 - 0
fs-service-system/src/main/resources/mapper/crm/CrmCustomerMapper.xml

@@ -289,4 +289,137 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ) t
         GROUP BY t.type
     </select>
+    <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
+        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.companyUserId != null">
+            and cu.company_user_id =#{maps.companyUserId}
+        </if>
+        <if test="maps.address != null and  maps.address != ''">
+            and c.address like CONCAT('%',#{maps.address},'%')
+        </if>
+        <if test="maps.customerCode != null and  maps.customerCode != ''">
+            and c.customer_code like CONCAT('%',#{maps.customerCode},'%')
+        </if>
+        <if test="maps.customerName != null and  maps.customerName != ''">
+            and c.customer_name like CONCAT('%',#{maps.customerName},'%')
+        </if>
+        <if test="maps.mobile != null and  maps.mobile != ''">
+            and c.mobile like CONCAT('%',#{maps.mobile},'%')
+        </if>
+        <if test="maps.status != null and  maps.status != ''">
+            and c.visit_status IN
+            <foreach collection="maps.status.split(',')" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="maps.isHisOrder != null and  maps.isHisOrder == 1">
+            and (select ifnull(count(1),0) from crm_customer_his_order h where h.customer_id=c.customer_id )  &gt; 0
+        </if>
+        <if test="maps.isHisOrder != null and  maps.isHisOrder == 0">
+            and (select ifnull(count(1),0) from crm_customer_his_order h where h.customer_id=c.customer_id )  = 0
+        </if>
+        <if test="maps.customerType != null">
+            and c.customer_type IN
+            <foreach collection="maps.customerType.split(',')" item="item" index="index" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="maps.source != null and  maps.source != ''">
+            and c.source IN
+            <foreach collection="maps.source.split(',')" item="item" index="index" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="maps.tags != null and  maps.tags != ''">
+            <foreach collection="maps.tags.split(',')" item="tag" open="(" separator="OR" close=")">
+                find_in_set(#{tag},c.tags)
+            </foreach>
+        </if>
+        <if test="maps.customerCreateTime != null">
+            AND date_format(c.create_time,'%y%m%d') &gt;= date_format(#{maps.customerCreateTime[0]},'%y%m%d')
+            AND date_format(c.create_time,'%y%m%d') &lt;= date_format(#{maps.customerCreateTime[1]},'%y%m%d')
+        </if>
+        <if test="maps.beginTime != null and maps.beginTime != ''">
+            and date_format(c.receive_time,'%y%m%d') &gt;= date_format(#{maps.beginTime},'%y%m%d')
+        </if>
+        <if test="maps.endTime != null and maps.endTime != ''">
+            and date_format(c.receive_time,'%y%m%d') &lt;= date_format(#{maps.endTime},'%y%m%d')
+        </if>
+        order by cu.customer_user_id desc
+    </select>
+    <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
+        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
+        where c.is_pool=0  and c.is_del = 0
+        <if test="maps.companyId != null">
+            and ca.company_id =#{maps.companyId}
+        </if>
+        <if test="maps.companyUserId != null">
+            and ca.company_user_id =#{maps.companyUserId}
+        </if>
+        <if test="maps.address != null and  maps.address != ''">
+            and c.address like CONCAT('%',#{maps.address},'%')
+        </if>
+        <if test="maps.customerCode != null and  maps.customerCode != ''">
+            and c.customer_code like CONCAT('%',#{maps.customerCode},'%')
+        </if>
+        <if test="maps.customerName != null and  maps.customerName != ''">
+            and c.customer_name like CONCAT('%',#{maps.customerName},'%')
+        </if>
+        <if test="maps.mobile != null and  maps.mobile != ''">
+            and c.mobile like CONCAT('%',#{maps.mobile},'%')
+        </if>
+        <if test="maps.status != null and  maps.status != ''">
+            and c.visit_status IN
+            <foreach collection="maps.status.split(',')" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="maps.isHisOrder != null and  maps.isHisOrder == 1">
+            and (select ifnull(count(1),0) from crm_customer_his_order h where h.customer_id=c.customer_id )  &gt; 0
+        </if>
+        <if test="maps.isHisOrder != null and  maps.isHisOrder == 0">
+            and (select ifnull(count(1),0) from crm_customer_his_order h where h.customer_id=c.customer_id )  = 0
+        </if>
+        <if test="maps.customerType != null">
+            and c.customer_type IN
+            <foreach collection="maps.customerType.split(',')" item="item" index="index" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="maps.source != null and  maps.source != ''">
+            and c.source IN
+            <foreach collection="maps.source.split(',')" item="item" index="index" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="maps.tags != null and  maps.tags != ''">
+            <foreach collection="maps.tags.split(',')" item="tag" open="(" separator="OR" close=")">
+                find_in_set(#{tag},c.tags)
+            </foreach>
+        </if>
+        <if test="maps.customerCreateTime != null">
+            AND date_format(c.create_time,'%y%m%d') &gt;= date_format(#{maps.customerCreateTime[0]},'%y%m%d')
+            AND date_format(c.create_time,'%y%m%d') &lt;= date_format(#{maps.customerCreateTime[1]},'%y%m%d')
+        </if>
+        <if test="maps.beginTime != null and maps.beginTime != ''">
+            and date_format(c.receive_time,'%y%m%d') &gt;= date_format(#{maps.beginTime},'%y%m%d')
+        </if>
+        <if test="maps.endTime != null and maps.endTime != ''">
+            and date_format(c.receive_time,'%y%m%d') &lt;= date_format(#{maps.endTime},'%y%m%d')
+        </if>
+        order by cu.customer_user_id desc
+    </select>
 </mapper>

+ 4 - 0
fs-user-app/src/main/java/com/fs/app/controller/DocController.java

@@ -0,0 +1,4 @@
+package com.fs.app.controller;
+
+public class DocController {
+}