Browse Source

议题表决折线图、提交满意度评价、支持、反对议题,满意度评价初始化,表决中详情——支持反对数量

master
zxc 5 years ago
parent
commit
3b8663a7fc
  1. 26
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/EvaluateInfoDTO.java
  2. 32
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/PolyLineDTO.java
  3. 37
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/EvaluateFormDTO.java
  4. 27
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/InitEvaluationFormDTO.java
  5. 21
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueIdFormDTO.java
  6. 32
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/VoteFormDTO.java
  7. 27
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/InitEvaluationResultDTO.java
  8. 32
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/VoteResultDTO.java
  9. 44
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/VotingTrendResultDTO.java
  10. 24
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueSatisfactionDetailController.java
  11. 13
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueVoteDetailController.java
  12. 27
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueVoteStatisticalController.java
  13. 11
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueSatisfactionDetailDao.java
  14. 10
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteDetailDao.java
  15. 2
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteStatisticalDailyDao.java
  16. 38
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteStatisticalDao.java
  17. 17
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueSatisfactionDetailService.java
  18. 8
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueVoteDetailService.java
  19. 19
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueVoteStatisticalService.java
  20. 47
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueSatisfactionDetailServiceImpl.java
  21. 22
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteDetailServiceImpl.java
  22. 44
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java
  23. 12
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueSatisfactionDetailDao.xml
  24. 11
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteDetailDao.xml
  25. 51
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDao.xml
  26. 26
      epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/EvaluateInfoDTO.java
  27. 22
      epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/PolyLineDTO.java
  28. 37
      epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/form/EvaluateFormDTO.java
  29. 27
      epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/form/InitEvaluationFormDTO.java
  30. 1
      epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/form/IssueIdFormDTO.java
  31. 32
      epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/form/VoteFormDTO.java
  32. 28
      epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/result/InitEvaluationResultDTO.java
  33. 32
      epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/result/VoteResultDTO.java
  34. 6
      epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/result/VotingTrendResultDTO.java
  35. 74
      epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/controller/IssueController.java
  36. 49
      epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/feign/GovIssueFeignClient.java
  37. 31
      epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/feign/fallback/GovIssueFeignClientFallBack.java
  38. 51
      epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/IssueService.java
  39. 107
      epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java

26
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/EvaluateInfoDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* 评价信息
*/
@Data
public class EvaluateInfoDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 评价内容
*/
private String evaluateContent;
/**
* 满意度 - 不满意:bad基本满意:good非常满意:perfect
*/
private String satisfaction;
}

32
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/PolyLineDTO.java

@ -0,0 +1,32 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* 投票折线数据
* @CreateTime 2020/5/11 9:36
*/
@Data
public class PolyLineDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 投票日期
*/
private Long voteDtae;
/**
* 当日赞成票数量
*/
private Integer supportIncrement;
/**
* 当日反对票数量
*/
private Integer oppositionIncrement;
}

37
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/EvaluateFormDTO.java

@ -0,0 +1,37 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* 提交满意度评价
*/
@Data
public class EvaluateFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 议题Id
*/
private String IssueId;
/**
* 满意度 - 不满意:bad基本满意:good非常满意:perfect
*/
private String satisfaction;
/**
* 评价内容
*/
private String comment;
/**
* 用户id
*/
private String userId;
}

27
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/InitEvaluationFormDTO.java

@ -0,0 +1,27 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* 满意度评价初始化
*/
@Data
public class InitEvaluationFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 议题Id
*/
private String IssueId;
/**
* 创建人
*/
private String userId;
}

21
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueIdFormDTO.java

@ -0,0 +1,21 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 议题Id
* @Author zxc
* @Date 2020/5/11 9:30
*/
@Data
public class IssueIdFormDTO implements Serializable {
private static final long serialVersionUID = 4859779755214503489L;
@NotBlank(message = "议题id不能为空")
private String issueId;
}

32
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/VoteFormDTO.java

@ -0,0 +1,32 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* 表决中 支持反对 投票
*/
@Data
public class VoteFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 话题Id
*/
private String IssueId;
/**
* 态度 - opposition反对support赞成
*/
private String attitude;
/**
* 创建人
*/
private String createdBy;
}

27
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/InitEvaluationResultDTO.java

@ -0,0 +1,27 @@
package com.epmet.dto.result;
import com.epmet.dto.EvaluateInfoDTO;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* 满意度评价初始化
*/
@Data
public class InitEvaluationResultDTO implements Serializable {
private static final long serialVersionUID = -1L;
/**
* 评价状态true已评价false未评价
*/
private Boolean status;
/**
* 评价信息
*/
private EvaluateInfoDTO evaluateInfo;
}

32
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/VoteResultDTO.java

