Browse Source

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

dev_shibei_match
zhaoqifeng 4 years ago
parent
commit
f4fc39fa26
  1. 5
      epmet-commons/epmet-commons-rocketmq/pom.xml
  2. 5
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java
  3. 10
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java
  4. 27
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/GroupAchievementMQMsg.java
  5. 43
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/ConsumerConfigProperties.java
  6. 79
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQConsumerRegister.java
  7. 2
      epmet-commons/epmet-commons-tools/pom.xml
  8. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java
  9. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseParamDTO.java
  10. 23
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java
  11. 49
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/AchievementTypeEnum.java
  12. 28
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/BizTypeEnum.java
  13. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java
  14. 31
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/SourceTypeEnum.java
  15. 11
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
  16. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java
  17. 21
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SendMqMsgUtils.java
  18. 21
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/UniqueIdGenerator.java
  19. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/OkHttpUtil.java
  20. 26
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexExcelDataListener.java
  21. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java
  22. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java
  23. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/IndexGroupServiceImpl.java
  24. 1
      epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.11__groupAchievementRule.sql
  25. 1
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java
  26. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
  27. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java
  28. 1
      epmet-module/epmet-message/epmet-message-client/pom.xml
  29. 5
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java
  30. 32
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/send/SendMqMsgUtil.java
  31. 3
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java
  32. 101
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/BizPointTotalDetailDTO.java
  33. 106
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/BizPointUserTotalDetailDTO.java
  34. 12
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/UserPointActionLogDTO.java
  35. 17
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/GroupPointFormDTO.java
  36. 38
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/GroupPointRankingResultDTO.java
  37. 26
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/GroupPointRuleResultDTO.java
  38. 44
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointRankingResultDTO.java
  39. 6
      epmet-module/epmet-point/epmet-point-server/pom.xml
  40. 96
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/GroupPointController.java
  41. 43
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/BizPointTotalDetailDao.java
  42. 44
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/BizPointUserTotalDetailDao.java
  43. 10
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java
  44. 71
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/BizPointTotalDetailEntity.java
  45. 76
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/BizPointUserTotalDetailEntity.java
  46. 12
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/UserPointActionLogEntity.java
  47. 129
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/BizPointTotalDetailService.java
  48. 143
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/BizPointUserTotalDetailService.java
  49. 10
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointRuleService.java
  50. 10
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java
  51. 212
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/BizPointTotalDetailServiceImpl.java
  52. 251
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/BizPointUserTotalDetailServiceImpl.java
  53. 5
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdjustmentLogServiceImpl.java
  54. 38
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java
  55. 130
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java
  56. 3
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/ModuleConstant.java
  57. 3
      epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.10__updateRule.sql
  58. 40
      epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.9__groupPoint.sql
  59. 33
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/BizPointTotalDetailDao.xml
  60. 32
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/BizPointUserTotalDetailDao.xml
  61. 8
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml
  62. 8
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml
  63. 8
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java
  64. 5
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java
  65. 1
      epmet-module/gov-issue/gov-issue-server/pom.xml
  66. 18
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueController.java
  67. 10
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java
  68. 27
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java
  69. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java
  70. 100
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgListener.java
  71. 22
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgRolesListener.java
  72. 62
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java
  73. 55
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/listener/InitCustomerComponentsListener.java
  74. 3
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java
  75. 111
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupAchievementStatsDTO.java
  76. 18
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupDTO.java
  77. 5
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupInfoRedisDTO.java
  78. 17
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupFormDTO.java
  79. 41
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/AchievementDetailResultDTO.java
  80. 4
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GovGroupSummarizeResultDTO.java
  81. 46
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupPointDetailResultDTO.java
  82. 2
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupSummarizeResultDTO.java
  83. 18
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/AchievementResultDTO.java
  84. 18
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/GroupAchievementDTO.java
  85. 35
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java
  86. 44
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java
  87. 24
      epmet-module/resi-group/resi-group-server/pom.xml
  88. 79
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java
  89. 57
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupAchievementConfigDao.java
  90. 68
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupAchievementStatsDao.java
  91. 10
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java
  92. 58
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupAchievementConfigEntity.java
  93. 86
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupAchievementStatsEntity.java
  94. 5
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java
  95. 1
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupRedis.java
  96. 138
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/AbstractStatsAchievementService.java
  97. 36
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupAchievementConfigService.java
  98. 84
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupAchievementStatsService.java
  99. 48
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java
  100. 51
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/StatsAchievementService.java

5
epmet-commons/epmet-commons-rocketmq/pom.xml

@ -16,6 +16,11 @@
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-spring-boot-starter</artifactId>
<version>2.0.1</version>
<!--<version>2.2.0</version>-->
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>

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

@ -26,4 +26,9 @@ public interface ConsomerGroupConstants {
*/
String PROJECT_CHANGED_COMPONENTS_GROUP = "project_changed_components_group";
/**
* 小组成就消费者组
*/
String GROUP_ACHIEVEMENT_COMPONENTS_GROUP = "group_achievement_components_group";
}

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

@ -1,6 +1,16 @@
package com.epmet.commons.rocketmq.constants;
public interface TopicConstants {
/**
* 初始化客户
*/
String INIT_CUSTOMER = "init_customer";
/**
* 项目变动
*/
String PROJECT_CHANGED = "project_changed";
/**
* 小组成就
*/
String GROUP_ACHIEVEMENT = "group_achievement";
}

27
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/GroupAchievementMQMsg.java

@ -0,0 +1,27 @@
package com.epmet.commons.rocketmq.messages;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.io.Serializable;
/**
* desc:小组成就mq消息类
*
* @author LiuJanJun
* @date 2021/4/22 8:35 下午
*/
@Data
@AllArgsConstructor
public class GroupAchievementMQMsg implements Serializable {
private String customerId;
private String groupId;
/**
* 成就类型
* @see com.epmet.modules.enums.AchievementTypeEnum
*/
private String achievementType;
}

43
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/ConsumerConfigProperties.java

@ -0,0 +1,43 @@
package com.epmet.commons.rocketmq.register;
import lombok.Data;
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
import java.io.Serializable;
/**
* desc:mq 消费配置类
*
* @author: LiuJanJun
* @date: 2021/4/30 2:39 下午
* @version: 1.0
*/
@Data
public class ConsumerConfigProperties implements Serializable {
private static final long serialVersionUID = 2069676324708473773L;
/**
* 消费者组
*/
private String consumerGroup;
/**
* 主题
*/
private String topic;
/**
* 标签
*/
private String tag = "*";
/**
* 最小消费的线程数
*/
private int consumeThreadMin = 2;
/**
* 最大消费的线程数
*/
private int consumeThreadMax = 4;
/**
* 消费监听器
*/
private MessageListenerConcurrently consumerListener;
}

79
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQConsumerRegister.java

@ -0,0 +1,79 @@
package com.epmet.commons.rocketmq.register;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
import org.springframework.beans.factory.annotation.Value;
import javax.annotation.PostConstruct;
/**
* desc注册mq监听器
*
* @author liujianjun
*/
@Slf4j
public abstract class MQConsumerRegister {
@Value("${spring.profiles.active}")
private String env;
@Value("${rocketmq.name-server}")
private String namesrvAddr;
public abstract ConsumerConfigProperties getConsumerProperty();
/**
* @return
* @Description 注册监听器
* @author wxz
* @date 2021.03.03 16:09
*/
@PostConstruct
public void registerMQListener() {
ConsumerConfigProperties consumerProperty = getConsumerProperty();
log.info("registerAllListeners consumers:{} success", consumerProperty);
//本地环境不注册
//if (!"local".equals(env)) {
try {
// 实例化消费者
DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(consumerProperty.getConsumerGroup());
// 设置NameServer的地址
consumer.setNamesrvAddr(namesrvAddr);
consumer.setMessageModel(MessageModel.CLUSTERING);
consumer.setInstanceName(buildInstanceName());
// 订阅一个或者多个Topic,以及Tag来过滤需要消费的消息
consumer.subscribe(consumer.getConsumerGroup(), consumerProperty.getTag());
// 注册回调实现类来处理从broker拉取回来的消息
consumer.registerMessageListener(consumerProperty.getConsumerListener());
consumer.setConsumeThreadMin(consumerProperty.getConsumeThreadMin());
consumer.setConsumeThreadMax(consumerProperty.getConsumeThreadMax());
// 启动消费者实例
consumer.start();
} catch (MQClientException e) {
log.info("registerMQListener exception", e);
}
//}
}
/**
* desc: 因为docker-compose部署有问题 所有自己命名
*
* @param
* @return java.lang.String
* @author LiuJanJun
* @date 2021/4/30 5:00 下午
*/
private String buildInstanceName() {
String instanceName = "";
for (int i = 0; i < 4; i++) {
int t = (int) (Math.random() * 10);
instanceName = instanceName.concat(t + "");
}
return instanceName;
}
}

2
epmet-commons/epmet-commons-tools/pom.xml

@ -134,7 +134,7 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
<version>4.5.13</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java

