From c0ce468ab8129c1e656f15773c52ed8d964be162 Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Fri, 8 Jul 2022 13:45:05 +0800 Subject: [PATCH] =?UTF-8?q?h=E8=8E=B7=E5=8F=96=E5=AD=90=E5=AE=A2=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/form/CustomerRelationFormDTO.java | 41 +++++++++++++++++++ .../epmet/feign/OperCrmOpenFeignClient.java | 12 ++++++ .../OperCrmOpenFeignClientFallback.java | 5 +++ .../CustomerRelationController.java | 18 ++++++++ .../com/epmet/dao/CustomerRelationDao.java | 10 +++++ .../service/CustomerRelationService.java | 2 + .../impl/CustomerRelationServiceImpl.java | 5 +++ .../resources/mapper/CustomerRelationDao.xml | 11 +++++ 8 files changed, 104 insertions(+) create mode 100644 epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerRelationFormDTO.java diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerRelationFormDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerRelationFormDTO.java new file mode 100644 index 0000000000..817670541f --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerRelationFormDTO.java @@ -0,0 +1,41 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 客户关系表(01.14 add) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-02-03 + */ +@Data +public class CustomerRelationFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + +} \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java index c6fc44b140..cda0889b35 100644 --- a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java @@ -133,4 +133,16 @@ public interface OperCrmOpenFeignClient { **/ @GetMapping("/oper/crm/customer/getexternalandparentcustomerid/{customerId}") Result getExternalAndParentCustomerId(@PathVariable("customerId") String customerId); + + /** + * 获取子客户 + * + * @param customerId + * @return com.epmet.commons.tools.utils.Result> + * @author zhy + * @date 2022/7/8 13:41 + */ + @GetMapping("/oper/crm/customerRelation/subcustomer/{customerId}") + Result> getSubCustomer(@PathVariable("customerId") String customerId); + } diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java index 8366657fa8..380ed077fa 100644 --- a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java @@ -99,4 +99,9 @@ public class OperCrmOpenFeignClientFallback implements OperCrmOpenFeignClient { public Result getExternalAndParentCustomerId(String customerId) { return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getExternalAndParentCustomerId", customerId); } + + @Override + public Result> getSubCustomer(String customerId) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getSubCustomer", customerId); + } } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerRelationController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerRelationController.java index 00e235b0b3..e6a4bc2f25 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerRelationController.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerRelationController.java @@ -13,6 +13,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerRelationDTO; import com.epmet.dto.result.CustomerRelationTreeDTO; import com.epmet.service.CustomerRelationService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -83,4 +84,21 @@ public class CustomerRelationController { public Result> customerTree(@LoginUser TokenDto tokenDto) { return new Result>().ok(customerRelationService.getCustomerTree(tokenDto)); } + + /** + * 获取子客户 + * + * @param customerId + * @return com.epmet.commons.tools.utils.Result> + * @author zhy + * @date 2022/7/8 13:41 + */ + @GetMapping("subcustomer/{customerId}") + public Result> getSubCustomer(@PathVariable("customerId") String customerId) { + if(StringUtils.isNotBlank(customerId)){ + List result = customerRelationService.getSubCustomer(customerId); + return new Result>().ok(result); + } + return new Result<>(); + } } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerRelationDao.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerRelationDao.java index b935ef5b08..ee8e6255ce 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerRelationDao.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerRelationDao.java @@ -71,4 +71,14 @@ public interface CustomerRelationDao extends BaseDao { */ List selectSubCustomerByPid(@Param("customerPid") String customerPid); + /** + * 获取子客户 + * + * @param customerId + * @return com.epmet.commons.tools.utils.Result> + * @author zhy + * @date 2022/7/8 13:41 + */ + List getSubCustomer(@Param("customerId") String customerId); + } \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerRelationService.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerRelationService.java index 6dfaa6c86f..05ee703d22 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerRelationService.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerRelationService.java @@ -144,4 +144,6 @@ public interface CustomerRelationService extends BaseService getCustomerTree(TokenDto tokenDto); + List getSubCustomer(String customerId); + } \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerRelationServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerRelationServiceImpl.java index d9ef04903d..415a6c831a 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerRelationServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerRelationServiceImpl.java @@ -198,6 +198,11 @@ public class CustomerRelationServiceImpl extends BaseServiceImpl getSubCustomer(String customerId) { + return baseDao.getSubCustomer(customerId); + } + /** * 处理子客户 * diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerRelationDao.xml b/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerRelationDao.xml index 9c49c97b54..525e388cf4 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerRelationDao.xml +++ b/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerRelationDao.xml @@ -54,4 +54,15 @@ AND cr.PARENT_CUSTOMER_ID = #{customerPid} + + \ No newline at end of file