@ -0,0 +1,32 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* 表决中议题详情支持反对数
*/
@Data
public class VoteResultDTO implements Serializable {
private static final long serialVersionUID = -1L;
/**
* 表决状态true已表决 false未表决
*/
private Boolean voteFlag;
/**
* 支持数量
*/
private Integer supportCount;
/**
* 反对数量
*/
private Integer oppositionCount;
}

44
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/VotingTrendResultDTO.java

@ -0,0 +1,44 @@
package com.epmet.dto.result;
import com.epmet.dto.PolyLineDTO;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author zxc
* 议题表决折线图
* @CreateTime 2020/5/11 9:36
*/
@Data
public class VotingTrendResultDTO implements Serializable {
private static final long serialVersionUID = -1L;
/**
* 应表决数量
*/
private Integer shouldVoteCount;
/**
* 实际表决数量
*/
private Integer realityVoteCount;
/**
* 截至今日赞成票总数
*/
private Integer supportAmount;
/**
* 截至今日反对票总数
*/
private Integer oppositionAmount;
/**
* 投票折线数据
*/
private List<PolyLineDTO> polyLine;
}

24
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueSatisfactionDetailController.java

@ -26,6 +26,9 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.IssueSatisfactionDetailDTO;
import com.epmet.dto.form.EvaluateFormDTO;
import com.epmet.dto.form.InitEvaluationFormDTO;
import com.epmet.dto.result.InitEvaluationResultDTO;
import com.epmet.excel.IssueSatisfactionDetailExcel;
import com.epmet.service.IssueSatisfactionDetailService;
import org.springframework.beans.factory.annotation.Autowired;
@ -91,4 +94,25 @@ public class IssueSatisfactionDetailController {
ExcelUtils.exportExcelToTarget(response, null, list, IssueSatisfactionDetailExcel.class);
}
/**
* @Description 满意度评价初始化
* @param formDTO
* @author zxc
*/
@PostMapping("initevaluation")
public Result<InitEvaluationResultDTO> initEvaluation(@RequestBody InitEvaluationFormDTO formDTO){
return new Result<InitEvaluationResultDTO>().ok(issueSatisfactionDetailService.initEvaluation(formDTO));
}
/**
* @Description 提交满意度评价
* @param formDTO
* @author zxc
*/
@PostMapping("evaluate")
public Result evaluate(@RequestBody EvaluateFormDTO formDTO){
issueSatisfactionDetailService.evaluate(formDTO);
return new Result();
}
}

13
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueVoteDetailController.java

@ -17,6 +17,7 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
@ -26,6 +27,7 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.IssueVoteDetailDTO;
import com.epmet.dto.form.VoteFormDTO;
import com.epmet.excel.IssueVoteDetailExcel;
import com.epmet.service.IssueVoteDetailService;
import org.springframework.beans.factory.annotation.Autowired;
@ -91,4 +93,15 @@ public class IssueVoteDetailController {
ExcelUtils.exportExcelToTarget(response, null, list, IssueVoteDetailExcel.class);
}
/**
* @Description 表决中 反对支持 投票
* @param formDTO
* @author zxc
*/
@PostMapping("vote")
public Result vote(@RequestBody VoteFormDTO formDTO){
issueVoteDetailService.vote(formDTO);
return new Result();
}
}

27
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueVoteStatisticalController.java

@ -17,7 +17,9 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
@ -26,6 +28,9 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.IssueVoteStatisticalDTO;
import com.epmet.dto.form.IssueIdFormDTO;
import com.epmet.dto.result.VoteResultDTO;
import com.epmet.dto.result.VotingTrendResultDTO;
import com.epmet.excel.IssueVoteStatisticalExcel;
import com.epmet.service.IssueVoteStatisticalService;
import org.springframework.beans.factory.annotation.Autowired;
@ -91,4 +96,26 @@ public class IssueVoteStatisticalController {
ExcelUtils.exportExcelToTarget(response, null, list, IssueVoteStatisticalExcel.class);
}
/**
* @Description 表决中议题详情支持反对数
* @param tokenDto
* @param formDTO
* @author zxc
*/
@PostMapping("votecount")
public Result<VoteResultDTO> voteCount(@LoginUser TokenDto tokenDto, @RequestBody IssueIdFormDTO formDTO){
return new Result<VoteResultDTO>().ok(issueVoteStatisticalService.voteCount(tokenDto,formDTO));
}
/**
* @Description 议题表决折线图
* @param formDTO
* @author zxc
*/
@PostMapping("votingtrend")
public Result<VotingTrendResultDTO> votingTrend(@RequestBody IssueIdFormDTO formDTO){
return new Result<VotingTrendResultDTO>().ok(issueVoteStatisticalService.votingTrend(formDTO));
}
}

11
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueSatisfactionDetailDao.java

@ -18,6 +18,8 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.EvaluateInfoDTO;
import com.epmet.dto.form.InitEvaluationFormDTO;
import com.epmet.entity.IssueSatisfactionDetailEntity;
import org.apache.ibatis.annotations.Mapper;
@ -29,5 +31,12 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface IssueSatisfactionDetailDao extends BaseDao<IssueSatisfactionDetailEntity> {
/**
* @Description 满意度评价初始化
* @param formDTO
* @author zxc
*/
EvaluateInfoDTO checkSatisfaction(InitEvaluationFormDTO formDTO);
}