@ -41,6 +41,7 @@ public interface NumConstant {
int SIXTY = 60;
int ONE_HUNDRED = 100;
int TWO_HUNDRED = 200;
int FIVE_HUNDRED = 500;
BigDecimal ONE_HUNDRED_DECIMAL = new BigDecimal(100);
BigDecimal ZERO_DECIMAL = new BigDecimal(0);
int ONE_THOUSAND = 1000;

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseParamDTO.java

@ -14,5 +14,4 @@ import java.io.Serializable;
public class MqBaseParamDTO implements Serializable {
private String appId;
private String token;
private String requestUrl;
}

23
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java

@ -29,6 +29,22 @@ public class BasePointEventMsg implements Serializable {
* 客户Id
*/
private String customerId;
/**
* 机关Id
*/
private String agencyId;
/**
* 网格Id
*/
private String gridId;
/**
* 小组ID
*/
private String groupId;
/**
* 被操作用户id
*/
@ -54,6 +70,11 @@ public class BasePointEventMsg implements Serializable {
*/
private String remark;
/**
* 业务类型 eg活动id
*/
private String sourceType;
/**
* 业务id eg活动id
*/
@ -69,4 +90,6 @@ public class BasePointEventMsg implements Serializable {
private Date targetDate;
private String eventTag;
private String eventClass;
}

49
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/AchievementTypeEnum.java

@ -0,0 +1,49 @@
package com.epmet.commons.tools.enums;
/**
* 小组成就类型枚举类
* dev|test|prod
*
* @author jianjun liu
* @date 2020-07-03 11:14
**/
public enum AchievementTypeEnum {
/**
* 环境变量枚举
*/
MEMBER("member", "小组成员数"),
TOPIC("topic", "话题数"),
TOISSUE("toissue", "转议题数"),
RESOVLE_TOPIC("resovletopic", "解决话题数"),
;
private String code;
private String name;
AchievementTypeEnum(String code, String name) {
this.code = code;
this.name = name;
}
public static AchievementTypeEnum getEnum(String code) {
AchievementTypeEnum[] values = AchievementTypeEnum.values();
for (AchievementTypeEnum value : values) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
}

28
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/BizTypeEnum.java

@ -0,0 +1,28 @@
package com.epmet.commons.tools.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/4/25 15:49
*/
@Getter
@AllArgsConstructor
public enum BizTypeEnum {
//枚举类型
GROUP("group", "小组"),
ACTIVITY("activity", "活动"),
AGENCY("agency", "组织");
/**
* 类型
*/
private String type;
/**
* 描述
*/
private String typeDesc;
}

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java

@ -17,6 +17,7 @@ public enum EventEnum {
TOPIC_SHIFTED_TO_ISSUE("topic_to_issue","resi_group","话题被转为议题(小组中发布的话题被组长转为议题)"),
SHIFT_TOPIC_TO_ISSUE("shift_topic_to_issue","resi_group","转话题为议题(将自建小组中话题转为议题)"),
TOPIC_SHIFTED_TO_PROJECT("topic_to_project","resi_group","话题被转为项目"),
LEADER_RESOLVE_TOPIC("leader_resolve_topic","resi_group","组长解决组内话题"),
;
private String eventClass;

31
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/SourceTypeEnum.java

@ -0,0 +1,31 @@
package com.epmet.commons.tools.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/4/25 16:23
*/
@Getter
@AllArgsConstructor
public enum SourceTypeEnum {
//枚举类型
ACTIVITY("activity", "活动"),
TOPIC("topic", "话题"),
ISSUE("issue", "议题"),
PROJECT("project", "项目"),
INVITE("invite", "邀请进组"),
MANUAL("manual", "人工调整"),
VOLUNTEER("volunteer", "志愿者");
/**
* 类型
*/
private String type;
/**
* 描述
*/
private String typeDesc;
}

11
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java

@ -558,6 +558,17 @@ public class DateUtils {
return format.format(timestamp * 1000);
}
/**
* 日期格式转时间戳
* @author zhaoqifeng
* @date 2021/4/19 14:52
* @param date
* @return java.lang.Long
*/
public static Long dateToTimestamp(Date date) {
return date.getTime()/NumConstant.ONE_THOUSAND;
}
/**
* @return java.util.Date
* @param minStr yyyy-MM-dd HH:mm字符串

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java

@ -101,6 +101,7 @@ public class HttpClientManager {
private static RequestConfig requestConfig = RequestConfig.custom()
.setSocketTimeout(soTimeout)
.setConnectTimeout(connectionTimeout)
.setConnectionRequestTimeout(soTimeout)
.build();//设置请求和传输超时时间
public static HttpClientManager getInstance() {

21
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SendMqMsgUtils.java

@ -29,6 +29,8 @@ import java.util.Map;
@Component
public class SendMqMsgUtils {
private static MqConfig mqConfig;
private static String requestUrl;
/**
* desc:发送mq消息(如果失败重试1次)
@ -39,22 +41,23 @@ public class SendMqMsgUtils {
if (mqConfig == null) {
mqConfig = SpringContextUtils.getBean(MqConfig.class);
}
log.info("sendMsg param:{}", JSON.toJSONString(msg));
if (requestUrl == null){
requestUrl = mqConfig.getHost().concat(MqMethodPathEnum.SEND_MSG.getCode());
}
try {
// TODO
ValidatorUtils.validateEntity(msg, DefaultGroup.class);
} catch (ValidateException e) {
return new Result<String>().error(e.getMsg());
}
msg.setAppId(mqConfig.getAppId());
msg.setRequestUrl(mqConfig.getHost().concat(MqMethodPathEnum.SEND_MSG.getCode()));
msg.setToken(mqConfig.getToken());
try {
int retryTime = 0;
Result<String> result = null;
log.info("sendMsg url:{},param:{}", requestUrl, JSON.toJSONString(msg));
do {
result = HttpClientManager.getInstance().sendPostByHttps(requestUrl, JSON.toJSONString(msg));
retryTime++;
result = HttpClientManager.getInstance().sendPostByHttps(msg.getRequestUrl(), JSON.toJSONString(msg));
log.info("sendMsg retryTime:{},result:{}", retryTime, JSON.toJSONString(result));
} while ((!result.success()) && retryTime < 2);
@ -78,6 +81,16 @@ public class SendMqMsgUtils {
}
}
public static void main(String[] args) {
mqConfig = new MqConfig();
mqConfig.setAppId("202007161443499985fa2d397436d10356542134c8f008c48");
mqConfig.setToken("52d9d9b0e7d0eb5b8b81c205b579e07c");
mqConfig.setHost("https://epmet-dev.elinkservice.cn/estos/");
String msg = "{\"eventClass\":\"resi_group\",\"eventTag\":\"shift_topic_to_issue\",\"msg\":\"[{\\\"actionFlag\\\":\\\"plus\\\",\\\"agencyId\\\":\\\"e9b55911549fe7b0d0427b557f7c5efc\\\",\\\"customerId\\\":\\\"45687aa479955f9d06204d415238f7cc\\\",\\\"eventClass\\\":\\\"resi_group\\\",\\\"eventTag\\\":\\\"topic_to_issue\\\",\\\"gridId\\\":\\\"708a3567b54ced7219666489f9d838ab\\\",\\\"groupId\\\":\\\"5b0bc6c3c409de4b7e2fdc5c13c43b1e\\\",\\\"isCommon\\\":false,\\\"remark\\\":\\\"支部测试1小组中发布的话题\\\\\\\"33\\\\\\\"被转为议题\\\",\\\"sourceId\\\":\\\"798f4081dbe94435a55c5004c7d01458\\\",\\\"sourceType\\\":\\\"issue\\\",\\\"userId\\\":\\\"3e12b2264da616f85def807e89dd7150\\\"},{\\\"actionFlag\\\":\\\"plus\\\",\\\"agencyId\\\":\\\"e9b55911549fe7b0d0427b557f7c5efc\\\",\\\"customerId\\\":\\\"45687aa479955f9d06204d415238f7cc\\\",\\\"eventTag\\\":\\\"shift_topic_to_issue\\\",\\\"gridId\\\":\\\"708a3567b54ced7219666489f9d838ab\\\",\\\"groupId\\\":\\\"5b0bc6c3c409de4b7e2fdc5c13c43b1e\\\",\\\"isCommon\\\":false,\\\"remark\\\":\\\"将话题\\\\\\\"33\\\\\\\"转为议题\\\",\\\"sourceId\\\":\\\"798f4081dbe94435a55c5004c7d01458\\\",\\\"sourceType\\\":\\\"issue\\\",\\\"userId\\\":\\\"3e12b2264da616f85def807e89dd7150\\\"}]\"}";
MqBaseMsgDTO mqBaseMsgDTO = JSON.parseObject(msg, MqBaseMsgDTO.class);
Result<String> stringResult = sendMsg(mqBaseMsgDTO);
}
/**
* desc:发送mq消息

21
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/UniqueIdGenerator.java

@ -11,6 +11,8 @@ import java.util.concurrent.atomic.AtomicLong;
* 唯一ID生成器
*/
public class UniqueIdGenerator {
public final static String FORMAT_DMDHS = "yyyyMMddHHmmss";
private static UniqueValue uniqueValue = new UniqueValue();
private static String middle;
@ -25,7 +27,7 @@ public class UniqueIdGenerator {
private static class UniqueValue {
private AtomicLong uniqueValue = new AtomicLong(0L);
private volatile String currentTime = DateUtils.format(new Date(), DateUtils.DATE_TIME_NO_SPLIT);
private volatile String currentTime = DateUtils.format(new Date(), FORMAT_DMDHS);
private volatile String lastTime = currentTime;
/**
@ -35,7 +37,7 @@ public class UniqueIdGenerator {
* @return
*/
public String getCurrentTime() {
currentTime = DateUtils.format(new Date(), DateUtils.DATE_TIME_NO_SPLIT);
currentTime = DateUtils.format(new Date(), FORMAT_DMDHS);
if (!currentTime.equals(lastTime)) {
lastTime = currentTime;
Random random = new Random();
@ -51,31 +53,32 @@ public class UniqueIdGenerator {
/**
* 生成一个24位唯一ID
* 15位时间+2位中间值防止多服务冲突+2个线程code+5位秒级递增值
* 14位时间+2位中间值防止多服务冲突+3个线程code+5位秒级递增值
*
* @return
*/
public static String generate() {
public static String generate24() {
StringBuilder builder = new StringBuilder(32);
builder.append(uniqueValue.getCurrentTime())
.append(middle)
.append(getUniqueThreadCode())
.append(getUniqueThreadCode(3))
.append(uniqueValue.getCurrentValue());
return builder.toString();
}
public static String getUniqueThreadCode() {
String threadCode = StringUtils.left(String.valueOf(Thread.currentThread().hashCode()), 2);
return StringUtils.leftPad(threadCode, 2, "0");
public static String getUniqueThreadCode(Integer length) {
String threadCode = StringUtils.left(String.valueOf(Thread.currentThread().hashCode()), length);
return StringUtils.leftPad(threadCode, length, "0");
}
public static void main(String[] args) throws InterruptedException {
System.out.println(UniqueIdGenerator.uniqueValue.currentTime);
System.out.println(UniqueIdGenerator.middle);
System.out.println(UniqueIdGenerator.getUniqueThreadCode());
System.out.println(UniqueIdGenerator.getUniqueThreadCode(2));
System.out.println(uniqueValue.getCurrentValue());
System.out.println(UniqueIdGenerator.generate24());
}
}

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/OkHttpUtil.java

@ -48,6 +48,7 @@ public class OkHttpUtil {
//支持HTTPS请求,跳过证书验证
clientBuilder.sslSocketFactory(SSLSocketClient.getSSLSocketFactory(), SSLSocketClient.getX509TrustManager())
.hostnameVerifier(SSLSocketClient.getHostnameVerifier());
//clientBuilder.followRedirects(false).followSslRedirects(false);
//clientBuilder.sslSocketFactory(createSSLSocketFactory());
/*clientBuilder.hostnameVerifier(new HostnameVerifier() {
@Override

26
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexExcelDataListener.java

@ -157,7 +157,7 @@ public class IndexExcelDataListener extends AnalysisEventListener<IndexModel> {
group1 = new IndexGroupTemplateEntity();
group1.setIndexId(indexDictEntity.getId());
group1.setParentIndexGroupId("0");
group1.setId(UniqueIdGenerator.generate());
group1.setId(UniqueIdGenerator.generate24());
group1.setIndexCode(Pinyin4jUtil.getSpellPinYin(indexDictEntity.getIndexName(), true, 4));
group1.setAllIndexCodePath(index.getAllIndexCodePath(0));
indexGroupMap.put(index.getLevel1Index(), group1);
@ -173,7 +173,7 @@ public class IndexExcelDataListener extends AnalysisEventListener<IndexModel> {
group2 = new IndexGroupTemplateEntity();
group2.setIndexId(indexDictEntity.getId());
group2.setParentIndexGroupId(group1.getId());
group2.setId(UniqueIdGenerator.generate());
group2.setId(UniqueIdGenerator.generate24());
group2.setIndexCode(Pinyin4jUtil.getSpellPinYin(indexDictEntity.getIndexName(), false, 4));
group2.setAllIndexCodePath(index.getAllIndexCodePath(3));
indexGroupMap.put(level4IndexDetailKey, group2);
@ -184,7 +184,7 @@ public class IndexExcelDataListener extends AnalysisEventListener<IndexModel> {
templateEntity.setIndexGroupId(group1.getId());
templateEntity.setIndexId(indexDictEntity.getId());
templateEntity.setAllParentIndexCode(allIndexCodeSb.toString());
templateEntity.setId(UniqueIdGenerator.generate());
templateEntity.setId(UniqueIdGenerator.generate24());
templateEntity.setCorrelation(index.getCorrelation());
templateEntity.setAllIndexCodePath(index.getAllIndexCodePath(3));
buildIndexGroupDetail(templateEntity, indexDictEntity, index, 2);
@ -202,7 +202,7 @@ public class IndexExcelDataListener extends AnalysisEventListener<IndexModel> {
templateEntity.setIndexGroupId(group2.getId());
templateEntity.setIndexId(indexDictEntity.getId());
templateEntity.setAllParentIndexCode(allIndexCodeSb.toString());
templateEntity.setId(UniqueIdGenerator.generate());
templateEntity.setId(UniqueIdGenerator.generate24());
templateEntity.setCorrelation(index.getCorrelation());
templateEntity.setAllIndexCodePath(index.getAllIndexCodePath(4));
buildIndexGroupDetail(templateEntity, indexDictEntity, index, 5);
@ -217,7 +217,7 @@ public class IndexExcelDataListener extends AnalysisEventListener<IndexModel> {
group1 = new IndexGroupTemplateEntity();
group1.setIndexId(indexDictEntity.getId());
group1.setParentIndexGroupId("0");
group1.setId(UniqueIdGenerator.generate());
group1.setId(UniqueIdGenerator.generate24());
group1.setIndexCode(Pinyin4jUtil.getSpellPinYin(indexDictEntity.getIndexName(), false, 4));
group1.setAllIndexCodePath(index.getAllIndexCodePath(0));
indexGroupMap.put(index.getLevel1Index(), group1);
@ -232,7 +232,7 @@ public class IndexExcelDataListener extends AnalysisEventListener<IndexModel> {
group2 = new IndexGroupTemplateEntity();
group2.setIndexId(indexDictEntity.getId());
group2.setParentIndexGroupId(group1.getId());
group2.setId(UniqueIdGenerator.generate());
group2.setId(UniqueIdGenerator.generate24());
group2.setIndexCode(Pinyin4jUtil.getSpellPinYin(indexDictEntity.getIndexName(), false, 4));
group2.setAllIndexCodePath(index.getAllIndexCodePath(1));
indexGroupMap.put(level2IndexGroupKey, group2);
@ -243,7 +243,7 @@ public class IndexExcelDataListener extends AnalysisEventListener<IndexModel> {
templateEntity.setIndexGroupId(group2.getId());
templateEntity.setIndexId(indexDictEntity.getId());
templateEntity.setAllParentIndexCode(allIndexCodeSb.toString());
templateEntity.setId(UniqueIdGenerator.generate());
templateEntity.setId(UniqueIdGenerator.generate24());
templateEntity.setCorrelation(index.getCorrelation());
templateEntity.setAllIndexCodePath(index.getAllIndexCodePath(1));
buildIndexGroupDetail(templateEntity, indexDictEntity, index, 2);
@ -260,7 +260,7 @@ public class IndexExcelDataListener extends AnalysisEventListener<IndexModel> {
templateEntity.setIndexGroupId(group2.getId());
templateEntity.setIndexId(indexDictEntity.getId());
templateEntity.setAllParentIndexCode(allIndexCodeSb.toString());
templateEntity.setId(UniqueIdGenerator.generate());
templateEntity.setId(UniqueIdGenerator.generate24());
templateEntity.setCorrelation(index.getCorrelation());
templateEntity.setAllIndexCodePath(index.getAllIndexCodePath(4));
buildIndexGroupDetail(templateEntity, indexDictEntity, index, 5);
@ -289,7 +289,7 @@ public class IndexExcelDataListener extends AnalysisEventListener<IndexModel> {
private void buildIndexDicEntity(IndexModel data, IndexDictEntity entity, IndexDictEntity entity2, IndexDictEntity entity3, IndexDictEntity entity4, IndexDictEntity entity5) {
if (!indexDicMap.containsKey(data.getLevel1Index())) {
entity.setId(UniqueIdGenerator.generate());
entity.setId(UniqueIdGenerator.generate24());
entity.setIndexName(data.getLevel1Index());
entity.setCorrelation(data.getCorrelation());
entity.setLevel("1");
@ -297,7 +297,7 @@ public class IndexExcelDataListener extends AnalysisEventListener<IndexModel> {
indexDicMap.put(data.getLevel1Index(), entity);
}
if (!indexDicMap.containsKey(data.getLevel2Index())) {
entity2.setId(UniqueIdGenerator.generate());
entity2.setId(UniqueIdGenerator.generate24());
entity2.setIndexName(data.getLevel2Index());
entity2.setCorrelation(data.getCorrelation());
entity2.setLevel("2");
@ -305,7 +305,7 @@ public class IndexExcelDataListener extends AnalysisEventListener<IndexModel> {
indexDicMap.put(data.getLevel2Index(), entity2);
}
if (!indexDicMap.containsKey(data.getLevel3Index())) {
entity3.setId(UniqueIdGenerator.generate());
entity3.setId(UniqueIdGenerator.generate24());
entity3.setIndexName(data.getLevel3Index());
entity3.setCorrelation(data.getCorrelation());
entity3.setLevel("3");
@ -313,7 +313,7 @@ public class IndexExcelDataListener extends AnalysisEventListener<IndexModel> {
indexDicMap.put(data.getLevel3Index(), entity3);
}
if (!indexDicMap.containsKey(data.getLevel4Index())) {
entity4.setId(UniqueIdGenerator.generate());
entity4.setId(UniqueIdGenerator.generate24());
entity4.setIndexName(data.getLevel4Index());
entity4.setCorrelation(data.getCorrelation());
entity4.setLevel("4");
@ -321,7 +321,7 @@ public class IndexExcelDataListener extends AnalysisEventListener<IndexModel> {
indexDicMap.put(data.getLevel4Index(), entity4);
}
if (!indexDicMap.containsKey(data.getLevel5Index())) {
entity5.setId(UniqueIdGenerator.generate());
entity5.setId(UniqueIdGenerator.generate24());
entity5.setIndexName(data.getLevel5Index());
entity5.setCorrelation(data.getCorrelation());
entity5.setLevel("5");

16
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java

@ -34,6 +34,7 @@ import java.util.stream.Collectors;
* @date 2021.03.03 16:10
*/
@Slf4j
//@Component
public class ProjectChangedCustomListener implements MessageListenerConcurrently {
private Logger logger = LoggerFactory.getLogger(getClass());
@ -56,7 +57,10 @@ public class ProjectChangedCustomListener implements MessageListenerConcurrently
private void consumeMessage(String msg) {
logger.info("receive customerId:{}", JSON.toJSONString(msg));
ProjectChangedMQMsg msgObj = JSON.parseObject(msg, ProjectChangedMQMsg.class);
if (msgObj == null){
log.warn("consumeMessage msg body is blank");
return;
}
DistributedLock distributedLock = null;
RLock lock = null;
try {
@ -115,4 +119,14 @@ public class ProjectChangedCustomListener implements MessageListenerConcurrently
log.info("data-statical-server服务被关闭,执行未执行完的动作");
}
/*@Override
public ConsumerConfigProperties getConsumerProperty() {
ConsumerConfigProperties configProperties = new ConsumerConfigProperties();
configProperties.setConsumerGroup(ConsomerGroupConstants.PROJECT_CHANGED_COMPONENTS_GROUP);
configProperties.setTopic(TopicConstants.PROJECT_CHANGED);
configProperties.setTag("*");
configProperties.setConsumerListener(this);
return configProperties;
}*/
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java

@ -3,22 +3,22 @@ package com.epmet.mq;
import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants;
import com.epmet.commons.rocketmq.constants.TopicConstants;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.enums.EnvEnum;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
@Slf4j
@Component
@Order(value = 111)
public class RocketMQConsumerRegister {
@Value("${spring.profiles.active}")
private String env;
@Value("${rocketmq.name-server}")
private String nameServer;
@ -31,7 +31,9 @@ public class RocketMQConsumerRegister {
@PostConstruct
public void registerAllListeners() {
try {
register(ConsomerGroupConstants.PROJECT_CHANGED_COMPONENTS_GROUP, MessageModel.CLUSTERING, TopicConstants.PROJECT_CHANGED, "*", new ProjectChangedCustomListener());
if (!EnvEnum.LOCAL.getCode().equals(env)) {
register(ConsomerGroupConstants.PROJECT_CHANGED_COMPONENTS_GROUP, MessageModel.CLUSTERING, TopicConstants.PROJECT_CHANGED, "*", new ProjectChangedCustomListener());
}
} catch (MQClientException e) {
log.error("registerAllListeners exception", e);
}

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/IndexGroupServiceImpl.java

@ -80,7 +80,7 @@ private IndexGroupTemplateDao indexGroupTemplateDao;
List<IndexGroupEntity> insertGroupList = new ArrayList<>();
groupMap.forEach((oldGroupTempId, o) -> {
IndexGroupEntity newGroupEntity = ConvertUtils.sourceToTarget(o, IndexGroupEntity.class);
String newGroupId = UniqueIdGenerator.generate();
String newGroupId = UniqueIdGenerator.generate24();
newGroupEntity.setId(newGroupId);
newGroupEntity.setCustomerId(customerId);
groupNewIdMap.put(oldGroupTempId, newGroupId);
@ -99,7 +99,7 @@ private IndexGroupTemplateDao indexGroupTemplateDao;
IndexGroupDetailEntity entity = ConvertUtils.sourceToTarget(groupDetailTemp, IndexGroupDetailEntity.class);
entity.setId(UniqueIdGenerator.generate());
entity.setId(UniqueIdGenerator.generate24());
String newGroupId = groupNewIdMap.get(oldIndexGroupId);
if (StringUtils.isBlank(newGroupId)){
log.error("新旧id映射关系有误");
@ -134,4 +134,4 @@ private IndexGroupTemplateDao indexGroupTemplateDao;
});*/
return true;
}
}
}

1
epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.11__groupAchievementRule.sql

@ -0,0 +1 @@
INSERT INTO `epmet_point`.`point_rule_default`(`ID`, `RULE_NAME`, `RULE_DESC`, `EVENT_CODE`, `FUNCTION_ID`, `OPERATE_TYPE`, `UP_LIMIT`, `UP_LIMIT_DESC`, `UP_LIMIT_PREFIX`, `RULE_PERIOD`, `POINT`, `POINT_UNIT`, `ENABLED_FLAG`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('10', '组长解决话题', '组长解决组内话题', 'leader_resolve_topic', '1', 'plus', 0, '无上限', NULL, 'day', 2, 'time', '0', '0', 0, 'APP_USER', '2021-04-19 15:55:18', 'APP_USER', '2021-04-19 15:55:18');

1
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java

@ -239,6 +239,7 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl<ActLiveRecDao, ActLiv
actPointEventMsg.setActionFlag(MqConstant.PLUS);
actPointEventMsg.setIsCommon(false);
actPointEventMsg.setRemark(actInfoDTO.getTitle());
actPointEventMsg.setSourceType("activity");
actPointEventMsg.setSourceId(formDTO.getActId());
actPointEventMsgList.add(actPointEventMsg);

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

@ -127,6 +127,8 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
BasePointEventMsg actPointEventMsg=new BasePointEventMsg();
actPointEventMsg.setCustomerId(formDTO.getCustomerId());
actPointEventMsg.setUserId(formDTO.getUserId());
actPointEventMsg.setSourceType("volunteer");
actPointEventMsg.setSourceId(formDTO.getUserId());
actPointEventMsg.setActionFlag(MqConstant.PLUS);
actPointEventMsg.setIsCommon(false);
actPointEventMsgList.add(actPointEventMsg);

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java

@ -927,6 +927,7 @@ public class WorkActServiceImpl implements WorkActService {
basePointEventMsg.setPoint(actInfoDTO.getReward());
basePointEventMsg.setIsCommon(true);
basePointEventMsg.setRemark(remark);
basePointEventMsg.setSourceType("activity");
basePointEventMsg.setSourceId(actInfoDTO.getId());
basePointEventMsg.setOperatorId(loginUserUtil.getLoginUserId());
basePointEventMsgArrayList.add(basePointEventMsg);
@ -966,6 +967,7 @@ public class WorkActServiceImpl implements WorkActService {
basePointEventMsg.setPoint(formDTO.getReward());
basePointEventMsg.setIsCommon(true);
basePointEventMsg.setRemark(formDTO.getRemark());
basePointEventMsg.setSourceType("activity");
basePointEventMsg.setSourceId(formDTO.getSourceId());
basePointEventMsg.setOperatorId(loginUserUtil.getLoginUserId());
basePointEventMsgArrayList.add(basePointEventMsg);

1
epmet-module/epmet-message/epmet-message-client/pom.xml

@ -30,7 +30,6 @@
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-rocketmq</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>

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

@ -15,4 +15,9 @@ public interface SystemMessageType {
*/
String PROJECT_CHANGED = "project_changed";
/**
* 小组成就
*/
String GROUP_ACHIEVEMENT = "group_achievement";
}

32
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/send/SendMqMsgUtil.java

@ -2,6 +2,7 @@ package com.epmet.send;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.rocketmq.messages.ProjectChangedMQMsg;
import com.epmet.commons.rocketmq.messages.GroupAchievementMQMsg;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.SystemMessageType;
@ -66,4 +67,35 @@ public class SendMqMsgUtil {
return false;
}
/**
* desc: 发送小组成就消息,计算小组成就
*
* @param msgContent
* @return boolean
* @author LiuJanJun
* @date 2021/4/23 3:01 下午
* @remark 失败重试1次,调用端自行判断如果失败是否要继续执行
*/
public boolean sendGroupAchievementMqMsg(GroupAchievementMQMsg msgContent) {
try {
SystemMsgFormDTO systemMsgFormDTO = new SystemMsgFormDTO();
systemMsgFormDTO.setMessageType(SystemMessageType.GROUP_ACHIEVEMENT);
systemMsgFormDTO.setContent(msgContent);
Result sendMsgResult = null;
log.info("sendGroupAchievementMqMsg param:{}",msgContent);
int retryTime = 0;
do {
sendMsgResult = epmetMessageOpenFeignClient.sendSystemMsgByMQ(systemMsgFormDTO);
} while ((sendMsgResult == null || !sendMsgResult.success()) && retryTime++ < NumConstant.TWO);
if (sendMsgResult != null && sendMsgResult.success()) {
return true;
}
log.error("发送(小组成就)系统消息到message服务失败:{},msg:{}", JSON.toJSONString(sendMsgResult), JSON.toJSONString(systemMsgFormDTO));
} catch (Exception e) {
log.error("sendMqMsg exception", e);
}
return false;
}
}

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

@ -67,6 +67,9 @@ public class SystemMessageServiceImpl implements SystemMessageService {
case SystemMessageType.PROJECT_CHANGED:
topic = TopicConstants.PROJECT_CHANGED;
break;
case SystemMessageType.GROUP_ACHIEVEMENT:
topic = TopicConstants.GROUP_ACHIEVEMENT;
break;
}
return topic;
}

101
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/BizPointTotalDetailDTO.java

@ -0,0 +1,101 @@
/**
* 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.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 按业务类型积分总计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-20
*/
@Data
public class BizPointTotalDetailDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 组织Id
*/
private String agencyId;
/**
* 网格ID
*/
private String gridId;
/**
* 业务类型小组group
*/
private String bizType;
/**
* 业务类型的对象id
*/
private String objectId;
/**
* OBJECTID的总积分 总积分=objectId下所有的用户积分
*/
private Integer totalPoint;
/**
* 删除标识
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

106
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/BizPointUserTotalDetailDTO.java

@ -0,0 +1,106 @@
/**
* 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.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 按业务类型积分总计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-20
*/
@Data
public class BizPointUserTotalDetailDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 组织Id
*/
private String agencyId;
/**
* 网格ID
*/
private String gridId;
/**
* 用户ID
*/
private String userId;
/**
* 业务类型小组group
*/
private String bizType;
/**
* 业务类型的对象id
*/
private String objectId;
/**
* OBJECTID的总积分 总积分=objectId下所有的用户积分
*/
private Integer totalPoint;
/**
* 删除标识
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

12
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/UserPointActionLogDTO.java

@ -53,6 +53,18 @@ public class UserPointActionLogDTO implements Serializable {
*/
private String actionFlag;
/**
* 业务类型小组group
*/
private String bizType;
/**
* 业务类型的对象id
*/
private String objectId;
private String sourceType;
/**
* 来源Id可以是活动Id
* */

17
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/GroupPointFormDTO.java

@ -0,0 +1,17 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/4/21 9:50
*/
@Data
public class GroupPointFormDTO implements Serializable {
private static final long serialVersionUID = -3231073030413434313L;
private String groupId;
private String gridId;
}

38
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/GroupPointRankingResultDTO.java

@ -0,0 +1,38 @@
package com.epmet.dto.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/4/21 10:34
*/
@NoArgsConstructor
@Data
public class GroupPointRankingResultDTO implements Serializable {
private static final long serialVersionUID = -9215609608003827403L;
/**
* 排名
*/
private String ranking;
/**
* 小组名
*/
private String groupName;
/**
* 小组积分
*/
private String point;
/**
* 是否本小组
*/
private String isMine;
/**
* 小组ID
*/
private String groupId;
}

26
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/GroupPointRuleResultDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/4/22 15:15
*/
@Data
public class GroupPointRuleResultDTO implements Serializable {
private static final long serialVersionUID = -1651136821935977327L;
private List<String> rules;
/**
* 个人贡献概述
*/
private String contriSummary;
/**
* 小组积分概述
*/
private String groupSummary;
}

44
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointRankingResultDTO.java

@ -0,0 +1,44 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/4/21 10:05
*/
@NoArgsConstructor
@Data
public class PointRankingResultDTO implements Serializable {
private static final long serialVersionUID = -5383837225811609227L;
/**
* 头像
*/
private String headPhoto;
/**
* 支部小组-姓名/普通小组-昵称
*/
private String name;
/**
* 积分
*/
private String point;
/**
* 排名
*/
private String ranking;
/**
* 是否本人
*/
private String isMine;
/**
* 用户ID
*/
@JsonIgnore
private String userId;
}

6
epmet-module/epmet-point/epmet-point-server/pom.xml

@ -87,6 +87,12 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>resi-group-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

96
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/GroupPointController.java

@ -0,0 +1,96 @@
package com.epmet.controller;
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.dto.form.GroupPointFormDTO;
import com.epmet.dto.result.GroupPointRuleResultDTO;
import com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO;
import com.epmet.dto.result.GroupPointRankingResultDTO;
import com.epmet.dto.result.PointRankingResultDTO;
import com.epmet.service.BizPointTotalDetailService;
import com.epmet.service.BizPointUserTotalDetailService;
import com.epmet.service.PointRuleService;
import com.epmet.utils.ModuleConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author zhaoqifeng
* 小组积分
* @date 2021/4/21 9:45
*/
@RestController
@RequestMapping("group/point")
public class GroupPointController {
@Autowired
private BizPointUserTotalDetailService bizPointUserTotalDetailService;
@Autowired
private BizPointTotalDetailService bizPointTotalDetailService;
@Autowired
private PointRuleService pointRuleService;
/**
* 小组积分贡献榜
*
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.dto.result.PointRankingResultDTO>>
* @author zhaoqifeng
* @date 2021/4/21 14:02
*/
@PostMapping("pointranking")
public Result<List<PointRankingResultDTO>> pointRanking(@LoginUser TokenDto tokenDto, @RequestBody GroupPointFormDTO formDTO) {
List<PointRankingResultDTO> list = bizPointUserTotalDetailService.pointRanking(tokenDto, formDTO);
return new Result<List<PointRankingResultDTO>>().ok(list);
}
/**
* 网格小组积分排行
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.dto.result.GroupPointRankingResultDTO>>
* @author zhaoqifeng
* @date 2021/4/21 14:02
*/
@PostMapping("grouppointranking")
public Result<List<GroupPointRankingResultDTO>> groupPointRanking(@RequestBody GroupPointFormDTO formDTO) {
List<GroupPointRankingResultDTO> list = bizPointTotalDetailService.groupPointRanking(formDTO);
return new Result<List<GroupPointRankingResultDTO>>().ok(list);
}
/**
* 小组积分详情
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO>
* @author zhaoqifeng
* @date 2021/4/21 14:02
*/
@PostMapping("pointdetail")
public Result<GroupPointDetailResultDTO> pointDetail(@RequestBody GroupPointFormDTO formDTO) {
GroupPointDetailResultDTO result = bizPointTotalDetailService.pointDetail(formDTO);
return new Result<GroupPointDetailResultDTO>().ok(result);
}
/**
* 小组积分规则
* @author zhaoqifeng
* @date 2021/4/22 15:36
* @param tokenDto
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.GroupPointRuleResultDTO>
*/
@PostMapping("pointrule")
public Result<GroupPointRuleResultDTO> pointRule(@LoginUser TokenDto tokenDto) {
GroupPointRuleResultDTO result = pointRuleService.getGroupRule(tokenDto.getCustomerId());
result.setContriSummary(ModuleConstant.CONTRI_SUMMARY);
result.setGroupSummary(ModuleConstant.GROUP_RULE_SUMMARY);
return new Result<GroupPointRuleResultDTO>().ok(result);
}
}

43
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/BizPointTotalDetailDao.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.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.BizPointTotalDetailDTO;
import com.epmet.entity.BizPointTotalDetailEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 按业务类型积分总计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-20
*/
@Mapper
public interface BizPointTotalDetailDao extends BaseDao<BizPointTotalDetailEntity> {
/**
* 根据业务类型查找数据
* @author zhaoqifeng
* @date 2021/4/20 16:57
* @param type
* @param objectId
* @return com.epmet.dto.BizPointTotalDetailDTO
*/
BizPointTotalDetailDTO selectDataByObject(@Param("type")String type, @Param("objectId")String objectId);
}

44
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/BizPointUserTotalDetailDao.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;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.BizPointUserTotalDetailEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 按业务类型积分总计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-20
*/
@Mapper
public interface BizPointUserTotalDetailDao extends BaseDao<BizPointUserTotalDetailEntity> {
/**
* 获取今日积分增量
* @author zhaoqifeng
* @date 2021/4/21 16:56
* @param type
* @param objectId
* @return java.lang.Integer
*/
Integer selectIncrease(@Param("type")String type, @Param("objectId")String objectId);
}

10
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java

@ -53,4 +53,14 @@ public interface UserPointActionLogDao extends BaseDao<UserPointActionLogEntity>
* @date 2020.07.31 15:11
**/
Integer selectSumByEvent(@Param("userId") String userId, @Param("eventId") String eventId, @Param("sourceId") String sourceId, @Param("customerId") String customerId, @Param("dateCheck") Date dateCheck,@Param("right")Date right);
/**
* 获取今日积分增量
* @author zhaoqifeng
* @date 2021/4/21 16:56
* @param type
* @param objectId
* @return java.lang.Integer
*/
Integer selectIncrease(@Param("type")String type, @Param("objectId")String objectId);
}

71
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/BizPointTotalDetailEntity.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;
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-04-20
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("biz_point_total_detail")
public class BizPointTotalDetailEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 组织Id
*/
private String agencyId;
/**
* 网格ID
*/
private String gridId;
/**
* 业务类型小组group
*/
private String bizType;
/**
* 业务类型的对象id
*/
private String objectId;
/**
* OBJECTID的总积分 总积分=objectId下所有的用户积分
*/
private Integer totalPoint;
}

76
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/BizPointUserTotalDetailEntity.java

@ -0,0 +1,76 @@
/**
* 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;
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-04-20
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("biz_point_user_total_detail")
public class BizPointUserTotalDetailEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 组织Id
*/
private String agencyId;
/**
* 网格ID
*/
private String gridId;
/**
* 用户ID
*/
private String userId;
/**
* 业务类型小组group
*/
private String bizType;
/**
* 业务类型的对象id
*/
private String objectId;
/**
* OBJECTID的总积分 总积分=objectId下所有的用户积分
*/
private Integer totalPoint;
}

12
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/UserPointActionLogEntity.java

@ -58,6 +58,18 @@ public class UserPointActionLogEntity extends BaseEpmetEntity {
*/
private String eventId;
/**
* 业务类型小组group
*/
private String bizType;
/**
* 业务类型的对象id
*/
private String objectId;
private String sourceType;
/**
* 来源Id可以是活动Id
* */

129
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/BizPointTotalDetailService.java

@ -0,0 +1,129 @@
/**
* 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.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.BizPointTotalDetailDTO;
import com.epmet.dto.form.GroupPointFormDTO;
import com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO;
import com.epmet.dto.result.GroupPointRankingResultDTO;
import com.epmet.entity.BizPointTotalDetailEntity;
import java.util.List;
import java.util.Map;
/**
* 按业务类型积分总计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-20
*/
public interface BizPointTotalDetailService extends BaseService<BizPointTotalDetailEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<BizPointTotalDetailDTO>
* @author generator
* @date 2021-04-20
*/
PageData<BizPointTotalDetailDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<BizPointTotalDetailDTO>
* @author generator
* @date 2021-04-20
*/
List<BizPointTotalDetailDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return BizPointTotalDetailDTO
* @author generator
* @date 2021-04-20
*/
BizPointTotalDetailDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-04-20
*/
void save(BizPointTotalDetailDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-04-20
*/
void update(BizPointTotalDetailDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-04-20
*/
void delete(String[] ids);
/**
* 根据业务类型查找数据
*
* @param type
* @param objectId
* @return com.epmet.dto.BizPointTotalDetailDTO
* @author zhaoqifeng
* @date 2021/4/20 16:53
*/
BizPointTotalDetailDTO getDataByObject(String type, String objectId);
/**
* 小组积分详情
*
* @param formDTO
* @return com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO
* @author zhaoqifeng
* @date 2021/4/21 14:05
*/
GroupPointDetailResultDTO pointDetail(GroupPointFormDTO formDTO);
/**
* 网格小组积分排行
*
* @param formDTO
* @return java.util.List<com.epmet.dto.result.GroupPointRankingResultDTO>
* @author zhaoqifeng
* @date 2021/4/21 14:05
*/
List<GroupPointRankingResultDTO> groupPointRanking(GroupPointFormDTO formDTO);
}

143
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/BizPointUserTotalDetailService.java

@ -0,0 +1,143 @@
/**
* 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.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.BizPointUserTotalDetailDTO;
import com.epmet.dto.form.GroupPointFormDTO;
import com.epmet.dto.result.PointRankingResultDTO;
import com.epmet.entity.BizPointUserTotalDetailEntity;
import java.util.List;
import java.util.Map;
/**
* 按业务类型积分总计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-20
*/
public interface BizPointUserTotalDetailService extends BaseService<BizPointUserTotalDetailEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<BizPointUserTotalDetailDTO>
* @author generator
* @date 2021-04-20
*/
PageData<BizPointUserTotalDetailDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<BizPointUserTotalDetailDTO>
* @author generator
* @date 2021-04-20
*/
List<BizPointUserTotalDetailDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return BizPointUserTotalDetailDTO
* @author generator
* @date 2021-04-20
*/
BizPointUserTotalDetailDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-04-20
*/
void save(BizPointUserTotalDetailDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-04-20
*/
void update(BizPointUserTotalDetailDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-04-20
*/
void delete(String[] ids);
/**
* 根据业务类型查找用户数据
*
* @param type
* @param objectId
* @param userId
* @return com.epmet.dto.BizPointTotalDetailDTO
* @author zhaoqifeng
* @date 2021/4/20 16:53
*/
BizPointUserTotalDetailDTO getDataByObject(String type, String objectId, String userId);
/**
* 根据业务类型查找积分总和
*
* @param type
* @param objectId
* @return java.lang.Integer
* @author zhaoqifeng
* @date 2021/4/20 17:21
*/
Integer getTotalByObject(String type, String objectId);
/**
* 小组积分贡献榜
*
* @param tokenDto
* @param formDTO
* @return java.util.List<com.epmet.dto.result.PointRankingResultDTO>
* @author zhaoqifeng
* @date 2021/4/21 14:06
*/
List<PointRankingResultDTO> pointRanking(TokenDto tokenDto, GroupPointFormDTO formDTO);
/**
* 获取今日增量
* @author zhaoqifeng
* @date 2021/4/21 16:41
* @param type
* @param objectId
* @return java.lang.Integer
*/
Integer getIncrease(String type, String objectId);
}

10
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointRuleService.java

@ -24,6 +24,7 @@ import com.epmet.dto.form.PointDetailFormDTO;
import com.epmet.dto.form.PointRuleFormDTO;
import com.epmet.dto.form.PointRuleListFormDTO;
import com.epmet.dto.result.CustomerFunctionResultDTO;
import com.epmet.dto.result.GroupPointRuleResultDTO;
import com.epmet.dto.result.PointDetailResultDTO;
import com.epmet.dto.result.PointRuleResultDTO;
import com.epmet.entity.PointRuleEntity;
@ -69,4 +70,13 @@ public interface PointRuleService extends BaseService<PointRuleEntity> {
PointRuleEntity getByEventCodeAndCustomerId(String customerId,String eventCode);
InitPointRuleResultDTO initPointRule();
/**
* 获取小组积分规则
* @author zhaoqifeng
* @date 2021/4/22 15:20
* @param customerId
* @return com.epmet.dto.result.GroupPointRuleResultDTO
*/
GroupPointRuleResultDTO getGroupRule(String customerId);
}

10
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java

@ -123,4 +123,14 @@ public interface UserPointActionLogService extends BaseService<UserPointActionLo
* @date 2020.07.31 13:45
**/
void grantPointByEvent(String eventCode,BasePointEventMsg event);
/**
* 获取今日增量
* @author zhaoqifeng
* @date 2021/4/21 16:41
* @param type
* @param objectId
* @return java.lang.Integer
*/
Integer getIncrease(String type, String objectId);
}

212
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/BizPointTotalDetailServiceImpl.java

@ -0,0 +1,212 @@
/**
* 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.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.BizPointTotalDetailDao;
import com.epmet.dto.BizPointTotalDetailDTO;
import com.epmet.dto.form.GroupPointFormDTO;
import com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO;
import com.epmet.dto.result.GroupPointRankingResultDTO;
import com.epmet.entity.BizPointTotalDetailEntity;
import com.epmet.resi.group.dto.group.ResiGroupDTO;
import com.epmet.resi.group.feign.ResiGroupOpenFeignClient;
import com.epmet.service.BizPointTotalDetailService;
import com.epmet.service.BizPointUserTotalDetailService;
import com.epmet.service.UserPointActionLogService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.Collator;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
* 按业务类型积分总计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-20
*/
@Service
public class BizPointTotalDetailServiceImpl extends BaseServiceImpl<BizPointTotalDetailDao, BizPointTotalDetailEntity> implements BizPointTotalDetailService {
@Autowired
private ResiGroupOpenFeignClient resiGroupOpenFeignClient;
@Autowired
private BizPointUserTotalDetailService bizPointUserTotalDetailService;
@Autowired
private UserPointActionLogService userPointActionLogService;
@Override
public PageData<BizPointTotalDetailDTO> page(Map<String, Object> params) {
IPage<BizPointTotalDetailEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, BizPointTotalDetailDTO.class);
}
@Override
public List<BizPointTotalDetailDTO> list(Map<String, Object> params) {
List<BizPointTotalDetailEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, BizPointTotalDetailDTO.class);
}
private QueryWrapper<BizPointTotalDetailEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<BizPointTotalDetailEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public BizPointTotalDetailDTO get(String id) {
BizPointTotalDetailEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, BizPointTotalDetailDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(BizPointTotalDetailDTO dto) {
BizPointTotalDetailEntity entity = ConvertUtils.sourceToTarget(dto, BizPointTotalDetailEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(BizPointTotalDetailDTO dto) {
BizPointTotalDetailEntity entity = ConvertUtils.sourceToTarget(dto, BizPointTotalDetailEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* 根据业务类型查找数据
*
* @param type
* @param objectId
* @return com.epmet.dto.BizPointTotalDetailDTO
* @author zhaoqifeng
* @date 2021/4/20 16:53
*/
@Override
public BizPointTotalDetailDTO getDataByObject(String type, String objectId) {
return baseDao.selectDataByObject(type, objectId);
}
/**
* 小组积分详情
*
* @param formDTO
* @return com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO
* @author zhaoqifeng
* @date 2021/4/21 14:05
*/
@Override
public GroupPointDetailResultDTO pointDetail(GroupPointFormDTO formDTO) {
Result<GroupPointDetailResultDTO> result = resiGroupOpenFeignClient.groupPointDetail(formDTO.getGroupId());
if (!result.success() || null == result.getData()) {
throw new RenException(result.getCode(), result.getMsg());
}
GroupPointDetailResultDTO detail = result.getData();
QueryWrapper<BizPointTotalDetailEntity> wrapper = new QueryWrapper<>();
wrapper.eq("BIZ_TYPE", "group")
.eq("OBJECT_ID", formDTO.getGroupId())
.eq("DEL_FLAG", NumConstant.ZERO_STR);
BizPointTotalDetailEntity entity = baseDao.selectOne(wrapper);
Integer increase = userPointActionLogService.getIncrease("group", formDTO.getGroupId());
detail.setIncrease(increase.toString());
if (null == entity) {
detail.setToUpgrade(detail.getNextLevelPoint());
detail.setTotal(NumConstant.ZERO_STR);
detail.setCurrentPoint(NumConstant.ZERO_STR);
} else {
int toUpgrade = Integer.parseInt(detail.getNextLevelPoint()) - entity.getTotalPoint();
detail.setToUpgrade(Integer.toString(toUpgrade));
detail.setTotal(entity.getTotalPoint().toString());
detail.setCurrentPoint(entity.getTotalPoint().toString());
}
return detail;
}
/**
* 网格小组积分排行
*
* @param formDTO
* @return java.util.List<com.epmet.dto.result.GroupPointRankingResultDTO>
* @author zhaoqifeng
* @date 2021/4/21 14:05
*/
@Override
public List<GroupPointRankingResultDTO> groupPointRanking(GroupPointFormDTO formDTO) {
List<GroupPointRankingResultDTO> list;
QueryWrapper<BizPointTotalDetailEntity> wrapper = new QueryWrapper<>();
wrapper.eq("BIZ_TYPE", "group")
.eq("GRID_ID", formDTO.getGridId())
.eq("DEL_FLAG", NumConstant.ZERO_STR)
.orderByDesc("TOTAL_POINT");
List<BizPointTotalDetailEntity> totalDetailList = baseDao.selectList(wrapper);
Result<List<ResiGroupDTO>> groupList = resiGroupOpenFeignClient.getGroupListByGrid(formDTO.getGridId());
list = groupList.getData().stream().map(item -> {
GroupPointRankingResultDTO dto = new GroupPointRankingResultDTO();
dto.setGroupId(item.getId());
dto.setGroupName(item.getGroupName());
dto.setPoint(NumConstant.ZERO_STR);
if (formDTO.getGroupId().equals(item.getId())) {
dto.setIsMine(NumConstant.ONE_STR);
} else {
dto.setIsMine(NumConstant.ZERO_STR);
}
return dto;
}).collect(Collectors.toList());
list.forEach(item -> totalDetailList.stream().filter(detail -> item.getGroupId().equals(detail.getObjectId())).forEach(total -> {
item.setPoint(total.getTotalPoint().toString());
}));
list =
list.stream().sorted(Comparator.comparing(GroupPointRankingResultDTO :: getPoint, Comparator.comparingInt(Integer::parseInt)).reversed()
.thenComparing(GroupPointRankingResultDTO::getGroupName, Collator.getInstance(Locale.CHINA)))
.collect(Collectors.toList());
AtomicInteger i = new AtomicInteger(1);
list.forEach(dto -> {
dto.setRanking(String.valueOf(i.getAndIncrement()));
});
return list;
}
}

251
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/BizPointUserTotalDetailServiceImpl.java

@ -0,0 +1,251 @@
/**
* 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.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.enums.BizTypeEnum;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.BizPointUserTotalDetailDao;
import com.epmet.dto.BizPointUserTotalDetailDTO;
import com.epmet.dto.form.GroupPointFormDTO;
import com.epmet.dto.result.PointRankingResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.entity.BizPointUserTotalDetailEntity;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.resi.group.dto.group.ResiGroupDTO;
import com.epmet.resi.group.dto.member.ResiGroupMemberDTO;
import com.epmet.resi.group.feign.ResiGroupOpenFeignClient;
import com.epmet.service.BizPointUserTotalDetailService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.Collator;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
* 按业务类型积分总计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-20
*/
@Service
public class BizPointUserTotalDetailServiceImpl extends BaseServiceImpl<BizPointUserTotalDetailDao, BizPointUserTotalDetailEntity> implements BizPointUserTotalDetailService {
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private ResiGroupOpenFeignClient resiGroupOpenFeignClient;
@Override
public PageData<BizPointUserTotalDetailDTO> page(Map<String, Object> params) {
IPage<BizPointUserTotalDetailEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, BizPointUserTotalDetailDTO.class);
}
@Override
public List<BizPointUserTotalDetailDTO> list(Map<String, Object> params) {
List<BizPointUserTotalDetailEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, BizPointUserTotalDetailDTO.class);
}
private QueryWrapper<BizPointUserTotalDetailEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<BizPointUserTotalDetailEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public BizPointUserTotalDetailDTO get(String id) {
BizPointUserTotalDetailEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, BizPointUserTotalDetailDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(BizPointUserTotalDetailDTO dto) {
BizPointUserTotalDetailEntity entity = ConvertUtils.sourceToTarget(dto, BizPointUserTotalDetailEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(BizPointUserTotalDetailDTO dto) {
BizPointUserTotalDetailEntity entity = ConvertUtils.sourceToTarget(dto, BizPointUserTotalDetailEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* 根据业务类型查找用户数据
*
* @param type
* @param objectId
* @param userId
* @return com.epmet.dto.BizPointTotalDetailDTO
* @author zhaoqifeng
* @date 2021/4/20 16:53
*/
@Override
public BizPointUserTotalDetailDTO getDataByObject(String type, String objectId, String userId) {
QueryWrapper<BizPointUserTotalDetailEntity> wrapper = new QueryWrapper<>();
wrapper.eq("BIZ_TYPE", type)
.eq("OBJECT_ID", objectId)
.eq("USER_ID", userId)
.eq("DEL_FLAG", NumConstant.ZERO_STR);
BizPointUserTotalDetailEntity entity = baseDao.selectOne(wrapper);
return ConvertUtils.sourceToTarget(entity, BizPointUserTotalDetailDTO.class);
}
/**
* 根据业务类型查找积分总和
*
* @param type
* @param objectId
* @return java.lang.Integer
* @author zhaoqifeng
* @date 2021/4/20 17:21
*/
@Override
public Integer getTotalByObject(String type, String objectId) {
QueryWrapper<BizPointUserTotalDetailEntity> wrapper = new QueryWrapper<>();
wrapper.select("IFNULL(SUM(TOTAL_POINT), 0) as TOTAL_POINT")
.eq("BIZ_TYPE", type)
.eq("OBJECT_ID", objectId)
.eq("DEL_FLAG", NumConstant.ZERO_STR);
BizPointUserTotalDetailEntity entity = baseDao.selectOne(wrapper);
if (null == entity) {
return NumConstant.ZERO;
}
return entity.getTotalPoint();
}
public static void main(String[] args) {
System.out.println(BizTypeEnum.ACTIVITY.getType());
}
/**
* 小组积分贡献榜
*
* @param tokenDto
* @param formDTO
* @return java.util.List<com.epmet.dto.result.PointRankingResultDTO>
* @author zhaoqifeng
* @date 2021/4/21 14:06
*/
@Override
public List<PointRankingResultDTO> pointRanking(TokenDto tokenDto, GroupPointFormDTO formDTO) {
List<PointRankingResultDTO> list = new ArrayList<>();
QueryWrapper<BizPointUserTotalDetailEntity> wrapper = new QueryWrapper<>();
wrapper.eq("BIZ_TYPE", "group")
.eq("OBJECT_ID", formDTO.getGroupId())
.eq("DEL_FLAG", NumConstant.ZERO_STR)
.orderByDesc("TOTAL_POINT");
List<BizPointUserTotalDetailEntity> userTotalList = baseDao.selectList(wrapper);
AtomicInteger i = new AtomicInteger(1);
//获取小组信息
Result<ResiGroupDTO> group = resiGroupOpenFeignClient.getGroupDetail(formDTO.getGroupId());
if (!group.success() || null == group.getData()) {
throw new RenException(group.getCode(), group.getMsg());
}
List<ResiGroupMemberDTO> memberList = group.getData().getMemberList();
list = memberList.stream().map(item -> {
PointRankingResultDTO dto = new PointRankingResultDTO();
dto.setUserId(item.getCustomerUserId());
dto.setPoint(NumConstant.ZERO_STR);
if (tokenDto.getUserId().equals(item.getCustomerUserId())) {
dto.setIsMine(NumConstant.ONE_STR);
} else {
dto.setIsMine(NumConstant.ZERO_STR);
}
return dto;
}).collect(Collectors.toList());
list.forEach(item -> userTotalList.stream().filter(user -> user.getUserId().equals(item.getUserId())).forEach(total -> {
item.setPoint(total.getTotalPoint().toString());
}));
//获取用户信息
List<String> userIds = memberList.stream().map(ResiGroupMemberDTO :: getCustomerUserId).collect(Collectors.toList());
Result<List<UserBaseInfoResultDTO>> userInfoListResult = epmetUserOpenFeignClient.queryUserBaseInfo(userIds);
if (!userInfoListResult.success() || null == userInfoListResult.getData()) {
throw new RenException(userInfoListResult.getCode(), userInfoListResult.getMsg());
}
list.forEach(item -> userInfoListResult.getData().stream().filter(baseInfo -> item.getUserId().equals(baseInfo.getUserId())).forEach(
user -> {
//楼院小组显示昵称,支部小组显示姓名
if (("ordinary").equals(group.getData().getGroupType())) {
item.setName(user.getNickname());
} else {
item.setName(StrConstant.EPMETY_STR);
if (StringUtils.isNotBlank(user.getSurname())){
item.setName(user.getSurname());
}
if (StringUtils.isNotBlank(user.getName())){
item.setName(item.getName().concat(user.getName()));
}
}
item.setHeadPhoto(user.getHeadImgUrl());
}
));
list = list.stream().sorted(Comparator.comparing(PointRankingResultDTO :: getPoint, Comparator.comparingInt(Integer::parseInt)).reversed()
.thenComparing(PointRankingResultDTO::getName, Collator.getInstance(Locale.CHINA)))
.collect(Collectors.toList());
list.forEach(item -> item.setRanking(String.valueOf(i.getAndIncrement())));
return list;
}
/**
* 获取今日增量
*
* @param type
* @param objectId
* @return java.lang.Integer
* @author zhaoqifeng
* @date 2021/4/21 16:41
*/
@Override
public Integer getIncrease(String type, String objectId) {
return baseDao.selectIncrease(type, objectId);
}
}

5
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdjustmentLogServiceImpl.java

@ -206,6 +206,11 @@ public class PointAdjustmentLogServiceImpl extends BaseServiceImpl<PointAdjustme
userPointActionEntity.setCustomerId(param.getCustomerId());
userPointActionEntity.setActionFlag(param.getAdjustmentType());
userPointActionEntity.setPoint(point);
userPointActionEntity.setEventId("manual");
userPointActionEntity.setBizType("agency");
userPointActionEntity.setObjectId(agencyId);
userPointActionEntity.setSourceType("manual");
userPointActionEntity.setSourceId(param.getUserId());
userPointActionEntity.setEventStatement(param.getReason());
userPointActionEntity.setEventName(ModuleConstant.EVENT_NAME_ADJUSTMENT);
userPointActionEntity.setOperatorAgencyId(agencyId);

38
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java

@ -18,6 +18,7 @@
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.common.enu.PointUnitEnum;
import com.epmet.common.enu.SysResponseEnum;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
@ -25,6 +26,7 @@ import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.enums.CommonOperateTypeEnum;
import com.epmet.commons.tools.enums.EventEnum;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
@ -41,10 +43,7 @@ import com.epmet.dto.form.CustomerFunctionListFormDTO;
import com.epmet.dto.form.PointDetailFormDTO;
import com.epmet.dto.form.PointRuleFormDTO;
import com.epmet.dto.form.PointRuleListFormDTO;
import com.epmet.dto.result.CustomerFunctionResultDTO;
import com.epmet.dto.result.DefaultFunctionListResultDTO;
import com.epmet.dto.result.PointDetailResultDTO;
import com.epmet.dto.result.PointRuleResultDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.PointRuleDefaultEntity;
import com.epmet.entity.PointRuleEntity;
import com.epmet.entity.RuleOperateLogEntity;
@ -61,6 +60,7 @@ import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
@ -284,6 +284,36 @@ public class PointRuleServiceImpl extends BaseServiceImpl<PointRuleDao, PointRul
return result;
}
/**
* 获取小组积分规则
*
* @param customerId
* @return com.epmet.dto.result.GroupPointRuleResultDTO
* @author zhaoqifeng
* @date 2021/4/22 15:20
*/
@Override
public GroupPointRuleResultDTO getGroupRule(String customerId) {
GroupPointRuleResultDTO resultDTO = new GroupPointRuleResultDTO();
List<String> list = new ArrayList<>();
QueryWrapper<PointRuleEntity> wrapper = new QueryWrapper<>();
wrapper.eq("CUSTOMER_ID", customerId)
.eq("DEL_FLAG", NumConstant.ZERO_STR);
List<PointRuleEntity> ruleList = baseDao.selectList(wrapper);
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(ruleList)) {
AtomicInteger index=new AtomicInteger(1);
list = ruleList.stream().filter(i -> ("resi_group").equals(Objects.requireNonNull(EventEnum.getEnum(i.getEventCode())).getEventClass())).map(item -> {
String rule = index.getAndIncrement() + "." + item.getRuleName() + "," + "" + item.getPoint() + "分";
if (NumConstant.ZERO != item.getUpLimit()) {
rule = rule + "(每天最多得" + item.getUpLimit() + "分)";
}
return rule;
}).collect(Collectors.toList());
}
resultDTO.setRules(list);
return resultDTO;
}
private void insertOperateRecord(TokenDto tokenDTO, PointRuleEntity entityNew, PointRuleEntity entityDB, String opType) {
RuleOperateLogEntity record = new RuleOperateLogEntity();
if (tokenDTO != null) {

130
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java

@ -31,17 +31,14 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dao.UserPointActionLogDao;
import com.epmet.dto.BizPointTotalDetailDTO;
import com.epmet.dto.BizPointUserTotalDetailDTO;
import com.epmet.dto.UserPointActionLogDTO;
import com.epmet.dto.form.CommonPageUserFormDTO;
import com.epmet.dto.result.ResiPointLogListResultDTO;
import com.epmet.dto.result.ResiPointLogPeriodResultDTO;
import com.epmet.entity.PointRuleEntity;
import com.epmet.entity.UserPointActionLogEntity;
import com.epmet.entity.UserPointStatisticalDailyEntity;
import com.epmet.entity.UserPointTotalEntity;
import com.epmet.service.UserPointActionLogService;
import com.epmet.service.UserPointStatisticalDailyService;
import com.epmet.service.UserPointTotalService;
import com.epmet.entity.*;
import com.epmet.service.*;
import com.epmet.utils.DimIdGenerator;
import com.epmet.utils.ModuleConstant;
import com.epmet.utils.RuleCycleEnum;
@ -77,6 +74,10 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
private UserPointStatisticalDailyService userPointStatisticalDailyService;
@Autowired
private PointRuleServiceImpl pointRuleService;
@Autowired
private BizPointTotalDetailService bizPointTotalDetailService;
@Autowired
private BizPointUserTotalDetailService bizPointUserTotalDetailService;
@Override
public PageData<UserPointActionLogDTO> page(Map<String, Object> params) {
IPage<UserPointActionLogEntity> page = baseDao.selectPage(
@ -253,7 +254,7 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
if(!StringUtils.equals(ModuleConstant.POINT_UNIT_TIME,ruleInfo.getPointUnit()) && !StringUtils.equals(ModuleConstant.POINT_UNIT_DAY,ruleInfo.getPointUnit())){
//其余积分单位
//TODO..
logger.warn(String.format("当前规则属于按%s计分,系统尚不支持响应此类积分规则的事件"),ruleInfo.getPointUnit());
logger.error(String.format("当前规则属于按%s计分,系统尚不支持响应此类积分规则的事件"),ruleInfo.getPointUnit());
return ;
}
@ -263,7 +264,9 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
if(ruleInfo.getUpLimit() > NumConstant.ZERO){
//不按照sourceId查询,查询指定日期内的相关积分规则的总和
Integer sum = baseDao.selectSumByEvent(event.getUserId(),eventCode,null,event.getCustomerId(),dateCheck,right);
if(null == sum) sum = NumConstant.ZERO;
if(null == sum) {
sum = NumConstant.ZERO;
}
if(StringUtils.equals(ModuleConstant.OPERATION_TYPE_PLUS,ruleInfo.getOperateType())){
if(ruleInfo.getPoint() < NumConstant.ZERO){
//保证要加的积分是正数
@ -317,8 +320,16 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
action.setUserId(event.getUserId());
action.setCreatedBy(StringUtils.isBlank(event.getOperatorId()) ? ModuleConstant.CREATED_BY_SYSTEM : event.getOperatorId());
action.setUpdatedBy(StringUtils.isBlank(event.getOperatorId()) ? ModuleConstant.CREATED_BY_SYSTEM : event.getOperatorId());
action.setSourceType(event.getSourceType());
action.setSourceId(event.getSourceId());
action.setOperatorAgencyId(event.getOpAgencyId());
if (("resi_group").equals(event.getEventClass())) {
action.setBizType("group");
action.setObjectId(event.getGroupId());
} else {
action.setBizType("activity");
action.setObjectId(event.getSourceId());
}
baseDao.insert(action);
//2.新增/修改用户积分日统计
DimIdGenerator.DimIdBean dimVal = DimIdGenerator.getDimIdBean(new Date());
@ -342,15 +353,71 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
point.setCreatedBy(StringUtils.isBlank(event.getOperatorId()) ? ModuleConstant.CREATED_BY_SYSTEM : event.getOperatorId());
point.setUpdatedBy(StringUtils.isBlank(event.getOperatorId()) ? ModuleConstant.CREATED_BY_SYSTEM : event.getOperatorId());
userPointTotalService.insertOrUpdate(point);
//
if (("resi_group").equals(event.getEventClass())) {
//2021.04.20 小组积分统计
//个人小组积分
BizPointUserTotalDetailDTO userTotalDetailDTO = bizPointUserTotalDetailService.getDataByObject("group", event.getGroupId(),
event.getUserId());
Integer userTotal = getUserTotalByObject("group", event.getGroupId(), event.getUserId());
if (null == userTotalDetailDTO) {
userTotalDetailDTO = new BizPointUserTotalDetailDTO();
userTotalDetailDTO.setCustomerId(event.getCustomerId());
userTotalDetailDTO.setAgencyId(event.getAgencyId());
userTotalDetailDTO.setGridId(event.getGridId());
userTotalDetailDTO.setUserId(event.getUserId());
userTotalDetailDTO.setBizType("group");
userTotalDetailDTO.setObjectId(event.getGroupId());
userTotalDetailDTO.setTotalPoint(userTotal);
bizPointUserTotalDetailService.save(userTotalDetailDTO);
} else {
userTotalDetailDTO.setTotalPoint(userTotal);
userTotalDetailDTO.setUpdatedTime(new Date());
bizPointUserTotalDetailService.update(userTotalDetailDTO);
}
//小组总积分
BizPointTotalDetailDTO totalDetailDTO = bizPointTotalDetailService.getDataByObject("group", event.getGroupId());
Integer total = getTotalByObject("group", event.getGroupId());
if (null == totalDetailDTO) {
totalDetailDTO = new BizPointTotalDetailDTO();
totalDetailDTO.setCustomerId(event.getCustomerId());
totalDetailDTO.setAgencyId(event.getAgencyId());
totalDetailDTO.setGridId(event.getGridId());
totalDetailDTO.setBizType("group");
totalDetailDTO.setObjectId(event.getGroupId());
totalDetailDTO.setTotalPoint(total);
bizPointTotalDetailService.save(totalDetailDTO);
} else {
totalDetailDTO.setTotalPoint(total);
totalDetailDTO.setUpdatedTime(new Date());
bizPointTotalDetailService.update(totalDetailDTO);
}
}
}else{
log.warn(String.format("未检测到该用户下有效的积分规则,消息体->【%s】", JSON.toJSON(event)));
log.error(String.format("未检测到该用户下有效的积分规则,消息体->【%s】", JSON.toJSON(event)));
}
}
/**
* 获取今日增量
*
* @param type
* @param objectId
* @return java.lang.Integer
* @author zhaoqifeng
* @date 2021/4/21 16:41
*/
@Override
public Integer getIncrease(String type, String objectId) {
return baseDao.selectIncrease(type, objectId);
}
private void plusPoint(SendPointFormDTO grantPoint) {
ValidatorUtils.validateEntity(grantPoint, SendPointFormDTO.SendPointGroup.class);
@ -379,6 +446,7 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
action.setCreatedBy(grantPoint.getOperatorId());
action.setUpdatedBy(grantPoint.getOperatorId());
action.setSourceId(grantPoint.getSourceId());
action.setSourceType("activity");
action.setOperatorAgencyId(grantPoint.getOpAgencyId());
baseDao.insert(action);
//2.新增/修改用户积分日统计
@ -402,4 +470,46 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
point.setUpdatedBy(grantPoint.getOperatorId());
userPointTotalService.insertOrUpdate(point);
}
private Integer getTotalByObject(String type, String objectId) {
QueryWrapper<UserPointActionLogEntity> wrapper = new QueryWrapper<>();
wrapper.select("IFNULL(SUM(POINT), 0) as POINT")
.eq("BIZ_TYPE", type)
.eq("OBJECT_ID", objectId)
.eq("ACTION_FLAG", "plus")
.eq("DEL_FLAG", NumConstant.ZERO_STR);
UserPointActionLogEntity entity1 = baseDao.selectOne(wrapper);
int plusTotal = null == entity1? NumConstant.ZERO : entity1.getPoint();
wrapper = new QueryWrapper<>();
wrapper.select("IFNULL(SUM(POINT), 0) as POINT")
.eq("BIZ_TYPE", type)
.eq("OBJECT_ID", objectId)
.eq("ACTION_FLAG", "minus")
.eq("DEL_FLAG", NumConstant.ZERO_STR);
UserPointActionLogEntity entity2 = baseDao.selectOne(wrapper);
int minusTotal = null == entity2? NumConstant.ZERO : entity2.getPoint();
return plusTotal - minusTotal;
}
private Integer getUserTotalByObject(String type, String objectId, String userId) {
QueryWrapper<UserPointActionLogEntity> wrapper = new QueryWrapper<>();
wrapper.select("IFNULL(SUM(POINT), 0) as POINT")
.eq("BIZ_TYPE", type)
.eq("OBJECT_ID", objectId)
.eq("USER_ID", userId)
.eq("ACTION_FLAG", "plus")
.eq("DEL_FLAG", NumConstant.ZERO_STR);
UserPointActionLogEntity entity1 = baseDao.selectOne(wrapper);
int plusTotal = null == entity1? NumConstant.ZERO : entity1.getPoint();
wrapper = new QueryWrapper<>();
wrapper.select("IFNULL(SUM(POINT), 0) as POINT")
.eq("BIZ_TYPE", type)
.eq("OBJECT_ID", objectId)
.eq("USER_ID", userId)
.eq("ACTION_FLAG", "minus")
.eq("DEL_FLAG", NumConstant.ZERO_STR);
UserPointActionLogEntity entity2 = baseDao.selectOne(wrapper);
int minusTotal = null == entity2? NumConstant.ZERO : entity2.getPoint();
return plusTotal - minusTotal;
}
}

3
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/ModuleConstant.java

@ -122,4 +122,7 @@ public interface ModuleConstant extends Constant {
String EVENT_NAME_ADD_LIVE = "添加活动实况";
String VERIFICATED_POINT_CAN_NOT_BE_NULL = "核销积分不能为空";
String GROUP_RULE_SUMMARY = "小组积分是指组内所有成员在本组内活动时所获取的积分总和。";
String CONTRI_SUMMARY = "组内贡献是指组内成员在本组进行活动时所获取的积分贡献值。";
}

3
epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.10__updateRule.sql

@ -0,0 +1,3 @@
UPDATE point_rule_default SET RULE_NAME = '组长转话题为议题' WHERE EVENT_CODE = 'shift_topic_to_issue';
UPDATE point_rule SET RULE_NAME = '组长转话题为议题' WHERE EVENT_CODE = 'shift_topic_to_issue';
INSERT INTO `epmet_point`.`point_rule_default`(`ID`, `RULE_NAME`, `RULE_DESC`, `EVENT_CODE`, `FUNCTION_ID`, `OPERATE_TYPE`, `UP_LIMIT`, `UP_LIMIT_DESC`, `UP_LIMIT_PREFIX`, `RULE_PERIOD`, `POINT`, `POINT_UNIT`, `ENABLED_FLAG`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('10', '组长解决话题', '组长解决组内话题', 'leader_resolve_topic', '1', 'plus', 0, '无上限', NULL, 'day', 2, 'time', '0', '0', 0, 'APP_USER', '2021-04-19 15:55:18', 'APP_USER', '2021-04-19 15:55:18');

40
epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.9__groupPoint.sql

@ -0,0 +1,40 @@
CREATE TABLE `biz_point_total_detail` (
`ID` varchar(64) NOT NULL COMMENT '主键',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID',
`AGENCY_ID` varchar(64) NOT NULL COMMENT '组织Id',
`GRID_ID` varchar(64) NOT NULL COMMENT '网格ID',
`BIZ_TYPE` varchar(64) NOT NULL DEFAULT '0' COMMENT '业务类型:小组:group',
`OBJECT_ID` varchar(64) NOT NULL DEFAULT '0' COMMENT '业务类型的对象id',
`TOTAL_POINT` int(11) NOT NULL DEFAULT '0' COMMENT 'OBJECTID的总积分 总积分=objectId下所有的用户积分',
`DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识',
`REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁',
`CREATED_BY` varchar(64) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE,
UNIQUE KEY `unx_o_point` (`OBJECT_ID`,`BIZ_TYPE`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='按业务类型积分总计';
CREATE TABLE `biz_point_user_total_detail` (
`ID` varchar(64) NOT NULL COMMENT '主键',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID',
`AGENCY_ID` varchar(64) NOT NULL COMMENT '组织Id',
`GRID_ID` varchar(64) NOT NULL COMMENT '网格ID',
`USER_ID` varchar(64) NOT NULL COMMENT '用户ID',
`BIZ_TYPE` varchar(64) NOT NULL DEFAULT '0' COMMENT '业务类型:小组:group',
`OBJECT_ID` varchar(64) NOT NULL DEFAULT '0' COMMENT '业务类型的对象id',
`TOTAL_POINT` int(11) NOT NULL DEFAULT '0' COMMENT 'OBJECTID的总积分 总积分=objectId下所有的用户积分',
`DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识',
`REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁',
`CREATED_BY` varchar(64) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE,
UNIQUE KEY `unx_point` (`USER_ID`,`OBJECT_ID`,`BIZ_TYPE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='按业务类型积分总计';
ALTER TABLE `user_point_action_log`
ADD COLUMN `BIZ_TYPE` varchar(64) NULL COMMENT '业务类型:小组:group 活动 activity' AFTER `EVENT_ID`,
ADD COLUMN `OBJECT_ID` varchar(64) NULL COMMENT '业务类型的对象id' AFTER `BIZ_TYPE`,
ADD COLUMN `SOURCE_TYPE` varchar(20) NULL COMMENT '活动 activity 活动ID\r\n志愿者 volunteer 用户ID\r\n邀请进组 invite 用户ID\r\n话题 topic 话题ID\r\n话题转议题 issue 议题id\r\n话题转项目 project 话题ID' AFTER `OBJECT_ID`;

33
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/BizPointTotalDetailDao.xml

@ -0,0 +1,33 @@
<?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.BizPointTotalDetailDao">
<resultMap type="com.epmet.entity.BizPointTotalDetailEntity" id="bizPointTotalDetailMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="gridId" column="GRID_ID"/>
<result property="bizType" column="BIZ_TYPE"/>
<result property="objectId" column="OBJECT_ID"/>
<result property="totalPoint" column="TOTAL_POINT"/>
<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="selectDataByObject" resultType="com.epmet.dto.BizPointTotalDetailDTO">
select ID,
CUSTOMER_ID,
AGENCY_ID,
GRID_ID,
TOTAL_POINT
from biz_point_total_detail
where BIZ_TYPE = #{type}
and OBJECT_ID = #{objectId}
</select>
</mapper>

32
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/BizPointUserTotalDetailDao.xml

@ -0,0 +1,32 @@
<?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.BizPointUserTotalDetailDao">
<resultMap type="com.epmet.entity.BizPointUserTotalDetailEntity" id="bizPointUserTotalDetailMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="gridId" column="GRID_ID"/>
<result property="userId" column="USER_ID"/>
<result property="bizType" column="BIZ_TYPE"/>
<result property="objectId" column="OBJECT_ID"/>
<result property="totalPoint" column="TOTAL_POINT"/>
<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="selectIncrease" resultType="java.lang.Integer">
SELECT IFNULL(SUM(TOTAL_POINT), 0)
FROM biz_point_user_total_detail
WHERE
BIZ_TYPE = #{type}
AND OBJECT_ID = #{objectId}
AND DATE_FORMAT(CREATED_TIME, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d')
</select>
</mapper>

8
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml

@ -28,7 +28,11 @@
SELECT DISTINCT FUNCTION_ID FROM point_rule WHERE CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
</select>
<select id="selectListByFunctionId" resultMap="pointRuleMap">
SELECT ID,RULE_NAME,RULE_DESC,POINT,POINT_UNIT,ENABLED_FLAG FROM point_rule WHERE CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND FUNCTION_ID = #{functionId,jdbcType=VARCHAR}
SELECT ID,RULE_NAME,RULE_DESC,POINT,POINT_UNIT,ENABLED_FLAG FROM point_rule
WHERE
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
AND FUNCTION_ID = #{functionId,jdbcType=VARCHAR}
AND DEL_FLAG = '0'
</select>
<update id="updateByCustomerId">
UPDATE point_rule
@ -50,4 +54,4 @@
<select id="selectCustomerIds" resultType="java.lang.String">
SELECT DISTINCT CUSTOMER_ID FROM point_rule WHERE DEL_FLAG = '0'
</select>
</mapper>
</mapper>

8
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml

@ -65,4 +65,12 @@
AND CREATED_TIME <![CDATA[ < ]]> #{right}
</if>
</select>
<select id="selectIncrease" resultType="java.lang.Integer">
SELECT IFNULL(SUM(POINT), 0)
FROM USER_POINT_ACTION_LOG
WHERE
BIZ_TYPE = #{type}
AND OBJECT_ID = #{objectId}
AND DATE_FORMAT(CREATED_TIME, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d')
</select>
</mapper>

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

@ -301,4 +301,12 @@ public interface GovIssueOpenFeignClient {
**/
@PostMapping(value = "/gov/issue/issueprojectcategorydict/getcategorytaglist")
Result<CategoryTagResultDTO> getCategoryTagList(@RequestBody CategoryTagListFormDTO formDTO);
/**
* @param customerId
* @Description 根据客户Id获取 议题列表
* @Author sun
**/
@PostMapping(value = "/gov/issue/issue/getissuelist")
Result<List<IssueDTO>> getIssueList(@RequestParam String customerId);
}

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

@ -256,4 +256,9 @@ public class GovIssueOpenFeignClientFallBack implements GovIssueOpenFeignClient
public Result<CategoryTagResultDTO> getCategoryTagList(CategoryTagListFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "getCategoryTagList", formDTO);
}
@Override
public Result<List<IssueDTO>> getIssueList(String customerId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "getIssueList", customerId);
}
}

1
epmet-module/gov-issue/gov-issue-server/pom.xml

@ -216,7 +216,6 @@
<!--rocketmq-->
<rocketmq.nameserver>192.168.1.130:9876;192.168.1.132:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties>
</profile>
<profile>

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

@ -12,10 +12,7 @@ import com.epmet.resi.group.dto.group.result.GroupVotingListResultDTO;
import com.epmet.resi.group.dto.topic.form.TopicInfoFormDTO;
import com.epmet.service.IssueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -246,5 +243,18 @@ public class IssueController {
return new Result<List<GroupClosedListResultDTO>>().ok(issueService.getClosedListByGroup(formDTO));
}
/**
* desc: 获取议题列表
*
* @param customerId
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.IssueDTO>>
* @author LiuJanJun
* @date 2021/4/27 10:19 上午
*/
@PostMapping("getissuelist")
public Result<List<IssueDTO>> getIssueList(@RequestParam String customerId) {
return new Result<List<IssueDTO>>().ok(issueService.getIssueList(customerId));
}
}

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

@ -315,4 +315,14 @@ public interface IssueService extends BaseService<IssueEntity> {
* @return java.util.List<com.epmet.resi.group.dto.group.result.GroupClosedListResultDTO>
*/
List<GroupClosedListResultDTO> getClosedListByGroup(AllIssueFormDTO formDTO);
/**
* desc: 根据客户Id获取议题列表
*
* @param customerId
* @return java.util.List<com.epmet.dto.IssueDTO>
* @author LiuJanJun
* @date 2021/4/27 10:23 上午
*/
List<IssueDTO> getIssueList(String customerId);
}

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

@ -5,6 +5,7 @@ import com.alibaba.nacos.client.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.rocketmq.messages.GroupAchievementMQMsg;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
@ -27,14 +28,15 @@ import com.epmet.dao.IssueDao;
import com.epmet.dao.IssueProcessDao;
import com.epmet.dao.IssueProjectRelationDao;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.form.IssueAuditionFormDTO;
import com.epmet.dto.form.IssueShiftedFromTopicFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.IssueEntity;
import com.epmet.entity.IssueProcessEntity;
import com.epmet.entity.IssueProjectRelationEntity;
import com.epmet.feign.*;
import com.epmet.commons.tools.enums.AchievementTypeEnum;
import com.epmet.redis.GovIssueRedis;
import com.epmet.redis.IssueVoteDetailRedis;
import com.epmet.resi.group.dto.group.form.AllIssueFormDTO;
@ -44,10 +46,11 @@ import com.epmet.resi.group.dto.group.result.GroupInfoResultDTO;
import com.epmet.resi.group.dto.group.result.GroupShiftProjectListResultDTO;
import com.epmet.resi.group.dto.group.result.GroupVotingListResultDTO;
import com.epmet.resi.group.dto.topic.ResiTopicDTO;
import com.epmet.resi.group.dto.topic.form.*;
import com.epmet.resi.group.dto.topic.form.GovTopicIssueInfoFormDTO;
import com.epmet.resi.group.dto.topic.form.*;
import com.epmet.resi.group.dto.topic.result.GovTopicIssueInfoResultDTO;
import com.epmet.resi.group.feign.ResiGroupOpenFeignClient;
import com.epmet.send.SendMqMsgUtil;
import com.epmet.service.*;
import com.epmet.utils.ModuleConstants;
import com.github.pagehelper.PageHelper;
@ -553,7 +556,12 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp
//}
//applicationService.update(app2update);
//发送小组成就消息
boolean flag = SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient)
.sendGroupAchievementMqMsg(new GroupAchievementMQMsg(application.getCustomerId(), application.getGroupId(), AchievementTypeEnum.TOISSUE.getCode()));
if (!flag) {
logger.error("发送(小组成就)系统消息到message服务失败");
}
return app2update.getIssueId();
}
@ -1387,4 +1395,17 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp
return baseDao.selectClosedListByTopic(formDTO);
}
@Override
public List<IssueDTO> getIssueList(String customerId) {
QueryWrapper<IssueEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda()
.eq(IssueEntity::getCustomerId,customerId)
.eq(IssueEntity::getDelFlag,NumConstant.ZERO_STR);
List<IssueEntity> issueEntities = baseDao.selectList(queryWrapper);
if (CollectionUtils.isEmpty(issueEntities)){
return null;
}
return ConvertUtils.sourceToTarget(issueEntities,IssueDTO.class);
}
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java

@ -2,6 +2,7 @@ package com.epmet.mq;
import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants;
import com.epmet.commons.rocketmq.constants.TopicConstants;
import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.mq.listener.InitCustomerOrgRolesListener;
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.apache.rocketmq.client.consumer.listener.MessageListener;
@ -14,7 +15,8 @@ import javax.annotation.PostConstruct;
@Component
public class RocketMQConsumerRegister {
@Value("${spring.profiles.active}")
private String env;
@Value("${rocketmq.name-server}")
private String nameServer;
@ -27,7 +29,9 @@ public class RocketMQConsumerRegister {
@PostConstruct
public void registerAllListeners() {
try {
register(nameServer, ConsomerGroupConstants.INIT_CUSTOMER_ORG_ROLES_GROUP, MessageModel.CLUSTERING, TopicConstants.INIT_CUSTOMER, "*", new InitCustomerOrgRolesListener());
if (!EnvEnum.LOCAL.getCode().equals(env)) {
register(nameServer, ConsomerGroupConstants.INIT_CUSTOMER_ORG_ROLES_GROUP, MessageModel.CLUSTERING, TopicConstants.INIT_CUSTOMER, "*", new InitCustomerOrgRolesListener());
}
} catch (MQClientException e) {
e.printStackTrace();
}

100
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgListener.java

@ -1,100 +0,0 @@
package com.epmet.mq.listener;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants;
import com.epmet.commons.rocketmq.constants.TopicConstants;
import com.epmet.commons.rocketmq.messages.InitCustomerMQMsg;
import com.epmet.commons.tools.distributedlock.DistributedLock;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.constant.UserWorkType;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.form.AddAgencyAndStaffFormDTO;
import com.epmet.dto.form.AdminStaffFromDTO;
import com.epmet.service.AgencyService;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.redisson.api.RLock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.concurrent.TimeUnit;
/**
* 监听初始化客户动作为客户初始化角色列表
*/
//@RocketMQMessageListener(topic = TopicConstants.INIT_CUSTOMER,
// consumerGroup = ConsomerGroupConstants.INIT_CUSTOMER_ORG_ROLES_GROUP,
// messageModel = MessageModel.CLUSTERING,
// selectorExpression = "*")
//@Component
public class InitCustomerOrgListener implements RocketMQListener<MessageExt> {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private AgencyService agencyService;
@Autowired
private DistributedLock distributedLock;
@Override
public void onMessage(MessageExt messageExt) {
String msg = new String(messageExt.getBody());
logger.info("初始化客户-初始化组织信息-收到消息内容:{}", msg);
InitCustomerMQMsg msgObj = JSON.parseObject(msg, InitCustomerMQMsg.class);
RLock lock = null;
try {
lock = distributedLock.getLock(String.format("lock:init_customer_org:%s", msgObj.getCustomerId()),
30l, 30l, TimeUnit.SECONDS);
agencyService.saveRootAgency(constructRootAndAgencyDTO(msgObj));
} catch (RenException e) {
// 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试
logger.error("【RocketMQ】初始化客户组织失败:".concat(ExceptionUtils.getErrorStackTrace(e)));
} catch (Exception e) {
// 不是我们自己抛出的异常,可以让MQ重试
logger.error("【RocketMQ】初始化客户组织失败:".concat(ExceptionUtils.getErrorStackTrace(e)));
throw e;
} finally {
distributedLock.unLock(lock);
}
}
/**
* @Description 构造dto
* @return
* @author wxz
* @date 2021.01.06 15:03
*/
private AddAgencyAndStaffFormDTO constructRootAndAgencyDTO(InitCustomerMQMsg msgObj) {
AddAgencyAndStaffFormDTO agencyAndStaff = new AddAgencyAndStaffFormDTO();
//客户组织信息
CustomerAgencyDTO agencyDTO = new CustomerAgencyDTO();
agencyDTO.setId(msgObj.getAgency().getAgencyId());
agencyDTO.setCustomerId(msgObj.getCustomerId());
agencyDTO.setOrganizationName(msgObj.getAgency().getOrganizationName());
agencyDTO.setLevel(msgObj.getAgency().getLevel());
agencyDTO.setAreaCode(msgObj.getAgency().getAreaCode());
agencyDTO.setProvince(msgObj.getAgency().getProvince());
agencyDTO.setCity(msgObj.getAgency().getCity());
agencyDTO.setDistrict(msgObj.getAgency().getDistrict());
agencyAndStaff.setAgencyDTO(agencyDTO);
//客户管理员信息
AdminStaffFromDTO staffSubmitFrom = new AdminStaffFromDTO();
staffSubmitFrom.setCustomerId(msgObj.getCustomerId());
staffSubmitFrom.setAgencyId(msgObj.getStaff().getAgencyId());
staffSubmitFrom.setGender(msgObj.getStaff().getGender());
staffSubmitFrom.setMobile(msgObj.getStaff().getMobile());
staffSubmitFrom.setName(msgObj.getStaff().getName());
staffSubmitFrom.setWorkType(UserWorkType.FULL_TIME);
agencyAndStaff.setStaffDTO(staffSubmitFrom);
return agencyAndStaff;
}
}

22
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgRolesListener.java

@ -23,11 +23,12 @@ import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* @author wxz
* @Description 创建客户-组织和角色监听器
* @return
* @author wxz
* @date 2021.03.03 16:10
*/
*/
//@Component
public class InitCustomerOrgRolesListener implements MessageListenerConcurrently {
private Logger logger = LoggerFactory.getLogger(getClass());
@ -37,7 +38,8 @@ public class InitCustomerOrgRolesListener implements MessageListenerConcurrently
try {
msgs.forEach(msg -> consumeMessage(msg));
} catch (Exception e) {
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
logger.error(ExceptionUtils.getErrorStackTrace(e));
return ConsumeConcurrentlyStatus.RECONSUME_LATER;
}
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}
@ -52,7 +54,7 @@ public class InitCustomerOrgRolesListener implements MessageListenerConcurrently
try {
distributedLock = SpringContextUtils.getBean(DistributedLock.class);
lock = distributedLock.getLock(String.format("lock:init_customer_org:%s", msgObj.getCustomerId()),
30l, 30l, TimeUnit.SECONDS);
30L, 30L, TimeUnit.SECONDS);
SpringContextUtils.getBean(AgencyService.class).saveRootAgency(constructRootAndAgencyDTO(msgObj));
} catch (RenException e) {
// 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试
@ -67,8 +69,8 @@ public class InitCustomerOrgRolesListener implements MessageListenerConcurrently
}
/**
* @Description 构造dto
* @return
* @Description 构造dto
* @author wxz
* @date 2021.01.06 15:03
*/
@ -98,4 +100,14 @@ public class InitCustomerOrgRolesListener implements MessageListenerConcurrently
return agencyAndStaff;
}
/* @Override
public ConsumerConfigProperties getConsumerProperty() {
ConsumerConfigProperties configProperties = new ConsumerConfigProperties();
configProperties.setConsumerGroup(ConsomerGroupConstants.INIT_CUSTOMER_ORG_ROLES_GROUP);
configProperties.setTopic(TopicConstants.INIT_CUSTOMER);
configProperties.setTag("*");
configProperties.setConsumerListener(this);
return configProperties;
}*/
}

62
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java

@ -0,0 +1,62 @@
package com.epmet.mq;
import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants;
import com.epmet.commons.rocketmq.constants.TopicConstants;
import com.epmet.mq.listener.InitCustomerComponentsListener;
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.apache.rocketmq.client.consumer.listener.MessageListener;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
@Component
public class RocketMQConsumerRegister {
@Value("${rocketmq.name-server}")
private String nameServer;
/**
* @return
* @Description 注册监听器
* @author wxz
* @date 2021.03.03 16:09
*/
@PostConstruct
public void registerAllListeners() {
try {
register(nameServer, ConsomerGroupConstants.INIT_CUSTOMER_COMPONENTS_GROUP, MessageModel.CLUSTERING, TopicConstants.INIT_CUSTOMER, "*", new InitCustomerComponentsListener());
} catch (MQClientException e) {
e.printStackTrace();
}
}
public void register(String nameServer, String group, MessageModel messageModel, String topic, String subException, MessageListener listener) throws MQClientException {
// 实例化消费者
DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(group);
// 设置NameServer的地址
consumer.setNamesrvAddr(nameServer);
consumer.setMessageModel(messageModel);
consumer.setInstanceName(buildInstanceName());
// 订阅一个或者多个Topic,以及Tag来过滤需要消费的消息
consumer.subscribe(topic, subException);
// 注册回调实现类来处理从broker拉取回来的消息
consumer.registerMessageListener(listener);
// 启动消费者实例
consumer.start();
}
private String buildInstanceName() {
String instanceName = "";
for (int i = 0; i < 4; i++) {
int t = (int) (Math.random() * 10);
instanceName = instanceName.concat(t + "");
}
return instanceName;
}
}

55
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/listener/InitCustomerCustomizeListener.java → epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/listener/InitCustomerComponentsListener.java

@ -1,46 +1,45 @@
package com.epmet.mq.listener;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants;
import com.epmet.commons.rocketmq.constants.TopicConstants;
import com.epmet.commons.rocketmq.messages.InitCustomerMQMsg;
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.utils.SpringContextUtils;
import com.epmet.dto.CustomerHomeDTO;
import com.epmet.service.CustomerHomeService;
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.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.redisson.api.RLock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* 监听初始化客户动作为客户初始化角色列表
*/
@RocketMQMessageListener(topic = TopicConstants.INIT_CUSTOMER,
consumerGroup = ConsomerGroupConstants.INIT_CUSTOMER_COMPONENTS_GROUP,
messageModel = MessageModel.CLUSTERING,
selectorExpression = "*")
@Component
public class InitCustomerCustomizeListener implements RocketMQListener<MessageExt> {
//@Component
public class InitCustomerComponentsListener implements MessageListenerConcurrently {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private CustomerHomeService customerHomeService;
@Autowired
private DistributedLock distributedLock;
@Override
public void onMessage(MessageExt messageExt) {
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) {
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) {
String msg = new String(messageExt.getBody());
logger.info("初始化客户-初始化客户自定义信息-收到消息内容:{}", msg);
InitCustomerMQMsg msgObj = JSON.parseObject(msg, InitCustomerMQMsg.class);
@ -48,10 +47,14 @@ public class InitCustomerCustomizeListener implements RocketMQListener<MessageEx
CustomerHomeDTO customerHomeDTO = new CustomerHomeDTO();
customerHomeDTO.setCustomerId(msgObj.getCustomerId());
DistributedLock distributedLock = null;
RLock lock = null;
try {
distributedLock = SpringContextUtils.getBean(DistributedLock.class);
lock = distributedLock.getLock(String.format("lock:init_customer_home:%s", msgObj.getCustomerId()),
30l, 30l, TimeUnit.SECONDS);
CustomerHomeService customerHomeService = SpringContextUtils.getBean(CustomerHomeService.class);
customerHomeService.init(customerHomeDTO);
} catch (RenException e) {
// 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试
@ -59,9 +62,19 @@ public class InitCustomerCustomizeListener implements RocketMQListener<MessageEx
} catch (Exception e) {
// 不是我们自己抛出的异常,可以让MQ重试
logger.error("【RocketMQ】初始化客户组件失败:".concat(ExceptionUtils.getErrorStackTrace(e)));
throw e;
throw e;
} finally {
distributedLock.unLock(lock);
}
}
}
/* @Override
public ConsumerConfigProperties getConsumerProperty() {
ConsumerConfigProperties configProperties = new ConsumerConfigProperties();
configProperties.setConsumerGroup(ConsomerGroupConstants.INIT_CUSTOMER_COMPONENTS_GROUP);
configProperties.setTopic(TopicConstants.INIT_CUSTOMER);
configProperties.setTag("*");
configProperties.setConsumerListener(this);
return configProperties;
}*/
}

3
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java

@ -117,4 +117,7 @@ public interface TopicConstant {
* 字段 附件类型 大写 下划线
*/
String FIELD_TOPIC_ATTACHMENT_TYPE = "ATTACHMENT_TYPE";
String RESOLVED = "resolved";
String MEMBER = "member";
}

111
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupAchievementStatsDTO.java

@ -0,0 +1,111 @@
/**
* 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.resi.group.dto.group;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 小组成就统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-19
*/
@Data
public class ResiGroupAchievementStatsDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户Id
*/
private String customerId;
/**
* 小组Id
*/
private String groupId;
/**
* 里程ID
*/
private String achievementId;
/**
* 里程名称
*/
private String achievementName;
/**
* 实现时间
*/
private Date arriveTime;
/**
* 当前值
*/
private Integer currentValue;
/**
* 目标值
*/
private Integer targetValue;
/**
* 目标是否实现10
*/
private Integer isArrive;
/**
* 删除标记 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

18
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupDTO.java

@ -17,10 +17,12 @@
package com.epmet.resi.group.dto.group;
import com.epmet.resi.group.dto.member.ResiGroupMemberDTO;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
@ -85,6 +87,16 @@ Ps: 如果一个小组被拒绝,当前小组的状态将永久停留在“审
*/
private String visitSwitch;
/**
* 小组类型(ordinary:楼院小组 branch:支部小组)
*/
private String groupType;
/**
* 小组等级
*/
private Integer level;
/**
* 删除标记 0未删除1已删除
*/
@ -114,9 +126,7 @@ Ps: 如果一个小组被拒绝,当前小组的状态将永久停留在“审
* 更新时间
*/
private Date updatedTime;
private List<ResiGroupMemberDTO> memberList;
/**
* 小组类型(ordinary:楼院小组 branch:支部小组)
*/
private String groupType;
}

5
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupInfoRedisDTO.java

@ -46,6 +46,11 @@ public class ResiGroupInfoRedisDTO implements Serializable{
* */
private String gridId;
/**
* 小组等级
* */
private String level;
/**
* 组状态
* */

17
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupFormDTO.java

@ -0,0 +1,17 @@
package com.epmet.resi.group.dto.group.form;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/4/19 15:57
*/
@Data
public class GroupFormDTO implements Serializable {
private static final long serialVersionUID = 5330629771935235995L;
private String groupId;
private String gridId;
}

41
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/AchievementDetailResultDTO.java

@ -0,0 +1,41 @@
package com.epmet.resi.group.dto.group.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/4/19 14:19
*/
@NoArgsConstructor
@Data
public class AchievementDetailResultDTO implements Serializable {
private static final long serialVersionUID = 2426917315141725167L;
/**
* 小组创建时间
*/
private Long createdDate;
private List<AchievementBean> achievement;
@NoArgsConstructor
@Data
public static class AchievementBean {
/**
* 达成时间
*/
private Long completionDate;
/**
* 成就描述分拼在一起
*/
private String describe;
/**
* 是否达成 01
*/
private Integer isArrive;
}
}

4
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GovGroupSummarizeResultDTO.java

@ -40,4 +40,8 @@ public class GovGroupSummarizeResultDTO implements Serializable {
* 话题总数
*/
private Integer totalTopics;
/**
* 小组等级
*/
private String level;
}

46
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupPointDetailResultDTO.java

@ -0,0 +1,46 @@
package com.epmet.resi.group.dto.group.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/4/21 10:37
*/
@NoArgsConstructor
@Data
public class GroupPointDetailResultDTO implements Serializable {
private static final long serialVersionUID = -1158521486690554498L;
/**
* 小组当前等级
*/
private String level;
/**
* 总积分
*/
private String total;
/**
* 今日增长
*/
private String increase;
/**
* 距离升级所需积分
*/
private String toUpgrade;
/**
* 下一等级积分
*/
private String nextLevelPoint;
/**
* 下一等级
*/
private String nextLevel;
/**
* 当前积分
*/
private String currentPoint;
}

2
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupSummarizeResultDTO.java

@ -69,6 +69,8 @@ public class GroupSummarizeResultDTO implements Serializable {
* 进组审核open开启close关闭
*/
private String auditSwitch;
private String level;
public GroupSummarizeResultDTO(){
this.setGroupId("");
this.setGroupHeadPhoto("");

18
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/AchievementResultDTO.java

@ -0,0 +1,18 @@
package com.epmet.resi.group.dto.member.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/4/22 9:24
*/
@Data
public class AchievementResultDTO implements Serializable {
private static final long serialVersionUID = 8079550501852632061L;
private String groupId;
private String achievementDesc;
}

18
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/GroupAchievementDTO.java

@ -0,0 +1,18 @@
package com.epmet.resi.group.dto.member.result;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/4/22 9:42
*/
@Data
public class GroupAchievementDTO implements Serializable {
private static final long serialVersionUID = 2195790168656351743L;
private String groupId;
private String groupName;
private String achievementName;
}

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

@ -5,10 +5,7 @@ import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.resi.group.dto.group.ResiGroupDTO;
import com.epmet.resi.group.dto.group.form.*;
import com.epmet.resi.group.dto.group.result.ApplicationDetailCopyResultDTO;
import com.epmet.resi.group.dto.group.result.ApplyingGroupResultDTO;
import com.epmet.resi.group.dto.group.result.GroupEditionDetailResultDTO;
import com.epmet.resi.group.dto.group.result.GroupInfoResultDTO;
import com.epmet.resi.group.dto.group.result.*;
import com.epmet.resi.group.dto.topic.MyCreateTopicsFormDTO;
import com.epmet.resi.group.dto.topic.ResiTopicDTO;
import com.epmet.resi.group.dto.topic.form.*;
@ -226,4 +223,34 @@ public interface ResiGroupOpenFeignClient {
*/
@PostMapping("/resi/group/topic/allmessages")
Result<List<AllMessagesResultDTO>> allMessages(@RequestBody AllMessagesFormDTO formDTO);
/**
* 获取小组详情
* @author zhaoqifeng
* @date 2021/4/21 15:20
* @param groupId
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.group.ResiGroupDTO>
*/
@PostMapping("resi/group/group/groupDetail/{groupId}")
Result<ResiGroupDTO> getGroupDetail(@PathVariable String groupId);
/**
* 获取网格下小组
* @author zhaoqifeng
* @date 2021/4/21 15:57
* @param gridId
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.resi.group.dto.group.ResiGroupDTO>>
*/
@PostMapping("resi/group/group/groupList/{gridId}")
Result<List<ResiGroupDTO>> getGroupListByGrid(@PathVariable String gridId);
/**
* 小组积分详情
* @author zhaoqifeng
* @date 2021/4/21 16:30
* @param groupId
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO>
*/
@PostMapping("resi/group/group/groupPointDetail/{groupId}")
Result<GroupPointDetailResultDTO> groupPointDetail(@PathVariable String groupId);
}

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

@ -5,10 +5,7 @@ import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.resi.group.dto.group.ResiGroupDTO;
import com.epmet.resi.group.dto.group.form.*;
import com.epmet.resi.group.dto.group.result.ApplicationDetailCopyResultDTO;
import com.epmet.resi.group.dto.group.result.ApplyingGroupResultDTO;
import com.epmet.resi.group.dto.group.result.GroupEditionDetailResultDTO;
import com.epmet.resi.group.dto.group.result.GroupInfoResultDTO;
import com.epmet.resi.group.dto.group.result.*;
import com.epmet.resi.group.dto.topic.MyCreateTopicsFormDTO;
import com.epmet.resi.group.dto.topic.ResiTopicDTO;
import com.epmet.resi.group.dto.topic.form.*;
@ -162,4 +159,43 @@ public class ResiGroupOpenFeignClientFallback implements ResiGroupOpenFeignClien
public Result<List<AllMessagesResultDTO>> allMessages(AllMessagesFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "allMessages", formDTO);
}
/**
* 获取小组详情
*
* @param groupId
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.group.ResiGroupDTO>
* @author zhaoqifeng
* @date 2021/4/21 15:20
*/
@Override
public Result<ResiGroupDTO> getGroupDetail(String groupId) {
return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "getGroupDetail", groupId);
}
/**
* 获取网格下小组
*
* @param gridId
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.resi.group.dto.group.ResiGroupDTO>>
* @author zhaoqifeng
* @date 2021/4/21 15:57
*/
@Override
public Result<List<ResiGroupDTO>> getGroupListByGrid(String gridId) {
return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "getGroupListByGrid", gridId);
}
/**
* 小组积分详情
*
* @param groupId
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO>
* @author zhaoqifeng
* @date 2021/4/21 16:30
*/
@Override
public Result<GroupPointDetailResultDTO> groupPointDetail(String groupId) {
return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "groupPointDetail", groupId);
}
}

24
epmet-module/resi-group/resi-group-server/pom.xml

@ -112,6 +112,18 @@
<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>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>oper-crm-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
@ -185,6 +197,10 @@
</dingTalk.robot.webHook>
<dingTalk.robot.secret>SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19
</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.nameserver>192.168.1.130:9876;192.168.1.132:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties>
</profile>
<profile>
@ -237,6 +253,8 @@
</dingTalk.robot.webHook>
<dingTalk.robot.secret>SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19
</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.nameserver>192.168.1.130:9876;192.168.1.132:9876</rocketmq.nameserver>
</properties>
</profile>
<profile>
@ -288,6 +306,9 @@
</dingTalk.robot.webHook>
<dingTalk.robot.secret>SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19
</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.nameserver>192.168.10.161:9876</rocketmq.nameserver>
</properties>
</profile>
<profile>
@ -336,6 +357,9 @@
</dingTalk.robot.webHook>
<dingTalk.robot.secret>SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1
</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.nameserver>192.168.11.187:9876;192.168.11.184:9876</rocketmq.nameserver>
</properties>
</profile>
</profiles>

79
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java

@ -25,18 +25,21 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.modules.group.service.ResiGroupService;
import com.epmet.modules.group.service.ResiGroupStatisticalService;
import com.epmet.modules.group.service.StatsAchievementService;
import com.epmet.resi.group.dto.group.GroupProcessingCountResultDTO;
import com.epmet.resi.group.dto.group.ResiGroupDTO;
import com.epmet.resi.group.dto.group.form.*;
import com.epmet.resi.group.dto.group.result.*;
import com.epmet.resi.group.dto.member.form.EditAuditSwitchFormDTO;
import com.epmet.resi.group.dto.member.form.ResiIdentityFormDTO;
import com.epmet.resi.group.dto.member.result.AchievementResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
@ -55,6 +58,8 @@ public class ResiGroupController {
private ResiGroupService resiGroupService;
@Autowired
private ResiGroupStatisticalService resiGroupStatisticalService;
@Autowired
private StatsAchievementService statsAchievementService;
/**
* @param tokenDto
@ -511,4 +516,78 @@ public class ResiGroupController {
return new Result<List<AllGroupListResultDTO>>().ok(resiGroupService.allGroupList(formDTO));
}
/**
* 小组成就详情
* @author zhaoqifeng
* @date 2021/4/19 14:25
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.group.result.AchievementDetailResultDTO>
*/
@PostMapping("achievementdetail")
public Result<AchievementDetailResultDTO> achievementDetail(@RequestBody GroupFormDTO formDTO) {
return new Result<AchievementDetailResultDTO>().ok(resiGroupService.achievementDetail(formDTO));
}
/**
* 获取小组详情
* @author zhaoqifeng
* @date 2021/4/21 15:17
* @param groupId
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.group.ResiGroupDTO>
*/
@PostMapping("groupDetail/{groupId}")
public Result<ResiGroupDTO> getGroupDetail(@PathVariable String groupId) {
ResiGroupDTO groupDTO = resiGroupService.getGroupInfoAndGroupMember(groupId);
return new Result<ResiGroupDTO>().ok(groupDTO);
}
/**
* 获取网格下小组
* @author zhaoqifeng
* @date 2021/4/21 15:57
* @param gridId
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.resi.group.dto.group.ResiGroupDTO>>
*/
@PostMapping("groupList/{gridId}")
public Result<List<ResiGroupDTO>> getGroupListByGrid(@PathVariable String gridId) {
List<ResiGroupDTO> list = resiGroupService.getGroupListByGrid(gridId);
return new Result<List<ResiGroupDTO>>().ok(list);
}
/**
* 小组积分详情
* @author zhaoqifeng
* @date 2021/4/21 16:22
* @param groupId
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO>
*/
@PostMapping("groupPointDetail/{groupId}")
public Result<GroupPointDetailResultDTO> groupPointDetail(@PathVariable String groupId) {
return new Result<GroupPointDetailResultDTO>().ok(resiGroupService.groupPointDetail(groupId));
}
/**
* 小组近段时间实现的成就列表
* @author zhaoqifeng
* @date 2021/4/22 9:27
* @param tokenDto
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.member.result.AchievementResultDTO>
*/
@PostMapping("achievement")
public Result<List<AchievementResultDTO>> achievement(@LoginUser TokenDto tokenDto, @RequestBody GroupFormDTO formDTO) {
return new Result<List<AchievementResultDTO>>().ok(resiGroupService.achievement(tokenDto, formDTO));
}
/**
* desc: 初始化小组成就用于小组成就上线后-历史小组的成就的初始化执行过后就再无意义
*
* @param customerId
* @return com.epmet.commons.tools.utils.Result<java.lang.Boolean>
* @author LiuJanJun
* @date 2021/4/25 12:41 下午
*/
@GetMapping("initachievement")
public Result<Boolean> initAchievement(@RequestParam String customerId) {
return new Result<Boolean>().ok(statsAchievementService.initAllGroupAchievement(customerId));
}
}

57
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupAchievementConfigDao.java

@ -0,0 +1,57 @@
package com.epmet.modules.group.dao; /**
* 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/>.
*/
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.modules.group.entity.ResiGroupAchievementConfigEntity;
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-04-19
*/
@Mapper
public interface ResiGroupAchievementConfigDao extends BaseDao<ResiGroupAchievementConfigEntity> {
/**
* desc: 获取成就配置 比targetValue
*
* @param achievementType
* @param offset
* @param pageSize
* @return java.util.List<com.epmet.modules.group.entity.ResiGroupAchievementConfigEntity>
* @author LiuJanJun
* @date 2021/4/21 10:04 下午
*/
List<ResiGroupAchievementConfigEntity> selectMoreThanOneByValue(@Param("achievementType") String achievementType, @Param("offset") int offset, @Param("pageSize") int pageSize);
/**
* desc: 获取最后一条配置
*
* @param achievementType
* @return com.epmet.modules.group.entity.ResiGroupAchievementConfigEntity
* @author LiuJanJun
* @date 2021/4/22 1:58 下午
*/
ResiGroupAchievementConfigEntity getLastOne(@Param("achievementType") String achievementType);
}

68
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupAchievementStatsDao.java

@ -0,0 +1,68 @@
/**
* 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.modules.group.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.modules.group.entity.ResiGroupAchievementStatsEntity;
import com.epmet.resi.group.dto.group.ResiGroupAchievementStatsDTO;
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-04-19
*/
@Mapper
public interface ResiGroupAchievementStatsDao extends BaseDao<ResiGroupAchievementStatsEntity> {
/**
* 获取未完成的成就
*
* @param groupId
* @return java.util.List<com.epmet.resi.group.dto.group.ResiGroupMilestoneStatsDTO>
* @author zhaoqifeng
* @date 2021/4/19 15:52
*/
List<ResiGroupAchievementStatsDTO> selectUnAchieved(@Param("groupId") String groupId);
/**
* desc: 获取级别最低的最后一个未实现的成就
*
* @param customerId
* @param groupId
* @param achievementType
* @return com.epmet.modules.group.entity.ResiGroupAchievementStatsEntity
* @author LiuJanJun
* @date 2021/4/21 8:34 下午
*/
ResiGroupAchievementStatsEntity selectLastUnAchieved(@Param("customerId") String customerId, @Param("groupId") String groupId, @Param("achievementType") String achievementType);
/**
* desc: 插入或更新成就
*
* @param list
* @param updateAll
* @return int
* @author LiuJanJun
* @date 2021/4/22 3:03 下午
*/
int saveOrUpdate(@Param("list") List<ResiGroupAchievementStatsEntity> list, @Param("updateAll") boolean updateAll);
}

10
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java

@ -29,6 +29,7 @@ import com.epmet.resi.group.dto.notice.result.UnReadListResultDTO;
import com.epmet.resi.group.dto.topic.result.AllMessagesResultDTO;
import com.epmet.resi.group.dto.topic.result.GetPastTopicListV2ResultDTO;
import com.epmet.resi.group.dto.topic.result.LatestTenResultDTO;
import com.epmet.resi.group.dto.member.result.GroupAchievementDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -323,4 +324,13 @@ public interface ResiGroupDao extends BaseDao<ResiGroupEntity> {
* @date 2021/4/25 上午9:10
*/
List<ReadStatusResultDTO> selectReadFlagByUserAndId(@Param("ids")List<String> ids,@Param("userIds")List<String> userIds);
/**
* 我所在小组最近完成的成就
* @author zhaoqifeng
* @date 2021/4/22 9:47
* @param userId
* @return java.util.List<com.epmet.resi.group.dto.member.result.GroupAchievementDTO>
*/
List<GroupAchievementDTO> selectRecentGroupAchievements(@Param("userId") String userId, @Param("gridId") String gridId);
}

58
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupAchievementConfigEntity.java

@ -0,0 +1,58 @@
/**
* 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.modules.group.entity;
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-04-19
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("resi_group_achievement_config")
public class ResiGroupAchievementConfigEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* 里程名称
*/
private String achievementName;
/**
* 目标值
*/
private Integer targetValue;
/**
* 里程类型小组人数membertopic话题数转议题数toIssue话题解决数resloveTopic
*/
private String achievementType;
}

86
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupAchievementStatsEntity.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.modules.group.entity;
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-04-19
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("resi_group_achievement_stats")
public class ResiGroupAchievementStatsEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* 小组Id
*/
private String groupId;
/**
* 成就ID
*/
private String achievementId;
/**
* 成就名称
*/
private String achievementName;
/**
* 成就类型
*/
private String achievementType;
/**
* 实现时间
*/
private Date arriveTime;
/**
* 当前值
*/
private Integer currentValue;
/**
* 目标值
*/
private Integer targetValue;
/**
* 目标是否实现10
*/
private Integer isArrive;
}

5
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java

@ -88,4 +88,9 @@ Ps: 如果一个小组被拒绝,当前小组的状态将永久停留在“审
* 小组类型(ordinary:楼院小组 branch:支部小组)
*/
private String groupType;
/**
* 小组等级
*/
private Integer level;
}

1
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupRedis.java

@ -101,6 +101,7 @@ public class ResiGroupRedis {
ResiGroupInfoRedisDTO groupRedis = ConvertUtils.sourceToTarget(groupMySql,ResiGroupInfoRedisDTO.class);
groupRedis.setGroupId(groupMySql.getId());
groupRedis.setGroupState(groupMySql.getState());
groupRedis.setLevel("LV" + groupMySql.getLevel());
Map<String,Object> param = new HashMap<>();
param.put(TopicConstant.RESI_GROUP_ID,groupId);
param.put(FieldConstant.DEL_FLAG, NumConstant.ZERO_STR);

138
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/AbstractStatsAchievementService.java

@ -0,0 +1,138 @@
/**
* 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.modules.group.service;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.enums.AchievementTypeEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.UniqueIdGenerator;
import com.epmet.modules.group.entity.ResiGroupAchievementConfigEntity;
import com.epmet.modules.group.entity.ResiGroupAchievementStatsEntity;
import com.epmet.modules.support.GroupAchievementUtils;
import com.epmet.resi.group.dto.group.ResiGroupAchievementStatsDTO;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.List;
/**
* desc实时计算小组成就完成情况
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-19
*/
public abstract class AbstractStatsAchievementService {
@Autowired
private ResiGroupAchievementConfigService achievementConfigService;
@Autowired
private ResiGroupAchievementStatsService achievementStatsService;
/**
* desc: 根据成绩类型 分页获取成就配置 按targetValue 升序
*
* @param pageNum
* @param pageSize
* @return java.util.List<com.epmet.modules.group.entity.ResiGroupAchievementConfigEntity>
* @author LiuJanJun
* @date 2021/4/22 1:36 下午
*/
protected List<ResiGroupAchievementConfigEntity> getAchievementConfigPage(int pageNum, int pageSize, String achievementType) {
return achievementConfigService.selectMoreThanOneByValue(achievementType, (pageNum - NumConstant.ONE) * pageSize, pageSize);
}
/**
* desc:初始化配置5条
*
* @param achievementType
* @return
*/
protected List<ResiGroupAchievementConfigEntity> initAchievementConfig(String achievementType) {
AchievementTypeEnum anEnum = AchievementTypeEnum.getEnum(achievementType);
if (anEnum == null) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode());
}
if (AchievementTypeEnum.MEMBER.getCode().equals(anEnum.getCode())) {
throw new RenException("小组人数都到10000啦?");
}
ResiGroupAchievementConfigEntity lastOne = achievementConfigService.getLastOne(achievementType);
if (lastOne == null){
throw new RenException("小组成就配置有误,type:{}",achievementType);
}
List<ResiGroupAchievementConfigEntity> newConfigList = new ArrayList<>();
Integer nextTargetValue = null;
int preValue = lastOne.getTargetValue();
String oldName = lastOne.getAchievementName().replace(String.valueOf(lastOne.getTargetValue()), StrConstant.UNDER_LINE);
for (int i = 0; i < 5; i++) {
nextTargetValue = GroupAchievementUtils.getNextTargetValue(achievementType, preValue);
ResiGroupAchievementConfigEntity next = new ResiGroupAchievementConfigEntity();
//生成ID 自增
next.setId(UniqueIdGenerator.generate24());
next.setCustomerId(lastOne.getCustomerId());
next.setAchievementName(oldName.replace(StrConstant.UNDER_LINE, String.valueOf(nextTargetValue)));
preValue = nextTargetValue;
next.setTargetValue(nextTargetValue);
next.setAchievementType(lastOne.getAchievementType());
newConfigList.add(next);
}
achievementConfigService.insertBatch(newConfigList);
return newConfigList;
}
/**
* desc: 插入或新增成就统计
*
* @param haveArrive
* @param updateAll
* @return void
* @author LiuJanJun
* @date 2021/4/25 12:26 下午
*/
protected Integer saveOrUpdate(List<ResiGroupAchievementStatsEntity> haveArrive, boolean updateAll){
return achievementStatsService.saveOrUpdate(haveArrive,updateAll);
}
/**
* desc: 获取小组最后一个未实现的成就
*
* @param customerId
* @param groupId
* @param achievementType
* @return com.epmet.modules.group.entity.ResiGroupAchievementStatsEntity
* @author LiuJanJun
* @date 2021/4/25 12:28 下午
*/
protected ResiGroupAchievementStatsEntity selectLastUnAchieved(String customerId, String groupId, String achievementType){
return achievementStatsService.selectLastUnAchieved(customerId, groupId, achievementType);
}
/**
* desc: 更新小组成就
*
* @param recordDTO
* @return java.lang.Integer
* @author LiuJanJun
* @date 2021/4/25 12:30 下午
*/
protected void update(ResiGroupAchievementStatsDTO recordDTO){
achievementStatsService.update(recordDTO);
}
}

36
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupAchievementConfigService.java

@ -0,0 +1,36 @@
/**
* 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.modules.group.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.modules.group.entity.ResiGroupAchievementConfigEntity;
import java.util.List;
/**
* 小组成就配置表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-19
*/
public interface ResiGroupAchievementConfigService extends BaseService<ResiGroupAchievementConfigEntity> {
ResiGroupAchievementConfigEntity getLastOne(String achievementType);
List<ResiGroupAchievementConfigEntity> selectMoreThanOneByValue(String achievementType,int offset,int pageSize);
}

84
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupAchievementStatsService.java

@ -0,0 +1,84 @@
/**
* 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.modules.group.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.modules.group.entity.ResiGroupAchievementStatsEntity;
import com.epmet.resi.group.dto.group.ResiGroupAchievementStatsDTO;
import java.util.List;
/**
* 小组成就统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-19
*/
public interface ResiGroupAchievementStatsService extends BaseService<ResiGroupAchievementStatsEntity> {
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-04-19
*/
void update(ResiGroupAchievementStatsDTO dto);
/**
* 已达成的成就
* @author zhaoqifeng
* @date 2021/4/19 15:15
* @param groupId
* @return java.util.List<com.epmet.resi.group.dto.group.ResiGroupMilestoneStatsDTO>
*/
List<ResiGroupAchievementStatsDTO> getAchieved(String groupId);
/**
* 未达成的成就
* @author zhaoqifeng
* @date 2021/4/19 15:15
* @param groupId
* @return java.util.List<com.epmet.resi.group.dto.group.ResiGroupMilestoneStatsDTO>
*/
List<ResiGroupAchievementStatsDTO> getUnAchieved(String groupId);
/**
* desc: 获取最后未实现的成就 实际每种类型 数据库只存在一条未实现的成就
*
* @param customerId
* @param groupId
* @param achievementType
* @return com.epmet.modules.group.entity.ResiGroupAchievementStatsEntity
* @author LiuJanJun
* @date 2021/4/22 2:35 下午
*/
ResiGroupAchievementStatsEntity selectLastUnAchieved(String customerId, String groupId, String achievementType);
/**
* desc: 插入或更新成就
*
* @param haveArrive
* @param updateAll
* @return int
* @author LiuJanJun
* @date 2021/4/22 3:03 下午
*/
int saveOrUpdate(List<ResiGroupAchievementStatsEntity> haveArrive, boolean updateAll);
}

48
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java

@ -20,6 +20,7 @@ package com.epmet.modules.group.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.modules.group.entity.ResiGroupEntity;
import com.epmet.resi.group.dto.UserRoleDTO;
@ -28,6 +29,8 @@ import com.epmet.resi.group.dto.group.ResiGroupDTO;
import com.epmet.resi.group.dto.group.form.*;
import com.epmet.resi.group.dto.group.result.*;
import com.epmet.resi.group.dto.member.form.EditAuditSwitchFormDTO;
import com.epmet.resi.group.dto.member.result.AchievementResultDTO;
import jdk.nashorn.internal.parser.Token;
import java.util.HashMap;
import java.util.List;
@ -378,4 +381,49 @@ public interface ResiGroupService extends BaseService<ResiGroupEntity> {
* @Description 所有小组查询
**/
List<AllGroupListResultDTO> allGroupList(AllGroupListFormDTO formDTO);
/**
* 小组成就详情
* @author zhaoqifeng
* @date 2021/4/19 14:25
* @param formDTO
* @return com.epmet.resi.group.dto.group.result.AchievementDetailResultDTO
*/
AchievementDetailResultDTO achievementDetail(GroupFormDTO formDTO);
/**
* 获取网格下小组列表
* @author zhaoqifeng
* @date 2021/4/21 15:42
* @param gridId
* @return java.util.List<com.epmet.resi.group.dto.group.ResiGroupDTO>
*/
List<ResiGroupDTO> getGroupListByGrid(String gridId);
/**
* 小组积分详情
* @author zhaoqifeng
* @date 2021/4/21 16:22
* @param groupId
* @return com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO
*/
GroupPointDetailResultDTO groupPointDetail(String groupId);
/**
* 小组近段时间实现的成就列表
* @author zhaoqifeng
* @date 2021/4/22 9:27
* @param tokenDto
* @return com.epmet.resi.group.dto.member.result.AchievementResultDTO
*/
List<AchievementResultDTO> achievement(TokenDto tokenDto, GroupFormDTO formDTO);
/**
* 获取小组信息及小组成员
* @author zhaoqifeng
* @date 2021/4/23 14:56
* @param groupId
* @return com.epmet.resi.group.dto.group.ResiGroupDTO
*/
ResiGroupDTO getGroupInfoAndGroupMember(String groupId);
}

51
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/StatsAchievementService.java

@ -0,0 +1,51 @@
/**
* 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.modules.group.service;
/**
* desc实时计算小组成就完成情况
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-19
*/
public interface StatsAchievementService{
/**
* desc: 初始化所有小组的各种成就入口
*
* @param customerId
* @return java.lang.Boolean
* @author LiuJanJun
* @date 2021/4/20
*/
Boolean initAllGroupAchievement(String customerId);
/**
* desc: 根据小组Id计算小组成就 入口
*
* @param customerId
* @param groupId
* @param achievementType 成就类型 小组人数话题数转议题数小组内问题解决数
* @return java.lang.Boolean
* @author LiuJanJun
* @date 2021/4/20
*/
Boolean calculateAcm(String customerId, String groupId, String achievementType);
}

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

Loading…
Cancel
Save