Browse Source

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

master
wangxianzhang 3 years ago
parent
commit
c5b6234a85
  1. 6
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/ResisByPolicyRulesFormDTO.java
  2. 37
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/IcUserController.java
  3. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/IcResiUserDao.java
  4. 24
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/IcHouseDao.java
  5. 4
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java
  6. 11
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  7. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
  8. 39
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  9. 78
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/ResiServiceImpl.java
  10. 35
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/IcResiUserDao.xml
  11. 35
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/IcHouseDao.xml
  12. 24
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/policy/IcPolicyRuleDetailDTO.java
  13. 69
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/HeartResisByPolicyRulesFormDTO.java
  14. 6
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResisByPolicyRulesFormDTO.java
  15. 53
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPolicyController.java
  16. 23
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPolicyRuleDetailEntity.java
  17. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPolicyService.java
  18. 56
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPolicyServiceImpl.java
  19. 17
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceRecordV2ServiceImpl.java
  20. 102
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.24__ic_policy.sql
  21. 81
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.25__ic_service_v2.sql
  22. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordV2Dao.xml
  23. 4
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml
  24. 2
      epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.32__policy_flag.sql

6
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> resiRule;
private List<HouseRule> houseRule;
private List<StatRule> statRule;
private List<ResiRule> resiRuleList;
private List<HouseRule> houseRuleList;
private List<StatRule> statRuleList;
}
@Data

37
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<PageData<ResiByPolicyInfoResultDTO>> listByPolicyRules(@RequestBody ResisByPolicyRulesFormDTO input) {
List<ResisByPolicyRulesFormDTO.ResiRule> resiRule = input.getRuleList().getResiRuleList();
List<ResisByPolicyRulesFormDTO.HouseRule> houseRule = input.getRuleList().getHouseRuleList();
List<ResisByPolicyRulesFormDTO.StatRule> statRule = input.getRuleList().getStatRuleList();
Integer pageNo = input.getPageNo();
Integer pageSize = input.getPageSize();
List<ResisByPolicyRulesFormDTO.ResiRule> resiRule = input.getRuleList().getResiRule();
List<ResisByPolicyRulesFormDTO.HouseRule> houseRule = input.getRuleList().getHouseRule();
List<ResisByPolicyRulesFormDTO.StatRule> 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文件失败");
}

2
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<IcResiUserEntity> {
* @return
*/
List<ResiByPolicyInfoResultDTO> 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<IcResiUserEntity> {
* @return
*/
Integer getTotalByPolicyRules(@Param("customerId") String customerId,
@Param("orgIdPath") String orgIdPath,
@Param("orgId") String orgId,
@Param("orgType") String orgType,
@Param("neighborHoodId") String neighborHoodId,

24
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<IcHouseEntity> {
/**
* 为政策-预览居民提供房屋id列表查询
* @param orgIdPath
* @param customerId
* @param neighborHoodId
* @param buildingId
* @param unitId
* @param houseId
* @param houseRule
* @param statRule
* @return
*/
List<String> 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<ResisByPolicyRulesFormDTO.HouseRule> houseRule,
@Param("statRule") List<ResisByPolicyRulesFormDTO.StatRule> statRule);
}

4
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<StaffSelectResDTO> staffSelectList(List<String> staffIds);
List<ResiByPolicyInfoResultDTO> listByPolicyRules(String customerId, String orgId, String orgType, String neighborHoodId, String buildingId, String unitId,
List<ResiByPolicyInfoResultDTO> 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<ResisByPolicyRulesFormDTO.ResiRule> resiRule, List<String> 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<ResisByPolicyRulesFormDTO.ResiRule> resiRule, List<String> houseIds);
}

11
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<ResiByPolicyInfoResultDTO> listByPolicyRules(String customerId, String orgId, String orgType, String neighborHoodId, String buildingId, String unitId,
public List<ResiByPolicyInfoResultDTO> 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<ResisByPolicyRulesFormDTO.ResiRule> resiRule, List<String> 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<ResisByPolicyRulesFormDTO.ResiRule> resiRule, List<String> 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<ResisByPolicyRulesFormDTO.ResiRule> resiRule, List<String> houseIds) {
return icResiUserDao.getTotalByPolicyRules(customerId, orgIdPath, orgId, orgType, neighborHoodId, buildingId, unitId, houseId, idCard, name, resiRule, houseIds);
}
}