10
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteDetailDao.java

@ -18,6 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.VoteFormDTO;
import com.epmet.entity.IssueVoteDetailEntity;
import org.apache.ibatis.annotations.Mapper;
@ -29,5 +30,12 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface IssueVoteDetailDao extends BaseDao<IssueVoteDetailEntity> {
/**
* @Description 支持反对校验
* @param formDTO
* @author zxc
*/
Integer checkoutVote(VoteFormDTO formDTO);
}

2
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteStatisticalDailyDao.java

@ -29,5 +29,5 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface IssueVoteStatisticalDailyDao extends BaseDao<IssueVoteStatisticalDailyEntity> {
}

38
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteStatisticalDao.java

@ -18,8 +18,15 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.PolyLineDTO;
import com.epmet.dto.form.IssueIdFormDTO;
import com.epmet.dto.result.VoteResultDTO;
import com.epmet.dto.result.VotingTrendResultDTO;
import com.epmet.entity.IssueVoteStatisticalEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 议题表决统计表
@ -29,5 +36,34 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface IssueVoteStatisticalDao extends BaseDao<IssueVoteStatisticalEntity> {
/**
* @Description 表决中议题详情支持反对数
* @param issueId
* @author zxc
*/
VoteResultDTO voteCount(IssueIdFormDTO issueId);
/**
* @Description 校验是否投票表决中详情支持反对
* @param issueId
* @param userId
* @author zxc
*/
Integer checkVote(@Param("issueId")String issueId,@Param("userId")String userId);
/**
* @Description 议题表决折线图
* @param issueId
* @author zxc
*/
VotingTrendResultDTO votingTrend(IssueIdFormDTO issueId);
/**
* @Description 获取折线每天的支持反对数量
* @param issueId
* @author zxc
*/
List<PolyLineDTO> polyLineData(IssueIdFormDTO issueId);
}

17
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueSatisfactionDetailService.java

@ -20,6 +20,9 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IssueSatisfactionDetailDTO;
import com.epmet.dto.form.EvaluateFormDTO;
import com.epmet.dto.form.InitEvaluationFormDTO;
import com.epmet.dto.result.InitEvaluationResultDTO;
import com.epmet.entity.IssueSatisfactionDetailEntity;
import java.util.List;
@ -92,4 +95,18 @@ public interface IssueSatisfactionDetailService extends BaseService<IssueSatisfa
* @date 2020-05-11
*/
void delete(String[] ids);
/**
* @Description 满意度评价初始化
* @param formDTO
* @author zxc
*/
InitEvaluationResultDTO initEvaluation(InitEvaluationFormDTO formDTO);
/**
* @Description 提交满意度评价
* @param formDTO
* @author zxc
*/
void evaluate(EvaluateFormDTO formDTO);
}

8
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueVoteDetailService.java

@ -20,6 +20,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IssueVoteDetailDTO;
import com.epmet.dto.form.VoteFormDTO;
import com.epmet.entity.IssueVoteDetailEntity;
import java.util.List;
@ -92,4 +93,11 @@ public interface IssueVoteDetailService extends BaseService<IssueVoteDetailEntit
* @date 2020-05-11
*/
void delete(String[] ids);
/**
* @Description 表决中 反对支持 投票
* @param formDTO
* @author zxc
*/
void vote(VoteFormDTO formDTO);
}

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

@ -19,7 +19,11 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.IssueVoteStatisticalDTO;
import com.epmet.dto.form.IssueIdFormDTO;
import com.epmet.dto.result.VoteResultDTO;
import com.epmet.dto.result.VotingTrendResultDTO;
import com.epmet.entity.IssueVoteStatisticalEntity;
import java.util.List;
@ -92,4 +96,19 @@ public interface IssueVoteStatisticalService extends BaseService<IssueVoteStatis
* @date 2020-05-11
*/
void delete(String[] ids);
/**
* @Description 表决中议题详情支持反对数
* @param issueId
* @author zxc
*/
VoteResultDTO voteCount(TokenDto tokenDto,IssueIdFormDTO issueId);
/**
* @Description 议题表决折线图
* @param issueId
* @author zxc
*/
VotingTrendResultDTO votingTrend(IssueIdFormDTO issueId);
}

47
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueSatisfactionDetailServiceImpl.java

