|
|
@ -70,6 +70,8 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.sql.Date; |
|
|
|
import java.sql.Timestamp; |
|
|
|
import java.util.*; |
|
|
@ -972,17 +974,28 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
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.getOrgType(), 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().toString().concat("%")); |
|
|
|
return dto; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
} |
|
|
@ -1022,15 +1035,26 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
Map<String, String> map = new HashMap<>(); |
|
|
|
//统计组织下文化程度党员人数
|
|
|
|
List<OptionDataResultDTO> list = baseDao.getPartyMemberEducationStatistics(formDTO.getOrgType(), 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().toString().concat("%")); |
|
|
|
return dto; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
} |
|
|
|