From 22847c88898e56a565f51ef61b64b0e8db10f269 Mon Sep 17 00:00:00 2001 From: wxz Date: Mon, 27 Feb 2023 16:49:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AE=A2=E6=88=B7=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E5=88=9D=E5=A7=8B=E5=8C=96(=E4=B8=8D=E9=80=9A?= =?UTF-8?q?=E8=BF=87=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=92=8C=E5=85=AC=E4=BC=97?= =?UTF-8?q?=E5=8F=B7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/CustomerInitFormDTO.java | 51 +++++++++++++- .../epmet/controller/CustomerController.java | 14 +++- .../com/epmet/service/CustomerService.java | 5 ++ .../service/impl/CustomerServiceImpl.java | 69 +++++++++++++++++++ 4 files changed, 135 insertions(+), 4 deletions(-) diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerInitFormDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerInitFormDTO.java index 04a40b5871..def7584d23 100644 --- a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerInitFormDTO.java +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerInitFormDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.form; import lombok.Data; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import java.io.Serializable; /** @@ -12,11 +13,55 @@ import java.io.Serializable; @Data public class CustomerInitFormDTO implements Serializable { - public interface GetCustomerDetailGroup { - } + /** + * 初始化带小程序的客户 + */ + public interface InitMiniAppCustomerGroup {} + + /** + * 初始化本地客户 + */ + public interface InitLocalCustomerGroup {} - @NotBlank(message = "客户Id不能为空", groups = {GetCustomerDetailGroup.class}) + @NotBlank(message = "客户Id不能为空", groups = {InitMiniAppCustomerGroup.class}) private String customerId; + @NotNull(message = "缺少paCustomer信息", groups = InitLocalCustomerGroup.class) + private PaCustomer paCustomer; + @NotNull(message = "缺少paCustomerAgency信息", groups = InitLocalCustomerGroup.class) + private PaCustomerAgency paAgency; + @NotNull(message = "缺少paUser信息", groups = InitLocalCustomerGroup.class) + private PaUser paUser; + + + @Data + public static class PaCustomer { + private String customerName; + private String isInitialize; + private String source; + private String type; + } + + @Data + public static class PaCustomerAgency { + private String id; + private String agencyName; + private String areaCode; + private String city; + private String customerId; + private String district; + private String level; + private String levelNum; + private Integer partybranchnum; + private String province; + } + + @Data + public static class PaUser { + private String gender; + private String phone; + private String realName; + } + } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java index 907ffbc967..6b3fe736cb 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java @@ -257,11 +257,23 @@ public class CustomerController { **/ @PostMapping("init") public Result init(@RequestBody CustomerInitFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO, CustomerInitFormDTO.GetCustomerDetailGroup.class); + ValidatorUtils.validateEntity(formDTO, CustomerInitFormDTO.InitMiniAppCustomerGroup.class); customerService.init(formDTO); return new Result(); } + /** + * 本地初始化客户,不经过小程序 + * @param formDTO + * @return + */ + @PostMapping("initLocally") + public Result initLocally(@RequestBody CustomerInitFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, CustomerInitFormDTO.InitLocalCustomerGroup.class); + customerService.initLocal(formDTO); + return new Result(); + } + /** * desc:获取所有未删除的客户 * @return diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java index f1efa2d087..c0ae3c1309 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java @@ -166,6 +166,11 @@ public interface CustomerService extends BaseService { **/ void init(CustomerInitFormDTO formDTO); + /** + * 本地初始化(不走小程序) + */ + void initLocal(CustomerInitFormDTO input); + /** * desc:获取所有客户列表 * @return diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java index 856a72c96d..0c1c2a3d47 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java @@ -22,6 +22,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.rocketmq.messages.InitCustomerMQMsg; import com.epmet.commons.tools.constant.FieldConstant; @@ -585,6 +586,74 @@ public class CustomerServiceImpl extends BaseServiceImpl resultPoint = epmetPointOpenFeignClient.initPointRule(customerId); + if (!resultPoint.success()) { + throw new RenException(resultPoint.getCode(), resultPoint.getInternalMsg()); + } + + //9.新客户初始化评价指标 权重 + InitCustomerIndexForm indexForm = new InitCustomerIndexForm(); + indexForm.setCustomerId(customerId); + Result resultData = dataStatisticalOpenFeignClient.initCustomerIndex(indexForm); + if (!resultData.success()) { + throw new RenException(resultData.getCode(), resultData.getInternalMsg()); + } + //2021.1.25 end + + } + private InitCustomerMQMsg.InitCustomerStaff constructStaffInfo4CustomerInit(String agencyId, PaUserDTO paUser) { InitCustomerMQMsg.InitCustomerStaff staff = new InitCustomerMQMsg.InitCustomerStaff(); staff.setAgencyId(agencyId);