@ -20,15 +20,21 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.IssueSatisfactionDetailDao;
import com.epmet.dto.EvaluateInfoDTO;
import com.epmet.dto.IssueSatisfactionDetailDTO;
import com.epmet.dto.form.EvaluateFormDTO;
import com.epmet.dto.form.InitEvaluationFormDTO;
import com.epmet.dto.result.InitEvaluationResultDTO;
import com.epmet.entity.IssueSatisfactionDetailEntity;
import com.epmet.redis.IssueSatisfactionDetailRedis;
import com.epmet.service.IssueSatisfactionDetailService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -101,4 +107,45 @@ public class IssueSatisfactionDetailServiceImpl extends BaseServiceImpl<IssueSat
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @Description 满意度评价初始化
* @param formDTO
* @author zxc
*/
@Override
public InitEvaluationResultDTO initEvaluation(InitEvaluationFormDTO formDTO) {
InitEvaluationResultDTO resultDTO = new InitEvaluationResultDTO();
EvaluateInfoDTO evaluateInfoDTO = baseDao.checkSatisfaction(formDTO);
if (evaluateInfoDTO!=null){
resultDTO.setStatus(true);//已评价
resultDTO.setEvaluateInfo(evaluateInfoDTO);
}else {
resultDTO.setStatus(false);
EvaluateInfoDTO evaluateInfo = new EvaluateInfoDTO();
evaluateInfo.setEvaluateContent("");
evaluateInfo.setSatisfaction("");
resultDTO.setEvaluateInfo(evaluateInfo);
}
return resultDTO;
}
/**
* @Description 提交满意度评价
* @param formDTO
* @author zxc
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void evaluate(EvaluateFormDTO formDTO) {
IssueSatisfactionDetailEntity entity = new IssueSatisfactionDetailEntity();
BeanUtils.copyProperties(formDTO,entity);
InitEvaluationFormDTO initEvaluation = new InitEvaluationFormDTO();
BeanUtils.copyProperties(formDTO,initEvaluation);
EvaluateInfoDTO evaluateInfoDTO = baseDao.checkSatisfaction(initEvaluation);
if (evaluateInfoDTO!=null){
throw new RenException("您已评价!");
}
baseDao.insert(entity);
}
}

22
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteDetailServiceImpl.java

@ -20,15 +20,19 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.IssueVoteDetailDao;
import com.epmet.dto.IssueVoteDetailDTO;
import com.epmet.dto.form.VoteFormDTO;
import com.epmet.entity.IssueVoteDetailEntity;
import com.epmet.redis.IssueVoteDetailRedis;
import com.epmet.service.IssueVoteDetailService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -101,4 +105,22 @@ public class IssueVoteDetailServiceImpl extends BaseServiceImpl<IssueVoteDetailD
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @Description 表决中 反对支持 投票
* @param formDTO
* @author zxc
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void vote(VoteFormDTO formDTO) {
IssueVoteDetailEntity entity = new IssueVoteDetailEntity();
BeanUtils.copyProperties(formDTO,entity);
Integer checkoutVoteCount = baseDao.checkoutVote(formDTO);
if (checkoutVoteCount==0){
baseDao.insert(entity);
}else {
throw new RenException("You've voted, please don't repeat the operation!");
}
}
}

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

@ -21,10 +21,15 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.IssueVoteStatisticalDao;
import com.epmet.dto.IssueVoteStatisticalDTO;
import com.epmet.dto.PolyLineDTO;
import com.epmet.dto.form.IssueIdFormDTO;
import com.epmet.dto.result.VoteResultDTO;
import com.epmet.dto.result.VotingTrendResultDTO;
import com.epmet.entity.IssueVoteStatisticalEntity;
import com.epmet.redis.IssueVoteStatisticalRedis;
import com.epmet.service.IssueVoteStatisticalService;
@ -48,6 +53,8 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt
@Autowired
private IssueVoteStatisticalRedis issueVoteStatisticalRedis;
@Autowired
private IssueVoteStatisticalDao issueVoteStatisticalDao;
@Override
public PageData<IssueVoteStatisticalDTO> page(Map<String, Object> params) {
@ -101,4 +108,41 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @Description 表决中议题详情支持反对数
* @param issueId
* @author zxc
*/
@Override
public VoteResultDTO voteCount(TokenDto tokenDto,IssueIdFormDTO issueId) {
VoteResultDTO voteResultDTO = issueVoteStatisticalDao.voteCount(issueId);
//校验是否已经投票
Integer voteStatus = issueVoteStatisticalDao.checkVote(issueId.getIssueId(), tokenDto.getUserId());
if (voteResultDTO!=null){
if (voteStatus==0){
voteResultDTO.setVoteFlag(false);
}else {
voteResultDTO.setVoteFlag(true);
}
}
return voteResultDTO;
}
/**
* @Description 议题表决折线图
* @param issueId
* @author zxc
*/
@Override
public VotingTrendResultDTO votingTrend(IssueIdFormDTO issueId) {
//应表决数暂时从issue_vote_statistical查询
VotingTrendResultDTO votingTrendResultDTO = issueVoteStatisticalDao.votingTrend(issueId);
if (votingTrendResultDTO!=null){
List<PolyLineDTO> polyLineDTOS = issueVoteStatisticalDao.polyLineData(issueId);
votingTrendResultDTO.setPolyLine(polyLineDTOS);
}
return votingTrendResultDTO;
}
}

