|
|
@ -412,7 +412,7 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt |
|
|
|
@Override |
|
|
|
public void syncVotingCacheToDbByIssueId(String issueId) { |
|
|
|
VoteRedisFormDTO vote = issueVoteDetailRedis.getVoteStatistical(issueId); |
|
|
|
if(null == vote) return; |
|
|
|
if(null == vote) throw new RenException(String.format(ModuleConstants.ISSUE_NOT_FOUND_EXCEPTION_TEMPLATE,issueId)); |
|
|
|
IssueVoteStatisticalDTO toUpd = ConvertUtils.sourceToTarget(vote,IssueVoteStatisticalDTO.class); |
|
|
|
toUpd.setUpdatedBy("system"); |
|
|
|
IssueEntity issue = issueDao.selectById(issueId); |
|
|
@ -425,10 +425,15 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt |
|
|
|
toUpd.setVotableCount(votableCount.getData()); |
|
|
|
|
|
|
|
} |
|
|
|
}else { |
|
|
|
toUpd.setVotableCount(NumConstant.ZERO); |
|
|
|
} |
|
|
|
toUpd.setVotableCount(NumConstant.ZERO); |
|
|
|
|
|
|
|
IssueVoteStatisticalDTO existedStatistical = getByIssueId(issueId); |
|
|
|
if(null != existedStatistical && StringUtils.isNotBlank(existedStatistical.getId())){ |
|
|
|
toUpd.setId(existedStatistical.getId()); |
|
|
|
} |
|
|
|
update(toUpd); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -464,6 +469,7 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt |
|
|
|
VoteRedisFormDTO cache = issueVoteDetailRedis.get(issue.getId()); |
|
|
|
if(null == cache) |
|
|
|
continue; |
|
|
|
if(StringUtils.isBlank(cache.getIssueId())) cache.setIssueId(issue.getId()); |
|
|
|
vote.setCreatedBy("system"); |
|
|
|
vote.setUpdatedBy("system"); |
|
|
|
vote.setSupportCount(cache.getSupportAmount()); |
|
|
@ -474,7 +480,7 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt |
|
|
|
); |
|
|
|
list.add(vote); |
|
|
|
if(cache.getShouldVoteCount() != vote.getVotableCount()){ |
|
|
|
issueVoteDetailRedis.hset(issue.getId(),ModuleConstants.SHOULD_VOTE_COUNT,vote.getVotableCount()); |
|
|
|
issueVoteDetailRedis.set(cache); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|