|
|
@ -92,10 +92,10 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private EpmetAdminOpenFeignClient adminOpenFeignClient; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
private LoginUserUtil loginUserUtil; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<IcResiUserDTO> page(Map<String, Object> params) { |
|
|
|
IPage<IcResiUserEntity> page = baseDao.selectPage( |
|
|
@ -162,6 +162,28 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void add(TokenDto tokenDto, List<IcResiUserFormDTO> formDTO) { |
|
|
|
//循环自动拼接sql语句,往多个表新增数据
|
|
|
|
//0.校验必填字段是否为空
|
|
|
|
Result<List<ColumnTableNameResultDTO>> resultList = operCustomizeOpenFeignClient.getMustColumn(tokenDto.getCustomerId()); |
|
|
|
if (resultList.success() && null != resultList.getData()) { |
|
|
|
StringBuffer str = new StringBuffer(""); |
|
|
|
formDTO.forEach(f -> { |
|
|
|
resultList.getData().forEach(l -> { |
|
|
|
if (f.getTableName().equals(l.getTableName())) { |
|
|
|
f.getList().forEach(map -> { |
|
|
|
if (!map.containsKey(l.getColumnName())) { |
|
|
|
str.append(str.length() < NumConstant.ONE ? l.getLabel() : "、" + l.getLabel()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (str.length() > NumConstant.ZERO ) { |
|
|
|
throw new RenException(String.format("新增居民信息,必要字段值为空,%s值为空", str)); |
|
|
|
} |
|
|
|
} else { |
|
|
|
throw new RenException(String.format("新增居民信息-根据客户Id查询必填信息失败,customerId->%s", tokenDto.getCustomerId())); |
|
|
|
} |
|
|
|
|
|
|
|
//1.先往主表新增数据
|
|
|
|
//主表Id
|
|
|
|
String resiUserId = UUID.randomUUID().toString().replaceAll("-", ""); |
|
|
@ -293,6 +315,12 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<Map<String, Object>> pageResiMap(IcResiUserPageFormDTO formDTO) { |
|
|
|
CustomerStaffInfoCacheResult staffInfoCacheResult=CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(),formDTO.getStaffId()); |
|
|
|
String staffOrgPath=StrConstant.EPMETY_STR; |
|
|
|
if(StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds())&& !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())){ |
|
|
|
staffOrgPath=staffInfoCacheResult.getAgencyPIds().concat(":").concat(staffInfoCacheResult.getAgencyId()); |
|
|
|
} |
|
|
|
|
|
|
|
// 查询列表展示项,如果没有,直接返回
|
|
|
|
CustomerFormQueryDTO queryDTO1=new CustomerFormQueryDTO(); |
|
|
|
queryDTO1.setCustomerId(formDTO.getCustomerId()); |
|
|
@ -309,18 +337,22 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
PageInfo<Map<String, Object>> pageInfo=new PageInfo<>(); |
|
|
|
if (null == formDTO.getPageFlag()||formDTO.getPageFlag()) { |
|
|
|
//分页
|
|
|
|
String finalStaffOrgPath = staffOrgPath; |
|
|
|
pageInfo= PageHelper.startPage(formDTO.getPageNo(), |
|
|
|
formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.selectListResiMap(formDTO.getCustomerId(), |
|
|
|
formDTO.getFormCode(), |
|
|
|
formDTO.getConditions(), |
|
|
|
resultColumns, |
|
|
|
subTables)); |
|
|
|
subTables, |
|
|
|
staffInfoCacheResult.getAgencyId(), finalStaffOrgPath |
|
|
|
)); |
|
|
|
}else{ |
|
|
|
List<Map<String,Object>> list=baseDao.selectListResiMap(formDTO.getCustomerId(), |
|
|
|
formDTO.getFormCode(), |
|
|
|
formDTO.getConditions(), |
|
|
|
resultColumns, |
|
|
|
subTables); |
|
|
|
subTables,staffInfoCacheResult.getAgencyId(), |
|
|
|
staffOrgPath); |
|
|
|
pageInfo.setTotal(CollectionUtils.isEmpty(list)?NumConstant.ZERO:list.size()); |
|
|
|
pageInfo.setList(list); |
|
|
|
} |
|
|
@ -380,8 +412,9 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
} else if (HouseTypeEnum.BIESHU.getCode().equals(houseType)) { |
|
|
|
resultMap.put(UserConstant.HOUSE_TYPE_KEY, HouseTypeEnum.BIESHU.getName()); |
|
|
|
} |
|
|
|
|
|
|
|
resultMap.put(UserConstant.HOME_ID, neighBorName.concat(buildName).concat(unitName).concat(doorName)); |
|
|
|
|
|
|
|
resultMap.put("CATEGORY_NAME",queryUserDemandName(formDTO.getCustomerId(),(String) resultMap.get("icResiUserId"))); |
|
|
|
} |
|
|
|
|
|
|
|
if (resultMap.containsKey(UserConstant.GENDER)) { |
|
|
@ -399,6 +432,24 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
return new PageData<>(pageInfo.getList(), pageInfo.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
private String queryUserDemandName(String customerId,String icResiUserId) { |
|
|
|
Set<String> demandCodePath=baseDao.selectUserDemandCode(icResiUserId); |
|
|
|
if(CollectionUtils.isEmpty(demandCodePath)){ |
|
|
|
return StrConstant.EPMETY_STR; |
|
|
|
} |
|
|
|
Set<String> codeSet=new HashSet<>(); |
|
|
|
for(String codePath:demandCodePath){ |
|
|
|
if(codePath.contains(StrConstant.COMMA)){ |
|
|
|
String[] codeAtt=codePath.split(StrConstant.COMMA); |
|
|
|
codeSet.add(codeAtt[codeAtt.length-1]); |
|
|
|
}else{ |
|
|
|
codeSet.add(codePath); |
|
|
|
} |
|
|
|
} |
|
|
|
String demandName=baseDao.selectCategoryNames(customerId,codeSet); |
|
|
|
return demandName; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 编辑页面,显示居民信息详情 |
|
|
|
* |
|
|
@ -550,11 +601,11 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
* @param currUserAgencyId 当前用户的组织id |
|
|
|
* @param checkBoxOptionColumnIdxAndLabel 复选框的列号&label中文 |
|
|
|
*/ |
|
|
|
private void persist(Map<String, ColumnWrapper> headerColumnWrapper, List<Map<Integer, String>> dataRows, |
|
|
|
private void persist(Map<String, ColumnWrapper> headerColumnWrapper, List<Map<Integer, String>> dataRows, |
|
|
|
String currUserAgencyId, Map<Integer, String> checkBoxOptionColumnIdxAndLabel, String tableName, |
|
|
|
String currUserAgencyPids, String currentUserId) { |
|
|
|
for (Map<Integer, String> row : dataRows) { |
|
|
|
|
|
|
|
|
|
|
|
// 当前行的列们
|
|
|
|
// List<ColumnWrapper> columnsOfCurrRow = new ArrayList<>();
|
|
|
|
|
|
|
@ -610,7 +661,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
columnAndValues.put("IS_UNITED_FRONT", "0"); |
|
|
|
columnAndValues.put("IS_VETERANS", "0"); |
|
|
|
columnAndValues.put("IS_VOLUNTEER", "0"); |
|
|
|
|
|
|
|
|
|
|
|
columnAndValues.put("AGENCY_ID", currUserAgencyId); |
|
|
|
columnAndValues.put("PIDS", currUserAgencyPids); |
|
|
|
columnAndValues.put("CUSTOMER_ID", loginUserUtil.getCurrentCustomerId()); |
|
|
@ -623,7 +674,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
// });
|
|
|
|
|
|
|
|
// System.out.println("-------------------");
|
|
|
|
|
|
|
|
|
|
|
|
baseDao.add(tableName, columnAndValues); |
|
|
|
} |
|
|
|
} |
|
|
@ -780,7 +831,9 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
cascadeItemId = uriParts[1]; |
|
|
|
|
|
|
|
// 根据uri上的id,找到关联的itemid,从而找到关联的item的值
|
|
|
|
cascadeItemColumnWrapper = columnWrappers.get(cascadeItemId); |
|
|
|
if (columnWrappers != null){ |
|
|
|
cascadeItemColumnWrapper = columnWrappers.get(cascadeItemId); |
|
|
|
} |
|
|
|
} else { |
|
|
|
pureUri = fullUri; |
|
|
|
} |
|
|
@ -991,9 +1044,18 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public PersonDataResultDTO personData(PersonDataFormDTO formDTO) { |
|
|
|
baseDao.personData(formDTO.getUserId()); |
|
|
|
PersonDataResultDTO personData = baseDao.personData(formDTO.getUserId()); |
|
|
|
if (null == personData){ |
|
|
|
return new PersonDataResultDTO(); |
|
|
|
} |
|
|
|
// 房屋信息查询
|
|
|
|
Result<List<String>> listResult = govOrgOpenFeignClient.selectHouseInfoByIdCard(personData.getIdCard()); |
|
|
|
if (!listResult.success()){ |
|
|
|
throw new RenException("查询房屋信息失败"); |
|
|
|
} |
|
|
|
personData.setHouseInfo(listResult.getData()); |
|
|
|
// TODO
|
|
|
|
return null; |
|
|
|
return personData; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -1039,17 +1101,45 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
Map<String, Map<String, Object>> result = new LinkedHashMap<>(); |
|
|
|
mapList.stream().filter(Objects::nonNull).forEach(map -> { |
|
|
|
String resiId = (String) map.getOrDefault(UserConstant.IC_RESI_USER, ""); |
|
|
|
formItemMap.forEach((k, v)->{ |
|
|
|
for (Map.Entry<String, FormItem> e : formItemMap.entrySet()) { |
|
|
|
String k = e.getKey(); |
|
|
|
FormItem v = e.getValue(); |
|
|
|
Object temp = map.get(k); |
|
|
|
if (temp != null){ |
|
|
|
if (v.getOptionSourceType().equals("remote")){ |
|
|
|
//todo 获取 options
|
|
|
|
if (temp != null) { |
|
|
|
if (v.getOptionSourceType().equals("remote")) { |
|
|
|
try { |
|
|
|
//todo 获取 options
|
|
|
|
Map<String, String> stringMap = listRemoteOptions(new HashMap<>(), v.getOptionSourceValue(), null); |
|
|
|
System.out.println("======remote:"+v.getLabel()+" "+JSON.toJSONString(stringMap)); |
|
|
|
if ("checkbox".equals(v.getItemType())) { |
|
|
|
stringMap.forEach((label, value) -> map.put(value, temp.toString().contains(value) ? "是" : "否")); |
|
|
|
} else if ("select".equals(v.getItemType())) { |
|
|
|
|
|
|
|
stringMap.forEach((label,value)->{ |
|
|
|
if (temp.toString().equals(value)){ |
|
|
|
map.put(k, label); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} catch (Exception ex) { |
|
|
|
log.warn("listRemoteOptions url:{}",v.getOptionSourceValue()); |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
if ("checkbox".equals(v.getItemType())) { |
|
|
|
v.getOptions().forEach(optionDTO -> { |
|
|
|
map.put(optionDTO.getValue(), temp.toString().contains(optionDTO.getValue()) ? "是" : "否"); |
|
|
|
}); |
|
|
|
} else if ("select".equals(v.getItemType())) { |
|
|
|
v.getOptions().forEach(optionDTO -> { |
|
|
|
if (optionDTO.getLabel().equals(temp.toString())){ |
|
|
|
map.put(k, optionDTO.getLabel()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
v.getOptions().forEach(optionDTO -> { |
|
|
|
map.put(optionDTO.getValue(),temp.toString().contains(optionDTO.getValue())?"是":"否"); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
if ("ic_resi_user".equals(baseTableName)) { |
|
|
|
resiId = (String) map.get("ID"); |
|
|
|
} |
|
|
@ -1080,6 +1170,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
map.put("VILLAGE_NAME", houseInfoDTO.getNeighborHoodName()); |
|
|
|
map.put("BUILD_NAME", houseInfoDTO.getBuildingName()); |
|
|
|
map.put("HOME_ID", houseInfoDTO.getDoorName()); |
|
|
|
map.put("UNIT_ID", houseInfoDTO.getUnitName()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|