12
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueSatisfactionDetailDao.xml

@ -16,5 +16,17 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!-- 满意度评价初始化 -->
<select id="checkSatisfaction" parameterType="com.epmet.dto.form.InitEvaluationFormDTO" resultType="com.epmet.dto.EvaluateInfoDTO">
SELECT
comment AS evaluateContent,
satisfaction AS satisfaction
FROM
issue_satisfaction_detail
WHERE
del_flag = 0
AND issue_id = #{issueId}
AND created_by = #{userId}
</select>
</mapper>

11
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteDetailDao.xml

@ -15,5 +15,16 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!-- 支持、反对校验 -->
<select id="checkoutVote" parameterType="com.epmet.dto.form.VoteFormDTO" resultType="integer">
SELECT
COUNT(*)
FROM
issue_vote_detail
WHERE
del_flag = 0
AND issue_id = #{issueId}
AND created_by = #{createdBy}
</select>
</mapper>

51
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDao.xml

@ -17,5 +17,56 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!-- 表决中议题详情——支持、反对数 -->
<select id="voteCount" parameterType="com.epmet.dto.form.IssueIdFormDTO" resultType="com.epmet.dto.result.VoteResultDTO">
SELECT
support_count AS supportCount,
opposition_count AS oppositionCount
FROM
issue_vote_statistical
WHERE
issue_id = #{issueId}
AND del_flag = 0
</select>
<!-- 校验是否投票(表决中详情——支持、反对) -->
<select id="checkVote" resultType="integer">
SELECT
COUNT(*) AS voteStatus
FROM
issue_vote_detail
WHERE
del_flag = 0
AND issue_id = #{issueId}
AND created_by = #{userId}
</select>
<!-- 议题表决折线图 -->
<select id="votingTrend" resultType="com.epmet.dto.result.VotingTrendResultDTO">
SELECT
votable_count AS shouldVoteCount,
( support_count + opposition_count ) AS realityVoteCount,
support_count AS supportAmount,
opposition_count AS oppositionAmount
FROM
issue_vote_statistical
WHERE
del_flag = 0
AND issue_id = #{issueId}
</select>
<!-- 获取折线每天的支持、反对数量 (按时间正序) -->
<select id="polyLineData" parameterType="com.epmet.dto.form.IssueIdFormDTO" resultType="com.epmet.dto.PolyLineDTO">
SELECT
UNIX_TIMESTAMP(statistical_date) AS voteDtae,
support_increment AS supportIncrement,
opposition_increment AS oppositionIncrement
FROM
issue_vote_statistical_daily
WHERE
issue_id = #{issueId}
AND del_flag = 0
ORDER BY statistical_date ASC
</select>
</mapper>

26
epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/EvaluateInfoDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* 评价信息
*/
@Data
public class EvaluateInfoDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 评价内容
*/
private String evaluateContent;
/**
* 满意度 - 不满意:bad基本满意:good非常满意:perfect
*/
private String satisfaction;
}

22
epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/PolyLineDTO.java

@ -16,28 +16,18 @@ public class PolyLineDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 话题id
* 投票日期
*/
private String topicId;
private Long voteDtae;
/**
* 话题内容
* 当日赞成票数量
*/
private String topicContent;
private Integer supportIncrement;
/**
* 图片列表
* 当日反对票数量
*/
private List<String> topicImgs;
/**
* 话题发表人山东路168-尹女士
*/
private String publishedUser;
/**
* 话题发表时间 (时间戳 毫秒级)
*/
private Long publishedTime;
private Integer oppositionIncrement;
}

37
epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/form/EvaluateFormDTO.java

@ -0,0 +1,37 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* 提交满意度评价
*/
@Data
public class EvaluateFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 议题Id
*/
private String IssueId;
/**
* 满意度 - 不满意:bad基本满意:good非常满意:perfect
*/
private String satisfaction;
/**
* 评价内容
*/
private String comment;
/**
* 用户ID
*/
private String userId;
}

27
epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/form/InitEvaluationFormDTO.java

@ -0,0 +1,27 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* 满意度评价初始化
*/
@Data
public class InitEvaluationFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 议题Id
*/
private String IssueId;
/**
* 创建人
*/
private String userId;
}

1
epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/form/IssueIdFormDTO.java

@ -8,7 +8,6 @@ import java.io.Serializable;
/**
* @Description 议题Id
* @Author zxc
* @Date 2020/5/11 9:30
*/
@Data
public class IssueIdFormDTO implements Serializable {

32
epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/form/VoteFormDTO.java

@ -0,0 +1,32 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* 表决中 支持反对 投票
*/
@Data
public class VoteFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 议题Id
*/
private String IssueId;
/**
* 态度 - opposition反对support赞成
*/
private String attitude;
/**
* 创建人
*/
private String createdBy;
}

