Browse Source

h获取子客户

master
zhangyuan 3 years ago
parent
commit
c0ce468ab8
  1. 41
      epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerRelationFormDTO.java
  2. 12
      epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java
  3. 5
      epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java
  4. 18
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerRelationController.java
  5. 10
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerRelationDao.java
  6. 2
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerRelationService.java
  7. 5
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerRelationServiceImpl.java
  8. 11
      epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerRelationDao.xml

41
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

12
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}") @GetMapping("/oper/crm/customer/getexternalandparentcustomerid/{customerId}")
Result<String> getExternalAndParentCustomerId(@PathVariable("customerId") String customerId); Result<String> getExternalAndParentCustomerId(@PathVariable("customerId") String customerId);
/**
* 获取子客户
*
* @param customerId
* @return com.epmet.commons.tools.utils.Result<java.util.List<java.lang.String>>
* @author zhy
* @date 2022/7/8 13:41
*/
@GetMapping("/oper/crm/customerRelation/subcustomer/{customerId}")
Result<List<String>> getSubCustomer(@PathVariable("customerId") String customerId);
} }

5
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<String> getExternalAndParentCustomerId(String customerId) { public Result<String> getExternalAndParentCustomerId(String customerId) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getExternalAndParentCustomerId", customerId); return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getExternalAndParentCustomerId", customerId);
} }
@Override
public Result<List<String>> getSubCustomer(String customerId) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getSubCustomer", customerId);
}
} }

18
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.CustomerRelationDTO;
import com.epmet.dto.result.CustomerRelationTreeDTO; import com.epmet.dto.result.CustomerRelationTreeDTO;
import com.epmet.service.CustomerRelationService; import com.epmet.service.CustomerRelationService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -83,4 +84,21 @@ public class CustomerRelationController {
public Result<List<CustomerRelationTreeDTO>> customerTree(@LoginUser TokenDto tokenDto) { public Result<List<CustomerRelationTreeDTO>> customerTree(@LoginUser TokenDto tokenDto) {
return new Result<List<CustomerRelationTreeDTO>>().ok(customerRelationService.getCustomerTree(tokenDto)); return new Result<List<CustomerRelationTreeDTO>>().ok(customerRelationService.getCustomerTree(tokenDto));
} }
/**
* 获取子客户
*
* @param customerId
* @return com.epmet.commons.tools.utils.Result<java.util.List<java.lang.String>>
* @author zhy
* @date 2022/7/8 13:41
*/
@GetMapping("subcustomer/{customerId}")
public Result<List<String>> getSubCustomer(@PathVariable("customerId") String customerId) {
if(StringUtils.isNotBlank(customerId)){
List<String> result = customerRelationService.getSubCustomer(customerId);
return new Result<List<String>>().ok(result);
}
return new Result<>();
}
} }

10
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerRelationDao.java

@ -71,4 +71,14 @@ public interface CustomerRelationDao extends BaseDao<CustomerRelationEntity> {
*/ */
List<CustomerRelationTreeDTO> selectSubCustomerByPid(@Param("customerPid") String customerPid); List<CustomerRelationTreeDTO> selectSubCustomerByPid(@Param("customerPid") String customerPid);
/**
* 获取子客户
*
* @param customerId
* @return com.epmet.commons.tools.utils.Result<java.util.List<java.lang.String>>
* @author zhy
* @date 2022/7/8 13:41
*/
List<String> getSubCustomer(@Param("customerId") String customerId);
} }

2
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerRelationService.java

@ -144,4 +144,6 @@ public interface CustomerRelationService extends BaseService<CustomerRelationEnt
*/ */
List<CustomerRelationTreeDTO> getCustomerTree(TokenDto tokenDto); List<CustomerRelationTreeDTO> getCustomerTree(TokenDto tokenDto);
List<String> getSubCustomer(String customerId);
} }

5
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<CustomerRelatio
return rootList; return rootList;
} }
@Override
public List<String> getSubCustomer(String customerId) {
return baseDao.getSubCustomer(customerId);
}
/** /**
* 处理子客户 * 处理子客户
* *

11
epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerRelationDao.xml

@ -54,4 +54,15 @@
AND cr.PARENT_CUSTOMER_ID = #{customerPid} AND cr.PARENT_CUSTOMER_ID = #{customerPid}
</select> </select>
<select id="getSubCustomer" parameterType="java.lang.String" resultType="java.lang.String">
SELECT
CUSTOMER_ID
FROM
customer_relation
WHERE
`STATUS` = 'open'
AND FIND_IN_SET( #{customerId}, pids )
AND DEL_FLAG = '0'
</select>
</mapper> </mapper>
Loading…
Cancel
Save