|
|
@ -53,6 +53,7 @@ import com.epmet.service.IssueVoteDetailService; |
|
|
|
import com.epmet.service.IssueVoteStatisticalService; |
|
|
|
import com.epmet.utils.ModuleConstants; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.collections4.ListUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -325,16 +326,19 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt |
|
|
|
|
|
|
|
notExistedIds.removeAll(votedIssueIds); |
|
|
|
if(!notExistedIds.isEmpty()){ |
|
|
|
List<IssueVoteStatisticalDTO> collect = notExistedIds.stream().map(issueId -> { |
|
|
|
IssueVoteStatisticalDTO dto = new IssueVoteStatisticalDTO(); |
|
|
|
dto.setIssueId(issueId); |
|
|
|
dto.setSupportCount(NumConstant.ZERO); |
|
|
|
dto.setOppositionCount(NumConstant.ZERO); |
|
|
|
dto.setVotableCount(Optional.ofNullable(votableCountMap.get(issueGridMap.get(issueId))).orElse(NumConstant.ZERO)); |
|
|
|
dto.setCreatedBy(ModuleConstants.CREATED_BY_SYSTEM);dto.setUpdatedBy(ModuleConstants.CREATED_BY_SYSTEM); |
|
|
|
return dto; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
if(!CollectionUtils.isEmpty(collect)) toInsert.addAll(collect);} |
|
|
|
List<IssueVoteStatisticalDTO> collect = notExistedIds.stream().map(issueId -> { |
|
|
|
IssueVoteStatisticalDTO dto = new IssueVoteStatisticalDTO(); |
|
|
|
dto.setIssueId(issueId); |
|
|
|
dto.setSupportCount(NumConstant.ZERO); |
|
|
|
dto.setOppositionCount(NumConstant.ZERO); |
|
|
|
dto.setVotableCount(Optional.ofNullable(votableCountMap.get(issueGridMap.get(issueId))).orElse(NumConstant.ZERO)); |
|
|
|
dto.setCreatedBy(ModuleConstants.CREATED_BY_SYSTEM);dto.setUpdatedBy(ModuleConstants.CREATED_BY_SYSTEM); |
|
|
|
return dto; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
if(!CollectionUtils.isEmpty(collect)) { |
|
|
|
toInsert.addAll(collect); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
List<IssueAttitudeCountResultDTO> summaryList = issueVoteDetailDao.getVotingSummaryList(notExistedIds); |
|
|
@ -427,8 +431,11 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt |
|
|
|
List<IssueVoteStatisticalDTO> listToUpdate = new ArrayList<>(); |
|
|
|
setVotableCountsAndUpdateCache(listToUpdate,issues,votableCountMap); |
|
|
|
|
|
|
|
// listToUpdate批量更新
|
|
|
|
baseDao.updateBatchByIssueId(listToUpdate); |
|
|
|
// listToUpdate批量更新 todo 暂时解决下 分批插入
|
|
|
|
if (CollectionUtils.isNotEmpty(listToUpdate)) { |
|
|
|
ListUtils.partition(listToUpdate, NumConstant.ONE_HUNDRED) |
|
|
|
.forEach(part -> baseDao.updateBatchByIssueId(part)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
@ -550,8 +557,12 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt |
|
|
|
IssueVoteStatisticalDTO vote = new IssueVoteStatisticalDTO(); |
|
|
|
vote.setIssueId(issue.getId()); |
|
|
|
VoteRedisFormDTO cache = issueVoteDetailRedis.getVoteStatistical(issue.getId()); |
|
|
|
if(null == cache) continue; |
|
|
|
if(StringUtils.isBlank(cache.getIssueId())) cache.setIssueId(issue.getId()); |
|
|
|
if(null == cache) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
if(StringUtils.isBlank(cache.getIssueId())) { |
|
|
|
cache.setIssueId(issue.getId()); |
|
|
|
} |
|
|
|
vote.setCreatedBy(ModuleConstants.CREATED_BY_SYSTEM); |
|
|
|
vote.setUpdatedBy(ModuleConstants.CREATED_BY_SYSTEM); |
|
|
|
vote.setSupportCount(cache.getSupportAmount()); |
|
|
|