28
epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/result/InitEvaluationResultDTO.java

@ -0,0 +1,28 @@
package com.epmet.dto.result;
import com.epmet.dto.EvaluateInfoDTO;
import com.sun.org.apache.xpath.internal.operations.Bool;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* 满意度评价初始化
*/
@Data
public class InitEvaluationResultDTO implements Serializable {
private static final long serialVersionUID = -1L;
/**
* 评价状态true已评价false未评价
*/
private Boolean status;
/**
* 评价信息
*/
private EvaluateInfoDTO evaluateInfo;
}

32
epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/result/VoteResultDTO.java

@ -0,0 +1,32 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* 表决中议题详情支持反对数
*/
@Data
public class VoteResultDTO implements Serializable {
private static final long serialVersionUID = -1L;
/**
* 表决状态true已表决 false未表决
*/
private Boolean voteFlag;
/**
* 支持数量
*/
private Integer supportCount;
/**
* 反对数量
*/
private Integer oppositionCount;
}

6
epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/result/VotingTrendResultDTO.java

@ -1,8 +1,10 @@
package com.epmet.dto.result;
import com.epmet.dto.PolyLineDTO;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author zxc
@ -34,5 +36,9 @@ public class VotingTrendResultDTO implements Serializable {
*/
private Integer oppositionAmount;
/**
* 投票折线数据
*/
private List<PolyLineDTO> polyLine;
}

74
epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/controller/IssueController.java

@ -1,10 +1,17 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.enums.RequirePermissionEnum;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.EvaluateFormDTO;
import com.epmet.dto.form.IssueDetailFormDTO;
import com.epmet.dto.form.IssueIdFormDTO;
import com.epmet.dto.result.InitEvaluationResultDTO;
import com.epmet.dto.result.IssueDetailResultDTO;
import com.epmet.dto.result.VoteResultDTO;
import com.epmet.dto.result.VotingTrendResultDTO;
import com.epmet.service.IssueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
@ -36,10 +43,69 @@ public class IssueController {
return new Result<IssueDetailResultDTO>().ok(issueService.detail(issueDetail));
}
/*@PostMapping(value = "votingtrend")
public Result<> votingTrend(){
return
}*/
/**
* @Description 议题表决折线图
* @param formDTO
* @author zxc
*/
@PostMapping(value = "votingtrend")
public Result<VotingTrendResultDTO> votingTrend(@RequestBody IssueIdFormDTO formDTO){
return new Result<VotingTrendResultDTO>().ok(issueService.votingTrend(formDTO));
}
/**
* @Description 支持议题
* @param formDTO
* @author zxc
*/
@PostMapping(value = "support")
public Result support(@LoginUser TokenDto tokenDto, @RequestBody IssueIdFormDTO formDTO){
issueService.support(tokenDto,formDTO);
return new Result();
}
/**
* @Description 反对议题
* @param formDTO
* @author zxc
*/
@PostMapping(value = "oppose")
public Result oppose(@LoginUser TokenDto tokenDto,@RequestBody IssueIdFormDTO formDTO){
issueService.oppose(tokenDto,formDTO);
return new Result();
}
/**
* @Description 表决中议题详情支持反对数
* @param formDTO
* @author zxc
*/
@PostMapping(value = "vote")
public Result<VoteResultDTO> vote(@RequestBody IssueIdFormDTO formDTO){
return new Result<VoteResultDTO>().ok(issueService.vote(formDTO));
}
/**
* @Description 满意度评价初始化
* @param tokenDto
* @param issueId
* @author zxc
*/
@PostMapping("initevaluation")
public Result<InitEvaluationResultDTO> initEvaluation(@LoginUser TokenDto tokenDto, @RequestBody IssueIdFormDTO issueId){
return new Result<InitEvaluationResultDTO>().ok(issueService.initEvaluation(tokenDto,issueId));
}
/**
* @Description 提交满意度评价
* @param formDTO
* @author zxc
*/
@PostMapping("evaluate")
public Result evaluate(@LoginUser TokenDto tokenDto,@RequestBody EvaluateFormDTO formDTO){
issueService.evaluate(tokenDto,formDTO);
return new Result();
}
}

49
epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/feign/GovIssueFeignClient.java

