Browse Source

组织区划下拉框接口V2

dev_shibei_match
yinzuomei 4 years ago
parent
commit
f77163b57d
  1. 1
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java
  2. 28
      epmet-module/data-aggregator/data-aggregator-server/pom.xml
  3. 16
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercrm/CustomerRelationDao.java
  4. 19
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  5. 13
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/CustomerRelation.java
  6. 30
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/impl/CustomerRelationImpl.java
  7. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml
  8. 16
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercrm/CustomerRelationDao.xml

1
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java

@ -25,4 +25,5 @@ public interface DataSourceConstant {
String EPMET_COMMON_SERVICE="commonservice"; String EPMET_COMMON_SERVICE="commonservice";
String OPER_CRM="opercrm";
} }

28
epmet-module/data-aggregator/data-aggregator-server/pom.xml

@ -150,6 +150,13 @@
<datasource.druid.commonservice.username>epmet_common_service_user</datasource.druid.commonservice.username> <datasource.druid.commonservice.username>epmet_common_service_user</datasource.druid.commonservice.username>
<datasource.druid.commonservice.password>EpmEt-db-UsEr</datasource.druid.commonservice.password> <datasource.druid.commonservice.password>EpmEt-db-UsEr</datasource.druid.commonservice.password>
<!-- opercrm -->
<datasource.druid.opercrm.url>
<![CDATA[jdbc:mysql://192.168.1.130:3306/epmet_oper_crm?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.opercrm.url>
<datasource.druid.opercrm.username>epmet_oper_crm_user</datasource.druid.opercrm.username>
<datasource.druid.opercrm.password>EpmEt-db-UsEr</datasource.druid.opercrm.password>
<!-- redis配置 --> <!-- redis配置 -->
<spring.redis.index>0</spring.redis.index> <spring.redis.index>0</spring.redis.index>
<spring.redis.host>192.168.1.130</spring.redis.host> <spring.redis.host>192.168.1.130</spring.redis.host>
@ -224,6 +231,13 @@
<datasource.druid.commonservice.username>epmet_common_service_user</datasource.druid.commonservice.username> <datasource.druid.commonservice.username>epmet_common_service_user</datasource.druid.commonservice.username>
<datasource.druid.commonservice.password>EpmEt-db-UsEr</datasource.druid.commonservice.password> <datasource.druid.commonservice.password>EpmEt-db-UsEr</datasource.druid.commonservice.password>
<!-- opercrm -->
<datasource.druid.opercrm.url>
<![CDATA[jdbc:mysql://192.168.1.130:3306/epmet_oper_crm?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.opercrm.url>
<datasource.druid.opercrm.username>epmet_oper_crm_user</datasource.druid.opercrm.username>
<datasource.druid.opercrm.password>EpmEt-db-UsEr</datasource.druid.opercrm.password>
<!-- redis配置 --> <!-- redis配置 -->
<spring.redis.index>0</spring.redis.index> <spring.redis.index>0</spring.redis.index>
<spring.redis.host>192.168.1.130</spring.redis.host> <spring.redis.host>192.168.1.130</spring.redis.host>
@ -298,6 +312,13 @@
<datasource.druid.commonservice.username>epmet</datasource.druid.commonservice.username> <datasource.druid.commonservice.username>epmet</datasource.druid.commonservice.username>
<datasource.druid.commonservice.password>elink@833066</datasource.druid.commonservice.password> <datasource.druid.commonservice.password>elink@833066</datasource.druid.commonservice.password>
<!-- opercrm-->
<datasource.druid.opercrm.url>
<![CDATA[jdbc:mysql://rm-m5ef9t617j6o5eup7.mysql.rds.aliyuncs.com:3306/epmet_oper_crm?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.opercrm.url>
<datasource.druid.opercrm.username>epmet</datasource.druid.opercrm.username>
<datasource.druid.opercrm.password>elink@833066</datasource.druid.opercrm.password>
<!-- redis配置 --> <!-- redis配置 -->
<spring.redis.index>0</spring.redis.index> <spring.redis.index>0</spring.redis.index>
<spring.redis.host>r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com</spring.redis.host> <spring.redis.host>r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com</spring.redis.host>
@ -372,6 +393,13 @@
<datasource.druid.commonservice.username>epmet_common_service_user</datasource.druid.commonservice.username> <datasource.druid.commonservice.username>epmet_common_service_user</datasource.druid.commonservice.username>
<datasource.druid.commonservice.password>EpmEt-db-UsEr</datasource.druid.commonservice.password> <datasource.druid.commonservice.password>EpmEt-db-UsEr</datasource.druid.commonservice.password>
<!-- opercrm-->
<datasource.druid.opercrm.url>
<![CDATA[jdbc:mysql://rm-m5e3vzs2637224wj9.mysql.rds.aliyuncs.com:3306/epmet_oper_crm?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.opercrm.url>
<datasource.druid.opercrm.username>epmet_oper_crm_user</datasource.druid.opercrm.username>
<datasource.druid.opercrm.password>EpmEt-db-UsEr</datasource.druid.opercrm.password>
<!-- redis配置 --> <!-- redis配置 -->
<spring.redis.index>0</spring.redis.index> <spring.redis.index>0</spring.redis.index>
<spring.redis.host>r-m5ez3n1j0qc3ykq2ut.redis.rds.aliyuncs.com</spring.redis.host> <spring.redis.host>r-m5ez3n1j0qc3ykq2ut.redis.rds.aliyuncs.com</spring.redis.host>

16
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercrm/CustomerRelationDao.java

@ -0,0 +1,16 @@
package com.epmet.dataaggre.dao.opercrm;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 描述一下
*
* @author yinzuomei@elink-cn.com
* @date 2021/4/13 10:43
*/
@Mapper
public interface CustomerRelationDao {
List<String> selectUsedAreaCodeList(String areaCode);
}

19
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java

@ -17,6 +17,7 @@ import com.epmet.dataaggre.dto.govorg.result.NextAreaCodeResultDTO;
import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity; import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
import com.epmet.dataaggre.service.commonservice.AreaCodeService; import com.epmet.dataaggre.service.commonservice.AreaCodeService;
import com.epmet.dataaggre.service.govorg.GovOrgService; import com.epmet.dataaggre.service.govorg.GovOrgService;
import com.epmet.dataaggre.service.opercrm.CustomerRelation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -46,6 +47,8 @@ public class GovOrgServiceImpl implements GovOrgService {
private CustomerGridDao customerGridDao; private CustomerGridDao customerGridDao;
@Autowired @Autowired
private AreaCodeService areaCodeService; private AreaCodeService areaCodeService;
@Autowired
private CustomerRelation customerRelation;
/** /**
* @param staffId * @param staffId
@ -133,18 +136,24 @@ public class GovOrgServiceImpl implements GovOrgService {
//全部下级 //全部下级
List<NextAreaCodeResultDTO> allList = areaCodeService.queryNextLevelAreaCodeList(formDTO); List<NextAreaCodeResultDTO> allList = areaCodeService.queryNextLevelAreaCodeList(formDTO);
if (CollectionUtils.isNotEmpty(allList)) { if (CollectionUtils.isNotEmpty(allList)) {
//已经被使用过的areaCode //内部客户: 已经被使用过的areaCode
List<String> usedAreaCodeList = customerAgencyDao.selectUsedAreaCodeList(formDTO.getAreaCode()); List<String> usedAreaCodeList1 = customerAgencyDao.selectUsedAreaCodeList(formDTO.getAreaCode());
//外部子客户:
List<String> usedAreaCodeList2= customerRelation.selectUsedAreaCodeList(formDTO.getAreaCode());
//已经被使用的移除不显示 //已经被使用的移除不显示
Iterator<NextAreaCodeResultDTO> iterator = allList.iterator(); Iterator<NextAreaCodeResultDTO> iterator = allList.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
NextAreaCodeResultDTO next = iterator.next(); NextAreaCodeResultDTO next = iterator.next();
for (String usedAreaCode : usedAreaCodeList) { for (String usedAreaCode1 : usedAreaCodeList1) {
if (next.getAreaCode().equals(usedAreaCode)) { if (next.getAreaCode().equals(usedAreaCode1)) {
iterator.remove();
}
}
for (String usedAreaCode2 : usedAreaCodeList2) {
if (next.getAreaCode().contains(usedAreaCode2)) {
iterator.remove(); iterator.remove();
} }
} }
//todo 移除掉 子客户下使用的
} }
} }
return allList; return allList;

13
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/CustomerRelation.java

@ -0,0 +1,13 @@
package com.epmet.dataaggre.service.opercrm;
import java.util.List;
/**
* 描述一下
*
* @author yinzuomei@elink-cn.com
* @date 2021/4/13 10:38
*/
public interface CustomerRelation {
List<String> selectUsedAreaCodeList(String areaCode);
}

30
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/impl/CustomerRelationImpl.java

@ -0,0 +1,30 @@
package com.epmet.dataaggre.service.opercrm.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.opercrm.CustomerRelationDao;
import com.epmet.dataaggre.service.opercrm.CustomerRelation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 描述一下
*
* @author yinzuomei@elink-cn.com
* @date 2021/4/13 10:38
*/
@DataSource(DataSourceConstant.OPER_CRM)
@Slf4j
@Service
public class CustomerRelationImpl implements CustomerRelation {
@Autowired
private CustomerRelationDao customerRelationDao;
@Override
public List<String> selectUsedAreaCodeList(String areaCode) {
return customerRelationDao.selectUsedAreaCodeList(areaCode);
}
}

5
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml

@ -124,6 +124,11 @@ dynamic:
url: @datasource.druid.commonservice.url@ url: @datasource.druid.commonservice.url@
username: @datasource.druid.commonservice.username@ username: @datasource.druid.commonservice.username@
password: @datasource.druid.commonservice.password@ password: @datasource.druid.commonservice.password@
opercrm:
driver-class-name: com.mysql.cj.jdbc.Driver
url: @datasource.druid.opercrm.url@
username: @datasource.druid.opercrm.username@
password: @datasource.druid.opercrm.password@
feign: feign:
hystrix: hystrix:
enabled: true enabled: true

16
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercrm/CustomerRelationDao.xml

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dataaggre.dao.opercrm.CustomerRelationDao">
<select id="selectUsedAreaCodeList" parameterType="java.lang.String" resultType="java.lang.String">
SELECT
cr.AREA_CODE
FROM
customer_relation cr
WHERE
cr.DEL_FLAG = '0'
AND cr.AREA_CODE LIKE concat(#{areaCode}, '%')
AND cr.AREA_CODE != #{areaCode}
</select>
</mapper>
Loading…
Cancel
Save