Browse Source

Merge remote-tracking branch 'origin/develop' into develop

master
jianjun 4 years ago
parent
commit
6ddd23305c
  1. 4
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java
  2. 5
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java
  3. 19
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/CalPartyUnitSatisfactionFormDTO.java
  4. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionDataResultDTO.java
  5. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java
  6. 2
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueProjectCategoryDictDTO.java
  7. 3
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/form/ProjectAnalysisFormDTO.java
  8. 2
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/result/ProjectCategoryTotalResultDTO.java
  9. 2
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/result/ProjectStatusListResultDTO.java
  10. 3
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovProjectController.java
  11. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/UserBaseInfoDao.java
  12. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java
  13. 4
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  14. 10
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java
  15. 1
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml
  16. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml
  17. 41
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/heart/VolunteerDemandServiceStatsResultDTO.java
  18. 38
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/heart/DataReportHeartDemandController.java
  19. 43
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactVolunteerServiceDailyDao.java
  20. 83
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/heart/FactVolunteerServiceDailyEntity.java
  21. 13
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/heart/DemandService.java
  22. 29
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/heart/impl/DemandServiceImpl.java
  23. 36
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactVolunteerServiceDailyDao.xml
  24. 19
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/heart/result/DemandServiceCountResultDTO.java
  25. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/IssueProjectCategoryDictDTO.java
  26. 12
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
  27. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
  28. 38
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemandController.java
  29. 44
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/IcUserDemandServiceDao.java
  30. 33
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/VolunteerInfoDao.java
  31. 42
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactVolunteerServiceDailyDao.java
  32. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java
  33. 75
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/heart/IcUserDemandServiceEntity.java
  34. 71
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/heart/VolunteerInfoEntity.java
  35. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/issue/IssueProjectCategoryDictEntity.java
  36. 86
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactVolunteerServiceDailyEntity.java
  37. 20
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/DemandService.java
  38. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/HeartDemandService.java
  39. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/HeartVolunteerService.java
  40. 40
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/HeartDemandServiceImpl.java
  41. 38
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/HeartVolunteerServiceImpl.java
  42. 176
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DemandServiceImpl.java
  43. 18
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DemandStatsService.java
  44. 36
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DemandStatsServiceImpl.java
  45. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java
  46. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java
  47. 21
      epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.26__create_volunteer_service_daily.sql
  48. 34
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/IcUserDemandServiceDao.xml
  49. 23
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/VolunteerInfoDao.xml
  50. 37
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactVolunteerServiceDailyDao.xml
  51. 13
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml
  52. 41
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/CategoryAnalysisFormDTO.java
  53. 14
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/DemandResearchAnalysisFormDTO.java
  54. 6
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/IcResiUserDemandFromDTO.java
  55. 10
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/PageListAnalysisFormDTO.java
  56. 26
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/VolunteerCommonFormDTO.java
  57. 19
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryAnalysisDTO.java
  58. 32
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryAnalysisDetail.java
  59. 17
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryAnalysisResDTO.java
  60. 11
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryDetailDTO.java
  61. 13
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandDataDTO.java
  62. 7
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandRecResultDTO.java
  63. 13
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandResearchAnalysisResultDTO.java
  64. 15
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/FinishResultDTO.java
  65. 22
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/HouseMemResDTO.java
  66. 2
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/IcResiUserReportDemandRes.java
  67. 26
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/LegendDTO.java
  68. 23
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/ServiceStatDTO.java
  69. 14
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/PageVolunteerInfoResultDTO.java
  70. 10
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java
  71. 7
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java
  72. 22
      epmet-module/epmet-heart/epmet-heart-server/pom.xml
  73. 8
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/UserDemandConstant.java
  74. 15
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java
  75. 36
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java
  76. 19
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java
  77. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPartyUnitDao.java
  78. 21
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java
  79. 31
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java
  80. 104
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/mq/listener/PartyUnitSatisfactionCalEventListener.java
  81. 7
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java
  82. 21
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java
  83. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java
  84. 35
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java
  85. 36
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java
  86. 8
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java
  87. 264
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java
  88. 20
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
  89. 5
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml
  90. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/logback-spring.xml
  91. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyUnitDao.xml
  92. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml
  93. 162
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml
  94. 23
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsDemandTask.java
  95. 4
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java
  96. 3
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java
  97. 5
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectCategoryDictDTO.java
  98. 4
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/CategoryListResultDTO.java
  99. 4
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueResultDTO.java
  100. 13
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzDTO.java

4
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java

@ -70,4 +70,8 @@ public interface ConsomerGroupConstants {
*/
String IC_WARN_STATS_EVENT_LISTENER_GROUP = "ic_warn_stats_event_listener_group";
/**
* 需求完成如果服务方是区域化党建单位重新计算这个单位的满意度
*/
String CAL_PARTY_UNIT_SATISFACTION = "cal_party_unit_satisfaction";
}

5
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java

@ -53,4 +53,9 @@ public interface TopicConstants {
* 项目
*/
String IC_RESI_USER = "ic_resi_user";
/**
* 需求完成如果服务方是区域化党建单位重新计算这个单位的满意度
*/
String CAL_PARTY_UNIT_SATISFACTION = "cal_party_unit_satisfaction";
}

19
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/CalPartyUnitSatisfactionFormDTO.java

@ -0,0 +1,19 @@
package com.epmet.commons.rocketmq.messages;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 需求完成如果服务方是区域化党建单位重新计算这个单位的满意度,或者直接计算整个客户
*/
@Data
public class CalPartyUnitSatisfactionFormDTO implements Serializable {
public interface AddUserInternalGroup {
}
@NotBlank(message = "客户id不能为空",groups = AddUserInternalGroup.class)
private String customerId;
private String partyUnitId;
}

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionDataResultDTO.java

@ -15,4 +15,5 @@ public class OptionDataResultDTO implements Serializable {
private String label;
private String value;
private String code;
private String radio;
}

3
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java

