Browse Source

Merge branch 'develop' into release_temp

master
zhaoqifeng 4 years ago
parent
commit
7861ec4705
  1. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionDataResultDTO.java
  2. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/HeartVolunteerService.java
  3. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/HeartVolunteerServiceImpl.java
  4. 57
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DemandServiceImpl.java
  5. 2
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectCategoryDictDao.xml
  6. 2
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/CategoryListDTO.java
  7. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VolunteerDistributionResultDTO.java
  8. 24
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  9. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/VolunteerServiceImpl.java

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionDataResultDTO.java

@ -15,4 +15,5 @@ public class OptionDataResultDTO implements Serializable {
private String label; private String label;
private String value; private String value;
private String code; private String code;
private String radio;
} }

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/HeartVolunteerService.java

@ -11,5 +11,5 @@ import java.util.List;
*@Date 2021/12/8 *@Date 2021/12/8
*/ */
public interface HeartVolunteerService { public interface HeartVolunteerService {
List<VolunteerInfoEntity> listVolunteersPage(String customerId, Date endCreateTime, Integer pageNum, Integer pageSize); List<VolunteerInfoEntity> listVolunteers(String customerId, Date endCreateTime);
} }

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/HeartVolunteerServiceImpl.java

@ -29,12 +29,10 @@ public class HeartVolunteerServiceImpl implements HeartVolunteerService {
private VolunteerInfoDao volunteerInfoDao; private VolunteerInfoDao volunteerInfoDao;
@Override @Override
public List<VolunteerInfoEntity> listVolunteersPage(String customerId, Date endCreateTime, Integer pageNum, Integer pageSize) { public List<VolunteerInfoEntity> listVolunteers(String customerId, Date endCreateTime) {
return PageHelper.startPage(pageNum, pageSize).doSelectPage(() -> { LambdaQueryWrapper<VolunteerInfoEntity> query = new LambdaQueryWrapper<>();
LambdaQueryWrapper<VolunteerInfoEntity> query = new LambdaQueryWrapper<>(); query.eq(VolunteerInfoEntity::getCustomerId, customerId);
query.eq(VolunteerInfoEntity::getCustomerId, customerId); query.lt(VolunteerInfoEntity::getCreatedTime, endCreateTime);
query.lt(VolunteerInfoEntity::getCreatedTime, endCreateTime); return volunteerInfoDao.selectList(query);
volunteerInfoDao.selectList(query);
});
} }
} }

57
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DemandServiceImpl.java

