Răsfoiți Sursa

客户跟进计划

于继渤 1 an în urmă
părinte
comite
6d66caebde

+ 6 - 4
src/main/java/com/dk/mdm/controller/mst/FollowPlanController.java

@@ -4,9 +4,7 @@ import com.dk.common.model.pojo.PageList;
 import com.dk.common.response.ResponseResultVO;
 import com.dk.mdm.model.pojo.mst.FollowPlan;
 import com.dk.common.service.BaseService;
-import com.dk.mdm.model.query.mst.CusFollowQuery;
 import com.dk.mdm.model.query.mst.FollowPlanQuery;
-import com.dk.mdm.model.response.mst.CusFollowResponse;
 import com.dk.mdm.model.response.mst.FollowPlanResponse;
 import com.dk.mdm.model.vo.mst.FollowPlanVO;
 import io.swagger.annotations.ApiOperation;
@@ -23,7 +21,7 @@ import javax.validation.Valid;
 
 @Api(tags = "客户跟进计划API接口")
 @RestController
-@RequestMapping("/followPlan")
+@RequestMapping("/mst/followPlan")
 public class FollowPlanController{
 
     public BaseService<FollowPlan> getService() {
@@ -45,7 +43,11 @@ public class FollowPlanController{
         return followPlanService.selectByCond(followPlanQuery);
     }
 
-
+    /**
+     * @desc : 新建
+     * @author : 于继渤
+     * @date : 2024/7/9 8:45
+     */
     @ApiOperation(
             value = "新建",
             notes = "新建"

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

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

+ 4 - 3
src/main/java/com/dk/mdm/mapper/mst/CustomerMapper.xml

@@ -103,6 +103,7 @@
         <result column="orderAmount" property="orderAmount"/>
 
         <result column="outboundQuantity" property="outboundQuantity"/>
+        <result column="followStaffsName" property="followStaffsName" />
         <result column="outboundAmount" property="outboundAmount"/>
         <result column="outboundNotAmount" property="outboundNotAmount"/>
         <result column="outboundNotQuantity" property="outboundNotQuantity"/>
@@ -312,18 +313,18 @@
         tma.receivable,
         tma.receivable_residue,
         tma.receipt_residue,
-        tmor.sum_amt_receivable AS "startAmount"
+        tmor.sum_amt_receivable AS "startAmount",
+        concat(tms3.staff_name)  AS "followStaffsName"
         FROM dkic_b.t_mst_customer tmc
         LEFT JOIN dkic_b.t_mst_dictionary_data tmd on tmd.data_id = tmc.cus_from
         LEFT JOIN dkic_b.t_mst_sale_channel tmsc on tmsc.channel_id = tmc.channel_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 tms2 on tms2.staff_id = tmc.report_staff
+        LEFT JOIN dkic_b.t_mst_staff tms3 on tms3.staff_id = Any(tmc.follow_staffs)
         LEFT JOIN sys.t_data_kind tdk on tdk.kind_code = tmc.sale_status
         LEFT JOIN  dkic_b.t_mac_account tma  on tma.object_id =  tmc.cus_id
         LEFT JOIN dkic_b.t_mac_other_receivable tmor on tmor.object_id = tmc.cus_id and tmor.business_type = 0
-        -- LEFT JOIN dkic_b.t_crm_cus_follow_staff tccfs on tccfs.follow_staff = any(tmc.follow_staffs)
-        -- LEFT JOIN dkic_b.t_mst_staff tms1 on tms1.staff_id = tccfs.follow_staff
         WHERE tmc.cus_id = #{id}::uuid
     </select>
 

+ 6 - 4
src/main/java/com/dk/mdm/model/response/mst/CustomerResponse.java

@@ -1,16 +1,14 @@
 package com.dk.mdm.model.response.mst;
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 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.UuidListTypeHandler;
-import com.dk.common.infrastructure.handler.UuidTypeHandler;
+import com.dk.common.infrastructure.handler.*;
 import com.dk.common.model.pojo.PageInfo;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
@@ -20,6 +18,7 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NoArgsConstructor;
 import lombok.experimental.Accessors;
+import org.apache.ibatis.type.StringTypeHandler;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
@@ -346,6 +345,9 @@ public class CustomerResponse extends PageInfo<CustomerResponse> implements Seri
     private BigDecimal startAmount;
 
 
+    private String followStaffsName;
+
+
 
 
     private static final long serialVersionUID = 1L;

+ 3 - 8
src/main/java/com/dk/mdm/model/vo/mst/FollowPlanVO.java

@@ -195,16 +195,11 @@ public class FollowPlanVO extends PageInfo<FollowPlanVO> implements Serializable
     private String opDbUser;
 
 
-    /*
-     * 相关属性
-     * @TableField(exist = false)
-     */
 
-    /*
-     * 关联属性 + 查询条件
-     * @TableField(exist = false)
+    /**
+     * 成交状态
      */
-
+    private String saleStatus;
 
     private static final long serialVersionUID = 1L;
 

+ 42 - 4
src/main/java/com/dk/mdm/service/mst/FollowPlanService.java

@@ -1,24 +1,30 @@
 package com.dk.mdm.service.mst;
 
 import com.dk.common.infrastructure.annotaiton.Pagination;
+import com.dk.common.infrastructure.constant.Constant;
 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.FollowPlanConvert;
+import com.dk.mdm.infrastructure.util.AuthUtils;
+import com.dk.mdm.mapper.mst.CustomerMapper;
+import com.dk.mdm.model.pojo.mst.Customer;
 import com.dk.mdm.model.pojo.mst.FollowPlan;
 import com.dk.mdm.mapper.mst.FollowPlanMapper;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
-import com.dk.mdm.model.query.mst.DictionaryDataQuery;
 import com.dk.mdm.model.query.mst.FollowPlanQuery;
-import com.dk.mdm.model.response.mst.DictionaryDataResponse;
 import com.dk.mdm.model.response.mst.FollowPlanResponse;
-import com.dk.mdm.model.vo.mst.DictionaryDataVO;
 import com.dk.mdm.model.vo.mst.FollowPlanVO;
+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.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
 @Service
 @Transactional
 public class FollowPlanService extends BaseService<FollowPlan> {
@@ -35,6 +41,17 @@ public class FollowPlanService extends BaseService<FollowPlan> {
     @Autowired
     private FollowPlanConvert followPlanConvert;
 
+    @Autowired
+    private CommonService commonService;
+
+    @Autowired
+    private CustomerService customerService;
+
+    @Autowired
+    private AuthUtils authUtils;
+
+    @Autowired
+    private CustomerMapper customerMapper;
 
     /**
      * @desc : 条件查询
@@ -51,13 +68,34 @@ public class FollowPlanService extends BaseService<FollowPlan> {
     /**
      * @desc : 新建
      * @author : 于继渤
-     * @date : 2023/1/5 9:39
+     * @date : 2024/7/9 8:45
      */
     @Transactional(
             rollbackFor = {Exception.class}
     )
     public ResponseResultVO<?> insert(FollowPlanVO followPlanVO) {
         FollowPlan followPlan = followPlanConvert.convertToPo(followPlanVO);
+        //设置ID
+        Map<String, Object> uniqueNoteCode = commonService.getUniqueNoteCode(Constant.docNameConstant.FOLLOWPLAN.getName(), true);
+        followPlan.setPlanId(uniqueNoteCode.get("outId").toString());
+        //查询客户信息
+        Customer customer = customerMapper.selectById(new Customer().setCusId(followPlanVO.getCusId()));
+
+        Customer customerSave = new Customer();
+        if (Constant.saleCustomerStatusConstant.SALE_STATUS_INTE.getName().equals(followPlanVO.getSaleStatus())) {
+            customerSave.setSaleStatus(Constant.saleCustomerStatusConstant.SALE_STATUS_POTE.getName());
+            //当前客户部门是否为空
+            if (customer.getOrgId() == null) {
+                customerSave.setOrgId(authUtils.getStaff().getOrgId());
+            }
+            List<Long> wxUsers = new ArrayList<>();
+            List arrList = new ArrayList(wxUsers);
+            arrList.add(authUtils.getStaff().getStaffId());
+            customerSave.setFollowStaffs(arrList);
+            //更新客户信息
+            customerService.updateByUuid(customerSave);
+        }
+
         followPlanMapper.insert(followPlan);
         return ResponseResultUtil.success(followPlan);
     }