@ -18,7 +18,8 @@ public enum DictTypeEnum {
GENDER("gender", "性别", 8),
USER_DEMAND_STATUS("user_demand_status", "居民需求状态",8),
USER_DEMAND_REPORT_TYPE("user_demand_report_type","居民需求上报类型",9),
USER_DEMAND_SERVICE_TYPE("user_demand_service_type","居民需求服务方类型",10)
USER_DEMAND_SERVICE_TYPE("user_demand_service_type","居民需求服务方类型",10),
AGE_GROUP("age_group", "年龄范围", 11),
;
private final String code;

2
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/IssueProjectCategoryDictDTO.java

@ -87,7 +87,7 @@ public class IssueProjectCategoryDictDTO implements Serializable {
/**
* 颜色
*/
private String colour;
private String color;
}

3
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/form/ProjectAnalysisFormDTO.java

@ -24,6 +24,9 @@ public class ProjectAnalysisFormDTO implements Serializable {
//一级分类Id集合
@NotNull(message = "分类Code集合不能为空", groups = {Analysis.class})
private List<String> categoryCodeList;
//当前查看的项目Id
@NotBlank(message = "当前查看项目Id不能为空", groups = {Analysis.class})
private String projectId;
private String customerId;

2
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/result/ProjectCategoryTotalResultDTO.java

@ -19,7 +19,7 @@ public class ProjectCategoryTotalResultDTO implements Serializable {
//一级分类名称
private String categoryName;
//一级分类颜色
private String colour = "";
private String color = "";
//分类下项目总数
private Integer total = 0;

2
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/result/ProjectStatusListResultDTO.java

@ -23,7 +23,7 @@ public class ProjectStatusListResultDTO implements Serializable {
//经度
private String longitude;
//纬度
private String dimension;
private String latitude;
//项目标题
private String title;

3
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovProjectController.java

@ -113,8 +113,9 @@ public class GovProjectController {
* @author sun
*/
@PostMapping("projectanalysis")
public Result<ProjectAnalysisResultDTO> projectAnalysis(@RequestBody ProjectAnalysisFormDTO formDTO) {
public Result<ProjectAnalysisResultDTO> projectAnalysis(@LoginUser TokenDto tokenDto, @RequestBody ProjectAnalysisFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ProjectAnalysisFormDTO.Analysis.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<ProjectAnalysisResultDTO>().ok(govProjectService.projectAnalysis(formDTO));
}

2
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/UserBaseInfoDao.java

@ -55,5 +55,5 @@ public interface UserBaseInfoDao extends BaseDao<UserBaseInfoEntity> {
* @Description 查询userId的身份证号在小程序用户中存在的多个userId值
* @author sun
*/
List<UserBaseInfoDTO> getUserBaseList(@Param("userId") String userId);
List<UserBaseInfoDTO> getUserBaseList(@Param("userId") String userId, @Param("customerId") String customerId);
}

2
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java

@ -154,7 +154,7 @@ public interface EpmetUserService {
* @Description 查询userId的身份证号在小程序用户中存在的多个userId值
* @author sun
*/
List<UserBaseInfoDTO> getUserBaseList(String userId);
List<UserBaseInfoDTO> getUserBaseList(String userId, String customerId);
/**
* @Description 根据身份证号查询负能平台用户信息

4
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java

@ -712,8 +712,8 @@ public class EpmetUserServiceImpl implements EpmetUserService {
* @author sun
*/
@Override
public List<UserBaseInfoDTO> getUserBaseList(String userId) {
return userBaseInfoDao.getUserBaseList(userId);
public List<UserBaseInfoDTO> getUserBaseList(String userId, String customerId) {
return userBaseInfoDao.getUserBaseList(userId, customerId);
}
/**

10
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java

@ -373,7 +373,7 @@ public class GovProjectServiceImpl implements GovProjectService {
if (ca.getCategoryCode().equals(l.getCategoryCode())) {
dto.setCategoryCode(ca.getCategoryCode());
dto.setCategoryName(ca.getCategoryName());
dto.setColour(ca.getColour());
dto.setColor(ca.getColor());
}
});
map.put(l.getCategoryCode(), l.getCategoryCode());
@ -385,7 +385,7 @@ public class GovProjectServiceImpl implements GovProjectService {
dto.setAgencyId(formDTO.getAgencyId());
dto.setCategoryCode(ca.getCategoryCode());
dto.setCategoryName(ca.getCategoryName());
dto.setColour(ca.getColour());
dto.setColor(ca.getColor());
resultList.add(dto);
map.put(ca.getCategoryCode(), ca.getCategoryCode());
}
@ -480,7 +480,7 @@ public class GovProjectServiceImpl implements GovProjectService {
ProjectAnalysisResultDTO resultDTO = new ProjectAnalysisResultDTO();
resultDTO.setUserId(formDTO.getUserId());
//1.查询userId的身份证号在小程序用户中存在的多个userId值
List<UserBaseInfoDTO> userList = epmetUserService.getUserBaseList(formDTO.getUserId());
List<UserBaseInfoDTO> userList = epmetUserService.getUserBaseList(formDTO.getUserId(), formDTO.getCustomerId());
List<String> userIds = userList.stream().map(UserBaseInfoDTO::getUserId).collect(Collectors.toList());
//2.查询对应负能平台用户家庭信息
@ -539,7 +539,7 @@ public class GovProjectServiceImpl implements GovProjectService {
});
//当前分类下来源楼院小组的项目
groupList.forEach(gr -> {
if (secondCodeMap.containsKey(gr.getCategoryCode())) {
if (secondCodeMap.containsKey(gr.getCategoryCode()) && !formDTO.getProjectId().equals(gr.getProjectId())) {
ProjectAnalysisResultDTO.Project project = ConvertUtils.sourceToTarget(gr, ProjectAnalysisResultDTO.Project.class);
groupPrList.add(project);
}
@ -548,7 +548,7 @@ public class GovProjectServiceImpl implements GovProjectService {
groupProjectList.add(groupCa);
//当前分类下来源事件上报的项目
eventList.forEach(gr -> {
if (secondCodeMap.containsKey(gr.getCategoryCode())) {
if (secondCodeMap.containsKey(gr.getCategoryCode()) && !formDTO.getProjectId().equals(gr.getProjectId())) {
ProjectAnalysisResultDTO.Project project = ConvertUtils.sourceToTarget(gr, ProjectAnalysisResultDTO.Project.class);
eventPrList.add(project);
}

1
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml

@ -47,6 +47,7 @@
WHERE
del_flag = '0'
AND id_num = ( SELECT id_num FROM user_base_info WHERE user_id = #{userId})
AND customer_id = #{customerId}
</select>
</mapper>

2
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml

@ -163,7 +163,7 @@
origin origin,
`status` status,
locate_longitude longitude,
locate_dimension dimension,
locate_dimension latitude,
title title
FROM
project

41
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/heart/VolunteerDemandServiceStatsResultDTO.java

@ -0,0 +1,41 @@
package com.epmet.dto.result.heart;
import lombok.Data;
/**
* @Description 描述
* @Author wangxianzhang
* @Date 2021/12/10 4:24 下午
* @Version 1.0
*/
@Data
public class VolunteerDemandServiceStatsResultDTO {
private String customerId;
private String dateId;
/**
* 客户下志愿者总数
*/
private Integer volunteerTotal;
/**
* 客户下志愿者中党员数量
*/
private Integer partyTotal;
/**
* 客户下志愿者中居民数量
*/
private Integer resiTotal;
/**
* 客户下志愿者服务总次数
*/
private Integer serviceTotal;
/**
* 客户下党员志愿者服务次数
*/
private Integer partyServiceTotal;
/**
* 客户下居民志愿者服务次数
*/
private Integer resiServiceTotal;
}

38
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/heart/DataReportHeartDemandController.java

@ -0,0 +1,38 @@
package com.epmet.datareport.controller.heart;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.datareport.service.heart.DemandService;
import com.epmet.dto.result.heart.VolunteerDemandServiceStatsResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Description 描述
* @Author wangxianzhang
* @Date 2021/12/10 3:55 下午
* @Version 1.0
*/
@RestController
@RequestMapping("heart/demand")
public class DataReportHeartDemandController {
@Autowired
private DemandService demandService;
/**
* 查询志愿者需求服务统计信息
* @param loginUser
* @return
*/
@PostMapping("volunteer/service")
public Result<VolunteerDemandServiceStatsResultDTO> getVolunteerServiceStats(@LoginUser TokenDto loginUser) {
String customerId = loginUser.getCustomerId();
VolunteerDemandServiceStatsResultDTO r = demandService.getVolunteerServiceStats(customerId);
return new Result<VolunteerDemandServiceStatsResultDTO>().ok(r);
}
}

43
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactVolunteerServiceDailyDao.java

@ -0,0 +1,43 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.datareport.dao.fact;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.datareport.entity.heart.FactVolunteerServiceDailyEntity;
import com.epmet.dto.result.heart.VolunteerDemandServiceStatsResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 志愿者服务情况统计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-12-08
*/
@Mapper
public interface FactVolunteerServiceDailyDao extends BaseDao<FactVolunteerServiceDailyEntity> {
/**
* 查询最新一条"志愿者需求服务统计信息"
* @param customerId
* @return
*/
VolunteerDemandServiceStatsResultDTO getLatestVolunteerDemandServiceStats(@Param("customerId") String customerId);
}

83
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/heart/FactVolunteerServiceDailyEntity.java

@ -0,0 +1,83 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.datareport.entity.heart;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 志愿者服务情况统计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-12-08
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_volunteer_service_daily")
public class FactVolunteerServiceDailyEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* yyyyMMdd
*/
private String dateId;
/**
* yyyyMM
*/
private String monthId;
/**
* 截止到当前dateId当前客户下共有多少个爱心互助的志愿者
*/
private Integer volunteerTotal;
/**
* 截止到当前dateId当前客户下XX个爱心互助志愿者中党员有多少个
*/
private Integer partyTotal;
/**
* 截止到当前dateId当前客户下XX个爱心互助志愿者中居民有多少个
*/
private Integer resiTotal;
/**
* 服务总次数
*/
private Integer serviceTotal;
/**
* 党员服务总次数
*/
private Integer partyServiceTotal;
/**
* 居民服务总次数
*/
private Integer resiServiceTotal;
}

13
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/heart/DemandService.java

@ -0,0 +1,13 @@
package com.epmet.datareport.service.heart;
import com.epmet.dto.result.heart.VolunteerDemandServiceStatsResultDTO;
/**
* @Description 需求服务
* @Author wangxianzhang
* @Date 2021/12/10 4:18 下午
* @Version 1.0
*/
public interface DemandService {
VolunteerDemandServiceStatsResultDTO getVolunteerServiceStats(String customerId);
}

29
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/heart/impl/DemandServiceImpl.java

@ -0,0 +1,29 @@
package com.epmet.datareport.service.heart.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.fact.FactVolunteerServiceDailyDao;
import com.epmet.datareport.entity.heart.FactVolunteerServiceDailyEntity;
import com.epmet.datareport.service.heart.DemandService;
import com.epmet.dto.result.heart.VolunteerDemandServiceStatsResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @Description 需求服务
* @Author wangxianzhang
* @Date 2021/12/10 4:20 下午
* @Version 1.0
*/
@Service
public class DemandServiceImpl implements DemandService {
@Autowired
private FactVolunteerServiceDailyDao factVolunteerServiceDailyDao;
@Override
public VolunteerDemandServiceStatsResultDTO getVolunteerServiceStats(String customerId) {
return factVolunteerServiceDailyDao.getLatestVolunteerDemandServiceStats(customerId);
}
}

36
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactVolunteerServiceDailyDao.xml

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.datareport.dao.fact.FactVolunteerServiceDailyDao">
<resultMap type="com.epmet.datareport.entity.heart.FactVolunteerServiceDailyEntity" id="factVolunteerServiceDailyMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="dateId" column="DATE_ID"/>
<result property="monthId" column="MONTH_ID"/>
<result property="volunteerTotal" column="VOLUNTEER_TOTAL"/>
<result property="partyTotal" column="PARTY_TOTAL"/>
<result property="resiTotal" column="RESI_TOTAL"/>
<result property="serviceTotal" column="SERVICE_TOTAL"/>
<result property="partyServiceTotal" column="PARTY_SERVICE_TOTAL"/>
<result property="resiServiceTotal" column="RESI_SERVICE_TOTAL"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="getLatestVolunteerDemandServiceStats"
resultType="com.epmet.dto.result.heart.VolunteerDemandServiceStatsResultDTO">
select *
from fact_volunteer_service_daily
where DEL_FLAG = 0
and CUSTOMER_ID = #{customerId}
order by DATE_ID desc
limit 1
</select>
</mapper>

19
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/heart/result/DemandServiceCountResultDTO.java

@ -0,0 +1,19 @@
package com.epmet.dto.heart.result;
import lombok.Data;
/**
* @Description 描述
* @Author wangxianzhang
* @Date 2021/12/8 4:39 下午
* @Version 1.0
*/
@Data
public class DemandServiceCountResultDTO {
// 服务者ID
private String serverId;
// 服务类型
private String serviceType;
// 服务次数
private int serveTimes;
}

5
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/IssueProjectCategoryDictDTO.java

@ -113,4 +113,9 @@ public class IssueProjectCategoryDictDTO implements Serializable {
*/
private Date updatedTime;
/**
* 颜色
*/
private String color;
}

12
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java

@ -25,6 +25,7 @@ import com.epmet.feign.impl.DataStatisticalOpenFeignClientFallBackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@ -341,4 +342,15 @@ public interface DataStatisticalOpenFeignClient {
*/
@PostMapping("/data/stats/datareporting/eventinfo")
Result<List<EventInfoResultDTO>> getEventInfo(@RequestBody EventInfoFormDTO formDTO);
/**
* wangxianzhang
*
* 计算客户下志愿者服务相关数据
*
* @param customerId 客户ID可以为空为空则计算所有客户
* @return
*/
@PostMapping("/data/stats/demand/volunteer/daily")
Result statsVolunteerDemandServicesDaily(@RequestParam(value = "customer-id", required = false) String customerId);
}

5
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java

@ -334,4 +334,9 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp
public Result<List<EventInfoResultDTO>> getEventInfo(EventInfoFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "getEventInfo", formDTO);
}
@Override
public Result statsVolunteerDemandServicesDaily(String customerId) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "statsVolunteerDemandServicesDaily", customerId);
}
}

38
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemandController.java

@ -0,0 +1,38 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.service.DemandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @Description 描述
* @Author wangxianzhang
* @Date 2021/12/8 10:44 上午
* @Version 1.0
*/
@RestController
@RequestMapping("demand")
public class DemandController {
@Autowired
private DemandService demandStatsService;
/**
* wangxianzhang
*
* 计算客户下志愿者服务相关数据
*
* @param customerId 客户ID可以为空为空则计算所有客户
* @return
*/
@PostMapping("volunteer/daily")
public Result statsVolunteerDemandServicesDaily(@RequestParam(value = "customer-id", required = false) String customerId) {
demandStatsService.statsVolunteerDemandServicesDaily(customerId);
return new Result();
}
}

44
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/IcUserDemandServiceDao.java

@ -0,0 +1,44 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao.heart;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.heart.result.DemandServiceCountResultDTO;
import com.epmet.entity.heart.IcUserDemandServiceEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* 居民需求服务记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-19
*/
@Mapper
public interface IcUserDemandServiceDao extends BaseDao<IcUserDemandServiceEntity> {
/**
* 需求服务次数查询
* @param customerId 客户id
* @param serviceType 服务者类型
*/
List<DemandServiceCountResultDTO> listDemandServeTimes(@Param("customerId") String customerId, @Param("endTime") Date endTime, @Param("serviceType") String serviceType);
}

33
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/VolunteerInfoDao.java

@ -0,0 +1,33 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao.heart;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.heart.VolunteerInfoEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 志愿者信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-12-08
*/
@Mapper
public interface VolunteerInfoDao extends BaseDao<VolunteerInfoEntity> {
}

42
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactVolunteerServiceDailyDao.java

@ -0,0 +1,42 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.stats.FactVolunteerServiceDailyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 志愿者服务情况统计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-12-08
*/
@Mapper
public interface FactVolunteerServiceDailyDao extends BaseDao<FactVolunteerServiceDailyEntity> {
/**
* 删除指定客户指定dateId的志愿者服务统计记录
* @param customerIds
* @param dateDimId
*/
void clearVolunteerDemandServiceDailyStats(@Param("customerIds") List<String> customerIds, @Param("dateDimId") String dateDimId);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java

@ -264,5 +264,7 @@ public interface UserDao {
List<MidPatrolRecordResult> getPatrolRecordList(MidPatrolFormDTO formDTO);
List<MidPatrolDetailResult> getPatrolDetailList(MidPatrolFormDTO formDTO);
List<String> filterUserIds(@Param("userIds") List<String> userIds, @Param("roleKey") String roleKey);
}

75
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/heart/IcUserDemandServiceEntity.java

@ -0,0 +1,75 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.heart;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 居民需求服务记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-19
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("ic_user_demand_service")
public class IcUserDemandServiceEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 需求id
*/
private String demandRecId;
/**
* 服务方类型志愿者volunteer社会组织social_org社区自组织community_org区域党建单位party_unit
*/
private String serviceType;
/**
* 志愿者居民端爱心互助的志愿者userId
*/
private String serverId;
/**
* 实际服务开始时间
*/
private Date serviceStartTime;
/**
* 实际服务结束时间
*/
private Date serviceEndTime;
/**
* 完成情况
*/
private String finishDesc;
}

71
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/heart/VolunteerInfoEntity.java

@ -0,0 +1,71 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.heart;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 志愿者信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-12-08
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("volunteer_info")
public class VolunteerInfoEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 用户id
*/
private String userId;
/**
* 客户id
*/
private String customerId;
/**
* 志愿者自我介绍
*/
private String volunteerIntroduce;
/**
* 志愿者签名
*/
private String volunteerSignature;
/**
* 网格id
*/
private String gridId;
/**
* 网格名称
*/
private String gridName;
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/issue/IssueProjectCategoryDictEntity.java

@ -80,4 +80,9 @@ public class IssueProjectCategoryDictEntity extends BaseEpmetEntity {
*/
private String isDisable;
/**
* 颜色
*/
private String color;
}

86
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactVolunteerServiceDailyEntity.java

@ -0,0 +1,86 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.stats;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 志愿者服务情况统计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-12-08
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_volunteer_service_daily")
public class FactVolunteerServiceDailyEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* yyyyMMdd
*/
private String dateId;
/**
* yyyyMM
*/
private String monthId;
/**
* 截止到当前dateId当前客户下共有多少个爱心互助的志愿者
*/
private Integer volunteerTotal;
/**
* 截止到当前dateId当前客户下XX个爱心互助志愿者中党员有多少个
*/
private Integer partyTotal;
/**
* 截止到当前dateId当前客户下XX个爱心互助志愿者中居民有多少个
*/
private Integer resiTotal;
/**
* 服务总次数
*/
private Integer serviceTotal;
/**
* 党员服务总次数
*/
private Integer partyServiceTotal;
/**
* 居民服务总次数
*/
private Integer resiServiceTotal;
}

20
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/DemandService.java

@ -0,0 +1,20 @@
package com.epmet.service;
/**
* @Description 需求service
* @Author wangxianzhang
* @Date 2021/12/8 12:14 下午
* @Version 1.0
*/
public interface DemandService {
/**
* wangxianzhang
*
* 按日统计
*
* @param customerId 客户ID可为空为空计算所有
*/
void statsVolunteerDemandServicesDaily(String customerId);
}

15
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/HeartDemandService.java

@ -0,0 +1,15 @@
package com.epmet.service.heart;
import com.epmet.dto.heart.result.DemandServiceCountResultDTO;
import java.util.Date;
import java.util.List;
/**
*@Description 爱心互助需求service
*@Author wangxianzhang
*@Date 2021/12/8
*/
public interface HeartDemandService {
List<DemandServiceCountResultDTO> listDemandServeTimesPage(String customerId, Date endTime, int serviceCountPageNo, int serviceCountPageSize);
}

15
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/HeartVolunteerService.java

@ -0,0 +1,15 @@
package com.epmet.service.heart;
import com.epmet.entity.heart.VolunteerInfoEntity;
import java.util.Date;
import java.util.List;
/**
*@Description heart 志愿者service
*@Author wangxianzhang
*@Date 2021/12/8
*/
public interface HeartVolunteerService {
List<VolunteerInfoEntity> listVolunteers(String customerId, Date endCreateTime);
}

40
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/HeartDemandServiceImpl.java

@ -0,0 +1,40 @@
package com.epmet.service.heart.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.heart.IcUserDemandServiceDao;
import com.epmet.dto.heart.result.DemandServiceCountResultDTO;
import com.epmet.service.heart.HeartDemandService;
import com.github.pagehelper.ISelect;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* @Description 爱心互助需求service
* @Author wangxianzhang
* @Date 2021/12/8 12:33 下午
* @Version 1.0
*/
@Service
@DataSource(DataSourceConstant.EPMET_HEART)
public class HeartDemandServiceImpl implements HeartDemandService {
@Autowired
private IcUserDemandServiceDao demandServiceDao;
@Override
public List<DemandServiceCountResultDTO> listDemandServeTimesPage(String customerId, Date endTime, int serviceCountPageNo, int serviceCountPageSize) {
return PageHelper.startPage(serviceCountPageNo, serviceCountPageSize).doSelectPage(new ISelect() {
@Override
public void doSelect() {
demandServiceDao.listDemandServeTimes(customerId, endTime, "volunteer");
}
});
}
}

38
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/HeartVolunteerServiceImpl.java

@ -0,0 +1,38 @@
package com.epmet.service.heart.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.heart.VolunteerInfoDao;
import com.epmet.entity.heart.VolunteerInfoEntity;
import com.epmet.service.heart.HeartVolunteerService;
import com.github.pagehelper.ISelect;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* @Description 描述
* @Author wangxianzhang
* @Date 2021/12/8 1:35 下午
* @Version 1.0
*/
@Service
@DataSource(DataSourceConstant.EPMET_HEART)
public class HeartVolunteerServiceImpl implements HeartVolunteerService {
@Autowired
private VolunteerInfoDao volunteerInfoDao;
@Override
public List<VolunteerInfoEntity> listVolunteers(String customerId, Date endCreateTime) {
LambdaQueryWrapper<VolunteerInfoEntity> query = new LambdaQueryWrapper<>();
query.eq(VolunteerInfoEntity::getCustomerId, customerId);
query.lt(VolunteerInfoEntity::getCreatedTime, endCreateTime);
return volunteerInfoDao.selectList(query);
}
}

176
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DemandServiceImpl.java

@ -0,0 +1,176 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.constant.EpmetRoleKeyConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.dto.heart.result.DemandServiceCountResultDTO;
import com.epmet.entity.crm.CustomerEntity;
import com.epmet.entity.heart.VolunteerInfoEntity;
import com.epmet.entity.stats.FactVolunteerServiceDailyEntity;
import com.epmet.service.DemandService;
import com.epmet.service.crm.CustomerService;
import com.epmet.service.heart.HeartDemandService;
import com.epmet.service.heart.HeartVolunteerService;
import com.epmet.service.stats.DemandStatsService;
import com.epmet.service.user.UserService;
import com.epmet.util.DimIdGenerator;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Description 需求service
* @Author wangxianzhang
* @Date 2021/12/8 12:14 下午
* @Version 1.0
*/
@Service
public class DemandServiceImpl implements DemandService {
@Autowired
private HeartDemandService heartDemandService;
@Autowired
private HeartVolunteerService heartVolunteerService;
@Autowired
private UserService userService;
@Autowired
private DemandStatsService demandStatsService;
@Autowired
private CustomerService customerService;
@Override
public void statsVolunteerDemandServicesDaily(String customerId) {
Date now = new Date();
Date today = DateUtils.integrate(now, "yyyy-MM-dd");
Date yestoday = DateUtils.addDateDays(today, -1);
if (StringUtils.isNotBlank(customerId)) {
// 只计算单个客户
clearOldDatas(Arrays.asList(customerId), yestoday);
statsVolunteerDemandServicesDaily4Customer(customerId, today, yestoday);
} else {
// 查询所有客户ID
List<String> customerIds = customerService.listValidCustomersByCreateTime(null, null).stream().map(c -> c.getId()).collect(Collectors.toList());
clearOldDatas(customerIds, yestoday);
customerIds.stream().forEach(cId -> {
statsVolunteerDemandServicesDaily4Customer(cId, today, yestoday);
});
}
}
/**
* 清理旧数据
* @param targetDate 要清理哪天的数据
* @param customerIds 要清理哪些客户的
*/
private void clearOldDatas(List<String> customerIds, Date targetDate) {
String dateDimId = DimIdGenerator.getDateDimId(targetDate);
demandStatsService.clearVolunteerDemandServiceDailyStats(customerIds, dateDimId);
}
/**
* 统计单个客户的志愿者服务情况
* @param customerId 客户ID
* @param endTime 统计截止时间(<endTime)
*/
private void statsVolunteerDemandServicesDaily4Customer(String customerId, Date endTime, Date belongTime) {
// 1.志愿者分流为党员志愿者&普通居民志愿者
Integer volunteerTotalCount = 0;
// 党员志愿者数量
Integer partymemberVolunteerCount = 0;
// 居民志愿者数量
Integer resiVolunteerCount = 0;
// 党员志愿者用户id列表
List<String> partymemberVolunteerUserIds = new ArrayList<>(16);
List<VolunteerInfoEntity> volunteers = heartVolunteerService.listVolunteers(customerId, endTime);
volunteerTotalCount = volunteers.size();
// 分片开始下标
int shardingStartIndex = 0;
// 分片大小(条数)
int shardingSize = 100;
// 分片去确定党员身份,防止in条件过大
while (true) {
int realShardingSize = Math.min(shardingSize, volunteerTotalCount - shardingStartIndex);
if (realShardingSize <= 0) {
break;
}
int shardingEndIndex = shardingStartIndex + realShardingSize;
List<String> volunteerUserIds = volunteers.subList(shardingStartIndex, shardingEndIndex)
.stream()
.map((volunteerInfoEntity) -> volunteerInfoEntity.getUserId())
.collect(Collectors.toList());
List<String> tempPartymemberUserIds = userService.filterUserIds(volunteerUserIds, EpmetRoleKeyConstant.PARTYMEMBER);
partymemberVolunteerUserIds.addAll(tempPartymemberUserIds);
shardingStartIndex = shardingEndIndex;
}
partymemberVolunteerCount = partymemberVolunteerUserIds.size();
resiVolunteerCount = volunteerTotalCount - partymemberVolunteerCount;
//2. 查询志愿者服务次数
// 总服务次数
int totalDemandServeTimes = 0;
// 党员服务次数
int partymemberDemandServeTimes = 0;
// 居民服务次数
int resiDemandServeTimes = 0;
int serviceCountPageNo = 0;
int serviceCountPageSize = 1000;
while (true) {
// 取出每一个服务者的服务次数
List<DemandServiceCountResultDTO> damendServeTimes = heartDemandService.listDemandServeTimesPage(customerId, endTime, serviceCountPageNo, serviceCountPageSize);
for (DemandServiceCountResultDTO damendServiceTimes : damendServeTimes) {
String serverId = damendServiceTimes.getServerId();
if (partymemberVolunteerUserIds.contains(serverId)) {
partymemberDemandServeTimes += damendServiceTimes.getServeTimes();
} else {
resiDemandServeTimes += damendServiceTimes.getServeTimes();
}
}
if (damendServeTimes.size() <= serviceCountPageSize) {
break;
}
}
totalDemandServeTimes = partymemberDemandServeTimes + resiDemandServeTimes;
// 3.持久化
FactVolunteerServiceDailyEntity insert = new FactVolunteerServiceDailyEntity();
insert.setDateId(DimIdGenerator.getDateDimId(belongTime));
insert.setCustomerId(customerId);
insert.setMonthId(DimIdGenerator.getMonthDimId(belongTime));
insert.setPartyServiceTotal(partymemberDemandServeTimes);
insert.setServiceTotal(totalDemandServeTimes);
insert.setPartyTotal(partymemberVolunteerCount);
insert.setResiServiceTotal(resiDemandServeTimes);
insert.setResiTotal(resiVolunteerCount);
insert.setVolunteerTotal(volunteerTotalCount);
demandStatsService.addVolunteerServiceDaily(insert);
}
}

18
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DemandStatsService.java

@ -0,0 +1,18 @@
package com.epmet.service.stats;
import com.epmet.entity.stats.FactVolunteerServiceDailyEntity;
import java.util.List;
/**
*@Description 统计客户下的志愿者需求服务数据
*@Author wangxianzhang
*@Date 2021/12/8
*/
public interface DemandStatsService {
void addVolunteerServiceDaily(FactVolunteerServiceDailyEntity entity);
void clearVolunteerDemandServiceDailyStats(List<String> customerIds, String dateDimId);
}

36
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DemandStatsServiceImpl.java

@ -0,0 +1,36 @@
package com.epmet.service.stats.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.stats.FactVolunteerServiceDailyDao;
import com.epmet.entity.stats.FactVolunteerServiceDailyEntity;
import com.epmet.service.stats.DemandStatsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description 描述
* @Author wangxianzhang
* @Date 2021/12/8 10:54 上午
* @Version 1.0
*/
@Service
@DataSource(DataSourceConstant.STATS)
public class DemandStatsServiceImpl implements DemandStatsService {
@Autowired
private FactVolunteerServiceDailyDao factVolunteerServiceDailyDao;
@Override
public void addVolunteerServiceDaily(FactVolunteerServiceDailyEntity entity) {
factVolunteerServiceDailyDao.insert(entity);
}
@Override
public void clearVolunteerDemandServiceDailyStats(List<String> customerIds, String dateDimId) {
factVolunteerServiceDailyDao.clearVolunteerDemandServiceDailyStats(customerIds, dateDimId);
}
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java

@ -146,4 +146,6 @@ public interface UserService {
List<MidPatrolRecordResult> getPatrolRecordList(MidPatrolFormDTO formDTO);
List<MidPatrolDetailResult> getPatrolDetailList(MidPatrolFormDTO formDTO);
List<String> filterUserIds(List<String> userIds, String roleKey);
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java

@ -1109,4 +1109,8 @@ public class UserServiceImpl implements UserService {
return userDao.getPatrolDetailList(formDTO);
}
@Override
public List<String> filterUserIds(List<String> userIds, String roleKey) {
return userDao.filterUserIds(userIds, roleKey);
}
}

21
epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.26__create_volunteer_service_daily.sql

@ -0,0 +1,21 @@
CREATE TABLE epmet_data_statistical.`fact_volunteer_service_daily`
(
`ID` varchar(64) NOT NULL COMMENT '主键',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id',
`DATE_ID` varchar(8) NOT NULL COMMENT 'yyyyMMdd',
`MONTH_ID` varchar(6) NOT NULL COMMENT 'yyyyMM',
`VOLUNTEER_TOTAL` int(11) NOT NULL COMMENT '截止到当前dateId,当前客户下,共有多少个爱心互助的志愿者',
`PARTY_TOTAL` int(11) NOT NULL COMMENT '截止到当前dateId,当前客户下,XX个爱心互助志愿者中,党员有多少个',
`RESI_TOTAL` int(11) NOT NULL COMMENT '截止到当前dateId,当前客户下,XX个爱心互助志愿者中,居民有多少个',
`SERVICE_TOTAL` int(11) NOT NULL COMMENT '服务总次数',
`PARTY_SERVICE_TOTAL` int(11) NOT NULL COMMENT '党员服务总次数',
`RESI_SERVICE_TOTAL` int(11) NOT NULL COMMENT '居民服务总次数',
`DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(32) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`),
UNIQUE KEY `uni_vsd` (`CUSTOMER_ID`,`DATE_ID`,`DEL_FLAG`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='志愿者服务情况统计'

34
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/IcUserDemandServiceDao.xml

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.heart.IcUserDemandServiceDao">
<resultMap type="com.epmet.entity.heart.IcUserDemandServiceEntity" id="icUserDemandServiceMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="demandRecId" column="DEMAND_REC_ID"/>
<result property="serviceType" column="SERVICE_TYPE"/>
<result property="serverId" column="SERVER_ID"/>
<result property="serviceStartTime" column="SERVICE_START_TIME"/>
<result property="serviceEndTime" column="SERVICE_END_TIME"/>
<result property="finishDesc" column="FINISH_DESC"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="listDemandServeTimes" resultType="com.epmet.dto.heart.result.DemandServiceCountResultDTO">
select service.SERVER_ID, SERVICE_TYPE, count(1) as SERVE_TIMES
from ic_user_demand_rec damend
inner join ic_user_demand_service service on (damend.ID = service.DEMAND_REC_ID and service.DEL_FLAG = 0)
where damend.DEL_FLAG = 0
and damend.STATUS = 'finished'
and damend.CUSTOMER_ID = #{customerId}
and service.SERVICE_END_TIME <![CDATA[<]]> #{endTime}
and service.SERVICE_TYPE = #{serviceType}
group by service.SERVER_ID, SERVICE_TYPE
</select>
</mapper>

23
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/VolunteerInfoDao.xml

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.VolunteerInfoDao">
<resultMap type="com.epmet.entity.heart.VolunteerInfoEntity" id="volunteerInfoMap">
<result property="id" column="ID"/>
<result property="userId" column="USER_ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="volunteerIntroduce" column="VOLUNTEER_INTRODUCE"/>
<result property="volunteerSignature" column="VOLUNTEER_SIGNATURE"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
<result property="gridId" column="GRID_ID"/>
<result property="gridName" column="GRID_NAME"/>
</resultMap>
</mapper>

37
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactVolunteerServiceDailyDao.xml

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.stats.FactVolunteerServiceDailyDao">
<resultMap type="com.epmet.entity.stats.FactVolunteerServiceDailyEntity" id="factVolunteerServiceDailyMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="dateId" column="DATE_ID"/>
<result property="monthId" column="MONTH_ID"/>
<result property="volunteerTotal" column="VOLUNTEER_TOTAL"/>
<result property="partyTotal" column="PARTY_TOTAL"/>
<result property="resiTotal" column="RESI_TOTAL"/>
<result property="serviceTotal" column="SERVICE_TOTAL"/>
<result property="partyServiceTotal" column="PARTY_SERVICE_TOTAL"/>
<result property="resiServiceTotal" column="RESI_SERVICE_TOTAL"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<delete id="clearVolunteerDemandServiceDailyStats">
delete
from fact_volunteer_service_daily
where DATE_ID=#{dateDimId}
and CUSTOMER_ID in
<foreach collection="customerIds" open="(" separator="," close=")" item="customerId">
#{customerId}
</foreach>
</delete>
</mapper>

13
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml

@ -1052,5 +1052,18 @@
order by created_time
LIMIT #{offset},#{pageSize}
</select>
<!-- 从UserId列表中过滤符合条件的UserId列表出来 -->
<select id="filterUserIds" resultType="java.lang.String">
select distinct ur.USER_ID
from user_role ur
inner join epmet_role er on (ur.ROLE_ID = er.ID)
where ur.DEL_FLAG = 0
and ur.USER_ID in
<foreach collection="userIds" open="(" item="userId" separator="," close=")">
#{userId}
</foreach>
and er.ROLE_KEY = #{roleKey}
</select>
</mapper>

41
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/CategoryAnalysisFormDTO.java

@ -0,0 +1,41 @@
package com.epmet.dto.form.demand;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 服务措施分析-柱状图入参
*/
@Data
public class CategoryAnalysisFormDTO implements Serializable {
public interface AddUserInternalGroup {
}
public interface AddUserShowGroup extends CustomerClientShowGroup {
}
@NotBlank(message = "先选择组织或网格", groups = AddUserShowGroup.class)
private String orgId;
@NotBlank(message = "组织:agency,网格:grid", groups = AddUserShowGroup.class)
private String orgType;
@NotBlank(message = "起止日期不能为空,格式yyyy-MM-dd", groups = AddUserShowGroup.class)
private String startDateId;
@NotBlank(message = "截止日期不能为空,格式yyyy-MM-dd", groups = AddUserShowGroup.class)
private String endDateId;
@NotBlank(message = "先选择组织或网格", groups = AddUserInternalGroup.class)
private String cusotmerId;
/**
* orgType=agency时pid拼接上orgId
*/
private String gridPids;
}

14
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/DemandResearchAnalysisFormDTO.java

@ -23,7 +23,7 @@ public class DemandResearchAnalysisFormDTO implements Serializable {
@NotBlank(message = "firstCategoryCode不能为空",groups = AddUserInternalGroup.class)
private String firstCategoryCode;
@NotBlank(message = "isResiUserId不能为空",groups = AddUserInternalGroup.class)
//@NotBlank(message = "isResiUserId不能为空",groups = AddUserInternalGroup.class)
private String icResiUserId;
private List<String> epmetUserIdList;
@ -31,4 +31,16 @@ public class DemandResearchAnalysisFormDTO implements Serializable {
@NotBlank(message = "tokenDto中的customerId不能为空",groups = AddUserInternalGroup.class)
private String customerId;
/**
* 个人档案personal-data
* 服务措施分析demand-analysis
*/
@NotBlank(message = "queryOrigin不能为空:个人档案:personal-data;服务措施分析:demand-analysis",groups = AddUserInternalGroup.class)
private String queryOrigin;
/**
* 当前查看的需求详情的需求id
*/
private String demandRecId;
}

6
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/IcResiUserDemandFromDTO.java

@ -41,4 +41,10 @@ public class IcResiUserDemandFromDTO implements Serializable {
* epmetUserIdList+userId
*/
private List<String> userIds;
/**
* 当前查看的需求详情的需求id 可空
*/
private String demandRecId;
}

10
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/PageListAnalysisFormDTO.java

@ -27,18 +27,17 @@ public class PageListAnalysisFormDTO implements Serializable {
@NotNull(message = "每页数量不能为空", groups = AddUserInternalGroup.class)
private Integer pageSize;
@NotBlank(message = "先选择组织或网格", groups = AddUserShowGroup.class)
@NotBlank(message = "先选择组织或网格不能为空", groups = AddUserShowGroup.class)
private String orgId;
@NotBlank(message = "组织或网格的上级", groups = AddUserShowGroup.class)
private String pid;
@NotBlank(message = "orgType=grid或者agency,不能为空", groups = AddUserInternalGroup.class)
private String orgType;
@NotBlank(message = "分类编码不能为空", groups = AddUserInternalGroup.class)
private String categoryCode;
@NotBlank(message = "上报时间起始日期不能为空,格式yyyyMMdd", groups = AddUserInternalGroup.class)
@NotBlank(message = "上报时间起始日期不能为空,格式yyyy-MM-dd", groups = AddUserInternalGroup.class)
private String startDateId;
@NotBlank(message = "上报时间截止日期不能为空,格式yyyyMMdd", groups = AddUserInternalGroup.class)
@NotBlank(message = "上报时间截止日期不能为空,格式yyyy-MM-dd", groups = AddUserInternalGroup.class)
private String endDateId;
@NotBlank(message = "tokenDto中的customerId不能为空",groups = AddUserInternalGroup.class)
@ -49,4 +48,5 @@ public class PageListAnalysisFormDTO implements Serializable {
private String gridPids;
private Boolean pageFlag;
}

26
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/VolunteerCommonFormDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.form.resi;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* @Description
* @Author wangxianzhang
* @Date 2021/12/10 6:10 下午
* @Version 1.0
*/
@Data
public class VolunteerCommonFormDTO {
public interface VolunteerPage {
}
@NotBlank(message = "客户ID不能为空", groups = {VolunteerPage.class})
private String customerId;
private Integer pageNo = 0;
private Integer pageSize = 20;
}

19
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryAnalysisDTO.java

@ -0,0 +1,19 @@
package com.epmet.dto.result.demand;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CategoryAnalysisDTO implements Serializable {
private static final long serialVersionUID = 3007202497989446585L;
private String categoryCode;
private String categoryName;
private Integer total;
private List<CategoryAnalysisDetail> detail;
}

32
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryAnalysisDetail.java

@ -0,0 +1,32 @@
package com.epmet.dto.result.demand;
import lombok.Data;
import java.io.Serializable;
@Data
public class CategoryAnalysisDetail implements Serializable {
private static final long serialVersionUID = -4606305611297470078L;
/**
* 区域党建单位party_unit
* 社会组织social_org
* 社区自组织community_org
* 志愿者volunteer
* 未完成unfinished
*/
private String legendCode;
/**
* 服务方类型名称
*/
private String legendName;
/**
* 服务方的个数
*/
private Integer totalService;
/**
* 需求个数
*/
private Integer serviceDemandTotal;
}

17
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryAnalysisResDTO.java

@ -0,0 +1,17 @@
package com.epmet.dto.result.demand;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CategoryAnalysisResDTO implements Serializable {
private static final long serialVersionUID = -3112952115061180189L;
private List<LegendDTO> legend;
private List<CategoryAnalysisDTO> categoryList;
}

11
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryDetailDTO.java

@ -0,0 +1,11 @@
package com.epmet.dto.result.demand;
import lombok.Data;
import java.io.Serializable;
@Data
public class CategoryDetailDTO extends CategoryAnalysisDetail implements Serializable {
private static final long serialVersionUID = 4459219163308113201L;
private String categoryCode;
}

13
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandDataDTO.java

@ -0,0 +1,13 @@
package com.epmet.dto.result.demand;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class DemandDataDTO implements Serializable {
private String firstCategoryCode;
private String firstCategoryName;
private List<IcResiUserReportDemandRes> demandList;
}

7
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandRecResultDTO.java

@ -88,6 +88,10 @@ public class DemandRecResultDTO implements Serializable {
* XXX(区域化党建单位)
*/
private String serviceShowName;
/**
* 只要有服务方就显示
*/
private Boolean serviceShowFlag;
/**
* 服务方类型志愿者volunteer社会组织social_org社区自组织community_org区域党建单位party_unit
*/
@ -114,4 +118,7 @@ public class DemandRecResultDTO implements Serializable {
* 完成情况
*/
private String finishDesc;
private String icResiUserId;
private String epmetUserId;
}

13
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandResearchAnalysisResultDTO.java

@ -1,6 +1,5 @@
package com.epmet.dto.result.demand;
import com.epmet.dto.result.HouseUserDTO;
import lombok.Data;
import java.io.Serializable;
@ -10,18 +9,10 @@ import java.util.List;
* 数据分析-个人档案-需求详情研判分析
*/
@Data
public class DemandResearchAnalysisResultDTO implements Serializable {
public class DemandResearchAnalysisResultDTO extends HouseMemResDTO implements Serializable {
private static final long serialVersionUID = -1024304149893118204L;
/**
* 居民信息及家属列表
*/
private String icResiUserId;
private String icUserName;
private String houseId;
private List<HouseUserDTO> houseUserList;
private List<IcResiUserReportDemandRes> demandList;
private List<DemandDataDTO> demandData;
/**
* 入参中给的再返回去
*/

15
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/FinishResultDTO.java

@ -0,0 +1,15 @@
package com.epmet.dto.result.demand;
import lombok.Data;
import java.io.Serializable;
/**
* 完成需求时是否需要计算 区域化党建单位的满意度
*
*/
@Data
public class FinishResultDTO implements Serializable {
private Boolean sendCalStatisfaction;
private String partyUnitId;
}

22
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/HouseMemResDTO.java

@ -0,0 +1,22 @@
package com.epmet.dto.result.demand;
import com.epmet.dto.result.HouseUserDTO;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 数据分析-个人档案-需求详情研判分析
* 案件居民家属
*/
@Data
public class HouseMemResDTO implements Serializable {
/**
* 居民信息及家属列表
*/
private String icResiUserId;
private String icUserName;
private String houseId;
private List<HouseUserDTO> houseUserList;
}

2
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/IcResiUserReportDemandRes.java

@ -26,7 +26,7 @@ public class IcResiUserReportDemandRes implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private Date wantServiceTime;
@JsonIgnore
//@JsonIgnore
private String status;
private String statusName;

26
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/LegendDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.result.demand;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 服务措施分析-柱状图
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LegendDTO implements Serializable {
private static final long serialVersionUID = 7205666632591639499L;
/**
* 区域党建单位party_unit
* 社会组织social_org
* 社区自组织community_org
* 志愿者volunteer
* 未完成unfinished
*/
private String legendCode;
private String legendName;
}

23
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/ServiceStatDTO.java

@ -0,0 +1,23 @@
package com.epmet.dto.result.demand;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
public class ServiceStatDTO implements Serializable {
/**
* 服务方id
*/
private String serverId;
/**
* 总分
*/
private BigDecimal totalScore;
/**
* 服务的需求个数
*/
private Integer demandCount;
}

14
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/PageVolunteerInfoResultDTO.java

@ -0,0 +1,14 @@
package com.epmet.dto.result.resi;
import lombok.Data;
/**
* @Description 志愿者信息分页查询结果
* @Author wangxianzhang
* @Date 2021/12/10 6:17 下午
* @Version 1.0
*/
@Data
public class PageVolunteerInfoResultDTO {
private String userId;
}

10
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java

@ -6,6 +6,8 @@ import com.epmet.dto.ActInfoDTO;
import com.epmet.dto.VolunteerInfoDTO;
import com.epmet.dto.form.CommonCustomerFormDTO;
import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO;
import com.epmet.dto.form.resi.VolunteerCommonFormDTO;
import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO;
import com.epmet.feign.fallback.EpmetHeartOpenFeignClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
@ -56,4 +58,12 @@ public interface EpmetHeartOpenFeignClient {
@PostMapping("/heart/icresidemanddict/demangnames")
Result<String> queryDemandNames(@RequestBody UserDemandNameQueryFormDTO formDTO);
/**
* 分页查询志愿者列表
* @param input
* @return
*/
@PostMapping("/heart/resi/volunteer/page")
Result<List<PageVolunteerInfoResultDTO>> queryVolunteerPage(@RequestBody VolunteerCommonFormDTO input);
}

7
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java

@ -7,6 +7,8 @@ import com.epmet.dto.ActInfoDTO;
import com.epmet.dto.VolunteerInfoDTO;
import com.epmet.dto.form.CommonCustomerFormDTO;
import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO;
import com.epmet.dto.form.resi.VolunteerCommonFormDTO;
import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO;
import com.epmet.feign.EpmetHeartOpenFeignClient;
import java.util.List;
@ -53,4 +55,9 @@ public class EpmetHeartOpenFeignClientFallback implements EpmetHeartOpenFeignCli
public Result<String> queryDemandNames(UserDemandNameQueryFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "queryDemandNames", formDTO);
}
@Override
public Result<List<PageVolunteerInfoResultDTO>> queryVolunteerPage(VolunteerCommonFormDTO input) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "queryVolunteerPage", input);
}
}

22
epmet-module/epmet-heart/epmet-heart-server/pom.xml

@ -88,6 +88,12 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<!--rocketmq-->
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-rocketmq</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
<build>
@ -152,6 +158,10 @@
<!--测试钉钉 机器人地址-->
<dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4</dingTalk.robot.webHook>
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
</properties>
</profile>
<profile>
@ -195,6 +205,10 @@
<!--测试钉钉 机器人地址-->
<dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4</dingTalk.robot.webHook>
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>false</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
</properties>
</profile>
<profile>
@ -238,6 +252,10 @@
<!--测试钉钉 机器人地址-->
<dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4</dingTalk.robot.webHook>
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.10.161:9876</rocketmq.nameserver>
</properties>
</profile>
<profile>
@ -281,6 +299,10 @@
<!--生产钉钉 机器人地址-->
<dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=a5f66c3374b1642fe2142dbf56d5997e280172d4e8f2b546c9423a68c82ece6c</dingTalk.robot.webHook>
<dingTalk.robot.secret>SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.11.187:9876;192.168.11.184:9876</rocketmq.nameserver>
</properties>
</profile>
</profiles>

8
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/UserDemandConstant.java

@ -50,4 +50,12 @@ public interface UserDemandConstant {
String SOCIAL_ORG="social_org";
String COMMUNITY_ORG="community_org";
String PARTY_UNIT="party_unit";
/**
* 个人档案personal-data
* 服务措施分析demand-analysis
*/
String PERSONAL_DATA="personal-data";
String DEMAND_ANALYSIS="demand-analysis";
}

15
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java

@ -17,6 +17,7 @@
package com.epmet.controller;
import com.epmet.commons.rocketmq.messages.CalPartyUnitSatisfactionFormDTO;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.dto.result.OptionDataResultDTO;
@ -179,4 +180,18 @@ public class IcPartyUnitController {
ValidatorUtils.validateEntity(formDTO);
return new Result<List<PartyUnitDistributionResultDTO>>().ok(icPartyUnitService.distribution(formDTO));
}
/**
* 计算区域化党建单位的群众满意度
*
* @param formDTO
* @return
*/
@PostMapping("cal-partyunit-satisfation")
public Result calPartyUnitSatisfation(@RequestBody CalPartyUnitSatisfactionFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO,CalPartyUnitSatisfactionFormDTO.AddUserInternalGroup.class);
icPartyUnitService.calPartyUnitSatisfation(formDTO);
return new Result();
}
}

36
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java

@ -17,15 +17,23 @@
package com.epmet.controller;
import com.epmet.commons.rocketmq.messages.CalPartyUnitSatisfactionFormDTO;
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.ValidatorUtils;
import com.epmet.constant.SystemMessageType;
import com.epmet.constant.UserDemandConstant;
import com.epmet.dto.form.SystemMsgFormDTO;
import com.epmet.dto.form.demand.*;
import com.epmet.dto.result.demand.*;
import com.epmet.dto.result.demand.DemandRecResultDTO;
import com.epmet.dto.result.demand.FinishResultDTO;
import com.epmet.dto.result.demand.IcResiUserReportDemandRes;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -60,7 +68,8 @@ public class IcUserDemandRecController {
private IcCommunitySelfOrganizationService icCommunitySelfOrganizationService;
@Autowired
private IcPartyUnitService icPartyUnitService;
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
/**
* 根据服务方类型查询 下拉框
@ -179,7 +188,16 @@ public class IcUserDemandRecController {
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(formDTO,FinishStaffFromDTO.AddUserShowGroup.class,FinishStaffFromDTO.AddUserInternalGroup.class);
icUserDemandRecService.finish(formDTO);
FinishResultDTO finishResultDTO=icUserDemandRecService.finish(formDTO);
if(finishResultDTO.getSendCalStatisfaction()){
CalPartyUnitSatisfactionFormDTO mqMsg = new CalPartyUnitSatisfactionFormDTO();
mqMsg.setCustomerId(formDTO.getCustomerId());
mqMsg.setPartyUnitId(finishResultDTO.getPartyUnitId());
SystemMsgFormDTO form = new SystemMsgFormDTO();
form.setMessageType(SystemMessageType.CAL_PARTY_UNIT_SATISFACTION);
form.setContent(mqMsg);
epmetMessageOpenFeignClient.sendSystemMsgByMQ(form);
}
return new Result();
}
@ -257,4 +275,18 @@ public class IcUserDemandRecController {
}
return new Result();
}
/**
* 数据分析-服务措施分析-柱状图
*
* @return
*/
@PostMapping("category-analysis")
public Result<CategoryAnalysisResDTO> categoryAnalysis(@LoginUser TokenDto tokenDto,@RequestBody CategoryAnalysisFormDTO formDTO){
formDTO.setCusotmerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(formDTO,CategoryAnalysisFormDTO.AddUserShowGroup.class,CategoryAnalysisFormDTO.AddUserInternalGroup.class);
return new Result<CategoryAnalysisResDTO>().ok(icUserDemandRecService.categoryAnalysis(formDTO));
}
}

19
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java

@ -26,7 +26,9 @@ import com.epmet.dto.form.CommonCustomerFormDTO;
import com.epmet.dto.form.demand.ServiceQueryFormDTO;
import com.epmet.dto.form.resi.ResiSendSmsCodeFormDTO;
import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO;
import com.epmet.dto.form.resi.VolunteerCommonFormDTO;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO;
import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO;
import com.epmet.service.VolunteerInfoService;
import org.springframework.beans.factory.annotation.Autowired;
@ -125,4 +127,21 @@ public class ResiVolunteerController {
public Result<List<OptionDTO>> queryListVolunteer(@LoginUser TokenDto tokenDto,@RequestBody ServiceQueryFormDTO formDTO){
return new Result<List<OptionDTO>>().ok(volunteerInfoService.queryListVolunteer(tokenDto.getCustomerId(),formDTO.getServiceName()));
}
/**
* 分页查询志愿者列表
* @param input
* @return
*/
@PostMapping("page")
public Result<List<PageVolunteerInfoResultDTO>> queryVolunteerPage(@RequestBody VolunteerCommonFormDTO input) {
ValidatorUtils.validateEntity(input, VolunteerCommonFormDTO.VolunteerPage.class);
Integer pageNo = input.getPageNo();
Integer pageSize = input.getPageSize();
String customerId = input.getCustomerId();
List<PageVolunteerInfoResultDTO> l = volunteerInfoService.queryVolunteerPage(customerId, pageNo, pageSize);
return new Result<List<PageVolunteerInfoResultDTO>>().ok(l);
}
}

3
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPartyUnitDao.java

@ -25,6 +25,7 @@ import com.epmet.entity.IcPartyUnitEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
/**
@ -63,4 +64,6 @@ public interface IcPartyUnitDao extends BaseDao<IcPartyUnitEntity> {
* @Date 2021/12/9 14:24
*/
List<PartyUnitDistributionResultDTO> getDistribution(@Param("agencyId")String agencyId);
int updateSatisfaction(@Param("partyUnitId") String serverId, @Param("satisfaction") BigDecimal satisfaction);
}

21
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java

@ -21,8 +21,10 @@ import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.demand.IcResiUserDemandFromDTO;
import com.epmet.dto.form.demand.PageListAnalysisFormDTO;
import com.epmet.dto.form.demand.UserDemandPageFormDTO;
import com.epmet.dto.result.demand.*;
import com.epmet.dto.result.demand.DemandRecResultDTO;
import com.epmet.dto.result.demand.IcResiUserReportDemandRes;
import com.epmet.dto.result.demand.ServiceStatDTO;
import com.epmet.entity.IcUserDemandRecEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -65,4 +67,23 @@ public interface IcUserDemandRecDao extends BaseDao<IcUserDemandRecEntity> {
* @return
*/
List<DemandRecResultDTO> pageListAnalysis(PageListAnalysisFormDTO formDTO);
List<CategoryAnalysisDetail> selectDetail(@Param("categoryCode") String categoryCode,
@Param("orgType") String orgType,
@Param("orgId") String orgId,
@Param("gridPids") String gridPids,
@Param("customerId") String customerId,
@Param("startDateId") String startDateId,
@Param("endDateId") String endDateId);
List<CategoryAnalysisDTO> selectListCategoryAnalysisDTO(@Param("firstCategoryList") List<OptionDTO> firstCategoryList,
@Param("customerId") String customerId,
@Param("orgId") String orgId,
@Param("orgType") String orgType,
@Param("gridPids") String gridPids,
@Param("startDateId") String startDateId,
@Param("endDateId") String endDateId);
List<ServiceStatDTO> selectGroupByPartyUnit(@Param("customerId") String customerId, @Param("partyUnitId") String partyUnitId);
}

31
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java

@ -0,0 +1,31 @@
package com.epmet.mq;
import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants;
import com.epmet.commons.rocketmq.constants.TopicConstants;
import com.epmet.commons.rocketmq.register.MQAbstractRegister;
import com.epmet.commons.rocketmq.register.MQConsumerProperties;
import com.epmet.mq.listener.PartyUnitSatisfactionCalEventListener;
import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
import org.springframework.stereotype.Component;
/**
* @Description 如果rocketmq.enable=true这里必须实现 实例化
* @author wxz
* @date 2021.07.14 17:13:41
*/
@Component
public class RocketMQConsumerRegister extends MQAbstractRegister {
@Override
public void registerAllListeners(String env, MQConsumerProperties consumerProperties) {
// 客户初始化监听器注册
register(consumerProperties,
ConsomerGroupConstants.CAL_PARTY_UNIT_SATISFACTION,
MessageModel.CLUSTERING,
TopicConstants.CAL_PARTY_UNIT_SATISFACTION,
"*",
new PartyUnitSatisfactionCalEventListener());
// ...其他监听器类似
}
}

104
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/mq/listener/PartyUnitSatisfactionCalEventListener.java

@ -0,0 +1,104 @@
package com.epmet.mq.listener;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.rocketmq.constants.MQUserPropertys;
import com.epmet.commons.rocketmq.messages.CalPartyUnitSatisfactionFormDTO;
import com.epmet.commons.tools.distributedlock.DistributedLock;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.service.IcPartyUnitService;
import org.apache.commons.lang.StringUtils;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
import org.apache.rocketmq.common.message.MessageExt;
import org.redisson.api.RLock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* @Description 计算区域化党建单位群众满意度=分数相加 需求的总个数
* @author wxz
* @date 2021.10.13 15:21:48
*/
public class PartyUnitSatisfactionCalEventListener implements MessageListenerConcurrently {
private Logger logger = LoggerFactory.getLogger(getClass());
private RedisUtils redisUtils;
@Override
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) {
if (redisUtils == null) {
redisUtils = SpringContextUtils.getBean(RedisUtils.class);
}
try {
msgs.forEach(msg -> consumeMessage(msg));
} catch (Exception e) {
logger.error(ExceptionUtils.getErrorStackTrace(e));
return ConsumeConcurrentlyStatus.RECONSUME_LATER;
}
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}
private void consumeMessage(MessageExt messageExt) {
// msg即为消息体
// tags为SystemMessageType.java中的项,为具体的操作,此处拿到tags,判断是创建还是变更,来做响应的后续操作即可
String msg = new String(messageExt.getBody());
String topic = messageExt.getTopic();
String tags = messageExt.getTags();
String pendingMsgLabel = messageExt.getUserProperty(MQUserPropertys.BLOCKED_MSG_LABEL);
logger.info("【计算区域化党建单位群众满意度事件监听器】-需求完成-收到消息内容:{},操作:{}", msg, tags);
CalPartyUnitSatisfactionFormDTO obj = JSON.parseObject(msg, CalPartyUnitSatisfactionFormDTO.class);
DistributedLock distributedLock = null;
RLock lock = null;
try {
distributedLock = SpringContextUtils.getBean(DistributedLock.class);
lock = distributedLock.getLock(String.format("lock:ic_warn_stats:%s", obj.getCustomerId()),
30L, 30L, TimeUnit.SECONDS);
//待执行方法
SpringContextUtils.getBean(IcPartyUnitService.class).calPartyUnitSatisfation(obj);
} catch (RenException e) {
// 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试
logger.error("【计算区域化党建单位群众满意度事件监听器】-MQ失败:".concat(ExceptionUtils.getErrorStackTrace(e)));
} catch (Exception e) {
// 不是我们自己抛出的异常,可以让MQ重试
logger.error("【计算区域化党建单位群众满意度监听器】-MQ失败:".concat(ExceptionUtils.getErrorStackTrace(e)));
throw e;
} finally {
distributedLock.unLock(lock);
}
if (StringUtils.isNotBlank(pendingMsgLabel)) {
try {
removePendingMqMsgCache(pendingMsgLabel);
} catch (Exception e) {
logger.error("【计算区域化党建单位群众满意度监听器】-删除mq阻塞消息缓存失败:{}", ExceptionUtils.getErrorStackTrace(e));
}
}
}
/**
* @description
*
* @param pendingMsgLabel
* @return
* @author wxz
* @date 2021.10.14 16:32:32
*/
private void removePendingMqMsgCache(String pendingMsgLabel) {
String key = RedisKeys.blockedMqMsgKey(pendingMsgLabel);
redisUtils.delete(key);
//logger.info("【开放数据事件监听器】删除mq阻塞消息缓存成功,blockedMsgLabel:{}", pendingMsgLabel);
}
}

7
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java

@ -19,6 +19,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.dto.result.OptionDataResultDTO;
import com.epmet.commons.rocketmq.messages.CalPartyUnitSatisfactionFormDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
@ -141,4 +142,10 @@ public interface IcPartyUnitService extends BaseService<IcPartyUnitEntity> {
* @Date 2021/12/9 10:10
*/
List<PartyUnitDistributionResultDTO> distribution(PartyActivityFormDTO formDTO);
/**
* 计算区域化党建单位的群众满意度
* @param formDTO
*/
void calPartyUnitSatisfation(CalPartyUnitSatisfactionFormDTO formDTO);
}

21
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java

@ -21,9 +21,12 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcUserDemandRecDTO;
import com.epmet.dto.form.demand.*;
import com.epmet.dto.result.demand.CategoryAnalysisResDTO;
import com.epmet.dto.result.demand.DemandRecResultDTO;
import com.epmet.dto.result.demand.DemandResearchAnalysisResultDTO;
import com.epmet.dto.result.demand.FinishResultDTO;
import com.epmet.dto.result.demand.IcResiUserReportDemandRes;
import com.epmet.dto.result.demand.ServiceStatDTO;
import com.epmet.entity.IcUserDemandRecEntity;
import java.util.List;
@ -128,7 +131,7 @@ public interface IcUserDemandRecService extends BaseService<IcUserDemandRecEntit
* 完成并评价
* @param formDTO
*/
void finish(FinishStaffFromDTO formDTO);
FinishResultDTO finish(FinishStaffFromDTO formDTO);
/**
* 数据分析-个人档案居民需求列表table
@ -161,4 +164,20 @@ public interface IcUserDemandRecService extends BaseService<IcUserDemandRecEntit
* @return
*/
PageData<DemandRecResultDTO> pageListAnalysis(PageListAnalysisFormDTO formDTO);
/**
* 数据分析-服务措施分析-柱状图
*
* @return
*/
CategoryAnalysisResDTO categoryAnalysis(CategoryAnalysisFormDTO formDTO);
/**
* 计算出服务方评价总分服务的需求个数
*
* @param customerId
* @param partyUnitId
* @return
*/
List<ServiceStatDTO> groupByPartyUnit(String customerId, String partyUnitId);
}

