Browse Source

Merge remote-tracking branch 'origin/dev_area_code' into dev_temp

master
yinzuomei 4 years ago
parent
commit
d2496e0090
  1. 4
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/commonservice/impl/AreaCodeServiceImpl.java
  2. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  3. 51
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java

4
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/commonservice/impl/AreaCodeServiceImpl.java

@ -70,7 +70,9 @@ public class AreaCodeServiceImpl implements AreaCodeService {
if (CollectionUtils.isEmpty(list)) {
list = new ArrayList<>();
}
list.add(other);
if(!"province".equals(formDTO.getLevel())){
list.add(other);
}
return list;
}
}

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

@ -139,7 +139,7 @@ public class GovOrgServiceImpl implements GovOrgService {
//内部客户: 已经被使用过的areaCode
List<String> usedAreaCodeList1 = customerAgencyDao.selectUsedAreaCodeList(formDTO.getAreaCode());
//外部子客户:
List<String> usedAreaCodeList2= customerRelation.selectUsedAreaCodeList(formDTO.getAreaCode());
List<String> usedAreaCodeList2 = customerRelation.selectUsedAreaCodeList(formDTO.getAreaCode());
//已经被使用的移除不显示
Iterator<NextAreaCodeResultDTO> iterator = allList.iterator();
while (iterator.hasNext()) {

51
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java

@ -431,21 +431,8 @@ public class AgencyServiceImpl implements AgencyService {
}
AddAgencyResultDTO resultDTO = new AddAgencyResultDTO();
resultDTO.setAreaCodeSwitch(formDTO.getAreaCodeSwitch());
CustomerAgencyEntity insertEntity=this.constructInsertEntity(formDTO,parent);
//判断areaCodeSwitch:open: 选择地区编码必填;closed: 无需选择地区编码
CustomerAgencyEntity insertEntity = ConvertUtils.sourceToTarget(formDTO, CustomerAgencyEntity.class);
insertEntity.setOrganizationName(formDTO.getAgencyName());
insertEntity.setTotalUser(NumConstant.ZERO);
insertEntity.setPid(parent.getId());
insertEntity.setCustomerId(parent.getCustomerId());
insertEntity.setParentAreaCode(parent.getAreaCode());
if (StringUtils.isBlank(parent.getPid()) || NumConstant.ZERO_STR.equals(parent.getPid())) {
//如果上级是根级组织
insertEntity.setPids(parent.getId());
insertEntity.setAllParentName(parent.getOrganizationName());
} else {
insertEntity.setPids(parent.getPids().concat(StrConstant.COLON).concat(parent.getId()));
insertEntity.setAllParentName(parent.getAllParentName().concat(StrConstant.HYPHEN).concat(parent.getOrganizationName()));
}
if (CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN.equals(formDTO.getAreaCodeSwitch())) {
//校验areaCode是否被使用过
if (!"other".equals(formDTO.getAreaCode())) {
@ -474,4 +461,40 @@ public class AgencyServiceImpl implements AgencyService {
return resultDTO;
}
private CustomerAgencyEntity constructInsertEntity(AddAgencyV2FormDTO formDTO, CustomerAgencyDTO parent) {
CustomerAgencyEntity insertEntity = ConvertUtils.sourceToTarget(formDTO, CustomerAgencyEntity.class);
insertEntity.setOrganizationName(formDTO.getAgencyName());
insertEntity.setTotalUser(NumConstant.ZERO);
insertEntity.setPid(parent.getId());
insertEntity.setCustomerId(parent.getCustomerId());
insertEntity.setParentAreaCode(parent.getAreaCode());
if (StringUtils.isBlank(parent.getPid()) || NumConstant.ZERO_STR.equals(parent.getPid())) {
//如果上级是根级组织
insertEntity.setPids(parent.getId());
insertEntity.setAllParentName(parent.getOrganizationName());
} else {
insertEntity.setPids(parent.getPids().concat(StrConstant.COLON).concat(parent.getId()));
insertEntity.setAllParentName(parent.getAllParentName().concat(StrConstant.HYPHEN).concat(parent.getOrganizationName()));
}
switch(parent.getLevel())
{
case CustomerAgencyConstant.PROVINCE_LEVEL:
insertEntity.setLevel(CustomerAgencyConstant.CITY_LEVEL);
break;
case CustomerAgencyConstant.CITY_LEVEL:
insertEntity.setLevel(CustomerAgencyConstant.DISTRICT);
break;
case CustomerAgencyConstant.DISTRICT:
insertEntity.setLevel(CustomerAgencyConstant.STREET_LEVEL);
break;
case CustomerAgencyConstant.STREET_LEVEL:
insertEntity.setLevel(CustomerAgencyConstant.COMMUNITY_LEVEL);
break;
default:
log.info("parent.getLevel()="+parent.getLevel());
break;
}
return insertEntity;
}
}
Loading…
Cancel
Save