Kaynağa Gözat

客户跟进修改

于继渤 2 yıl önce
ebeveyn
işleme
80600cd4af

+ 12 - 4
src/main/java/com/dk/mdm/controller/mst/CusFollowController.java

@@ -12,11 +12,8 @@ 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.web.bind.annotation.*;
 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;
 
@@ -89,4 +86,15 @@ public class CusFollowController{
         return cusFollowService.update(cusFollowVO);
     }
 
+    /**
+     * @desc   : 跟进id查询
+     * @author : 于继渤
+     * @date : 2024/2/26 10:36
+     */
+    @ApiOperation(value = "跟进id查询", notes = "跟进id查询")
+    @PostMapping({"{id}"})
+    public ResponseResultVO<?> selectById(@PathVariable String id) {
+        return cusFollowService.selectById(new CusFollowQuery().setFollowId(id));
+    }
+
 }

+ 4 - 1
src/main/java/com/dk/mdm/mapper/mst/CusFollowMapper.xml

@@ -68,6 +68,7 @@
         <result column="channel_id" property="channelId"/>
         <result column="cusName" property="cusName"/>
         <result column="cusCode" property="cusCode"/>
+        <result column="cusPhone" property="cusPhone"/>
         <result column="orgName" property="orgName"/>
         <result column="staffName" property="staffName"/>
         <result column="follow_count" property="followCount"/>
@@ -182,6 +183,9 @@
             <if test="followStatus != null and followStatus != ''">
                 AND tccf.follow_status = #{followStatus}
             </if>
+            <if test="followId != null and followId != ''">
+                AND tccf.follow_id = #{followId}::uuid
+            </if>
 
             <if test="followOrg != null and followOrg != ''">
                 AND tccf.follow_org = #{followOrg}
@@ -402,5 +406,4 @@
         </foreach>
     </insert>
 
-
 </mapper>

+ 5 - 1
src/main/java/com/dk/mdm/mapper/mst/MeasureReceiptMapper.java

@@ -2,13 +2,17 @@ package com.dk.mdm.mapper.mst;
 
 import com.dk.mdm.model.pojo.mst.MeasureReceipt;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.query.mst.CusFollowQuery;
+import com.dk.mdm.model.response.mst.CusFollowResponse;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 /**
 *  量尺回执 Mapper
 */
 @Repository
 public interface MeasureReceiptMapper extends BaseMapper<MeasureReceipt>{
-	
+    MeasureReceipt selectByFollowId(MeasureReceipt measureReceipt);
 }
 

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

@@ -118,6 +118,15 @@
         WHERE receipt_id = #{receiptId}::uuid
     </select>
 
+    <select id="selectByFollowId" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM t_crm_measure_receipt
+        WHERE follow_id = #{followId}::uuid
+    </select>
+
+
+
     <!-- 根据主键锁定表t_crm_measure_receipt的一行数据 -->
     <select id="selectByIdForUpdate" resultMap="BaseResultMap">
         SELECT

+ 4 - 1
src/main/java/com/dk/mdm/mapper/mst/MeasureRoomMapper.java

@@ -1,14 +1,17 @@
 package com.dk.mdm.mapper.mst;
 
+import com.dk.mdm.model.pojo.mst.MeasureReceipt;
 import com.dk.mdm.model.pojo.mst.MeasureRoom;
 import com.dk.common.mapper.BaseMapper;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 /**
 *  量尺空间 Mapper
 */
 @Repository
 public interface MeasureRoomMapper extends BaseMapper<MeasureRoom>{
-	
+    List<MeasureRoom> selectByReceiptId(MeasureRoom measureRoom);
 }
 

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

@@ -118,6 +118,15 @@
         WHERE room_id = #{roomId}::uuid
     </select>
 
+
+
+    <select id="selectByReceiptId" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM t_crm_measure_room
+        WHERE receipt_id = #{receiptId}::uuid
+    </select>
+
     <!-- 根据主键锁定表t_crm_measure_room的一行数据 -->
     <select id="selectByIdForUpdate" resultMap="BaseResultMap">
         SELECT

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

@@ -10,6 +10,8 @@ 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.mdm.model.pojo.mst.MeasureReceipt;
+import com.dk.mdm.model.pojo.mst.MeasureRoom;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -21,6 +23,7 @@ import lombok.experimental.Accessors;
 
 import java.io.Serializable;
 import java.time.LocalDateTime;