3
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java

@ -25,6 +25,7 @@ import com.epmet.dto.form.CommonCustomerFormDTO;
import com.epmet.dto.form.resi.ResiSendSmsCodeFormDTO;
import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO;
import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO;
import com.epmet.entity.VolunteerInfoEntity;
@ -94,4 +95,6 @@ public interface VolunteerInfoService extends BaseService<VolunteerInfoEntity> {
* @return
*/
List<OptionDTO> queryListVolunteer(String customerId,String userRealName);
List<PageVolunteerInfoResultDTO> queryVolunteerPage(String customerId, Integer pageNo, Integer pageSize);
}

35
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java

@ -72,6 +72,10 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
private IcPartyUnitService icPartyUnitService;
@Resource
private IcResiDemandDictService icResiDemandDictService;
/**
* 服务事项code
*/
private static final String SERVICE_MATTER_CODE = "1010";
@Override
public PageData<IcPartyActivityDTO> search(PartyActivityFormDTO formDTO) {
@ -150,12 +154,21 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
@Override
public IcPartyActivityDTO get(String id) {
IcPartyActivityEntity entity = baseDao.selectById(id);
if (null == entity) {
return null;
}
//获取服务事项名称
SubCodeFormDTO codeFormDTO = new SubCodeFormDTO();
codeFormDTO.setCustomerId(entity.getCustomerId());
codeFormDTO.setParentCategoryCode("1010");
codeFormDTO.setParentCategoryCode(SERVICE_MATTER_CODE);
Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
IcPartyActivityDTO dto = ConvertUtils.sourceToTarget(entity, IcPartyActivityDTO.class);
dto.setServiceMatterName(categoryMap.get(dto.getServiceMatter()));
//获取单位名称
IcPartyUnitDTO unitDTO = icPartyUnitService.get(dto.getUnitId());
if (null != unitDTO) {
dto.setUnitName(unitDTO.getUnitName());
}
return dto;
}
@ -213,7 +226,7 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
//获取服务事项
SubCodeFormDTO codeFormDTO = new SubCodeFormDTO();
codeFormDTO.setCustomerId(tokenDto.getCustomerId());
codeFormDTO.setParentCategoryCode("1010");
codeFormDTO.setParentCategoryCode(SERVICE_MATTER_CODE);
Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getLabel, OptionDTO::getValue));
//获取联建单位
IcPartyUnitDTO unitDTO = new IcPartyUnitDTO();
@ -338,8 +351,10 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
setDate(formDTO);
}
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
//获取活动列表
LambdaQueryWrapper<IcPartyActivityEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcPartyActivityEntity::getAgencyId, formDTO.getAgencyId());
wrapper.and(wp -> wp.eq(IcPartyActivityEntity::getAgencyId, formDTO.getAgencyId()).or().
like(IcPartyActivityEntity::getPids, formDTO.getAgencyId()));
wrapper.eq(StringUtils.isNotBlank(formDTO.getServiceMatter()), IcPartyActivityEntity::getServiceMatter, formDTO.getServiceMatter());
wrapper.ge(null != formDTO.getStartTime(),IcPartyActivityEntity::getActivityTime, formDTO.getStartTime());
wrapper.le(null != formDTO.getEndTime(), IcPartyActivityEntity::getActivityTime, formDTO.getEndTime());
@ -350,11 +365,14 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
IcPartyUnitDTO unitDTO = new IcPartyUnitDTO();
unitDTO.setAgencyId(formDTO.getAgencyId());
if (CollectionUtils.isNotEmpty(dtoList)) {
//获取联建单位
Map<String, String> option = icPartyUnitService.option(unitDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
//获取服务事项字典
SubCodeFormDTO codeFormDTO = new SubCodeFormDTO();
codeFormDTO.setCustomerId(tokenDto.getCustomerId());
codeFormDTO.setParentCategoryCode("1010");
codeFormDTO.setParentCategoryCode(SERVICE_MATTER_CODE);
Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
//数据组装
dtoList.forEach(dto -> {
dto.setServiceMatterName(categoryMap.get(dto.getServiceMatter()));
dto.setUnitName(option.get(dto.getUnitId()));
@ -364,9 +382,16 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
return new PageData<>(dtoList, pageInfo.getTotal());
}
/**
* 近30天开始时间和结束时间 精确到秒
* @Param formDTO
* @Return
* @Author zhaoqifeng
* @Date 2021/12/13 17:40
*/
private void setDate(PartyActivityFormDTO formDTO) {
String start = DateUtils.getBeforeNDay(30);
formDTO.setEndTime(DateUtils.parse(start.concat("000000"), DateUtils.DATE_TIME_NO_SPLIT));
formDTO.setStartTime(DateUtils.parse(start.concat("000000"), DateUtils.DATE_TIME_NO_SPLIT));
String end = DateUtils.format(new Date(), DateUtils.DATE_PATTERN);
formDTO.setEndTime(DateUtils.parse(end.concat(" 23:59:59"), DateUtils.DATE_TIME_PATTERN));
}

36
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java

@ -18,9 +18,11 @@
package com.epmet.service.impl;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.rocketmq.messages.CalPartyUnitSatisfactionFormDTO;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
@ -46,6 +48,7 @@ import com.epmet.dto.form.demand.ServiceQueryFormDTO;
import com.epmet.dto.form.demand.SubCodeFormDTO;
import com.epmet.dto.result.PartyUnitDistributionResultDTO;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.dto.result.demand.ServiceStatDTO;
import com.epmet.entity.IcPartyUnitEntity;
import com.epmet.excel.IcPartyUnitImportExcel;
import com.epmet.feign.EpmetAdminOpenFeignClient;
@ -64,6 +67,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@ -111,6 +115,11 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
} else {
item.setServiceMatterList(new ArrayList<>());
}
if(StringUtils.isBlank(item.getSatisfaction())){
item.setSatisfaction(StrConstant.HYPHEN);
}else{
item.setSatisfaction(new BigDecimal(item.getSatisfaction()).setScale(2,BigDecimal.ROUND_HALF_UP).toString());
}
});
PageInfo<IcPartyUnitDTO> pageInfo = new PageInfo<>(dtoList);
return new PageData<>(dtoList, pageInfo.getTotal());
@ -415,7 +424,32 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
*/
@Override
public List<PartyUnitDistributionResultDTO> distribution(PartyActivityFormDTO formDTO) {
return baseDao.getDistribution(formDTO.getAgencyId());
Result<Map<String, String>> unitTypeMap = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.PARTY_UNIT_TYPE.getCode());
List<PartyUnitDistributionResultDTO> list = baseDao.getDistribution(formDTO.getAgencyId());
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
list.forEach(item -> {
item.setType(unitTypeMap.getData().get(item.getType()));
});
return list;
}
/**
* 计算区域化党建单位的群众满意度
* 总分需求个数
* @param formDTO
*/
@Override
public void calPartyUnitSatisfation(CalPartyUnitSatisfactionFormDTO formDTO) {
log.info("收到消息内容啦...." + JSON.toJSONString(formDTO));
List<ServiceStatDTO> list = icUserDemandRecService.groupByPartyUnit(formDTO.getCustomerId(), formDTO.getPartyUnitId());
for (ServiceStatDTO serviceStatDTO : list) {
if (0 != serviceStatDTO.getDemandCount()) {
BigDecimal result = serviceStatDTO.getTotalScore().divide(new BigDecimal(serviceStatDTO.getDemandCount()), 4, BigDecimal.ROUND_HALF_UP);
baseDao.updateSatisfaction(serviceStatDTO.getServerId(),result);
}
}
}
private String getServiceMatter(Map<String, String> map, String matter) {

8
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java

@ -36,11 +36,13 @@ import com.epmet.service.IcResiDemandDictService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@ -203,7 +205,11 @@ public class IcResiDemandDictServiceImpl extends BaseServiceImpl<IcResiDemandDic
@Override
public List<OptionDTO> querySubCodeList(SubCodeFormDTO formDTO) {
return baseDao.selectByPCode(formDTO.getParentCategoryCode(),formDTO.getCustomerId(),formDTO.getCategoryName());
List<OptionDTO> list = baseDao.selectByPCode(formDTO.getParentCategoryCode(),formDTO.getCustomerId(),formDTO.getCategoryName());
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list;
}
@Override

264
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java

@ -17,6 +17,7 @@
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
@ -41,13 +42,11 @@ import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.IcUserDemandRecDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.FindIcUserFormDTO;
import com.epmet.dto.form.ResiUserFormDTO;
import com.epmet.dto.form.demand.*;
import com.epmet.dto.result.AllGridsByUserIdResultDTO;
import com.epmet.dto.result.IcResiUserBriefDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.dto.result.demand.DemandRecResultDTO;
import com.epmet.dto.result.demand.DemandResearchAnalysisResultDTO;
import com.epmet.dto.result.demand.IcResiUserReportDemandRes;
import com.epmet.dto.result.*;
import com.epmet.dto.result.demand.*;
import com.epmet.entity.*;
import com.epmet.feign.EpmetAdminOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
@ -56,6 +55,7 @@ import com.epmet.service.IcResiDemandDictService;
import com.epmet.service.IcUserDemandRecService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
@ -73,6 +73,7 @@ import java.util.stream.Collectors;
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-19
*/
@Slf4j
@Service
public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecDao, IcUserDemandRecEntity> implements IcUserDemandRecService {
@Autowired
@ -90,6 +91,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
@Autowired
private EpmetAdminOpenFeignClient adminOpenFeignClient;
@Override
public PageData<IcUserDemandRecDTO> page(Map<String, Object> params) {
IPage<IcUserDemandRecEntity> page = baseDao.selectPage(
@ -239,9 +241,9 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
//3、查询志愿者
// 服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;
Map<String,String> userInfoMap=new HashMap<>();
List<String> userIdList=list.stream().filter(item->item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toList());
Set<String> userIdList=list.stream().filter(item->item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toSet());
if(CollectionUtils.isNotEmpty(userIdList)){
Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList);
Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(new ArrayList<>(userIdList));
if(!userInfoRes.success()||CollectionUtils.isEmpty(userInfoRes.getData())){
throw new RenException("查询志愿者信息异常");
}
@ -321,6 +323,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
res.setServiceShowName(res.getServiceName().concat("(区域化党建单位)"));
break;
}*/
res.setServiceShowFlag(StringUtils.isNotBlank(res.getServerId()) ? true : false);
}
}
return new PageData<>(list, pageInfo.getTotal());
@ -410,7 +413,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void finish(FinishStaffFromDTO formDTO) {
public FinishResultDTO finish(FinishStaffFromDTO formDTO) {
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId());
if (null == entity) {
throw new RenException(EpmetErrorCode.DEMAND_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_NOT_EXITS.getMsg());
@ -458,6 +461,15 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
satisfactionEntity.setEvaluateTime(logEntity.getOperateTime());
satisfactionEntity.setScore(formDTO.getScore());
demandSatisfactionDao.insert(satisfactionEntity);
FinishResultDTO finishResultDTO=new FinishResultDTO();
finishResultDTO.setPartyUnitId(serviceEntity.getServerId());
finishResultDTO.setSendCalStatisfaction(false);
//5、如果服务方区域化党建单位,需求重新计算当前这个单位的满意度。
//如果服务方是区域化党建单位,需要实时去计算他的群众满意度=服务过的需求的评价分数相加➗ 需求的总个数。
if(UserDemandConstant.PARTY_UNIT.equals(serviceEntity.getServiceType())){
finishResultDTO.setSendCalStatisfaction(true);
}
return finishResultDTO;
}
/**
@ -552,6 +564,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
//服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;
res.setServiceShowName(serviceTypeMap.containsKey(res.getServiceType()) ? res.getServiceName().concat("(").concat(serviceTypeMap.get(res.getServiceType())).concat(")") : StrConstant.EPMETY_STR);
res.setServiceShowFlag(StringUtils.isNotBlank(res.getServerId())?true:false);
}
return res;
}
@ -566,22 +579,51 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
@Override
public DemandResearchAnalysisResultDTO queryDemandResearchAnalysis(DemandResearchAnalysisFormDTO formDTO) {
//获取案件居民和及家属列表
Result<IcResiUserBriefDTO> userRes = epmetUserOpenFeignClient.findFamilyMem(formDTO.getIcResiUserId());
if (!userRes.success() || null == userRes.getData()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取居民信息接口异常");
HouseMemResDTO houseMemResDTO=queryDemandUserFamily(formDTO);
DemandResearchAnalysisResultDTO resultDTO = ConvertUtils.sourceToTarget(houseMemResDTO, DemandResearchAnalysisResultDTO.class);
//log.info(JSON.toJSONString(formDTO));
//返参格式套一层类别和类别名称
List<DemandDataDTO> demandData=new ArrayList<>();
DemandDataDTO demandDataDTO=new DemandDataDTO();
demandDataDTO.setFirstCategoryCode(formDTO.getFirstCategoryCode());
demandDataDTO.setFirstCategoryName(demandDictService.getCategoryName(formDTO.getCustomerId(),formDTO.getFirstCategoryCode()));
demandDataDTO.setDemandList(new ArrayList<>());
demandData.add(demandDataDTO);
//如果是服务措施分析来的,并且是pc录入的需求,需要先去找epmetUserIdList
if (UserDemandConstant.DEMAND_ANALYSIS.equals(formDTO.getQueryOrigin())
&& StringUtils.isNotBlank(formDTO.getIcResiUserId())
&& CollectionUtils.isEmpty(formDTO.getEpmetUserIdList())) {
ResiUserFormDTO resiUserFormDTO = new ResiUserFormDTO();
resiUserFormDTO.setCustomerId(formDTO.getCustomerId());
resiUserFormDTO.setIcResiUserId(formDTO.getIcResiUserId());
Result<ResiUserResDTO> resiRes = epmetUserOpenFeignClient.findEpmetUser(resiUserFormDTO);
if (!resiRes.success()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询小程序用户异常");
}
if (null != resiRes.getData() && CollectionUtils.isNotEmpty(resiRes.getData().getEpmetUserIdList())) {
formDTO.setEpmetUserIdList(resiRes.getData().getEpmetUserIdList());
}
}
IcResiUserBriefDTO icResiUserDTO = userRes.getData();
DemandResearchAnalysisResultDTO resultDTO = ConvertUtils.sourceToTarget(icResiUserDTO, DemandResearchAnalysisResultDTO.class);
resultDTO.setEpmetUserIdList(CollectionUtils.isNotEmpty(formDTO.getEpmetUserIdList()) ? formDTO.getEpmetUserIdList() : Collections.emptyList());
//获取当前需求人,相同分类的需求列表。不分页,直接返回所有
List<String> userIds=new ArrayList<>();
userIds.add(formDTO.getIcResiUserId());
if(StringUtils.isNotBlank(formDTO.getIcResiUserId())){
userIds.add(formDTO.getIcResiUserId());
}
if(CollectionUtils.isNotEmpty(formDTO.getEpmetUserIdList())){
userIds.addAll(formDTO.getEpmetUserIdList());
}
if(StringUtils.isBlank(formDTO.getIcResiUserId())&&CollectionUtils.isEmpty(formDTO.getEpmetUserIdList())){
//需求人不能为空
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "需求人不能为空,icResiUserId与epmetUserIdList不能同时为空");
}
IcResiUserDemandFromDTO icResiUserDemandFromDTO=new IcResiUserDemandFromDTO();
icResiUserDemandFromDTO.setUserIds(userIds);
icResiUserDemandFromDTO.setFirstCategoryCode(formDTO.getFirstCategoryCode());
icResiUserDemandFromDTO.setDemandRecId(formDTO.getDemandRecId());
List<IcResiUserReportDemandRes> demandList = baseDao.selectUserDemand(icResiUserDemandFromDTO);
if(CollectionUtils.isNotEmpty(demandList)){
@ -603,11 +645,53 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
//一级分类名称
resDto.setFirstCategoryName(demandDictService.getCategoryName(formDTO.getCustomerId(),resDto.getFirstCategoryCode()));
}
resultDTO.setDemandList(CollectionUtils.isNotEmpty(demandList) ? demandList : Collections.emptyList());
demandData.get(NumConstant.ZERO).setDemandList(CollectionUtils.isNotEmpty(demandList) ? demandList : Collections.emptyList());
}
resultDTO.setEpmetUserIdList(CollectionUtils.isNotEmpty(formDTO.getEpmetUserIdList()) ? formDTO.getEpmetUserIdList() : Collections.emptyList());
resultDTO.setDemandData(demandData);
return resultDTO;
}
/**
* 数据分析-个人档案-需求详情研判分析
* 获取案件居民和及家属列表
*
*
* @param formDTO
* @return
*/
private HouseMemResDTO queryDemandUserFamily(DemandResearchAnalysisFormDTO formDTO) {
HouseMemResDTO houseMemResDTO=new HouseMemResDTO();
if(StringUtils.isBlank(formDTO.getIcResiUserId())&&CollectionUtils.isEmpty(formDTO.getEpmetUserIdList())){
//需求人不能为空
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "需求人不能为空,icResiUserId与epmetUserIdList不能同时为空");
}
//服务措施分析点击了PC录入的需求,或者个人档案进来的(这两种情况肯定会有icResiUserId)
if(StringUtils.isNotBlank(formDTO.getIcResiUserId())){
Result<IcResiUserBriefDTO> userRes = epmetUserOpenFeignClient.findFamilyMem(formDTO.getIcResiUserId());
if (!userRes.success() || null == userRes.getData()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取居民信息接口异常");
}
houseMemResDTO=ConvertUtils.sourceToTarget(userRes.getData(),HouseMemResDTO.class);
}
//服务措施点击了,小程序用户上报的需求
if (StringUtils.isBlank(formDTO.getIcResiUserId())&&CollectionUtils.isNotEmpty(formDTO.getEpmetUserIdList())) {
//需要找到当前这个epmetUserIdList相同身份证号的人,
//以及这个身份证号所对应的居民的家属
FindIcUserFormDTO findIcUserFormDTO=new FindIcUserFormDTO();
findIcUserFormDTO.setCustomerId(formDTO.getCustomerId());
findIcUserFormDTO.setEpmetUserId(formDTO.getEpmetUserIdList().get(NumConstant.ZERO));
Result<EpmetUserFamilyDTO> epmetUserFamilyDTOResult=epmetUserOpenFeignClient.findIcUser(findIcUserFormDTO);
if (!epmetUserFamilyDTOResult.success() || null == epmetUserFamilyDTOResult.getData()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "根据小程序用户id,获取ic居民信息接口异常");
}
houseMemResDTO=ConvertUtils.sourceToTarget(epmetUserFamilyDTOResult.getData(),HouseMemResDTO.class);
formDTO.setEpmetUserIdList(epmetUserFamilyDTOResult.getData().getEpmetUserIdList());
}
return houseMemResDTO;
}
/**
* 数分析-服务措施分析-分页查询
*
@ -617,15 +701,15 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
@Override
public PageData<DemandRecResultDTO> pageListAnalysis(PageListAnalysisFormDTO formDTO) {
if("agency".equals(formDTO.getOrgType())){
if(NumConstant.ZERO_STR.equals(formDTO.getPid())){
//找到当前组织的所有上级,再拼接上自己
Result<CustomerAgencyDTO> customerAgencyDTOResult=govOrgOpenFeignClient.getAgencyById(formDTO.getOrgId());
if(!customerAgencyDTOResult.success()||null==customerAgencyDTOResult.getData()){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取组织信息异常govOrgOpenFeignClient.getAgencyById");
}
if(NumConstant.ZERO_STR.equals(customerAgencyDTOResult.getData().getPid())){
//当前传入的组织id=客户的根组织
formDTO.setGridPids(formDTO.getOrgId());
}else{
//找到当前组织的所有上级,再拼接上自己
Result<CustomerAgencyDTO> customerAgencyDTOResult=govOrgOpenFeignClient.getAgencyById(formDTO.getOrgId());
if(!customerAgencyDTOResult.success()||null==customerAgencyDTOResult.getData()){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取组织信息异常govOrgOpenFeignClient.getAgencyById");
}
formDTO.setGridPids(customerAgencyDTOResult.getData().getPids().concat(StrConstant.COLON).concat(formDTO.getOrgId()));
}
}
@ -654,9 +738,9 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
//3、查询志愿者
// 服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;
Map<String,String> userInfoMap=new HashMap<>();
List<String> userIdList=list.stream().filter(item->item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toList());
Set<String> userIdList=list.stream().filter(item->item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toSet());
if(CollectionUtils.isNotEmpty(userIdList)){
Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList);
Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(new ArrayList<>(userIdList));
if(!userInfoRes.success()||CollectionUtils.isEmpty(userInfoRes.getData())){
throw new RenException("查询志愿者信息异常");
}
@ -691,11 +775,141 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
res.setStatusName(statusMap.containsKey(res.getStatus())?statusMap.get(res.getStatus()):StrConstant.EPMETY_STR);
//服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;
res.setServiceShowName(serviceTypeMap.containsKey(res.getServiceType())?res.getServiceName().concat("(").concat(serviceTypeMap.get(res.getServiceType())).concat(")"):StrConstant.EPMETY_STR);
res.setServiceShowFlag(StringUtils.isNotBlank(res.getServerId())?true:false);
}
}
return new PageData<>(list, total);
}
/**
* 数据分析-服务措施分析-柱状图
*
* @param formDTO
* @return
*/
@Override
public CategoryAnalysisResDTO categoryAnalysis(CategoryAnalysisFormDTO formDTO) {
//1、一级分类字典,没有分类直接退出
SubCodeFormDTO subCodeFormDTO=new SubCodeFormDTO();
subCodeFormDTO.setCustomerId(formDTO.getCusotmerId());
subCodeFormDTO.setParentCategoryCode(NumConstant.ZERO_STR);
List<OptionDTO> firstCategoryList=demandDictService.querySubCodeList(subCodeFormDTO);
if(CollectionUtils.isEmpty(firstCategoryList)){
return new CategoryAnalysisResDTO(Collections.EMPTY_LIST,Collections.EMPTY_LIST);
}
//2、没有服务类型直接退出
Result<Map<String, String>> serviceTypeRes=adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_SERVICE_TYPE.getCode());
if(!serviceTypeRes.success()||MapUtils.isEmpty(serviceTypeRes.getData())){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"查询服务方类型异常,请检查是否已经配置字典信息");
}
List<LegendDTO> legend=new ArrayList<>();
serviceTypeRes.getData().forEach((code,name)->{
LegendDTO legendDTO=new LegendDTO(code,name);
legend.add(legendDTO);
});
LegendDTO unfinishLegend = new LegendDTO("unfinished", "未完成");
legend.add(unfinishLegend);
log.info("阶段性胜利1:"+ JSON.toJSONString(legend));
// 3、传进来的是组织id的话,查询出全路径
if("agency".equals(formDTO.getOrgType())){
//找到当前组织的所有上级,再拼接上自己
Result<CustomerAgencyDTO> customerAgencyDTOResult=govOrgOpenFeignClient.getAgencyById(formDTO.getOrgId());
if(!customerAgencyDTOResult.success()||null==customerAgencyDTOResult.getData()){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取组织信息异常govOrgOpenFeignClient.getAgencyById");
}
if(NumConstant.ZERO_STR.equals(customerAgencyDTOResult.getData().getPid())){
//当前传入的组织id=客户的根组织
formDTO.setGridPids(formDTO.getOrgId());
}else{
formDTO.setGridPids(customerAgencyDTOResult.getData().getPids().concat(StrConstant.COLON).concat(formDTO.getOrgId()));
}
}
//4、构造最后的反参
List<CategoryAnalysisDTO> list=new ArrayList<>();
// firstCategoryList是所有的一级分类字典
firstCategoryList.forEach(firstCategory->{
CategoryAnalysisDTO categoryAnalysisDTO=new CategoryAnalysisDTO(firstCategory.getValue(),firstCategory.getLabel(),NumConstant.ZERO,Collections.EMPTY_LIST);
categoryAnalysisDTO.setDetail(constructDefaultDetail(legend));
list.add(categoryAnalysisDTO);
});
log.info("阶段性胜利2:"+ JSON.toJSONString(list));
// 5、查询出有数据的一级分类,sql计算出detail
List<CategoryAnalysisDTO> haveDemandList=baseDao.selectListCategoryAnalysisDTO(firstCategoryList,
formDTO.getCusotmerId(),
formDTO.getOrgId(),
formDTO.getOrgType(),
formDTO.getGridPids(),
formDTO.getStartDateId(),
formDTO.getEndDateId());
if(!CollectionUtils.isEmpty(haveDemandList)){
log.info("阶段性胜利3:"+ JSON.toJSONString(haveDemandList));
Map<String, CategoryAnalysisDTO> map = haveDemandList.stream().filter(temp -> CollectionUtils.isNotEmpty(temp.getDetail())).collect(Collectors.toMap(CategoryAnalysisDTO::getCategoryCode, dto -> dto));
if(MapUtils.isNotEmpty(map)){
log.info("阶段性胜利4:"+ JSON.toJSONString(map));
for(CategoryAnalysisDTO result:list){
if (map.containsKey(result.getCategoryCode()) && null != map.get(result.getCategoryCode())) {
//如果当前分类下有上报的需求,将原来的0改为实际的需求数量
CategoryAnalysisDTO tempDto=map.get(result.getCategoryCode());
result.setTotal(tempDto.getTotal());
//当前分类有居民的明细:未完成多少个,xxx个志愿者完成xxx个需求
if(CollectionUtils.isNotEmpty(tempDto.getDetail())){
List<CategoryAnalysisDetail> resDetailList=tempDto.getDetail();
Map<String, CategoryAnalysisDetail> detailMap = resDetailList.stream().collect(Collectors.toMap(CategoryAnalysisDetail::getLegendCode, dto -> dto));
//遍历之前构造好的图例
for(CategoryAnalysisDetail resultDetail:result.getDetail()){
if(detailMap.containsKey(resultDetail.getLegendCode())&&null!=detailMap.get(resultDetail.getLegendCode())){
resultDetail.setTotalService(detailMap.get(resultDetail.getLegendCode()).getTotalService());
resultDetail.setServiceDemandTotal(detailMap.get(resultDetail.getLegendCode()).getServiceDemandTotal());
}
}
}
}
}
}
}
//返回结果,也不知道对不对
CategoryAnalysisResDTO result=new CategoryAnalysisResDTO();
result.setLegend(legend);
result.setCategoryList(list);
return result;
}
private List<CategoryAnalysisDetail> constructDefaultDetail(List<LegendDTO> legend) {
List<CategoryAnalysisDetail> l = new ArrayList<>();
legend.forEach(legendDTO -> {
CategoryAnalysisDetail d = ConvertUtils.sourceToTarget(legendDTO, CategoryAnalysisDetail.class);
d.setServiceDemandTotal(NumConstant.ZERO);
d.setTotalService(NumConstant.ZERO);
l.add(d);
});
return l;
}
/**
* 计算出服务方评价总分服务的需求个数
*
* @param customerId
* @param partyUnitId
* @return
*/
@Override
public List<ServiceStatDTO> groupByPartyUnit(String customerId, String partyUnitId) {
if(StringUtils.isBlank(customerId)&&StringUtils.isBlank(partyUnitId)){
return new ArrayList<>();
}
return baseDao.selectGroupByPartyUnit(customerId,partyUnitId);
}
}

