Browse Source

项目评价统计补全

dev_shibei_match
zxc 4 years ago
parent
commit
42d192bdb2
  1. 26
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/CanEvaluateProjectCountBatchResultDTO.java
  2. 20
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueVoteResultDTO.java
  3. 9
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java
  4. 5
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java
  5. 11
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueController.java
  6. 9
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteDetailDao.java
  7. 8
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java
  8. 61
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java
  9. 16
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteDetailDao.xml
  10. 24
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ComplementedProjectEvaluateResultDTO.java
  11. 20
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectEvaluateDetailResultDTO.java
  12. 11
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSatisfactionDetailController.java
  13. 7
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java
  14. 9
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSatisfactionDetailDao.java
  15. 9
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSatisfactionStatisticsDao.java
  16. 8
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSatisfactionStatisticsEntity.java
  17. 7
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSatisfactionDetailService.java
  18. 76
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionDetailServiceImpl.java
  19. 12
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml
  20. 16
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSatisfactionDetailDao.xml
  21. 5
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSatisfactionStatisticsDao.xml
  22. 20
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicCreatedUserBatchResultDTO.java
  23. 9
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java
  24. 5
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java
  25. 16
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/StatsAchievementServiceImpl.java
  26. 12
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java
  27. 8
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java
  28. 22
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java

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

@ -0,0 +1,26 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @Author zxc
* @DateTime 2021/5/12 11:16 上午
* @DESC
*/
@Data
public class CanEvaluateProjectCountBatchResultDTO implements Serializable {
private static final long serialVersionUID = -3577868520393911786L;
private String issueId;
private List<String> userIds = new ArrayList<>();
@JsonIgnore
private String userId;
}

20
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueVoteResultDTO.java

@ -0,0 +1,20 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/5/12 1:44 下午
* @DESC
*/
@Data
public class IssueVoteResultDTO implements Serializable {
private static final long serialVersionUID = -616467646035136184L;
private String issueId;
private String userId;
}

9
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java

@ -318,4 +318,13 @@ public interface GovIssueOpenFeignClient {
*/
@PostMapping("/gov/issue/issue/canevaluateprojectcount")
Result<List<String>> canEvaluateProjectCount(@RequestParam("issueId")String issueId);
/**
* @Description 查询可评价项目人数 批量
* @Param issueIds
* @author zxc
* @date 2021/5/12 9:31 上午
*/
@PostMapping("/gov/issue/issue/canevaluateprojectcountbatch")
Result<List<CanEvaluateProjectCountBatchResultDTO>> canEvaluateProjectCountBatch(@RequestParam("issueIds")List<String> issueIds);
}

5
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java

@ -266,4 +266,9 @@ public class GovIssueOpenFeignClientFallBack implements GovIssueOpenFeignClient
public Result<List<String>> canEvaluateProjectCount(String issueId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "canEvaluateProjectCount", issueId);
}
@Override
public Result<List<CanEvaluateProjectCountBatchResultDTO>> canEvaluateProjectCountBatch(List<String> issueIds) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "canEvaluateProjectCountBatch", issueIds);
}
}

11
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueController.java

@ -267,5 +267,16 @@ public class IssueController {
return new Result<List<String>>().ok(issueService.canEvaluateProjectCount(issueId));
}
/**
* @Description 查询可评价项目人数批量
* @Param issueId
* @author zxc
* @date 2021/5/11 4:50 下午
*/
@PostMapping("canevaluateprojectcountbatch")
public Result<List<CanEvaluateProjectCountBatchResultDTO>> canEvaluateProjectCountBatch(@RequestParam("issueIds")List<String> issueIds){
return new Result<List<CanEvaluateProjectCountBatchResultDTO>>().ok(issueService.canEvaluateProjectCountBatch(issueIds));
}
}

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

@ -22,6 +22,7 @@ import com.epmet.dto.IssueVoteDetailDTO;
import com.epmet.dto.form.VoteFormDTO;
import com.epmet.dto.form.VoteRedisFormDTO;
import com.epmet.dto.result.IssueAttitudeCountResultDTO;
import com.epmet.dto.result.IssueVoteResultDTO;
import com.epmet.dto.result.MyPartIssuesResultDTO;
import com.epmet.entity.IssueVoteDetailEntity;
import org.apache.ibatis.annotations.Mapper;
@ -121,4 +122,12 @@ public interface IssueVoteDetailDao extends BaseDao<IssueVoteDetailEntity> {
* @date 2021/5/11 5:15 下午
*/
List<String> selectIssueVoteCount(@Param("issueId")String issueId);
/**
* @Description 查询议题表决数批量
* @Param issueIds
* @author zxc
* @date 2021/5/12 1:48 下午
*/
List<IssueVoteResultDTO> selectIssueVoteCountBatch(@Param("issueIds")List<String> issueIds);
}

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

