Browse Source

【政策】人员预览接口调整,用aggre为主来查询

master
wangxianzhang 3 years ago
parent
commit
0169ee2bad
  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. 6
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/ResiServiceImpl.java
  4. 14
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/HeartResisByPolicyRulesFormDTO.java
  5. 6
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResisByPolicyRulesFormDTO.java
  6. 8
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPolicyController.java
  7. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPolicyServiceImpl.java

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 @AllArgsConstructor
public static class RuleList { public static class RuleList {
private String ruleName; private String ruleName;
private List<ResiRule> resiRule; private List<ResiRule> resiRuleList;
private List<HouseRule> houseRule; private List<HouseRule> houseRuleList;
private List<StatRule> statRule; private List<StatRule> statRuleList;
} }
@Data @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.annotation.LoginUser;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dataaggre.dto.epmetuser.form.IcUserCategoryFormDTO; 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.dto.epmetuser.result.ResiByPolicyInfoResultDTO;
import com.epmet.dataaggre.service.ResiService; import com.epmet.dataaggre.service.ResiService;
import com.epmet.dataaggre.service.epmetuser.EpmetUserService; import com.epmet.dataaggre.service.epmetuser.EpmetUserService;
import com.epmet.feign.EpmetHeartOpenFeignClient;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -30,7 +35,7 @@ import java.util.Set;
@RestController @RestController
@RequestMapping("icuser") @RequestMapping("icuser")
public class IcUserController { public class IcUserController implements ResultDataResolver {
@Autowired @Autowired
private EpmetUserService epmetUserService; private EpmetUserService epmetUserService;
@ -38,6 +43,9 @@ public class IcUserController {
@Autowired @Autowired
private ResiService icResiService; private ResiService icResiService;
@Autowired
private EpmetHeartOpenFeignClient heartOpenFeignClient;
/** /**
* 人员类别分析-各类别人数 * 人员类别分析-各类别人数
* *
@ -59,13 +67,14 @@ public class IcUserController {
*/ */
@PostMapping("listByPolicyRules") @PostMapping("listByPolicyRules")
public Result<PageData<ResiByPolicyInfoResultDTO>> listByPolicyRules(@RequestBody ResisByPolicyRulesFormDTO input) { 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 pageNo = input.getPageNo();
Integer pageSize = input.getPageSize(); 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 orgId = input.getOrgId();
String orgType = input.getOrgType(); String orgType = input.getOrgType();
String neighborHoodId = input.getNeighborHoodId(); String neighborHoodId = input.getNeighborHoodId();
@ -74,8 +83,22 @@ public class IcUserController {
String houseId = input.getHouseId(); String houseId = input.getHouseId();
String idCard = input.getIdCard(); String idCard = input.getIdCard();
String name = input.getName(); 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) if (CollectionUtils.isEmpty(resiRule)
&& CollectionUtils.isEmpty(houseRule) && CollectionUtils.isEmpty(houseRule)
&& CollectionUtils.isEmpty(statRule)) { && CollectionUtils.isEmpty(statRule)) {
@ -97,7 +120,7 @@ public class IcUserController {
icResiService.exportResisByPolicy( icResiService.exportResisByPolicy(
input.getOrgId(), input.getOrgType(), input.getNeighborHoodId(), input.getBuildingId(), input.getUnitId(), input.getOrgId(), input.getOrgType(), input.getNeighborHoodId(), input.getBuildingId(), input.getUnitId(),
input.getHouseId(), input.getIdCard(), input.getName(), input.getPageNo(), input.getPageSize(), 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) { } catch (IOException e) {
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "导出Excel文件失败", "导出Excel文件失败"); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "导出Excel文件失败", "导出Excel文件失败");
} }

6
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/ResiServiceImpl.java

@ -167,9 +167,9 @@ public class ResiServiceImpl implements ResiService, ResultDataResolver {
EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getCode(),
null, null); null, null);
resiRule = ConvertUtils.sourceToTarget(ruleList.getResiRule(), ResisByPolicyRulesFormDTO.ResiRule.class); resiRule = ConvertUtils.sourceToTarget(ruleList.getResiRuleList(), ResisByPolicyRulesFormDTO.ResiRule.class);
houseRule = ConvertUtils.sourceToTarget(ruleList.getHouseRule(), ResisByPolicyRulesFormDTO.HouseRule.class); houseRule = ConvertUtils.sourceToTarget(ruleList.getHouseRuleList(), ResisByPolicyRulesFormDTO.HouseRule.class);
statRule = ConvertUtils.sourceToTarget(ruleList.getStatRule(), ResisByPolicyRulesFormDTO.StatRule.class); statRule = ConvertUtils.sourceToTarget(ruleList.getStatRuleList(), ResisByPolicyRulesFormDTO.StatRule.class);
} }
ServletOutputStream ostream = response.getOutputStream(); ServletOutputStream ostream = response.getOutputStream();

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

@ -28,14 +28,18 @@ public class HeartResisByPolicyRulesFormDTO {
private Integer pageSize; private Integer pageSize;
@Data @Data
@NoArgsConstructor
@AllArgsConstructor
public static class RuleList { public static class RuleList {
private String ruleName; private String ruleName;
private List<ResisByPolicyRulesFormDTO.ResiRule> resiRule; private List<ResisByPolicyRulesFormDTO.ResiRule> resiRuleList;
private List<ResisByPolicyRulesFormDTO.HouseRule> houseRule; private List<ResisByPolicyRulesFormDTO.HouseRule> houseRuleList;
private List<ResisByPolicyRulesFormDTO.StatRule> statRule; private List<ResisByPolicyRulesFormDTO.StatRule> statRuleList;
} }
@Data @Data
@NoArgsConstructor
@AllArgsConstructor
public static class ResiRule { public static class ResiRule {
private String ruleDesc; private String ruleDesc;
private String nextLogicalRel; private String nextLogicalRel;
@ -48,6 +52,8 @@ public class HeartResisByPolicyRulesFormDTO {
} }
@Data @Data
@NoArgsConstructor
@AllArgsConstructor
public static class HouseRule { public static class HouseRule {
private String colTable; private String colTable;
private String colKey; private String colKey;
@ -58,6 +64,8 @@ public class HeartResisByPolicyRulesFormDTO {
} }
@Data @Data
@NoArgsConstructor
@AllArgsConstructor
public static class StatRule { public static class StatRule {
private String colKey; private String colKey;
private String colVal; private String colVal;

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 @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public static class RuleList { public static class RuleList {
private List<ResiRule> resiRule; private List<ResiRule> resiRuleList;
private List<HouseRule> houseRule; private List<HouseRule> houseRuleList;
private List<StatRule> statRule; private List<StatRule> statRuleList;
} }
@Data @Data

8
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPolicyController.java

@ -55,6 +55,7 @@ public class IcPolicyController {
* @param input * @param input
* @return * @return
*/ */
@Deprecated
@PostMapping("resiuserlist") @PostMapping("resiuserlist")
public Result listResiUserByPolicyRules(@RequestBody ResisByPolicyRulesFormDTO input) { public Result listResiUserByPolicyRules(@RequestBody ResisByPolicyRulesFormDTO input) {
// 调整错位的逻辑符号位置 // 调整错位的逻辑符号位置
@ -146,7 +147,6 @@ public class IcPolicyController {
/** /**
* Desc: 政策列表下拉选 * Desc: 政策列表下拉选
* @param tokenDto * @param tokenDto
* @param formDTO
* @author zxc * @author zxc
* @date 2022/7/21 09:48 * @date 2022/7/21 09:48
*/ */
@ -199,7 +199,7 @@ public class IcPolicyController {
r.getItemId(), r.getQueryType(), r.getColTable(), r.getColKey(), r.getColVal())) r.getItemId(), r.getQueryType(), r.getColTable(), r.getColKey(), r.getColVal()))
.collect(Collectors.toList()); .collect(Collectors.toList());
data.setResiRule(resiRules); data.setResiRuleList(resiRules);
} }
// house规则 // house规则
@ -210,7 +210,7 @@ public class IcPolicyController {
.map((r) -> new ResisByPolicyRulesFormDTO.HouseRule(r.getColTable(), r.getColKey(), r.getColVal(), .map((r) -> new ResisByPolicyRulesFormDTO.HouseRule(r.getColTable(), r.getColKey(), r.getColVal(),
r.getRuleDesc(), r.getNextLogicalRel(), r.getQueryType())) r.getRuleDesc(), r.getNextLogicalRel(), r.getQueryType()))
.collect(Collectors.toList()); .collect(Collectors.toList());
data.setHouseRule(houseRules); data.setHouseRuleList(houseRules);
} }
// stat规则 // stat规则
@ -222,7 +222,7 @@ public class IcPolicyController {
r.getRuleDesc(), r.getQueryType(), r.getColTable())) r.getRuleDesc(), r.getQueryType(), r.getColTable()))
.collect(Collectors.toList()); .collect(Collectors.toList());
data.setStatRule(statRules); data.setStatRuleList(statRules);
} }
return new Result<ResisByPolicyRulesFormDTO.RuleList>().ok(data); return new Result<ResisByPolicyRulesFormDTO.RuleList>().ok(data);

