|  |  | @ -7,7 +7,10 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.FieldConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.NumConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.StrConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.dto.form.DictListFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.dto.result.DictListResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.dto.result.OptionDataResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.enums.DictTypeEnum; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.enums.IcFormCodeEnum; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.enums.PartyPostEnum; | 
			
		
	
	
		
			
				
					|  |  | @ -20,6 +23,10 @@ import com.epmet.commons.tools.utils.ConvertUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.DateUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.Result; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.form.IcFormOptionsQueryFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.form.IcPartyMemberFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.form.IcPartyMemberListFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.result.PartyMemberAgeResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.result.PartyMemberEducationResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.feign.EpmetAdminOpenFeignClient; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.feign.EpmetUserOpenFeignClient; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.feign.OperCustomizeOpenFeignClient; | 
			
		
	
	
		
			
				
					|  |  | @ -44,6 +51,8 @@ import org.springframework.stereotype.Service; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import javax.annotation.Resource; | 
			
		
	
		
			
				
					|  |  |  | import java.math.BigDecimal; | 
			
		
	
		
			
				
					|  |  |  | import java.math.RoundingMode; | 
			
		
	
		
			
				
					|  |  |  | import java.util.*; | 
			
		
	
		
			
				
					|  |  |  | import java.util.stream.Collectors; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | @ -307,4 +316,107 @@ public class IcPartyMemberServiceImpl extends BaseServiceImpl<IcPartyMemberDao, | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public List<OptionDataResultDTO> partyMemberEducationStatistics(IcPartyMemberFormDTO formDTO) { | 
			
		
	
		
			
				
					|  |  |  |         //获取文化程度字典
 | 
			
		
	
		
			
				
					|  |  |  |         DictListFormDTO dictFormDTO = new DictListFormDTO(); | 
			
		
	
		
			
				
					|  |  |  |         dictFormDTO.setDictType(DictTypeEnum.EDUCATION.getCode()); | 
			
		
	
		
			
				
					|  |  |  |         Result<List<DictListResultDTO>> dictResult = epmetAdminOpenFeignClient.dictList(dictFormDTO); | 
			
		
	
		
			
				
					|  |  |  |         Map<String, String> map = new HashMap<>(); | 
			
		
	
		
			
				
					|  |  |  |         //统计组织下文化程度党员人数
 | 
			
		
	
		
			
				
					|  |  |  |         List<OptionDataResultDTO> list = baseDao.getPartyMemberEducationStatistics(formDTO.getOrgId()); | 
			
		
	
		
			
				
					|  |  |  |         int total = 0; | 
			
		
	
		
			
				
					|  |  |  |         if (CollectionUtils.isNotEmpty(list)) { | 
			
		
	
		
			
				
					|  |  |  |             map = list.stream().collect(Collectors.toMap(OptionDataResultDTO::getCode, OptionDataResultDTO::getValue)); | 
			
		
	
		
			
				
					|  |  |  |             total = list.stream().mapToInt(item -> Integer.parseInt(item.getValue())).sum(); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         Map<String, String> finalMap = map; | 
			
		
	
		
			
				
					|  |  |  |         int finalTotal = total; | 
			
		
	
		
			
				
					|  |  |  |         return dictResult.getData().stream().map(item -> { | 
			
		
	
		
			
				
					|  |  |  |             OptionDataResultDTO dto = new OptionDataResultDTO(); | 
			
		
	
		
			
				
					|  |  |  |             dto.setCode(item.getValue()); | 
			
		
	
		
			
				
					|  |  |  |             dto.setLabel(item.getLabel()); | 
			
		
	
		
			
				
					|  |  |  |             dto.setValue(null == finalMap.get(item.getValue()) ? NumConstant.ZERO_STR : finalMap.get(item.getValue())); | 
			
		
	
		
			
				
					|  |  |  |             BigDecimal radio = new BigDecimal("0.00"); | 
			
		
	
		
			
				
					|  |  |  |             if (NumConstant.ZERO != finalTotal) { | 
			
		
	
		
			
				
					|  |  |  |                 BigDecimal sum = new BigDecimal(finalTotal); | 
			
		
	
		
			
				
					|  |  |  |                 BigDecimal count = new BigDecimal(dto.getValue()); | 
			
		
	
		
			
				
					|  |  |  |                 BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); | 
			
		
	
		
			
				
					|  |  |  |                 radio = count.multiply(hundred).divide(sum, NumConstant.TWO, RoundingMode.HALF_UP); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             dto.setRadio(radio.stripTrailingZeros().toPlainString().concat("%")); | 
			
		
	
		
			
				
					|  |  |  |             return dto; | 
			
		
	
		
			
				
					|  |  |  |         }).collect(Collectors.toList()); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public PageData<PartyMemberAgeResultDTO> getPartyMemberAgeList(IcPartyMemberListFormDTO formDTO) { | 
			
		
	
		
			
				
					|  |  |  |         if (formDTO.getIsPage()) { | 
			
		
	
		
			
				
					|  |  |  |             PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); | 
			
		
	
		
			
				
					|  |  |  |             List<PartyMemberAgeResultDTO> list = baseDao.getPartyMemberAgeList(formDTO.getOrgId(), formDTO.getCode()); | 
			
		
	
		
			
				
					|  |  |  |             PageInfo<PartyMemberAgeResultDTO> pageInfo = new PageInfo<>(list); | 
			
		
	
		
			
				
					|  |  |  |             return new PageData<>(list, pageInfo.getTotal()); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         List<PartyMemberAgeResultDTO> list = baseDao.getPartyMemberAgeList(formDTO.getOrgId(), formDTO.getCode()); | 
			
		
	
		
			
				
					|  |  |  |         return new PageData<>(list, null == list?NumConstant.ZERO:list.size()); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public PageData<PartyMemberEducationResultDTO> getPartyMemberEducationList(IcPartyMemberListFormDTO formDTO) { | 
			
		
	
		
			
				
					|  |  |  |         if (formDTO.getIsPage()) { | 
			
		
	
		
			
				
					|  |  |  |             PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); | 
			
		
	
		
			
				
					|  |  |  |             List<PartyMemberEducationResultDTO> list = baseDao.getPartyMemberEducationList(formDTO.getOrgId(), formDTO.getCode()); | 
			
		
	
		
			
				
					|  |  |  |             Result<Map<String, String>> mapResult = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.EDUCATION.getCode()); | 
			
		
	
		
			
				
					|  |  |  |             PageInfo<PartyMemberEducationResultDTO> pageInfo = new PageInfo<>(list); | 
			
		
	
		
			
				
					|  |  |  |             if (CollectionUtils.isNotEmpty(list)) { | 
			
		
	
		
			
				
					|  |  |  |                 list.forEach(item -> { | 
			
		
	
		
			
				
					|  |  |  |                     item.setEducation(null == mapResult.getData().get(item.getEducation()) ? "" : mapResult.getData().get(item.getEducation())); | 
			
		
	
		
			
				
					|  |  |  |                 }); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             return new PageData<>(list, pageInfo.getTotal()); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         List<PartyMemberEducationResultDTO> list = baseDao.getPartyMemberEducationList(formDTO.getOrgId(), formDTO.getCode()); | 
			
		
	
		
			
				
					|  |  |  |         Result<Map<String, String>> mapResult = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.EDUCATION.getCode()); | 
			
		
	
		
			
				
					|  |  |  |         if (CollectionUtils.isNotEmpty(list)) { | 
			
		
	
		
			
				
					|  |  |  |             list.forEach(item -> { | 
			
		
	
		
			
				
					|  |  |  |                 item.setEducation(null == mapResult.getData().get(item.getEducation()) ? "" : mapResult.getData().get(item.getEducation())); | 
			
		
	
		
			
				
					|  |  |  |             }); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         return new PageData<>(list, null == list?NumConstant.ZERO:list.size()); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public List<OptionDataResultDTO> partyMemberAgeStatistics(IcPartyMemberFormDTO formDTO) { | 
			
		
	
		
			
				
					|  |  |  |         //获取年龄范围字典
 | 
			
		
	
		
			
				
					|  |  |  |         DictListFormDTO dictFormDTO = new DictListFormDTO(); | 
			
		
	
		
			
				
					|  |  |  |         dictFormDTO.setDictType(DictTypeEnum.AGE_GROUP.getCode()); | 
			
		
	
		
			
				
					|  |  |  |         Result<List<DictListResultDTO>> dictResult = epmetAdminOpenFeignClient.dictList(dictFormDTO); | 
			
		
	
		
			
				
					|  |  |  |         Map<String, String> map = new HashMap<>(); | 
			
		
	
		
			
				
					|  |  |  |         int total = 0; | 
			
		
	
		
			
				
					|  |  |  |         //统计组织下各年龄范围人数
 | 
			
		
	
		
			
				
					|  |  |  |         List<OptionDataResultDTO> list = baseDao.getPartyMemberAgeStatistics(formDTO.getOrgId()); | 
			
		
	
		
			
				
					|  |  |  |         if (CollectionUtils.isNotEmpty(list)) { | 
			
		
	
		
			
				
					|  |  |  |             map = list.stream().collect(Collectors.toMap(OptionDataResultDTO::getCode, OptionDataResultDTO::getValue)); | 
			
		
	
		
			
				
					|  |  |  |             total = list.stream().mapToInt(item -> Integer.parseInt(item.getValue())).sum(); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         Map<String, String> finalMap = map; | 
			
		
	
		
			
				
					|  |  |  |         int finalTotal = total; | 
			
		
	
		
			
				
					|  |  |  |         return dictResult.getData().stream().map(item -> { | 
			
		
	
		
			
				
					|  |  |  |             OptionDataResultDTO dto = new OptionDataResultDTO(); | 
			
		
	
		
			
				
					|  |  |  |             dto.setCode(item.getValue()); | 
			
		
	
		
			
				
					|  |  |  |             dto.setLabel(item.getLabel()); | 
			
		
	
		
			
				
					|  |  |  |             dto.setValue(null == finalMap.get(item.getValue()) ? NumConstant.ZERO_STR : finalMap.get(item.getValue())); | 
			
		
	
		
			
				
					|  |  |  |             BigDecimal radio = new BigDecimal("0.00"); | 
			
		
	
		
			
				
					|  |  |  |             if (NumConstant.ZERO != finalTotal) { | 
			
		
	
		
			
				
					|  |  |  |                 BigDecimal sum = new BigDecimal(finalTotal); | 
			
		
	
		
			
				
					|  |  |  |                 BigDecimal count = new BigDecimal(dto.getValue()); | 
			
		
	
		
			
				
					|  |  |  |                 BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); | 
			
		
	
		
			
				
					|  |  |  |                 radio = count.multiply(hundred).divide(sum, NumConstant.TWO, RoundingMode.HALF_UP); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             dto.setRadio(radio.stripTrailingZeros().toPlainString().concat("%")); | 
			
		
	
		
			
				
					|  |  |  |             return dto; | 
			
		
	
		
			
				
					|  |  |  |         }).collect(Collectors.toList()); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
	
		
			
				
					|  |  | 
 |