Browse Source

Merge branch 'yantai_master' of http://git.elinkit.com.cn:7070/r/epmet-cloud into yantai_master

 Conflicts:
	epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
dev
jianjun 3 years ago
parent
commit
570e1a3dbe
  1. 7
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aop/NoRepeatSubmitAop.java
  2. 43
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DemandAnalysisLegendEnum.java
  3. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java
  4. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java
  5. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/UserDemandConstant.java
  6. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java
  7. 136
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java
  8. 30
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml
  9. 10
      epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/CaLoudongFormDTO.java
  10. 10
      epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/CaPingfangFormDTO.java
  11. 10
      epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/CaRentalFormtDTO.java
  12. 11
      epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/CaResidentFormDTO.java
  13. 10
      epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/CaRotatorsFormDTO.java
  14. 10
      epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/result/CaResidentResultDTO.java
  15. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/CaLoudongController.java
  16. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/CaPingfangController.java
  17. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/CaRentalController.java
  18. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/CaResidentController.java
  19. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/CaRotatorsController.java
  20. 3
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/CaLoudongDao.java
  21. 3
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/CaPingfangDao.java
  22. 3
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/CaRentalDao.java
  23. 3
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/CaResidentDao.java
  24. 3
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/CaRotatorsDao.java
  25. 39
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/CaLoudongServiceImpl.java
  26. 39
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/CaPingfangServiceImpl.java
  27. 37
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/CaRentalServiceImpl.java
  28. 39
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/CaResidentServiceImpl.java
  29. 38
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/CaRotatorsServiceImpl.java
  30. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/resources/db/migration/V0.0.10__add_indexes_of_ca_resident_user.sql
  31. 35
      epmet-module/open-data-worker/open-data-worker-server/src/main/resources/db/migration/V0.0.11__update_ca_view.sql
  32. 18
      epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/CaLoudongDao.xml
  33. 18
      epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/CaPingfangDao.xml
  34. 18
      epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/CaRentalDao.xml
  35. 23
      epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/CaResidentDao.xml
  36. 18
      epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/CaRotatorsDao.xml
  37. 16
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/impl/ResiMineGridServiceImpl.java
  38. 8
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  39. 11
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  40. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  41. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  42. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  43. 44
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  44. 9
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

7
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aop/NoRepeatSubmitAop.java

@ -49,19 +49,16 @@ public class NoRepeatSubmitAop {
long leaseTime = noRepeatSubmit.leaseTime(); long leaseTime = noRepeatSubmit.leaseTime();
//如果获取不到锁等待0秒直接返回 持锁时间为leaseTime //如果获取不到锁等待0秒直接返回 持锁时间为leaseTime
lock = distributedLock.getLock(RedisKeys.getNoRepeatSubmitKey(key), leaseTime, NumConstant.ZERO_L, TimeUnit.MILLISECONDS); lock = distributedLock.getLock(RedisKeys.getNoRepeatSubmitKey(key), leaseTime, NumConstant.ZERO_L, TimeUnit.MILLISECONDS);
//因为getLock如果获取失败抛异常 所以不做锁状态的判断
result = pjp.proceed();
} catch (Exception e) { } catch (Exception e) {
log.warn("noRepeatSubmit key:{},msg:{}", key, e.getMessage()); log.warn("noRepeatSubmit key:{},msg:{}", key, e.getMessage());
//"未获取到锁,重复提交了 //"未获取到锁,重复提交了
throw new RenException(EpmetErrorCode.REPEAT_SUBMIT.getCode()); throw new RenException(EpmetErrorCode.REPEAT_SUBMIT.getCode());
}
try {
//因为getLock如果获取失败抛异常 所以不做锁状态的判断
result = pjp.proceed();
} finally { } finally {
distributedLock.unLock(lock); distributedLock.unLock(lock);
} }
return result; return result;
} }

43
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DemandAnalysisLegendEnum.java