@ -1,9 +1,14 @@
package com.epmet.feign;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.IssueDetailFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.InitEvaluationResultDTO;
import com.epmet.dto.result.IssueResultDTO;
import com.epmet.dto.result.VoteResultDTO;
import com.epmet.dto.result.VotingTrendResultDTO;
import com.epmet.feign.fallback.GovIssueFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
@ -22,8 +27,48 @@ public interface GovIssueFeignClient {
* @Description 议题详情
* @param issueDetail
* @author zxc
* @date 2020/5/11 16:50
*/
@PostMapping("/gov/issue/issue/issuedetail")
Result<IssueResultDTO> issueDetail(@RequestBody IssueDetailFormDTO issueDetail);
/**
* @Description 表决中议题详情支持反对数
* @param issueId
* @author zxc
*/
@PostMapping("/gov/issue/issuevotestatistical/votecount")
Result<VoteResultDTO> voteCount(@RequestBody IssueIdFormDTO issueId);
/**
* @Description 议题表决折线图
* @param issueId
* @author zxc
*/
@PostMapping("/gov/issue/issuevotestatistical/votingtrend")
Result<VotingTrendResultDTO> votingTrend(@RequestBody IssueIdFormDTO issueId);
/**
* @Description 表决中的 支持反对 投票
* @param issueId
* @author zxc
*/
@PostMapping("/gov/issue/issuevotedetail/vote")
Result vote(@RequestBody VoteFormDTO issueId);
/**
* @Description 满意度评价初始化
* @param formDTO
* @author zxc
*/
@PostMapping("/gov/issue/issuesatisfactiondetail/initevaluation")
Result<InitEvaluationResultDTO> initEvaluation(@RequestBody InitEvaluationFormDTO formDTO);
/**
* @Description 提交满意度评价
* @param formDTO
* @author zxc
*/
@PostMapping("/gov/issue/issuesatisfactiondetail/evaluate")
Result evaluate(@RequestBody EvaluateFormDTO formDTO);
}

31
epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/feign/fallback/GovIssueFeignClientFallBack.java

@ -1,10 +1,14 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.IssueDetailFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.InitEvaluationResultDTO;
import com.epmet.dto.result.IssueResultDTO;
import com.epmet.dto.result.VoteResultDTO;
import com.epmet.dto.result.VotingTrendResultDTO;
import com.epmet.feign.GovIssueFeignClient;
import org.springframework.stereotype.Component;
@ -19,4 +23,29 @@ public class GovIssueFeignClientFallBack implements GovIssueFeignClient {
public Result<IssueResultDTO> issueDetail(IssueDetailFormDTO issueDetail) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "issueDetail", issueDetail);
}
@Override
public Result<VoteResultDTO> voteCount(IssueIdFormDTO issueId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "voteCount", issueId);
}
@Override
public Result<VotingTrendResultDTO> votingTrend(IssueIdFormDTO issueId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "votingTrend", issueId);
}
@Override
public Result vote(VoteFormDTO voteFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "vote", voteFormDTO);
}
@Override
public Result initEvaluation(InitEvaluationFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "initEvaluation", formDTO);
}
@Override
public Result<InitEvaluationResultDTO> evaluate(EvaluateFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "evaluate", formDTO);
}
}

51
epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/IssueService.java

@ -1,7 +1,14 @@
package com.epmet.service;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.form.EvaluateFormDTO;
import com.epmet.dto.form.IssueDetailFormDTO;
import com.epmet.dto.form.IssueIdFormDTO;
import com.epmet.dto.result.InitEvaluationResultDTO;
import com.epmet.dto.result.IssueDetailResultDTO;
import com.epmet.dto.result.VoteResultDTO;
import com.epmet.dto.result.VotingTrendResultDTO;
import org.springframework.web.bind.annotation.RequestBody;
/**
* @Author zxc
@ -17,4 +24,48 @@ public interface IssueService {
*/
IssueDetailResultDTO detail(IssueDetailFormDTO issueDetail);
/**
* @Description 议题表决折线图
* @param issueId
* @author zxc
* @date 2020/5/12 8:48
*/
VotingTrendResultDTO votingTrend(IssueIdFormDTO issueId);
/**
* @Description 支持议题
* @param issueId
* @author zxc
*/
void support(TokenDto tokenDto,IssueIdFormDTO issueId);
/**
* @Description 反对议题
* @param issueId
* @author zxc
*/
void oppose(TokenDto tokenDto,IssueIdFormDTO issueId);
/**
* @Description 表决中议题详情支持反对数
* @param issueId
* @author zxc
*/
VoteResultDTO vote(IssueIdFormDTO issueId);
/**
* @Description 满意度评价初始化
* @param tokenDto
* @param issueId
* @author zxc
*/
InitEvaluationResultDTO initEvaluation(TokenDto tokenDto, IssueIdFormDTO issueId);
/**
* @Description 提交满意度评价
* @param evaluateFormDTO
* @author zxc
*/
void evaluate(TokenDto tokenDto,EvaluateFormDTO evaluateFormDTO);
}

107
epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java

