diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/ResisByPolicyRulesFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/ResisByPolicyRulesFormDTO.java index e89f1131cf..974172a7e4 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/ResisByPolicyRulesFormDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/ResisByPolicyRulesFormDTO.java @@ -32,9 +32,9 @@ public class ResisByPolicyRulesFormDTO { @AllArgsConstructor public static class RuleList { private String ruleName; - private List resiRule; - private List houseRule; - private List statRule; + private List resiRuleList; + private List houseRuleList; + private List statRuleList; } @Data diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/IcUserController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/IcUserController.java index 5659dca060..1216c2b193 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/IcUserController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/IcUserController.java @@ -2,10 +2,13 @@ package com.epmet.dataaggre.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dataaggre.dto.epmetuser.form.IcUserCategoryFormDTO; @@ -14,7 +17,9 @@ import com.epmet.dataaggre.dto.epmetuser.result.IcUserCategoryResultDTO; import com.epmet.dataaggre.dto.epmetuser.result.ResiByPolicyInfoResultDTO; import com.epmet.dataaggre.service.ResiService; import com.epmet.dataaggre.service.epmetuser.EpmetUserService; +import com.epmet.feign.EpmetHeartOpenFeignClient; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -30,7 +35,7 @@ import java.util.Set; @RestController @RequestMapping("icuser") -public class IcUserController { +public class IcUserController implements ResultDataResolver { @Autowired private EpmetUserService epmetUserService; @@ -38,6 +43,9 @@ public class IcUserController { @Autowired private ResiService icResiService; + @Autowired + private EpmetHeartOpenFeignClient heartOpenFeignClient; + /** * 【人员类别分析】-各类别人数 * @@ -59,13 +67,14 @@ public class IcUserController { */ @PostMapping("listByPolicyRules") public Result> listByPolicyRules(@RequestBody ResisByPolicyRulesFormDTO input) { + + List resiRule = input.getRuleList().getResiRuleList(); + List houseRule = input.getRuleList().getHouseRuleList(); + List statRule = input.getRuleList().getStatRuleList(); + Integer pageNo = input.getPageNo(); Integer pageSize = input.getPageSize(); - List resiRule = input.getRuleList().getResiRule(); - List houseRule = input.getRuleList().getHouseRule(); - List statRule = input.getRuleList().getStatRule(); - String orgId = input.getOrgId(); String orgType = input.getOrgType(); String neighborHoodId = input.getNeighborHoodId(); @@ -74,8 +83,22 @@ public class IcUserController { String houseId = input.getHouseId(); String idCard = input.getIdCard(); String name = input.getName(); + String ruleId = input.getRuleId(); + + if (StringUtils.isNotBlank(ruleId)) { + // 从heart取,覆盖形参 + com.epmet.dto.form.resi.ResisByPolicyRulesFormDTO.RuleList ruleList = getResultDataOrThrowsException( + heartOpenFeignClient.listPolicyRules4QueryAndExport(ruleId), + ServiceConstant.EPMET_HEART_SERVER, + EpmetErrorCode.SERVER_ERROR.getCode(), + null, null); + + resiRule = ConvertUtils.sourceToTarget(ruleList.getResiRuleList(), ResisByPolicyRulesFormDTO.ResiRule.class); + houseRule = ConvertUtils.sourceToTarget(ruleList.getHouseRuleList(), ResisByPolicyRulesFormDTO.HouseRule.class); + statRule = ConvertUtils.sourceToTarget(ruleList.getStatRuleList(), ResisByPolicyRulesFormDTO.StatRule.class); + } - // 全都为空,则返回空 + // 全都为空,则返回空ç if (CollectionUtils.isEmpty(resiRule) && CollectionUtils.isEmpty(houseRule) && CollectionUtils.isEmpty(statRule)) { @@ -97,7 +120,7 @@ public class IcUserController { icResiService.exportResisByPolicy( input.getOrgId(), input.getOrgType(), input.getNeighborHoodId(), input.getBuildingId(), input.getUnitId(), input.getHouseId(), input.getIdCard(), input.getName(), input.getPageNo(), input.getPageSize(), - input.getRuleId(), input.getRuleList().getResiRule(), input.getRuleList().getHouseRule(), input.getRuleList().getStatRule(), response); + input.getRuleId(), input.getRuleList().getResiRuleList(), input.getRuleList().getHouseRuleList(), input.getRuleList().getStatRuleList(), response); } catch (IOException e) { throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "导出Excel文件失败", "导出Excel文件失败"); } 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/dao/govorg/IcHouseDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/IcHouseDao.java index 5df9a571dc..568e74e5cb 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/IcHouseDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/IcHouseDao.java @@ -1,8 +1,12 @@ package com.epmet.dataaggre.dao.govorg; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dataaggre.dto.epmetuser.form.ResisByPolicyRulesFormDTO; import com.epmet.dataaggre.entity.govorg.IcHouseEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 房屋信息 @@ -12,4 +16,24 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface IcHouseDao extends BaseDao { + /** + * 为政策-预览居民,提供房屋id列表查询 + * @param orgIdPath + * @param customerId + * @param neighborHoodId + * @param buildingId + * @param unitId + * @param houseId + * @param houseRule + * @param statRule + * @return + */ + List listHouseIds4PolicyResis(@Param("orgIdPath") String orgIdPath, + @Param("customerId") String customerId, + @Param("neighborHoodId") String neighborHoodId, + @Param("buildingId") String buildingId, + @Param("unitId") String unitId, + @Param("houseId") String houseId, + @Param("houseRule") List houseRule, + @Param("statRule") List statRule); } 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 267af969ea..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 @@ -45,6 +45,7 @@ import com.epmet.dataaggre.service.opercustomize.CustomerFootBarService; import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.UserBaseInfoDTO; import com.epmet.dto.result.StaffRoleResultDTO; +import com.github.pagehelper.PageHelper; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; @@ -845,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) { - - return icResiUserDao.listByPolicyRules(customerId, orgId, orgType, neighborHoodId, buildingId, unitId, houseId, idCard, name, resiRule, houseIds); + PageHelper.startPage(pageNo, pageSize); + 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..ee502bd493 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 listHouseIdsByRules(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..e869553be3 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 listHouseIdsByRules(String customerId, String orgIdPath, String orgId, String orgType, String neighborHoodId, String buildingId, String unitId, String houseId, List houseRule, List statRule, Integer pageNo, Integer pageSize) { @@ -1118,45 +1118,12 @@ public class GovOrgServiceImpl implements GovOrgService { return new ArrayList<>(); } - 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); - } - - if (StringUtils.isNotBlank(customerId)) { - query.eq("CUSTOMER_ID", customerId); - } - if (StringUtils.isNotBlank(neighborHoodId)) { - query.eq("NEIGHBOR_HOOD_ID", neighborHoodId); - } - if (StringUtils.isNotBlank(buildingId)) { - query.eq("BUILDING_ID", buildingId); - } - if (StringUtils.isNotBlank(unitId)) { - query.eq("BUILDING_UNIT_ID", unitId); - } - if (StringUtils.isNotBlank(houseId)) { - query.eq("ID", houseId); - } - - // 房屋属性 - if (CollectionUtils.isNotEmpty(houseRule)) { - for (ResisByPolicyRulesFormDTO.HouseRule rule : houseRule) { - query.eq(rule.getColKey(), rule.getColVal()); - } - } - - // 房屋的统计属性 - if (CollectionUtils.isNotEmpty(statRule)) { - for (ResisByPolicyRulesFormDTO.StatRule rule : statRule) { - query.eq(rule.getColKey(), rule.getColVal()); - } + orgIdPath = getOrgIdPath(orgId, orgType); } PageHelper.startPage(pageNo, pageSize); - return houseDao.selectList(query); + return houseDao.listHouseIds4PolicyResis(orgIdPath, customerId, neighborHoodId, buildingId, unitId, houseId, houseRule, statRule); } @Override 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 b0de4560f1..32cc0cbfa1 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,17 +22,24 @@ 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; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.web.servlet.resource.ResourceUrlEncodingFilter; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.time.*; +import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; +import java.time.temporal.TemporalUnit; import java.util.*; import java.util.stream.Collectors; @@ -48,21 +55,37 @@ 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(); + // 对特殊规则进行转换。 + specificRuleConvert(resiRule); + + // 查询当前组织及下级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,9 +94,8 @@ public class ResiServiceImpl implements ResiService, ResultDataResolver { int total = 0; do { // 拿到房屋id列表,去查询居民列表 - List houseEntities = govOrgService.listHousesByRules(customerId, orgId, orgType, neighborHoodId, buildingId, unitId, + List houseIds = govOrgService.listHouseIdsByRules(customerId, orgIdPath, orgId, orgType, neighborHoodId, buildingId, unitId, houseId, houseRule, statRule, housePageNo, 50); - List houseIds = houseEntities.stream().map(icHouseEntity -> icHouseEntity.getId()).collect(Collectors.toList()); if (houseIds.size() == 0) { // 用户使用了房屋和统计相关的条件,但是没查到房屋,我看就没有走下去了的必要了吧.. @@ -83,7 +105,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 +113,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; @@ -109,6 +131,46 @@ public class ResiServiceImpl implements ResiService, ResultDataResolver { return new PageData<>(resultResis, total); } + /** + * 为特定的规则进行转换 + * @param resiRule + */ + private void specificRuleConvert(List resiRule) { + // 使用年龄计算出生日期 + resiRule.stream().forEach((r) -> { + if ("BIRTHDAY".equals(r.getColKey())) { + LocalDate birthday = LocalDate.now().minus(Long.valueOf(r.getColVal()), ChronoUnit.YEARS); + r.setQueryType(revertQueryType(r.getQueryType())); + r.setColVal(birthday.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); + } + }); + } + + /** + * 翻转逻辑操作符 + * @param oldRel + * @return + */ + private String revertQueryType(String oldRel) { + if (">".equals(oldRel)) { + return "<"; + } + + if (">=".equals(oldRel)) { + return "<="; + } + + if ("<".equals(oldRel)) { + return ">"; + } + + if ("<=".equals(oldRel)) { + return ">="; + } + + return ""; + } + /** * 补充额外信息 * @param resultResis @@ -167,9 +229,9 @@ public class ResiServiceImpl implements ResiService, ResultDataResolver { EpmetErrorCode.SERVER_ERROR.getCode(), null, null); - resiRule = ConvertUtils.sourceToTarget(ruleList.getResiRule(), ResisByPolicyRulesFormDTO.ResiRule.class); - houseRule = ConvertUtils.sourceToTarget(ruleList.getHouseRule(), ResisByPolicyRulesFormDTO.HouseRule.class); - statRule = ConvertUtils.sourceToTarget(ruleList.getStatRule(), ResisByPolicyRulesFormDTO.StatRule.class); + resiRule = ConvertUtils.sourceToTarget(ruleList.getResiRuleList(), ResisByPolicyRulesFormDTO.ResiRule.class); + houseRule = ConvertUtils.sourceToTarget(ruleList.getHouseRuleList(), ResisByPolicyRulesFormDTO.HouseRule.class); + statRule = ConvertUtils.sourceToTarget(ruleList.getStatRuleList(), ResisByPolicyRulesFormDTO.StatRule.class); } ServletOutputStream ostream = response.getOutputStream(); 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 f0c98c7732..703bcc2bfa 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 @@ -71,7 +71,10 @@ - ic_resi_user.CUSTOMER_ID=#{customerId} + 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' @@ -84,23 +87,23 @@ - + and ic_resi_user.VILLAGE_ID=#{neighborHoodId} - + and ic_resi_user.BUILD_ID=#{buildingId} - + and ic_resi_user.UNIT_ID=#{unitId} - + and ic_resi_user.HOME_ID=#{houseId} - - and ic_resi_user.ID_CARD like CONCAT('%'#{idCard}, '%') + + and ic_resi_user.ID_CARD like CONCAT('%',#{idCard}, '%') - - and ic_resi_user.NAME like CONCAT('%'#{name}, '%') + + and ic_resi_user.NAME like CONCAT('%',#{name}, '%') @@ -121,13 +124,13 @@ + select ic_house.ID + from ic_house + + DEL_FLAG = '0' + and ic_house.CUSTOMER_ID = #{customerId} + and ic_house.ORG_ID_PATH like CONCAT(#{orgIdPath}, '%') + + and ic_house.NEIGHBOR_HOOD_ID = #{neighborHoodId} + + + and ic_house.BUILDING_ID = #{buildingId} + + + and ic_house.BUILDING_UNIT_ID = #{unitId} + + + and ic_house.ID = #{houseId} + + + and + + ${rule.colTable}.${rule.colKey} ${rule.queryType} #{rule.colVal} ${rule.nextLogicalRel} + + + + + and + + ${rule.colTable}.${rule.colKey} ${rule.queryType} #{rule.colVal} ${rule.nextLogicalRel} + + + + diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/policy/IcPolicyRuleDetailDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/policy/IcPolicyRuleDetailDTO.java index 79be9a25ff..d9f15f9637 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/policy/IcPolicyRuleDetailDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/policy/IcPolicyRuleDetailDTO.java @@ -66,5 +66,29 @@ public class IcPolicyRuleDetailDTO { */ @NotBlank(message = "参数值不能为空", groups = {ResiRulerShowGroup.class,HouseRulerShowGroup.class,StatRulerShowGroup.class}) private String colVal; + + /** + * 用于前端展示:基础信息、教育信息、房屋类型..... + */ + private String itemGroupName; + /** + * 用于前端展示:姓名、手机号、...... + */ + private String itemLabel; + + /** + * 用于前端展示:等于、不等于、大于、小于.... + */ + private String queryTypeName; + + /** + * 用于前端展示:参数值显示值eg:男女 + */ + private String colValLabel; + + /** + * 用于前端展示:逻辑:并且、或者 + */ + private String nextLogicalRelName; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/HeartResisByPolicyRulesFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/HeartResisByPolicyRulesFormDTO.java deleted file mode 100644 index 11ff13ac65..0000000000 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/HeartResisByPolicyRulesFormDTO.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.epmet.dto.form.resi; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.Comparator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class HeartResisByPolicyRulesFormDTO { - private String ruleId; - private String orgId; - private String orgType; - private String neighborHoodId; - private String buildingId; - private String unitId; - private String houseId; - private String name; - private String mobile; - private String idCard; - private RuleList ruleList; - private Integer pageNo; - private Integer pageSize; - - @Data - public static class RuleList { - private String ruleName; - private List resiRule; - private List houseRule; - private List statRule; - } - - @Data - public static class ResiRule { - private String ruleDesc; - private String nextLogicalRel; - private String itemGroupId; - private String itemId; - private String queryType; - private String colTable; - private String colKey; - private String colVal; - } - - @Data - public static class HouseRule { - private String colTable; - private String colKey; - private String colVal; - private String ruleDesc; - private String nextLogicalRel; - private String queryType; - } - - @Data - public static class StatRule { - private String colKey; - private String colVal; - private String nextLogicalRel; - private String ruleDesc; - private String queryType; - private String colTable; - } -} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResisByPolicyRulesFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResisByPolicyRulesFormDTO.java index 9522159e12..b65e138cdc 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResisByPolicyRulesFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResisByPolicyRulesFormDTO.java @@ -28,9 +28,9 @@ public class ResisByPolicyRulesFormDTO { @NoArgsConstructor @AllArgsConstructor public static class RuleList { - private List resiRule; - private List houseRule; - private List statRule; + private List resiRuleList; + private List houseRuleList; + private List statRuleList; } @Data diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPolicyController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPolicyController.java index f27d291844..53cd8815b5 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPolicyController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPolicyController.java @@ -50,52 +50,6 @@ public class IcPolicyController { return new Result>().ok(list); } - /** - * 政策找人,居民列表 - * @param input - * @return - */ - @PostMapping("resiuserlist") - public Result listResiUserByPolicyRules(@RequestBody ResisByPolicyRulesFormDTO input) { - // 调整错位的逻辑符号位置 - //adjustMalpositionLogicalOperatorPosition(input); - PageData page = icPolicyService.listResiUserByPolicyRules(input); - return new Result().ok(page); - } - - /** - * 调整错位的逻辑运算符 - * @param input - */ - //private void adjustMalpositionLogicalOperatorPosition(ResisByPolicyRulesFormDTO input) { - // List resiRule = input.getRuleList().getResiRule(); - // List houseRule = input.getRuleList().getHouseRule(); - // List statRule = input.getRuleList().getStatRule(); - // - // if (CollectionUtils.isNotEmpty(resiRule)) { - // for (int i = 1; i < resiRule.size() - 1; i++) { - // ResisByPolicyRulesFormDTO.ResiRule current = resiRule.get(i); - // ResisByPolicyRulesFormDTO.ResiRule last = resiRule.get(i - 1); - // current.setLastLogicalRel(last.getLastLogicalRel()); - // } - // } - // - // if (CollectionUtils.isNotEmpty(houseRule)) { - // for (int i = 1; i < houseRule.size() - 1; i++) { - // ResisByPolicyRulesFormDTO.HouseRule current = houseRule.get(i); - // ResisByPolicyRulesFormDTO.HouseRule last = houseRule.get(i - 1); - // current.setLastLogicalRel(last.getLastLogicalRel()); - // } - // } - // - // if (CollectionUtils.isNotEmpty(statRule)) { - // for (int i = 1; i < statRule.size() - 1; i++) { - // ResisByPolicyRulesFormDTO.StatRule current = statRule.get(i); - // ResisByPolicyRulesFormDTO.StatRule last = statRule.get(i - 1); - // current.setLastLogicalRel(last.getLastLogicalRel()); - // } - // } - //} /** * 政策管理-新增/修改 @@ -146,7 +100,6 @@ public class IcPolicyController { /** * Desc: 政策列表下拉选 * @param tokenDto - * @param formDTO * @author zxc * @date 2022/7/21 09:48 */ @@ -199,7 +152,7 @@ public class IcPolicyController { r.getItemId(), r.getQueryType(), r.getColTable(), r.getColKey(), r.getColVal())) .collect(Collectors.toList()); - data.setResiRule(resiRules); + data.setResiRuleList(resiRules); } // house规则 @@ -210,7 +163,7 @@ public class IcPolicyController { .map((r) -> new ResisByPolicyRulesFormDTO.HouseRule(r.getColTable(), r.getColKey(), r.getColVal(), r.getRuleDesc(), r.getNextLogicalRel(), r.getQueryType())) .collect(Collectors.toList()); - data.setHouseRule(houseRules); + data.setHouseRuleList(houseRules); } // stat规则 @@ -222,7 +175,7 @@ public class IcPolicyController { r.getRuleDesc(), r.getQueryType(), r.getColTable())) .collect(Collectors.toList()); - data.setStatRule(statRules); + data.setStatRuleList(statRules); } return new Result().ok(data); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPolicyRuleDetailEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPolicyRuleDetailEntity.java index 7516f2aca6..9a29c03d1b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPolicyRuleDetailEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPolicyRuleDetailEntity.java @@ -84,4 +84,27 @@ public class IcPolicyRuleDetailEntity extends BaseEpmetEntity { */ private Integer sort; + /** + * 用于前端展示:基础信息、教育信息、房屋类型..... + */ + private String itemGroupName; + /** + * 用于前端展示:姓名、手机号、...... + */ + private String itemLabel; + + /** + * 用于前端展示:等于、不等于、大于、小于.... + */ + private String queryTypeName; + + /** + * 用于前端展示:参数值显示值eg:男女 + */ + private String colValLabel; + + /** + * 用于前端展示:逻辑:并且、或者 + */ + private String nextLogicalRelName; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPolicyService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPolicyService.java index d57a6ca886..e13fb4722f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPolicyService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPolicyService.java @@ -57,8 +57,6 @@ public interface IcPolicyService extends BaseService { IcPolicyDTO policyDetail(String customerId,String policyId); - PageData listResiUserByPolicyRules(ResisByPolicyRulesFormDTO input); - /** * 政策规则查询 * @param customerId diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPolicyServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPolicyServiceImpl.java index 77900d2519..194b9561b2 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPolicyServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPolicyServiceImpl.java @@ -321,62 +321,6 @@ public class IcPolicyServiceImpl extends BaseServiceImpl listResiUserByPolicyRules(com.epmet.dto.form.resi.ResisByPolicyRulesFormDTO input) { - String customerId = EpmetRequestHolder.getLoginUserCustomerId(); - String ruleId = input.getRuleId(); - - ResisByPolicyRulesFormDTO aggForm = ConvertUtils.sourceToTarget(input, ResisByPolicyRulesFormDTO.class); - - // 穿了规则id,按照规则id来,忽略规则list - if (StringUtils.isNotBlank(ruleId)) { - Map> ruleMap = listPolicyRules4QueryAndExport(customerId, ruleId); - // resi规则 - List originResiRules = ruleMap.get("resi"); - if (CollectionUtils.isNotEmpty(originResiRules)) { - List resiRules = originResiRules - .stream() - .map((r) -> new ResisByPolicyRulesFormDTO.ResiRule(r.getRuleDesc(), r.getNextLogicalRel(), r.getItemGroupId(), - r.getItemId(), r.getQueryType(), r.getColTable(), r.getColKey(), r.getColVal())) - .collect(Collectors.toList()); - - aggForm.getRuleList().setResiRule(resiRules); - } - - // house规则 - List originHouseRules = ruleMap.get("house"); - if (CollectionUtils.isNotEmpty(originHouseRules)) { - List houseRules = originHouseRules - .stream() - .map((r) -> new ResisByPolicyRulesFormDTO.HouseRule(r.getColTable(), r.getColKey(), r.getColVal(), - r.getRuleDesc(), r.getNextLogicalRel(), r.getQueryType())) - .collect(Collectors.toList()); - aggForm.getRuleList().setHouseRule(houseRules); - } - - // stat规则 - List originStatRules = ruleMap.get("stat"); - if (CollectionUtils.isNotEmpty(originStatRules)) { - List statRules = originStatRules - .stream() - .map((r) -> new ResisByPolicyRulesFormDTO.StatRule(r.getColKey(), r.getColVal(), r.getNextLogicalRel(), - r.getRuleDesc(), r.getQueryType(), r.getColTable())) - .collect(Collectors.toList()); - - aggForm.getRuleList().setStatRule(statRules); - } - } - - // 调用aggre服务查询结果 - Result> result = dataAggregatorOpenFeignClient.listByPolicyRules(aggForm); - List list = result.getData().getList().stream() - .map((r) -> new ResiByPolicyInfoResultDTO(r.getIcResiUserId() ,r.getName(), r.getMobile(), r.getIdCard(), r.getGridId() - ,r.getNeighborhoodId(), r.getNeighborHoodName(), r.getAge(), r.getBirthday())) - .collect(Collectors.toList()); - - return new PageData(list, result.getData().getTotal()); - } - public Map> listPolicyRules4QueryAndExport(String customerId, String ruleId) { ResisByPolicyRulesFormDTO form = new ResisByPolicyRulesFormDTO(); LambdaQueryWrapper query = new LambdaQueryWrapper(); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceRecordV2ServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceRecordV2ServiceImpl.java index 62f1d9a433..69cebbad20 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceRecordV2ServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceRecordV2ServiceImpl.java @@ -1,5 +1,6 @@ package com.epmet.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.IdWorker; @@ -16,6 +17,7 @@ import com.epmet.commons.tools.utils.DateUtils; import com.epmet.dao.IcServiceFeedbackV2Dao; import com.epmet.dao.IcServiceRecordV2Dao; import com.epmet.dao.IcServiceScopeDao; +import com.epmet.dao.IcServiceScopeV2Dao; import com.epmet.dto.IcServiceFeedbackV2DTO; import com.epmet.dto.IcServiceRecordV2DTO; import com.epmet.dto.IcServiceScopeV2DTO; @@ -67,11 +69,12 @@ public class IcServiceRecordV2ServiceImpl extends BaseServiceImpl page(Map params) { @@ -177,8 +180,16 @@ public class IcServiceRecordV2ServiceImpl extends BaseServiceImpl%s", formDTO.getServiceRecordId())); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "取消服务记录失败,未查询到服务记录"); } - entity.setServiceStatus("cancel"); - baseDao.updateById(entity); + if (!"in_service".equals(entity.getServiceStatus())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("服务状态:%s", entity.getServiceStatus()), "只有服务中的记录可以取消"); + } + //2.删除主表、字表数据【进行中数据不存在反馈记录】 + baseDao.deleteById(entity); + + LambdaQueryWrapper tWrapper = new LambdaQueryWrapper<>(); + tWrapper.eq(IcServiceScopeV2Entity::getServiceRecordId, formDTO.getServiceRecordId()); + icServiceScopeV2Dao.delete(tWrapper); + } @Override diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.24__ic_policy.sql b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.24__ic_policy.sql new file mode 100644 index 0000000000..86d1472abb --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.24__ic_policy.sql @@ -0,0 +1,102 @@ +CREATE TABLE `ic_policy` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `ORG_ID` varchar(64) NOT NULL COMMENT '政策创建人,所属组织id', + `ORG_ID_PATH` varchar(255) NOT NULL COMMENT 'AGENCY_ID的全路径,含agency_id', + `POLICY_LEVEL` varchar(1) NOT NULL COMMENT '政策级别,0市级;1区级;2街道级', + `START_DATE` date NOT NULL COMMENT '生效起止日期', + `END_DATE` date NOT NULL COMMENT '截止日期', + `TITLE` varchar(128) NOT NULL COMMENT '政策标题', + `CONTENT` varchar(2048) NOT NULL COMMENT '政策内容', + `DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='政策表'; + + +CREATE TABLE `ic_policy_category` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `IC_POLICY_ID` varchar(64) NOT NULL COMMENT '政策id', + `CATEGORY_CODE` varchar(64) NOT NULL COMMENT '分类编码', + `CODE_PATH` varchar(128) NOT NULL COMMENT '分类全路径,包含CATEGORY_CODE,英文逗号隔开', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='政策匹配资源类型'; + +CREATE TABLE `ic_policy_rule` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `IC_POLICY_ID` varchar(64) NOT NULL COMMENT '政策id', + `RULE_NAME` varchar(128) NOT NULL COMMENT '规则名称', + `SORT` int(1) NOT NULL COMMENT '排序字段', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='政策匹配规则'; + + +CREATE TABLE `ic_policy_rule_detail` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `IC_POLICY_ID` varchar(64) NOT NULL COMMENT '政策id', + `RULE_ID` varchar(32) NOT NULL COMMENT '规则id', + `RULE_DESC` varchar(512) DEFAULT NULL COMMENT '规则描述文字,例如:基础信息性别等于女', + `GROUP_TYPE` varchar(10) NOT NULL COMMENT 'resi:人员信息,house:房屋信息,stat:统计信息', + `NEXT_LOGICAL_REL` varchar(4) DEFAULT NULL COMMENT '与下一条的关系;and、or', + `ITEM_GROUP_ID` varchar(64) DEFAULT NULL COMMENT '分组id;人员信息有值;', + `ITEM_ID` varchar(64) DEFAULT NULL COMMENT '组件id;人员信息有值;', + `COL_TABLE` varchar(64) DEFAULT NULL COMMENT '表名;人员信息有值;房屋信息也有值', + `QUERY_TYPE` varchar(32) NOT NULL COMMENT '查询类型:等于、不等于....;来源于字典表sql_query_type', + `COL_KEY` varchar(32) NOT NULL COMMENT '人员信息存储组件对应的列名;房屋信息存储ic_house表的列名;统计信息应该是定义到字典表,这里存储字典key就行吧', + `COL_VAL` varchar(512) NOT NULL COMMENT '参数值', + `SORT` int(1) NOT NULL COMMENT '排序字段;同一group_type升序', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + `ITEM_GROUP_NAME` varchar(64) DEFAULT NULL COMMENT '用于前端展示:基础信息、教育信息、房屋类型.....', + `ITEM_LABEL` varchar(64) DEFAULT NULL COMMENT '用于前端展示:姓名、手机号、......', + `QUERY_TYPE_NAME` varchar(64) DEFAULT NULL COMMENT '用于前端展示:等于、不等于、大于、小于....', + `COL_VAL_LABEL` varchar(64) DEFAULT NULL COMMENT '用于前端展示:参数值显示值eg:男女', + `NEXT_LOGICAL_REL_NAME` varchar(32) DEFAULT NULL COMMENT '用于前端展示:逻辑:并且、或者', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='政策匹配规则明细'; + + +CREATE TABLE `ic_policy_item` ( + `ID` varchar(64) NOT NULL, + `CUSTOMER_ID` varchar(64) NOT NULL, + `GROUP_TYPE` varchar(10) NOT NULL COMMENT 'house:房屋信息,stat:统计信息', + `LABEL` varchar(255) NOT NULL COMMENT '选项名;例如:房屋类型,房屋状态,人均收入', + `COL_KEY` varchar(64) NOT NULL COMMENT '房屋信息存储列名;统计信息定义好key放在这里', + `ITEM_TYPE` varchar(64) NOT NULL, + `TABLE_NAME` varchar(64) DEFAULT NULL COMMENT '表名', + `SORT` int(11) NOT NULL COMMENT '排序', + `REMARK` varchar(255) DEFAULT NULL COMMENT '备注', + `OPTION_SOURCE_TYPE` varchar(10) DEFAULT NULL COMMENT '值来源;需要接口获取:remote。', + `OPTION_SOURCE_URL` varchar(128) DEFAULT NULL COMMENT '动态url;', + `OPTION_SOURCE_PARAM` varchar(255) DEFAULT NULL COMMENT '动态url的入参;存储json串', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='政策找人规则组件表'; \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.25__ic_service_v2.sql b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.25__ic_service_v2.sql new file mode 100644 index 0000000000..c52f2abc0d --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.25__ic_service_v2.sql @@ -0,0 +1,81 @@ +CREATE TABLE `ic_service_record_v2` ( + `ID` varchar(64) NOT NULL, + `CUSTOMER_ID` varchar(64) NOT NULL, + `POLICY_ID` varchar(64) NOT NULL COMMENT '政策依据ID', + `SERVICE_NAME` varchar(32) NOT NULL COMMENT '服务名称', + `SERVICE_ORG_TYPE` varchar(64) NOT NULL COMMENT '服务组织类型\n社区自组织:community_org,\n志愿者:ic_user_volunteer,\n联建单位:party_unit', + `SERVICE_ORG_ID` varchar(64) NOT NULL COMMENT '服务组织ID', + `PRINCIPAL_NAME` varchar(32) DEFAULT NULL COMMENT '经办人姓名', + `PRINCIPAL_CONTACT` varchar(64) DEFAULT NULL COMMENT '联系方式', + `SERVICE_TIME_START` datetime NOT NULL COMMENT '服务时间', + `SERVICE_TIME_END` datetime NOT NULL COMMENT '服务截止时间', + `SERVICE_STATUS` varchar(32) NOT NULL COMMENT 'in_service服务中;completed:已完成;cancel:取消', + `REMARK` varchar(255) DEFAULT NULL COMMENT '备注', + `DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='服务记录表'; + +CREATE TABLE `ic_service_feedback_v2` ( + `ID` varchar(64) NOT NULL, + `CUSTOMER_ID` varchar(64) NOT NULL, + `SERVICE_RECORD_ID` varchar(64) NOT NULL COMMENT '服务ID', + `SERVICE_GOAL` varchar(2000) DEFAULT NULL COMMENT '服务目标', + `SERVICE_EFFECT` varchar(2000) DEFAULT NULL COMMENT '服务效果', + `SERVICE_PEOPLE_NUMBER` int(10) DEFAULT NULL COMMENT '服务人数', + `SATISFACTION` varchar(30) DEFAULT NULL COMMENT '满意度。满意度 - 不满意:bad、基本满意:good、非常满意:perfect', + `LONGITUDE` varchar(255) DEFAULT NULL COMMENT '地址经度', + `LATITUDE` varchar(255) DEFAULT NULL COMMENT '地址纬度', + `ADDRESS` varchar(64) DEFAULT NULL COMMENT '地址', + `DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='服务记录反馈表'; + + +CREATE TABLE `ic_service_scope_v2` ( + `ID` varchar(64) NOT NULL, + `CUSTOMER_ID` varchar(64) NOT NULL, + `SERVICE_RECORD_ID` varchar(64) NOT NULL COMMENT '服务记录的ID', + `OBJECT_TYPE` varchar(32) NOT NULL COMMENT 'agency单位;grid网格;neighborhood小区', + `OBJECT_ID` varchar(64) NOT NULL COMMENT '选中的组织的ID', + `OBJECT_ID_PATH` varchar(255) NOT NULL COMMENT '发布范围的组织ID【包含组织、网格、小区本身的全路径】', + `OBJECT_NAME` varchar(32) DEFAULT NULL, + `DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='服务范围表'; + +CREATE TABLE `heart_attachment` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `BUSINESS_ID` varchar(64) NOT NULL COMMENT '业务id', + `ATTACH_TO` varchar(32) DEFAULT NULL COMMENT '政策:ic_policy;服务:ic_service_record_v2', + `NAME` varchar(64) DEFAULT NULL COMMENT '附件名', + `FORMAT` varchar(64) DEFAULT NULL COMMENT '文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS)', + `TYPE` varchar(64) NOT NULL COMMENT '附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc))', + `URL` varchar(255) NOT NULL COMMENT '附件地址', + `SORT` int(1) NOT NULL COMMENT '排序字段', + `STATUS` varchar(32) NOT NULL DEFAULT 'auto_passed' COMMENT '附件状态(审核中:auditing; \r\nauto_passed: 自动通过;\r\nreview:结果不确定,需要人工审核;\r\nblock: 结果违规;\r\nrejected:人工审核驳回;\r\napproved:人工审核通过)\r\n现在图片是同步审核的,所以图片只有auto_passed一种状态', + `REASON` varchar(255) DEFAULT NULL COMMENT '失败原因', + `DURATION` int(11) DEFAULT NULL COMMENT '语音或视频时长,秒', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='heart库附件表'; \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordV2Dao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordV2Dao.xml index 15696d8d2b..7a7b4f1a68 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordV2Dao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordV2Dao.xml @@ -11,8 +11,8 @@ sr.SERVICE_NAME, sr.SERVICE_ORG_TYPE, sr.SERVICE_ORG_ID, - sr.SERVICE_TIME_START, - sr.SERVICE_TIME_END, + date_format(sr.SERVICE_TIME_START,'%Y-%m-%d') AS serviceTimeStart, + date_format(sr.SERVICE_TIME_END,'%Y-%m-%d') AS serviceTimeEnd, sr.SERVICE_STATUS, IFNULL(sf.SERVICE_PEOPLE_NUMBER,0) AS servicePeopleNumber FROM ic_service_record_v2 sr diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml index 8756c9ea8d..f68f84233b 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml @@ -528,7 +528,9 @@ UPDATE ic_house SET RESI_NUMBER = #{resiNumber}, AVG_YSR = #{avgYsrD}, UPDATED_TIME = NOW() - where ID = #{houseId} and RESI_NUMBER != #{resiNumber} and DEL_FLAG = '0' + where + ID = #{houseId} and DEL_FLAG = '0' + and (RESI_NUMBER != #{resiNumber} or AVG_YSR != #{avgYsrD})