20
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java

@ -18,6 +18,7 @@
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.MqConstant;
import com.epmet.commons.tools.constant.NumConstant;
@ -44,12 +45,14 @@ import com.epmet.dto.result.ResiUserBaseInfoResultDTO;
import com.epmet.dto.result.SendVerificationCodeResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO;
import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO;
import com.epmet.entity.VolunteerInfoEntity;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.service.HeartUserInfoService;
import com.epmet.service.VolunteerInfoService;
import com.github.pagehelper.PageHelper;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
@ -258,4 +261,21 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
}
return resultList;
}
@Override
public List<PageVolunteerInfoResultDTO> queryVolunteerPage(String customerId, Integer pageNo, Integer pageSize) {
LambdaQueryWrapper<VolunteerInfoEntity> query = new LambdaQueryWrapper<>();
query.eq(VolunteerInfoEntity::getCustomerId, customerId);
PageHelper.startPage(pageNo, pageSize);
List<VolunteerInfoEntity> volunteerInfoEntities = baseDao.selectList(query);
List<PageVolunteerInfoResultDTO> list = volunteerInfoEntities.stream().map(vi -> {
PageVolunteerInfoResultDTO p = new PageVolunteerInfoResultDTO();
p.setUserId(vi.getUserId());
return p;
}).collect(Collectors.toList());
return list;
}
}