@ -333,4 +333,12 @@ public interface IssueService extends BaseService<IssueEntity> {
* @date 2021/5/11 4:50 下午
*/
List<String> canEvaluateProjectCount(String issueId);
/**
* @Description 查询可评价项目人数批量
* @Param issueId
* @author zxc
* @date 2021/5/11 4:50 下午
*/
List<CanEvaluateProjectCountBatchResultDTO> canEvaluateProjectCountBatch(List<String> issueIds);
}

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

@ -50,6 +50,7 @@ import com.epmet.resi.group.dto.topic.ResiTopicDTO;
import com.epmet.resi.group.dto.topic.form.GovTopicIssueInfoFormDTO;
import com.epmet.resi.group.dto.topic.form.*;
import com.epmet.resi.group.dto.topic.result.GovTopicIssueInfoResultDTO;
import com.epmet.resi.group.dto.topic.result.TopicCreatedUserBatchResultDTO;
import com.epmet.resi.group.feign.ResiGroupOpenFeignClient;
import com.epmet.send.SendMqMsgUtil;
import com.epmet.service.*;
@ -1440,4 +1441,64 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp
return userIds.stream().distinct().collect(Collectors.toList());
}
/**
* @Description 查询可评价项目人数批量
* @Param issueId
* @author zxc
* @date 2021/5/11 4:50 下午
*/
@Override
public List<CanEvaluateProjectCountBatchResultDTO> canEvaluateProjectCountBatch(List<String> issueIds) {
// 根据议题查询
List<IssueEntity> issueEntities = baseDao.selectBatchIds(issueIds);
if (CollectionUtils.isEmpty(issueEntities)){
throw new RenException("议题信息不存在");
}
List<CanEvaluateProjectCountBatchResultDTO> result = new ArrayList<>();
issueEntities.forEach(i -> {
CanEvaluateProjectCountBatchResultDTO r = new CanEvaluateProjectCountBatchResultDTO();
r.setIssueId(i.getId());
r.setUserId(i.getCreatedBy());
result.add(r);
});
// 所有议题表决
List<IssueVoteResultDTO> issueVoteResult = issueVoteDetailDao.selectIssueVoteCountBatch(issueIds);
Map<String, List<IssueVoteResultDTO>> groupByIssue = new HashMap<>(16);
if (!CollectionUtils.isEmpty(issueVoteResult)){
// 根据议题分组
groupByIssue = issueVoteResult.stream().collect(Collectors.groupingBy(IssueVoteResultDTO::getIssueId));
}
Map<String, List<IssueVoteResultDTO>> finalGroupByIssue = groupByIssue;
boolean empty = finalGroupByIssue.isEmpty();
Result<List<TopicCreatedUserBatchResultDTO>> topicCreatedUserBatch = resiGroupOpenFeignClient.topicCreatedUserBatch(issueEntities.stream().map(m -> m.getSourceId()).collect(Collectors.toList()));
if (!topicCreatedUserBatch.success()){
throw new RenException("【查询话题创建者失败】["+topicCreatedUserBatch.getMsg()+"]");
}
List<TopicCreatedUserBatchResultDTO> topicCreatedUserBatchData = topicCreatedUserBatch.getData();
result.forEach(r -> {
List<String> userIds = new ArrayList<>();
// 议题创建者
userIds.add(r.getUserId());
if (!empty){
// 实际表决人数
finalGroupByIssue.forEach((issueId, list) -> {
if (r.getIssueId().equals(issueId)){
List<String> votePeople = list.stream().map(m -> m.getUserId()).collect(Collectors.toList());
userIds.addAll(votePeople);
}
});
}
// 话题创建者
if (!CollectionUtils.isEmpty(topicCreatedUserBatchData)){
topicCreatedUserBatchData.forEach(t -> {
if (r.getIssueId().equals(t.getIssueId())){
userIds.add(t.getUserId());
}
});
}
r.setUserIds(userIds.stream().distinct().collect(Collectors.toList()));
});
return result;
}
}

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

