Browse Source

areaCodePath

release
yinzuomei 3 years ago
parent
commit
006d263997
  1. 6
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/AgencyInfoCache.java
  2. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govorg/CustomerAgencyEntity.java
  3. 76
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  4. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffBasicInfoResultDTO.java
  5. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

6
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/AgencyInfoCache.java

@ -4,6 +4,7 @@ import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Author zxc
@ -59,6 +60,11 @@ public class AgencyInfoCache implements Serializable {
*/
private String areaCode;
/**
* 地区编码全路径例如37,3702,370203,370203005,370203005015
*/
private List<String> areaCodePath;
/**
* 删除标识
*/

7
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govorg/CustomerAgencyEntity.java

@ -22,6 +22,8 @@ import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* 机关单位信息表
*
@ -74,6 +76,11 @@ public class CustomerAgencyEntity extends BaseEpmetEntity {
*/
private String areaCode;
/**
* 地区编码全路径例如37,3702,370203,370203005,370203005015
*/
private List<String> areaCodePath;
/**
* 总人数
*/

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

@ -6,6 +6,7 @@ import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import com.alibaba.fastjson.JSON;
import com.dingtalk.api.request.OapiRobotSendRequest;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.constant.DingDingRobotConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
@ -250,41 +251,6 @@ public class GovOrgServiceImpl implements GovOrgService {
return result;
}
public static void main(String[] args) {
List<NextAreaCodeResultDTO> allList = new ArrayList<>();
NextAreaCodeResultDTO m1 = new NextAreaCodeResultDTO();
m1.setAreaCode("1");
m1.setAreaName("a");
allList.add(m1);
NextAreaCodeResultDTO m2 = new NextAreaCodeResultDTO();
m2.setAreaCode("2");
m2.setAreaName("b");
allList.add(m2);
NextAreaCodeResultDTO m3 = new NextAreaCodeResultDTO();
m3.setAreaCode("3");
m3.setAreaName("c");
allList.add(m3);
List<String> stringList = new ArrayList<>();
stringList.add("1");
stringList.add("2");
Iterator<NextAreaCodeResultDTO> iterator = allList.iterator();
while (iterator.hasNext()) {
NextAreaCodeResultDTO next = iterator.next();
for (String usedAreaCode : stringList) {
if (next.getAreaCode().equals(usedAreaCode)) {
iterator.remove();
}
}
}
System.out.println(JSON.toJSONString(allList, true));
}
/**
* @param staffId
* @Author sun
@ -643,7 +609,45 @@ public class GovOrgServiceImpl implements GovOrgService {
*/
@Override
public CustomerAgencyEntity getAgencyInfo(String agencyId) {
return customerAgencyDao.selectById(agencyId);
CustomerAgencyEntity customerAgencyEntity=customerAgencyDao.selectById(agencyId);
//设置行政地区编码全路径
if (StringUtils.isNotBlank(customerAgencyEntity.getAreaCode()) && StringUtils.isNotBlank(customerAgencyEntity.getParentAreaCode())) {
customerAgencyEntity.setAreaCodePath(queryAreaCodePath(customerAgencyEntity));
}
return customerAgencyEntity;
}
private List<String> queryAreaCodePath(CustomerAgencyEntity customerAgencyEntity) {
List<String> areaCodePath = new ArrayList<>();
switch (customerAgencyEntity.getLevel()) {
case Constant.COMMUNITY:
areaCodePath.add(customerAgencyEntity.getAreaCode().substring(NumConstant.ZERO, NumConstant.TWO));
areaCodePath.add(customerAgencyEntity.getAreaCode().substring(NumConstant.ZERO, NumConstant.FOUR));
areaCodePath.add(customerAgencyEntity.getAreaCode().substring(NumConstant.ZERO, NumConstant.SIX));
areaCodePath.add(customerAgencyEntity.getParentAreaCode());
areaCodePath.add(customerAgencyEntity.getAreaCode());
break;
case Constant.STREET:
areaCodePath.add(customerAgencyEntity.getAreaCode().substring(NumConstant.ZERO, NumConstant.TWO));
areaCodePath.add(customerAgencyEntity.getAreaCode().substring(NumConstant.ZERO, NumConstant.FOUR));
areaCodePath.add(customerAgencyEntity.getParentAreaCode());
areaCodePath.add(customerAgencyEntity.getAreaCode());
break;
case Constant.DISTRICT:
areaCodePath.add(customerAgencyEntity.getAreaCode().substring(NumConstant.ZERO, NumConstant.TWO));
areaCodePath.add(customerAgencyEntity.getParentAreaCode());
areaCodePath.add(customerAgencyEntity.getAreaCode());
break;
case Constant.CITY:
areaCodePath.add(customerAgencyEntity.getParentAreaCode());
areaCodePath.add(customerAgencyEntity.getAreaCode());
break;
case Constant.PROVINCE:
areaCodePath.add(customerAgencyEntity.getAreaCode());
break;
}
return areaCodePath;
}
/**

5
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffBasicInfoResultDTO.java

@ -92,5 +92,8 @@ public class StaffBasicInfoResultDTO implements Serializable {
*/
private String latitude;
private String areaCode;
/**
* 地区编码全路径例如37,3702,370203,370203005,370203005015
*/
private List<String> areaCodePath;
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

@ -745,7 +745,7 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
resultDTO.setLongitude(staffInfo.getLongitude());
resultDTO.setLatitude(staffInfo.getLatitude());
AgencyInfoCache agency=CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId());
resultDTO.setAreaCode(null != agency && StringUtils.isNotBlank(agency.getAreaCode()) ? agency.getAreaCode() : StrConstant.EPMETY_STR);
resultDTO.setAreaCodePath(null != agency && !CollectionUtils.isEmpty(agency.getAreaCodePath()) ? agency.getAreaCodePath() : new ArrayList<>());
}
//获取工作人员所属客户名
CustomerDTO dto = new CustomerDTO();

Loading…
Cancel
Save