+import java.util.List;
 
 /**
  *  客户跟进
@@ -290,6 +293,9 @@ public class CusFollowResponse implements Serializable {
     @ApiModelProperty(value = "销售渠道")
     private String channelId;
 
+    private MeasureReceipt measureReceipt;
+    private List<MeasureRoom> measureRoomList;
+
     private static final long serialVersionUID = 1L;
 
 }

+ 54 - 28
src/main/java/com/dk/mdm/service/mst/CusFollowService.java

@@ -11,11 +11,8 @@ 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.mapper.mst.*;
 import com.dk.mdm.model.pojo.mst.*;
-import com.dk.mdm.mapper.mst.CusFollowMapper;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
 import com.dk.mdm.model.query.mst.CusFollowQuery;
@@ -72,6 +69,12 @@ public class CusFollowService extends BaseService<CusFollow> {
 
     @Autowired
     private MeasureReceiptService measureReceiptService;
+    @Autowired
+    private MeasureReceiptMapper measureReceiptMapper;
+
+    @Autowired
+    private MeasureRoomMapper measureRoomMapper;
+
 
     /**
      * @desc : 重写主键
@@ -100,6 +103,25 @@ public class CusFollowService extends BaseService<CusFollow> {
     }
 
     /**
+     * @desc : 跟进id查询
+     * @author : 于继渤
+     * @date : 2023/1/5 9:39
+     */
+    public ResponseResultVO<CusFollowResponse> selectById(CusFollowQuery cusFollowQuery) {
+        CusFollowResponse cusFollowResponse = cusFollowMapper.selectByCond(cusFollowQuery).get(0);
+
+        if (cusFollowResponse.getFollowId() != null && cusFollowResponse.getMeasureStatus().equals(Constant.BasicDataConstant.MEASURE_STATUS_1.getValue())) {
+            //已量尺
+            MeasureReceipt measureReceipts = measureReceiptMapper.selectByFollowId(new MeasureReceipt().setFollowId(cusFollowResponse.getFollowId()));
+            cusFollowResponse.setMeasureReceipt(measureReceipts);
+            //查询 空间
+            List<MeasureRoom> measureRooms = measureRoomMapper.selectByReceiptId(new MeasureRoom().setReceiptId(measureReceipts.getReceiptId()));
+            cusFollowResponse.setMeasureRoomList(measureRooms);
+        }
+        return ResponseResultUtil.success(cusFollowResponse);
+    }
+
+    /**
      * @desc : 新建
      * @author : 于继渤
      * @date : 2023/1/5 9:39
@@ -434,30 +456,34 @@ public class CusFollowService extends BaseService<CusFollow> {
             //更新客户信息
             customerService.updateByUuid(customer);
         } else {
-            StaffEntity staff = authUtils.getStaff();
-            Customer customer = new Customer();
-            customer.setCusName(cusFollowVO.getCusName());
-            customer.setCusPhone(cusFollowVO.getCusPhone());
-            customer.setAddressName(cusFollowVO.getAddressName());
-            customer.setAddressNo(cusFollowVO.getAddressNo());
-            customer.setOrgId(cusFollowVO.getFollowOrg());
-            customer.setAddressFull(cusFollowVO.getAddressFull());
-            customer.setAddressArea(cusFollowVO.getAddressArea());
-            customer.setSaleStatus(cusFollowVO.getSaleStatus());
-            customer.setAddressGcj02(cusFollowVO.getAddressGcj02());
-            customer.setReportStaff(cusFollowVO.getFollowStaff());
-            customer.setReportTime(LocalDateTime.now());
-            customer.setCpId(staff.getCpId());
-            List<String> list = new ArrayList<>();
-            list.add(staff.getStaffId());
-            customer.setFollowStaffs(list);
-            customer.setSaleStatus("客成状态-潜客");
-            customer.setChannelId(cusFollowVO.getChannelId());
-            Map<String, Object> customerNoteCode = commonService.getUniqueNoteCode(Constant.docNameConstant.CUSTOMER.getName(), true);
-            customer.setCusId(customerNoteCode.get("outId").toString());
-            //新建客户
-            customerMapper.insert(customer);
-            cusFollow.setCusId(customer.getCusId());
+            //不是陌生接待
+            if(!cusFollowVO.getFollowStatus().equals(Constant.BasicDataConstant.FOLLOW_STATUS_4.getValue())){
+                StaffEntity staff = authUtils.getStaff();
+                Customer customer = new Customer();
+                customer.setCusName(cusFollowVO.getCusName());
+                customer.setCusPhone(cusFollowVO.getCusPhone());
+                customer.setAddressName(cusFollowVO.getAddressName());
+                customer.setAddressNo(cusFollowVO.getAddressNo());
+                customer.setOrgId(cusFollowVO.getFollowOrg());
+                customer.setAddressFull(cusFollowVO.getAddressFull());
+                customer.setAddressArea(cusFollowVO.getAddressArea());
+                customer.setSaleStatus(cusFollowVO.getSaleStatus());
+                customer.setAddressGcj02(cusFollowVO.getAddressGcj02());
+                customer.setReportStaff(cusFollowVO.getFollowStaff());
+                customer.setReportTime(LocalDateTime.now());
+                customer.setCpId(staff.getCpId());
+                List<String> list = new ArrayList<>();
+                list.add(staff.getStaffId());
+                customer.setFollowStaffs(list);
+                customer.setSaleStatus("客成状态-潜客");
+                customer.setChannelId(cusFollowVO.getChannelId());
+                Map<String, Object> customerNoteCode = commonService.getUniqueNoteCode(Constant.docNameConstant.CUSTOMER.getName(), true);
+                customer.setCusId(customerNoteCode.get("outId").toString());
+                //新建客户
+                customerMapper.insert(customer);
+                cusFollow.setCusId(customer.getCusId());
+            }
+
         }
         //更新总单
         super.updateByUuid(cusFollow);

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

@@ -141,7 +141,7 @@ public class CustomerService extends BaseService<Customer> {
      * @author : 于继渤
      * @date : 2023/1/5 9:39
      */
-    public ResponseResultVO<CustomerResponse> selectByIdRespone(@PathVariable String id) {
+    public ResponseResultVO<CustomerResponse> selectByIdRespone( String id) {
         CustomerResponse customerResponse = customerMapper.selectByIdRespone(id);
         if (customerResponse == null) {
             return ResponseResultUtil.error(ResponseCodeEnum.SELECT_NULL);