Explorar el Código

Merge branch 'master' of http://git.dongkesoft.com:9001/iBOSS-2.0-Mini/iboss-server-mdm

changhaoning hace 2 años
padre
commit
7442a6b03e
Se han modificado 30 ficheros con 2715 adiciones y 144 borrados
  1. 5 5
      src/main/java/com/dk/mdm/controller/ivt/IntoReturnController.java
  2. 59 0
      src/main/java/com/dk/mdm/controller/mst/CusFollowController.java
  3. 24 0
      src/main/java/com/dk/mdm/controller/mst/CusFollowStaffController.java
  4. 8 8
      src/main/java/com/dk/mdm/generator/Generator.java
  5. 12 0
      src/main/java/com/dk/mdm/infrastructure/convert/mst/CusFollowConvert.java
  6. 12 0
      src/main/java/com/dk/mdm/infrastructure/convert/mst/CusFollowStaffConvert.java
  7. 2 0
      src/main/java/com/dk/mdm/mapper/common/CommonMapper.java
  8. 4 0
      src/main/java/com/dk/mdm/mapper/common/CommonMapper.xml
  9. 1 1
      src/main/java/com/dk/mdm/mapper/ivt/InboundMapper.xml
  10. 35 0
      src/main/java/com/dk/mdm/mapper/mst/CusFollowMapper.java
  11. 347 0
      src/main/java/com/dk/mdm/mapper/mst/CusFollowMapper.xml
  12. 15 0
      src/main/java/com/dk/mdm/mapper/mst/CusFollowStaffMapper.java
  13. 132 0
      src/main/java/com/dk/mdm/mapper/mst/CusFollowStaffMapper.xml
  14. 9 0
      src/main/java/com/dk/mdm/mapper/mst/CustomerMapper.java
  15. 19 1
      src/main/java/com/dk/mdm/mapper/mst/CustomerMapper.xml
  16. 7 0
      src/main/java/com/dk/mdm/mapper/pur/PurchaseItemMapper.xml
  17. 296 0
      src/main/java/com/dk/mdm/model/pojo/mst/CusFollow.java
  18. 115 0
      src/main/java/com/dk/mdm/model/pojo/mst/CusFollowStaff.java
  19. 299 0
      src/main/java/com/dk/mdm/model/query/mst/CusFollowQuery.java
  20. 113 0
      src/main/java/com/dk/mdm/model/query/mst/CusFollowStaffQuery.java
  21. 229 0
      src/main/java/com/dk/mdm/model/response/mst/CusFollowResponse.java
  22. 106 0
      src/main/java/com/dk/mdm/model/response/mst/CusFollowStaffResponse.java
  23. 15 75
      src/main/java/com/dk/mdm/model/response/mst/CustomerResponse.java
  24. 115 0
      src/main/java/com/dk/mdm/model/vo/mst/CusFollowStaffVO.java
  25. 342 0
      src/main/java/com/dk/mdm/model/vo/mst/CusFollowVO.java
  26. 30 0
      src/main/java/com/dk/mdm/service/common/CommonService.java
  27. 8 48
      src/main/java/com/dk/mdm/service/ivt/IntoReturnService.java
  28. 300 0
      src/main/java/com/dk/mdm/service/mst/CusFollowService.java
  29. 23 0
      src/main/java/com/dk/mdm/service/mst/CusFollowStaffService.java
  30. 33 6
      src/main/java/com/dk/mdm/service/mst/CustomerService.java

+ 5 - 5
src/main/java/com/dk/mdm/controller/ivt/IntoReturnController.java

@@ -65,11 +65,11 @@ public class IntoReturnController{
      * @author : 于继渤
      * @author : 于继渤
      */
      */
     @ApiOperation(
     @ApiOperation(
-            value = "冲正",
-            notes = "冲正"
+            value = "作废",
+            notes = "作废"
     )
     )
-    @PostMapping("righting")
-    public ResponseResultVO<String> righting(@RequestBody IntoReturnVO intoReturnVO) {
-        return intoReturnService.righting(intoReturnVO.getPurId(),intoReturnVO.getIntoReturnIdList());
+    @PostMapping("cancel")
+    public ResponseResultVO<String> cancel(@RequestBody IntoReturnVO intoReturnVO) {
+        return intoReturnService.cancel(intoReturnVO);
     }
     }
 }
 }

+ 59 - 0
src/main/java/com/dk/mdm/controller/mst/CusFollowController.java

@@ -0,0 +1,59 @@
+package com.dk.mdm.controller.mst;
+
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseResultVO;
+import com.dk.mdm.model.pojo.mst.CusFollow;
+import com.dk.common.controller.BaseController;
+import com.dk.common.service.BaseService;
+import com.dk.mdm.model.query.mst.CusFollowQuery;
+import com.dk.mdm.model.query.mst.CustomerQuery;
+import com.dk.mdm.model.response.mst.CusFollowResponse;
+import com.dk.mdm.model.response.mst.CustomerResponse;
+import com.dk.mdm.model.vo.mst.CusFollowVO;
+import com.dk.mdm.model.vo.mst.CustomerVO;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RestController;
+import io.swagger.annotations.Api;
+import com.dk.mdm.service.mst.CusFollowService;
+
+@Api(tags = "客户跟进API接口")
+@RestController
+@RequestMapping("/mst/cusFollow")
+public class CusFollowController{
+
+    public BaseService<CusFollow> getService() {
+        return cusFollowService;
+    }
+
+    @Autowired
+    private CusFollowService cusFollowService;
+
+
+    /**
+     * @desc : 条件查询
+     * @author : 于继渤
+     * @date : 2024/2/26 10:36
+     */
+    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
+    @PostMapping({"list_by"})
+    public ResponseResultVO<PageList<CusFollowResponse>> selectByCond(@RequestBody CusFollowQuery customerQuery) {
+        return cusFollowService.selectByCond(customerQuery);
+    }
+
+    /**
+     * @desc : 新建
+     * @author : 于继渤
+     * @date : 2023/1/5 9:39
+     */
+    @ApiOperation( value = "新建", notes = "v" )
+    @PostMapping({"insert"})
+    public ResponseResultVO<?> insert(@RequestBody CusFollowVO cusFollowVO) {
+        return cusFollowService.insert(cusFollowVO);
+    }
+
+
+}

+ 24 - 0
src/main/java/com/dk/mdm/controller/mst/CusFollowStaffController.java

@@ -0,0 +1,24 @@
+package com.dk.mdm.controller.mst;
+
+import com.dk.mdm.model.pojo.mst.CusFollowStaff;
+import com.dk.common.controller.BaseController;
+import com.dk.common.service.BaseService;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RestController;
+import io.swagger.annotations.Api;
+import com.dk.mdm.service.mst.CusFollowStaffService;
+
+@Api(tags = "客户跟进人API接口")
+@RestController
+@RequestMapping("/cusFollowStaff")
+public class CusFollowStaffController{
+
+    public BaseService<CusFollowStaff> getService() {
+        return cusFollowStaffService;
+    }
+
+    @Autowired
+    private CusFollowStaffService cusFollowStaffService;
+
+}

+ 8 - 8
src/main/java/com/dk/mdm/generator/Generator.java

