diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/IcResiUserDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/IcResiUserDao.java index 5dd78f714c..8705014852 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/IcResiUserDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/IcResiUserDao.java @@ -69,6 +69,7 @@ public interface IcResiUserDao extends BaseDao { * @return */ List listByPolicyRules(@Param("customerId") String customerId, + @Param("orgIdPath") String orgIdPath, @Param("orgId") String orgId, @Param("orgType") String orgType, @Param("neighborHoodId") String neighborHoodId, @@ -86,6 +87,7 @@ public interface IcResiUserDao extends BaseDao { * @return */ Integer getTotalByPolicyRules(@Param("customerId") String customerId, + @Param("orgIdPath") String orgIdPath, @Param("orgId") String orgId, @Param("orgType") String orgType, @Param("neighborHoodId") String neighborHoodId, diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java index ca91cd86e7..01b9dae907 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java @@ -201,11 +201,11 @@ public interface EpmetUserService { */ List staffSelectList(List staffIds); - List listByPolicyRules(String customerId, String orgId, String orgType, String neighborHoodId, String buildingId, String unitId, + List listByPolicyRules(String customerId, String orgIdPath, String orgId, String orgType, String neighborHoodId, String buildingId, String unitId, String houseId, String idCard, String name, Integer pageNo, Integer pageSize, List resiRule, List houseIds); - Integer getTotalByPolicyRules(String customerId, String orgId, String orgType, String neighborHoodId, String buildingId, String unitId, + Integer getTotalByPolicyRules(String customerId, String orgIdPath, String orgId, String orgType, String neighborHoodId, String buildingId, String unitId, String houseId, String idCard, String name, List resiRule, List houseIds); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java index 7c710b9e03..000affa6ff 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java @@ -846,15 +846,15 @@ public class EpmetUserServiceImpl implements EpmetUserService { } @Override - public List listByPolicyRules(String customerId, String orgId, String orgType, String neighborHoodId, String buildingId, String unitId, + public List listByPolicyRules(String customerId, String orgIdPath, String orgId, String orgType, String neighborHoodId, String buildingId, String unitId, String houseId, String idCard, String name, Integer pageNo, Integer pageSize, List resiRule, List houseIds) { PageHelper.startPage(pageNo, pageSize); - return icResiUserDao.listByPolicyRules(customerId, orgId, orgType, neighborHoodId, buildingId, unitId, houseId, idCard, name, resiRule, houseIds); + return icResiUserDao.listByPolicyRules(customerId, orgIdPath, orgId, orgType, neighborHoodId, buildingId, unitId, houseId, idCard, name, resiRule, houseIds); } @Override - public Integer getTotalByPolicyRules(String customerId, String orgId, String orgType, String neighborHoodId, String buildingId, String unitId, String houseId, String idCard, String name, List resiRule, List houseIds) { - return icResiUserDao.getTotalByPolicyRules(customerId, orgId, orgType, neighborHoodId, buildingId, unitId, houseId, idCard, name, resiRule, houseIds); + public Integer getTotalByPolicyRules(String customerId, String orgIdPath, String orgId, String orgType, String neighborHoodId, String buildingId, String unitId, String houseId, String idCard, String name, List resiRule, List houseIds) { + return icResiUserDao.getTotalByPolicyRules(customerId, orgIdPath, orgId, orgType, neighborHoodId, buildingId, unitId, houseId, idCard, name, resiRule, houseIds); } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java index 237a0cf6f2..c3908fad04 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java @@ -218,7 +218,7 @@ public interface GovOrgService { */ CustomerAgencyEntity getRootAgencyByCustomerId(String customerId); - List listHousesByRules(String customerId, String orgId, String orgType, String neighborHoodId, String buildingId, + List listHousesByRules(String customerId, String orgIdPath, String orgId, String orgType, String neighborHoodId, String buildingId, String unitId, String houseId, List houseRule, List statRule, Integer pageNo, Integer pageSize); diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java index 945cb2ab59..a57f014463 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java @@ -1110,7 +1110,7 @@ public class GovOrgServiceImpl implements GovOrgService { } @Override - public List listHousesByRules(String customerId, String orgId, String orgType, String neighborHoodId, String buildingId, + public List listHousesByRules(String customerId, String orgIdPath, String orgId, String orgType, String neighborHoodId, String buildingId, String unitId, String houseId, List houseRule, List statRule, Integer pageNo, Integer pageSize) { @@ -1120,11 +1120,13 @@ public class GovOrgServiceImpl implements GovOrgService { QueryWrapper query = new QueryWrapper<>(); + // 如果参数里面选了,就用参数选择的来查询,没有选择的话,就查询当前工作人员所属组织的本级及下级 if (StringUtils.isNotBlank(orgId) && StringUtils.isNotBlank(orgType)) { - String orgIdPath = getOrgIdPath(orgId, orgType); - query.likeRight(StringUtils.isNotBlank(orgIdPath), "ORG_ID_PATH", orgIdPath); + orgIdPath = getOrgIdPath(orgId, orgType); } + query.likeRight(StringUtils.isNotBlank(orgIdPath), "ORG_ID_PATH", orgIdPath); + if (StringUtils.isNotBlank(customerId)) { query.eq("CUSTOMER_ID", customerId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/ResiServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/ResiServiceImpl.java index 44a522eaa7..428d87ed3e 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/ResiServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/ResiServiceImpl.java @@ -22,7 +22,10 @@ import com.epmet.dataaggre.service.ResiService; import com.epmet.dataaggre.service.epmetuser.EpmetUserService; import com.epmet.dataaggre.service.govorg.GovOrgService; import com.epmet.dto.IcNeighborHoodDTO; +import com.epmet.dto.form.LoginUserDetailsFormDTO; +import com.epmet.dto.result.LoginUserDetailsResultDTO; import com.epmet.feign.EpmetHeartOpenFeignClient; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.github.pagehelper.PageInfo; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -48,21 +51,34 @@ public class ResiServiceImpl implements ResiService, ResultDataResolver { @Autowired private EpmetHeartOpenFeignClient heartOpenFeignClient; + @Autowired + private EpmetUserOpenFeignClient userOpenFeignClient; + @Override public PageData listByPolicyRules(String orgId, String orgType, String neighborHoodId, String buildingId, String unitId, String houseId, String idCard, String name, Integer pageNo, Integer pageSize, List resiRule, List houseRule, List statRule) { + String userId = EpmetRequestHolder.getLoginUserId(); + String app = EpmetRequestHolder.getLoginUserApp(); + String client = EpmetRequestHolder.getLoginUserClient(); String customerId = EpmetRequestHolder.getLoginUserCustomerId(); + // 查询当前组织及下级id路径 + LoginUserDetailsResultDTO userDetail = getResultDataOrThrowsException(userOpenFeignClient.getLoginUserDetails(new LoginUserDetailsFormDTO(app, client, userId)), + ServiceConstant.EPMET_USER_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null, null); + + String orgIdPath = userDetail.getOrgIdPath(); + // 结果集 List resultResis = new ArrayList<>(); // 1.用户没配置house和stat规则,直接按照居民规则查询 if (CollectionUtils.isEmpty(houseRule) && CollectionUtils.isEmpty(statRule)) { - List resis = epmetUserService.listByPolicyRules(customerId, orgId, orgType, neighborHoodId, buildingId, unitId, + List resis = epmetUserService.listByPolicyRules(customerId, orgIdPath, orgId, orgType, neighborHoodId, buildingId, unitId, houseId, idCard, name, pageNo, pageSize, resiRule, null); + fillResisExtraInfoForPolicy(resis); return new PageData<>(resis, new PageInfo(resis).getTotal()); } @@ -71,7 +87,7 @@ public class ResiServiceImpl implements ResiService, ResultDataResolver { int total = 0; do { // 拿到房屋id列表,去查询居民列表 - List houseEntities = govOrgService.listHousesByRules(customerId, orgId, orgType, neighborHoodId, buildingId, unitId, + List houseEntities = govOrgService.listHousesByRules(customerId, orgIdPath, orgId, orgType, neighborHoodId, buildingId, unitId, houseId, houseRule, statRule, housePageNo, 50); List houseIds = houseEntities.stream().map(icHouseEntity -> icHouseEntity.getId()).collect(Collectors.toList()); @@ -83,7 +99,7 @@ public class ResiServiceImpl implements ResiService, ResultDataResolver { // 查询居民,满了20个,不再查询数据,只查询数量 if (resultResis.size() < pageSize) { List resis = epmetUserService.listByPolicyRules( - customerId, orgId, orgType, neighborHoodId, buildingId, unitId, + customerId, orgIdPath, orgId, orgType, neighborHoodId, buildingId, unitId, houseId, idCard, name, pageNo, pageSize, resiRule, houseIds); resultResis.addAll(resis); @@ -91,7 +107,7 @@ public class ResiServiceImpl implements ResiService, ResultDataResolver { // 查询数量 Integer count = epmetUserService.getTotalByPolicyRules( - customerId, orgId, orgType, neighborHoodId, buildingId, unitId, + customerId, orgIdPath, orgId, orgType, neighborHoodId, buildingId, unitId, houseId, idCard, name, resiRule, houseIds); total += count; diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/IcResiUserDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/IcResiUserDao.xml index 8fa83ca190..ffb7246583 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/IcResiUserDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/IcResiUserDao.xml @@ -73,6 +73,7 @@ ic_resi_user.status='0' and ic_resi_user.CUSTOMER_ID=#{customerId} + and ic_resi_user.PIDS LIKE CONCAT(#{orgIdPath},'%') and ic_resi_user.del_flag='0'