@ -165,4 +165,20 @@
DEL_FLAG = '0'
AND ISSUE_ID = #{issueId}
</select>
<!-- 查询议题表决数【批量】 -->
<select id="selectIssueVoteCountBatch" resultType="com.epmet.dto.result.IssueVoteResultDTO">
SELECT
CREATED_BY AS userId,
ISSUE_ID
FROM
issue_vote_detail
WHERE
DEL_FLAG = '0'
AND (
<foreach collection="issueIds" item="issueId" separator=" OR ">
ISSUE_ID = #{issueId}
</foreach>
)
</select>
</mapper>

24
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ComplementedProjectEvaluateResultDTO.java

@ -0,0 +1,24 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/5/12 10:24 上午
* @DESC
*/
@Data
public class ComplementedProjectEvaluateResultDTO implements Serializable {
private static final long serialVersionUID = -300492311961684245L;
private String projectId;
private String issueId;
private String customerId;
private Boolean disposeStatus = false;
}

20
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectEvaluateDetailResultDTO.java

@ -0,0 +1,20 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/5/12 4:34 下午
* @DESC
*/
@Data
public class ProjectEvaluateDetailResultDTO implements Serializable {
private static final long serialVersionUID = -6651646333040235330L;
private String projectId;
private String satisfaction;
}

11
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSatisfactionDetailController.java

@ -127,4 +127,15 @@ public class ProjectSatisfactionDetailController {
return new Result<List<ProjectEvaluationListResultDTO>>().ok(projectSatisfactionDetailService.projectEvaluationList(formDTO));
}
/**
* @Description 补全项目评价统计
* @author zxc
* @date 2021/5/12 10:04 上午
*/
@PostMapping("complementedprojectevaluate")
public Result complementedProjectEvaluate(){
projectSatisfactionDetailService.complementedProjectEvaluate();
return new Result();
}
}

7
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java

@ -147,4 +147,11 @@ public interface ProjectDao extends BaseDao<ProjectEntity> {
@Param("customerId") String customerId);
ProjectInfoDTO queryProjectInfoByProjectId(String projectId);
/**
* @Description 查询所以已关闭的项目项目来源为 'issue'
* @author zxc
* @date 2021/5/12 10:29 上午
*/
List<ComplementedProjectEvaluateResultDTO> selectAllClosedProject();
}

9
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSatisfactionDetailDao.java

@ -20,6 +20,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.ProjectEvaluationListFormDTO;
import com.epmet.dto.form.ProjectInitEvaluationFormDTO;
import com.epmet.dto.result.ProjectEvaluateDetailResultDTO;
import com.epmet.dto.result.ProjectEvaluateInfoResultDTO;
import com.epmet.dto.result.EvaluationListResultDTO;
import com.epmet.dto.result.ProjectEvaluationListResultDTO;
@ -60,4 +61,12 @@ public interface ProjectSatisfactionDetailDao extends BaseDao<ProjectSatisfactio
*/
List<ProjectEvaluationListResultDTO> projectEvaluationList(ProjectEvaluationListFormDTO formDTO);
/**
* @Description 查询项目的评价人
* @Param projectIds
* @author zxc
* @date 2021/5/12 4:42 下午
*/
List<ProjectEvaluateDetailResultDTO> selectProjectEvaluateDetail(@Param("projectIds")List<String> projectIds);
}

9
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSatisfactionStatisticsDao.java

@ -22,6 +22,8 @@ import com.epmet.entity.ProjectSatisfactionStatisticsEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 项目满意度调查统计表
*
@ -48,4 +50,11 @@ public interface ProjectSatisfactionStatisticsDao extends BaseDao<ProjectSatisfa
*/
void updateEvaluateData(@Param("projectId")String projectId,@Param("evalType")String evalType,@Param("shouldEvaluateCount")Integer shouldEvaluateCount);
/**
* @Description 查询已经存在的记录
* @author zxc
* @date 2021/5/12 10:35 上午
*/
List<String> selectExistsProject();
}

8
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSatisfactionStatisticsEntity.java

@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -70,4 +71,11 @@ public class ProjectSatisfactionStatisticsEntity extends BaseEpmetEntity {
* 应评价人数等于实际表决人数
*/
private Integer shouldEvaluateCount;
public ProjectSatisfactionStatisticsEntity() {
this.goodCount = NumConstant.ZERO;
this.perfectCount = NumConstant.ZERO;
this.badCount = NumConstant.ZERO;
this.shouldEvaluateCount = NumConstant.ZERO;
}
}

