|
@ -252,7 +252,7 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt |
|
|
//获取所有voting的议题
|
|
|
//获取所有voting的议题
|
|
|
Set<IssueDTO> issues = |
|
|
Set<IssueDTO> issues = |
|
|
issueDao.selectIssueIdsByCondition(issueParam); |
|
|
issueDao.selectIssueIdsByCondition(issueParam); |
|
|
if(null == issues || issues.size()< NumConstant.ONE){ |
|
|
if(null == issues || issues.isEmpty()){ |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
Set<String> ids = issues.stream().map(IssueDTO::getId).collect(Collectors.toSet()); |
|
|
Set<String> ids = issues.stream().map(IssueDTO::getId).collect(Collectors.toSet()); |
|
@ -285,9 +285,7 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt |
|
|
List<IssueVoteStatisticalDTO> listToUpdate = new ArrayList<>(); |
|
|
List<IssueVoteStatisticalDTO> listToUpdate = new ArrayList<>(); |
|
|
setVotableCountsAndUpdateCache(listToUpdate, |
|
|
setVotableCountsAndUpdateCache(listToUpdate, |
|
|
existedIds.stream().flatMap(existedId -> issues.stream().filter(issue -> |
|
|
existedIds.stream().flatMap(existedId -> issues.stream().filter(issue -> |
|
|
StringUtils.equals(issue.getId(),existedId)).map(issueDTO -> { |
|
|
StringUtils.equals(issue.getId(),existedId))).collect(Collectors.toSet()), |
|
|
return issueDTO; |
|
|
|
|
|
})).collect(Collectors.toSet()), |
|
|
|
|
|
votableCountMap); |
|
|
votableCountMap); |
|
|
|
|
|
|
|
|
// 批量更新listToUpdate
|
|
|
// 批量更新listToUpdate
|
|
@ -417,8 +415,10 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt |
|
|
public void syncVotingCacheToDbByIssueId(String issueId) { |
|
|
public void syncVotingCacheToDbByIssueId(String issueId) { |
|
|
VoteRedisFormDTO vote = issueVoteDetailRedis.getVoteStatistical(issueId); |
|
|
VoteRedisFormDTO vote = issueVoteDetailRedis.getVoteStatistical(issueId); |
|
|
if(null == vote) throw new RenException(String.format(ModuleConstants.ISSUE_NOT_FOUND_EXCEPTION_TEMPLATE,issueId)); |
|
|
if(null == vote) throw new RenException(String.format(ModuleConstants.ISSUE_NOT_FOUND_EXCEPTION_TEMPLATE,issueId)); |
|
|
IssueVoteStatisticalDTO toUpd = ConvertUtils.sourceToTarget(vote,IssueVoteStatisticalDTO.class); |
|
|
IssueVoteStatisticalDTO toUpd = new IssueVoteStatisticalDTO(); |
|
|
toUpd.setUpdatedBy("system"); |
|
|
toUpd.setOppositionCount(vote.getOppositionAmount()); |
|
|
|
|
|
toUpd.setSupportCount(vote.getSupportAmount()); |
|
|
|
|
|
toUpd.setVotableCount(vote.getShouldVoteCount()); |
|
|
IssueEntity issue = issueDao.selectById(issueId); |
|
|
IssueEntity issue = issueDao.selectById(issueId); |
|
|
if(null != issue && StringUtils.isNotBlank(issue.getGridId())){ |
|
|
if(null != issue && StringUtils.isNotBlank(issue.getGridId())){ |
|
|
CommonGridIdFormDTO gridId = new CommonGridIdFormDTO(); |
|
|
CommonGridIdFormDTO gridId = new CommonGridIdFormDTO(); |
|
@ -427,17 +427,15 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt |
|
|
resiGroupFeignClient.votableCount(gridId); |
|
|
resiGroupFeignClient.votableCount(gridId); |
|
|
if(votableCount.success() && null != votableCount.getData()){ |
|
|
if(votableCount.success() && null != votableCount.getData()){ |
|
|
toUpd.setVotableCount(votableCount.getData()); |
|
|
toUpd.setVotableCount(votableCount.getData()); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}else { |
|
|
|
|
|
toUpd.setVotableCount(NumConstant.ZERO); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
IssueVoteStatisticalDTO existedStatistical = getByIssueId(issueId); |
|
|
IssueVoteStatisticalDTO existedStatistical = getByIssueId(issueId); |
|
|
if(null != existedStatistical && StringUtils.isNotBlank(existedStatistical.getId())){ |
|
|
if(null != existedStatistical && StringUtils.isNotBlank(existedStatistical.getId())){ |
|
|
toUpd.setId(existedStatistical.getId()); |
|
|
toUpd.setId(existedStatistical.getId()); |
|
|
|
|
|
update(toUpd); |
|
|
} |
|
|
} |
|
|
update(toUpd); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -452,6 +450,44 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt |
|
|
return baseDao.selectByIssueId(issueId); |
|
|
return baseDao.selectByIssueId(issueId); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @Description 对指定的issueId的议题表决统计数缓存与Db同步,对于前项操作已经查询过的数据不再重复查询 |
|
|
|
|
|
* @param issueId |
|
|
|
|
|
* @param gridId |
|
|
|
|
|
* @parma statisticalId |
|
|
|
|
|
* @return |
|
|
|
|
|
* @author wangc |
|
|
|
|
|
* @date 2020.05.21 09:09 |
|
|
|
|
|
**/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public void syncVotingCacheToDbByParams(String issueId, String gridId, String statisticalId) { |
|
|
|
|
|
VoteRedisFormDTO vote = issueVoteDetailRedis.getVoteStatistical(issueId); |
|
|
|
|
|
if(null == vote) throw new RenException(String.format(ModuleConstants.ISSUE_NOT_FOUND_EXCEPTION_TEMPLATE,issueId)); |
|
|
|
|
|
IssueVoteStatisticalDTO toUpd = new IssueVoteStatisticalDTO(); |
|
|
|
|
|
toUpd.setOppositionCount(vote.getOppositionAmount()); |
|
|
|
|
|
toUpd.setSupportCount(vote.getSupportAmount()); |
|
|
|
|
|
toUpd.setVotableCount(vote.getShouldVoteCount()); |
|
|
|
|
|
CommonGridIdFormDTO gridParam = new CommonGridIdFormDTO(); |
|
|
|
|
|
gridParam.setGridId(gridId); |
|
|
|
|
|
Result<Integer> votableCount = |
|
|
|
|
|
resiGroupFeignClient.votableCount(gridParam); |
|
|
|
|
|
if(votableCount.success() && null != votableCount.getData()){ |
|
|
|
|
|
toUpd.setVotableCount(votableCount.getData()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(statisticalId)){ |
|
|
|
|
|
toUpd.setId(statisticalId); |
|
|
|
|
|
update(toUpd); |
|
|
|
|
|
}else{ |
|
|
|
|
|
IssueVoteStatisticalDTO existedStatistical = getByIssueId(issueId); |
|
|
|
|
|
if(null != existedStatistical && StringUtils.isNotBlank(existedStatistical.getId())){ |
|
|
|
|
|
toUpd.setId(existedStatistical.getId()); |
|
|
|
|
|
update(toUpd); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Description 遍历应表决数 |
|
|
* @Description 遍历应表决数 |
|
|
* @param list - List<IssueVoteStatisticalDTO> | Set<IssueDTO> | Map<String,Integer> |
|
|
* @param list - List<IssueVoteStatisticalDTO> | Set<IssueDTO> | Map<String,Integer> |
|
|