From 72ff31c3fcaae3c92a3aeeafa3df6e61563258a2 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 14 Aug 2020 16:29:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=AE=A2=E6=88=B7=E5=9F=BA?= =?UTF-8?q?=E6=9C=AC=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/service/impl/OpenUpServiceImpl.java | 5 ++- .../com/epmet/dto/form/CustomerIdFormDTO.java | 21 +++++++++++ .../result/CustomerGridCountResultDTO.java | 20 +++++++++++ .../epmet/feign/GovOrgOpenFeignClient.java | 13 +++++-- .../GovOrgOpenFeignClientFallback.java | 5 +++ .../controller/CustomerGridController.java | 12 +++++++ .../epmet/service/CustomerGridService.java | 8 +++++ .../service/impl/CustomerGridServiceImpl.java | 16 +++++++-- .../dto/result/CustomerInfoResultDTO.java | 36 +++++++++++++++++++ .../com/epmet/constant/ModuleConstant.java | 11 ++++++ .../epmet/controller/CustomerController.java | 25 +++++++++++++ .../main/java/com/epmet/dao/CustomerDao.java | 9 +++++ .../com/epmet/service/CustomerService.java | 10 ++++++ .../service/impl/CustomerServiceImpl.java | 19 ++++++++++ .../src/main/resources/mapper/CustomerDao.xml | 13 +++++++ 15 files changed, 218 insertions(+), 5 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerIdFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridCountResultDTO.java create mode 100644 epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerInfoResultDTO.java create mode 100644 epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/constant/ModuleConstant.java diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java index d3cc815455..136fe2e55f 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java @@ -1,8 +1,10 @@ package com.epmet.service.impl; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.ModuleConstant; +import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.StaffSinDeptResultDTO; import com.epmet.dto.result.StaffSinGridResultDTO; @@ -16,6 +18,7 @@ import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; +import java.util.UUID; /** * @Author zxc @@ -39,7 +42,7 @@ public class OpenUpServiceImpl implements OpenUpService { public List staffSinGrid(StaffSinGridFormDTO formDTO) { CommonGridIdFormDTO commonGridId = new CommonGridIdFormDTO(); commonGridId.setGridId(formDTO.getGridId()); - commonGridId.setUserId(""); + commonGridId.setUserId(UUID.randomUUID().toString().replace(StrConstant.HYPHEN, "")); Result> gridStaffs = govOrgOpenFeignClient.getGridStaffs(commonGridId); if (!gridStaffs.success()){ throw new RenException(ModuleConstant.ERROR_GOV_ORG_GRID); diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerIdFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerIdFormDTO.java new file mode 100644 index 0000000000..0e853c6275 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerIdFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/8/13 5:56 下午 + */ +@Data +public class CustomerIdFormDTO implements Serializable { + + private static final long serialVersionUID = 4512080710854617599L; + + public interface Customer{} + + @NotBlank(message = "customerId不能为空",groups = {Customer.class}) + private String customerId; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridCountResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridCountResultDTO.java new file mode 100644 index 0000000000..1f583338a2 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridCountResultDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/8/14 9:27 上午 + */ +@Data +public class CustomerGridCountResultDTO implements Serializable { + + private static final long serialVersionUID = 386294009143897744L; + + /** + * 客户下的网格数量 + */ + private Integer gridCount; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index 162bd8a07a..361a3e5b76 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -19,7 +19,7 @@ import java.util.List; * @author yinzuomei@elink-cn.com * @date 2020/6/4 13:37 */ -// @FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgOpenFeignClientFallback.class, url = "localhost:8092") +//@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgOpenFeignClientFallback.class, url = "localhost:8092") @FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgOpenFeignClientFallback.class) public interface GovOrgOpenFeignClient { @@ -191,7 +191,7 @@ public interface GovOrgOpenFeignClient { * @author zxc * @date 2020/8/13 10:46 上午 */ - @PostMapping("/gov/org/customerstaffgrid/getgridstaffs") + @PostMapping(value = "/gov/org/customerstaffgrid/getgridstaffs") Result> getGridStaffs(@RequestBody CommonGridIdFormDTO gridIdFormDTO); /** @@ -202,4 +202,13 @@ public interface GovOrgOpenFeignClient { */ @PostMapping("/gov/org/customerstaffdepartment/getdepartmentstaffs") Result> getDepartmentStaffs(@RequestBody DepartmentIdFormDTO formDTO); + + /** + * @Description 查询客户下的网格数量 + * @param customerIdFormDTO + * @author zxc + * @date 2020/8/14 9:31 上午 + */ + @PostMapping("/gov/org/customergrid/gridcount") + Result selectGridCount(@RequestBody CustomerIdFormDTO customerIdFormDTO); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index c4421f69a7..370559ff57 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -121,4 +121,9 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { public Result> getDepartmentStaffs(DepartmentIdFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getDepartmentStaffs", formDTO); } + + @Override + public Result selectGridCount(CustomerIdFormDTO customerIdFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectGridCount", customerIdFormDTO); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java index 69eecc5d2c..b86bb7df20 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java @@ -216,4 +216,16 @@ public class CustomerGridController { return customerGridService.queryCustomerGridList(formDTO); } + /** + * @Description 查询客户下的网格数量 + * @param customerIdFormDTO + * @author zxc + * @date 2020/8/14 9:31 上午 + */ + @PostMapping("gridcount") + public Result selectGridCount(@RequestBody CustomerIdFormDTO customerIdFormDTO){ + ValidatorUtils.validateEntity(customerIdFormDTO, CustomerIdFormDTO.Customer.class); + return new Result().ok(customerGridService.selectGridCount(customerIdFormDTO)); + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java index 518e20fdb5..67c425915f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java @@ -251,4 +251,12 @@ public interface CustomerGridService extends BaseService { * @Description 单客户-陌生人导览模块调用-根据地区编码查询客户下的网格列表 **/ Result> queryCustomerGridList(ThirdCustomerGridListFormDTO formDTO); + + /** + * @Description 查询客户下的网格数量 + * @param customerIdFormDTO + * @author zxc + * @date 2020/8/14 9:31 上午 + */ + CustomerGridCountResultDTO selectGridCount( CustomerIdFormDTO customerIdFormDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java index fd32b2a087..afece523c4 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java @@ -29,7 +29,6 @@ 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.constant.CustomerGridConstant; -import com.epmet.dao.CustomerAgencyDao; import com.epmet.dao.CustomerGridDao; import com.epmet.dao.CustomerStaffGridDao; import com.epmet.dto.*; @@ -40,7 +39,6 @@ import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.service.CustomerAgencyService; import com.epmet.service.CustomerGridService; -import com.epmet.service.CustomerStaffGridService; import com.epmet.util.ModuleConstant; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -637,4 +635,18 @@ public class CustomerGridServiceImpl extends BaseServiceImpl> page(@RequestParam Map params) { @@ -267,4 +271,25 @@ public class CustomerController { return new Result().ok(customerService.getGridCount(formDTO)); } + /** + * @Description 查询客户基本信息 + * @param formDTO + * @author zxc + * @date 2020/8/14 9:08 上午 + */ + @PostMapping("getcustomer") + public Result getCustomer(@RequestBody CustomerIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, CustomerIdFormDTO.Customer.class); + return new Result().ok(customerService.getCustomer(formDTO)); + } + + + @PostMapping("zxc") + public void getZxc(){ + CommonGridIdFormDTO commonGridId = new CommonGridIdFormDTO(); + commonGridId.setGridId("111"); + commonGridId.setUserId("111"); + Result> gridStaffs = govOrgOpenFeignClient.getGridStaffs(commonGridId); + System.out.println(gridStaffs); + } } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java index 40dd5394e6..6c21743bbb 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java @@ -19,6 +19,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.CustomerDTO; +import com.epmet.dto.result.CustomerInfoResultDTO; import com.epmet.dto.result.CustomerResultDTO; import com.epmet.dto.result.GridCountResultDTO; import com.epmet.dto.result.ValidCustomerResultDTO; @@ -83,4 +84,12 @@ public interface CustomerDao extends BaseDao { */ GridCountResultDTO getGridCount(@Param("customerId")String customerId); + /** + * @Description 根据客户Id查询客户基本信息 + * @param customerId + * @author zxc + * @date 2020/8/14 9:12 上午 + */ + CustomerInfoResultDTO selectCustomerBasicInfo(@Param("customerId")String customerId); + } 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 08475a9f5b..cf32a13308 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 @@ -23,9 +23,11 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.CustomerDetailResultDTO; +import com.epmet.dto.result.CustomerInfoResultDTO; import com.epmet.dto.result.GridCountResultDTO; import com.epmet.dto.result.ValidCustomerResultDTO; import com.epmet.entity.CustomerEntity; +import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.Map; @@ -179,4 +181,12 @@ public interface CustomerService extends BaseService { * @date 2020/8/12 4:30 下午 */ GridCountResultDTO getGridCount( GridCountFormDTO formDTO); + + /** + * @Description 查询客户基本信息 + * @param formDTO + * @author zxc + * @date 2020/8/14 9:08 上午 + */ + CustomerInfoResultDTO getCustomer( CustomerIdFormDTO formDTO); } 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 a408167145..51364b48d9 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 @@ -30,6 +30,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.ModuleConstant; import com.epmet.constant.RoleKeyConstants; import com.epmet.constant.UserWorkType; import com.epmet.dao.CustomerDao; @@ -557,4 +558,22 @@ public class CustomerServiceImpl extends BaseServiceImpl result = govOrgOpenFeignClient.selectGridCount(formDTO); + if (!result.success()){ + throw new RenException(ModuleConstant.ERROR_GOV_ORG_COUNT); + } + customerInfoResultDTO.setCreateGridNum(result.getData().getGridCount()); + return customerInfoResultDTO; + } + } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml b/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml index 6586930075..33c0dd52e2 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml +++ b/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml @@ -89,4 +89,17 @@ del_flag = 0 AND id = #{customerId} + + +