5
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml

@ -141,7 +141,10 @@ dingTalk:
robot:
webHook: @dingTalk.robot.webHook@
secret: @dingTalk.robot.secret@
rocketmq:
# 是否开启mq
enable: @rocketmq.enable@
name-server: @rocketmq.nameserver@
# 停机选项
shutdown:
graceful:

3
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/logback-spring.xml

@ -138,10 +138,9 @@
</appender>
<!-- 开发、测试环境 -->
<springProfile name="dev,test">
<springProfile name="local,dev,test">
<logger name="org.springframework.web" level="INFO"/>
<logger name="org.springboot.sample" level="INFO"/>
<logger name="com.epmet.dao" level="INFO"/>
<logger name="com.epmet.dao" level="DEBUG"/>
<root level="INFO">
<appender-ref ref="DEBUG_FILE"/>

6
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyUnitDao.xml

@ -74,4 +74,10 @@
ID
</select>
<update id="updateSatisfaction" parameterType="map">
update ic_party_unit
set SATISFACTION=#{satisfaction},UPDATED_TIME=NOW()
where del_flag='0'
and id=#{partyUnitId}
</update>
</mapper>

4
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml

@ -141,7 +141,7 @@
AND m.CATEGORY_CODE =#{firstCategoryCode}
</if>
ORDER BY
m.CREATED_TIME DESC
m.CREATED_TIME DESC,m.sort desc
</select>
@ -163,7 +163,7 @@
AND m.CUSTOMER_ID = #{customerId}
AND m.PARENT_CODE = #{parentCode}
ORDER BY
m.CREATED_TIME DESC
m.CREATED_TIME DESC,m.sort desc
</select>