2
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<IcHouseEntity> listHousesByRules(String customerId, String orgId, String orgType, String neighborHoodId, String buildingId,
List<String> listHouseIdsByRules(String customerId, String orgIdPath, String orgId, String orgType, String neighborHoodId, String buildingId,
String unitId, String houseId, List<ResisByPolicyRulesFormDTO.HouseRule> houseRule,
List<ResisByPolicyRulesFormDTO.StatRule> statRule, Integer pageNo, Integer pageSize);

39
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<IcHouseEntity> listHousesByRules(String customerId, String orgId, String orgType, String neighborHoodId, String buildingId,
public List<String> listHouseIdsByRules(String customerId, String orgIdPath, String orgId, String orgType, String neighborHoodId, String buildingId,
String unitId, String houseId, List<ResisByPolicyRulesFormDTO.HouseRule> houseRule,
List<ResisByPolicyRulesFormDTO.StatRule> statRule, Integer pageNo, Integer pageSize) {
@ -1118,45 +1118,12 @@ public class GovOrgServiceImpl implements GovOrgService {
return new ArrayList<>();
}
QueryWrapper<IcHouseEntity> 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

78
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<ResiByPolicyInfoResultDTO> listByPolicyRules(String orgId, String orgType, String neighborHoodId, String buildingId, String unitId,
String houseId, String idCard, String name, Integer pageNo, Integer pageSize,
List<ResisByPolicyRulesFormDTO.ResiRule> resiRule,
List<ResisByPolicyRulesFormDTO.HouseRule> houseRule,
List<ResisByPolicyRulesFormDTO.StatRule> 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<ResiByPolicyInfoResultDTO> resultResis = new ArrayList<>();
// 1.用户没配置house和stat规则,直接按照居民规则查询
if (CollectionUtils.isEmpty(houseRule) && CollectionUtils.isEmpty(statRule)) {
List<ResiByPolicyInfoResultDTO> resis = epmetUserService.listByPolicyRules(customerId, orgId, orgType, neighborHoodId, buildingId, unitId,
List<ResiByPolicyInfoResultDTO> 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<IcHouseEntity> houseEntities = govOrgService.listHousesByRules(customerId, orgId, orgType, neighborHoodId, buildingId, unitId,
List<String> houseIds = govOrgService.listHouseIdsByRules(customerId, orgIdPath, orgId, orgType, neighborHoodId, buildingId, unitId,
houseId, houseRule, statRule, housePageNo, 50);
List<String> 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<ResiByPolicyInfoResultDTO> 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<ResisByPolicyRulesFormDTO.ResiRule> 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();

35
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/IcResiUserDao.xml

@ -71,7 +71,10 @@
<sql id="segmentForPolicyRules">
<where>
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'
<!--组织过滤-->
<if test="orgId != null and orgId != '' and orgType != null and orgType != ''">
<choose>
@ -84,23 +87,23 @@
</choose>
</if>
<!-- 小区等条件 -->
<if test="neighborHoodId != null">
<if test="neighborHoodId != null and neighborHoodId!=''">
and ic_resi_user.VILLAGE_ID=#{neighborHoodId}
</if>
<if test="buildingId != null">
<if test="buildingId != null and buildingId!=''">
and ic_resi_user.BUILD_ID=#{buildingId}
</if>
<if test="unitId != null">
<if test="unitId != null and unitId!=''">
and ic_resi_user.UNIT_ID=#{unitId}
</if>
<if test="houseId != null">
<if test="houseId != null and houseId!=''">
and ic_resi_user.HOME_ID=#{houseId}
</if>
<if test="idCard != null">
and ic_resi_user.ID_CARD like CONCAT('%'#{idCard}, '%')
<if test="idCard != null and idCard!=''">
and ic_resi_user.ID_CARD like CONCAT('%',#{idCard}, '%')
</if>
<if test="name != null">
and ic_resi_user.NAME like CONCAT('%'#{name}, '%')
<if test="name != null and name!=''">
and ic_resi_user.NAME like CONCAT('%',#{name}, '%')
</if>
<!-- 房屋id列表 -->
<if test="houseIds != null and houseIds.size() > 0">
@ -121,13 +124,13 @@
<!--政策查找-->
<select id="listByPolicyRules" resultType="com.epmet.dataaggre.dto.epmetuser.result.ResiByPolicyInfoResultDTO">
select `ID` as icResiUserId,
`GRID_ID`,
`NAME`,
`MOBILE`,
`ID_CARD`,
`VILLAGE_ID` as neighborhoodId,
`BIRTHDAY`
select ic_resi_user.`ID` as icResiUserId,
ic_resi_user.`GRID_ID`,
ic_resi_user.`NAME`,
ic_resi_user.`MOBILE`,
ic_resi_user.`ID_CARD`,
ic_resi_user.`VILLAGE_ID` as neighborhoodId,
ic_resi_user.`BIRTHDAY`
from ic_resi_user
<foreach collection="resiRules" item="rule">
<if test="rule.colTable != 'ic_resi_user'"> inner join #{rule.colTable}</if>

35
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/IcHouseDao.xml

@ -3,4 +3,39 @@
<mapper namespace="com.epmet.dataaggre.dao.govorg.IcHouseDao">
<!--为政策-预览居民,提供房屋id列表查询-->
<select id="listHouseIds4PolicyResis" resultType="java.lang.String">
select ic_house.ID
from ic_house
<where>
DEL_FLAG = '0'
and ic_house.CUSTOMER_ID = #{customerId}
and ic_house.ORG_ID_PATH like CONCAT(#{orgIdPath}, '%')
<if test="neighborHoodId != null and neighborHoodId != ''">
and ic_house.NEIGHBOR_HOOD_ID = #{neighborHoodId}
</if>
<if test="buildingId != null and buildingId != ''">
and ic_house.BUILDING_ID = #{buildingId}
</if>
<if test="unitId != null and unitId != ''">
and ic_house.BUILDING_UNIT_ID = #{unitId}
</if>
<if test="houseId != null and houseId != ''">
and ic_house.ID = #{houseId}
</if>
<if test="houseRule != null and houseRule.size() > 0">
and
<foreach collection="houseRule" item="rule" open="(" close=")">
${rule.colTable}.${rule.colKey} ${rule.queryType} #{rule.colVal} ${rule.nextLogicalRel}
</foreach>
</if>
<if test="statRule != null and statRule.size() > 0">
and
<foreach collection="statRule" item="rule" open="(" close=")">
${rule.colTable}.${rule.colKey} ${rule.queryType} #{rule.colVal} ${rule.nextLogicalRel}
</foreach>
</if>
</where>
</select>
</mapper>

24
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;
}

69
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/HeartResisByPolicyRulesFormDTO.java

@ -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<ResisByPolicyRulesFormDTO.ResiRule> resiRule;
private List<ResisByPolicyRulesFormDTO.HouseRule> houseRule;
private List<ResisByPolicyRulesFormDTO.StatRule> 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;
}
}

6
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> resiRule;
private List<HouseRule> houseRule;
private List<StatRule> statRule;
private List<ResiRule> resiRuleList;
private List<HouseRule> houseRuleList;
private List<StatRule> statRuleList;
}
@Data

53
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<List<IcPolicyItemResultDTO>>().ok(list);
}
/**
* 政策找人居民列表
* @param input
* @return
*/
@PostMapping("resiuserlist")
public Result listResiUserByPolicyRules(@RequestBody ResisByPolicyRulesFormDTO input) {
// 调整错位的逻辑符号位置
//adjustMalpositionLogicalOperatorPosition(input);
PageData<ResiByPolicyInfoResultDTO> page = icPolicyService.listResiUserByPolicyRules(input);
return new Result().ok(page);
}
/**
* 调整错位的逻辑运算符
* @param input
*/
//private void adjustMalpositionLogicalOperatorPosition(ResisByPolicyRulesFormDTO input) {
// List<ResisByPolicyRulesFormDTO.ResiRule> resiRule = input.getRuleList().getResiRule();
// List<ResisByPolicyRulesFormDTO.HouseRule> houseRule = input.getRuleList().getHouseRule();
// List<ResisByPolicyRulesFormDTO.StatRule> 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<ResisByPolicyRulesFormDTO.RuleList>().ok(data);

23
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;
}

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPolicyService.java

@ -57,8 +57,6 @@ public interface IcPolicyService extends BaseService<IcPolicyEntity> {
IcPolicyDTO policyDetail(String customerId,String policyId);
PageData<ResiByPolicyInfoResultDTO> listResiUserByPolicyRules(ResisByPolicyRulesFormDTO input);
/**
* 政策规则查询
* @param customerId

56
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<IcPolicyDao, IcPolicyEn
return icPolicyDTO;
}
@Override
public PageData<ResiByPolicyInfoResultDTO> 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<String, List<IcPolicyRuleDetailEntity>> ruleMap = listPolicyRules4QueryAndExport(customerId, ruleId);
// resi规则
List<IcPolicyRuleDetailEntity> originResiRules = ruleMap.get("resi");
if (CollectionUtils.isNotEmpty(originResiRules)) {
List<ResisByPolicyRulesFormDTO.ResiRule> 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<IcPolicyRuleDetailEntity> originHouseRules = ruleMap.get("house");
if (CollectionUtils.isNotEmpty(originHouseRules)) {
List<ResisByPolicyRulesFormDTO.HouseRule> 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<IcPolicyRuleDetailEntity> originStatRules = ruleMap.get("stat");
if (CollectionUtils.isNotEmpty(originStatRules)) {
List<ResisByPolicyRulesFormDTO.StatRule> 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<PageData<com.epmet.dataaggre.dto.epmetuser.result.ResiByPolicyInfoResultDTO>> result = dataAggregatorOpenFeignClient.listByPolicyRules(aggForm);
List<ResiByPolicyInfoResultDTO> 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<ResiByPolicyInfoResultDTO>(list, result.getData().getTotal());
}
public Map<String, List<IcPolicyRuleDetailEntity>> listPolicyRules4QueryAndExport(String customerId, String ruleId) {
ResisByPolicyRulesFormDTO form = new ResisByPolicyRulesFormDTO();
LambdaQueryWrapper<IcPolicyRuleDetailEntity> query = new LambdaQueryWrapper();

17
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<IcServiceRecor
private IcServiceFeedbackV2Service icServiceFeedbackV2Service;
@Autowired
private HeartAttachmentService heartAttachmentService;
@Autowired
private IcServiceScopeDao serviceScopeDao;
@Autowired
private IcServiceFeedbackV2Dao serviceFeedbackV2Dao;
@Autowired
private IcServiceScopeV2Dao icServiceScopeV2Dao;
@Override
public PageData<IcServiceRecordV2DTO> page(Map<String, Object> params) {
@ -177,8 +180,16 @@ public class IcServiceRecordV2ServiceImpl extends BaseServiceImpl<IcServiceRecor
log.error(String.format("取消服务记录失败,未查询到服务记录,服务记录Id->%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<IcServiceScopeV2Entity> tWrapper = new LambdaQueryWrapper<>();
tWrapper.eq(IcServiceScopeV2Entity::getServiceRecordId, formDTO.getServiceRecordId());
icServiceScopeV2Dao.delete(tWrapper);
}
@Override

102
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='政策找人规则组件表';

81
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库附件表';

4
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

4
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml

@ -528,7 +528,9 @@
<update id="updateIcHouseResiNumber">
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})
</update>
<select id="selectByCoding" resultType="com.epmet.entity.IcHouseEntity">

2
epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.32__policy_flag.sql

@ -14,4 +14,4 @@ where i.DEL_FLAG='0'
and i.COLUMN_NAME is not null
and i.COLUMN_NAME !=''
and i.ITEM_TYPE not in('cascader')
and i.label not in ('分割线','出生日期');
and i.label not in ('分割线','出生日期','参战时间');
Loading…
Cancel
Save