|
|
@ -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文件失败"); |
|
|
|
} |
|
|
|