Browse Source

议题表决定时任务恢复

dev_shibei_match
wangchao 5 years ago
parent
commit
9b8b1bf051
  1. 11
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueVoteDetailRedis.java
  2. 27
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java
  3. 5
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/utils/ModuleConstants.java
  4. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java

11
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueVoteDetailRedis.java

@ -23,14 +23,12 @@ import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.IssueConstant;
import com.epmet.dto.IssueDTO;
import com.epmet.dto.IssueVoteStatisticalDTO;
import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.dto.form.VoteRedisFormDTO;
import com.epmet.entity.IssueVoteStatisticalEntity;
import com.epmet.feign.ResiGroupFeignClient;
import com.epmet.service.IssueService;
import com.epmet.service.IssueVoteDetailService;
import com.epmet.service.IssueVoteStatisticalService;
import com.epmet.utils.ModuleConstants;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -55,9 +53,6 @@ public class IssueVoteDetailRedis {
@Autowired
private RedisUtils redisUtils;
@Autowired
private IssueVoteStatisticalService issueVoteStatisticalService;
@Autowired
private ResiGroupFeignClient resiGroupFeignClient;
@ -166,7 +161,7 @@ public class IssueVoteDetailRedis {
}
}else{
//如果没有该议题,终止所有操作
logger.warn(String.format("找不到指定Id的议题,Id:【%s】",issueId));
logger.warn(String.format(ModuleConstants.ISSUE_NOT_FOUND_EXCEPTION_TEMPLATE,issueId));
return null;
}
@ -208,7 +203,7 @@ public class IssueVoteDetailRedis {
set(voteCache);
return voteCache;
}else{
logger.warn(String.format("找不到指定Id的议题,Id:【%s】",issueId));
logger.warn(String.format(ModuleConstants.ISSUE_NOT_FOUND_EXCEPTION_TEMPLATE,issueId));
return null;
}
}

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

@ -302,7 +302,7 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt
summaryList.stream().collect(Collectors.groupingBy(IssueAttitudeCountResultDTO::getIssueId));
for (Map.Entry<String, List<IssueAttitudeCountResultDTO>> entry : summaryMap.entrySet()) {
IssueVoteStatisticalDTO obj = new IssueVoteStatisticalDTO();
obj.setCreatedBy("system");
obj.setCreatedBy(ModuleConstants.CREATED_BY_SYSTEM);
obj.setIssueId(entry.getKey());
List<IssueAttitudeCountResultDTO> v = entry.getValue();
if (v.size() > NumConstant.ONE) {
@ -338,7 +338,7 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt
IssueVoteStatisticalDTO dto = new IssueVoteStatisticalDTO();
dto.setOppositionCount(NumConstant.ZERO);
dto.setSupportCount(NumConstant.ZERO);
dto.setCreatedBy("system");
dto.setCreatedBy(ModuleConstants.CREATED_BY_SYSTEM);
return dto;
}).collect(Collectors.toList());
@ -468,10 +468,6 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt
String k = entry.getKey();
List<IssueDTO> v = entry.getValue();
for(IssueDTO issue : v){
//TODO 待删除
Integer a = issueVoteDetailService.getVotingCount(issue.getId(),IssueConstant.SUPPORT);
//TODO 待删除
Integer b = issueVoteDetailService.getVotingCount(issue.getId(),IssueConstant.OPPOSE);
IssueVoteStatisticalDTO vote = new IssueVoteStatisticalDTO();
vote.setIssueId(issue.getId());
@ -479,31 +475,22 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt
if(null == cache)
continue;
if(StringUtils.isBlank(cache.getIssueId())) cache.setIssueId(issue.getId());
vote.setCreatedBy("system");
vote.setUpdatedBy("system");
vote.setCreatedBy(ModuleConstants.CREATED_BY_SYSTEM);
vote.setUpdatedBy(ModuleConstants.CREATED_BY_SYSTEM);
vote.setSupportCount(cache.getSupportAmount());
vote.setOppositionCount(cache.getOppositionAmount());
vote.setVotableCount( null == votableCountMap ?
NumConstant.ZERO :
null == votableCountMap.get(k) ? NumConstant.ZERO : votableCountMap.get(k)
);
//TODO 待删除
vote.setSupportCount(a);
//TODO 待删除
vote.setOppositionCount(b);
list.add(vote);
//TODO 待删除
cache.setOppositionAmount(vote.getOppositionCount());
//TODO 待删除
cache.setSupportAmount(vote.getSupportCount());
//TODO 待恢复
//if(cache.getShouldVoteCount() != vote.getVotableCount()){
if(cache.getShouldVoteCount() != vote.getVotableCount()){
cache.setShouldVoteCount(vote.getVotableCount());
cache.setIssueId(issue.getId());
issueVoteDetailRedis.set(cache);
//TODO 待恢复
//}
}
}
}

5
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/utils/ModuleConstants.java

@ -104,4 +104,9 @@ public interface ModuleConstants {
* */
String ISSUE_NOT_FOUND_EXCEPTION_TEMPLATE = "没有找到指定议题,议题Id:【%s】";
/**
* 定时任务创建的数据 created_by
* */
String CREATED_BY_SYSTEM = "system";
}

7
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java

@ -246,10 +246,13 @@ public class RegisterRelationServiceImpl extends BaseServiceImpl<RegisterRelatio
UserResiInfoFormDTO userResiInfoFormDTO = new UserResiInfoFormDTO();
userResiInfoFormDTO.setUserId(enterGridFormDTO.getUserId());
UserResiInfoResultDTO userResiInfo = userResiInfoDao.selectUserResiInfoNotByCustId(userResiInfoFormDTO);
//如果没有注册居民,昵称、用户头像为空
resultObj.setNickname(ModuleConstant.EMPTY_STR);
resultObj.setUserHeadPhoto(ModuleConstant.EMPTY_STR);
if(null != userResiInfo) {
//已经注册居民
resultObj.setNickname(userResiInfo.getShowName());
}else{
log.warn(String.format("查找用户居民注册信息失败,用户Id:【%s】",enterGridFormDTO.getUserId()));
resultObj.setUserHeadPhoto(userResiInfo.getHeadPhoto());
}
}

Loading…
Cancel
Save