| 
						
						
						
					 | 
				
				 | 
				
					@ -1,35 +1,43 @@ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					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.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.page.PageData; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.redis.common.CustomerStaffRedis; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.ConvertUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.Result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dao.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.IcPolicyCategoryDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.IcPolicyDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.IcPolicyItemResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					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.entity.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.feign.EpmetAdminOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.service.IcPolicyService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.github.pagehelper.PageHelper; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.github.pagehelper.PageInfo; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.apache.commons.collections4.CollectionUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.apache.commons.collections4.MapUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.apache.commons.lang3.StringUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.stereotype.Service; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.transaction.annotation.Transactional; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.ArrayList; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.HashMap; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.List; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.Map; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					/** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					 * 政策表 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -48,7 +56,8 @@ public class IcPolicyServiceImpl extends BaseServiceImpl<IcPolicyDao, IcPolicyEn | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private HeartAttachmentDao heartAttachmentDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private IcPolicyRuleDetailDao icPolicyRuleDetailDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private EpmetAdminOpenFeignClient adminOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * 房屋信息、统计信息查询有哪些可选项 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -211,7 +220,77 @@ public class IcPolicyServiceImpl extends BaseServiceImpl<IcPolicyDao, IcPolicyEn | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        formDTO.setAgencyId(staffInfo.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<IcPolicyDTO> list = baseDao.policyList(formDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (CollectionUtils.isNotEmpty(list)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            for (IcPolicyDTO icPolicyDTO : list) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 查询字典表
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                Result<Map<String, String>> levelRes = adminOpenFeignClient.dictMap(DictTypeEnum.POLICY_LEVEL.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                Map<String, String> levelMap = levelRes.success() && MapUtils.isNotEmpty(levelRes.getData()) ? levelRes.getData() : new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                icPolicyDTO.setPolicyLevelName(MapUtils.isNotEmpty(levelMap) && levelMap.containsKey(icPolicyDTO.getPolicyLevel()) ? levelMap.get(icPolicyDTO.getPolicyLevel()) : StrConstant.EPMETY_STR); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        PageInfo<IcPolicyDTO> pageInfo = new PageInfo<>(list); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return new PageData<>(list, pageInfo.getTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public List<IcPolicyRuleDTO> ruleList(String customerId, String policyId) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        LambdaQueryWrapper<IcPolicyRuleEntity> wrapper = new LambdaQueryWrapper<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        wrapper.eq(IcPolicyRuleEntity::getCustomerId, customerId) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                .eq(IcPolicyRuleEntity::getIcPolicyId, policyId) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                .orderByAsc(IcPolicyRuleEntity::getSort); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<IcPolicyRuleEntity> list = icPolicyRuleDao.selectList(wrapper); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return ConvertUtils.sourceToTarget(list, IcPolicyRuleDTO.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public IcPolicyDTO policyDetail(String customerId, String policyId) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        IcPolicyEntity policyEntity = baseDao.selectById(policyId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        IcPolicyDTO icPolicyDTO = ConvertUtils.sourceToTarget(policyEntity, IcPolicyDTO.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (null != icPolicyDTO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            icPolicyDTO.setPolicyId(policyId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            LambdaQueryWrapper<HeartAttachmentEntity> attWrapper = new LambdaQueryWrapper<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            attWrapper.eq(HeartAttachmentEntity::getBusinessId, policyId) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    .orderByAsc(HeartAttachmentEntity::getSort); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<HeartAttachmentEntity> attList = heartAttachmentDao.selectList(attWrapper); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            icPolicyDTO.setAttachmentList(CollectionUtils.isNotEmpty(attList) ? ConvertUtils.sourceToTarget(attList, FileCommonDTO.class) : new ArrayList<>()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            LambdaQueryWrapper<IcPolicyCategoryEntity> cateWrapper = new LambdaQueryWrapper<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            cateWrapper.eq(IcPolicyCategoryEntity::getIcPolicyId, policyId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<IcPolicyCategoryEntity> cateList = icPolicyCategoryDao.selectList(cateWrapper); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            icPolicyDTO.setCategoryList(CollectionUtils.isNotEmpty(cateList) ? ConvertUtils.sourceToTarget(cateList, IcPolicyCategoryDTO.class) : new ArrayList<>()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<IcPolicyRuleDTO> ruleDTOList = ruleList(customerId, policyId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<IcPolicyRuleFormDTO> ruleList = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            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") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            .orderByAsc(IcPolicyRuleDetailEntity::getSort); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    List<IcPolicyRuleDetailEntity> resiList = icPolicyRuleDetailDao.selectList(ruleDetailWrapper); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    List<IcPolicyRuleDetailDTO> resiRuleList = CollectionUtils.isNotEmpty(resiList) ? ConvertUtils.sourceToTarget(resiList, IcPolicyRuleDetailDTO.class) : new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    rule.setResiRuleList(resiRuleList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    ruleDetailWrapper.eq(IcPolicyRuleDetailEntity::getRuleId, rule.getId()) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            .eq(IcPolicyRuleDetailEntity::getGroupType, "house") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            .orderByAsc(IcPolicyRuleDetailEntity::getSort); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    List<IcPolicyRuleDetailEntity> houseList = icPolicyRuleDetailDao.selectList(ruleDetailWrapper); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    List<IcPolicyRuleDetailDTO> houseRuleList = CollectionUtils.isNotEmpty(houseList) ? ConvertUtils.sourceToTarget(houseList, IcPolicyRuleDetailDTO.class) : new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    rule.setHouseRuleList(houseRuleList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    ruleDetailWrapper.eq(IcPolicyRuleDetailEntity::getRuleId, rule.getId()) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            .eq(IcPolicyRuleDetailEntity::getGroupType, "stat") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            .orderByAsc(IcPolicyRuleDetailEntity::getSort); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    List<IcPolicyRuleDetailEntity> statList = icPolicyRuleDetailDao.selectList(ruleDetailWrapper); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    List<IcPolicyRuleDetailDTO> statRuleList = CollectionUtils.isNotEmpty(statList) ? ConvertUtils.sourceToTarget(statList, IcPolicyRuleDetailDTO.class) : new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    ; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    rule.setStatRuleList(statRuleList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            icPolicyDTO.setRuleList(ruleList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return icPolicyDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} |