|
|
@ -56,12 +56,16 @@ import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.dto.result.demand.IcResiDemandDictDTO; |
|
|
|
import com.epmet.dto.result.demand.OptionDTO; |
|
|
|
import com.epmet.entity.*; |
|
|
|
import com.epmet.excel.support.ExportResiUserItemDTO; |
|
|
|
import com.epmet.feign.*; |
|
|
|
import com.epmet.opendata.dto.form.GetResidentDetailByIdCardFormDTO; |
|
|
|
import com.epmet.opendata.dto.form.SaveCaResidentUserFormDTO; |
|
|
|
import com.epmet.opendata.dto.result.ResidentByIdCardResultDTO; |
|
|
|
import com.epmet.opendata.feign.GuardarDatosFeignClient; |
|
|
|
import com.epmet.resi.partymember.feign.ResiPartyMemberOpenFeignClient; |
|
|
|
import com.epmet.service.*; |
|
|
|
import com.epmet.dto.result.demand.OptionDTO; |
|
|
|
import com.github.pagehelper.Page; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
@ -80,9 +84,10 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.sql.Date; |
|
|
|
|
|
|
|
import java.sql.Timestamp; |
|
|
|
import java.text.NumberFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
@ -139,9 +144,13 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
private IcPartyMemberDao icPartyMemberDao; |
|
|
|
@Resource |
|
|
|
private IcVolunteerDao icVolunteerDao; |
|
|
|
@Autowired |
|
|
|
private GuardarDatosFeignClient guardarDatosFeignClient; |
|
|
|
@Resource |
|
|
|
private ResiPartyMemberOpenFeignClient resiPartyMemberOpenFeignClient; |
|
|
|
@Resource |
|
|
|
private GovOrgOpenFeignClient getGovOrgOpenFeignClient; |
|
|
|
@Resource |
|
|
|
private EpmetHeartOpenFeignClient epmetHeartOpenFeignClient; |
|
|
|
@Resource |
|
|
|
private UserBaseInfoDao userBaseInfoDao; |
|
|
@ -194,7 +203,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
if (str.length() > NumConstant.ZERO ) { |
|
|
|
if (str.length() > NumConstant.ZERO) { |
|
|
|
String errorMsg = String.format("新增居民信息,必要字段值为空,%s值为空", str); |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg); |
|
|
|
} |
|
|
@ -208,7 +217,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
String name = ""; |
|
|
|
LinkedHashMap<String, String> map = new LinkedHashMap<>(); |
|
|
|
com.epmet.resi.partymember.dto.partymember.IcPartyMemberDTO partyMemberDTO = new com.epmet.resi.partymember.dto.partymember.IcPartyMemberDTO(); |
|
|
|
Map<String, List<LinkedHashMap<String,String>>> formMap = formDTO.stream().collect(Collectors.toMap(IcResiUserFormDTO::getTableName, IcResiUserFormDTO::getList)); |
|
|
|
Map<String, List<LinkedHashMap<String, String>>> formMap = formDTO.stream().collect(Collectors.toMap(IcResiUserFormDTO::getTableName, IcResiUserFormDTO::getList)); |
|
|
|
boolean isDyzxh = false; |
|
|
|
//判断是否是党员中心户
|
|
|
|
if (formMap.containsKey("ic_party_member")) { |
|
|
@ -326,13 +335,13 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
//2022.05.18 start zhaoqf 党员信息同步
|
|
|
|
if ("ic_party_member".equals(d.getTableName())) { |
|
|
|
for (LinkedHashMap<String, String> hash : d.getList()) { |
|
|
|
partyMemberDTO.setRdsj(hash.get("RDSJ")); |
|
|
|
partyMemberDTO.setSszb(hash.get("SSZB")); |
|
|
|
partyMemberDTO.setIsLd(hash.get("IS_LD")); |
|
|
|
partyMemberDTO.setLdzh(hash.get("LDZH")); |
|
|
|
partyMemberDTO.setPartyZw(hash.get("PARTY_ZW")); |
|
|
|
partyMemberDTO.setIsTx(hash.get("IS_TX")); |
|
|
|
partyMemberDTO.setIsDyzxh(hash.get("IS_DYZXH")); |
|
|
|
partyMemberDTO.setRdsj(hash.get("RDSJ")); |
|
|
|
partyMemberDTO.setSszb(hash.get("SSZB")); |
|
|
|
partyMemberDTO.setIsLd(hash.get("IS_LD")); |
|
|
|
partyMemberDTO.setLdzh(hash.get("LDZH")); |
|
|
|
partyMemberDTO.setPartyZw(hash.get("PARTY_ZW")); |
|
|
|
partyMemberDTO.setIsTx(hash.get("IS_TX")); |
|
|
|
partyMemberDTO.setIsDyzxh(hash.get("IS_DYZXH")); |
|
|
|
} |
|
|
|
} |
|
|
|
if ("ic_volunteer".equals(d.getTableName())) { |
|
|
@ -349,7 +358,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
} |
|
|
|
} |
|
|
|
//3.变更记录表和变更记录明细表新增数据
|
|
|
|
saveUserChangeRecord(tokenDto,map,resiUserId,name); |
|
|
|
saveUserChangeRecord(tokenDto, map, resiUserId, name); |
|
|
|
|
|
|
|
return resiUserId; |
|
|
|
|
|
|
@ -437,7 +446,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
String resiUserId = ""; |
|
|
|
LinkedHashMap<String, String> map = new LinkedHashMap<>(); |
|
|
|
com.epmet.resi.partymember.dto.partymember.IcPartyMemberDTO partyMemberDTO = new com.epmet.resi.partymember.dto.partymember.IcPartyMemberDTO(); |
|
|
|
Map<String, List<LinkedHashMap<String,String>>> formMap = formDTO.stream().collect(Collectors.toMap(IcResiUserFormDTO::getTableName, IcResiUserFormDTO::getList)); |
|
|
|
Map<String, List<LinkedHashMap<String, String>>> formMap = formDTO.stream().collect(Collectors.toMap(IcResiUserFormDTO::getTableName, IcResiUserFormDTO::getList)); |
|
|
|
boolean isDyzxh = false; |
|
|
|
//判断是否是党员中心户
|
|
|
|
if (formMap.containsKey("ic_party_member")) { |
|
|
@ -498,7 +507,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
} |
|
|
|
} |
|
|
|
if ((map.containsKey("IS_PARTY") && NumConstant.ONE_STR.equals(map.get("IS_PARTY"))) |
|
|
|
|| (!map.containsKey("IS_PARTY") && NumConstant.ONE_STR.equals(icResiUser.getIsParty()))) { |
|
|
|
|| (!map.containsKey("IS_PARTY") && NumConstant.ONE_STR.equals(icResiUser.getIsParty()))) { |
|
|
|
partyMemberDTO.setCustomerId(tokenDto.getCustomerId()); |
|
|
|
partyMemberDTO.setAgencyId(icResiUser.getAgencyId()); |
|
|
|
partyMemberDTO.setAgencyPids(icResiUser.getPids()); |
|
|
@ -745,13 +754,6 @@ 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; |
|
|
|
if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) { |
|
|
|
staffOrgPath = staffInfoCacheResult.getAgencyPIds().concat(":").concat(staffInfoCacheResult.getAgencyId()); |
|
|
|
} else { |
|
|
|
staffOrgPath = staffInfoCacheResult.getAgencyId(); |
|
|
|
} |
|
|
|
|
|
|
|
// 查询列表展示项,如果没有,直接返回
|
|
|
|
CustomerFormQueryDTO queryDTO1 = new CustomerFormQueryDTO(); |
|
|
@ -765,7 +767,36 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
List<IcFormResColumnDTO> resultColumns = resultColumnRes.getData(); |
|
|
|
// 查询结果列对应的表:
|
|
|
|
Set<String> resultColumnTables = resultColumns.stream().map(IcFormResColumnDTO::getTableName).collect(Collectors.toSet()); |
|
|
|
List<String> queryAgencyIdList = formDTO.getConditions().stream() |
|
|
|
.filter(o -> IcResiUserConstant.IC_RESI_USER.equals(o.getTableName()) && "AGENCY_ID".equals(o.getColumnName())) |
|
|
|
.flatMap(o -> o.getColumnValue().stream()).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//添加数据权限
|
|
|
|
String staffOrgPath; |
|
|
|
String agencyId; |
|
|
|
//如果查询条件中 有居民表的agencyId 则匹配查询该组织下的 数据
|
|
|
|
if (queryAgencyIdList.isEmpty()){ |
|
|
|
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); |
|
|
|
agencyId = staffInfoCacheResult.getAgencyId(); |
|
|
|
if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) { |
|
|
|
staffOrgPath = staffInfoCacheResult.getAgencyPIds().concat(":").concat(staffInfoCacheResult.getAgencyId()); |
|
|
|
} else { |
|
|
|
staffOrgPath = staffInfoCacheResult.getAgencyId(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
formDTO.getConditions().removeIf(o->IcResiUserConstant.IC_RESI_USER.equals(o.getTableName()) && "AGENCY_ID".equals(o.getColumnName())); |
|
|
|
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(queryAgencyIdList.get(NumConstant.ZERO)); |
|
|
|
if (agencyInfo == null){ |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"获取组织信息失败"); |
|
|
|
} |
|
|
|
agencyId = agencyInfo.getId(); |
|
|
|
staffOrgPath = agencyInfo.getPids(); |
|
|
|
if (StringUtils.isBlank(staffOrgPath)){ |
|
|
|
staffOrgPath = agencyId; |
|
|
|
}else{ |
|
|
|
staffOrgPath = staffOrgPath+StrConstant.COLON+agencyInfo.getId(); |
|
|
|
} |
|
|
|
} |
|
|
|
// 查询列表展示项需要用到哪些子表
|
|
|
|
Result<List<SubTableJoinDTO>> subTablesRes = operCustomizeOpenFeignClient.querySubTables(queryDTO1); |
|
|
|
List<SubTableJoinDTO> subTables = subTablesRes.getData(); |
|
|
@ -778,20 +809,20 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
tables.addAll(resultColumnTables); |
|
|
|
// log.info("2、查询条件+查询列对应的tables并集去重:"+ JSON.toJSONString(tables,true));
|
|
|
|
//最终关联的子表对应的sql:
|
|
|
|
List<String> finalSubTables =new ArrayList<>(); |
|
|
|
List<String> finalSubTables = new ArrayList<>(); |
|
|
|
//groupBy用到的表
|
|
|
|
Set<String> groupByTables=new HashSet<>(); |
|
|
|
subTables.forEach(subTable->{ |
|
|
|
if(tables.contains(subTable.getTableName())){ |
|
|
|
Set<String> groupByTables = new HashSet<>(); |
|
|
|
subTables.forEach(subTable -> { |
|
|
|
if (tables.contains(subTable.getTableName())) { |
|
|
|
finalSubTables.add(subTable.getJoinTableSql()); |
|
|
|
if(subTable.getSupportAdd()){ |
|
|
|
if (subTable.getSupportAdd()) { |
|
|
|
groupByTables.add(subTable.getTableName()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
PageInfo<Map<String, Object>> pageInfo=new PageInfo<>(); |
|
|
|
if (null == formDTO.getIsPage()||formDTO.getIsPage()) { |
|
|
|
PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(); |
|
|
|
if (null == formDTO.getIsPage() || formDTO.getIsPage()) { |
|
|
|
//分页
|
|
|
|
String finalStaffOrgPath = staffOrgPath; |
|
|
|
pageInfo = PageHelper.startPage(formDTO.getPageNo(), |
|
|
@ -800,19 +831,19 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
formDTO.getConditions(), |
|
|
|
resultColumns, |
|
|
|
finalSubTables, |
|
|
|
staffInfoCacheResult.getAgencyId(), finalStaffOrgPath,null, formDTO.getKeyword(), |
|
|
|
agencyId, finalStaffOrgPath,null, formDTO.getKeyword(), |
|
|
|
groupByTables)); |
|
|
|
}else{ |
|
|
|
List<Map<String,Object>> list=baseDao.selectListResiMap(formDTO.getCustomerId(), |
|
|
|
} else { |
|
|
|
List<Map<String, Object>> list = baseDao.selectListResiMap(formDTO.getCustomerId(), |
|
|
|
formDTO.getFormCode(), |
|
|
|
formDTO.getConditions(), |
|
|
|
resultColumns, |
|
|
|
finalSubTables, |
|
|
|
staffInfoCacheResult.getAgencyId(), |
|
|
|
agencyId, |
|
|
|
staffOrgPath,null, |
|
|
|
formDTO.getKeyword(), |
|
|
|
groupByTables); |
|
|
|
pageInfo.setTotal(CollectionUtils.isEmpty(list)?NumConstant.ZERO:list.size()); |
|
|
|
pageInfo.setTotal(CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size()); |
|
|
|
pageInfo.setList(list); |
|
|
|
} |
|
|
|
|
|
|
@ -910,8 +941,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
if (CollectionUtils.isEmpty(demandCodePath)) { |
|
|
|
return StrConstant.EPMETY_STR; |
|
|
|
} |
|
|
|
Set<String> nameList=new HashSet<>(); |
|
|
|
for(String codePath:demandCodePath){ |
|
|
|
Set<String> nameList = new HashSet<>(); |
|
|
|
for (String codePath : demandCodePath) { |
|
|
|
if (StringUtils.isNotBlank(codePath) && codePath.contains(StrConstant.COMMA)) { |
|
|
|
String[] codeAtt = codePath.split(StrConstant.COMMA); |
|
|
|
String code = codeAtt[codeAtt.length - 1]; |
|
|
@ -973,48 +1004,48 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<Map<String,Object>> dynamicQuery(String customerId, |
|
|
|
String formCode, |
|
|
|
String resultTableName, |
|
|
|
List<ResiUserQueryValueDTO> conditions, |
|
|
|
String currentStaffAgencyId, |
|
|
|
String staffOrgPath){ |
|
|
|
public List<Map<String, Object>> dynamicQuery(String customerId, |
|
|
|
String formCode, |
|
|
|
String resultTableName, |
|
|
|
List<ResiUserQueryValueDTO> conditions, |
|
|
|
String currentStaffAgencyId, |
|
|
|
String staffOrgPath) { |
|
|
|
// List<String> finalSubTables = getFinalSubables(customerId, formCode, resultTableName, conditions);
|
|
|
|
Map<String,List<String>> map=getFinalSubables(customerId, formCode, resultTableName, conditions, null); |
|
|
|
return baseDao.dynamicQuery(customerId,resultTableName,conditions,map.get("finalSubTables"), null, currentStaffAgencyId,staffOrgPath,map.get("groupByTables")); |
|
|
|
Map<String, List<String>> map = getFinalSubables(customerId, formCode, resultTableName, conditions, null); |
|
|
|
return baseDao.dynamicQuery(customerId, resultTableName, conditions, map.get("finalSubTables"), null, currentStaffAgencyId, staffOrgPath, map.get("groupByTables")); |
|
|
|
} |
|
|
|
|
|
|
|
@NotNull |
|
|
|
public Map<String,List<String>> getFinalSubables(String customerId, String formCode, String resultTableName, List<ResiUserQueryValueDTO> conditions, List<String> exportNeedTableList) { |
|
|
|
Map<String,List<String>> map=new HashMap<>(); |
|
|
|
CustomerFormQueryDTO queryDTO=new CustomerFormQueryDTO(); |
|
|
|
public Map<String, List<String>> getFinalSubables(String customerId, String formCode, String resultTableName, List<ResiUserQueryValueDTO> conditions, List<String> exportNeedTableList) { |
|
|
|
Map<String, List<String>> map = new HashMap<>(); |
|
|
|
CustomerFormQueryDTO queryDTO = new CustomerFormQueryDTO(); |
|
|
|
queryDTO.setCustomerId(customerId); |
|
|
|
queryDTO.setFormCode(formCode); |
|
|
|
//所有的子表
|
|
|
|
Result<List<SubTableJoinDTO>> subTablesRes=operCustomizeOpenFeignClient.querySubTables(queryDTO); |
|
|
|
Result<List<SubTableJoinDTO>> subTablesRes = operCustomizeOpenFeignClient.querySubTables(queryDTO); |
|
|
|
|
|
|
|
List<SubTableJoinDTO> subTables =subTablesRes.getData(); |
|
|
|
List<SubTableJoinDTO> subTables = subTablesRes.getData(); |
|
|
|
// log.info("1、所有的子表subTables:"+JSON.toJSONString(subTables,true));
|
|
|
|
//关联哪些子表:查询条件用到的表名+查询的列对应的表 并集去重
|
|
|
|
Set<String> tables = conditions.stream().map(ResiUserQueryValueDTO::getTableName).collect(Collectors.toSet()); |
|
|
|
tables.add(resultTableName); |
|
|
|
if (CollectionUtils.isNotEmpty(exportNeedTableList)){ |
|
|
|
if (CollectionUtils.isNotEmpty(exportNeedTableList)) { |
|
|
|
tables.addAll(exportNeedTableList); |
|
|
|
} |
|
|
|
// log.info("2、查询条件+查询列对应的tables并集去重:"+ JSON.toJSONString(tables,true));
|
|
|
|
//最终关联的子表对应的sql:
|
|
|
|
List<String> finalSubTables =new ArrayList<>(); |
|
|
|
List<String> finalSubTables = new ArrayList<>(); |
|
|
|
//groupBy用到的表
|
|
|
|
Set<String> groupByTables=new HashSet<>(); |
|
|
|
subTables.forEach(subTable->{ |
|
|
|
if(tables.contains(subTable.getTableName())){ |
|
|
|
Set<String> groupByTables = new HashSet<>(); |
|
|
|
subTables.forEach(subTable -> { |
|
|
|
if (tables.contains(subTable.getTableName())) { |
|
|
|
finalSubTables.add(subTable.getJoinTableSql()); |
|
|
|
if(subTable.getSupportAdd()){ |
|
|
|
if (subTable.getSupportAdd()) { |
|
|
|
groupByTables.add(subTable.getTableName()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
map.put("finalSubTables",finalSubTables); |
|
|
|
map.put("finalSubTables", finalSubTables); |
|
|
|
map.put("groupByTables", new ArrayList<>(groupByTables)); |
|
|
|
return map; |
|
|
|
} |
|
|
@ -1126,7 +1157,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
formDTO.getLevel(), |
|
|
|
formDTO.getId(), |
|
|
|
staffInfo.getAgencyId(), |
|
|
|
no,formDTO.getCustomerId())); |
|
|
|
no, formDTO.getCustomerId())); |
|
|
|
List<SearchByNameResultDTO> result = pageInfo.getList(); |
|
|
|
if (CollectionUtils.isEmpty(result)) { |
|
|
|
return new PageData<>(new ArrayList<>(), pageInfo.getTotal()); |
|
|
@ -1581,13 +1612,13 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
list = baseDao.vaccineList(formDTO); |
|
|
|
} |
|
|
|
Set<String> homeIds = list.stream().filter(m -> StringUtils.isNotBlank(m.getIdCard())).map(m -> m.getHomeId()).distinct().collect(Collectors.toSet()); |
|
|
|
if (CollectionUtils.isNotEmpty(homeIds)){ |
|
|
|
if (CollectionUtils.isNotEmpty(homeIds)) { |
|
|
|
Result<List<HouseInfoDTO>> houseInfoRes = govOrgOpenFeignClient.queryListHouseInfo(homeIds, formDTO.getCustomerId()); |
|
|
|
if (!houseInfoRes.success()){ |
|
|
|
if (!houseInfoRes.success()) { |
|
|
|
throw new EpmetException("查询居民所属房屋失败..."); |
|
|
|
} |
|
|
|
if (CollectionUtils.isNotEmpty(houseInfoRes.getData())){ |
|
|
|
list.forEach(l -> houseInfoRes.getData().stream().filter( h -> h.getHomeId().equals(l.getHomeId())).forEach(h -> l.setHouseName(h.getAllName()))); |
|
|
|
if (CollectionUtils.isNotEmpty(houseInfoRes.getData())) { |
|
|
|
list.forEach(l -> houseInfoRes.getData().stream().filter(h -> h.getHomeId().equals(l.getHomeId())).forEach(h -> l.setHouseName(h.getAllName()))); |
|
|
|
} |
|
|
|
} |
|
|
|
PageInfo<EpidemicPreventionResultDTO> pageInfo = new PageInfo<>(list); |
|
|
@ -1774,7 +1805,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
return new PageData<>(list, pageInfo.getTotal()); |
|
|
|
} |
|
|
|
List<PartyMemberAgeResultDTO> list = baseDao.getPartyMemberAgeList(formDTO.getOrgType(), formDTO.getOrgId(), formDTO.getCode()); |
|
|
|
return new PageData<>(list, null == list?NumConstant.ZERO:list.size()); |
|
|
|
return new PageData<>(list, null == list ? NumConstant.ZERO : list.size()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -1849,7 +1880,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
item.setEducation(null == mapResult.getData().get(item.getEducation()) ? "" : mapResult.getData().get(item.getEducation())); |
|
|
|
}); |
|
|
|
} |
|
|
|
return new PageData<>(list, null == list?NumConstant.ZERO:list.size()); |
|
|
|
return new PageData<>(list, null == list ? NumConstant.ZERO : list.size()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -2028,7 +2059,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
LambdaQueryWrapper<IcResiUserEntity> lqw = new LambdaQueryWrapper<>(); |
|
|
|
lqw.eq(IcResiUserEntity::getCustomerId, customerId) |
|
|
|
.eq(IcResiUserEntity::getHomeId, homeId) |
|
|
|
.eq(IcResiUserEntity::getYhzgx,RelationshipEnum.SELF.getCode()) |
|
|
|
.eq(IcResiUserEntity::getYhzgx, RelationshipEnum.SELF.getCode()) |
|
|
|
.select( |
|
|
|
IcResiUserEntity::getId, |
|
|
|
IcResiUserEntity::getName |
|
|
@ -2079,17 +2110,13 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public List<HouseIcResiUserResultDTO> getResiUserGroupHomeId(RentTenantDataFormDTO formDTO) { |
|
|
|
//如果是组织 且非顶级组织 则利用pids 查询 本级及下级
|
|
|
|
if (StringUtils.isNotBlank(formDTO.getAgencyId())){ |
|
|
|
if (StringUtils.isNotBlank(formDTO.getAgencyId())) { |
|
|
|
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(formDTO.getAgencyId()); |
|
|
|
if (agencyInfo == null){ |
|
|
|
log.warn("getResiUserGroupHomeId agencyId:{} is not exist",formDTO.getAgencyId()); |
|
|
|
if (agencyInfo == null) { |
|
|
|
log.warn("getResiUserGroupHomeId agencyId:{} is not exist", formDTO.getAgencyId()); |
|
|
|
return null; |
|
|
|
} |
|
|
|
if (!NumConstant.ZERO_STR.equals(agencyInfo.getPid())) { |
|
|
@ -2099,35 +2126,35 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
} |
|
|
|
|
|
|
|
Page<HouseIcResiUserResultDTO> listPage = PageHelper |
|
|
|
.startPage(formDTO.getPageNo(),formDTO.getPageSize(),formDTO.getIsPage()) |
|
|
|
.doSelectPage(()->baseDao.getResiUserGroupHomeId(formDTO)); |
|
|
|
.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()) |
|
|
|
.doSelectPage(() -> baseDao.getResiUserGroupHomeId(formDTO)); |
|
|
|
|
|
|
|
List<String> dictTypeList = Arrays.asList(DictTypeEnum.EDUCATION.getCode(), DictTypeEnum.RELATIONSHIP.getCode(), DictTypeEnum.NATION.getCode()); |
|
|
|
Map<String,Map<String, String>> dictResult = new HashMap<>(); |
|
|
|
dictTypeList.forEach(dict->{ |
|
|
|
Map<String, Map<String, String>> dictResult = new HashMap<>(); |
|
|
|
dictTypeList.forEach(dict -> { |
|
|
|
Result<Map<String, String>> mapResult = epmetAdminOpenFeignClient.dictMap(dict); |
|
|
|
if (mapResult!=null && mapResult.success()){ |
|
|
|
dictResult.put(dict,mapResult.getData()); |
|
|
|
if (mapResult != null && mapResult.success()) { |
|
|
|
dictResult.put(dict, mapResult.getData()); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
//婚姻状况
|
|
|
|
Map<String, String> hyzkMap = getOptionMap(formDTO.getCustomerId(),"HYZK"); |
|
|
|
Map<String, String> hyzkMap = getOptionMap(formDTO.getCustomerId(), "HYZK"); |
|
|
|
|
|
|
|
//遍历数据 转换为中文
|
|
|
|
listPage.getResult().forEach(e->{ |
|
|
|
e.getHouseMemberList().parallelStream().forEach(o->{ |
|
|
|
if (StringUtils.isNotBlank(o.getIsParty())){ |
|
|
|
o.setIsParty(NumConstant.ZERO_STR.equals(o.getIsParty())?StrConstant.NO:StrConstant.YES); |
|
|
|
listPage.getResult().forEach(e -> { |
|
|
|
e.getHouseMemberList().parallelStream().forEach(o -> { |
|
|
|
if (StringUtils.isNotBlank(o.getIsParty())) { |
|
|
|
o.setIsParty(NumConstant.ZERO_STR.equals(o.getIsParty()) ? StrConstant.NO : StrConstant.YES); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(o.getGender())){ |
|
|
|
if (StringUtils.isNotBlank(o.getGender())) { |
|
|
|
o.setGender(GenderEnum.getName(o.getGender())); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(o.getIsTenant())){ |
|
|
|
o.setIsTenant(NumConstant.ZERO_STR.equals(o.getIsTenant())?StrConstant.NO:StrConstant.YES); |
|
|
|
if (StringUtils.isNotBlank(o.getIsTenant())) { |
|
|
|
o.setIsTenant(NumConstant.ZERO_STR.equals(o.getIsTenant()) ? StrConstant.NO : StrConstant.YES); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(o.getIsFloating())){ |
|
|
|
o.setIsFloating(NumConstant.ZERO_STR.equals(o.getIsFloating())?StrConstant.NO:StrConstant.YES); |
|
|
|
if (StringUtils.isNotBlank(o.getIsFloating())) { |
|
|
|
o.setIsFloating(NumConstant.ZERO_STR.equals(o.getIsFloating()) ? StrConstant.NO : StrConstant.YES); |
|
|
|
} |
|
|
|
Map<String, String> mzMap = dictResult.get(DictTypeEnum.NATION.getCode()); |
|
|
|
Map<String, String> whcdMap = dictResult.get(DictTypeEnum.EDUCATION.getCode()); |
|
|
@ -2153,8 +2180,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
public List<String> changeIcResiUserBelongTo(TokenDto tokenDto, IcUserBelongToChangedFormDTO formDTO) { |
|
|
|
List<String> resiUserIdList = baseDao.listUserIds(formDTO.getCustomerId(),formDTO.getSourceGridId()); |
|
|
|
if (CollectionUtils.isEmpty(resiUserIdList)){ |
|
|
|
List<String> resiUserIdList = baseDao.listUserIds(formDTO.getCustomerId(), formDTO.getSourceGridId()); |
|
|
|
if (CollectionUtils.isEmpty(resiUserIdList)) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
List<IcResiUserFormDTO> icResiUserFormDTOS = new ArrayList<>(); |
|
|
@ -2168,9 +2195,9 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
e.setList(list); |
|
|
|
icResiUserFormDTOS.add(e); |
|
|
|
|
|
|
|
resiUserIdList.forEach(userId->{ |
|
|
|
resiUserIdList.forEach(userId -> { |
|
|
|
map.put(FieldConstant.ID, userId); |
|
|
|
this.edit(tokenDto,icResiUserFormDTOS); |
|
|
|
this.edit(tokenDto, icResiUserFormDTOS); |
|
|
|
}); |
|
|
|
|
|
|
|
return resiUserIdList; |
|
|
@ -2193,7 +2220,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
//获取居民信息
|
|
|
|
IcResiUserEntity user = baseDao.selectById(formDTO.getIcResiUser()); |
|
|
|
//居民信息不存在时返回
|
|
|
|
if(null == user) { |
|
|
|
if (null == user) { |
|
|
|
return dto; |
|
|
|
} |
|
|
|
if (!user.getIdCard().equals(dto.getIdCard())) { |
|
|
@ -2202,7 +2229,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
wrapper.eq(IcResiUserEntity::getIdCard, formDTO.getIdCard()); |
|
|
|
wrapper.eq(IcResiUserEntity::getStatus, NumConstant.ZERO_STR); |
|
|
|
user = baseDao.selectOne(wrapper); |
|
|
|
if(null == user) { |
|
|
|
if (null == user) { |
|
|
|
return dto; |
|
|
|
} |
|
|
|
} |
|
|
@ -2228,7 +2255,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
wrapper.eq(IcResiUserEntity::getStatus, NumConstant.ZERO_STR); |
|
|
|
IcResiUserEntity user = baseDao.selectOne(wrapper); |
|
|
|
//居民信息不存在时返回
|
|
|
|
if(null == user) { |
|
|
|
if (null == user) { |
|
|
|
return dto; |
|
|
|
} |
|
|
|
dto.setIcResiUser(user.getId()); |
|
|
@ -2595,20 +2622,106 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 绑定房屋 |
|
|
|
* |
|
|
|
* @param form |
|
|
|
* @return void |
|
|
|
* @author LZN |
|
|
|
* @date 2022/6/22 16:30 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void bindHome(BindHomeFormDTO form) { |
|
|
|
// 根据idCard获取ca_redident表的数据
|
|
|
|
if (StringUtils.isBlank(form.getIdCard())) { |
|
|
|
throw new RenException("身份证号不能为空"); |
|
|
|
} |
|
|
|
GetResidentDetailByIdCardFormDTO dto = new GetResidentDetailByIdCardFormDTO(); |
|
|
|
dto.setIdCard(form.getIdCard()); |
|
|
|
Result<ResidentByIdCardResultDTO> result = guardarDatosFeignClient.getResidentDetailByIdCard(dto); |
|
|
|
ResidentByIdCardResultDTO residentDetailByIdCard = result.getData(); |
|
|
|
if (org.springframework.util.StringUtils.isEmpty(residentDetailByIdCard)) { |
|
|
|
throw new RenException("获取不到人的信息"); |
|
|
|
} |
|
|
|
// 根据房屋id获取房屋信息
|
|
|
|
if (StringUtils.isBlank(form.getHomeId())) { |
|
|
|
throw new RenException("房屋id不能为空"); |
|
|
|
} |
|
|
|
HouseInfoCache houseInfo = CustomerIcHouseRedis.getHouseInfo(form.getCustomerId(), form.getHomeId()); |
|
|
|
if (org.springframework.util.StringUtils.isEmpty(houseInfo)) { |
|
|
|
throw new RenException("获取不到房屋信息"); |
|
|
|
} |
|
|
|
// 将人的信息放入ic_resi_user对象中
|
|
|
|
IcResiUserEntity entity = new IcResiUserEntity(); |
|
|
|
entity.setCustomerId(form.getCustomerId()); |
|
|
|
// 进行日期转换
|
|
|
|
if(residentDetailByIdCard.getBirthday() == null){ |
|
|
|
throw new RenException("出生日期为空"); |
|
|
|
} |
|
|
|
Date d = new Date(); |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
String birthday = sdf.format(residentDetailByIdCard.getBirthday()); |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(residentDetailByIdCard.getIdCard()) |
|
|
|
&& StringUtils.isNotBlank(residentDetailByIdCard.getResidentName()) |
|
|
|
&& StringUtils.isNotBlank(residentDetailByIdCard.getTelephone()) |
|
|
|
&& StringUtils.isNotBlank(birthday)) { |
|
|
|
entity.setIdCard(residentDetailByIdCard.getIdCard()); |
|
|
|
entity.setName(residentDetailByIdCard.getResidentName()); |
|
|
|
entity.setMobile(residentDetailByIdCard.getTelephone()); |
|
|
|
entity.setBirthday(birthday); |
|
|
|
} else { |
|
|
|
throw new RenException("人信息不全"); |
|
|
|
} |
|
|
|
// 将房屋的信息放入ic_resi_user对象中
|
|
|
|
if (StringUtils.isNotBlank(houseInfo.getHomeId()) |
|
|
|
&& StringUtils.isNotBlank(houseInfo.getNeighborHoodId()) |
|
|
|
&& StringUtils.isNotBlank(houseInfo.getBuildingId()) |
|
|
|
&& StringUtils.isNotBlank(houseInfo.getBuildingUnitId())) { |
|
|
|
entity.setHomeId(houseInfo.getHomeId()); |
|
|
|
entity.setVillageId(houseInfo.getNeighborHoodId()); |
|
|
|
entity.setBuildId(houseInfo.getBuildingId()); |
|
|
|
entity.setUnitId(houseInfo.getBuildingUnitId()); |
|
|
|
entity.setAgencyId(houseInfo.getAgencyId()); |
|
|
|
// 根据homeId获取gridId和pids
|
|
|
|
Result<HouseAgencyInfoResultDTO> resultDTOResult = getGovOrgOpenFeignClient.getHouseAgencyInfo(houseInfo.getHomeId()); |
|
|
|
entity.setGridId(resultDTOResult.getData().getGridId()); |
|
|
|
entity.setPids(resultDTOResult.getData().getPids()); |
|
|
|
} else { |
|
|
|
throw new RenException("房屋信息不全"); |
|
|
|
} |
|
|
|
SaveCaResidentUserFormDTO saveForm = new SaveCaResidentUserFormDTO(); |
|
|
|
saveForm.setHomeId(form.getHomeId()); |
|
|
|
saveForm.setIdCard(form.getIdCard()); |
|
|
|
if (baseDao.selectCountByIdCard(form.getIdCard(), form.getCustomerId()) > 0) { |
|
|
|
String id = baseDao.seletIdByIdCard(entity.getCustomerId(),entity.getIdCard()); |
|
|
|
baseDao.updateIcResiUserByIdCard(entity); |
|
|
|
saveForm.setIcResiUserId(id); |
|
|
|
guardarDatosFeignClient.saveCaResidentUser(saveForm); |
|
|
|
} else { |
|
|
|
baseDao.insert(entity); |
|
|
|
String id = baseDao.seletIdByIdCard(entity.getCustomerId(),entity.getIdCard()); |
|
|
|
saveForm.setIcResiUserId(id); |
|
|
|
guardarDatosFeignClient.saveCaResidentUser(saveForm); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* desc:根据字段值获取 options |
|
|
|
* |
|
|
|
* @param customerId |
|
|
|
* @param columnName |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private Map<String, String> getOptionMap(String customerId,String columnName) { |
|
|
|
private Map<String, String> getOptionMap(String customerId, String columnName) { |
|
|
|
IcFormOptionsQueryFormDTO optionsForm = new IcFormOptionsQueryFormDTO(); |
|
|
|
optionsForm.setCustomerId(customerId); |
|
|
|
optionsForm.setFormCode(IcFormCodeEnum.RESI_BASE_INFO.getCode()); |
|
|
|
optionsForm.setColumnName(columnName); |
|
|
|
Result<List<IcFormItemOptionsDTO>> listResult = operCustomizeOpenFeignClient.listOptionsByItemConditions(optionsForm); |
|
|
|
if (!listResult.success()){ |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"获取item失败,"+listResult.getInternalMsg()); |
|
|
|
if (!listResult.success()) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取item失败," + listResult.getInternalMsg()); |
|
|
|
} |
|
|
|
return listResult.getData().stream() |
|
|
|
.collect(Collectors.toMap(IcFormItemOptionsDTO::getOptionValue, IcFormItemOptionsDTO::getOptionLabel, (o1, o2) -> o1)); |
|
|
|