Browse Source

Merge branch 'yantai_zhengwu_master' into dev

master
lichao 2 years ago
parent
commit
40d7bf6d77
  1. 100
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CommunityBuildingManagerServiceImpl.java
  2. 20
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java

100
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CommunityBuildingManagerServiceImpl.java

@ -361,7 +361,7 @@ public class CommunityBuildingManagerServiceImpl extends BaseServiceImpl<Communi
}
}
//删除小区缓存、楼栋缓存、单元缓存
redisUtils.deleteByPrex(redisKey);
redisUtils.deleteByPrex(redisKey+"*");
}
@ -401,12 +401,12 @@ public class CommunityBuildingManagerServiceImpl extends BaseServiceImpl<Communi
continue;
}
String gridId = gridMap.get(dto.getGridName());
entity.setGridId(gridId);
entity.setOrgIdPath(CustomerOrgRedis.getOrgIdPath(gridId, OrgTypeEnum.GRID.getCode()));
// 查询当前网格下的小区
// 所属小区
List<OptionResultDTO> viliageList =queryViliageList(customerId,staffId,agencyId,gridId,rediPrex);
Map<String, String> viliageMap = viliageList.stream().collect(Collectors.toMap(OptionResultDTO::getLabel, OptionResultDTO::getValue));
Map<String, String> viliageMap =queryViliageList(customerId,staffId,agencyId,gridId,rediPrex);
if (MapUtils.isEmpty(viliageMap) || !viliageMap.containsKey(dto.getViliageName()) || StringUtils.isBlank(viliageMap.get(dto.getViliageName()))) {
CommunityBuildingManagerImportExcelData.ErrorRow errorRow = ConvertUtils.sourceToTarget(dto, CommunityBuildingManagerImportExcelData.ErrorRow.class);
errorRow.setErrorInfo("小区不存在");
@ -419,8 +419,9 @@ public class CommunityBuildingManagerServiceImpl extends BaseServiceImpl<Communi
// 查询当前小区下的楼栋
// 所属楼栋
List<OptionResultDTO> buildingList=queryBuildingList(viliageId,rediPrex);
Map<String, String> buildingMap = buildingList.stream().collect(Collectors.toMap(OptionResultDTO::getLabel, OptionResultDTO::getValue));
// List<OptionResultDTO> buildingList=queryBuildingList(viliageId,rediPrex);
// Map<String, String> buildingMap = buildingList.stream().collect(Collectors.toMap(OptionResultDTO::getLabel, OptionResultDTO::getValue));
Map<String, String> buildingMap =queryBuildingList(viliageId,rediPrex);;
if (MapUtils.isEmpty(buildingMap) || !buildingMap.containsKey(dto.getBuildingName()) || StringUtils.isBlank(buildingMap.get(dto.getBuildingName()))) {
CommunityBuildingManagerImportExcelData.ErrorRow errorRow = ConvertUtils.sourceToTarget(dto, CommunityBuildingManagerImportExcelData.ErrorRow.class);
errorRow.setErrorInfo("楼栋不存在");
@ -434,8 +435,9 @@ public class CommunityBuildingManagerServiceImpl extends BaseServiceImpl<Communi
String unitId = "";
if (StringUtils.isNotBlank(dto.getUnitName())) {
// 查询楼栋下的单元列表
List<OptionResultDTO> unitList=queryUnitList(buildingId,rediPrex);
Map<String, String> unitMap = unitList.stream().collect(Collectors.toMap(OptionResultDTO::getLabel, OptionResultDTO::getValue));
// List<OptionResultDTO> unitList=queryUnitList(buildingId,rediPrex);
// Map<String, String> unitMap = unitList.stream().collect(Collectors.toMap(OptionResultDTO::getLabel, OptionResultDTO::getValue));
Map<String, String> unitMap = queryUnitList(buildingId, rediPrex);
if (MapUtils.isEmpty(unitMap) || !unitMap.containsKey(dto.getUnitName()) || StringUtils.isBlank(unitMap.get(dto.getUnitName()))) {
CommunityBuildingManagerImportExcelData.ErrorRow errorRow = ConvertUtils.sourceToTarget(dto, CommunityBuildingManagerImportExcelData.ErrorRow.class);
errorRow.setErrorInfo("单元不存在");
@ -450,7 +452,7 @@ public class CommunityBuildingManagerServiceImpl extends BaseServiceImpl<Communi
countQuery.eq(CommunityBuildingManagerEntity::getType, entity.getType())
.eq(CommunityBuildingManagerEntity::getBuildingId, buildingId)
.eq(StringUtils.isNotBlank(unitId), CommunityBuildingManagerEntity::getUnitId, unitId)
.ne(CommunityBuildingManagerEntity::getId, null);
.ne(StringUtils.isNotBlank(entity.getId()),CommunityBuildingManagerEntity::getId, entity.getId());
CommunityBuildingManagerEntity origin = baseDao.selectOne(countQuery);
if (null == origin) {
insertList.add(entity);
@ -476,51 +478,69 @@ public class CommunityBuildingManagerServiceImpl extends BaseServiceImpl<Communi
}
}
// 同步到ic_building
this.insertBatch(insertList);
this.updateBatchById(updateList);
SpringContextUtils.getBean(IcBuildingService.class).updateBuildingLeader(buildingUpdateList);
if(!CollectionUtils.isEmpty(insertList)){
this.insertBatch(insertList);
}
if(!CollectionUtils.isEmpty(updateList)){
this.updateBatchById(updateList);
}
if(!CollectionUtils.isEmpty(buildingUpdateList)){
SpringContextUtils.getBean(IcBuildingService.class).updateBuildingLeader(buildingUpdateList);
}
}
private List<OptionResultDTO> queryViliageList(String customerId, String staffId, String agencyId, String gridId, String rediPrex) {
private Map<String, String> queryViliageList(String customerId, String staffId, String agencyId, String gridId, String rediPrex) {
String redisKey = rediPrex.concat(StrConstant.COLON).concat("viliage_list").concat(StrConstant.COLON).concat(gridId);
List<OptionResultDTO> viliageList = redisUtils.lrange(redisKey, NumConstant.ZERO, NumConstant.ONE_NEG, OptionResultDTO.class);
if (!CollectionUtils.isEmpty(viliageList)) {
return viliageList;
Map<String, Object> viliageMap = redisUtils.hGetAll(redisKey);
if (MapUtils.isEmpty(viliageMap)) {
NeighborHoodOptionFormDTO neighborHoodOptionFormDTO = new NeighborHoodOptionFormDTO();
neighborHoodOptionFormDTO.setCustomerId(customerId);
neighborHoodOptionFormDTO.setStaffId(staffId);
neighborHoodOptionFormDTO.setAgencyId(agencyId);
neighborHoodOptionFormDTO.setGridId(gridId);
List<OptionResultDTO> resultList = SpringContextUtils.getBean(IcNeighborHoodService.class).queryNeighborHoodOptions(neighborHoodOptionFormDTO);
viliageMap = resultList.stream().collect(Collectors.toMap(OptionResultDTO::getLabel, OptionResultDTO::getValue));
// 有效时间1小时
redisUtils.hMSet(redisKey, viliageMap, RedisUtils.HOUR_ONE_EXPIRE);
}
NeighborHoodOptionFormDTO neighborHoodOptionFormDTO = new NeighborHoodOptionFormDTO();
neighborHoodOptionFormDTO.setCustomerId(customerId);
neighborHoodOptionFormDTO.setStaffId(staffId);
neighborHoodOptionFormDTO.setAgencyId(agencyId);
neighborHoodOptionFormDTO.setGridId(gridId);
List<OptionResultDTO> resultList = SpringContextUtils.getBean(IcNeighborHoodService.class).queryNeighborHoodOptions(neighborHoodOptionFormDTO);
// 有效时间1小时
redisUtils.leftPush(redisKey, resultList, RedisUtils.HOUR_ONE_EXPIRE);
return resultList;
Map<String, String> resultMap = new HashMap<>();
viliageMap.forEach((k, v) ->
resultMap.put(k, (String) v)
);
return resultMap;
}
private List<OptionResultDTO> queryBuildingList(String viliageId, String rediPrex) {
private Map<String, String> queryBuildingList(String viliageId, String rediPrex) {
String redisKey = rediPrex.concat(StrConstant.COLON).concat("building_List").concat(StrConstant.COLON).concat(viliageId);
List<OptionResultDTO> buildingList = redisUtils.lrange(redisKey, NumConstant.ZERO, NumConstant.ONE_NEG, OptionResultDTO.class);
if (!CollectionUtils.isEmpty(buildingList)) {
return buildingList;
Map<String, Object> buildingMap = redisUtils.hGetAll(redisKey);
if (MapUtils.isEmpty(buildingMap)) {
List<OptionResultDTO> resultList = SpringContextUtils.getBean(IcBuildingService.class).getBuildingOptions(viliageId);
buildingMap = resultList.stream().collect(Collectors.toMap(OptionResultDTO::getLabel, OptionResultDTO::getValue));
// 有效时间1小时
redisUtils.hMSet(redisKey, buildingMap, RedisUtils.HOUR_ONE_EXPIRE);
}
List<OptionResultDTO> resultList = SpringContextUtils.getBean(IcBuildingService.class).getBuildingOptions(viliageId);
// 有效时间1小时
redisUtils.leftPush(redisKey, resultList, RedisUtils.HOUR_ONE_EXPIRE);
return resultList;
Map<String, String> resultMap = new HashMap<>();
buildingMap.forEach((k, v) ->
resultMap.put(k, (String) v)
);
return resultMap;
}
private List<OptionResultDTO> queryUnitList(String buildingId, String rediPrex) {
private Map<String, String> queryUnitList(String buildingId, String rediPrex) {
String redisKey = rediPrex.concat(StrConstant.COLON).concat("unit_List").concat(StrConstant.COLON).concat(buildingId);
List<OptionResultDTO> unitList = redisUtils.lrange(redisKey, NumConstant.ZERO, NumConstant.ONE_NEG, OptionResultDTO.class);
if (!CollectionUtils.isEmpty(unitList)) {
return unitList;
Map<String, Object> unitMap = redisUtils.hGetAll(redisKey);
if (MapUtils.isEmpty(unitMap)) {
List<OptionResultDTO> resultList = SpringContextUtils.getBean(IcBuildingUnitService.class).getUnitOptions(buildingId);
unitMap = resultList.stream().collect(Collectors.toMap(OptionResultDTO::getLabel, OptionResultDTO::getValue));
// 有效时间1小时
redisUtils.hMSet(redisKey, unitMap, RedisUtils.HOUR_ONE_EXPIRE);
}
List<OptionResultDTO> resultList = SpringContextUtils.getBean(IcBuildingUnitService.class).getUnitOptions(buildingId);
// 有效时间1小时
redisUtils.leftPush(redisKey, resultList, RedisUtils.HOUR_ONE_EXPIRE);
return resultList;
Map<String, String> resultMap = new HashMap<>();
unitMap.forEach((k, v) ->
resultMap.put(k, (String) v)
);
return resultMap;
}

20
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java

@ -798,20 +798,20 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao
needUpdateList.forEach(
needUpdate->{
if (StringUtils.isNotBlank(needUpdate.getOpenTypeName())){
if (needUpdate.getOpenTypeName().equals("自然村")){
needUpdate.setOpenType("2");
if (StringUtils.isNotBlank(needUpdate.getViliageTypeName())){
if (needUpdate.getViliageTypeName().equals("自然村")){
needUpdate.setViliageType("2");
}
if (needUpdate.getOpenTypeName().equals("住宅小区")){
needUpdate.setOpenType("1");
if (needUpdate.getViliageTypeName().equals("住宅小区")){
needUpdate.setViliageType("1");
}
}
if (StringUtils.isNotBlank(needUpdate.getViliageTypeName())){
if (needUpdate.getViliageTypeName().equals("封闭式")){
needUpdate.setViliageTypeName("1");
if (StringUtils.isNotBlank(needUpdate.getOpenTypeName())){
if (needUpdate.getOpenTypeName().equals("封闭式")){
needUpdate.setOpenType("1");
}
if (needUpdate.getViliageTypeName().equals("开放式")){
needUpdate.setViliageTypeName("2");
if (needUpdate.getOpenTypeName().equals("开放式")){
needUpdate.setOpenType("2");
}
}
});

Loading…
Cancel
Save