7
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSatisfactionDetailService.java

@ -129,4 +129,11 @@ public interface ProjectSatisfactionDetailService extends BaseService<ProjectSat
* @author zxc
*/
List<ProjectEvaluationListResultDTO> projectEvaluationList(@RequestBody ProjectEvaluationListFormDTO formDTO);
/**
* @Description 补全项目评价统计
* @author zxc
* @date 2021/5/12 10:04 上午
*/
void complementedProjectEvaluate();
}

76
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionDetailServiceImpl.java

@ -47,6 +47,7 @@ import com.epmet.feign.GovIssueOpenFeignClient;
import com.epmet.redis.ProjectRedis;
import com.epmet.redis.ProjectSatisfactionDetailRedis;
import com.epmet.service.ProjectSatisfactionDetailService;
import com.epmet.service.ProjectSatisfactionStatisticsService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.redisson.api.RLock;
@ -55,6 +56,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.stream.Collectors;
@ -87,6 +89,8 @@ public class ProjectSatisfactionDetailServiceImpl extends BaseServiceImpl<Projec
private ProjectRedis projectRedis;
@Autowired
private GovIssueOpenFeignClient govIssueOpenFeignClient;
@Autowired
private ProjectSatisfactionStatisticsService projectSatisfactionStatisticsService;
@Override
public PageData<ProjectSatisfactionDetailDTO> page(Map<String, Object> params) {
@ -243,7 +247,6 @@ public class ProjectSatisfactionDetailServiceImpl extends BaseServiceImpl<Projec
if (null == projectEntity){
throw new RenException("未查询到项目信息");
}
VoteRedisFormDTO issueVoteDetail = projectRedis.getIssueVoteDetail(projectEntity.getOriginId());
// 应评价数 = 话题创建者 + 议题发起者 + 议题表决人 【去重】
// 议题发起者 和 议题表决人 和 话题创建者 查询
Result<List<String>> canEvaluateProjectCount = govIssueOpenFeignClient.canEvaluateProjectCount(projectEntity.getOriginId());
@ -300,4 +303,75 @@ public class ProjectSatisfactionDetailServiceImpl extends BaseServiceImpl<Projec
return baseDao.projectEvaluationList(formDTO);
}
/**
* @Description 补全项目评价统计
* @author zxc
* @date 2021/5/12 10:04 上午
*/
@Override
public void complementedProjectEvaluate() {
// 查询所有已关闭的项目【醒目来源为'issue'】
List<ComplementedProjectEvaluateResultDTO> allProjects = projectDao.selectAllClosedProject();
if (CollectionUtils.isEmpty(allProjects)){
log.warn("不存在可补全的数据");
return;
}
// 查询已存在的项目记录
List<String> existsProjects = statisticsDao.selectExistsProject();
List<ComplementedProjectEvaluateResultDTO> projects = new ArrayList<>();
if (CollectionUtils.isEmpty(existsProjects)){
projects = allProjects;
}else {
allProjects.forEach(a -> {
existsProjects.forEach(p -> {
if (a.getProjectId().equals(p)){
a.setDisposeStatus(true);
}
});
});
Map<Boolean, List<ComplementedProjectEvaluateResultDTO>> groupByStatus = allProjects.stream().collect(Collectors.groupingBy(ComplementedProjectEvaluateResultDTO::getDisposeStatus));
// 去除存在记录的项目
projects = groupByStatus.get(false);
}
List<ProjectSatisfactionStatisticsEntity> needAdd = new ArrayList<>();
if (!CollectionUtils.isEmpty(projects)){
List<String> projectIds = projects.stream().map(m -> m.getIssueId()).collect(Collectors.toList());
List<ProjectEvaluateDetailResultDTO> projectEvaluateDetailResult = baseDao.selectProjectEvaluateDetail(projectIds);
Map<String, List<ProjectEvaluateDetailResultDTO>> groupByProject = projectEvaluateDetailResult.stream().collect(Collectors.groupingBy(ProjectEvaluateDetailResultDTO::getProjectId));
boolean empty = groupByProject.isEmpty();
// 项目应评价人数 = 话题创建者 + 议题发起者 + 议题表决人 【去重】
Result<List<CanEvaluateProjectCountBatchResultDTO>> canEvaluateProjectCountBatch = govIssueOpenFeignClient.canEvaluateProjectCountBatch(projectIds);
if (!canEvaluateProjectCountBatch.success()){
throw new RenException("【查询项目应评价人数失败】,【"+canEvaluateProjectCountBatch.getMsg()+"】");
}
projects.forEach(p -> {
ProjectSatisfactionStatisticsEntity e = new ProjectSatisfactionStatisticsEntity();
e.setCustomerId(p.getCustomerId());
e.setProjectId(p.getProjectId());
if (!empty){
groupByProject.forEach((projectId,list) -> {
if (p.getProjectId().equals(projectId)){
Map<String, List<ProjectEvaluateDetailResultDTO>> groupByS = list.stream().collect(Collectors.groupingBy(ProjectEvaluateDetailResultDTO::getSatisfaction));
e.setBadCount(groupByS.get(ProjectConstant.EVALUATE_BAD).size());
e.setGoodCount(groupByS.get(ProjectConstant.EVALUATE_GOOD).size());
e.setPerfectCount(groupByS.get(ProjectConstant.EVALUATE_PERFECT).size());
}
});
}
if (!CollectionUtils.isEmpty(canEvaluateProjectCountBatch.getData())){
canEvaluateProjectCountBatch.getData().forEach(ep -> {
if (p.getIssueId().equals(ep.getIssueId())){
e.setShouldEvaluateCount(ep.getUserIds().size());
}
});
}
needAdd.add(e);
});
}
if (!CollectionUtils.isEmpty(needAdd)){
projectSatisfactionStatisticsService.insertBatch(needAdd);
}
}
}