@ -0,0 +1,43 @@
package com.epmet.commons.tools.enums;
public enum DemandAnalysisLegendEnum {
/**
* 环境变量枚举
*/
VOLUNTEER("ic_user_volunteer", "志愿者"),
PARTY_UNIT("party_unit", "联建单位"),
COMMUNITY_ORG("community_org", "社区自组织"),
UNFINISHED("unfinished", "未完成"),
;
private String code;
private String name;
DemandAnalysisLegendEnum(String code, String name) {
this.code = code;
this.name = name;
}
public static DemandAnalysisLegendEnum getEnum(String code) {
DemandAnalysisLegendEnum[] values = DemandAnalysisLegendEnum.values();
for (DemandAnalysisLegendEnum value : values) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
}

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java

@ -115,7 +115,7 @@ public class GridInfoCache implements Serializable {
private String coordinates; private String coordinates;
/** /**
* 弃用标记 * 弃用标记 弃用1正常使用0
*/ */
private Integer abandonFlag; private Integer abandonFlag;

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java

@ -1,5 +1,8 @@
package com.epmet.service.evaluationindex.extract.toscreen.impl; package com.epmet.service.evaluationindex.extract.toscreen.impl;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.constant.OrgTypeConstant; import com.epmet.constant.OrgTypeConstant;
import com.epmet.constant.ProjectConstant; import com.epmet.constant.ProjectConstant;
import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.screen.ScreenProjectDataDTO;
@ -126,7 +129,11 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic
//上面的initNewScreenProjectData已经赋值了orgName=组织名称 //上面的initNewScreenProjectData已经赋值了orgName=组织名称
meta.setProjectContent(projectInfo.getBackGround()); meta.setProjectContent(projectInfo.getBackGround());
meta.setLinkUserId(projectInfo.getCreatedBy()); meta.setLinkUserId(projectInfo.getCreatedBy());
meta.setLinkName(projectInfo.getCreatedBy()); CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(param.getCustomerId(), projectInfo.getCreatedBy());
if (null == staffInfo){
throw new EpmetException("未查询到工作人员:"+projectInfo.getCreatedBy());
}
meta.setLinkName(staffInfo.getRealName());
if (StringUtils.isNotBlank(projectInfo.getLocateDimension())) { if (StringUtils.isNotBlank(projectInfo.getLocateDimension())) {
meta.setLatitude(new BigDecimal(projectInfo.getLocateDimension())); meta.setLatitude(new BigDecimal(projectInfo.getLocateDimension()));
} }

4
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/UserDemandConstant.java

@ -47,11 +47,13 @@ public interface UserDemandConstant {
String EVALUATE="evaluate"; String EVALUATE="evaluate";
// 服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit; // 服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;
//volunteer是指的居民信息的志愿者
String VOLUNTEER="volunteer"; String VOLUNTEER="volunteer";
String SOCIAL_ORG="social_org"; String SOCIAL_ORG="social_org";
String COMMUNITY_ORG="community_org"; String COMMUNITY_ORG="community_org";
String PARTY_UNIT="party_unit"; String PARTY_UNIT="party_unit";
String IC_USER_VOLUNTEER="ic_user_volunteer";
/** /**
* 个人档案personal-data * 个人档案personal-data

3
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java

@ -98,6 +98,7 @@ public class IcUserDemandRecController implements ResultDataResolver {
formDTO.setStaffId(tokenDto.getUserId()); formDTO.setStaffId(tokenDto.getUserId());
ValidatorUtils.validateEntity(formDTO, ServiceQueryFormDTO.AddUserInternalGroup.class); ValidatorUtils.validateEntity(formDTO, ServiceQueryFormDTO.AddUserInternalGroup.class);
if (UserDemandConstant.VOLUNTEER.equals(formDTO.getServiceType())) { if (UserDemandConstant.VOLUNTEER.equals(formDTO.getServiceType())) {
//应该查询爱心互助的志愿者
return new Result<List<OptionDTO>>().ok(volunteerInfoService.queryListVolunteer(tokenDto.getCustomerId(), formDTO.getStaffId(),formDTO.getServiceName())); return new Result<List<OptionDTO>>().ok(volunteerInfoService.queryListVolunteer(tokenDto.getCustomerId(), formDTO.getStaffId(),formDTO.getServiceName()));
} else if (UserDemandConstant.SOCIAL_ORG.equals(formDTO.getServiceType())) { } else if (UserDemandConstant.SOCIAL_ORG.equals(formDTO.getServiceType())) {
ValidatorUtils.validateEntity(formDTO, ServiceQueryFormDTO.AddUserInternalGroup.class, ServiceQueryFormDTO.SocietyOrgInternalGroup.class); ValidatorUtils.validateEntity(formDTO, ServiceQueryFormDTO.AddUserInternalGroup.class, ServiceQueryFormDTO.SocietyOrgInternalGroup.class);
@ -106,6 +107,8 @@ public class IcUserDemandRecController implements ResultDataResolver {
return new Result<List<OptionDTO>>().ok(icCommunitySelfOrganizationService.queryServiceList(formDTO)); return new Result<List<OptionDTO>>().ok(icCommunitySelfOrganizationService.queryServiceList(formDTO));
} else if (UserDemandConstant.PARTY_UNIT.equals(formDTO.getServiceType())) { } else if (UserDemandConstant.PARTY_UNIT.equals(formDTO.getServiceType())) {
return new Result<List<OptionDTO>>().ok(icPartyUnitService.queryServiceList(formDTO)); return new Result<List<OptionDTO>>().ok(icPartyUnitService.queryServiceList(formDTO));
}else if (UserDemandConstant.IC_USER_VOLUNTEER.equals(formDTO.getServiceType())) {
return new Result<List<OptionDTO>>().ok(volunteerInfoService.queryListVolunteer(tokenDto.getCustomerId(), formDTO.getStaffId(),formDTO.getServiceName()));
} }
return new Result<>(); return new Result<>();
} }

136
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java

@ -25,13 +25,16 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.DemandAnalysisLegendEnum;
import com.epmet.commons.tools.enums.DictTypeEnum; import com.epmet.commons.tools.enums.DictTypeEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.scan.param.TextScanParamDTO; import com.epmet.commons.tools.scan.param.TextScanParamDTO;
import com.epmet.commons.tools.scan.param.TextTaskDTO; import com.epmet.commons.tools.scan.param.TextTaskDTO;
import com.epmet.commons.tools.scan.result.SyncScanResult; import com.epmet.commons.tools.scan.result.SyncScanResult;
@ -260,6 +263,10 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
} else { } else {
formDTO.setGridPids(staffInfo.getAgencyPIds().concat(StrConstant.COLON).concat(staffInfo.getAgencyId())); formDTO.setGridPids(staffInfo.getAgencyPIds().concat(StrConstant.COLON).concat(staffInfo.getAgencyId()));
} }
//服务方=志愿者的,查询的是居民信息的志愿者+爱心互助的志愿者服务的
if(UserDemandConstant.IC_USER_VOLUNTEER.equals(formDTO.getServiceType())){
formDTO.setServiceType(UserDemandConstant.VOLUNTEER);
}
PageInfo<DemandRecResultDTO> pageInfo= PageHelper.startPage(formDTO.getPageNo(), PageInfo<DemandRecResultDTO> pageInfo= PageHelper.startPage(formDTO.getPageNo(),
formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.pageSelect(formDTO)); formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.pageSelect(formDTO));
List<DemandRecResultDTO> list=pageInfo.getList(); List<DemandRecResultDTO> list=pageInfo.getList();
@ -275,18 +282,22 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
List<IcResiDemandDictEntity> dictList=demandDictService.listByCodes(formDTO.getCustomerId(),categoryCodes); List<IcResiDemandDictEntity> dictList=demandDictService.listByCodes(formDTO.getCustomerId(),categoryCodes);
Map<String, String> dictMap = dictList.stream().collect(Collectors.toMap(IcResiDemandDictEntity::getCategoryCode, IcResiDemandDictEntity::getCategoryName)); Map<String, String> dictMap = dictList.stream().collect(Collectors.toMap(IcResiDemandDictEntity::getCategoryCode, IcResiDemandDictEntity::getCategoryName));
//3、查询志愿者 //3、查询爱心互助志愿者
// 服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit; // 服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;
Map<String,String> userInfoMap=new HashMap<>(); Map<String,String> userInfoMap=new HashMap<>();
Set<String> userIdList=list.stream().filter(item->null!=item.getServiceType()&&item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toSet()); Set<String> userIdList=list.stream().filter(item->null!=item.getServiceType()&&item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toSet());
if(CollectionUtils.isNotEmpty(userIdList)){ if(CollectionUtils.isNotEmpty(userIdList)){
Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(new ArrayList<>(userIdList)); Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(new ArrayList<>(userIdList));
if(!userInfoRes.success()||CollectionUtils.isEmpty(userInfoRes.getData())){ if(!userInfoRes.success()||CollectionUtils.isEmpty(userInfoRes.getData())){
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(),"查询志愿者信息异常"); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(),"查询爱心互助志愿者信息异常");
} }
userInfoMap=userInfoRes.getData().stream().collect(Collectors.toMap(UserBaseInfoResultDTO::getUserId, UserBaseInfoResultDTO::getRealName)); userInfoMap=userInfoRes.getData().stream().collect(Collectors.toMap(UserBaseInfoResultDTO::getUserId, UserBaseInfoResultDTO::getRealName));
} }
//4、居民信息的志愿者
Set<String> icUserIdList = list.stream().filter(item -> null != item.getServiceType() && item.getServiceType().equals(UserDemandConstant.IC_USER_VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toSet());
Map<String, IcResiUserDTO> icUserInfoMap =getIcVolunteerMap(icUserIdList);
//查询字典表 //查询字典表
Result<Map<String, String>> reportTypeRes=adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_REPORT_TYPE.getCode()); Result<Map<String, String>> reportTypeRes=adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_REPORT_TYPE.getCode());
Map<String,String> reportTypeMap=reportTypeRes.success()&& MapUtils.isNotEmpty(reportTypeRes.getData())?reportTypeRes.getData():new HashMap<>(); Map<String,String> reportTypeMap=reportTypeRes.success()&& MapUtils.isNotEmpty(reportTypeRes.getData())?reportTypeRes.getData():new HashMap<>();
@ -306,15 +317,29 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
res.setCategoryName(dictMap.get(res.getCategoryCode())); res.setCategoryName(dictMap.get(res.getCategoryCode()));
} }
res.setFirstCategoryName(demandDictService.getCategoryName(formDTO.getCustomerId(), res.getFirstCategoryCode())); res.setFirstCategoryName(demandDictService.getCategoryName(formDTO.getCustomerId(), res.getFirstCategoryCode()));
if (null != userInfoMap && userInfoMap.containsKey(res.getServerId())) { //爱心互助志愿者
res.setServiceName(userInfoMap.get(res.getServerId())); if(res.getServiceType().equals(UserDemandConstant.VOLUNTEER)){
if (null != userInfoMap && userInfoMap.containsKey(res.getServerId())) {
res.setServiceName(userInfoMap.get(res.getServerId()));
}
}
//居民信息志愿者
if(res.getServiceType().equals(UserDemandConstant.IC_USER_VOLUNTEER)){
if (null != icUserInfoMap && icUserInfoMap.containsKey(res.getServerId())) {
res.setServiceName(icUserInfoMap.get(res.getServerId()).getName());
}
} }
//社区帮办:community;楼长帮办:building_caption;党员帮办:party;自身上报:self_help //社区帮办:community;楼长帮办:building_caption;党员帮办:party;自身上报:self_help
res.setReportTypeName(reportTypeMap.containsKey(res.getReportType())?reportTypeMap.get(res.getReportType()):StrConstant.EPMETY_STR); res.setReportTypeName(reportTypeMap.containsKey(res.getReportType())?reportTypeMap.get(res.getReportType()):StrConstant.EPMETY_STR);
//待处理:pending;已取消canceled;已派单:assigned;已接单:have_order;已完成:finished //待处理:pending;已取消canceled;已派单:assigned;已接单:have_order;已完成:finished
res.setStatusName(statusMap.containsKey(res.getStatus())?statusMap.get(res.getStatus()):StrConstant.EPMETY_STR); res.setStatusName(statusMap.containsKey(res.getStatus())?statusMap.get(res.getStatus()):StrConstant.EPMETY_STR);
//服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit; //服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;
res.setServiceShowName(serviceTypeMap.containsKey(res.getServiceType())?res.getServiceName().concat("(").concat(serviceTypeMap.get(res.getServiceType())).concat(")"):StrConstant.EPMETY_STR); if (serviceTypeMap.containsKey(res.getServiceType())) {
res.setServiceShowName(res.getServiceName().concat("(").concat(serviceTypeMap.get(res.getServiceType())).concat(")"));
} else if (res.getServiceType().equals(UserDemandConstant.VOLUNTEER)) {
res.setServiceShowName(res.getServiceName().concat("(").concat("志愿者").concat(")"));
}
res.setServiceShowFlag(StringUtils.isNotBlank(res.getServerId()) ? true : false); res.setServiceShowFlag(StringUtils.isNotBlank(res.getServerId()) ? true : false);
} }
} }
@ -430,12 +455,21 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
serviceName=null != dto ? dto.getOrganizationName() : StrConstant.EPMETY_STR; serviceName=null != dto ? dto.getOrganizationName() : StrConstant.EPMETY_STR;
break; break;
case UserDemandConstant.VOLUNTEER: case UserDemandConstant.VOLUNTEER:
//爱心互助的志愿者
Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(Arrays.asList(serverId)); Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(Arrays.asList(serverId));
if (!userInfoRes.success() || CollectionUtils.isEmpty(userInfoRes.getData())) { if (!userInfoRes.success() || CollectionUtils.isEmpty(userInfoRes.getData())) {
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询志愿者信息异常","志愿者信息查询异常"); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询爱心互助志愿者信息异常","志愿者信息查询异常");
} }
serviceName=userInfoRes.getData().get(NumConstant.ZERO).getRealName(); serviceName=userInfoRes.getData().get(NumConstant.ZERO).getRealName();
break; break;
case UserDemandConstant.IC_USER_VOLUNTEER:
//居民信息的志愿者 ic_resi_user
Result<IcResiUserDTO> icUserInfoRes = epmetUserOpenFeignClient.getIcResiUserDTO(serverId);
if (!icUserInfoRes.success() || null==icUserInfoRes.getData()) {
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询居民信息志愿者信息异常","查询居民信息志愿者信息异常");
}
serviceName=icUserInfoRes.getData().getName();
break;
default: default:
log.warn("serviceType 错误"); log.warn("serviceType 错误");
break; break;
@ -633,9 +667,16 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
List<String> userIdList = Arrays.asList(res.getServerId()); List<String> userIdList = Arrays.asList(res.getServerId());
Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList); Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList);
if (!userInfoRes.success() || CollectionUtils.isEmpty(userInfoRes.getData())) { if (!userInfoRes.success() || CollectionUtils.isEmpty(userInfoRes.getData())) {
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询志愿者信息异常"); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询爱心互助志愿者信息异常");
} }
res.setServiceName(userInfoRes.getData().get(NumConstant.ZERO).getRealName()); res.setServiceName(userInfoRes.getData().get(NumConstant.ZERO).getRealName());
}else if(UserDemandConstant.IC_USER_VOLUNTEER.equals(res.getServiceType())){
// 如果服务方是居民信息的志愿者,需要查询ic_resi_user.姓名
Result<IcResiUserDTO> userInfoRes = epmetUserOpenFeignClient.getIcResiUserDTO(res.getServerId());
if (!userInfoRes.success() || null == userInfoRes.getData()) {
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询居民信息志愿者信息异常");
}
res.setServiceName(userInfoRes.getData().getName());
} }
//查询字典表 //查询字典表
Result<Map<String, String>> reportTypeRes = adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_REPORT_TYPE.getCode()); Result<Map<String, String>> reportTypeRes = adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_REPORT_TYPE.getCode());
@ -654,7 +695,11 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
res.setStatusName(statusMap.containsKey(res.getStatus()) ? statusMap.get(res.getStatus()) : StrConstant.EPMETY_STR); res.setStatusName(statusMap.containsKey(res.getStatus()) ? statusMap.get(res.getStatus()) : StrConstant.EPMETY_STR);
//服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit; //服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;
res.setServiceShowName(serviceTypeMap.containsKey(res.getServiceType()) ? res.getServiceName().concat("(").concat(serviceTypeMap.get(res.getServiceType())).concat(")") : StrConstant.EPMETY_STR); if (serviceTypeMap.containsKey(res.getServiceType())) {
res.setServiceShowName(res.getServiceName().concat("(").concat(serviceTypeMap.get(res.getServiceType())).concat(")"));
} else if (res.getServiceType().equals(UserDemandConstant.VOLUNTEER)) {
res.setServiceShowName(res.getServiceName().concat("(").concat("志愿者").concat(")"));
}
res.setServiceShowFlag(StringUtils.isNotBlank(res.getServerId())); res.setServiceShowFlag(StringUtils.isNotBlank(res.getServerId()));
} }
return res; return res;
@ -838,7 +883,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
List<IcResiDemandDictEntity> dictList=demandDictService.listByCodes(customerId,categoryCodes); List<IcResiDemandDictEntity> dictList=demandDictService.listByCodes(customerId,categoryCodes);
Map<String, String> dictMap = dictList.stream().collect(Collectors.toMap(IcResiDemandDictEntity::getCategoryCode, IcResiDemandDictEntity::getCategoryName)); Map<String, String> dictMap = dictList.stream().collect(Collectors.toMap(IcResiDemandDictEntity::getCategoryCode, IcResiDemandDictEntity::getCategoryName));
//3、查询志愿者 //3、查询爱心互助志愿者
// 服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit; // 服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;
Map<String,String> userInfoMap=new HashMap<>(); Map<String,String> userInfoMap=new HashMap<>();
Set<String> userIdList=demandList.stream().filter(item->null!=item.getServiceType()&&item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toSet()); Set<String> userIdList=demandList.stream().filter(item->null!=item.getServiceType()&&item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toSet());
@ -850,6 +895,10 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
userInfoMap=userInfoRes.getData().stream().collect(Collectors.toMap(UserBaseInfoResultDTO::getUserId, UserBaseInfoResultDTO::getRealName)); userInfoMap=userInfoRes.getData().stream().collect(Collectors.toMap(UserBaseInfoResultDTO::getUserId, UserBaseInfoResultDTO::getRealName));
} }
//4、居民信息的志愿者
Set<String> icUserIdList = demandList.stream().filter(item -> null != item.getServiceType() && item.getServiceType().equals(UserDemandConstant.IC_USER_VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toSet());
Map<String, IcResiUserDTO> icUserInfoMap=getIcVolunteerMap(icUserIdList);
for(DemandRecResultDTO res:demandList){ for(DemandRecResultDTO res:demandList){
if (null != gridInfoMap && gridInfoMap.containsKey(res.getGridId())) { if (null != gridInfoMap && gridInfoMap.containsKey(res.getGridId())) {
res.setGridName(gridInfoMap.get(res.getGridId()).getGridName()); res.setGridName(gridInfoMap.get(res.getGridId()).getGridName());
@ -859,9 +908,6 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
res.setCategoryName(dictMap.get(res.getCategoryCode())); res.setCategoryName(dictMap.get(res.getCategoryCode()));
} }
res.setFirstCategoryName(demandDictService.getCategoryName(customerId, res.getFirstCategoryCode())); res.setFirstCategoryName(demandDictService.getCategoryName(customerId, res.getFirstCategoryCode()));
if (null != userInfoMap && userInfoMap.containsKey(res.getServerId())) {
res.setServiceName(userInfoMap.get(res.getServerId()));
}
//社区帮办:community;楼长帮办:building_caption;党员帮办:party;自身上报:self_help //社区帮办:community;楼长帮办:building_caption;党员帮办:party;自身上报:self_help
//待处理:pending;已取消canceled;已派单:assigned;已接单:have_order;已完成:finished //待处理:pending;已取消canceled;已派单:assigned;已接单:have_order;已完成:finished
//服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit; //服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;
@ -877,6 +923,15 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
res.setServiceShowName(res.getServiceName().concat("(社区自组织)")); res.setServiceShowName(res.getServiceName().concat("(社区自组织)"));
break; break;
case UserDemandConstant.VOLUNTEER: case UserDemandConstant.VOLUNTEER:
if (null != userInfoMap && userInfoMap.containsKey(res.getServerId())) {
res.setServiceName(userInfoMap.get(res.getServerId()));
}
res.setServiceShowName(res.getServiceName().concat("(志愿者)"));
break;
case UserDemandConstant.IC_USER_VOLUNTEER:
if (null != icUserInfoMap && icUserInfoMap.containsKey(res.getServerId())) {
res.setServiceName(icUserInfoMap.get(res.getServerId()).getName());
}
res.setServiceShowName(res.getServiceName().concat("(志愿者)")); res.setServiceShowName(res.getServiceName().concat("(志愿者)"));
break; break;
default: default:
@ -900,36 +955,44 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
SubCodeFormDTO subCodeFormDTO=new SubCodeFormDTO(); SubCodeFormDTO subCodeFormDTO=new SubCodeFormDTO();
subCodeFormDTO.setCustomerId(formDTO.getCusotmerId()); subCodeFormDTO.setCustomerId(formDTO.getCusotmerId());
subCodeFormDTO.setParentCategoryCode(NumConstant.ZERO_STR); subCodeFormDTO.setParentCategoryCode(NumConstant.ZERO_STR);
// subCodeFormDTO.setCategoryName("特殊群体照料");
List<OptionDTO> firstCategoryList=demandDictService.querySubCodeList(subCodeFormDTO); List<OptionDTO> firstCategoryList=demandDictService.querySubCodeList(subCodeFormDTO);
if(CollectionUtils.isEmpty(firstCategoryList)){ if(CollectionUtils.isEmpty(firstCategoryList)){
return new CategoryAnalysisResDTO(Collections.EMPTY_LIST,Collections.EMPTY_LIST); return new CategoryAnalysisResDTO(Collections.EMPTY_LIST,Collections.EMPTY_LIST);
} }
//2、没有服务类型直接退出 //2、没有服务类型直接退出
Result<Map<String, String>> serviceTypeRes=adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_SERVICE_TYPE.getCode()); /*Result<Map<String, String>> serviceTypeRes=adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_SERVICE_TYPE.getCode());
if(!serviceTypeRes.success()||MapUtils.isEmpty(serviceTypeRes.getData())){ if(!serviceTypeRes.success()||MapUtils.isEmpty(serviceTypeRes.getData())){
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(),"查询服务方类型异常,请检查是否已经配置字典信息"); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(),"查询服务方类型异常,请检查是否已经配置字典信息");
} }
List<LegendDTO> legend=new ArrayList<>();
serviceTypeRes.getData().forEach((code,name)->{ serviceTypeRes.getData().forEach((code,name)->{
LegendDTO legendDTO=new LegendDTO(code,name); LegendDTO legendDTO=new LegendDTO(code,name);
legend.add(legendDTO); legend.add(legendDTO);
}); });
LegendDTO unfinishLegend = new LegendDTO("unfinished", "未完成"); LegendDTO unfinishLegend = new LegendDTO("unfinished", "未完成");
legend.add(unfinishLegend); legend.add(unfinishLegend);*/
List<LegendDTO> legend=new ArrayList<>();
log.info("阶段性胜利1:"+ JSON.toJSONString(legend)); DemandAnalysisLegendEnum[] values = DemandAnalysisLegendEnum.values();
for (DemandAnalysisLegendEnum value : values) {
LegendDTO legendDTO=new LegendDTO();
legendDTO.setLegendCode(value.getCode());
legendDTO.setLegendName(value.getName());
legend.add(legendDTO);
}
// log.info("阶段性胜利1:"+ JSON.toJSONString(legend));
// 3、传进来的是组织id的话,查询出全路径 // 3、传进来的是组织id的话,查询出全路径
if("agency".equals(formDTO.getOrgType())){ if("agency".equals(formDTO.getOrgType())){
//找到当前组织的所有上级,再拼接上自己 //找到当前组织的所有上级,再拼接上自己
Result<CustomerAgencyDTO> customerAgencyDTOResult=govOrgOpenFeignClient.getAgencyById(formDTO.getOrgId()); /*Result<CustomerAgencyDTO> customerAgencyDTOResult=govOrgOpenFeignClient.getAgencyById(formDTO.getOrgId());
if(!customerAgencyDTOResult.success()||null==customerAgencyDTOResult.getData()){ if(!customerAgencyDTOResult.success()||null==customerAgencyDTOResult.getData()){
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "获取组织信息异常govOrgOpenFeignClient.getAgencyById"); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "获取组织信息异常govOrgOpenFeignClient.getAgencyById");
} }*/
if(NumConstant.ZERO_STR.equals(customerAgencyDTOResult.getData().getPid())){ AgencyInfoCache agencyInfoCache=CustomerOrgRedis.getAgencyInfo(formDTO.getOrgId());
if(NumConstant.ZERO_STR.equals(agencyInfoCache.getPid())||StringUtils.isBlank(agencyInfoCache.getPid())){
//当前传入的组织id=客户的根组织 //当前传入的组织id=客户的根组织
formDTO.setGridPids(formDTO.getOrgId()); formDTO.setGridPids(formDTO.getOrgId());
}else{ }else{
formDTO.setGridPids(customerAgencyDTOResult.getData().getPids().concat(StrConstant.COLON).concat(formDTO.getOrgId())); formDTO.setGridPids(agencyInfoCache.getPids().concat(StrConstant.COLON).concat(formDTO.getOrgId()));
} }
} }
@ -1241,6 +1304,9 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
//2、志愿者姓名、手机号 //2、志愿者姓名、手机号
Set<String> userIdList=list.stream().filter(item->null!=item.getServiceType()&&item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(ResiClientMyDemandResDTO::getServerId).collect(Collectors.toSet()); Set<String> userIdList=list.stream().filter(item->null!=item.getServiceType()&&item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(ResiClientMyDemandResDTO::getServerId).collect(Collectors.toSet());
Map<String,UserBaseInfoResultDTO> userInfoMap=getVolunteerMap(userIdList); Map<String,UserBaseInfoResultDTO> userInfoMap=getVolunteerMap(userIdList);
//3、居民信息志愿者
Set<String> icUserIdList=list.stream().filter(item->null!=item.getServiceType()&&item.getServiceType().equals(UserDemandConstant.IC_USER_VOLUNTEER)).map(ResiClientMyDemandResDTO::getServerId).collect(Collectors.toSet());
Map<String,IcResiUserDTO> icUerInfoMap=getIcVolunteerMap(icUserIdList);
for (ResiClientMyDemandResDTO resDto : list) { for (ResiClientMyDemandResDTO resDto : list) {
//3、查询分类名称 //3、查询分类名称
@ -1269,6 +1335,11 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
resDto.setServiceUserName(userInfoMap.get(resDto.getServerId()).getRealName()); resDto.setServiceUserName(userInfoMap.get(resDto.getServerId()).getRealName());
resDto.setServiceUserMobile(userInfoMap.get(resDto.getServerId()).getMobile()); resDto.setServiceUserMobile(userInfoMap.get(resDto.getServerId()).getMobile());
break; break;
case UserDemandConstant.IC_USER_VOLUNTEER:
resDto.setServiceUnitName(StrConstant.EPMETY_STR);
resDto.setServiceUserName(icUerInfoMap.get(resDto.getServerId()).getName());
resDto.setServiceUserMobile(icUerInfoMap.get(resDto.getServerId()).getMobile());
break;
default: default:
log.warn("serviceType 错误"); log.warn("serviceType 错误");
break; break;
@ -1330,6 +1401,23 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
return userInfoMap; return userInfoMap;
} }
/**
* 获取居民信息志愿者信息
* @param icUserIdList
* @return
*/
private Map<String, IcResiUserDTO> getIcVolunteerMap(Set<String> icUserIdList) {
Map<String, IcResiUserDTO> icUserInfoMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(icUserIdList)) {
Result<List<IcResiUserDTO>> icUserInfoRes = epmetUserOpenFeignClient.getListIcResiUserDTO(new ArrayList<>(icUserIdList));
if (!icUserInfoRes.success() || CollectionUtils.isEmpty(icUserInfoRes.getData())) {
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询居民信息志愿者信息异常");
}
icUserInfoMap = icUserInfoRes.getData().stream().collect(Collectors.toMap(IcResiUserDTO::getId, o -> o, (o1, o2) -> o1));
}
return icUserInfoMap;
}
/** /**
* 我的需求-需求详情待处理处理中已完成已取消 * 我的需求-需求详情待处理处理中已完成已取消
* *
@ -1374,6 +1462,12 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
resDto.setServiceUserName(userInfoMap.get(resDto.getServerId()).getRealName()); resDto.setServiceUserName(userInfoMap.get(resDto.getServerId()).getRealName());
resDto.setServiceUserMobile(userInfoMap.get(resDto.getServerId()).getMobile()); resDto.setServiceUserMobile(userInfoMap.get(resDto.getServerId()).getMobile());
break; break;
case UserDemandConstant.IC_USER_VOLUNTEER:
Map<String, IcResiUserDTO> icUserInfoMap = getIcVolunteerMap(new HashSet<>(Arrays.asList(resDto.getServerId())));
resDto.setServiceUnitName(StrConstant.EPMETY_STR);
resDto.setServiceUserName(icUserInfoMap.get(resDto.getServerId()).getName());
resDto.setServiceUserMobile(icUserInfoMap.get(resDto.getServerId()).getMobile());
break;
default: default:
log.warn("serviceType 错误"); log.warn("serviceType 错误");
break; break;

30
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml

@ -120,7 +120,7 @@
and r.STATUS=#{status} and r.STATUS=#{status}
</if> </if>
<if test="null != serviceType and serviceType != '' "> <if test="null != serviceType and serviceType != '' ">
and s.SERVICE_TYPE=#{serviceType} and s.SERVICE_TYPE like concat('%',#{serviceType},'%')
</if> </if>
<if test="null != serverId and serverId != '' "> <if test="null != serverId and serverId != '' ">
and s.SERVER_ID=#{serverId} and s.SERVER_ID=#{serverId}
@ -389,6 +389,7 @@
when s.SERVICE_TYPE='social_org' then '社会组织' when s.SERVICE_TYPE='social_org' then '社会组织'
when s.SERVICE_TYPE='community_org' then '社区自组织' when s.SERVICE_TYPE='community_org' then '社区自组织'
when s.SERVICE_TYPE='party_unit' then '区域化党建单位' when s.SERVICE_TYPE='party_unit' then '区域化党建单位'
when s.SERVICE_TYPE='ic_user_volunteer' then '志愿者'
end end
)as legendName, )as legendName,
count(s.DEMAND_REC_ID) as serviceDemandTotal, count(s.DEMAND_REC_ID) as serviceDemandTotal,
@ -406,6 +407,7 @@
<if test="null != orgType and orgType == 'agency' "> <if test="null != orgType and orgType == 'agency' ">
and m.GRID_PIDS like concat(#{gridPids},'%') and m.GRID_PIDS like concat(#{gridPids},'%')
</if> </if>
and s.SERVICE_TYPE not like '%volunteer%'
and DATE_FORMAT(m.REPORT_TIME,'%Y-%m-%d') &gt;= #{startDateId} and DATE_FORMAT(m.REPORT_TIME,'%Y-%m-%d') &gt;= #{startDateId}
and DATE_FORMAT(m.REPORT_TIME,'%Y-%m-%d') &lt;= #{endDateId} and DATE_FORMAT(m.REPORT_TIME,'%Y-%m-%d') &lt;= #{endDateId}
and m.CATEGORY_CODE like concat(#{categoryCode},'%') and m.CATEGORY_CODE like concat(#{categoryCode},'%')
@ -413,6 +415,32 @@
union all union all
select
#{categoryCode} as categoryCode,
'ic_user_volunteer' as legendCode,
'志愿者' as legendName,
count(s.DEMAND_REC_ID) as serviceDemandTotal,
count(distinct s.SERVER_ID) as totalService
from ic_user_demand_service s
inner join ic_user_demand_rec m
on(s.DEMAND_REC_ID=m.ID)
where s.DEL_FLAG='0'
and m.DEL_FLAG='0'
and m.`STATUS`='finished'
and m.CUSTOMER_ID=#{customerId}
<if test="null != orgType and orgType == 'grid' ">
and m.GRID_ID=#{orgId}
</if>
<if test="null != orgType and orgType == 'agency' ">
and m.GRID_PIDS like concat(#{gridPids},'%')
</if>
and s.SERVICE_TYPE like '%volunteer%'
and DATE_FORMAT(m.REPORT_TIME,'%Y-%m-%d') &gt;= #{startDateId}
and DATE_FORMAT(m.REPORT_TIME,'%Y-%m-%d') &lt;= #{endDateId}
and m.CATEGORY_CODE like concat(#{categoryCode},'%')
union all
select select
#{categoryCode} as categoryCode, #{categoryCode} as categoryCode,
'unfinished' as legendCode, 'unfinished' as legendCode,

10
epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/CaLoudongFormDTO.java

@ -20,6 +20,16 @@ public class CaLoudongFormDTO implements Serializable {
*/ */
private String buildingName; private String buildingName;
/**
* userId
*/
private String userId;
/**
* 客户id
*/
private String customerId;
/** /**
* 网格id * 网格id
*/ */

10
epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/CaPingfangFormDTO.java

@ -9,6 +9,16 @@ public class CaPingfangFormDTO implements Serializable {
private static final long serialVersionUID = 7714897295294884648L; private static final long serialVersionUID = 7714897295294884648L;
/**
* userId
*/
private String userId;
/**
* 客户id
*/
private String customerId;
/** /**
* 楼栋名称 * 楼栋名称
*/ */

10
epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/CaRentalFormtDTO.java

@ -9,6 +9,16 @@ public class CaRentalFormtDTO implements Serializable {
private static final long serialVersionUID = -6052280300032032361L; private static final long serialVersionUID = -6052280300032032361L;
/**
* userId
*/
private String userId;
/**
* 客户id
*/
private String customerId;
/** /**
* 房主姓名 * 房主姓名
*/ */

11
epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/CaResidentFormDTO.java

@ -13,6 +13,17 @@ public class CaResidentFormDTO implements Serializable {
private Integer limit; private Integer limit;
/**
* userId
*/
private String userId;
/**
* 客户id
*/
private String customerId;
/** /**
* 姓名 * 姓名
*/ */

10
epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/CaRotatorsFormDTO.java

@ -10,6 +10,16 @@ public class CaRotatorsFormDTO implements Serializable {
private static final long serialVersionUID = 3356808153818385932L; private static final long serialVersionUID = 3356808153818385932L;
/**
* 客户id
*/
private String customerId;
/**
* userId
*/
private String userId;
/** /**
* 姓名 * 姓名
*/ */

10
epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/result/CaResidentResultDTO.java

@ -16,6 +16,16 @@ public class CaResidentResultDTO implements Serializable {
private String streetName; private String streetName;
/**
* 房屋id
*/
private String homeId;
/**
* ic_resi_user表id
*/
private String icResiUserId;
/** /**
* 人口ID * 人口ID
*/ */

2
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/CaLoudongController.java

@ -96,6 +96,8 @@ public class CaLoudongController {
*/ */
@PostMapping("getPage") @PostMapping("getPage")
public Result<PageData<CaLoudongResultDTO>> getPage(@RequestBody CaLoudongFormDTO dto, @LoginUser TokenDto tokenDto) { public Result<PageData<CaLoudongResultDTO>> getPage(@RequestBody CaLoudongFormDTO dto, @LoginUser TokenDto tokenDto) {
dto.setUserId(tokenDto.getUserId());
dto.setCustomerId(tokenDto.getCustomerId());
PageData<CaLoudongResultDTO> data = caLoudongService.getPage(dto); PageData<CaLoudongResultDTO> data = caLoudongService.getPage(dto);
return new Result<PageData<CaLoudongResultDTO>>().ok(data); return new Result<PageData<CaLoudongResultDTO>>().ok(data);
} }

2
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/CaPingfangController.java

@ -92,6 +92,8 @@ public class CaPingfangController {
*/ */
@PostMapping("getPage") @PostMapping("getPage")
public Result<PageData> getPage(@RequestBody CaPingfangFormDTO dto, @LoginUser TokenDto tokenDto) { public Result<PageData> getPage(@RequestBody CaPingfangFormDTO dto, @LoginUser TokenDto tokenDto) {
dto.setUserId(tokenDto.getUserId());
dto.setCustomerId(tokenDto.getCustomerId());
PageData data = caPingfangService.getPage(dto); PageData data = caPingfangService.getPage(dto);
return new Result<PageData>().ok(data); return new Result<PageData>().ok(data);
} }

2
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/CaRentalController.java

@ -95,6 +95,8 @@ public class CaRentalController {
*/ */
@PostMapping("getPage") @PostMapping("getPage")
public Result<PageData<CaRentalResultDTO>> getPage(@RequestBody CaRentalFormtDTO dto, @LoginUser TokenDto tokenDto) { public Result<PageData<CaRentalResultDTO>> getPage(@RequestBody CaRentalFormtDTO dto, @LoginUser TokenDto tokenDto) {
dto.setCustomerId(tokenDto.getCustomerId());
dto.setUserId(tokenDto.getUserId());
PageData<CaRentalResultDTO> data = caRentalService.getPage(dto); PageData<CaRentalResultDTO> data = caRentalService.getPage(dto);
return new Result<PageData<CaRentalResultDTO>>().ok(data); return new Result<PageData<CaRentalResultDTO>>().ok(data);
} }

2
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/CaResidentController.java

@ -98,6 +98,8 @@ public class CaResidentController {
*/ */
@PostMapping("getPage") @PostMapping("getPage")
public Result<PageData<CaResidentResultDTO>> getPage(@RequestBody CaResidentFormDTO dto, @LoginUser TokenDto tokenDto) { public Result<PageData<CaResidentResultDTO>> getPage(@RequestBody CaResidentFormDTO dto, @LoginUser TokenDto tokenDto) {
dto.setUserId(tokenDto.getUserId());
dto.setCustomerId(tokenDto.getCustomerId());
PageData<CaResidentResultDTO> data = caResidentService.getPage(dto); PageData<CaResidentResultDTO> data = caResidentService.getPage(dto);
return new Result<PageData<CaResidentResultDTO>>().ok(data); return new Result<PageData<CaResidentResultDTO>>().ok(data);
} }

2
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/CaRotatorsController.java

@ -95,6 +95,8 @@ public class CaRotatorsController {
*/ */
@PostMapping("getPage") @PostMapping("getPage")
public Result<PageData<CaRotatorsResultDTO>> getPage(@RequestBody CaRotatorsFormDTO dto, @LoginUser TokenDto tokenDto) { public Result<PageData<CaRotatorsResultDTO>> getPage(@RequestBody CaRotatorsFormDTO dto, @LoginUser TokenDto tokenDto) {
dto.setCustomerId(tokenDto.getCustomerId());
dto.setUserId(tokenDto.getUserId());
PageData<CaRotatorsResultDTO> data = caRotatorsService.getPage(dto); PageData<CaRotatorsResultDTO> data = caRotatorsService.getPage(dto);
return new Result<PageData<CaRotatorsResultDTO>>().ok(data); return new Result<PageData<CaRotatorsResultDTO>>().ok(data);
} }

3
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/CaLoudongDao.java

@ -34,7 +34,8 @@ public interface CaLoudongDao extends BaseDao<CaLoudongEntity> {
*/ */
List<CaLoudongResultDTO> getPage(@Param("communityName") String communityName, List<CaLoudongResultDTO> getPage(@Param("communityName") String communityName,
@Param("buildingName") String buildingName, @Param("buildingName") String buildingName,
@Param("gridId") String gridId); @Param("gridId") String gridId,
@Param("gridList") List<String> gridList);
/** /**
* 楼栋基本信息详情 * 楼栋基本信息详情

3
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/CaPingfangDao.java

@ -24,7 +24,8 @@ public interface CaPingfangDao extends BaseDao<CaPingfangEntity> {
*/ */
List<CaPingfangResultDTO> getPage(@Param("buildingName") String buildingName, List<CaPingfangResultDTO> getPage(@Param("buildingName") String buildingName,
@Param("communityName") String communityName, @Param("communityName") String communityName,
@Param("gridId") String gridId); @Param("gridId") String gridId,
@Param("gridList") List<String> gridList);
int deleteAll(); int deleteAll();

3
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/CaRentalDao.java

@ -29,7 +29,8 @@ public interface CaRentalDao extends BaseDao<CaRentalEntity> {
List<CaRentalResultDTO> getPage(@Param("residentName") String residentName, List<CaRentalResultDTO> getPage(@Param("residentName") String residentName,
@Param("houseName") String houseName, @Param("houseName") String houseName,
@Param("renterName") String renterName, @Param("renterName") String renterName,
@Param("gridId") String gridId); @Param("gridId") String gridId,
@Param("gridList") List<String> gridList);
int deleteAll(); int deleteAll();

3
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/CaResidentDao.java

@ -31,7 +31,8 @@ public interface CaResidentDao extends BaseDao<CaResidentEntity> {
List<CaResidentResultDTO> getPage(@Param("residentName") String residentName, List<CaResidentResultDTO> getPage(@Param("residentName") String residentName,
@Param("idCard") String idCard, @Param("idCard") String idCard,
@Param("telephone") String telephone, @Param("telephone") String telephone,
@Param("gridId") String gridId); @Param("gridId") String gridId,
@Param("gridList") List<String> gridList);
int deleteAll(); int deleteAll();

3
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/CaRotatorsDao.java

@ -29,7 +29,8 @@ public interface CaRotatorsDao extends BaseDao<CaRotatorsEntity> {
List<CaRotatorsResultDTO> getPage(@Param("rotatorsName") String rotatorsName, List<CaRotatorsResultDTO> getPage(@Param("rotatorsName") String rotatorsName,
@Param("idCard") String idCard, @Param("idCard") String idCard,
@Param("telephone") String telephone, @Param("telephone") String telephone,
@Param("gridId") String gridId); @Param("gridId") String gridId,
@Param("gridList") List<String> gridList);
int deleteAll(); int deleteAll();

39
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/CaLoudongServiceImpl.java

@ -1,13 +1,23 @@
package com.epmet.opendata.service.impl; package com.epmet.opendata.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.enums.OrgLevelEnum;
import com.epmet.commons.tools.enums.OrgTypeEnum;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.*; import com.epmet.commons.tools.utils.*;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.GridOptionFormDTO;
import com.epmet.dto.result.CustomerStaffGridResultDTO;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.opendata.dao.CaLoudongDao; import com.epmet.opendata.dao.CaLoudongDao;
import com.epmet.opendata.dto.ca.CaLoudongDTO; import com.epmet.opendata.dto.ca.CaLoudongDTO;
import com.epmet.opendata.dto.constant.CaWghDataConstant; import com.epmet.opendata.dto.constant.CaWghDataConstant;
@ -42,6 +52,9 @@ public class CaLoudongServiceImpl extends BaseServiceImpl<CaLoudongDao, CaLoudon
@Autowired @Autowired
private CaLoudongRedis caLoudongRedis; private CaLoudongRedis caLoudongRedis;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
// @Override // @Override
// public PageData<CaLoudongDTO> page(Map<String, Object> params) { // public PageData<CaLoudongDTO> page(Map<String, Object> params) {
// IPage<CaLoudongEntity> page = baseDao.selectPage( // IPage<CaLoudongEntity> page = baseDao.selectPage(
@ -104,12 +117,36 @@ public class CaLoudongServiceImpl extends BaseServiceImpl<CaLoudongDao, CaLoudon
@Override @Override
public PageData<CaLoudongResultDTO> getPage(CaLoudongFormDTO dto) { public PageData<CaLoudongResultDTO> getPage(CaLoudongFormDTO dto) {
// 获取组织id
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(dto.getCustomerId(), dto.getUserId());
String agencyId = staffInfo.getAgencyId();
// 根据组织id获取gridId网格id
GridOptionFormDTO gridOptionFormDTO = new GridOptionFormDTO();
gridOptionFormDTO.setAgencyId(agencyId);
gridOptionFormDTO.setPurpose("query");
Result<List<OptionResultDTO>> gridOption = govOrgOpenFeignClient.getGridOption(gridOptionFormDTO);
List<String> gridList = new ArrayList<>();
gridList.add(agencyId);
this.packGirdArray(gridOption.getData(), gridList);
PageHelper.startPage(dto.getPage(), dto.getLimit()); PageHelper.startPage(dto.getPage(), dto.getLimit());
List<CaLoudongResultDTO> result = baseDao.getPage(dto.getCommunityName(), dto.getBuildingName(),dto.getGridId()); List<CaLoudongResultDTO> result = baseDao.getPage(dto.getCommunityName(),
dto.getBuildingName(),
dto.getGridId(),
gridList);
PageInfo<CaLoudongResultDTO> info = new PageInfo<>(result); PageInfo<CaLoudongResultDTO> info = new PageInfo<>(result);
return new PageData<>(result, info.getTotal()); return new PageData<>(result, info.getTotal());
} }
private void packGirdArray(List<OptionResultDTO> options, List<String> gridList) {
if (CollUtil.isNotEmpty(options)) {
for (OptionResultDTO option : options) {
gridList.add(option.getValue());
packGirdArray(option.getChildren(), gridList);
}
}
}
/** /**
* 楼栋基本信息详情 * 楼栋基本信息详情
* *

39
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/CaPingfangServiceImpl.java

@ -1,5 +1,6 @@
package com.epmet.opendata.service.impl; package com.epmet.opendata.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -7,10 +8,18 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.enums.OrgTypeEnum;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.GridOptionFormDTO;
import com.epmet.dto.result.CustomerStaffGridResultDTO;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.opendata.dao.CaPingfangDao; import com.epmet.opendata.dao.CaPingfangDao;
import com.epmet.opendata.dto.ca.CaPingfangDTO; import com.epmet.opendata.dto.ca.CaPingfangDTO;
import com.epmet.opendata.dto.constant.CaWghDataConstant; import com.epmet.opendata.dto.constant.CaWghDataConstant;
@ -30,6 +39,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -44,6 +54,9 @@ public class CaPingfangServiceImpl extends BaseServiceImpl<CaPingfangDao, CaPing
@Autowired @Autowired
private CaPingfangRedis caPingfangRedis; private CaPingfangRedis caPingfangRedis;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Override @Override
public PageData<CaPingfangDTO> page(Map<String, Object> params) { public PageData<CaPingfangDTO> page(Map<String, Object> params) {
IPage<CaPingfangEntity> page = baseDao.selectPage( IPage<CaPingfangEntity> page = baseDao.selectPage(
@ -98,12 +111,36 @@ public class CaPingfangServiceImpl extends BaseServiceImpl<CaPingfangDao, CaPing
@Override @Override
public PageData getPage(CaPingfangFormDTO dto) { public PageData getPage(CaPingfangFormDTO dto) {
// 获取组织id
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(dto.getCustomerId(), dto.getUserId());
String agencyId = staffInfo.getAgencyId();
// 根据组织id获取gridId网格id
GridOptionFormDTO gridOptionFormDTO = new GridOptionFormDTO();
gridOptionFormDTO.setAgencyId(agencyId);
gridOptionFormDTO.setPurpose("query");
Result<List<OptionResultDTO>> gridOption = govOrgOpenFeignClient.getGridOption(gridOptionFormDTO);
List<String> gridList = new ArrayList<>();
gridList.add(agencyId);
this.packGirdArray(gridOption.getData(), gridList);
PageHelper.startPage(dto.getPage(), dto.getLimit()); PageHelper.startPage(dto.getPage(), dto.getLimit());
List<CaPingfangResultDTO> result = baseDao.getPage(dto.getBuildingName(), dto.getCommunityName(),dto.getGridId()); List<CaPingfangResultDTO> result = baseDao.getPage(dto.getBuildingName(),
dto.getCommunityName(),
dto.getGridId(),
gridList);
PageInfo<CaPingfangResultDTO> info = new PageInfo<>(result); PageInfo<CaPingfangResultDTO> info = new PageInfo<>(result);
return new PageData<>(result, info.getTotal()); return new PageData<>(result, info.getTotal());
} }
private void packGirdArray(List<OptionResultDTO> options, List<String> gridList) {
if (CollUtil.isNotEmpty(options)) {
for (OptionResultDTO option : options) {
gridList.add(option.getValue());
packGirdArray(option.getChildren(), gridList);
}
}
}
/** /**
* 平房调用ruoyi接口存储数据 * 平房调用ruoyi接口存储数据
* *

37
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/CaRentalServiceImpl.java

@ -1,17 +1,26 @@
package com.epmet.opendata.service.impl; package com.epmet.opendata.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.enums.OrgTypeEnum;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.GridOptionFormDTO;
import com.epmet.dto.result.CustomerStaffGridResultDTO;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.opendata.dao.CaRentalDao; import com.epmet.opendata.dao.CaRentalDao;
import com.epmet.opendata.dto.ca.CaRentalDTO; import com.epmet.opendata.dto.ca.CaRentalDTO;
import com.epmet.opendata.dto.constant.CaWghDataConstant; import com.epmet.opendata.dto.constant.CaWghDataConstant;
@ -31,6 +40,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -47,6 +57,9 @@ public class CaRentalServiceImpl extends BaseServiceImpl<CaRentalDao, CaRentalEn
@Autowired @Autowired
private CaRentalRedis caRentalRedis; private CaRentalRedis caRentalRedis;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Override @Override
public PageData<CaRentalDTO> page(Map<String, Object> params) { public PageData<CaRentalDTO> page(Map<String, Object> params) {
IPage<CaRentalEntity> page = baseDao.selectPage( IPage<CaRentalEntity> page = baseDao.selectPage(
@ -101,15 +114,37 @@ public class CaRentalServiceImpl extends BaseServiceImpl<CaRentalDao, CaRentalEn
@Override @Override
public PageData<CaRentalResultDTO> getPage(CaRentalFormtDTO dto) { public PageData<CaRentalResultDTO> getPage(CaRentalFormtDTO dto) {
// 获取组织id
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(dto.getCustomerId(), dto.getUserId());
String agencyId = staffInfo.getAgencyId();
// 根据组织id获取gridId网格id
GridOptionFormDTO gridOptionFormDTO = new GridOptionFormDTO();
gridOptionFormDTO.setAgencyId(agencyId);
gridOptionFormDTO.setPurpose("query");
Result<List<OptionResultDTO>> gridOption = govOrgOpenFeignClient.getGridOption(gridOptionFormDTO);
List<String> gridList = new ArrayList<>();
gridList.add(agencyId);
this.packGirdArray(gridOption.getData(), gridList);
PageHelper.startPage(dto.getPage(), dto.getLimit()); PageHelper.startPage(dto.getPage(), dto.getLimit());
List<CaRentalResultDTO> result = baseDao.getPage(dto.getResidentName(), List<CaRentalResultDTO> result = baseDao.getPage(dto.getResidentName(),
dto.getHouseName(), dto.getHouseName(),
dto.getRenterName(), dto.getRenterName(),
dto.getGridId()); dto.getGridId(),
gridList);
PageInfo<CaRentalResultDTO> info = new PageInfo<>(result); PageInfo<CaRentalResultDTO> info = new PageInfo<>(result);
return new PageData<>(result, info.getTotal()); return new PageData<>(result, info.getTotal());
} }
private void packGirdArray(List<OptionResultDTO> options, List<String> gridList) {
if (CollUtil.isNotEmpty(options)) {
for (OptionResultDTO option : options) {
gridList.add(option.getValue());
packGirdArray(option.getChildren(), gridList);
}
}
}
/** /**
* 出租房调用ruoyi接口存储数据 * 出租房调用ruoyi接口存储数据
* *

39
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/CaResidentServiceImpl.java

@ -1,5 +1,6 @@
package com.epmet.opendata.service.impl; package com.epmet.opendata.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -8,12 +9,20 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.enums.OrgTypeEnum;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.GridOptionFormDTO;
import com.epmet.dto.result.CustomerStaffGridResultDTO;
import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.opendata.dao.CaResidentDao; import com.epmet.opendata.dao.CaResidentDao;
import com.epmet.opendata.dto.ca.CaResidentDTO; import com.epmet.opendata.dto.ca.CaResidentDTO;
import com.epmet.opendata.dto.constant.CaWghDataConstant; import com.epmet.opendata.dto.constant.CaWghDataConstant;
@ -35,6 +44,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -54,6 +64,9 @@ public class CaResidentServiceImpl extends BaseServiceImpl<CaResidentDao, CaResi
@Autowired @Autowired
private EpmetUserOpenFeignClient openFeignClient; private EpmetUserOpenFeignClient openFeignClient;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Override @Override
public PageData<CaResidentDTO> page(Map<String, Object> params) { public PageData<CaResidentDTO> page(Map<String, Object> params) {
IPage<CaResidentEntity> page = baseDao.selectPage( IPage<CaResidentEntity> page = baseDao.selectPage(
@ -108,15 +121,39 @@ public class CaResidentServiceImpl extends BaseServiceImpl<CaResidentDao, CaResi
@Override @Override
public PageData<CaResidentResultDTO> getPage(CaResidentFormDTO dto) { public PageData<CaResidentResultDTO> getPage(CaResidentFormDTO dto) {
// 获取组织id
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(dto.getCustomerId(), dto.getUserId());
String agencyId = staffInfo.getAgencyId();
// 根据组织id获取gridId网格id
GridOptionFormDTO gridOptionFormDTO = new GridOptionFormDTO();
gridOptionFormDTO.setAgencyId(agencyId);
gridOptionFormDTO.setPurpose("query");
Result<List<OptionResultDTO>> gridOption = govOrgOpenFeignClient.getGridOption(gridOptionFormDTO);
List<String> gridList = new ArrayList<>();
gridList.add(agencyId);
this.packGirdArray(gridOption.getData(), gridList);
// 分页查询
PageHelper.startPage(dto.getPage(), dto.getLimit()); PageHelper.startPage(dto.getPage(), dto.getLimit());
List<CaResidentResultDTO> result = baseDao.getPage(dto.getResidentName(), List<CaResidentResultDTO> result = baseDao.getPage(dto.getResidentName(),
dto.getIdCard(), dto.getIdCard(),
dto.getTelephone(), dto.getTelephone(),
dto.getGridId()); dto.getGridId(),
gridList);
PageInfo<CaResidentResultDTO> info = new PageInfo<>(result); PageInfo<CaResidentResultDTO> info = new PageInfo<>(result);
return new PageData<>(result, info.getTotal()); return new PageData<>(result, info.getTotal());
} }
private void packGirdArray(List<OptionResultDTO> options, List<String> gridList) {
if (CollUtil.isNotEmpty(options)) {
for (OptionResultDTO option : options) {
gridList.add(option.getValue());
packGirdArray(option.getChildren(), gridList);
}
}
}
/** /**
* 人口基本信息调用ruoyi接口存储数据 * 人口基本信息调用ruoyi接口存储数据
* *

38
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/CaRotatorsServiceImpl.java

@ -1,17 +1,26 @@
package com.epmet.opendata.service.impl; package com.epmet.opendata.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.enums.OrgTypeEnum;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.GridOptionFormDTO;
import com.epmet.dto.result.CustomerStaffGridResultDTO;
import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.opendata.dao.CaRotatorsDao; import com.epmet.opendata.dao.CaRotatorsDao;
import com.epmet.opendata.dto.ca.CaRotatorsDTO; import com.epmet.opendata.dto.ca.CaRotatorsDTO;
import com.epmet.opendata.dto.constant.CaWghDataConstant; import com.epmet.opendata.dto.constant.CaWghDataConstant;
@ -31,6 +40,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -50,6 +60,9 @@ public class CaRotatorsServiceImpl extends BaseServiceImpl<CaRotatorsDao, CaRota
@Autowired @Autowired
private EpmetUserOpenFeignClient openFeignClient; private EpmetUserOpenFeignClient openFeignClient;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Override @Override
public PageData<CaRotatorsDTO> page(Map<String, Object> params) { public PageData<CaRotatorsDTO> page(Map<String, Object> params) {
IPage<CaRotatorsEntity> page = baseDao.selectPage( IPage<CaRotatorsEntity> page = baseDao.selectPage(
@ -104,15 +117,38 @@ public class CaRotatorsServiceImpl extends BaseServiceImpl<CaRotatorsDao, CaRota
@Override @Override
public PageData<CaRotatorsResultDTO> getPage(CaRotatorsFormDTO dto) { public PageData<CaRotatorsResultDTO> getPage(CaRotatorsFormDTO dto) {
// 获取组织id
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(dto.getCustomerId(), dto.getUserId());
String agencyId = staffInfo.getAgencyId();
// 根据组织id获取gridId网格id
GridOptionFormDTO gridOptionFormDTO = new GridOptionFormDTO();
gridOptionFormDTO.setAgencyId(agencyId);
gridOptionFormDTO.setPurpose("query");
Result<List<OptionResultDTO>> gridOption = govOrgOpenFeignClient.getGridOption(gridOptionFormDTO);
List<String> gridList = new ArrayList<>();
gridList.add(agencyId);
this.packGirdArray(gridOption.getData(), gridList);
PageHelper.startPage(dto.getPage(), dto.getLimit()); PageHelper.startPage(dto.getPage(), dto.getLimit());
List<CaRotatorsResultDTO> result = baseDao.getPage(dto.getRotatorsName(), List<CaRotatorsResultDTO> result = baseDao.getPage(dto.getRotatorsName(),
dto.getIdCard(), dto.getIdCard(),
dto.getTelephone(), dto.getTelephone(),
dto.getGridId()); dto.getGridId(),
gridList);
PageInfo<CaRotatorsResultDTO> info = new PageInfo<>(result); PageInfo<CaRotatorsResultDTO> info = new PageInfo<>(result);
return new PageData<>(result, info.getTotal()); return new PageData<>(result, info.getTotal());
} }
private void packGirdArray(List<OptionResultDTO> options, List<String> gridList) {
if (CollUtil.isNotEmpty(options)) {
for (OptionResultDTO option : options) {
gridList.add(option.getValue());
packGirdArray(option.getChildren(), gridList);
}
}
}
/** /**
* 流动人口调用ruoyi接口存储数据 * 流动人口调用ruoyi接口存储数据
* *

2
epmet-module/open-data-worker/open-data-worker-server/src/main/resources/db/migration/V0.0.10__add_indexes_of_ca_resident_user.sql

@ -0,0 +1,2 @@
ALTER TABLE `ca_resident_user` ADD INDEX ID_CARD (`id_card` );
ALTER TABLE `ca_resident_user` ADD INDEX DEL_FLAG (`DEL_FLAG` )

35
epmet-module/open-data-worker/open-data-worker-server/src/main/resources/db/migration/V0.0.11__update_ca_view.sql

@ -0,0 +1,35 @@
DROP INDEX DEL_FLAG ON `ca_resident_user`;
DROP VIEW IF EXISTS `view_grid_comm_street_ca`;
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `view_grid_comm_street_ca` AS SELECT
`g4`.`grid_id` AS `grid_id`,
`g4`.`grid_name` AS `grid_name`,
`g3`.`grid_id` AS `community_id`,
`g3`.`grid_name` AS `community_name`,
`g2`.`grid_id` AS `street_id`,
`g2`.`grid_name` AS `street_name`,
concat( `g2`.`grid_id`, ':', `g3`.`grid_id`, ':', `g4`.`grid_id` ) AS `grid_id_path`,
`bbo`.`business_org_id` AS `business_org_id`
FROM
(((
`ca_bm_grid` `g4`
JOIN `ca_bm_grid` `g3` ON (((
`g3`.`grid_id` = `g4`.`parent_id`
)
AND ( `g3`.`grid_level` = 'level3' )
AND ( `g3`.`delete_flag` = 'normal' ))))
JOIN `ca_bm_grid` `g2` ON (((
`g2`.`grid_id` = `g3`.`parent_id`
)
AND ( `g2`.`grid_level` = 'level2' )
AND ( `g2`.`delete_flag` = 'normal' ))))
LEFT JOIN `business_bind_org` `bbo` ON (((
concat( `g4`.`grid_id` ) = `bbo`.`third_org_id`
)
AND ( `bbo`.`business_code` = 'ca' )
AND ( `bbo`.`DEL_FLAG` = '0' ))))
WHERE
((
`g4`.`grid_level` = 'level4'
)
AND ( `g4`.`delete_flag` = 'normal' ))

18
epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/CaLoudongDao.xml

@ -88,7 +88,21 @@
vs.street_name vs.street_name
FROM FROM
ca_loudong as ca ca_loudong as ca
LEFT JOIN view_grid_comm_street_ca as vs on ca.grid_id = vs.grid_id INNER JOIN (
SELECT
viewca.grid_id,
viewca.grid_name,
viewca.community_name,
viewca.street_name,
viewca.business_org_id
FROM
view_grid_comm_street_ca viewca
WHERE
viewca.business_org_id IN
<foreach collection="gridList" open="(" close=")" separator="," item="gridId">
#{gridId}
</foreach>
) AS vs ON ca.grid_id = vs.grid_id
<where> <where>
ca.delete_flag = 'normal' ca.delete_flag = 'normal'
<if test="communityName != null and communityName != ''"> <if test="communityName != null and communityName != ''">
@ -98,7 +112,7 @@
AND ca.building_name like '%${buildingName}%' AND ca.building_name like '%${buildingName}%'
</if> </if>
<if test="gridId != null and gridId != ''"> <if test="gridId != null and gridId != ''">
AND vs.grid_id_path like '%${gridId}%' AND vs.business_org_id = #{gridId}
</if> </if>
</where> </where>
order by ca.grid_id,ca.building_id,ca.community_id desc order by ca.grid_id,ca.building_id,ca.community_id desc

18
epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/CaPingfangDao.xml

@ -85,7 +85,21 @@
vs.street_name vs.street_name
FROM FROM
ca_pingfang as ca ca_pingfang as ca
left join view_grid_comm_street_ca as vs on ca.grid_id = vs.grid_id INNER JOIN (
SELECT
viewca.grid_id,
viewca.grid_name,
viewca.community_name,
viewca.street_name,
viewca.business_org_id
FROM
view_grid_comm_street_ca viewca
WHERE
viewca.business_org_id IN
<foreach collection="gridList" open="(" close=")" separator="," item="gridId">
#{gridId}
</foreach>
) AS vs ON ca.grid_id = vs.grid_id
<where> <where>
ca.delete_flag = 'normal' ca.delete_flag = 'normal'
<if test="buildingName != null and buildingName != ''"> <if test="buildingName != null and buildingName != ''">
@ -95,7 +109,7 @@
AND ca.community_name like '%${communityName}%' AND ca.community_name like '%${communityName}%'
</if> </if>
<if test="gridId != null and gridId != ''"> <if test="gridId != null and gridId != ''">
AND vs.grid_id_path like '%${gridId}%' AND vs.business_org_id = #{gridId}
</if> </if>
</where> </where>
order by ca.grid_id,ca.building_id,ca.community_id desc order by ca.grid_id,ca.building_id,ca.community_id desc

18
epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/CaRentalDao.xml

@ -77,7 +77,21 @@
vs.street_name vs.street_name
FROM FROM
ca_rental as ca ca_rental as ca
left join view_grid_comm_street_ca as vs on ca.grid_id = vs.grid_id INNER JOIN (
SELECT
viewca.grid_id,
viewca.grid_name,
viewca.community_name,
viewca.street_name,
viewca.business_org_id
FROM
view_grid_comm_street_ca viewca
WHERE
viewca.business_org_id IN
<foreach collection="gridList" open="(" close=")" separator="," item="gridId">
#{gridId}
</foreach>
) AS vs ON ca.grid_id = vs.grid_id
<where> <where>
ca.delete_flag = 'normal' ca.delete_flag = 'normal'
<if test="residentName != null and residentName != ''"> <if test="residentName != null and residentName != ''">
@ -90,7 +104,7 @@
AND ca.renter_name like '%${renterName}%' AND ca.renter_name like '%${renterName}%'
</if> </if>
<if test="gridId != null and gridId != ''"> <if test="gridId != null and gridId != ''">
AND vs.grid_id_path like '%${gridId}%' AND vs.business_org_id = #{gridId}
</if> </if>
</where> </where>
order by ca.grid_id,ca.rental_id,ca.id_card desc order by ca.grid_id,ca.rental_id,ca.id_card desc

23
epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/CaResidentDao.xml

@ -103,10 +103,27 @@
ca.plat_code, ca.plat_code,
vs.grid_name, vs.grid_name,
vs.community_name as comName, vs.community_name as comName,
vs.street_name vs.street_name,
cau.home_id,
cau.ic_resi_user_id
FROM FROM
ca_resident as ca ca_resident as ca
left join view_grid_comm_street_ca as vs on ca.grid_id = vs.grid_id INNER JOIN (
SELECT
viewca.grid_id,
viewca.grid_name,
viewca.community_name,
viewca.street_name,
viewca.business_org_id
FROM
view_grid_comm_street_ca viewca
WHERE
viewca.business_org_id IN
<foreach collection="gridList" open="(" close=")" separator="," item="gridId">
#{gridId}
</foreach>
) AS vs ON ca.grid_id = vs.grid_id
left join ca_resident_user as cau on cau.id_card = ca.id_card and del_flag = '0'
<where> <where>
ca.delete_flag = 'normal' ca.delete_flag = 'normal'
<if test="residentName != null and residentName != ''"> <if test="residentName != null and residentName != ''">
@ -119,7 +136,7 @@
AND ca.telephone like '%${telephone}%' AND ca.telephone like '%${telephone}%'
</if> </if>
<if test="gridId != null and gridId != ''"> <if test="gridId != null and gridId != ''">
AND vs.grid_id_path like '%${gridId}%' AND vs.business_org_id = #{gridId}
</if> </if>
</where> </where>
order by ca.grid_id,ca.resident_id,ca.id_card desc order by ca.grid_id,ca.resident_id,ca.id_card desc

18
epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/CaRotatorsDao.xml

@ -109,7 +109,21 @@
vs.street_name vs.street_name
FROM FROM
ca_rotators as ca ca_rotators as ca
left join view_grid_comm_street_ca as vs on vs.grid_id = ca.grid_id INNER JOIN (
SELECT
viewca.grid_id,
viewca.grid_name,
viewca.community_name,
viewca.street_name,
viewca.business_org_id
FROM
view_grid_comm_street_ca viewca
WHERE
viewca.business_org_id IN
<foreach collection="gridList" open="(" close=")" separator="," item="gridId">
#{gridId}
</foreach>
) AS vs ON ca.grid_id = vs.grid_id
<where> <where>
ca.delete_flag = 'normal' ca.delete_flag = 'normal'
<if test="rotatorsName != null and rotatorsName != ''"> <if test="rotatorsName != null and rotatorsName != ''">
@ -122,7 +136,7 @@
AND ca.telephone like '%${telephone}%' AND ca.telephone like '%${telephone}%'
</if> </if>
<if test="gridId != null and gridId != ''"> <if test="gridId != null and gridId != ''">
AND vs.grid_id_path like '%${gridId}%' AND vs.business_org_id = #{gridId}
</if> </if>
</where> </where>
order by ca.grid_id,ca.rotators_id,ca.id_card desc order by ca.grid_id,ca.rotators_id,ca.id_card desc

16
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/impl/ResiMineGridServiceImpl.java

@ -3,6 +3,7 @@ package com.epmet.modules.grid.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
@ -107,7 +108,7 @@ public class ResiMineGridServiceImpl implements ResiMineGridService {
**/ **/
@Override @Override
public LatestGridInfoResultDTO latestGridInfo(LatestGridInfoFormDTO formDTO) { public LatestGridInfoResultDTO latestGridInfo(LatestGridInfoFormDTO formDTO) {
logger.info(String.format("居民端获取用户最近访问网格入参%s", JSON.toJSONString(formDTO))); // logger.info(String.format("居民端获取用户最近访问网格入参%s", JSON.toJSONString(formDTO)));
// 查询注册网格的弃用状态 // 查询注册网格的弃用状态
LatestGridInfoResultDTO result = new LatestGridInfoResultDTO(); LatestGridInfoResultDTO result = new LatestGridInfoResultDTO();
@ -160,6 +161,19 @@ public class ResiMineGridServiceImpl implements ResiMineGridService {
} }
result.setGridId(StringUtils.isNotBlank(userResult.getData().getGridId()) ? userResult.getData().getGridId() : ""); result.setGridId(StringUtils.isNotBlank(userResult.getData().getGridId()) ? userResult.getData().getGridId() : "");
result.setCustomerId(StringUtils.isNotBlank(userResult.getData().getCustomerId()) ? userResult.getData().getCustomerId() : ""); result.setCustomerId(StringUtils.isNotBlank(userResult.getData().getCustomerId()) ? userResult.getData().getCustomerId() : "");
//判断下最后一次访问的网格是否已经被删除或者被弃用
if (StringUtils.isNotBlank(userResult.getData().getGridId())) {
GridInfoCache gridInfoCache=CustomerOrgRedis.getGridInfo(result.getGridId());
if (null == gridInfoCache || (null != gridInfoCache.getAbandonFlag() && NumConstant.ONE == gridInfoCache.getAbandonFlag())) {
result.setGridId(StrConstant.EPMETY_STR);
result.setCustomerId(StrConstant.EPMETY_STR);
logger.error(String.format("获取用户最近访问网格异常,网格可能被删除或者被弃用,参数%s",JSON.toJSONString(formDTO)));
return result;
}
result.setGridId(userResult.getData().getGridId());
} else {
result.setGridId(StrConstant.EPMETY_STR);
}
return result; return result;
} }

8
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -697,6 +697,14 @@ public interface EpmetUserOpenFeignClient {
@PostMapping(value = "/epmetuser/icresiuser/geticresiuser/{icResiUserId}") @PostMapping(value = "/epmetuser/icresiuser/geticresiuser/{icResiUserId}")
Result<IcResiUserDTO> getIcResiUserDTO(@PathVariable("icResiUserId") String icResiUserId); Result<IcResiUserDTO> getIcResiUserDTO(@PathVariable("icResiUserId") String icResiUserId);
/**
* 获取ic_resi_user
* @param icResiUserIdList
* @return
*/
@PostMapping(value = "/epmetuser/icresiuser/list-icresiuser")
Result<List<IcResiUserDTO>> getListIcResiUserDTO(@RequestBody List<String> icResiUserIdList);
/** /**
* @Description 查询居民注册关系 * @Description 查询居民注册关系
* @param userId * @param userId

11
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

@ -515,6 +515,17 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getIcResiUserDTO", icResiUserId); return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getIcResiUserDTO", icResiUserId);
} }
/**
* 获取ic_resi_user
*
* @param icResiUserIdList
* @return
*/
@Override
public Result<List<IcResiUserDTO>> getListIcResiUserDTO(List<String> icResiUserIdList) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getListIcResiUserDTO", icResiUserIdList);
}
@Override @Override
public Result<RegisterRelationDTO> resiRelationInfo(String userId) { public Result<RegisterRelationDTO> resiRelationInfo(String userId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "resiRelationInfo", userId); return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "resiRelationInfo", userId);

14
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java

@ -957,6 +957,20 @@ public class IcResiUserController implements ResultDataResolver {
return new Result<>(); return new Result<>();
} }
/**
* 获取ic_resi_user
* 目前只返回id, name
* @param icResiUserIdList
* @return
*/
@PostMapping(value = "list-icresiuser")
public Result<List<IcResiUserDTO>> getListIcResiUserDTO(@RequestBody List<String> icResiUserIdList) {
if (CollectionUtils.isEmpty(icResiUserIdList)) {
return new Result<>();
}
return new Result<List<IcResiUserDTO>>().ok(icResiUserService.getListIcResiUserDTO(icResiUserIdList));
}
/** /**
* 社区查询搜索居民们 * 社区查询搜索居民们
* *

16
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java

@ -394,11 +394,13 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
@Param("customerId") String customerId); @Param("customerId") String customerId);
/** /**
* @return com.epmet.entity.IcResiUserEntity * @describe: 通过身份证号查询实体类
* @describe: 通过身份证号查询实体类 * @author wangtong
* @author wangtong * @date 2022/6/13 17:32
* @date 2022/6/13 17:32 * @params [idCard, customerId]
* @params [idCard, customerId] * @return com.epmet.entity.IcResiUserEntity
*/ */
IcResiUserEntity selectResiUserEntityByIdCard(@Param("idCard") String idCard, @Param("customerId") String customerId); IcResiUserEntity selectResiUserEntityByIdCard(@Param("idCard") String idCard,@Param("customerId") String customerId);
List<IcResiUserDTO> getListIcResiUserDTO(@Param("icResiUserIdList") List<String> icResiUserIdList);
} }

3
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java

@ -452,4 +452,7 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
* @param entity * @param entity
*/ */
void setIcResiUserPids(IcResiUserEntity entity); void setIcResiUserPids(IcResiUserEntity entity);
List<IcResiUserDTO> getListIcResiUserDTO(List<String> icResiUserIdList);
} }

44
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

@ -2582,6 +2582,19 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
return baseInfoList.stream().map(UserBaseInfoEntity::getUserId).collect(Collectors.toList()); return baseInfoList.stream().map(UserBaseInfoEntity::getUserId).collect(Collectors.toList());
} }
/**
* 目前只返回id,和姓名
* @param icResiUserIdList
* @return
*/
@Override
public List<IcResiUserDTO> getListIcResiUserDTO(List<String> icResiUserIdList) {
if(CollectionUtils.isEmpty(icResiUserIdList)){
return new ArrayList<>();
}
return baseDao.getListIcResiUserDTO(icResiUserIdList);
}
/** /**
* 根据身份证获取居民角色目前只有是否是志愿者 * 根据身份证获取居民角色目前只有是否是志愿者
* *
@ -2650,32 +2663,24 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
@Override @Override
public void bindHome(BindHomeFormDTO form) { public void bindHome(BindHomeFormDTO form) {
// 根据idCard获取ca_redident表的数据 // 根据idCard获取ca_redident表的数据
if (StringUtils.isBlank(form.getIdCard())) {
throw new RenException("身份证号不能为空");
}
GetResidentDetailByIdCardFormDTO dto = new GetResidentDetailByIdCardFormDTO(); GetResidentDetailByIdCardFormDTO dto = new GetResidentDetailByIdCardFormDTO();
dto.setIdCard(form.getIdCard()); dto.setIdCard(form.getIdCard());
Result<ResidentByIdCardResultDTO> result = guardarDatosFeignClient.getResidentDetailByIdCard(dto); Result<ResidentByIdCardResultDTO> result = guardarDatosFeignClient.getResidentDetailByIdCard(dto);
ResidentByIdCardResultDTO residentDetailByIdCard = result.getData(); ResidentByIdCardResultDTO residentDetailByIdCard = result.getData();
if (org.springframework.util.StringUtils.isEmpty(residentDetailByIdCard)) { if(!result.success() || residentDetailByIdCard == null){
throw new RenException("获取不到人的信息"); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取居民信息失败", "获取居民信息失败");
}
// 根据房屋id获取房屋信息
if (StringUtils.isBlank(form.getHomeId())) {
throw new RenException("房屋id不能为空");
} }
HouseInfoCache houseInfo = CustomerIcHouseRedis.getHouseInfo(form.getCustomerId(), form.getHomeId()); HouseInfoCache houseInfo = CustomerIcHouseRedis.getHouseInfo(form.getCustomerId(), form.getHomeId());
if (org.springframework.util.StringUtils.isEmpty(houseInfo)) { if(houseInfo == null){
throw new RenException("获取不到房屋信息"); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取房屋信息失败", "获取房屋信息失败");
} }
// 将人的信息放入ic_resi_user对象中 // 将人的信息放入ic_resi_user对象中
IcResiUserEntity entity = new IcResiUserEntity(); IcResiUserEntity entity = new IcResiUserEntity();
entity.setCustomerId(form.getCustomerId()); entity.setCustomerId(form.getCustomerId());
// 进行日期转换 // 进行日期转换
if(residentDetailByIdCard.getBirthday() == null){ if(residentDetailByIdCard.getBirthday() == null){
throw new RenException("出生日期为空"); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取出生日期失败", "获取出生日期失败");
} }
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String birthday = sdf.format(residentDetailByIdCard.getBirthday()); String birthday = sdf.format(residentDetailByIdCard.getBirthday());
@ -2688,7 +2693,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
entity.setMobile(residentDetailByIdCard.getTelephone()); entity.setMobile(residentDetailByIdCard.getTelephone());
entity.setBirthday(birthday); entity.setBirthday(birthday);
} else { } else {
throw new RenException("人信息不全"); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "居民信息不完整", "居民信息不完整");
} }
// 将房屋的信息放入ic_resi_user对象中 // 将房屋的信息放入ic_resi_user对象中
if (StringUtils.isNotBlank(houseInfo.getHomeId()) if (StringUtils.isNotBlank(houseInfo.getHomeId())
@ -2702,10 +2707,11 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
entity.setAgencyId(houseInfo.getAgencyId()); entity.setAgencyId(houseInfo.getAgencyId());
// 根据homeId获取gridId和pids // 根据homeId获取gridId和pids
Result<HouseAgencyInfoResultDTO> resultDTOResult = getGovOrgOpenFeignClient.getHouseAgencyInfo(houseInfo.getHomeId()); Result<HouseAgencyInfoResultDTO> resultDTOResult = getGovOrgOpenFeignClient.getHouseAgencyInfo(houseInfo.getHomeId());
entity.setGridId(resultDTOResult.getData().getGridId()); HouseAgencyInfoResultDTO data = resultDTOResult.getData();
entity.setPids(resultDTOResult.getData().getPids()); entity.setGridId(data.getGridId());
entity.setPids(data.getPids() + ":" + data.getAgencyId());
} else { } else {
throw new RenException("房屋信息不全"); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "房屋信息不完整", "房屋信息不完整");
} }
SaveCaResidentUserFormDTO saveForm = new SaveCaResidentUserFormDTO(); SaveCaResidentUserFormDTO saveForm = new SaveCaResidentUserFormDTO();
saveForm.setHomeId(form.getHomeId()); saveForm.setHomeId(form.getHomeId());
@ -2714,14 +2720,12 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
String id = baseDao.seletIdByIdCard(entity.getCustomerId(),entity.getIdCard()); String id = baseDao.seletIdByIdCard(entity.getCustomerId(),entity.getIdCard());
baseDao.updateIcResiUserByIdCard(entity); baseDao.updateIcResiUserByIdCard(entity);
saveForm.setIcResiUserId(id); saveForm.setIcResiUserId(id);
guardarDatosFeignClient.saveCaResidentUser(saveForm);
} else { } else {
baseDao.insert(entity); baseDao.insert(entity);
String id = baseDao.seletIdByIdCard(entity.getCustomerId(),entity.getIdCard()); String id = baseDao.seletIdByIdCard(entity.getCustomerId(),entity.getIdCard());
saveForm.setIcResiUserId(id); saveForm.setIcResiUserId(id);
guardarDatosFeignClient.saveCaResidentUser(saveForm);
} }
guardarDatosFeignClient.saveCaResidentUser(saveForm);
} }
/** /**

9
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

@ -1164,4 +1164,13 @@
AND customer_id = #{customerId} AND customer_id = #{customerId}
AND DEL_FLAG = '0' AND DEL_FLAG = '0'
</select> </select>
<select id="getListIcResiUserDTO" parameterType="map" resultType="com.epmet.dto.IcResiUserDTO">
select id, NAME,MOBILE
from ic_resi_user
WHERE DEL_FLAG = '0'
<foreach collection="icResiUserIdList" item="icResiUserId" open="AND (" separator="or" close=")">
id = #{icResiUserId}
</foreach>
</select>
</mapper> </mapper>

Loading…
Cancel
Save