|
|
@ -607,36 +607,49 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt |
|
|
|
|
|
|
|
/** |
|
|
|
* @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); |
|
|
|
public void syncVotingCacheToDbByParams(IssueEntity issueEntity, String statisticalId) { |
|
|
|
VoteRedisFormDTO vote = issueVoteDetailRedis.getVoteStatistical(issueEntity.getId()); |
|
|
|
if(null == vote) { |
|
|
|
throw new RenException(String.format(ModuleConstants.ISSUE_NOT_FOUND_EXCEPTION_TEMPLATE,issueId)); |
|
|
|
throw new RenException(String.format(ModuleConstants.ISSUE_NOT_FOUND_EXCEPTION_TEMPLATE,issueEntity.getId())); |
|
|
|
} |
|
|
|
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()){ |
|
|
|
if ("resi_topic".equals(issueEntity.getSourceType())) { |
|
|
|
CommonGridIdFormDTO gridParam = new CommonGridIdFormDTO(); |
|
|
|
gridParam.setGridId(issueEntity.getGridId()); |
|
|
|
Result<Integer> votableCount = |
|
|
|
resiGroupFeignClient.votableCount(gridParam); |
|
|
|
if (votableCount.success() && null != votableCount.getData()) { |
|
|
|
toUpd.setVotableCount(votableCount.getData()); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
//先默认赋值0吧
|
|
|
|
toUpd.setVotableCount(NumConstant.ZERO); |
|
|
|
} |
|
|
|
} else { |
|
|
|
AllResiByGridFormDTO allResiByGridFormDTO=new AllResiByGridFormDTO(); |
|
|
|
allResiByGridFormDTO.setGridId(issueEntity.getGridId()); |
|
|
|
Result<Integer> allResiByGrid=epmetUserOpenFeignClient.getAllResiByGrid(allResiByGridFormDTO); |
|
|
|
if(allResiByGrid.success()){ |
|
|
|
toUpd.setVotableCount(allResiByGrid.getData()); |
|
|
|
}else{ |
|
|
|
//先默认赋值0吧
|
|
|
|
toUpd.setVotableCount(NumConstant.ZERO); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(statisticalId)){ |
|
|
|
toUpd.setId(statisticalId); |
|
|
|
update(toUpd); |
|
|
|
}else{ |
|
|
|
IssueVoteStatisticalDTO existedStatistical = getByIssueId(issueId); |
|
|
|
IssueVoteStatisticalDTO existedStatistical = getByIssueId(issueEntity.getId()); |
|
|
|
if(null != existedStatistical && StringUtils.isNotBlank(existedStatistical.getId())){ |
|
|
|
toUpd.setId(existedStatistical.getId()); |
|
|
|
update(toUpd); |
|
|
|