@ -67,11 +67,12 @@ public class DemandServiceImpl implements DemandService {
/** /**
* 清理旧数据 * 清理旧数据
* @param yestoday * @param targetDate 要清理哪天的数据
* @param customerIds 要清理哪些客户的
*/ */
private void clearOldDatas(List<String> customerIds, Date yestoday) { private void clearOldDatas(List<String> customerIds, Date targetDate) {
String dateDimId = DimIdGenerator.getDateDimId(yestoday); String dateDimId = DimIdGenerator.getDateDimId(targetDate);
demandStatsService.clearVolunteerDemandServiceDailyStats(customerIds, dateDimId); demandStatsService.clearVolunteerDemandServiceDailyStats(customerIds, dateDimId);
@ -90,50 +91,40 @@ public class DemandServiceImpl implements DemandService {
// 居民志愿者数量 // 居民志愿者数量
Integer resiVolunteerCount = 0; Integer resiVolunteerCount = 0;
// 党员志愿者用户id列表
List<String> partymemberVolunteerUserIds = new ArrayList<>(16); List<String> partymemberVolunteerUserIds = new ArrayList<>(16);
int pageNum = 1; List<VolunteerInfoEntity> volunteers = heartVolunteerService.listVolunteers(customerId, endTime);
int volunteerPageSize = 5;
while (true) { volunteerTotalCount = volunteers.size();
int shardingStartIndex = 0; // 分片开始下标
int shardingSize = 2; int shardingStartIndex = 0;
// 分片大小(条数)
int shardingSize = 2;
List<VolunteerInfoEntity> volunteersPage = heartVolunteerService.listVolunteersPage(customerId, endTime, pageNum, volunteerPageSize); // 分片去确定党员身份,防止in条件过大
while (true) {
int realShardingSize = Math.min(shardingSize, volunteerTotalCount - shardingStartIndex);
// 如果查询结果为0,说明没有更多的志愿者了 if (realShardingSize <= 0) {
if (volunteersPage.size() == 0) {
break; break;
} }
volunteerTotalCount += volunteersPage.size(); int shardingEndIndex = shardingStartIndex + realShardingSize;
List<String> volunteerUserIds = volunteers.subList(shardingStartIndex, shardingEndIndex)
// 分片去确定党员身份 .stream()
while (true) { .map((volunteerInfoEntity) -> volunteerInfoEntity.getUserId())
int realShardingSize = Math.min(shardingSize, volunteersPage.size() - shardingStartIndex); .collect(Collectors.toList());
if (realShardingSize == 0) {
break;
}
int shardingEndIndex = shardingStartIndex + realShardingSize;
List<String> volunteerUserIds = volunteersPage.subList(shardingStartIndex, shardingEndIndex)
.stream()
.map((volunteerInfoEntity) -> volunteerInfoEntity.getUserId())
.collect(Collectors.toList());
List<String> tempPartymemberUserIds = userService.filterUserIds(volunteerUserIds, EpmetRoleKeyConstant.PARTYMEMBER); List<String> tempPartymemberUserIds = userService.filterUserIds(volunteerUserIds, EpmetRoleKeyConstant.PARTYMEMBER);
partymemberVolunteerUserIds.addAll(tempPartymemberUserIds); partymemberVolunteerUserIds.addAll(tempPartymemberUserIds);
shardingStartIndex = shardingEndIndex;
}
pageNum++; shardingStartIndex = shardingEndIndex;
} }
partymemberVolunteerCount += partymemberVolunteerUserIds.size(); partymemberVolunteerCount = partymemberVolunteerUserIds.size();
resiVolunteerCount = volunteerTotalCount - partymemberVolunteerCount; resiVolunteerCount = volunteerTotalCount - partymemberVolunteerCount;
//2. 查询志愿者服务次数 //2. 查询志愿者服务次数

2
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectCategoryDictDao.xml

@ -251,7 +251,7 @@
CATEGORY_CODE, CATEGORY_CODE,
CATEGORY_NAME, CATEGORY_NAME,
LENGTH(CATEGORY_CODE) AS codeLength, LENGTH(CATEGORY_CODE) AS codeLength,
IFNULL(color,'') AS colour IFNULL(color,'') AS color
FROM issue_project_category_dict FROM issue_project_category_dict
WHERE DEL_FLAG = 0 WHERE DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId} AND CUSTOMER_ID = #{customerId}

2
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/CategoryListDTO.java

@ -25,6 +25,8 @@ public class CategoryListDTO implements Serializable {
*/ */
private String categoryName; private String categoryName;
private String color;
/** /**
* 个数 * 个数
*/ */

2
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VolunteerDistributionResultDTO.java

@ -27,7 +27,7 @@ public class VolunteerDistributionResultDTO {
@Data @Data
public static class Distribution { public static class Distribution {
private Set<String> volunteerTypes; private Set<String> volunteerCategories;
private String epmetUserId; private String epmetUserId;
private String icResiUserId; private String icResiUserId;
private String longitude; private String longitude;

24
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

@ -70,6 +70,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.Date; import java.sql.Date;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.*; import java.util.*;
@ -972,17 +974,28 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
dictFormDTO.setDictType(DictTypeEnum.AGE_GROUP.getCode()); dictFormDTO.setDictType(DictTypeEnum.AGE_GROUP.getCode());
Result<List<DictListResultDTO>> dictResult = epmetAdminOpenFeignClient.dictList(dictFormDTO); Result<List<DictListResultDTO>> dictResult = epmetAdminOpenFeignClient.dictList(dictFormDTO);
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
int total = 0;
//统计组织下各年龄范围人数 //统计组织下各年龄范围人数
List<OptionDataResultDTO> list = baseDao.getPartyMemberAgeStatistics(formDTO.getOrgType(), formDTO.getOrgId()); List<OptionDataResultDTO> list = baseDao.getPartyMemberAgeStatistics(formDTO.getOrgType(), formDTO.getOrgId());
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
map = list.stream().collect(Collectors.toMap(OptionDataResultDTO::getCode, OptionDataResultDTO::getValue)); 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; Map<String, String> finalMap = map;
int finalTotal = total;
return dictResult.getData().stream().map(item -> { return dictResult.getData().stream().map(item -> {
OptionDataResultDTO dto = new OptionDataResultDTO(); OptionDataResultDTO dto = new OptionDataResultDTO();
dto.setCode(item.getValue()); dto.setCode(item.getValue());
dto.setLabel(item.getLabel()); dto.setLabel(item.getLabel());
dto.setValue(null == finalMap.get(item.getValue())?NumConstant.ZERO_STR:finalMap.get(item.getValue())); 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; return dto;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
@ -1022,15 +1035,26 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
//统计组织下文化程度党员人数 //统计组织下文化程度党员人数
List<OptionDataResultDTO> list = baseDao.getPartyMemberEducationStatistics(formDTO.getOrgType(), formDTO.getOrgId()); List<OptionDataResultDTO> list = baseDao.getPartyMemberEducationStatistics(formDTO.getOrgType(), formDTO.getOrgId());
int total = 0;
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
map = list.stream().collect(Collectors.toMap(OptionDataResultDTO::getCode, OptionDataResultDTO::getValue)); 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; Map<String, String> finalMap = map;
int finalTotal = total;
return dictResult.getData().stream().map(item -> { return dictResult.getData().stream().map(item -> {
OptionDataResultDTO dto = new OptionDataResultDTO(); OptionDataResultDTO dto = new OptionDataResultDTO();
dto.setCode(item.getValue()); dto.setCode(item.getValue());
dto.setLabel(item.getLabel()); dto.setLabel(item.getLabel());
dto.setValue(null == finalMap.get(item.getValue())?NumConstant.ZERO_STR:finalMap.get(item.getValue())); 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; return dto;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/VolunteerServiceImpl.java

@ -162,7 +162,7 @@ public class VolunteerServiceImpl implements VolunteerService, ResultDataResolve
ServiceConstant.GOV_ORG_SERVER, ServiceConstant.GOV_ORG_SERVER,
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg); EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg);
distribution.setVolunteerTypes(volunteerTypes); distribution.setVolunteerCategories(volunteerTypes);
distribution.setEpmetUserId(userBaseInfo.getUserId()); distribution.setEpmetUserId(userBaseInfo.getUserId());
distribution.setIcResiUserId(icResiUserInfo.getId()); distribution.setIcResiUserId(icResiUserInfo.getId());
Optional.of(building).ifPresent(b -> { Optional.of(building).ifPresent(b -> {

Loading…
Cancel
Save