6
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPolicyServiceImpl.java

@ -340,7 +340,7 @@ public class IcPolicyServiceImpl extends BaseServiceImpl<IcPolicyDao, IcPolicyEn
r.getItemId(), r.getQueryType(), r.getColTable(), r.getColKey(), r.getColVal())) r.getItemId(), r.getQueryType(), r.getColTable(), r.getColKey(), r.getColVal()))
.collect(Collectors.toList()); .collect(Collectors.toList());
aggForm.getRuleList().setResiRule(resiRules); aggForm.getRuleList().setResiRuleList(resiRules);
} }
// house规则 // house规则
@ -351,7 +351,7 @@ public class IcPolicyServiceImpl extends BaseServiceImpl<IcPolicyDao, IcPolicyEn
.map((r) -> new ResisByPolicyRulesFormDTO.HouseRule(r.getColTable(), r.getColKey(), r.getColVal(), .map((r) -> new ResisByPolicyRulesFormDTO.HouseRule(r.getColTable(), r.getColKey(), r.getColVal(),
r.getRuleDesc(), r.getNextLogicalRel(), r.getQueryType())) r.getRuleDesc(), r.getNextLogicalRel(), r.getQueryType()))
.collect(Collectors.toList()); .collect(Collectors.toList());
aggForm.getRuleList().setHouseRule(houseRules); aggForm.getRuleList().setHouseRuleList(houseRules);
} }
// stat规则 // stat规则
@ -363,7 +363,7 @@ public class IcPolicyServiceImpl extends BaseServiceImpl<IcPolicyDao, IcPolicyEn
r.getRuleDesc(), r.getQueryType(), r.getColTable())) r.getRuleDesc(), r.getQueryType(), r.getColTable()))
.collect(Collectors.toList()); .collect(Collectors.toList());
aggForm.getRuleList().setStatRule(statRules); aggForm.getRuleList().setStatRuleList(statRules);
} }
} }

Loading…
Cancel
Save