162
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml

@ -75,7 +75,17 @@
case when r.PARENT_CODE !='0' then r.PARENT_CODE
ELSE R.CATEGORY_CODE
END
) as firstCategoryCode
) as firstCategoryCode,
(
CASE WHEN R.DEMAND_USER_TYPE='ic_resi_user' THEN R.DEMAND_USER_ID
ELSE ''
END
) as icResiUserId,
(
CASE WHEN R.DEMAND_USER_TYPE='mini_resi' THEN R.DEMAND_USER_ID
ELSE ''
END
) as epmetUserId
FROM
ic_user_demand_rec r
left JOIN ic_user_demand_service s ON ( r.id = s.DEMAND_REC_ID AND s.DEL_FLAG = '0' )
@ -90,7 +100,7 @@
AND r.GRID_PIDS LIKE concat('%',#{gridPids},'%')
</if>
<if test="null != level and level ==1">
and r.PARENT_CODE=#{categoryCode}
and (r.PARENT_CODE=#{categoryCode} or r.CATEGORY_CODE=#{categoryCode})
</if>
<if test="null != level and level ==2">
and r.CATEGORY_CODE=#{categoryCode}
@ -142,6 +152,9 @@
<if test="null !=firstCategoryCode and firstCategoryCode!=''">
and r.CATEGORY_CODE like concat(#{firstCategoryCode},'%')
</if>
<if test="null !=demandRecId and demandRecId!=''">
and r.id !=#{demandRecId}
</if>
ORDER BY
r.WANT_SERVICE_TIME DESC
</select>
@ -182,7 +195,17 @@
IFNULL(s.FINISH_DESC,'') as finishDesc,
'' AS serviceShowName,
s.id as serviceId,
left(r.CATEGORY_CODE,4) as firstCategoryCode
left(r.CATEGORY_CODE,4) as firstCategoryCode,
(
CASE WHEN R.DEMAND_USER_TYPE='ic_resi_user' THEN R.DEMAND_USER_ID
ELSE ''
END
) as icResiUserId,
(
CASE WHEN R.DEMAND_USER_TYPE='mini_resi' THEN R.DEMAND_USER_ID
ELSE ''
END
) as epmetUserId
FROM
ic_user_demand_rec r
left JOIN ic_user_demand_service s ON ( r.id = s.DEMAND_REC_ID AND s.DEL_FLAG = '0' )
@ -235,7 +258,17 @@
case when r.PARENT_CODE !='0' then r.PARENT_CODE
ELSE R.CATEGORY_CODE
END
) as firstCategoryCode
) as firstCategoryCode,
(
CASE WHEN R.DEMAND_USER_TYPE='ic_resi_user' THEN R.DEMAND_USER_ID
ELSE ''
END
) as icResiUserId,
(
CASE WHEN R.DEMAND_USER_TYPE='mini_resi' THEN R.DEMAND_USER_ID
ELSE ''
END
) as epmetUserId
FROM
ic_user_demand_rec r
left JOIN ic_user_demand_service s ON ( r.id = s.DEMAND_REC_ID AND s.DEL_FLAG = '0' )
@ -254,11 +287,128 @@
</if>
<if test=" null != startDateId and startDateId != '' ">
AND DATE_FORMAT(r.REPORT_TIME,'%Y%m%d') <![CDATA[ >= ]]> #{startDateId}
AND DATE_FORMAT(r.REPORT_TIME,'%Y-%m-%d') <![CDATA[ >= ]]> #{startDateId}
</if>
<if test="null != endDateId and endDateId != '' ">
AND DATE_FORMAT(r.REPORT_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{endDateId}
AND DATE_FORMAT(r.REPORT_TIME,'%Y-%m-%d') <![CDATA[ <= ]]> #{endDateId}
</if>
order by r.WANT_SERVICE_TIME desc,r.REPORT_TIME asc
</select>
<resultMap id="CategoryAnalysisDTOMap" type="com.epmet.dto.result.demand.CategoryAnalysisDTO">
<result property="categoryCode" column="category_code"/>
<result property="categoryName" column="category_name"/>
<result property="total" column="TOTAL"/>
<collection property="detail" ofType="com.epmet.dto.result.demand.CategoryAnalysisDetail"
column="{categoryCode=category_code, orgType=org_type,orgId=org_id,gridPids=grid_pids,customerId=customer_id,startDateId=start_date_id,endDateId=end_date_id}"
select="com.epmet.dao.IcUserDemandRecDao.selectDetail">
</collection>
</resultMap>
<select id="selectListCategoryAnalysisDTO" parameterType="map" resultMap="CategoryAnalysisDTOMap">
<foreach collection="firstCategoryList" item="category" separator=" UNION ALL ">
select
#{category.value} as category_code,
#{category.label} as category_name,
count(m.id) as TOTAL,
#{orgType} as org_type,
#{orgId} as org_id,
#{gridPids} as grid_pids,
#{customerId} as customer_id,
#{startDateId} as start_date_id,
#{endDateId} as end_date_id
from ic_user_demand_rec m
where m.DEL_FLAG='0'
and m.CUSTOMER_ID=#{customerId}
<if test="null != orgType and orgType == 'grid' ">
and m.GRID_ID=#{orgId}
</if>
<if test="null != orgType and orgType == 'agency' ">
and m.GRID_PIDS like concat(#{gridPids},'%')
</if>
and DATE_FORMAT(m.REPORT_TIME,'%Y-%m-%d') &gt;= #{startDateId}
and DATE_FORMAT(m.REPORT_TIME,'%Y-%m-%d') &lt;= #{endDateId}
and m.CATEGORY_CODE like concat(#{category.value},'%')
and m.status !='canceled'
</foreach>
</select>
<select id="selectDetail" parameterType="map" resultType="com.epmet.dto.result.demand.CategoryAnalysisDetail">
select
#{categoryCode} as categoryCode,
s.SERVICE_TYPE as legendCode,
(
case when s.SERVICE_TYPE='volunteer' then '志愿者'
when s.SERVICE_TYPE='social_org' then '社会组织'
when s.SERVICE_TYPE='community_org' then '社区自组织'
when s.SERVICE_TYPE='party_unit' then '区域化党建单位'
end
)as legendName,
count(s.DEMAND_REC_ID) as serviceDemandTotal,
count(distinct s.SERVER_ID) as totalService
from ic_user_demand_service s
inner join ic_user_demand_rec m
on(s.DEMAND_REC_ID=m.ID)
where s.DEL_FLAG='0'
and m.DEL_FLAG='0'
and m.`STATUS`='finished'
and m.CUSTOMER_ID=#{customerId}
<if test="null != orgType and orgType == 'grid' ">
and m.GRID_ID=#{orgId}
</if>
<if test="null != orgType and orgType == 'agency' ">
and m.GRID_PIDS like concat(#{gridPids},'%')
</if>
and DATE_FORMAT(m.REPORT_TIME,'%Y-%m-%d') &gt;= #{startDateId}
and DATE_FORMAT(m.REPORT_TIME,'%Y-%m-%d') &lt;= #{endDateId}
and m.CATEGORY_CODE like concat(#{categoryCode},'%')
group by s.SERVICE_TYPE
union all
select
#{categoryCode} as categoryCode,
'unfinished' as legendCode,
'未完成' as legendName,
count(m.id) as serviceDemandTotal,
'0' as totalService
from ic_user_demand_rec m
where m.DEL_FLAG='0'
and m.`STATUS`!='finished'
and m.STATUS !='canceled'
and m.CUSTOMER_ID=#{customerId}
<if test="null != orgType and orgType == 'grid' ">
and m.GRID_ID=#{orgId}
</if>
<if test="null != orgType and orgType == 'agency' ">
and m.GRID_PIDS like concat(#{gridPids},'%')
</if>
and DATE_FORMAT(m.REPORT_TIME,'%Y-%m-%d') &gt;= #{startDateId}
and DATE_FORMAT(m.REPORT_TIME,'%Y-%m-%d') &lt;= #{endDateId}
and m.CATEGORY_CODE like concat(#{categoryCode},'%')
</select>
<select id="selectGroupByPartyUnit" parameterType="map" resultType="com.epmet.dto.result.demand.ServiceStatDTO">
SELECT
S.SERVER_ID AS serverId,
SUM( M.SCORE ) AS totalScore,
count( DISTINCT m.DEMAND_REC_ID ) AS demandCount
FROM
ic_user_demand_satisfaction m
INNER JOIN ic_user_demand_rec r ON ( m.DEMAND_REC_ID = r.id )
INNER JOIN ic_user_demand_service s ON ( R.ID = s.DEMAND_REC_ID )
WHERE
m.DEL_FLAG = '0'
AND r.DEL_FLAG = '0'
AND m.CUSTOMER_ID = #{customerId}
AND r.`STATUS` = 'finished'
and s.SERVICE_TYPE ='party_unit'
<if test="null !=partyUnitId and partyUnitId!='' ">
and s.server_id=#{partyUnitId}
</if>
group by s.SERVER_ID
</select>
</mapper>

23
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsDemandTask.java

@ -0,0 +1,23 @@
package com.epmet.task;
import com.epmet.feign.DataStatisticalOpenFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @Description
* @Author wangxianzhang
* @Date 2021/12/13 9:40 上午
* @Version 1.0
*/
@Component("statsDemandTask")
public class StatsDemandTask implements ITask {
@Autowired
private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient;
@Override
public void run(String params) {
dataStatisticalOpenFeignClient.statsVolunteerDemandServicesDaily(null);
}
}

4
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java

@ -100,4 +100,8 @@ public interface SystemMessageType {
*/
String IC_RESI_USER_DEL = "ic_resi_user_del";
/**
* 需求完成如果服务方是区域化党建单位重新计算这个单位的满意度
*/
String CAL_PARTY_UNIT_SATISFACTION = "cal_party_unit_satisfaction";
}

3
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java

@ -192,6 +192,9 @@ public class SystemMessageServiceImpl implements SystemMessageService {
case SystemMessageType.IC_RESI_USER_DEL:
topic = TopicConstants.IC_RESI_USER;
break;
case SystemMessageType.CAL_PARTY_UNIT_SATISFACTION:
topic=TopicConstants.CAL_PARTY_UNIT_SATISFACTION;
break;
}
return topic;
}

5
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectCategoryDictDTO.java

@ -113,4 +113,9 @@ public class IssueProjectCategoryDictDTO implements Serializable {
*/
private Date updatedTime;
/**
* 颜色
*/
private String colour;
}

4
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/CategoryListResultDTO.java

@ -30,7 +30,7 @@ public class CategoryListResultDTO implements Serializable {
/**
* 颜色
*/
private String colour;
private String color;
/**
* 1级分类长度
@ -42,6 +42,6 @@ public class CategoryListResultDTO implements Serializable {
this.categoryName = "";
this.count = NumConstant.ZERO;
this.codeLength = NumConstant.ZERO;
this.colour = "";
this.color = "";
}
}

4
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueResultDTO.java

@ -1,8 +1,10 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Author zxc
@ -49,4 +51,6 @@ public class IssueResultDTO implements Serializable {
*/
private String gridName;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date shiftIssueTime;
}

13
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzDTO.java

@ -5,6 +5,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @Author zxc
@ -72,7 +74,7 @@ public class ResiBuzzDTO implements Serializable {
/**
* 分类名字
*/
private String categoryName;
private List<String> categoryName;
public ResiBuzzDTO() {
this.createdBy = "";
@ -86,6 +88,13 @@ public class ResiBuzzDTO implements Serializable {
this.oppositionCount = NumConstant.ZERO;
this.voteAccount = "";
this.issueOriginator = "";
this.categoryName = "其他";
this.categoryName = getDefaultCategoryName();
}
@JsonIgnore
public List<String> getDefaultCategoryName(){
List<String> list = new ArrayList<>();
list.add("其他");
return list;
}
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save