Browse Source

发布的议题,议题转项目接口调整

master
yinzuomei 3 years ago
parent
commit
c692768a8f
  1. 5
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueVoteStatisticalService.java
  2. 4
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java
  3. 37
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java

5
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueVoteStatisticalService.java

@ -28,6 +28,7 @@ import com.epmet.dto.result.EvaluationListResultDTO;
import com.epmet.dto.result.MyPartIssuesResultDTO;
import com.epmet.dto.result.VoteResultDTO;
import com.epmet.dto.result.VotingTrendResultDTO;
import com.epmet.entity.IssueEntity;
import com.epmet.entity.IssueVoteStatisticalEntity;
import java.util.List;
@ -153,14 +154,12 @@ public interface IssueVoteStatisticalService extends BaseService<IssueVoteStatis
/**
* @Description 对指定的issueId的议题表决统计数缓存与Db同步
* @param issueId
* @param gridId
* @parma statisticalId
* @return
* @author wangc
* @date 2020.05.21 09:09
**/
void syncVotingCacheToDbByParams(String issueId,String gridId,String statisticalId);
void syncVotingCacheToDbByParams(IssueEntity issueEntity, String statisticalId);
/**
* @Description 个人中心-我参与的议题列表

4
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java

@ -958,7 +958,7 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp
}
try{
issueVoteStatisticalService.syncVotingCacheToDbByParams(formDTO.getIssueId(),entity.getGridId(),null);
issueVoteStatisticalService.syncVotingCacheToDbByParams(entity,null);
}catch(RenException e){
logger.error(e.getInternalMsg());
}
@ -1088,7 +1088,7 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp
//6:缓存中网格下表决中的议题总数减1
govIssueRedis.subtractWorkGrassrootsIssueRedDotValue(entity.getGridId());
try{
issueVoteStatisticalService.syncVotingCacheToDbByParams(formDTO.getIssueId(),entity.getGridId(),null);
issueVoteStatisticalService.syncVotingCacheToDbByParams(entity,null);
}catch(RenException e){
logger.error(e.getInternalMsg());
}

37
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java

@ -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);

Loading…
Cancel
Save