|
|
@ -3,23 +3,17 @@ package com.epmet.service.impl; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.Constant; |
|
|
|
import com.epmet.commons.tools.constant.ServiceConstant; |
|
|
|
import com.epmet.commons.tools.feign.ResultDataResolver; |
|
|
|
import com.epmet.commons.tools.utils.EpmetRequestHolder; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.dao.IcPolicyDao; |
|
|
|
import com.epmet.dao.IcPolicyRuleDetailDao; |
|
|
|
import com.epmet.dataaggre.dto.epmetuser.form.ResisByPolicyRulesFormDTO; |
|
|
|
import com.epmet.dataaggre.feign.DataAggregatorOpenFeignClient; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.dto.form.FileCommonDTO; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.enums.DictTypeEnum; |
|
|
|
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.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.EpmetRequestHolder; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
|
import com.epmet.dao.*; |
|
|
@ -28,14 +22,12 @@ import com.epmet.dataaggre.feign.DataAggregatorOpenFeignClient; |
|
|
|
import com.epmet.dto.IcPolicyCategoryDTO; |
|
|
|
import com.epmet.dto.IcPolicyDTO; |
|
|
|
import com.epmet.dto.IcPolicyItemResultDTO; |
|
|
|
import com.epmet.dto.result.resi.ResiByPolicyInfoResultDTO; |
|
|
|
import com.epmet.entity.IcPolicyEntity; |
|
|
|
import com.epmet.entity.IcPolicyRuleDetailEntity; |
|
|
|
import com.epmet.dto.IcPolicyRuleDTO; |
|
|
|
import com.epmet.dto.form.policy.IcPolicyFormDTO; |
|
|
|
import com.epmet.dto.form.policy.IcPolicyPageFormDTO; |
|
|
|
import com.epmet.dto.form.policy.IcPolicyRuleDetailDTO; |
|
|
|
import com.epmet.dto.form.policy.IcPolicyRuleFormDTO; |
|
|
|
import com.epmet.dto.result.resi.ResiByPolicyInfoResultDTO; |
|
|
|
import com.epmet.entity.*; |
|
|
|
import com.epmet.feign.EpmetAdminOpenFeignClient; |
|
|
|
import com.epmet.service.IcPolicyService; |
|
|
@ -48,7 +40,10 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -116,13 +111,13 @@ public class IcPolicyServiceImpl extends BaseServiceImpl<IcPolicyDao, IcPolicyEn |
|
|
|
if(StringUtils.isNotBlank(formDTO.getPolicyId())){ |
|
|
|
icPolicyEntity.setId(formDTO.getPolicyId()); |
|
|
|
baseDao.updateById(icPolicyEntity); |
|
|
|
}else{ |
|
|
|
// 插入政策主表
|
|
|
|
baseDao.insert(icPolicyEntity); |
|
|
|
//删除规则、规则明细、分类、附件
|
|
|
|
icPolicyRuleDao.deleteByIcPolicyId(icPolicyEntity.getId()); |
|
|
|
icPolicyCategoryDao.deleteByIcPolicyId(icPolicyEntity.getId()); |
|
|
|
heartAttachmentDao.deleteByBusinessId(icPolicyEntity.getId()); |
|
|
|
}else{ |
|
|
|
// 插入政策主表
|
|
|
|
baseDao.insert(icPolicyEntity); |
|
|
|
} |
|
|
|
// 插入细则
|
|
|
|
int ruleSort = 1; |
|
|
@ -285,6 +280,7 @@ public class IcPolicyServiceImpl extends BaseServiceImpl<IcPolicyDao, IcPolicyEn |
|
|
|
if (CollectionUtils.isNotEmpty(ruleDTOList)) { |
|
|
|
ruleList = ConvertUtils.sourceToTarget(ruleDTOList, IcPolicyRuleFormDTO.class); |
|
|
|
for (IcPolicyRuleFormDTO rule : ruleList) { |
|
|
|
//人员信息
|
|
|
|
LambdaQueryWrapper<IcPolicyRuleDetailEntity> ruleDetailWrapper = new LambdaQueryWrapper<>(); |
|
|
|
ruleDetailWrapper.eq(IcPolicyRuleDetailEntity::getRuleId, rule.getId()) |
|
|
|
.eq(IcPolicyRuleDetailEntity::getGroupType, "resi") |
|
|
@ -293,19 +289,22 @@ public class IcPolicyServiceImpl extends BaseServiceImpl<IcPolicyDao, IcPolicyEn |
|
|
|
List<IcPolicyRuleDetailDTO> resiRuleList = CollectionUtils.isNotEmpty(resiList) ? ConvertUtils.sourceToTarget(resiList, IcPolicyRuleDetailDTO.class) : new ArrayList<>(); |
|
|
|
rule.setResiRuleList(resiRuleList); |
|
|
|
|
|
|
|
ruleDetailWrapper.eq(IcPolicyRuleDetailEntity::getRuleId, rule.getId()) |
|
|
|
//房屋信息
|
|
|
|
LambdaQueryWrapper<IcPolicyRuleDetailEntity> houseDetailWrapper = new LambdaQueryWrapper<>(); |
|
|
|
houseDetailWrapper.eq(IcPolicyRuleDetailEntity::getRuleId, rule.getId()) |
|
|
|
.eq(IcPolicyRuleDetailEntity::getGroupType, "house") |
|
|
|
.orderByAsc(IcPolicyRuleDetailEntity::getSort); |
|
|
|
List<IcPolicyRuleDetailEntity> houseList = icPolicyRuleDetailDao.selectList(ruleDetailWrapper); |
|
|
|
List<IcPolicyRuleDetailEntity> houseList = icPolicyRuleDetailDao.selectList(houseDetailWrapper); |
|
|
|
List<IcPolicyRuleDetailDTO> houseRuleList = CollectionUtils.isNotEmpty(houseList) ? ConvertUtils.sourceToTarget(houseList, IcPolicyRuleDetailDTO.class) : new ArrayList<>(); |
|
|
|
rule.setHouseRuleList(houseRuleList); |
|
|
|
|
|
|
|
ruleDetailWrapper.eq(IcPolicyRuleDetailEntity::getRuleId, rule.getId()) |
|
|
|
//统计信息
|
|
|
|
LambdaQueryWrapper<IcPolicyRuleDetailEntity> statDetailWrapper = new LambdaQueryWrapper<>(); |
|
|
|
statDetailWrapper.eq(IcPolicyRuleDetailEntity::getRuleId, rule.getId()) |
|
|
|
.eq(IcPolicyRuleDetailEntity::getGroupType, "stat") |
|
|
|
.orderByAsc(IcPolicyRuleDetailEntity::getSort); |
|
|
|
List<IcPolicyRuleDetailEntity> statList = icPolicyRuleDetailDao.selectList(ruleDetailWrapper); |
|
|
|
List<IcPolicyRuleDetailEntity> statList = icPolicyRuleDetailDao.selectList(statDetailWrapper); |
|
|
|
List<IcPolicyRuleDetailDTO> statRuleList = CollectionUtils.isNotEmpty(statList) ? ConvertUtils.sourceToTarget(statList, IcPolicyRuleDetailDTO.class) : new ArrayList<>(); |
|
|
|
; |
|
|
|
rule.setStatRuleList(statRuleList); |
|
|
|
} |
|
|
|
} |
|
|
|