From 50d02c096615b2c5b4c6731e15a414fbad70afe3 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Thu, 21 Jul 2022 09:25:29 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=94=BF=E7=AD=96=E3=80=91=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E5=AF=BC=E5=87=BA=EF=BC=8C=E5=81=9A=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E5=8D=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/ResisByPolicyRulesFormDTO.java | 6 +- .../data-aggregator-server/pom.xml | 5 ++ .../controller/IcUserController.java | 20 ++++++ .../dataaggre/excel/ResisByPolicyExcel.java | 21 +++++++ .../epmet/dataaggre/service/ResiService.java | 23 +++++++ .../service/impl/ResiServiceImpl.java | 62 ++++++++++++++++++- .../form/resi/ResisByPolicyRulesFormDTO.java | 15 ++++- .../feign/EpmetHeartOpenFeignClient.java | 8 +++ .../EpmetHeartOpenFeignClientFallback.java | 5 ++ .../epmet/controller/IcPolicyController.java | 55 ++++++++++++++++ .../com/epmet/service/IcPolicyService.java | 10 +++ .../service/impl/IcPolicyServiceImpl.java | 22 ++++--- 12 files changed, 238 insertions(+), 14 deletions(-) create mode 100644 epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/excel/ResisByPolicyExcel.java 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 ea4bd8cb0a..e89f1131cf 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 @@ -24,10 +24,12 @@ public class ResisByPolicyRulesFormDTO { private String mobile; private String idCard; private RuleList ruleList = new RuleList(); - private Integer pageNo; - private Integer pageSize; + private Integer pageNo = 1; + private Integer pageSize = 20; @Data + @NoArgsConstructor + @AllArgsConstructor public static class RuleList { private String ruleName; private List resiRule; diff --git a/epmet-module/data-aggregator/data-aggregator-server/pom.xml b/epmet-module/data-aggregator/data-aggregator-server/pom.xml index 4cc34ba06f..efa4bca631 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/pom.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/pom.xml @@ -13,6 +13,11 @@ data-aggregator-server + + com.epmet + epmet-heart-client + 2.0.0 + com.epmet epmet-commons-tools 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 32f41b81e4..23b6e5f4ec 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,6 +2,8 @@ package com.epmet.dataaggre.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; @@ -19,6 +21,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -83,4 +87,20 @@ public class IcUserController { return new Result>().ok(page); } + /** + * 导出政策查找到的居民 + * @param input + */ + @PostMapping("exportByPolicy") + public void exportResisByPolicy(@RequestBody ResisByPolicyRulesFormDTO input, HttpServletResponse response) { + try { + 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); + } 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/excel/ResisByPolicyExcel.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/excel/ResisByPolicyExcel.java new file mode 100644 index 0000000000..e5cb9b5022 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/excel/ResisByPolicyExcel.java @@ -0,0 +1,21 @@ +package com.epmet.dataaggre.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +@Data +public class ResisByPolicyExcel { + @ExcelProperty("姓名") + private String name; + @ExcelProperty("手机号") + private String mobile; + @ExcelProperty("身份证号") + private String idCard; + /** + * 小区全名,包含小区前面的属性,比如网格等 + */ + @ExcelProperty("小区名") + private String neighborHoodName; + @ExcelProperty("年龄") + private Integer age; +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/ResiService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/ResiService.java index ee9feb43c4..f160f4a8f3 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/ResiService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/ResiService.java @@ -5,6 +5,8 @@ import com.epmet.dataaggre.dto.epmetuser.form.ResisByPolicyRulesFormDTO; import com.epmet.dataaggre.dto.epmetuser.result.ResiByPolicyInfoResultDTO; import com.github.pagehelper.PageInfo; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.List; import java.util.Set; @@ -26,4 +28,25 @@ public interface ResiService { List resiRule, List houseRule, List statRule); + + /** + * 政策找居民导出 + * @param orgId + * @param orgType + * @param neighborHoodId + * @param buildingId + * @param unitId + * @param houseId + * @param idCard + * @param name + * @param pageNo + * @param pageSize + * @param ruleId + */ + void exportResisByPolicy(String orgId, String orgType, String neighborHoodId, String buildingId, String unitId, + String houseId, String idCard, String name, Integer pageNo, Integer pageSize, + String ruleId, List resiRule, + List houseRule, + List statRule, + HttpServletResponse response) throws IOException; } 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 09097b559c..b0de4560f1 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 @@ -1,27 +1,43 @@ package com.epmet.dataaggre.service.impl; +import cn.hutool.core.bean.BeanUtil; +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.support.ExcelTypeEnum; +import com.alibaba.excel.write.builder.ExcelWriterSheetBuilder; +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.utils.ConvertUtils; import com.epmet.commons.tools.utils.EpmetRequestHolder; +import com.epmet.commons.tools.utils.Result; import com.epmet.dataaggre.dto.epmetuser.form.ResisByPolicyRulesFormDTO; import com.epmet.dataaggre.dto.epmetuser.result.ResiByPolicyInfoResultDTO; import com.epmet.dataaggre.dto.govorg.result.GridsInfoListResultDTO; import com.epmet.dataaggre.entity.govorg.IcHouseEntity; +import com.epmet.dataaggre.excel.ResisByPolicyExcel; 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.feign.EpmetHeartOpenFeignClient; 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 javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.time.*; import java.util.*; import java.util.stream.Collectors; @Service -public class ResiServiceImpl implements ResiService { +public class ResiServiceImpl implements ResiService, ResultDataResolver { @Autowired private EpmetUserService epmetUserService; @@ -29,6 +45,9 @@ public class ResiServiceImpl implements ResiService { @Autowired private GovOrgService govOrgService; + @Autowired + private EpmetHeartOpenFeignClient heartOpenFeignClient; + @Override public PageData listByPolicyRules(String orgId, String orgType, String neighborHoodId, String buildingId, String unitId, String houseId, String idCard, String name, Integer pageNo, Integer pageSize, @@ -132,4 +151,45 @@ public class ResiServiceImpl implements ResiService { }); } + @Override + public void exportResisByPolicy(String orgId, String orgType, String neighborHoodId, String buildingId, String unitId, + String houseId, String idCard, String name, Integer pageNo, Integer pageSize, + String ruleId, List resiRule, + List houseRule, + List statRule, + HttpServletResponse response) throws IOException { + + 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.getResiRule(), ResisByPolicyRulesFormDTO.ResiRule.class); + houseRule = ConvertUtils.sourceToTarget(ruleList.getHouseRule(), ResisByPolicyRulesFormDTO.HouseRule.class); + statRule = ConvertUtils.sourceToTarget(ruleList.getStatRule(), ResisByPolicyRulesFormDTO.StatRule.class); + } + + ServletOutputStream ostream = response.getOutputStream(); + ExcelWriterSheetBuilder sheetBuilder = EasyExcel.write(ostream, ResisByPolicyExcel.class).sheet("居民列表"); + + // 循环填充数据 + do { + PageData resis = this.listByPolicyRules(orgId, orgType, neighborHoodId, buildingId, unitId, + houseId, idCard, name, pageNo, pageSize, resiRule, houseRule, statRule); + List list = resis.getList(); + List excelDatas = ConvertUtils.sourceToTarget(list, ResisByPolicyExcel.class); + if (CollectionUtils.isEmpty(excelDatas)) { + break; + } + //sheetBuilder.write(excelDatas); + } while (true); + + + + System.out.println(666); + + } } 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 4437c9de35..9522159e12 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 @@ -1,10 +1,14 @@ package com.epmet.dto.form.resi; +import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; import java.util.List; @Data +@NoArgsConstructor +@AllArgsConstructor public class ResisByPolicyRulesFormDTO { private String ruleId; private String orgId; @@ -16,19 +20,22 @@ public class ResisByPolicyRulesFormDTO { private String name; private String mobile; private String idCard; - private RuleList ruleList; + private RuleList ruleList = new RuleList(); private Integer pageNo; private Integer pageSize; @Data + @NoArgsConstructor + @AllArgsConstructor public static class RuleList { - private String ruleName; private List resiRule; private List houseRule; private List statRule; } @Data + @NoArgsConstructor + @AllArgsConstructor public static class ResiRule { private String ruleDesc; private String nextLogicalRel; @@ -41,6 +48,8 @@ public class ResisByPolicyRulesFormDTO { } @Data + @NoArgsConstructor + @AllArgsConstructor public static class HouseRule { private String colTable; private String colKey; @@ -51,6 +60,8 @@ public class ResisByPolicyRulesFormDTO { } @Data + @NoArgsConstructor + @AllArgsConstructor public static class StatRule { private String colKey; private String colVal; diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java index f3c8430b3e..9939b88455 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java @@ -14,6 +14,7 @@ import com.epmet.dto.form.demand.DemandRecId; import com.epmet.dto.form.demand.IcEventCommentToDemandFromDTO; import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; +import com.epmet.dto.form.resi.ResisByPolicyRulesFormDTO; import com.epmet.dto.form.resi.VolunteerCommonFormDTO; import com.epmet.dto.result.PartyUnitListResultDTO; import com.epmet.dto.result.demand.IcResiDemandDictDTO; @@ -158,4 +159,11 @@ public interface EpmetHeartOpenFeignClient { @PostMapping("/heart/resi/volunteer/addVolunteer") Result addVolunteer(@RequestBody ResiVolunteerAuthenticateFormDTO formDTO); + + /** + * 为预览和导出提供规则列表查询 + * @return + */ + @PostMapping("/heart/policy/rules4ResiListAndExport/{ruleId}") + Result listPolicyRules4QueryAndExport(@PathVariable("ruleId") String ruleId); } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java index 10670de1ab..815bfab92c 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java @@ -16,6 +16,7 @@ import com.epmet.dto.form.demand.IcEventCommentToDemandFromDTO; import com.epmet.dto.form.demand.ServiceItemSelectFormDTO; import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; +import com.epmet.dto.form.resi.ResisByPolicyRulesFormDTO; import com.epmet.dto.form.resi.VolunteerCommonFormDTO; import com.epmet.dto.result.PartyUnitListResultDTO; import com.epmet.dto.result.demand.IcResiDemandDictDTO; @@ -161,4 +162,8 @@ public class EpmetHeartOpenFeignClientFallback implements EpmetHeartOpenFeignCli return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "addVolunteer", formDTO); } + @Override + public Result listPolicyRules4QueryAndExport(String ruleId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "listPolicyRules4QueryAndExport", ruleId); + } } 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 d8536ce6c2..ad21eb16e4 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 @@ -1,5 +1,6 @@ package com.epmet.controller; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.EpmetRequestHolder; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.dto.form.PageFormDTO; @@ -15,12 +16,15 @@ import com.epmet.dto.form.policy.IcPolicyFormDTO; import com.epmet.dto.form.policy.IcPolicyPageFormDTO; import com.epmet.dto.form.resi.ResisByPolicyRulesFormDTO; import com.epmet.dto.result.resi.ResiByPolicyInfoResultDTO; +import com.epmet.entity.IcPolicyRuleDetailEntity; import com.epmet.service.IcPolicyService; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** @@ -48,6 +52,11 @@ public class IcPolicyController { return new Result>().ok(list); } + /** + * 政策找人,居民列表 + * @param input + * @return + */ @PostMapping("resiuserlist") public Result listResiUserByPolicyRules(@RequestBody ResisByPolicyRulesFormDTO input) { // 调整错位的逻辑符号位置 @@ -162,4 +171,50 @@ public class IcPolicyController { public Result policyDetail(@LoginUser TokenDto tokenDto,@PathVariable("policyId") String policyId) { return new Result().ok(icPolicyService.policyDetail(tokenDto.getCustomerId(),policyId)); } + + /** + * 为预览和导出提供规则列表查询 + * @return + */ + @PostMapping("rules4ResiListAndExport/{ruleId}") + public Result listPolicyRules4QueryAndExport(@PathVariable("ruleId") String ruleId) { + Map> ruleMap = icPolicyService.listPolicyRules4QueryAndExport(EpmetRequestHolder.getLoginUserCustomerId(), ruleId); + ResisByPolicyRulesFormDTO.RuleList data = new ResisByPolicyRulesFormDTO.RuleList(); + // 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()); + + data.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()); + data.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()); + + data.setStatRule(statRules); + } + + return new Result().ok(data); + } } 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 1b18091b4a..e9e71b24af 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 @@ -10,8 +10,10 @@ import com.epmet.dto.form.policy.IcPolicyPageFormDTO; import com.epmet.dto.form.resi.ResisByPolicyRulesFormDTO; import com.epmet.dto.result.resi.ResiByPolicyInfoResultDTO; import com.epmet.entity.IcPolicyEntity; +import com.epmet.entity.IcPolicyRuleDetailEntity; import java.util.List; +import java.util.Map; /** * 政策表 @@ -48,4 +50,12 @@ public interface IcPolicyService extends BaseService { IcPolicyDTO policyDetail(String customerId,String policyId); PageData listResiUserByPolicyRules(ResisByPolicyRulesFormDTO input); + + /** + * 政策规则查询 + * @param customerId + * @param ruleId + * @return + */ + Map> listPolicyRules4QueryAndExport(String customerId, String ruleId); } \ No newline at end of file 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 c8f3edeae9..2fc323a951 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 @@ -322,15 +322,7 @@ public class IcPolicyServiceImpl extends BaseServiceImpl query = new LambdaQueryWrapper(); - query.eq(IcPolicyRuleDetailEntity::getCustomerId, customerId); - query.eq(IcPolicyRuleDetailEntity::getRuleId, ruleId); - query.orderByAsc(IcPolicyRuleDetailEntity::getSort); - List rules = policyRuleDetailDao.selectList(query); - - // 将查询出的数据转化成aggre服务能接受的格式 - Map> ruleMap = rules.stream().collect(Collectors.groupingBy(IcPolicyRuleDetailEntity::getGroupType, Collectors.toList())); - + Map> ruleMap = listPolicyRules4QueryAndExport(customerId, ruleId); // resi规则 List originResiRules = ruleMap.get("resi"); if (CollectionUtils.isNotEmpty(originResiRules)) { @@ -376,4 +368,16 @@ public class IcPolicyServiceImpl extends BaseServiceImpl(list, result.getData().getTotal()); } + + public Map> listPolicyRules4QueryAndExport(String customerId, String ruleId) { + ResisByPolicyRulesFormDTO form = new ResisByPolicyRulesFormDTO(); + LambdaQueryWrapper query = new LambdaQueryWrapper(); + query.eq(IcPolicyRuleDetailEntity::getCustomerId, customerId); + query.eq(IcPolicyRuleDetailEntity::getRuleId, ruleId); + query.orderByAsc(IcPolicyRuleDetailEntity::getSort); + List rules = policyRuleDetailDao.selectList(query); + + // 将查询出的数据转化成aggre服务能接受的格式 + return rules.stream().collect(Collectors.groupingBy(IcPolicyRuleDetailEntity::getGroupType, Collectors.toList())); + } } \ No newline at end of file