12
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml

@ -269,4 +269,16 @@
where P.DEL_FLAG='0'
AND p.id=#{projectId}
</select>
<!-- 查询所以已关闭的项目【项目来源为 'issue'】 -->
<select id="selectAllClosedProject" resultType="com.epmet.dto.result.ComplementedProjectEvaluateResultDTO">
SELECT
ID AS projectId,
ORIGIN_ID AS issueId,
CUSTOMER_ID
FROM project
WHERE DEL_FLAG = '0'
AND ORIGIN = 'issue'
AND `STATUS` = 'closed'
</select>
</mapper>

16
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSatisfactionDetailDao.xml

@ -59,4 +59,20 @@
LIMIT #{pageNo},#{pageSize}
</select>
<!-- 查询项目的评价人 -->
<select id="selectProjectEvaluateDetail" resultType="com.epmet.dto.result.ProjectEvaluateDetailResultDTO">
SELECT
SATISFACTION AS satisfaction,
PROJECT_ID
FROM
project_satisfaction_detail
WHERE
DEL_FLAG = '0'
AND (
<foreach collection="projectIds" item="projectId" separator=" OR ">
PROJECT_ID = #{projectId}
</foreach>
)
</select>
</mapper>

5
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSatisfactionStatisticsDao.xml

@ -33,5 +33,10 @@
AND PROJECT_ID = #{projectId}
</select>
<!-- 查询已经存在的记录 -->
<select id="selectExistsProject" resultType="java.lang.String">
SELECT PROJECT_ID FROM project_satisfaction_statistics WHERE DEL_FLAG = '0'
</select>
</mapper>

20
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicCreatedUserBatchResultDTO.java

@ -0,0 +1,20 @@
package com.epmet.resi.group.dto.topic.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/5/12 2:25 下午
* @DESC
*/
@Data
public class TopicCreatedUserBatchResultDTO implements Serializable {
private static final long serialVersionUID = 3742119092028478772L;
private String issueId;
private String userId;
}

9
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java

@ -259,4 +259,13 @@ public interface ResiGroupOpenFeignClient {
*/
@PostMapping("/resi/group/topic/topiccreateduser")
Result<String> topicCreatedUser(@RequestParam("topicId")String topicId);
/**
* @Description 查询话题的创建者批量
* @Param topicId
* @author zxc
* @date 2021/5/12 9:16 上午
*/
@PostMapping("/resi/group/topic/topiccreateduserbatch")
Result<List<TopicCreatedUserBatchResultDTO>> topicCreatedUserBatch(@RequestParam("topicIds")List<String> topicIds);
}

5
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java

