diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java index 388594a48b..0036e17a81 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java @@ -30,6 +30,7 @@ import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.constant.ActConstant; import com.epmet.dao.ActInfoDao; import com.epmet.dao.ActUserRelationDao; @@ -66,16 +67,13 @@ public class ActInfoServiceImpl extends BaseServiceImpl option = icPartyUnitService.option(unitDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + Map option = SpringContextUtils.getBean(IcPartyUnitService.class).option(unitDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); List unitIds = icActivityUnitRelationService.getUnitList(dto.getId()); List unitNames = unitIds.stream().map(option::get).collect(Collectors.toList()); detailResultDTO.setUnitIdList(unitIds); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java index 07014bd72c..d0d8c5d541 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java @@ -44,6 +44,7 @@ import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.FileUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.constant.UserDemandConstant; import com.epmet.constants.ImportTaskConstants; import com.epmet.dao.IcPartyUnitDao; @@ -99,16 +100,16 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl serviceItemList = icServiceItemDictService.queryDictList(formDTO.getCustomerId()); Map categoryMap = serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); //获取单位积分 - Map pointMap = icUserDemandRecService.getServicePoint(formDTO.getCustomerId(), UserDemandConstant.PARTY_UNIT); + Map pointMap = SpringContextUtils.getBean(IcUserDemandRecService.class).getServicePoint(formDTO.getCustomerId(), UserDemandConstant.PARTY_UNIT); dtoList.forEach(item -> { item.setTypeName(unitTypeMap.getData().get(item.getType())); //这是错误的,应该是赋值type,遗留bug, 先不改了.... @@ -180,7 +181,7 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl serviceItemList = icServiceItemDictService.queryDictList(formDTO.getCustomerId()); Map categoryMap = serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); //获取单位积分 - Map pointMap = icUserDemandRecService.getServicePoint(formDTO.getCustomerId(), UserDemandConstant.PARTY_UNIT); + Map pointMap = SpringContextUtils.getBean(IcUserDemandRecService.class).getServicePoint(formDTO.getCustomerId(), UserDemandConstant.PARTY_UNIT); dtoList.forEach(item -> { item.setTypeName(unitTypeMap.getData().get(item.getType())); //这是错误的,应该是赋值type,遗留bug, 先不改了.... @@ -211,7 +212,7 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl pointMap = icUserDemandRecService.getServicePoint(entity.getCustomerId(), UserDemandConstant.PARTY_UNIT); + Map pointMap = SpringContextUtils.getBean(IcUserDemandRecService.class).getServicePoint(entity.getCustomerId(), UserDemandConstant.PARTY_UNIT); dto.setServiceMatterList(Arrays.asList(dto.getServiceMatter().split(StrConstant.COMMA))); dto.setScore(null == pointMap.get(id) ? NumConstant.ZERO : pointMap.get(id)); // 分类名称 @@ -271,7 +272,7 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl NumConstant.ZERO) { + if (SpringContextUtils.getBean(IcUserDemandRecService.class).selectCountByServerId(id) > NumConstant.ZERO) { throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "存在未完成的服务", "存在未完成的服务,不能删除"); } //校验是否有同步到通讯录,是否存在工作人员下有未处理项目数据【联建单位被同步到通讯录部门的,如果部门下人员存在未办结项目则不允许删除】 @@ -438,7 +439,7 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl list = icUserDemandRecService.groupByServer(formDTO.getCustomerId(), formDTO.getServerId(), formDTO.getServiceType()); + List list = SpringContextUtils.getBean(IcUserDemandRecService.class).groupByServer(formDTO.getCustomerId(), formDTO.getServerId(), formDTO.getServiceType()); for (ServiceStatDTO serviceStatDTO : list) { if (0 != serviceStatDTO.getDemandCount()) { BigDecimal result = serviceStatDTO.getTotalScore().divide(new BigDecimal(serviceStatDTO.getDemandCount()), 4, BigDecimal.ROUND_HALF_UP); diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/CloudStorageConfig.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/CloudStorageConfig.java index 6403bc343a..bfa8799ef7 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/CloudStorageConfig.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/CloudStorageConfig.java @@ -105,6 +105,8 @@ public class CloudStorageConfig implements Serializable { private AliyunCloudStorageConfig aliyun; private MinioStorageConfig minio; private InspurOssConfigProps inspur; + + /** * 阿里云存储配置 */ 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..cc730f6223 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,45 @@ 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(); } + /** + * 本地初始化客户,不经过小程序 + * curl --location 'http://localhost:8090/oper/crm/customer/initLocally' \ + * --header 'Content-Type: application/json' \ + * --data '{ + * "paAgency": { + * "agencyName": "wxz测试001", + * "areaCode": "370666", + * "city": "青岛市", + * "district": "海马脑区", + * "level": "district", + * "levelNum": "2", + * "partybranchnum": 50, + * "province": "山东省" + * }, + * "paCustomer": { + * "customerName": "海马脑区" + * }, + * "paUser": { + * "gender": "1", + * "phone": "18560677960", + * "realName": "wang" + * } + * }' + * @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);