@ -1,20 +1,16 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.TopicInfoDTO;
import com.epmet.dto.form.BelongGridNameFormDTO;
import com.epmet.dto.form.IssueDetailFormDTO;
import com.epmet.dto.form.IssueInitiatorFormDTO;
import com.epmet.dto.form.TopicInfoFormDTO;
import com.epmet.dto.result.BelongGridNameResultDTO;
import com.epmet.dto.result.IssueDetailResultDTO;
import com.epmet.dto.result.IssueInitiatorResultDTO;
import com.epmet.dto.result.IssueResultDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.GovIssueFeignClient;
import com.epmet.feign.GovOrgFeignClient;
import com.epmet.feign.ResiGroupFeignClient;
import com.epmet.service.IssueService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -54,18 +50,101 @@ public class IssueServiceImpl implements IssueService {
//话题发起人
IssueInitiatorFormDTO initiatorFormDTO = new IssueInitiatorFormDTO();
initiatorFormDTO.setUserId(issueResult.getUserId());
Result<IssueInitiatorResultDTO> initiatorResult = userFeignClient.selectIssueInitiator(initiatorFormDTO);
issueDetailResult.setIssueInitiator(initiatorResult.getData().getIssueInitiator());
if (!StringUtils.isBlank(issueResult.getUserId())) {
Result<IssueInitiatorResultDTO> initiatorResult = userFeignClient.selectIssueInitiator(initiatorFormDTO);
issueDetailResult.setIssueInitiator(initiatorResult.getData().getIssueInitiator());
}
//网格名称
BelongGridNameFormDTO belongGridName = new BelongGridNameFormDTO();
belongGridName.setGridId(issueResult.getGridId());
Result<BelongGridNameResultDTO> belongGridNameResult = govOrgFeignClient.getGridNameByGridId(belongGridName);
issueDetailResult.setBelongsGridName(belongGridNameResult.getData().getBelongsGridName());
if (!StringUtils.isBlank(issueResult.getGridId())) {
Result<BelongGridNameResultDTO> belongGridNameResult = govOrgFeignClient.getGridNameByGridId(belongGridName);
issueDetailResult.setBelongsGridName(belongGridNameResult.getData().getBelongsGridName());
}
//话题信息
TopicInfoFormDTO topicInfoFormDTO = new TopicInfoFormDTO();
topicInfoFormDTO.setTopicId(issueResult.getTopicId());
Result<TopicInfoDTO> topicInfoDTOResult = resiGroupFeignClient.selectDetail(topicInfoFormDTO);
issueDetailResult.setTopicInfo(topicInfoDTOResult.getData());
if (!StringUtils.isBlank(issueResult.getTopicId())) {
Result<TopicInfoDTO> topicInfoDTOResult = resiGroupFeignClient.selectDetail(topicInfoFormDTO);
issueDetailResult.setTopicInfo(topicInfoDTOResult.getData());
}
return issueDetailResult;
}
/**
* @Description 议题表决折线图
* @param issueId
* @author zxc
* @date 2020/5/12 8:49
*/
@Override
public VotingTrendResultDTO votingTrend(IssueIdFormDTO issueId) {
Result<VotingTrendResultDTO> votingTrendResultDTOResult = govIssueFeignClient.votingTrend(issueId);
return votingTrendResultDTOResult.getData();
}
/**
* @Description 支持议题
* @param issueId
* @author zxc
*/
@Override
public void support(TokenDto tokenDto,IssueIdFormDTO issueId) {
VoteFormDTO voteFormDTO = new VoteFormDTO();
voteFormDTO.setAttitude("support");
voteFormDTO.setCreatedBy(tokenDto.getUserId());
voteFormDTO.setIssueId(issueId.getIssueId());
govIssueFeignClient.vote(voteFormDTO);
}
/**
* @Description 反对议题
* @param issueId
* @author zxc
*/
@Override
public void oppose(TokenDto tokenDto,IssueIdFormDTO issueId) {
VoteFormDTO voteFormDTO = new VoteFormDTO();
voteFormDTO.setAttitude("opposition");
voteFormDTO.setCreatedBy(tokenDto.getUserId());
voteFormDTO.setIssueId(issueId.getIssueId());
govIssueFeignClient.vote(voteFormDTO);
}
/**
* @Description 表决中议题详情支持反对数
* @param issueId
* @author zxc
*/
@Override
public VoteResultDTO vote(IssueIdFormDTO issueId) {
Result<VoteResultDTO> voteResultDTOResult = govIssueFeignClient.voteCount(issueId);
return voteResultDTOResult.getData();
}
/**
* @Description 满意度评价初始化
* @param tokenDto
* @param issueId
* @author zxc
*/
@Override
public InitEvaluationResultDTO initEvaluation(TokenDto tokenDto, IssueIdFormDTO issueId) {
InitEvaluationFormDTO formDTO = new InitEvaluationFormDTO();
formDTO.setIssueId(issueId.getIssueId());
formDTO.setUserId(tokenDto.getUserId());
Result<InitEvaluationResultDTO> initEvaluationResult = govIssueFeignClient.initEvaluation(formDTO);
return initEvaluationResult.getData();
}
/**
* @Description 提交满意度评价
* @param evaluateFormDTO
* @author zxc
*/
@Override
public void evaluate(TokenDto tokenDto,EvaluateFormDTO evaluateFormDTO) {
evaluateFormDTO.setUserId(tokenDto.getUserId());
govIssueFeignClient.evaluate(evaluateFormDTO);
}
}

Loading…
Cancel
Save