@@ -53,7 +53,7 @@ public class Generator {
         GlobalConfig gc = new GlobalConfig();
         GlobalConfig gc = new GlobalConfig();
         String projectPath = System.getProperty("user.dir");    //获取当前目录
         String projectPath = System.getProperty("user.dir");    //获取当前目录
         gc.setOutputDir(projectPath+"/src/main/java");          //输出到哪个目录
         gc.setOutputDir(projectPath+"/src/main/java");          //输出到哪个目录
-        gc.setAuthor("姜永辉");                                    //作者
+        gc.setAuthor("于继渤");                                    //作者
         gc.setOpen(false);                                      //是否打开目录
         gc.setOpen(false);                                      //是否打开目录
         gc.setFileOverride(false);                              //是否覆盖
         gc.setFileOverride(false);                              //是否覆盖
         gc.setServiceName("%sService");                         //去Service的I前缀
         gc.setServiceName("%sService");                         //去Service的I前缀
@@ -79,11 +79,11 @@ public class Generator {
         PackageConfig pc = new PackageConfig();
         PackageConfig pc = new PackageConfig();
 //        pc.setModuleName("task");                  //模块包名
 //        pc.setModuleName("task");                  //模块包名
         pc.setParent("com.dk.mdm");        //父包路径
         pc.setParent("com.dk.mdm");        //父包路径
-        pc.setEntity("model.pojo.ivt");                     //实体层路径
-        pc.setMapper("mapper.ivt");                 //mapper层路径
-        pc.setXml("mapper.ivt");                       //xml层路径
-        pc.setServiceImpl("service.ivt");                   //业务层路径
-        pc.setController("controller.ivt");             //控制层路径
+        pc.setEntity("model.pojo.mst");                     //实体层路径
+        pc.setMapper("mapper.mst");                 //mapper层路径
+        pc.setXml("mapper.mst");                       //xml层路径
+        pc.setServiceImpl("service.mst");                   //业务层路径
+        pc.setController("controller.mst");             //控制层路径
         //app相关路径
         //app相关路径
 //        pc.setEntity("model.app.pojo.pset");                     //实体层路径
 //        pc.setEntity("model.app.pojo.pset");                     //实体层路径
 //        pc.setMapper("mapper.app.pset");                 //mapper层路径
 //        pc.setMapper("mapper.app.pset");                 //mapper层路径
@@ -94,8 +94,8 @@ public class Generator {
 
 
         //4、策略配置
         //4、策略配置
         StrategyConfig strategy = new StrategyConfig();
         StrategyConfig strategy = new StrategyConfig();
-        strategy.setTablePrefix("t_psi");                                             //表名前缀
-        strategy.setInclude("t_psi_inbound");                                        //设置要映射的表名,只需改这里即可,可以是一个数组,一次性生成多张表。
+        strategy.setTablePrefix("t_crm");                                             //表名前缀
+        strategy.setInclude("t_crm_cus_follow_staff");                                        //设置要映射的表名,只需改这里即可,可以是一个数组,一次性生成多张表。
         strategy.setNaming(NamingStrategy.underline_to_camel);                      //转驼峰
         strategy.setNaming(NamingStrategy.underline_to_camel);                      //转驼峰
         strategy.setColumnNaming(NamingStrategy.underline_to_camel);                //字段下划线转驼峰
         strategy.setColumnNaming(NamingStrategy.underline_to_camel);                //字段下划线转驼峰
         strategy.setEntityLombokModel(true);                                        //是否使用lombok开启注解
         strategy.setEntityLombokModel(true);                                        //是否使用lombok开启注解

+ 12 - 0
src/main/java/com/dk/mdm/infrastructure/convert/mst/CusFollowConvert.java

@@ -0,0 +1,12 @@
+package com.dk.mdm.infrastructure.convert.mst;
+
+import com.dk.mdm.model.pojo.mst.CusFollow;
+import com.dk.mdm.model.pojo.mst.Customer;
+import com.dk.mdm.model.vo.mst.CusFollowVO;
+import com.dk.mdm.model.vo.mst.CustomerVO;
+import org.mapstruct.Mapper;
+
+@Mapper(componentModel = "spring")
+public interface CusFollowConvert {
+    CusFollow convertToPo(CusFollowVO cusFollowVO);
+}

+ 12 - 0
src/main/java/com/dk/mdm/infrastructure/convert/mst/CusFollowStaffConvert.java

@@ -0,0 +1,12 @@
+package com.dk.mdm.infrastructure.convert.mst;
+
+import com.dk.mdm.model.pojo.mst.CusFollowStaff;
+import com.dk.mdm.model.pojo.mst.Customer;
+import com.dk.mdm.model.vo.mst.CusFollowStaffVO;
+import com.dk.mdm.model.vo.mst.CustomerVO;
+import org.mapstruct.Mapper;
+
+@Mapper(componentModel = "spring")
+public interface CusFollowStaffConvert {
+    CusFollowStaff convertToPo(CusFollowStaffVO cusFollowStaffVO);
+}

+ 2 - 0
src/main/java/com/dk/mdm/mapper/common/CommonMapper.java

@@ -387,4 +387,6 @@ public interface CommonMapper extends BaseMapper<Map<String, Object>> {
 
 
     List<Map<String, Object>> getSaleChannel(Map param);
     List<Map<String, Object>> getSaleChannel(Map param);
     List<Map<String, Object>> getStaff(Map param);
     List<Map<String, Object>> getStaff(Map param);
+
+
 }
 }

+ 4 - 0
src/main/java/com/dk/mdm/mapper/common/CommonMapper.xml

@@ -93,6 +93,7 @@
         kind_type AS "kindType",
         kind_type AS "kindType",
         kind_tags AS "kindTags",
         kind_tags AS "kindTags",
         display_no AS "displayNo",
         display_no AS "displayNo",
+        kind_code AS "id",
         remarks
         remarks
         from sys.t_data_kind
         from sys.t_data_kind
         where flg_valid
         where flg_valid
@@ -296,6 +297,7 @@
     <!-- 获取仓库 -->
     <!-- 获取仓库 -->
     <select id="getWarehouse" resultType="java.util.Map">
     <select id="getWarehouse" resultType="java.util.Map">
         SELECT tmw.wh_id as "whId"
         SELECT tmw.wh_id as "whId"
+        ,tmw.wh_id AS "id"
         ,tmw.wh_name as "whName"
         ,tmw.wh_name as "whName"
         ,tmw.wh_code as "whCode"
         ,tmw.wh_code as "whCode"
         ,tmw.flg_default as "flgDefault"
         ,tmw.flg_default as "flgDefault"
@@ -921,4 +923,6 @@
             </if>
             </if>
         </where>
         </where>
     </select>
     </select>
+    <!--获取仓库档案-->
+
 </mapper>
 </mapper>

+ 1 - 1
src/main/java/com/dk/mdm/mapper/ivt/InboundMapper.xml

@@ -285,7 +285,7 @@
         Left join dkic_b.t_mst_staff makestaff on makestaff.staff_id = tpi.make_staff
         Left join dkic_b.t_mst_staff makestaff on makestaff.staff_id = tpi.make_staff
         LEFT JOIN sys.t_data_kind tdk   ON tdk.kind_code = tpi.into_status
         LEFT JOIN sys.t_data_kind tdk   ON tdk.kind_code = tpi.into_status
         Left join dkic_b.t_mst_warehouse tmw on tmw.wh_id = tpi.wh_id
         Left join dkic_b.t_mst_warehouse tmw on tmw.wh_id = tpi.wh_id
-        left join dkic_b.t_mst_customer tmc on t.cus_id = tmc.cus_id
+        left join dkic_b.t_mst_customer tmc on tpi.cus_id = tmc.cus_id
     </sql>
     </sql>
 
 
 
 

+ 35 - 0
src/main/java/com/dk/mdm/mapper/mst/CusFollowMapper.java

@@ -0,0 +1,35 @@
+package com.dk.mdm.mapper.mst;
+
+import com.dk.mdm.model.pojo.mst.CusFollow;
+import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.query.mst.CusFollowQuery;
+import com.dk.mdm.model.query.mst.CustomerQuery;
+import com.dk.mdm.model.response.mst.CusFollowResponse;
+import com.dk.mdm.model.response.mst.CustomerResponse;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+*  客户跟进 Mapper
+*/
+@Repository
+public interface CusFollowMapper extends BaseMapper<CusFollow>{
+
+
+    /**
+     * @desc   : 根据条件进行查询
+     * @author : 于继渤
+     * @date : 2024/2/26 10:36
+     */
+    List<CusFollowResponse> selectByCond(CusFollowQuery cusFollowQuery);
+
+    /**
+     * @desc   : 根据条件进行查询(数量)
+     * @author : 于继渤
+     * @date : 2024/2/26 10:36
+     */
+    Long countByCond(CusFollowQuery cusFollowQuery);
+	
+}
+

+ 347 - 0
src/main/java/com/dk/mdm/mapper/mst/CusFollowMapper.xml

@@ -0,0 +1,347 @@
+<?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.dk.mdm.mapper.mst.CusFollowMapper">
+
+    <!-- 通用设置 -->
+    <!-- 通用查询列 -->
+    <sql id="Base_Column_List">
+        follow_id, cus_id, follow_status, follow_type, follow_org, follow_staff, follow_time, follow_data, follow_time_len, stay_time_len, intention, invite_result, invite_time, design_staff, next_follow_plan, next_follow_time, annex_paths, measure_status, remarks, flg_valid, cp_id, op_create_time, op_create_user_id, op_update_time, op_update_user_id, op_app_code, op_timestamp, op_db_user
+    </sql>
+    <sql id="Base_Column_List_Join">
+        tccf.follow_id, tccf.cus_id, tccf.follow_status, tccf.follow_type, tccf.follow_org, tccf.follow_staff, tccf.follow_time, tccf.follow_data,
+                 tccf.follow_time_len, tccf.stay_time_len, tccf.intention, tccf.invite_result, tccf.invite_time, tccf.design_staff,
+                 tccf.next_follow_plan, tccf.next_follow_time,tccf.annex_paths, tccf.measure_status, tccf.remarks, tccf.flg_valid,
+                 tccf.cp_id
+    </sql>
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mst.CusFollow">
+        <id column="follow_id" property="followId"/>
+                <result column="cus_id" property="cusId" typeHandler="UuidTypeHandler"/>
+                <result column="follow_status" property="followStatus"/>
+                <result column="follow_type" property="followType"/>
+                <result column="follow_org" property="followOrg" typeHandler="UuidTypeHandler"/>
+                <result column="follow_staff" property="followStaff" typeHandler="UuidTypeHandler"/>
+            <result column="follow_time" property="followTime" typeHandler="TimestampTypeHandler"/>
+                <result column="follow_data" property="followData"/>
+                <result column="follow_time_len" property="followTimeLen"/>
+                <result column="stay_time_len" property="stayTimeLen"/>
+                <result column="intention" property="intention"/>
+                <result column="invite_result" property="inviteResult"/>
+            <result column="invite_time" property="inviteTime" typeHandler="TimestampTypeHandler"/>
+                <result column="design_staff" property="designStaff" typeHandler="UuidTypeHandler"/>
+                <result column="next_follow_plan" property="nextFollowPlan"/>
+            <result column="next_follow_time" property="nextFollowTime" typeHandler="TimestampTypeHandler"/>
+                <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
+                <result column="measure_status" property="measureStatus"/>
+                <result column="remarks" property="remarks"/>
+                <result column="flg_valid" property="flgValid"/>
+                <result column="cp_id" property="cpId"/>
+            <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
+                <result column="op_create_user_id" property="opCreateUserId" typeHandler="UuidTypeHandler"/>
+            <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
+                <result column="op_update_user_id" property="opUpdateUserId" typeHandler="UuidTypeHandler"/>
+                <result column="op_app_code" property="opAppCode"/>
+            <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
+                <result column="op_db_user" property="opDbUser"/>
+    </resultMap>
+    <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.mst.CusFollowResponse">
+        <id column="follow_id" property="followId"/>
+        <result column="cus_id" property="cusId" typeHandler="UuidTypeHandler"/>
+        <result column="follow_status" property="followStatus"/>
+        <result column="follow_type" property="followType"/>
+        <result column="follow_org" property="followOrg" typeHandler="UuidTypeHandler"/>
+        <result column="follow_staff" property="followStaff" typeHandler="UuidTypeHandler"/>
+        <result column="follow_time" property="followTime" typeHandler="TimestampTypeHandler"/>
+        <result column="follow_data" property="followData"/>
+        <result column="follow_time_len" property="followTimeLen"/>
+        <result column="stay_time_len" property="stayTimeLen"/>
+        <result column="intention" property="intention"/>
+        <result column="invite_result" property="inviteResult"/>
+        <result column="invite_time" property="inviteTime" typeHandler="TimestampTypeHandler"/>
+        <result column="design_staff" property="designStaff" typeHandler="UuidTypeHandler"/>
+        <result column="next_follow_plan" property="nextFollowPlan"/>
+        <result column="next_follow_time" property="nextFollowTime" typeHandler="TimestampTypeHandler"/>
+        <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
+        <result column="measure_status" property="measureStatus"/>
+        <result column="remarks" property="remarks"/>
+        <result column="flg_valid" property="flgValid"/>
+        <result column="cp_id" property="cpId"/>
+        <result column="cusName" property="cusName"/>
+        <result column="orgName" property="orgName"/>
+        <result column="staffName" property="staffName"/>
+        <result column="cusPhone" property="cusPhone"/>
+        <result column="addressFull" property="addressFull"/>
+
+
+
+    </resultMap>
+
+    <!-- 通用条件列 -->
+      <sql id="Condition">
+        <where>
+            <if test="cusId != null and cusId != ''">
+                AND cus_id = #{cusId}
+            </if>
+            <if test="followStatus != null and followStatus != ''">
+                AND follow_status = #{followStatus}
+            </if>
+            <if test="followType != null and followType != ''">
+                AND follow_type = #{followType}
+            </if>
+            <if test="followOrg != null and followOrg != ''">
+                AND follow_org = #{followOrg}
+            </if>
+            <if test="followStaff != null and followStaff != ''">
+                AND follow_staff = #{followStaff}
+            </if>
+            <if test="followTime != null">
+                AND follow_time = #{followTime}
+            </if>
+            <if test="followData != null and followData != ''">
+                AND follow_data = #{followData}
+            </if>
+            <if test="followTimeLen != null">
+                AND follow_time_len = #{followTimeLen}
+            </if>
+            <if test="stayTimeLen != null and stayTimeLen != ''">
+                AND stay_time_len = #{stayTimeLen}
+            </if>
+            <if test="intention != null and intention != ''">
+                AND intention = #{intention}
+            </if>
+            <if test="inviteResult != null and inviteResult != ''">
+                AND invite_result = #{inviteResult}
+            </if>
+            <if test="inviteTime != null">
+                AND invite_time = #{inviteTime}
+            </if>
+            <if test="designStaff != null and designStaff != ''">
+                AND design_staff = #{designStaff}
+            </if>
+            <if test="nextFollowPlan != null and nextFollowPlan != ''">
+                AND next_follow_plan = #{nextFollowPlan}
+            </if>
+            <if test="nextFollowTime != null">
+                AND next_follow_time = #{nextFollowTime}
+            </if>
+            <if test="annexPaths != null and annexPaths != ''">
+                AND annex_paths = #{annexPaths}
+            </if>
+            <if test="measureStatus != null and measureStatus != ''">
+                AND measure_status = #{measureStatus}
+            </if>
+            <if test="remarks != null and remarks != ''">
+                AND remarks = #{remarks}
+            </if>
+            <if test="flgValid != null">
+                AND flg_valid = #{flgValid}
+            </if>
+            <if test="cpId != null">
+                AND cp_id = #{cpId}
+            </if>
+            <if test="opCreateTime != null">
+                AND op_create_time = #{opCreateTime}
+            </if>
+            <if test="opCreateUserId != null and opCreateUserId != ''">
+                AND op_create_user_id = #{opCreateUserId}
+            </if>
+            <if test="opUpdateTime != null">
+                AND op_update_time = #{opUpdateTime}
+            </if>
+            <if test="opUpdateUserId != null and opUpdateUserId != ''">
+                AND op_update_user_id = #{opUpdateUserId}
+            </if>
+            <if test="opAppCode != null and opAppCode != ''">
+                AND op_app_code = #{opAppCode}
+            </if>
+            <if test="opTimestamp != null">
+                AND op_timestamp = #{opTimestamp}
+            </if>
+            <if test="opDbUser != null and opDbUser != ''">
+                AND op_db_user = #{opDbUser}
+            </if>
+        </where>
+    </sql>
+
+    <sql id="Condition_Join">
+        <where>
+            <if test="cusId != null and cusId != ''">
+                AND tccf.cus_id = #{cusId}
+            </if>
+            <if test="followStatus != null and followStatus != ''">
+                AND tccf.follow_status = #{followStatus}
+            </if>
+            <if test="followType != null and followType != ''">
+                AND tccf.follow_type = #{followType}
+            </if>
+            <if test="followOrg != null and followOrg != ''">
+                AND tccf.follow_org = #{followOrg}
+            </if>
+            <if test="followStaff != null and followStaff != ''">
+                AND tccf.follow_staff = #{followStaff}
+            </if>
+            <if test="followTime != null">
+                AND tccf.follow_time = #{followTime}
+            </if>
+            <if test="followData != null and followData != ''">
+                AND tccf.follow_data = #{followData}
+            </if>
+            <if test="followTimeLen != null">
+                AND tccf.follow_time_len = #{followTimeLen}
+            </if>
+            <if test="stayTimeLen != null and stayTimeLen != ''">
+                AND tccf.stay_time_len = #{stayTimeLen}
+            </if>
+            <if test="intention != null and intention != ''">
+                AND tccf.intention = #{intention}
+            </if>
+            <if test="inviteResult != null and inviteResult != ''">
+                AND tccf.invite_result = #{inviteResult}
+            </if>
+            <if test="inviteTime != null">
+                AND tccf.invite_time = #{inviteTime}
+            </if>
+            <if test="designStaff != null and designStaff != ''">
+                AND tccf.design_staff = #{designStaff}
+            </if>
+            <if test="nextFollowPlan != null and nextFollowPlan != ''">
+                AND tccf.next_follow_plan = #{nextFollowPlan}
+            </if>
+            <if test="nextFollowTime != null">
+                AND tccf.next_follow_time = #{nextFollowTime}
+            </if>
+            <if test="annexPaths != null and annexPaths != ''">
+                AND tccf.annex_paths = #{annexPaths}
+            </if>
+            <if test="measureStatus != null and measureStatus != ''">
+                AND tccf.measure_status = #{measureStatus}
+            </if>
+            <if test="remarks != null and remarks != ''">
+                AND tccf.remarks = #{remarks}
+            </if>
+            <if test="flgValid != null">
+                AND tccf.flg_valid = #{flgValid}
+            </if>
+            <if test="cpId != null">
+                AND tccf.cp_id = #{cpId}
+            </if>
+
+        </where>
+    </sql>
+
+    <sql id="idsForeach">
+        <!-- 根据主键followId批量操作 -->
+        WHERE follow_id in
+        <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
+            #{item}
+        </foreach>
+    </sql>
+
+    <!-- 查询表t_crm_cus_follow,(条件查询+分页)列表 -->
+    <select id="selectByCond" resultMap="BaseResultMapResponse">
+        SELECT
+        <include refid="Base_Column_List_Join"/>,
+        tmc.cus_name AS "cusName",
+        tmc.cus_phone AS "cusPhone",
+        tmc.address_full AS "addressFull",
+        tmo.org_name  AS  "orgName",
+        tms.staff_name  AS  "staffName"
+        FROM dkic_b.t_crm_cus_follow tccf
+        LEFT JOIN dkic_b.t_mst_customer tmc ON tmc.cus_id = tccf.cus_id
+        LEFT JOIN dkic_b.t_mst_org tmo on tmo.org_id = tccf.follow_org
+        LEFT JOIN dkic_b.t_mst_staff tms on tms.staff_id = tccf.follow_staff
+        <include refid="Condition_Join"/>
+        <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
+            limit #{end} offset #{start}
+        </if>
+    </select>
+
+    <!-- 查询表t_crm_cus_follow,(条件查询)个数 -->
+    <select id="countByCond" resultType="Long">
+        SELECT
+        count(1)
+        FROM dkic_b.t_crm_cus_follow tccf
+        <include refid="Condition_Join"/>
+    </select>
+
+    <!-- 根据主键查询表t_crm_cus_follow的一行数据 -->
+    <select id="selectById" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM dkic_b.t_crm_cus_follow
+        WHERE follow_id = #{followId}::uuid
+    </select>
+
+    <!-- 根据主键锁定表t_crm_cus_follow的一行数据 -->
+    <select id="selectByIdForUpdate" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM dkic_b.t_crm_cus_follow
+        WHERE follow_id = #{followId}
+        for update
+    </select>
+
+    <!-- 根据主键锁定表t_crm_cus_follow的多行数据 -->
+    <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM dkic_b.t_crm_cus_follow
+        <include refid="idsForeach"/>
+        for update
+    </select>
+
+    <insert id="insertBatch">
+        insert into dkic_b.t_crm_cus_follow
+        (
+        <trim suffixOverrides=",">
+            cus_id,
+            follow_status,
+            follow_type,
+            follow_org,
+            follow_staff,
+            follow_time,
+            follow_data,
+            follow_time_len,
+            stay_time_len,
+            intention,
+            invite_result,
+            invite_time,
+            design_staff,
+            next_follow_plan,
+            next_follow_time,
+            annex_paths,
+            measure_status,
+            remarks,
+            cp_id,
+            op_app_code,
+        </trim>
+        )
+        values
+        <foreach collection="list" index="index" item="item" separator=",">
+            (
+            <trim suffixOverrides=",">
+                #{item.cusId}::uuid,
+                #{item.followStatus},
+                #{item.followType},
+                #{item.followOrg}::uuid,
+                #{item.followStaff}::uuid,
+                #{item.followTime},
+                #{item.followData},
+                #{item.followTimeLen},
+                #{item.stayTimeLen},
+                #{item.intention},
+                #{item.inviteResult},
+                #{item.inviteTime},
+                #{item.designStaff}::uuid,
+                #{item.nextFollowPlan},
+                #{item.nextFollowTime},
+                #{item.annexPaths},
+                #{item.measureStatus},
+                #{item.remarks},
+                #{item.cpId},
+                #{item.opAppCode},
+            </trim>
+            )
+        </foreach>
+    </insert>
+</mapper>

+ 15 - 0
src/main/java/com/dk/mdm/mapper/mst/CusFollowStaffMapper.java

@@ -0,0 +1,15 @@
+package com.dk.mdm.mapper.mst;
+
+import com.dk.mdm.model.pojo.mst.CusFollowStaff;
+import com.dk.common.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+/**
+*  客户跟进人 Mapper
+*/
+@Repository
+public interface CusFollowStaffMapper extends BaseMapper<CusFollowStaff>{
+    CusFollowStaff selectByCusFollowStaffId(@Param("cusId") String cusId, @Param("followStaff") String followStaff);
+}
+

+ 132 - 0
src/main/java/com/dk/mdm/mapper/mst/CusFollowStaffMapper.xml

@@ -0,0 +1,132 @@
+<?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.dk.mdm.mapper.mst.CusFollowStaffMapper">
+
+    <!-- 通用设置 -->
+    <!-- 通用查询列 -->
+    <sql id="Base_Column_List">
+        cus_id, follow_staff, last_follow_id, last_follow_status, last_follow_time, follow_count, cp_id
+    </sql>
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mst.CusFollowStaff">
+        <id column="cus_id" property="cusId"/>
+                <result column="follow_staff" property="followStaff" typeHandler="UuidTypeHandler"/>
+                <result column="last_follow_id" property="lastFollowId" typeHandler="UuidTypeHandler"/>
+                <result column="last_follow_status" property="lastFollowStatus"/>
+            <result column="last_follow_time" property="lastFollowTime" typeHandler="TimestampTypeHandler"/>
+                <result column="follow_count" property="followCount"/>
+                <result column="cp_id" property="cpId"/>
+    </resultMap>
+
+    <!-- 通用条件列 -->
+    <sql id="Condition">
+        <where>
+            <if test="followStaff != null and followStaff != ''">
+                AND follow_staff = #{followStaff}
+            </if>
+            <if test="lastFollowId != null and lastFollowId != ''">
+                AND last_follow_id = #{lastFollowId}
+            </if>
+            <if test="lastFollowStatus != null and lastFollowStatus != ''">
+                AND last_follow_status = #{lastFollowStatus}
+            </if>
+            <if test="lastFollowTime != null">
+                AND last_follow_time = #{lastFollowTime}
+            </if>
+            <if test="followCount != null">
+                AND follow_count = #{followCount}
+            </if>
+            <if test="cpId != null">
+                AND cp_id = #{cpId}
+            </if>
+        </where>
+    </sql>
+
+    <sql id="idsForeach">
+        <!-- 根据主键cusId批量操作 -->
+        WHERE cus_id in
+        <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
+            #{item}
+        </foreach>
+    </sql>
+
+    <!-- 查询表t_crm_cus_follow_staff,(条件查询+分页)列表 -->
+    <select id="selectByCond" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM t_crm_cus_follow_staff
+        <include refid="Condition"/>
+        <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
+            limit #{end} offset #{start}
+        </if>
+    </select>
+
+    <!-- 查询表t_crm_cus_follow_staff,(条件查询)个数 -->
+    <select id="countByCond" resultType="Long">
+        SELECT
+        count(1)
+        FROM t_crm_cus_follow_staff
+        <include refid="Condition"/>
+    </select>
+
+    <!-- 根据主键查询表t_crm_cus_follow_staff的一行数据 -->
+    <select id="selectById" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM t_crm_cus_follow_staff
+        WHERE cus_id = #{cusId}::uuid
+    </select>
+
+    <!-- 根据主键锁定表t_crm_cus_follow_staff的一行数据 -->
+    <select id="selectByIdForUpdate" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM t_crm_cus_follow_staff
+        WHERE cus_id = #{cusId}
+        for update
+    </select>
+
+    <!-- 根据主键锁定表t_crm_cus_follow_staff的多行数据 -->
+    <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM t_crm_cus_follow_staff
+        <include refid="idsForeach"/>
+        for update
+    </select>
+
+    <insert id="insertBatch">
+        insert into t_crm_cus_follow_staff
+        (
+        <trim suffixOverrides=",">
+            follow_staff,
+            last_follow_id,
+            last_follow_status,
+            last_follow_time,
+            follow_count,
+            cp_id,
+        </trim>
+        )
+        values
+        <foreach collection="list" index="index" item="item" separator=",">
+            (
+            <trim suffixOverrides=",">
+                #{item.followStaff}::uuid,
+                #{item.lastFollowId}::uuid,
+                #{item.lastFollowStatus},
+                #{item.lastFollowTime},
+                #{item.followCount},
+                #{item.cpId},
+            </trim>
+            )
+        </foreach>
+    </insert>
+
+    <select id="selectByCusFollowStaffId" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM dkic_b.t_crm_cus_follow_staff
+        where cus_id = #{cusId} and follow_staff = #{followStaff}
+    </select>
+</mapper>

+ 9 - 0
src/main/java/com/dk/mdm/mapper/mst/CustomerMapper.java

@@ -4,6 +4,7 @@ import com.dk.mdm.model.pojo.mst.Customer;
 import com.dk.common.mapper.BaseMapper;
 import com.dk.common.mapper.BaseMapper;
 import com.dk.mdm.model.query.mst.CustomerQuery;
 import com.dk.mdm.model.query.mst.CustomerQuery;
 import com.dk.mdm.model.response.mst.CustomerResponse;
 import com.dk.mdm.model.response.mst.CustomerResponse;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 import org.springframework.stereotype.Repository;
 
 
 import java.util.List;
 import java.util.List;
@@ -26,5 +27,13 @@ public interface CustomerMapper extends BaseMapper<Customer>{
      * @date : 2024/2/26 10:36
      * @date : 2024/2/26 10:36
      */
      */
     Long countByCond(CustomerQuery customerQuery);
     Long countByCond(CustomerQuery customerQuery);
+
+
+    /**
+     * @desc : 查询跟进人
+     * @author : 于继渤
+     * @date : 2022-05-26 14:05
+     */
+    Object selectFollowStaffs(@Param("cusId") String customerId);
 }
 }
 
 

+ 19 - 1
src/main/java/com/dk/mdm/mapper/mst/CustomerMapper.xml

@@ -90,6 +90,7 @@
         <result column="reportStaffName" property="reportStaffName"/>
         <result column="reportStaffName" property="reportStaffName"/>
         <result column="followStaffName" property="followStaffName"/>
         <result column="followStaffName" property="followStaffName"/>
         <result column="lastFollowStaffName" property="lastFollowStaffName"/>
         <result column="lastFollowStaffName" property="lastFollowStaffName"/>
+        <result column="saleStatusName" property="saleStatusName"/>
 
 
     </resultMap>
     </resultMap>
 
 
@@ -174,6 +175,13 @@
             <if test="cpId != null">
             <if test="cpId != null">
                 AND tmc.cp_id = #{cpId}
                 AND tmc.cp_id = #{cpId}
             </if>
             </if>
+            <if  test="searchText != null">
+                AND (data_value  like concat('%', my_ex.likequery(#{searchText}) , '%')
+                OR  dict_code  like concat('%', my_ex.likequery(#{searchText}) , '%')
+                OR  remarks like concat('%', my_ex.likequery(#{searchText}) , '%')
+                )
+            </if>
+
 
 
         </where>
         </where>
     </sql>
     </sql>
@@ -194,7 +202,8 @@
         tmsc.channel_name  AS  "channelName",
         tmsc.channel_name  AS  "channelName",
         tmo.org_name  AS  "orgName",
         tmo.org_name  AS  "orgName",
         tms.staff_name  AS  "staffName",
         tms.staff_name  AS  "staffName",
-        tms2.staff_name  AS  "reportStaffName"
+        tms2.staff_name  AS  "reportStaffName",
+        tdk.kind_name_i18n  ->> 'zh_CN' AS "saleStatusName"
 --         tms3.staff_name  AS  "followStaffName",
 --         tms3.staff_name  AS  "followStaffName",
 --         tms4.staff_name  AS  "lastFollowStaffName"
 --         tms4.staff_name  AS  "lastFollowStaffName"
         FROM dkic_b.t_mst_customer tmc
         FROM dkic_b.t_mst_customer tmc
@@ -203,6 +212,7 @@
         LEFT JOIN  dkic_b.t_mst_org tmo  on tmo.org_id =  tmc.org_id
         LEFT JOIN  dkic_b.t_mst_org tmo  on tmo.org_id =  tmc.org_id
         LEFT JOIN  dkic_b.t_mst_staff tms  on tms.staff_id =  tmc.staff_id
         LEFT JOIN  dkic_b.t_mst_staff tms  on tms.staff_id =  tmc.staff_id
         LEFT JOIN  dkic_b.t_mst_staff tms2  on tms2.staff_id =  tmc.report_staff
         LEFT JOIN  dkic_b.t_mst_staff tms2  on tms2.staff_id =  tmc.report_staff
+        LEFT JOIN  sys.t_data_kind tdk  on tdk.kind_code =  tmc.sale_status
 --         LEFT JOIN  dkic_b.t_mst_staff tms3  on tms3.staff_id =  tmc.follow_staffs
 --         LEFT JOIN  dkic_b.t_mst_staff tms3  on tms3.staff_id =  tmc.follow_staffs
 --         LEFT JOIN  dkic_b.t_mst_staff tms4  on tms4.staff_id =  tmc.last_follow_staff
 --         LEFT JOIN  dkic_b.t_mst_staff tms4  on tms4.staff_id =  tmc.last_follow_staff
         <include refid="Condition"/>
         <include refid="Condition"/>
@@ -311,4 +321,12 @@
             )
             )
         </foreach>
         </foreach>
     </insert>
     </insert>
+
+    <!--    查询跟进人-->
+    <select id="selectFollowStaffs" resultType="Object">
+        SELECT follow_staffs
+        from dkic_b.t_mst_customer
+        WHERE cus_id = #{cusId}
+    </select>
+
 </mapper>
 </mapper>

+ 7 - 0
src/main/java/com/dk/mdm/mapper/pur/PurchaseItemMapper.xml

@@ -95,6 +95,13 @@
         <result column="remarks" property="remarks"/>
         <result column="remarks" property="remarks"/>
         <result column="flg_valid" property="flgValid"/>
         <result column="flg_valid" property="flgValid"/>
         <result column="cp_id" property="cpId"/>
         <result column="cp_id" property="cpId"/>
+        <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
+        <result column="op_create_user_id" property="opCreateUserId" typeHandler="UuidTypeHandler"/>
+        <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
+        <result column="op_update_user_id" property="opUpdateUserId" typeHandler="UuidTypeHandler"/>
+        <result column="op_app_code" property="opAppCode"/>
+        <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
+        <result column="op_db_user" property="opDbUser"/>
     </resultMap>
     </resultMap>
 
 
 
 

+ 296 - 0
src/main/java/com/dk/mdm/model/pojo/mst/CusFollow.java

@@ -0,0 +1,296 @@
+package com.dk.mdm.model.pojo.mst;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.*;
+import java.io.Serializable;
+
+import com.dk.common.infrastructure.annotaiton.ExportTitle;
+import com.dk.common.infrastructure.handler.*;
+import com.dk.common.model.pojo.PageInfo;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.AllArgsConstructor;
+import lombok.NoArgsConstructor;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.List;
+import java.time.LocalDateTime;
+
+/**
+ *  客户跟进
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Accessors(chain = true)
+@ExportTitle("客户跟进")
+@TableName(value = "t_crm_cus_follow", autoResultMap = true)
+@ApiModel(value="实体类:客户跟进", description="表名:t_crm_cus_follow")
+public class CusFollow   implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 跟进ID
+     */
+    @ApiModelProperty(value = "跟进ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String followId;
+
+
+    /**
+     * 客户ID (陌生接待时为null)
+     */
+    @Excel(name = "客户ID (陌生接待时为null)")
+    @ApiModelProperty(value = "客户ID (陌生接待时为null)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String cusId;
+
+
+    /**
+     * 跟进状态 (【系统字典】陌生接待、留资接待(报备)、跟进、邀约、约尺)
+     */
+    @Excel(name = "跟进状态 (【系统字典】陌生接待、留资接待(报备)、跟进、邀约、约尺)")
+    @ApiModelProperty(value = "跟进状态 (【系统字典】陌生接待、留资接待(报备)、跟进、邀约、约尺)")
+    private String followStatus;
+
+
+    /**
+     * 跟进方式 (【系统字典】电话、微信、上门、进店)
+     */
+    @Excel(name = "跟进方式 (【系统字典】电话、微信、上门、进店)")
+    @ApiModelProperty(value = "跟进方式 (【系统字典】电话、微信、上门、进店)")
+    private String followType;
+
+
+    /**
+     * 跟进部门
+     */
+    @Excel(name = "跟进部门")
+    @ApiModelProperty(value = "跟进部门")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String followOrg;
+
+
+    /**
+     * 跟进人
+     */
+    @Excel(name = "跟进人")
+    @ApiModelProperty(value = "跟进人")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String followStaff;
+
+
+    /**
+     * 跟进时间
+     */
+    @Excel(name = "跟进时间")
+    @ApiModelProperty(value = "跟进时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime followTime;
+
+
+    /**
+     * 跟进内容
+     */
+    @Excel(name = "跟进内容")
+    @ApiModelProperty(value = "跟进内容")
+    private String followData;
+
+
+    /**
+     * 跟进时长 (分钟)
+     */
+    @Excel(name = "跟进时长 (分钟)")
+    @ApiModelProperty(value = "跟进时长 (分钟)")
+    private Integer followTimeLen;
+
+
+    /**
+     * 留店时长 (【系统字典】10-20、20-30。。)
+     */
+    @Excel(name = "留店时长 (【系统字典】10-20、20-30。。)")
+    @ApiModelProperty(value = "留店时长 (【系统字典】10-20、20-30。。)")
+    private String stayTimeLen;
+
+
+    /**
+     * 客户意向 (【系统字典】)
+     */
+    @Excel(name = "客户意向 (【系统字典】)")
+    @ApiModelProperty(value = "客户意向 (【系统字典】)")
+    private String intention;
+
+
+    /**
+     * 邀约结果 (【系统字典】)
+     */
+    @Excel(name = "邀约结果 (【系统字典】)")
+    @ApiModelProperty(value = "邀约结果 (【系统字典】)")
+    private String inviteResult;
+
+
+    /**
+     * 邀约时间
+     */
+    @Excel(name = "邀约时间")
+    @ApiModelProperty(value = "邀约时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime inviteTime;
+
+
+    /**
+     * 设计师
+     */
+    @Excel(name = "设计师")
+    @ApiModelProperty(value = "设计师")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String designStaff;
+
+
+    /**
+     * 下次跟进计划
+     */
+    @Excel(name = "下次跟进计划")
+    @ApiModelProperty(value = "下次跟进计划")
+    private String nextFollowPlan;
+
+
+    /**
+     * 下次跟进时间 (提醒时间)
+     */
+    @Excel(name = "下次跟进时间 (提醒时间)")
+    @ApiModelProperty(value = "下次跟进时间 (提醒时间)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime nextFollowTime;
+
+
+    /**
+     * 跟进附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)
+     */
+    @Excel(name = "跟进附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
+    @ApiModelProperty(value = "跟进附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONObject annexPaths;
+
+
+    /**
+     * 量尺状态 (【系统字典】)
+     */
+    @Excel(name = "量尺状态 (【系统字典】)")
+    @ApiModelProperty(value = "量尺状态 (【系统字典】)")
+    private String measureStatus;
+
+
+    /**
+     * 备注
+     */
+    @Excel(name = "备注")
+    @ApiModelProperty(value = "备注")
+    private String remarks;
+
+
+    /**
+     * 有效标识 (1:正常 0:停用)
+     */
+    @Excel(name = "有效标识 (1:正常 0:停用)")
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private Boolean flgValid;
+
+
+    /**
+     * 企业ID
+     */
+    @TableField(fill = FieldFill.INSERT)
+    @Excel(name = "企业ID")
+    @ApiModelProperty(value = "企业ID")
+    private Integer cpId;
+
+
+    /**
+     * 创建时间 (触发器自动处理)
+     */
+    @Excel(name = "创建时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
+    @ApiModelProperty(value = "创建时间 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opCreateTime;
+
+
+    /**
+     * 创建用户 (触发器自动处理)
+     */
+    @Excel(name = "创建用户 (触发器自动处理)")
+    @ApiModelProperty(value = "创建用户 (触发器自动处理)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String opCreateUserId;
+
+
+    /**
+     * 修改时间 (触发器自动处理)
+     */
+    @Excel(name = "修改时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
+    @ApiModelProperty(value = "修改时间 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opUpdateTime;
+
+
+    /**
+     * 修改用户 (触发器自动处理)
+     */
+    @Excel(name = "修改用户 (触发器自动处理)")
+    @ApiModelProperty(value = "修改用户 (触发器自动处理)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String opUpdateUserId;
+
+
+    /**
+     * 数据操作应用 (触发器自动处理)
+     */
+    @Excel(name = "数据操作应用 (触发器自动处理)")
+    @ApiModelProperty(value = "数据操作应用 (触发器自动处理)")
+    private String opAppCode;
+
+
+    /**
+     * 数据时间戳 (触发器自动处理)
+     */
+    @Excel(name = "数据时间戳 (触发器自动处理)")
+    @ApiModelProperty(value = "数据时间戳 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opTimestamp;
+
+
+    /**
+     * 数据操作数据库用户 (触发器自动处理)
+     */
+    @Excel(name = "数据操作数据库用户 (触发器自动处理)")
+    @ApiModelProperty(value = "数据操作数据库用户 (触发器自动处理)")
+    private String opDbUser;
+
+
+    /*
+     * 相关属性
+     * @TableField(exist = false)
+     */
+
+    /*
+     * 关联属性 + 查询条件
+     * @TableField(exist = false)
+     */
+
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 115 - 0
src/main/java/com/dk/mdm/model/pojo/mst/CusFollowStaff.java

@@ -0,0 +1,115 @@
+package com.dk.mdm.model.pojo.mst;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.*;
+import java.io.Serializable;
+
+import com.dk.common.infrastructure.annotaiton.ExportTitle;
+import com.dk.common.infrastructure.handler.*;
+import com.dk.common.model.pojo.PageInfo;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.AllArgsConstructor;
+import lombok.NoArgsConstructor;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.List;
+import java.time.LocalDateTime;
+
+/**
+ *  客户跟进人
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@ExportTitle("客户跟进人")
+@TableName(value = "t_crm_cus_follow_staff", autoResultMap = true)
+@ApiModel(value="实体类:客户跟进人", description="表名:t_crm_cus_follow_staff")
+public class CusFollowStaff extends PageInfo<CusFollowStaff> implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 客户ID
+     */
+
+    @ApiModelProperty(value = "客户ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String cusId;
+
+
+    /**
+     * 跟进人
+     */
+    @Excel(name = "跟进人")
+    @ApiModelProperty(value = "跟进人")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String followStaff;
+
+
+    /**
+     * 最后跟进ID
+     */
+    @Excel(name = "最后跟进ID")
+    @ApiModelProperty(value = "最后跟进ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String lastFollowId;
+
+
+    /**
+     * 最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)
+     */
+    @Excel(name = "最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)")
+    @ApiModelProperty(value = "最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)")
+    private String lastFollowStatus;
+
+
+    /**
+     * 最后跟进时间
+     */
+    @Excel(name = "最后跟进时间")
+    @ApiModelProperty(value = "最后跟进时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime lastFollowTime;
+
+
+    /**
+     * 跟进次数
+     */
+    @Excel(name = "跟进次数")
+    @ApiModelProperty(value = "跟进次数")
+    private Integer followCount;
+
+
+    /**
+     * 企业ID
+     */
+    @TableField(fill = FieldFill.INSERT)
+    @Excel(name = "企业ID")
+    @ApiModelProperty(value = "企业ID")
+    private Integer cpId;
+
+
+    /*
+     * 相关属性
+     * @TableField(exist = false)
+     */
+
+    /*
+     * 关联属性 + 查询条件
+     * @TableField(exist = false)
+     */
+
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 299 - 0
src/main/java/com/dk/mdm/model/query/mst/CusFollowQuery.java

@@ -0,0 +1,299 @@
+package com.dk.mdm.model.query.mst;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.dk.common.infrastructure.annotaiton.ExportTitle;
+import com.dk.common.infrastructure.handler.JsonTypeHandler;
+import com.dk.common.infrastructure.handler.TimestampTypeHandler;
+import com.dk.common.infrastructure.handler.UuidTypeHandler;
+import com.dk.common.model.pojo.PageInfo;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ *  客户跟进
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@ExportTitle("客户跟进")
+@TableName(value = "t_crm_cus_follow", autoResultMap = true)
+@ApiModel(value="实体类:客户跟进", description="表名:t_crm_cus_follow")
+public class CusFollowQuery extends PageInfo<CusFollowQuery> implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 跟进ID
+     */
+    @ApiModelProperty(value = "跟进ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String followId;
+
+
+    /**
+     * 客户ID (陌生接待时为null)
+     */
+    @Excel(name = "客户ID (陌生接待时为null)")
+    @ApiModelProperty(value = "客户ID (陌生接待时为null)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String cusId;
+
+
+    /**
+     * 跟进状态 (【系统字典】陌生接待、留资接待(报备)、跟进、邀约、约尺)
+     */
+    @Excel(name = "跟进状态 (【系统字典】陌生接待、留资接待(报备)、跟进、邀约、约尺)")
+    @ApiModelProperty(value = "跟进状态 (【系统字典】陌生接待、留资接待(报备)、跟进、邀约、约尺)")
+    private String followStatus;
+
+
+    /**
+     * 跟进方式 (【系统字典】电话、微信、上门、进店)
+     */
+    @Excel(name = "跟进方式 (【系统字典】电话、微信、上门、进店)")
+    @ApiModelProperty(value = "跟进方式 (【系统字典】电话、微信、上门、进店)")
+    private String followType;
+
+
+    /**
+     * 跟进部门
+     */
+    @Excel(name = "跟进部门")
+    @ApiModelProperty(value = "跟进部门")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String followOrg;
+
+
+    /**
+     * 跟进人
+     */
+    @Excel(name = "跟进人")
+    @ApiModelProperty(value = "跟进人")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String followStaff;
+
+
+    /**
+     * 跟进时间
+     */
+    @Excel(name = "跟进时间")
+    @ApiModelProperty(value = "跟进时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime followTime;
+
+
+    /**
+     * 跟进内容
+     */
+    @Excel(name = "跟进内容")
+    @ApiModelProperty(value = "跟进内容")
+    private String followData;
+
+
+    /**
+     * 跟进时长 (分钟)
+     */
+    @Excel(name = "跟进时长 (分钟)")
+    @ApiModelProperty(value = "跟进时长 (分钟)")
+    private Integer followTimeLen;
+
+
+    /**
+     * 留店时长 (【系统字典】10-20、20-30。。)
+     */
+    @Excel(name = "留店时长 (【系统字典】10-20、20-30。。)")
+    @ApiModelProperty(value = "留店时长 (【系统字典】10-20、20-30。。)")
+    private String stayTimeLen;
+
+
+    /**
+     * 客户意向 (【系统字典】)
+     */
+    @Excel(name = "客户意向 (【系统字典】)")
+    @ApiModelProperty(value = "客户意向 (【系统字典】)")
+    private String intention;
+
+
+    /**
+     * 邀约结果 (【系统字典】)
+     */
+    @Excel(name = "邀约结果 (【系统字典】)")
+    @ApiModelProperty(value = "邀约结果 (【系统字典】)")
+    private String inviteResult;
+
+
+    /**
+     * 邀约时间
+     */
+    @Excel(name = "邀约时间")
+    @ApiModelProperty(value = "邀约时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime inviteTime;
+
+
+    /**
+     * 设计师
+     */
+    @Excel(name = "设计师")
+    @ApiModelProperty(value = "设计师")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String designStaff;
+
+
+    /**
+     * 下次跟进计划
+     */
+    @Excel(name = "下次跟进计划")
+    @ApiModelProperty(value = "下次跟进计划")
+    private String nextFollowPlan;
+
+
+    /**
+     * 下次跟进时间 (提醒时间)
+     */
+    @Excel(name = "下次跟进时间 (提醒时间)")
+    @ApiModelProperty(value = "下次跟进时间 (提醒时间)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime nextFollowTime;
+
+
+    /**
+     * 跟进附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)
+     */
+    @Excel(name = "跟进附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
+    @ApiModelProperty(value = "跟进附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONObject annexPaths;
+
+
+    /**
+     * 量尺状态 (【系统字典】)
+     */
+    @Excel(name = "量尺状态 (【系统字典】)")
+    @ApiModelProperty(value = "量尺状态 (【系统字典】)")
+    private String measureStatus;
+
+
+    /**
+     * 备注
+     */
+    @Excel(name = "备注")
+    @ApiModelProperty(value = "备注")
+    private String remarks;
+
+
+    /**
+     * 有效标识 (1:正常 0:停用)
+     */
+    @Excel(name = "有效标识 (1:正常 0:停用)")
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private Boolean flgValid;
+
+
+    /**
+     * 企业ID
+     */
+    @TableField(fill = FieldFill.INSERT)
+    @Excel(name = "企业ID")
+    @ApiModelProperty(value = "企业ID")
+    private Integer cpId;
+
+
+    /**
+     * 创建时间 (触发器自动处理)
+     */
+    @Excel(name = "创建时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
+    @ApiModelProperty(value = "创建时间 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opCreateTime;
+
+
+    /**
+     * 创建用户 (触发器自动处理)
+     */
+    @Excel(name = "创建用户 (触发器自动处理)")
+    @ApiModelProperty(value = "创建用户 (触发器自动处理)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String opCreateUserId;
+
+
+    /**
+     * 修改时间 (触发器自动处理)
+     */
+    @Excel(name = "修改时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
+    @ApiModelProperty(value = "修改时间 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opUpdateTime;
+
+
+    /**
+     * 修改用户 (触发器自动处理)
+     */
+    @Excel(name = "修改用户 (触发器自动处理)")
+    @ApiModelProperty(value = "修改用户 (触发器自动处理)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String opUpdateUserId;
+
+
+    /**
+     * 数据操作应用 (触发器自动处理)
+     */
+    @Excel(name = "数据操作应用 (触发器自动处理)")
+    @ApiModelProperty(value = "数据操作应用 (触发器自动处理)")
+    private String opAppCode;
+
+
+    /**
+     * 数据时间戳 (触发器自动处理)
+     */
+    @Excel(name = "数据时间戳 (触发器自动处理)")
+    @ApiModelProperty(value = "数据时间戳 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opTimestamp;
+
+
+    /**
+     * 数据操作数据库用户 (触发器自动处理)
+     */
+    @Excel(name = "数据操作数据库用户 (触发器自动处理)")
+    @ApiModelProperty(value = "数据操作数据库用户 (触发器自动处理)")
+    private String opDbUser;
+
+
+    /*
+     * 相关属性
+     * @TableField(exist = false)
+     */
+
+    /*
+     * 关联属性 + 查询条件
+     * @TableField(exist = false)
+     */
+
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 113 - 0
src/main/java/com/dk/mdm/model/query/mst/CusFollowStaffQuery.java

@@ -0,0 +1,113 @@
+package com.dk.mdm.model.query.mst;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.*;
+import com.dk.common.infrastructure.annotaiton.ExportTitle;
+import com.dk.common.infrastructure.handler.TimestampTypeHandler;
+import com.dk.common.infrastructure.handler.UuidTypeHandler;
+import com.dk.common.model.pojo.PageInfo;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ *  客户跟进人
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@ExportTitle("客户跟进人")
+@TableName(value = "t_crm_cus_follow_staff", autoResultMap = true)
+@ApiModel(value="实体类:客户跟进人", description="表名:t_crm_cus_follow_staff")
+public class CusFollowStaffQuery extends PageInfo<CusFollowStaffQuery> implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 客户ID
+     */
+
+    @ApiModelProperty(value = "客户ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String cusId;
+
+
+    /**
+     * 跟进人
+     */
+    @Excel(name = "跟进人")
+    @ApiModelProperty(value = "跟进人")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String followStaff;
+
+
+    /**
+     * 最后跟进ID
+     */
+    @Excel(name = "最后跟进ID")
+    @ApiModelProperty(value = "最后跟进ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String lastFollowId;
+
+
+    /**
+     * 最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)
+     */
+    @Excel(name = "最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)")
+    @ApiModelProperty(value = "最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)")
+    private String lastFollowStatus;
+
+
+    /**
+     * 最后跟进时间
+     */
+    @Excel(name = "最后跟进时间")
+    @ApiModelProperty(value = "最后跟进时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime lastFollowTime;
+
+
+    /**
+     * 跟进次数
+     */
+    @Excel(name = "跟进次数")
+    @ApiModelProperty(value = "跟进次数")
+    private Integer followCount;
+
+
+    /**
+     * 企业ID
+     */
+    @TableField(fill = FieldFill.INSERT)
+    @Excel(name = "企业ID")
+    @ApiModelProperty(value = "企业ID")
+    private Integer cpId;
+
+
+    /*
+     * 相关属性
+     * @TableField(exist = false)
+     */
+
+    /*
+     * 关联属性 + 查询条件
+     * @TableField(exist = false)
+     */
+
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 229 - 0
src/main/java/com/dk/mdm/model/response/mst/CusFollowResponse.java

@@ -0,0 +1,229 @@
+package com.dk.mdm.model.response.mst;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.dk.common.infrastructure.annotaiton.ExportTitle;
+import com.dk.common.infrastructure.handler.JsonTypeHandler;
+import com.dk.common.infrastructure.handler.TimestampTypeHandler;
+import com.dk.common.infrastructure.handler.UuidTypeHandler;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ *  客户跟进
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Accessors(chain = true)
+@ExportTitle("客户跟进")
+@TableName(value = "t_crm_cus_follow", autoResultMap = true)
+@ApiModel(value="实体类:客户跟进", description="表名:t_crm_cus_follow")
+public class CusFollowResponse implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 跟进ID
+     */
+    @ApiModelProperty(value = "跟进ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String followId;
+
+
+    /**
+     * 客户ID (陌生接待时为null)
+     */
+    @Excel(name = "客户ID (陌生接待时为null)")
+    @ApiModelProperty(value = "客户ID (陌生接待时为null)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String cusId;
+
+
+    /**
+     * 跟进状态 (【系统字典】陌生接待、留资接待(报备)、跟进、邀约、约尺)
+     */
+    @Excel(name = "跟进状态 (【系统字典】陌生接待、留资接待(报备)、跟进、邀约、约尺)")
+    @ApiModelProperty(value = "跟进状态 (【系统字典】陌生接待、留资接待(报备)、跟进、邀约、约尺)")
+    private String followStatus;
+
+
+    /**
+     * 跟进方式 (【系统字典】电话、微信、上门、进店)
+     */
+    @Excel(name = "跟进方式 (【系统字典】电话、微信、上门、进店)")
+    @ApiModelProperty(value = "跟进方式 (【系统字典】电话、微信、上门、进店)")
+    private String followType;
+
+
+    /**
+     * 跟进部门
+     */
+    @Excel(name = "跟进部门")
+    @ApiModelProperty(value = "跟进部门")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String followOrg;
+
+
+    /**
+     * 跟进人
+     */
+    @Excel(name = "跟进人")
+    @ApiModelProperty(value = "跟进人")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String followStaff;
+
+
+    /**
+     * 跟进时间
+     */
+    @Excel(name = "跟进时间")
+    @ApiModelProperty(value = "跟进时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime followTime;
+
+
+    /**
+     * 跟进内容
+     */
+    @Excel(name = "跟进内容")
+    @ApiModelProperty(value = "跟进内容")
+    private String followData;
+
+
+    /**
+     * 跟进时长 (分钟)
+     */
+    @Excel(name = "跟进时长 (分钟)")
+    @ApiModelProperty(value = "跟进时长 (分钟)")
+    private Integer followTimeLen;
+
+
+    /**
+     * 留店时长 (【系统字典】10-20、20-30。。)
+     */
+    @Excel(name = "留店时长 (【系统字典】10-20、20-30。。)")
+    @ApiModelProperty(value = "留店时长 (【系统字典】10-20、20-30。。)")
+    private String stayTimeLen;
+
+
+    /**
+     * 客户意向 (【系统字典】)
+     */
+    @Excel(name = "客户意向 (【系统字典】)")
+    @ApiModelProperty(value = "客户意向 (【系统字典】)")
+    private String intention;
+
+
+    /**
+     * 邀约结果 (【系统字典】)
+     */
+    @Excel(name = "邀约结果 (【系统字典】)")
+    @ApiModelProperty(value = "邀约结果 (【系统字典】)")
+    private String inviteResult;
+
+
+    /**
+     * 邀约时间
+     */
+    @Excel(name = "邀约时间")
+    @ApiModelProperty(value = "邀约时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime inviteTime;
+
+
+    /**
+     * 设计师
+     */
+    @Excel(name = "设计师")
+    @ApiModelProperty(value = "设计师")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String designStaff;
+
+
+    /**
+     * 下次跟进计划
+     */
+    @Excel(name = "下次跟进计划")
+    @ApiModelProperty(value = "下次跟进计划")
+    private String nextFollowPlan;
+
+
+    /**
+     * 下次跟进时间 (提醒时间)
+     */
+    @Excel(name = "下次跟进时间 (提醒时间)")
+    @ApiModelProperty(value = "下次跟进时间 (提醒时间)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime nextFollowTime;
+
+
+    /**
+     * 跟进附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)
+     */
+    @Excel(name = "跟进附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
+    @ApiModelProperty(value = "跟进附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONObject annexPaths;
+
+
+    /**
+     * 量尺状态 (【系统字典】)
+     */
+    @Excel(name = "量尺状态 (【系统字典】)")
+    @ApiModelProperty(value = "量尺状态 (【系统字典】)")
+    private String measureStatus;
+
+
+    /**
+     * 备注
+     */
+    @Excel(name = "备注")
+    @ApiModelProperty(value = "备注")
+    private String remarks;
+
+
+    /**
+     * 有效标识 (1:正常 0:停用)
+     */
+    @Excel(name = "有效标识 (1:正常 0:停用)")
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private Boolean flgValid;
+
+
+    /**
+     * 企业ID
+     */
+    @TableField(fill = FieldFill.INSERT)
+    @Excel(name = "企业ID")
+    @ApiModelProperty(value = "企业ID")
+    private Integer cpId;
+
+
+    private String cusName;
+    private String cusPhone;
+    private String orgName;
+    private String staffName;
+    private String addressFull;
+
+
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 106 - 0
src/main/java/com/dk/mdm/model/response/mst/CusFollowStaffResponse.java

@@ -0,0 +1,106 @@
+package com.dk.mdm.model.response.mst;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.dk.common.infrastructure.annotaiton.ExportTitle;
+import com.dk.common.infrastructure.handler.TimestampTypeHandler;
+import com.dk.common.infrastructure.handler.UuidTypeHandler;
+import com.dk.common.model.pojo.PageInfo;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ *  客户跟进人
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Accessors(chain = true)
+@ExportTitle("客户跟进人")
+@TableName(value = "t_crm_cus_follow_staff", autoResultMap = true)
+@ApiModel(value="实体类:客户跟进人", description="表名:t_crm_cus_follow_staff")
+public class CusFollowStaffResponse implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 客户ID
+     */
+
+    @ApiModelProperty(value = "客户ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String cusId;
+
+
+    /**
+     * 跟进人
+     */
+    @Excel(name = "跟进人")
+    @ApiModelProperty(value = "跟进人")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String followStaff;
+
+
+    /**
+     * 最后跟进ID
+     */
+    @Excel(name = "最后跟进ID")
+    @ApiModelProperty(value = "最后跟进ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String lastFollowId;
+
+
+    /**
+     * 最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)
+     */
+    @Excel(name = "最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)")
+    @ApiModelProperty(value = "最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)")
+    private String lastFollowStatus;
+
+
+    /**
+     * 最后跟进时间
+     */
+    @Excel(name = "最后跟进时间")
+    @ApiModelProperty(value = "最后跟进时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime lastFollowTime;
+
+
+    /**
+     * 跟进次数
+     */
+    @Excel(name = "跟进次数")
+    @ApiModelProperty(value = "跟进次数")
+    private Integer followCount;
+
+
+    /**
+     * 企业ID
+     */
+    @TableField(fill = FieldFill.INSERT)
+    @Excel(name = "企业ID")
+    @ApiModelProperty(value = "企业ID")
+    private Integer cpId;
+
+
+
+
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 15 - 75
src/main/java/com/dk/mdm/model/response/mst/CustomerResponse.java

@@ -273,91 +273,31 @@ public class CustomerResponse extends PageInfo<CustomerResponse> implements Seri
     private Integer cpId;
     private Integer cpId;
 
 
 
 
-    /**
-     * 创建时间 (触发器自动处理)
-     */
-    @Excel(name = "创建时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
-    @ApiModelProperty(value = "创建时间 (触发器自动处理)")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-    @TableField(typeHandler = TimestampTypeHandler.class)
-    private LocalDateTime opCreateTime;
-
-
-    /**
-     * 创建用户 (触发器自动处理)
-     */
-    @Excel(name = "创建用户 (触发器自动处理)")
-    @ApiModelProperty(value = "创建用户 (触发器自动处理)")
-    @TableField(typeHandler = UuidTypeHandler.class)
-    private String opCreateUserId;
-
-
-    /**
-     * 修改时间 (触发器自动处理)
-     */
-    @Excel(name = "修改时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
-    @ApiModelProperty(value = "修改时间 (触发器自动处理)")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-    @TableField(typeHandler = TimestampTypeHandler.class)
-    private LocalDateTime opUpdateTime;
-
-
-    /**
-     * 修改用户 (触发器自动处理)
-     */
-    @Excel(name = "修改用户 (触发器自动处理)")
-    @ApiModelProperty(value = "修改用户 (触发器自动处理)")
-    @TableField(typeHandler = UuidTypeHandler.class)
-    private String opUpdateUserId;
-
-
-    /**
-     * 数据操作应用 (触发器自动处理)
-     */
-    @Excel(name = "数据操作应用 (触发器自动处理)")
-    @ApiModelProperty(value = "数据操作应用 (触发器自动处理)")
-    private String opAppCode;
-
-
-    /**
-     * 数据时间戳 (触发器自动处理)
-     */
-    @Excel(name = "数据时间戳 (触发器自动处理)")
-    @ApiModelProperty(value = "数据时间戳 (触发器自动处理)")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-    @TableField(typeHandler = TimestampTypeHandler.class)
-    private LocalDateTime opTimestamp;
-
-
-    /**
-     * 数据操作数据库用户 (触发器自动处理)
-     */
-    @Excel(name = "数据操作数据库用户 (触发器自动处理)")
-    @ApiModelProperty(value = "数据操作数据库用户 (触发器自动处理)")
-    private String opDbUser;
-
-
-    /*
-     * 相关属性
-     * @TableField(exist = false)
-     */
-
-    /*
-     * 关联属性 + 查询条件
-     * @TableField(exist = false)
-     */
-
-
 
 
 
 
+    @ApiModelProperty(value = "来源名称")
     private String cusFromName;
     private String cusFromName;
+
+    @ApiModelProperty(value = "渠道")
     private String channelName;
     private String channelName;
+
+    @ApiModelProperty(value = "部门")
     private String orgName;
     private String orgName;
+
+    @ApiModelProperty(value = "员工")
     private String staffName;
     private String staffName;
+
+    @ApiModelProperty(value = "报备人")
     private String reportStaffName;
     private String reportStaffName;
+
+    @ApiModelProperty(value = "跟进人")
     private String followStaffName;
     private String followStaffName;
+
+    @ApiModelProperty(value = "")
     private String lastFollowStaffName;
     private String lastFollowStaffName;
 
 
+    private String saleStatusName;
+
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 
 }
 }

+ 115 - 0
src/main/java/com/dk/mdm/model/vo/mst/CusFollowStaffVO.java

@@ -0,0 +1,115 @@
+package com.dk.mdm.model.vo.mst;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.dk.common.infrastructure.annotaiton.ExportTitle;
+import com.dk.common.infrastructure.handler.TimestampTypeHandler;
+import com.dk.common.infrastructure.handler.UuidTypeHandler;
+import com.dk.common.model.pojo.PageInfo;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ *  客户跟进人
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@ExportTitle("客户跟进人")
+@TableName(value = "t_crm_cus_follow_staff", autoResultMap = true)
+@ApiModel(value="实体类:客户跟进人", description="表名:t_crm_cus_follow_staff")
+public class CusFollowStaffVO extends PageInfo<CusFollowStaffVO> implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 客户ID
+     */
+
+    @ApiModelProperty(value = "客户ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String cusId;
+
+
+    /**
+     * 跟进人
+     */
+    @Excel(name = "跟进人")
+    @ApiModelProperty(value = "跟进人")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String followStaff;
+
+
+    /**
+     * 最后跟进ID
+     */
+    @Excel(name = "最后跟进ID")
+    @ApiModelProperty(value = "最后跟进ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String lastFollowId;
+
+
+    /**
+     * 最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)
+     */
+    @Excel(name = "最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)")
+    @ApiModelProperty(value = "最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)")
+    private String lastFollowStatus;
+
+
+    /**
+     * 最后跟进时间
+     */
+    @Excel(name = "最后跟进时间")
+    @ApiModelProperty(value = "最后跟进时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime lastFollowTime;
+
+
+    /**
+     * 跟进次数
+     */
+    @Excel(name = "跟进次数")
+    @ApiModelProperty(value = "跟进次数")
+    private Integer followCount;
+
+
+    /**
+     * 企业ID
+     */
+    @TableField(fill = FieldFill.INSERT)
+    @Excel(name = "企业ID")
+    @ApiModelProperty(value = "企业ID")
+    private Integer cpId;
+
+
+    /*
+     * 相关属性
+     * @TableField(exist = false)
+     */
+
+    /*
+     * 关联属性 + 查询条件
+     * @TableField(exist = false)
+     */
+
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 342 - 0
src/main/java/com/dk/mdm/model/vo/mst/CusFollowVO.java

@@ -0,0 +1,342 @@
+package com.dk.mdm.model.vo.mst;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.dk.common.infrastructure.annotaiton.ExportTitle;
+import com.dk.common.infrastructure.handler.JsonTypeHandler;
+import com.dk.common.infrastructure.handler.TimestampTypeHandler;
+import com.dk.common.infrastructure.handler.UuidTypeHandler;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ *  客户跟进
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Accessors(chain = true)
+@ExportTitle("客户跟进")
+@TableName(value = "t_crm_cus_follow", autoResultMap = true)
+@ApiModel(value="实体类:客户跟进", description="表名:t_crm_cus_follow")
+public class CusFollowVO implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 跟进ID
+     */
+    @ApiModelProperty(value = "跟进ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String followId;
+
+
+    /**
+     * 客户ID (陌生接待时为null)
+     */
+    @Excel(name = "客户ID (陌生接待时为null)")
+    @ApiModelProperty(value = "客户ID (陌生接待时为null)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String cusId;
+
+
+    /**
+     * 跟进状态 (【系统字典】陌生接待、留资接待(报备)、跟进、邀约、约尺)
+     */
+    @Excel(name = "跟进状态 (【系统字典】陌生接待、留资接待(报备)、跟进、邀约、约尺)")
+    @ApiModelProperty(value = "跟进状态 (【系统字典】陌生接待、留资接待(报备)、跟进、邀约、约尺)")
+    private String followStatus;
+
+
+    /**
+     * 跟进方式 (【系统字典】电话、微信、上门、进店)
+     */
+    @Excel(name = "跟进方式 (【系统字典】电话、微信、上门、进店)")
+    @ApiModelProperty(value = "跟进方式 (【系统字典】电话、微信、上门、进店)")
+    private String followType;
+
+
+    /**
+     * 跟进部门
+     */
+    @Excel(name = "跟进部门")
+    @ApiModelProperty(value = "跟进部门")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String followOrg;
+
+
+    /**
+     * 跟进人
+     */
+    @Excel(name = "跟进人")
+    @ApiModelProperty(value = "跟进人")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String followStaff;
+
+
+    /**
+     * 跟进时间
+     */
+    @Excel(name = "跟进时间")
+    @ApiModelProperty(value = "跟进时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime followTime;
+
+
+    /**
+     * 跟进内容
+     */
+    @Excel(name = "跟进内容")
+    @ApiModelProperty(value = "跟进内容")
+    private String followData;
+
+
+    /**
+     * 跟进时长 (分钟)
+     */
+    @Excel(name = "跟进时长 (分钟)")
+    @ApiModelProperty(value = "跟进时长 (分钟)")
+    private Integer followTimeLen;
+
+
+    /**
+     * 留店时长 (【系统字典】10-20、20-30。。)
+     */
+    @Excel(name = "留店时长 (【系统字典】10-20、20-30。。)")
+    @ApiModelProperty(value = "留店时长 (【系统字典】10-20、20-30。。)")
+    private String stayTimeLen;
+
+
+    /**
+     * 客户意向 (【系统字典】)
+     */
+    @Excel(name = "客户意向 (【系统字典】)")
+    @ApiModelProperty(value = "客户意向 (【系统字典】)")
+    private String intention;
+
+
+    /**
+     * 邀约结果 (【系统字典】)
+     */
+    @Excel(name = "邀约结果 (【系统字典】)")
+    @ApiModelProperty(value = "邀约结果 (【系统字典】)")
+    private String inviteResult;
+
+
+    /**
+     * 邀约时间
+     */
+    @Excel(name = "邀约时间")
+    @ApiModelProperty(value = "邀约时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime inviteTime;
+
+
+    /**
+     * 设计师
+     */
+    @Excel(name = "设计师")
+    @ApiModelProperty(value = "设计师")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String designStaff;
+
+
+    /**
+     * 下次跟进计划
+     */
+    @Excel(name = "下次跟进计划")
+    @ApiModelProperty(value = "下次跟进计划")
+    private String nextFollowPlan;
+
+
+    /**
+     * 下次跟进时间 (提醒时间)
+     */
+    @Excel(name = "下次跟进时间 (提醒时间)")
+    @ApiModelProperty(value = "下次跟进时间 (提醒时间)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime nextFollowTime;
+
+
+    /**
+     * 跟进附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)
+     */
+    @Excel(name = "跟进附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
+    @ApiModelProperty(value = "跟进附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONObject annexPaths;
+
+
+    /**
+     * 量尺状态 (【系统字典】)
+     */
+    @Excel(name = "量尺状态 (【系统字典】)")
+    @ApiModelProperty(value = "量尺状态 (【系统字典】)")
+    private String measureStatus;
+
+
+    /**
+     * 备注
+     */
+    @Excel(name = "备注")
+    @ApiModelProperty(value = "备注")
+    private String remarks;
+
+
+    /**
+     * 有效标识 (1:正常 0:停用)
+     */
+    @Excel(name = "有效标识 (1:正常 0:停用)")
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private Boolean flgValid;
+
+
+    /**
+     * 企业ID
+     */
+    @TableField(fill = FieldFill.INSERT)
+    @Excel(name = "企业ID")
+    @ApiModelProperty(value = "企业ID")
+    private Integer cpId;
+
+
+    /**
+     * 创建时间 (触发器自动处理)
+     */
+    @Excel(name = "创建时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
+    @ApiModelProperty(value = "创建时间 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opCreateTime;
+
+
+    /**
+     * 创建用户 (触发器自动处理)
+     */
+    @Excel(name = "创建用户 (触发器自动处理)")
+    @ApiModelProperty(value = "创建用户 (触发器自动处理)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String opCreateUserId;
+
+
+    /**
+     * 修改时间 (触发器自动处理)
+     */
+    @Excel(name = "修改时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
+    @ApiModelProperty(value = "修改时间 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opUpdateTime;
+
+
+    /**
+     * 修改用户 (触发器自动处理)
+     */
+    @Excel(name = "修改用户 (触发器自动处理)")
+    @ApiModelProperty(value = "修改用户 (触发器自动处理)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String opUpdateUserId;
+
+
+    /**
+     * 数据操作应用 (触发器自动处理)
+     */
+    @Excel(name = "数据操作应用 (触发器自动处理)")
+    @ApiModelProperty(value = "数据操作应用 (触发器自动处理)")
+    private String opAppCode;
+
+
+    /**
+     * 数据时间戳 (触发器自动处理)
+     */
+    @Excel(name = "数据时间戳 (触发器自动处理)")
+    @ApiModelProperty(value = "数据时间戳 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opTimestamp;
+
+
+    /**
+     * 数据操作数据库用户 (触发器自动处理)
+     */
+    @Excel(name = "数据操作数据库用户 (触发器自动处理)")
+    @ApiModelProperty(value = "数据操作数据库用户 (触发器自动处理)")
+    private String opDbUser;
+
+
+    /**
+     * 客户名称
+     */
+    @Excel(name = "客户名称")
+    @ApiModelProperty(value = "客户名称")
+    private String cusName;
+
+
+    /**
+     * 客户电话
+     */
+    @Excel(name = "客户电话")
+    @ApiModelProperty(value = "客户电话")
+    private String cusPhone;
+
+
+    /**
+     * 行政区划 (a1:省 a2:市 a3:区)
+     */
+    @Excel(name = "行政区划 (a1:省 a2:市 a3:区)")
+    @ApiModelProperty(value = "行政区划 (a1:省 a2:市 a3:区)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONObject addressArea;
+
+
+    /**
+     * 小区或POI
+     */
+    @Excel(name = "小区或POI")
+    @ApiModelProperty(value = "小区或POI")
+    private String addressName;
+
+
+    /**
+     * 门牌号
+     */
+    @Excel(name = "门牌号")
+    @ApiModelProperty(value = "门牌号")
+    private String addressNo;
+
+
+    /**
+     * 地址坐标(gcj02) (LAT:纬度的值 LON:经度的值)
+     */
+    @Excel(name = "地址坐标(gcj02) (LAT:纬度的值 LON:经度的值)")
+    @ApiModelProperty(value = "地址坐标(gcj02) (LAT:纬度的值 LON:经度的值)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONObject addressGcj02;
+
+
+    /**
+     * 详细地址
+     */
+    @Excel(name = "详细地址")
+    @ApiModelProperty(value = "详细地址")
+    private String addressFull;
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 30 - 0
src/main/java/com/dk/mdm/service/common/CommonService.java

@@ -705,6 +705,36 @@ public class CommonService extends BaseService<Map<String, Object>> {
         if (dataSourceCode.equals("staff")) {
         if (dataSourceCode.equals("staff")) {
             list = commonMapper.getStaff(map);
             list = commonMapper.getStaff(map);
         }
         }
+        //仓库
+        if (dataSourceCode.equals("warehouse")) {
+            list = commonMapper.getWarehouse(map);
+        }
+
+        //客户意向
+        if (dataSourceCode.equals("customerIntention")) {
+            map.put("kindType","客户意向");
+            list = commonMapper.getDataKind(map);
+        }
+        //留店时长
+        if (dataSourceCode.equals("storeRetentionTime")) {
+            map.put("kindType","留店时长");
+            list = commonMapper.getDataKind(map);
+        }
+        //邀约结果
+        if (dataSourceCode.equals("invitationResults")) {
+            map.put("kindType","邀约结果");
+            list = commonMapper.getDataKind(map);
+        }
+        //量尺状态
+        if (dataSourceCode.equals("scaleStatus")) {
+            map.put("kindType","量尺状态");
+            list = commonMapper.getDataKind(map);
+        }
+        //跟进方式
+        if (dataSourceCode.equals("followType")) {
+            map.put("kindType","跟进方式");
+            list = commonMapper.getDataKind(map);
+        }
         return ResponseResultUtil.success(list);
         return ResponseResultUtil.success(list);
     }
     }
 }
 }

+ 8 - 48
src/main/java/com/dk/mdm/service/ivt/IntoReturnService.java

@@ -287,62 +287,22 @@ public class IntoReturnService extends BaseService<IntoReturn> {
     //TODO 未完成
     //TODO 未完成
 
 
     /**
     /**
-     * @desc : 冲正
+     * @desc : 作废
      * @date : 2022/6/28 16:58
      * @date : 2022/6/28 16:58
      * @author : 于继渤
      * @author : 于继渤
      */
      */
     @Transactional(rollbackFor = {Exception.class})
     @Transactional(rollbackFor = {Exception.class})
-    public ResponseResultVO<String> righting(String purId, List<String> intoReturnIdList) {
+    public ResponseResultVO<String> cancel(IntoReturnVO intoReturnVO) {
         //根据订单id查询到订单
         //根据订单id查询到订单
-        Purchase purchase = purchaseMapper.selectPurchaseByRighting(new PurchaseQuery().setPurId(purId));
-
-
-        //查询采购退货数据List
-        List<IntoReturn> intoReturnList = intoReturnMapper.selectReturnList(intoReturnIdList);
-
-        //根据订单id查询所有退货单
-        List<IntoReturnResponse> intoReturnResponsesList = intoReturnMapper.selectByCond(new IntoReturnQuery().setIntoReturnIdList(intoReturnIdList));
-
-
-        //本次冲正退货总额
-        BigDecimal sumReturnAmount = intoReturnResponsesList.stream().map(IntoReturnResponse::getSumAmount)
-                .reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
-
-//        for (IntoReturn intoReturn : intoReturnList) {
+//        Purchase purchase = purchaseMapper.selectPurchaseByRighting(new PurchaseQuery().setPurId(purId));
+//
 //
 //
+//        //查询采购退货数据List
+//        List<IntoReturn> intoReturnList = intoReturnMapper.selectReturnList(intoReturnIdList);
 //
 //
-//        }
-        //订单退货金额、退货数量
-        purchase.setReturnAmt(purchase.getReturnAmt().subtract(intoReturnList.stream()
-                .map(IntoReturn::getSumAmount).reduce(BigDecimal.ZERO, BigDecimal::add)).setScale(2, BigDecimal.ROUND_HALF_UP));
-        purchase.setReturnQty(purchase.getReturnQty().subtract(intoReturnList.stream()
-                .map(IntoReturn::getSumQuantity).reduce(BigDecimal.ZERO, BigDecimal::add)).setScale(6, BigDecimal.ROUND_HALF_UP));
+//        //根据订单id查询所有退货单
+//        List<IntoReturnResponse> intoReturnResponsesList = intoReturnMapper.selectByCond(new IntoReturnQuery().setIntoReturnIdList(intoReturnIdList));
         return null;
         return null;
     }
     }
 
 
-
-    //TODO 未完成
-    @Transactional(rollbackFor = {Exception.class})
-    public void rightingByIbossReturnSuccess(IntoReturn intoReturn) {
-        //修改原单总单的状态
-        intoReturnMapper.updateById(new IntoReturn().setReturnId(intoReturn.getReturnId()).
-                setReturnStatus("退货状态-冲正"));
-
-
-        //region 根据id查询原始单据信息、生成逆向生成销售退货总单数据
-        //根据id查询原始单据信息
-        IntoReturn intoReturnRig = intoReturnMapper.selectReturnByRighting(intoReturn.getReturnId());
-        Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.OUTBOUND.getName(), false);
-        intoReturnRig.setReturnId(codeMap.get("outId").toString()).setReturnNo(codeMap.get("outNote").toString())
-                .setReturnType(Constant.returnType.PURRETURN.getName());
-
-        intoReturnRig.setReturnType("退货类型-冲正");
-        intoReturnRig.setReturnStatus("退货状态-冲正");
-        //退货单状态 冲正
-        intoReturnRig.setMakeTime(LocalDateTime.now());
-        //endregion
-
-
-    }
-
 }
 }

+ 300 - 0
src/main/java/com/dk/mdm/service/mst/CusFollowService.java

@@ -0,0 +1,300 @@
+package com.dk.mdm.service.mst;
+
+import com.dk.common.exception.BaseBusinessException;
+import com.dk.common.infrastructure.annotaiton.Pagination;
+import com.dk.common.infrastructure.constant.Constant;
+import com.dk.common.infrastructure.enums.ErrorCodeEnum;
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseResultUtil;
+import com.dk.common.response.ResponseResultVO;
+import com.dk.mdm.infrastructure.convert.mst.CusFollowConvert;
+import com.dk.mdm.infrastructure.util.AuthUtils;
+import com.dk.mdm.mapper.mst.CusFollowStaffMapper;
+import com.dk.mdm.mapper.mst.CustomerMapper;
+import com.dk.mdm.mapper.mst.StaffMapper;
+import com.dk.mdm.model.pojo.mst.CusFollow;
+import com.dk.mdm.mapper.mst.CusFollowMapper;
+import com.dk.common.service.BaseService;
+import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.pojo.mst.CusFollowStaff;
+import com.dk.mdm.model.pojo.mst.Customer;
+import com.dk.mdm.model.query.mst.CusFollowQuery;
+import com.dk.mdm.model.query.mst.CustomerQuery;
+import com.dk.mdm.model.response.mst.CusFollowResponse;
+import com.dk.mdm.model.response.mst.CustomerResponse;
+import com.dk.mdm.model.response.mst.StaffResponse;
+import com.dk.mdm.model.vo.mst.CusFollowVO;
+import com.dk.mdm.service.common.CommonService;
+import org.springframework.stereotype.Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.LocalDateTime;
+import java.time.ZoneOffset;
+import java.util.*;
+
+@Service
+@Transactional
+public class CusFollowService extends BaseService<CusFollow> {
+
+    @Override
+    public BaseMapper<CusFollow> getRepository() {
+        return cusFollowMapper;
+    }
+
+    @Autowired
+    private CusFollowMapper cusFollowMapper;
+
+    @Autowired
+    private CustomerMapper customerMapper;
+
+    @Autowired
+    private CustomerService customerService;
+
+    @Autowired
+    private CusFollowStaffMapper cusFollowStaffMapper;
+
+    @Autowired
+    private CommonService commonService;
+
+    @Autowired
+    private CusFollowConvert cusFollowConvert;
+
+    @Autowired
+    private StaffMapper staffMapper;
+
+
+    @Autowired
+    private AuthUtils authUtils;
+
+    /**
+     * @desc : 重写主键
+     * @author : 于继渤
+     * @date : 2024/2/29 20:29
+     */
+    @Override
+    public String getPrimaryKey() {
+        return "follow_id";
+    }
+
+
+    /**
+     * @desc : 查询
+     * @author : 于继渤
+     * @date : 2023/1/5 9:39
+     */
+    @Pagination
+    public ResponseResultVO<PageList<CusFollowResponse>> selectByCond(CusFollowQuery cusFollowQuery) {
+        return super.mergeListWithCount(cusFollowQuery, cusFollowMapper.selectByCond(cusFollowQuery),
+                cusFollowMapper.countByCond(cusFollowQuery));
+    }
+
+    /**
+     * @desc : 新建
+     * @author : 于继渤
+     * @date : 2023/1/5 9:39
+     */
+    @Transactional(
+            rollbackFor = {Exception.class}
+    )
+    public ResponseResultVO<?> insert(CusFollowVO cusFollowVO) {
+
+        if (cusFollowVO.getCusId() != null) {
+            //查询客户
+            Customer customer = customerMapper.selectById(cusFollowVO.getCusId());
+
+            // 查询跟进人是否存在
+            CusFollowStaff followStaff = cusFollowStaffMapper.selectByCusFollowStaffId(cusFollowVO.getCusId(), cusFollowVO.getFollowStaff());
+            //追加跟进人表
+            if (followStaff == null) {
+                cusFollowStaffMapper.insert(new CusFollowStaff()
+                        .setCusId(cusFollowVO.getCusId())
+                        .setFollowStaff(cusFollowVO.getFollowStaff())
+                        .setLastFollowId(authUtils.getStaff().getStaffId())
+                        .setLastFollowTime(LocalDateTime.now())
+                        .setCpId(authUtils.getStaff().getCpId())
+                        .setLastFollowStatus(cusFollowVO.getFollowStatus())
+                        .setFollowCount(1)
+                );
+            }
+            //追加跟进人
+            List<Long> users = new ArrayList<>();
+            Object o = customerMapper.selectFollowStaffs(cusFollowVO.getCusId());
+            if (o != null && o instanceof Long[]) {
+                users = Arrays.asList((Long[]) o);
+            }
+
+            if (users == null || users.size() == 0 || (users != null && users.stream().allMatch(Objects::isNull))) {
+                users = new ArrayList<>();
+            }
+            //公海客户跟进后 变成潜客状态
+            if (Constant.saleCustomerStatusConstant.SALE_STATUS_INTE.getName().equals(customer.getSaleStatus())) {
+                customer.setSaleStatus(Constant.saleCustomerStatusConstant.SALE_STATUS_POTE.getName());
+            }
+            //已流失客户重新接待后应该变成潜客
+            if (Constant.saleCustomerStatusConstant.SALE_STATUS_LOST.getName().equals(customer.getSaleStatus())) {
+                customer.setSaleStatus(Constant.saleCustomerStatusConstant.SALE_STATUS_POTE.getName());
+            }
+
+            //放入公海客户,清除跟进人
+            if (Constant.IntentionConstant.SEA.getValue().equals(cusFollowVO.getIntention())) {
+                customer.setFollowStaffs(new ArrayList<>());
+                customer.setSaleStatus(Constant.saleCustomerStatusConstant.SALE_STATUS_INTE.getName());
+            } else {
+                if (!users.contains(authUtils.getStaff().getStaffId())) {
+                    List arrList = new ArrayList(users);
+                    arrList.add(authUtils.getStaff().getStaffId());
+                    customer.setFollowStaffs(arrList);
+                }
+            }
+            //已流失客户,修改状态为流失
+            if (Constant.IntentionConstant.LOST.getValue().equals(cusFollowVO.getIntention())) {
+                customer.setSaleStatus(Constant.saleCustomerStatusConstant.SALE_STATUS_LOST.getName());
+            }
+
+            //如果不是留资接待 修改客户信息
+            if (!Constant.BasicDataConstant.FOLLOW_STATUS_4.getValue().equals(cusFollowVO.getFollowStatus())) {
+                customer.setCusName(cusFollowVO.getCusName());
+                customer.setCusPhone(cusFollowVO.getCusPhone());
+                customer.setAddressName(cusFollowVO.getAddressName());
+                customer.setAddressNo(cusFollowVO.getAddressNo());
+                customer.setAddressGcj02(cusFollowVO.getAddressGcj02());
+                customer.setAddressFull(cusFollowVO.getAddressFull());
+                customer.setAddressArea(cusFollowVO.getAddressArea());
+            }
+            customer.setCpId(authUtils.getStaff().getCpId());
+            // 同商户 电话不同
+            List<CustomerResponse> cusList = customerMapper.selectByCond(
+                    new CustomerQuery().setCpId(customer.getCpId()).setCusPhone(customer.getCusPhone()).setFlgValid(true)
+            );
+            if (cusList != null && cusList.size() > 0 && cusList.stream().anyMatch(a -> !a.getCusId().equals(customer.getCusId()))) {
+                throw new BaseBusinessException(ErrorCodeEnum.CUSTOMER_SAME_COMPANY_TELEPHONE.getCode(),
+                        ErrorCodeEnum.CUSTOMER_SAME_COMPANY_TELEPHONE.getMessage());
+            }
+            customerService.updateByUuid(customer);
+        } else if (cusFollowVO.getCusPhone() != null && cusFollowVO.getCusName() != null) {
+            //留资接待 新建客户
+            Customer customer = new Customer();
+            customer.setCusName(cusFollowVO.getCusName());
+            customer.setCusPhone(cusFollowVO.getCusPhone());
+            customer.setAddressName(cusFollowVO.getAddressName());
+            customer.setAddressNo(cusFollowVO.getAddressNo());
+            customer.setAddressGcj02(cusFollowVO.getAddressGcj02());
+            customer.setAddressFull(cusFollowVO.getAddressFull());
+            customer.setAddressArea(cusFollowVO.getAddressArea());
+            customer.setReportStaff(authUtils.getStaff().getStaffId());
+            customer.setReportTime(LocalDateTime.now());
+            customer.setCpId(authUtils.getStaff().getCpId());
+            customer.setOrgId(authUtils.getStaff().getOrgId());
+//            customer.setCustomerFrom(-1L);
+
+            // 同商户 电话不同
+            Long count = customerMapper.countByCond(
+                    new CustomerQuery().setCpId(customer.getCpId()).setCusPhone(customer.getCusPhone()).setFlgValid(true)
+            );
+            if (count > 0) {
+                return ResponseResultUtil.error(ErrorCodeEnum.CUSTOMER_SAME_COMPANY_TELEPHONE.getCode(),
+                        ErrorCodeEnum.CUSTOMER_SAME_COMPANY_TELEPHONE.getMessage());
+            }
+
+            //放入公海客户,清除跟进人
+            if (Constant.IntentionConstant.SEA.getValue().equals(cusFollowVO.getIntention())) {
+                customer.setFollowStaffs(new ArrayList<>());
+                customer.setSaleStatus(Constant.saleCustomerStatusConstant.SALE_STATUS_INTE.getName());
+            } else {
+                //当前跟进人(业务员)
+                customer.setFollowStaffs(new ArrayList<String>() {{
+                    add(authUtils.getStaff().getStaffId());
+                }});
+                customer.setSaleStatus(Constant.saleCustomerStatusConstant.SALE_STATUS_POTE.getName());
+            }
+
+            customer.setFollowCount(0);
+            //新建客户或编辑客户
+            customerMapper.insert(customer);
+
+            cusFollowVO.setCusId(customer.getCusId());
+        }
+
+
+        CusFollow cusFollow = cusFollowConvert.convertToPo(cusFollowVO);
+        //设置ID
+        Map<String, Object> uniqueNoteCode = commonService.getUniqueNoteCode(Constant.docNameConstant.CUSTOMERFOLLOW.getName(), true);
+        cusFollow.setFollowId(uniqueNoteCode.get("outId").toString());
+        //跟进时间
+        cusFollow.setFollowTime(LocalDateTime.now());
+        //跟进人
+        cusFollow.setFollowStaff(authUtils.getStaff().getStaffId());
+        //跟进部门
+        cusFollow.setFollowOrg(authUtils.getStaff().getOrgId());
+
+        // 约量尺
+        if (Constant.BasicDataConstant.FOLLOW_STATUS_3.getValue().equals(cusFollow.getFollowStatus())) {
+            // 量尺状态:待量尺
+            cusFollow.setMeasureStatus(Constant.BasicDataConstant.MEASURE_STATUS_2.getValue());
+        }
+        if (cusFollow.getFollowData() == null) {
+            cusFollow.setFollowData("无");
+        }
+        super.insert(cusFollow);
+
+
+        //设计师
+        StaffResponse designStaff = null;
+        if (cusFollow.getDesignStaff() != null) {
+
+            designStaff = staffMapper.selectById(cusFollow.getDesignStaff());
+
+        }
+
+        // 约尺 同意邀约 有设计师 设计师绑定企微
+        boolean pushFlag = Constant.BasicDataConstant.FOLLOW_STATUS_3.getValue().equals(cusFollow.getFollowStatus()) &&
+                Constant.BasicDataConstant.FOLLOW_INVITE_RESULT.getValue().equals(cusFollow.getInviteResult()) &&
+                designStaff != null;
+
+        if (cusFollow.getNextFollowTime() != null || pushFlag) {
+            // 保存跟进信息
+            //  saveToXxlJob(cusFollow);
+        }
+
+        return ResponseResultUtil.success();
+    }
+
+
+    /**
+     * @desc : 保存跟进信息到xxl job
+     * @author : 于继渤海
+     * @date : 2022-05-27 09:53
+     */
+//    @Transactional(rollbackFor = {Exception.class})
+//    public void saveToXxlJob(CusFollow cusFollow) {
+//
+//        Long nextId = followPlanMapper.getNextId();
+//
+//
+//        // 约量尺 && 接受邀约
+////        预约量尺,邀约结果接受,通知设计师提醒时间是(服务时间);邀约结果拒绝,通知创建者提醒时间是(提醒时间)
+//        if (Constant.BasicDataConstant.FOLLOW_STATUS_3.getValue().equals(follow.getFollowStatus()) &&
+//                Constant.BasicDataConstant.FOLLOW_INVITE_RESULT.getValue().equals(follow.getInviteResult())) {
+//            follow.setNextFollowTime(follow.getInviteTime()).setFollowUser(follow.getDesignUser());
+//        }
+//
+//        int id = xxlJobUtils.create(Math.toIntExact(
+//                (follow.getNextFollowTime().toInstant(ZoneOffset.of("+8")).toEpochMilli() - System.currentTimeMillis()) / 1000
+//        ), nextId, Constant.XxlJobInfo.FOLLOW.getValue());
+//
+//
+//        // 生成主键
+//        followPlanMapper.insert(
+//                new FollowPlan().setPlanId(nextId).setCustomerId(follow.getCustomerId())
+//                        .setPlanType(Constant.IntegerConstant.PLAN_TYPE_FOLLOW.getValue())
+//                        .setFollowId(follow.getFollowId())
+//                        .setFollowUser(follow.getFollowUser())
+//                        .setNextFollowPlan(follow.getNextFollowPlan())
+//                        .setNextFollowTime(follow.getNextFollowTime())
+//                        .setXxlJobId(id)
+//                        .setCpId(follow.getCpId())
+//        );
+//    }
+
+}

+ 23 - 0
src/main/java/com/dk/mdm/service/mst/CusFollowStaffService.java

@@ -0,0 +1,23 @@
+package com.dk.mdm.service.mst;
+
+import com.dk.mdm.model.pojo.mst.CusFollowStaff;
+import com.dk.mdm.mapper.mst.CusFollowStaffMapper;
+import com.dk.common.service.BaseService;
+import com.dk.common.mapper.BaseMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@Transactional
+public class CusFollowStaffService extends BaseService<CusFollowStaff> {
+
+	@Override
+	public BaseMapper<CusFollowStaff> getRepository() {
+		return cusFollowStaffMapper;
+	}
+
+	@Autowired
+	private CusFollowStaffMapper cusFollowStaffMapper;
+
+}

+ 33 - 6
src/main/java/com/dk/mdm/service/mst/CustomerService.java

@@ -2,8 +2,10 @@ package com.dk.mdm.service.mst;
 
 
 import com.dk.common.infrastructure.annotaiton.Pagination;
 import com.dk.common.infrastructure.annotaiton.Pagination;
 import com.dk.common.infrastructure.constant.Constant;
 import com.dk.common.infrastructure.constant.Constant;
+import com.dk.common.infrastructure.enums.ErrorCodeEnum;
 import com.dk.common.infrastructure.util.LocalDateTimeUtils;
 import com.dk.common.infrastructure.util.LocalDateTimeUtils;
 import com.dk.common.model.pojo.PageList;
 import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseCodeEnum;
 import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultVO;
 import com.dk.common.response.ResponseResultVO;
 import com.dk.mdm.infrastructure.convert.mst.CustomerConvert;
 import com.dk.mdm.infrastructure.convert.mst.CustomerConvert;
@@ -12,6 +14,7 @@ import com.dk.mdm.model.pojo.mst.Customer;
 import com.dk.mdm.mapper.mst.CustomerMapper;
 import com.dk.mdm.mapper.mst.CustomerMapper;
 import com.dk.common.service.BaseService;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.pojo.mst.Org;
 import com.dk.mdm.model.query.mst.CustomerQuery;
 import com.dk.mdm.model.query.mst.CustomerQuery;
 import com.dk.mdm.model.response.mst.CustomerResponse;
 import com.dk.mdm.model.response.mst.CustomerResponse;
 import com.dk.mdm.model.vo.mst.CustomerVO;
 import com.dk.mdm.model.vo.mst.CustomerVO;
@@ -21,7 +24,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.Date;
+import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
 @Service
 @Service
@@ -43,6 +48,9 @@ public class CustomerService extends BaseService<Customer> {
     @Autowired
     @Autowired
     private CommonService commonService;
     private CommonService commonService;
 
 
+    @Autowired
+    private OrgService orgService;
+
 
 
     @Autowired
     @Autowired
     private AuthUtils authUtils;
     private AuthUtils authUtils;
@@ -83,16 +91,35 @@ public class CustomerService extends BaseService<Customer> {
         Map<String, Object> uniqueNoteCode = commonService.getUniqueNoteCode(Constant.docNameConstant.CUSTOMER.getName(), true);
         Map<String, Object> uniqueNoteCode = commonService.getUniqueNoteCode(Constant.docNameConstant.CUSTOMER.getName(), true);
         customer.setCusId(uniqueNoteCode.get("outId").toString());
         customer.setCusId(uniqueNoteCode.get("outId").toString());
         customer.setCusCode(uniqueNoteCode.get("outNote").toString());
         customer.setCusCode(uniqueNoteCode.get("outNote").toString());
+
+        // 同商户 电话不同
+        Long count = customerMapper.countByCond(
+                new CustomerQuery().setCpId(customer.getCpId()).setCusPhone(customer.getCusPhone()).setFlgValid(true)
+        );
+        if (count > 0) {
+            return ResponseResultUtil.error(ErrorCodeEnum.CUSTOMER_SAME_COMPANY_TELEPHONE.getCode(),
+                    ErrorCodeEnum.CUSTOMER_SAME_COMPANY_TELEPHONE.getMessage());
+        }
+        List<String> followStaff = new ArrayList<>();
+        followStaff.add(authUtils.getStaff().getStaffId());
+        customer.setFollowStaffs(followStaff);
+        if (customer.getSaleStatus() == null) {
+            //新建默认就是潜客
+            customer.setSaleStatus(Constant.saleCustomerStatusConstant.SALE_STATUS_POTE.getName());
+        }
+
+
         //设置公司id
         //设置公司id
         customer.setCpId(authUtils.getStaff().getCpId());
         customer.setCpId(authUtils.getStaff().getCpId());
-        //设置报备人
-        customer.setReportStaff(authUtils.getStaff().getStaffId());
         //报备日期
         //报备日期
         customer.setReportTime(LocalDateTime.now());
         customer.setReportTime(LocalDateTime.now());
-        //销售状态 (【系统字典】客销状态:公海、潜客、成
-        customer.setSaleStatus(Constant.SaleStatus.QIANKE.getName());
-        customerMapper.insert(customer);
-        return ResponseResultUtil.success();
+        ResponseResultVO<?> insert = super.insert(customer);
+        if (insert.getCode() == ResponseCodeEnum.SUCCESS.getCode()) {
+            return ResponseResultUtil.success(customer);
+        } else {
+            return insert;
+        }
+
     }
     }
 
 
     /**
     /**