@ -203,4 +203,9 @@ public class ResiGroupOpenFeignClientFallback implements ResiGroupOpenFeignClien
public Result<String> topicCreatedUser(String topicId) {
return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "topicCreatedUser", topicId);
}
@Override
public Result<List<TopicCreatedUserBatchResultDTO>> topicCreatedUserBatch(List<String> topicIds) {
return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "topicCreatedUserBatch", topicIds);
}
}

16
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/StatsAchievementServiceImpl.java

@ -5,10 +5,10 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerDTO;
//import com.epmet.dto.CustomerDTO;
import com.epmet.dto.IssueDTO;
import com.epmet.feign.GovIssueOpenFeignClient;
import com.epmet.feign.OperCrmOpenFeignClient;
//import com.epmet.feign.OperCrmOpenFeignClient;
import com.epmet.commons.tools.enums.AchievementTypeEnum;
import com.epmet.modules.group.dao.ResiGroupDao;
import com.epmet.modules.group.entity.ResiGroupAchievementConfigEntity;
@ -50,8 +50,8 @@ public class StatsAchievementServiceImpl extends AbstractStatsAchievementService
private ResiTopicDao resiTopicDao;
@Autowired
private ResiGroupDao resiGroupDao;
@Autowired
private OperCrmOpenFeignClient operCrmOpenFeignClient;
// @Autowired
// private OperCrmOpenFeignClient operCrmOpenFeignClient;
@Autowired
private GovIssueOpenFeignClient govIssueOpenFeignClient;
@ -387,10 +387,10 @@ public class StatsAchievementServiceImpl extends AbstractStatsAchievementService
private List<String> getCustomerIds(String customerId) {
List<String> customerIdList = new ArrayList<>();
if (StringUtils.isBlank(customerId)) {
Result<List<CustomerDTO>> allCustomerList = operCrmOpenFeignClient.getAllCustomerList();
if (allCustomerList != null && !CollectionUtils.isEmpty(allCustomerList.getData())) {
customerIdList.addAll(allCustomerList.getData().stream().map(CustomerDTO::getId).collect(Collectors.toList()));
}
// Result<List<CustomerDTO>> allCustomerList = operCrmOpenFeignClient.getAllCustomerList();
// if (allCustomerList != null && !CollectionUtils.isEmpty(allCustomerList.getData())) {
// customerIdList.addAll(allCustomerList.getData().stream().map(CustomerDTO::getId).collect(Collectors.toList()));
// }
} else {
customerIdList.add(customerId);
}

12
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java

@ -496,4 +496,16 @@ public class ResiTopicController {
public Result<String> topicCreatedUser(@RequestParam("topicId")String topicId){
return new Result<String>().ok(topicService.topicCreatedUser(topicId));
}
/**
* @Description 查询话题的创建者
* @Param topicId
* @author zxc
* @date 2021/5/12 9:16 上午
*/
@PostMapping("topiccreateduserbatch")
public Result<List<TopicCreatedUserBatchResultDTO>> topicCreatedUserBatch(@RequestParam("topicIds")List<String> topicIds){
return new Result<List<TopicCreatedUserBatchResultDTO>>().ok(topicService.topicCreatedUserBatch(topicIds));
}
}

8
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java

@ -397,4 +397,12 @@ public interface ResiTopicService extends BaseService<ResiTopicEntity> {
* @date 2021/5/12 9:16 上午
*/
String topicCreatedUser(String topicId);
/**
* @Description 查询话题的创建者批量
* @Param topicId
* @author zxc
* @date 2021/5/12 9:16 上午
*/
List<TopicCreatedUserBatchResultDTO> topicCreatedUserBatch(List<String> topicIds);
}

22
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java

@ -2761,6 +2761,28 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
return resiTopicEntity.getCreatedBy();
}
/**
* @Description 查询话题的创建者批量
* @Param topicId
* @author zxc
* @date 2021/5/12 9:16 上午
*/
@Override
public List<TopicCreatedUserBatchResultDTO> topicCreatedUserBatch(List<String> topicIds) {
if (CollectionUtils.isEmpty(topicIds)){
return new ArrayList<>();
}
List<ResiTopicEntity> resiTopicEntities = baseDao.selectBatchIds(topicIds);
List<TopicCreatedUserBatchResultDTO> result = new ArrayList<>();
resiTopicEntities.forEach(r -> {
TopicCreatedUserBatchResultDTO t = new TopicCreatedUserBatchResultDTO();
t.setIssueId(r.getIssueId());
t.setUserId(r.getCreatedBy());
result.add(t);
});
return result;
}
}

Loading…
Cancel
Save