|
|
@ -259,14 +259,33 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
}); |
|
|
|
|
|
|
|
//3.变更记录表和变更记录明细表新增数据
|
|
|
|
saveUserChangeRecord(tokenDto,map,resiUserId,name); |
|
|
|
|
|
|
|
return resiUserId; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 3.变更记录表和变更记录明细表新增数据 |
|
|
|
* |
|
|
|
* @param tokenDto |
|
|
|
* @param map |
|
|
|
* @param icUserId |
|
|
|
* @param icUserName |
|
|
|
* @return void |
|
|
|
* @author zhy |
|
|
|
* @date 2022/4/29 14:49 |
|
|
|
*/ |
|
|
|
private void saveUserChangeRecord(TokenDto tokenDto, LinkedHashMap<String, String> map, String icUserId, String icUserName) { |
|
|
|
//变更记录表和变更记录明细表新增数据
|
|
|
|
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); |
|
|
|
//3-1.变更记录表
|
|
|
|
IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity(); |
|
|
|
changeRecordEntity.setCustomerId(tokenDto.getCustomerId()); |
|
|
|
changeRecordEntity.setOperatorId(tokenDto.getUserId()); |
|
|
|
changeRecordEntity.setIcUserId(resiUserId); |
|
|
|
changeRecordEntity.setIcUserId(icUserId); |
|
|
|
changeRecordEntity.setOperatorName(staffInfoCache.getRealName()); |
|
|
|
changeRecordEntity.setIcUserName(name); |
|
|
|
changeRecordEntity.setIcUserName(icUserName); |
|
|
|
changeRecordEntity.setType("add"); |
|
|
|
changeRecordEntity.setTypeName("新增"); |
|
|
|
changeRecordEntity.setBeforeChangeName("-"); |
|
|
@ -274,11 +293,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
changeRecordEntity.setChangeTime(new java.util.Date()); |
|
|
|
icUserChangeRecordService.insert(changeRecordEntity); |
|
|
|
//3-2.变更明细表
|
|
|
|
List<IcUserChangeDetailedEntity> changeDetailedEntityList = saveChangeRecord(tokenDto, map, resiUserId, changeRecordEntity.getId()); |
|
|
|
List<IcUserChangeDetailedEntity> changeDetailedEntityList = saveChangeRecord(tokenDto, map, icUserId, changeRecordEntity.getId()); |
|
|
|
icUserChangeDetailedService.insertBatch(changeDetailedEntityList); |
|
|
|
|
|
|
|
return resiUserId; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -799,7 +815,93 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
map.put("groupByTables", new ArrayList<>(groupByTables)); |
|
|
|
return map; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @Description 查询个人数据 |
|
|
|
* @author zxc |
|
|
|
* @date 2021/11/3 9:21 上午 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public PersonDataResultDTO personData(PersonDataFormDTO formDTO) { |
|
|
|
PersonDataResultDTO personData = baseDao.personData(formDTO.getUserId()); |
|
|
|
if (null == personData) { |
|
|
|
return new PersonDataResultDTO(); |
|
|
|
} |
|
|
|
//新增以下2个返参
|
|
|
|
ResiUserFormDTO resiUserFormDTO = new ResiUserFormDTO(); |
|
|
|
resiUserFormDTO.setIcResiUserId(formDTO.getUserId()); |
|
|
|
resiUserFormDTO.setIdNum(personData.getIdCard()); |
|
|
|
resiUserFormDTO.setCustomerId(formDTO.getCustomerId()); |
|
|
|
//根据身份证号+ic_resi_user.id找epmetUserId
|
|
|
|
ResiUserResDTO resiUserResDTO = userService.findEpmetUser(resiUserFormDTO); |
|
|
|
personData.setEpmetUserIdList(null != resiUserResDTO ? resiUserResDTO.getEpmetUserIdList() : new ArrayList<>()); |
|
|
|
personData.setIcResiUserId(formDTO.getUserId()); |
|
|
|
|
|
|
|
// 房屋信息查询
|
|
|
|
Result<List<String>> listResult = govOrgOpenFeignClient.selectHouseInfoByIdCard(personData.getIdCard(), formDTO.getCustomerId()); |
|
|
|
if (!listResult.success()) { |
|
|
|
throw new RenException("查询房屋信息失败"); |
|
|
|
} |
|
|
|
personData.setHouseInfo(listResult.getData()); |
|
|
|
|
|
|
|
// 志愿者处理
|
|
|
|
if (personData.getIsVolunteer().equals(NumConstant.ONE_STR)) { |
|
|
|
List<String> volunteerList = baseDao.selectVolunteerByUserId(formDTO.getUserId()); |
|
|
|
if (!CollectionUtils.isEmpty(volunteerList)) { |
|
|
|
List<String> volunteers = new ArrayList<>(); |
|
|
|
List<String> finalVolunteers = volunteers; |
|
|
|
volunteerList.forEach(v -> { |
|
|
|
List<String> collect = Arrays.stream(v.split(",")).collect(Collectors.toList()); |
|
|
|
finalVolunteers.addAll(collect); |
|
|
|
}); |
|
|
|
volunteers = volunteers.stream().distinct().collect(Collectors.toList()); |
|
|
|
// 去customize 查询志愿者类别
|
|
|
|
Result<List<String>> volunteerResult = operCustomizeOpenFeignClient.volunteerLabelByValues(volunteers, personData.getCustomerId()); |
|
|
|
if (!volunteerResult.success()) { |
|
|
|
throw new RenException("查询志愿者类别失败..."); |
|
|
|
} |
|
|
|
personData.setVolunteerCategory(volunteerResult.getData()); |
|
|
|
} |
|
|
|
} |
|
|
|
// 网格名
|
|
|
|
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(personData.getGridId()); |
|
|
|
if (null != gridInfo) { |
|
|
|
personData.setGridName(gridInfo.getGridNamePath()); |
|
|
|
} |
|
|
|
/** |
|
|
|
* 人员类别 |
|
|
|
* 先查询customize配置的 |
|
|
|
* 再根据配置去查询字段 |
|
|
|
*/ |
|
|
|
IcResiCategoryStatsConfigDTO dto = new IcResiCategoryStatsConfigDTO(); |
|
|
|
dto.setCustomerId(personData.getCustomerId()); |
|
|
|
Result<List<IcResiCategoryStatsConfigDTO>> categoryListResult = operCustomizeOpenFeignClient.getCategoryList(dto); |
|
|
|
if (!categoryListResult.success()) { |
|
|
|
throw new RenException("查询客户下的人员类别失败..."); |
|
|
|
} |
|
|
|
List<IcResiCategoryStatsConfigDTO> categoryData = categoryListResult.getData(); |
|
|
|
if (!CollectionUtils.isEmpty(categoryData)) { |
|
|
|
Map<String, List<IcResiCategoryStatsConfigDTO>> groupByStatus = categoryData.stream().collect(Collectors.groupingBy(IcResiCategoryStatsConfigDTO::getStatus)); |
|
|
|
List<IcResiCategoryStatsConfigDTO> showList = groupByStatus.get(IcPlatformConstant.PERSON_CATEGORY_SHOW); |
|
|
|
List<String> personCategoryList = new ArrayList<>(); |
|
|
|
if (!CollectionUtils.isEmpty(showList)) { |
|
|
|
Map<String, List<IcResiCategoryStatsConfigDTO>> groupByTableName = showList.stream().collect(Collectors.groupingBy(IcResiCategoryStatsConfigDTO::getTableName)); |
|
|
|
groupByTableName.forEach((tableName, list) -> { |
|
|
|
List<String> columns = list.stream().map(IcResiCategoryStatsConfigDTO::getColumnName).collect(Collectors.toList()); |
|
|
|
Map<String, String> result = baseDao.selectPersonType(columns, personData.getCustomerId(), tableName, formDTO.getUserId()); |
|
|
|
list.forEach(l -> { |
|
|
|
result.forEach((k, v) -> { |
|
|
|
if (l.getColumnName().equals(k) && v.equals(NumConstant.ONE_STR)) { |
|
|
|
personCategoryList.add(l.getLabel()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
personData.setPersonCategory(personCategoryList); |
|
|
|
} |
|
|
|
} |
|
|
|
return personData; |
|
|
|
} |
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @Description 根据名字搜索 |
|
|
@ -1672,4 +1774,48 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
return resiUserId; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public RentTenantDataResultDTO getRentResiUserInfo(RentTenantDataFormDTO formDTO) { |
|
|
|
IcResiUserEntity entity = baseDao.selectById(formDTO.getUserId()); |
|
|
|
return ConvertUtils.sourceToTarget(entity, RentTenantDataResultDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<RentTenantDataResultDTO> getRentResiUserInfoByIdCard(String idCard) { |
|
|
|
Map<String, Object> params = new HashMap<>(8); |
|
|
|
params.put("idCard", idCard); |
|
|
|
List<IcResiUserEntity> entityList = baseDao.selectList(getWrapper(params)); |
|
|
|
return ConvertUtils.sourceToTarget(entityList, RentTenantDataResultDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public String updateImage(TokenDto tokenDto, RentTenantFormDTO formDTO) { |
|
|
|
String resiUserId = ""; |
|
|
|
IcResiUserDTO userDTO = baseDao.getResiUserByIdCard(formDTO.getIdCard(), formDTO.getCustomerId()); |
|
|
|
if (null != userDTO) { |
|
|
|
resiUserId = userDTO.getId(); |
|
|
|
// 插入附件头像(只有一张)
|
|
|
|
List<IcResiUserAttachmentDTO> images = formDTO.getImages(); |
|
|
|
images.forEach(item -> item.setUserId(userDTO.getId())); |
|
|
|
images.forEach(item-> icResiUserAttachmentService.save(item)); |
|
|
|
} else if (NumConstant.ONE_STR.equals(formDTO.getType())) { |
|
|
|
// 如果是新增的租客,需要新增一条信息,不存在的房东就不管了
|
|
|
|
IcResiUserEntity entity = ConvertUtils.sourceToTarget(formDTO.getUser(), IcResiUserEntity.class); |
|
|
|
insert(entity); |
|
|
|
resiUserId = entity.getId(); |
|
|
|
// 变更记录表和变更记录明细表新增数据
|
|
|
|
LinkedHashMap<String, String> map = new LinkedHashMap(); |
|
|
|
map.put("AGENCY_ID",entity.getAgencyId()); |
|
|
|
saveUserChangeRecord(tokenDto,map,resiUserId,entity.getName()); |
|
|
|
// 新增用户后保存头像信息
|
|
|
|
List<IcResiUserAttachmentDTO> images = formDTO.getImages(); |
|
|
|
images.forEach(item -> item.setUserId(entity.getId())); |
|
|
|
images.forEach(item -> icResiUserAttachmentService.save(item)); |
|
|
|
} |
|
|
|
|
|
|
|
return resiUserId; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|