diff --git a/epmet-commons/epmet-commons-rocketmq/pom.xml b/epmet-commons/epmet-commons-rocketmq/pom.xml index 274ec09b58..346f055ccc 100644 --- a/epmet-commons/epmet-commons-rocketmq/pom.xml +++ b/epmet-commons/epmet-commons-rocketmq/pom.xml @@ -16,6 +16,11 @@ org.apache.rocketmq rocketmq-spring-boot-starter 2.0.1 + + + + org.projectlombok + lombok org.projectlombok diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java index de07ea3106..5acfebb90e 100644 --- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java +++ b/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"; + } diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java index bbf28a5884..bd9fed05eb 100644 --- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java +++ b/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"; } diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/GroupAchievementMQMsg.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/GroupAchievementMQMsg.java new file mode 100644 index 0000000000..f54a2bee52 --- /dev/null +++ b/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; +} diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/ConsumerConfigProperties.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/ConsumerConfigProperties.java new file mode 100644 index 0000000000..71a8fea41c --- /dev/null +++ b/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; +} diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQConsumerRegister.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQConsumerRegister.java new file mode 100644 index 0000000000..3387b55931 --- /dev/null +++ b/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; + } +} diff --git a/epmet-commons/epmet-commons-tools/pom.xml b/epmet-commons/epmet-commons-tools/pom.xml index 0f8bd545fc..258b1a09b2 100644 --- a/epmet-commons/epmet-commons-tools/pom.xml +++ b/epmet-commons/epmet-commons-tools/pom.xml @@ -134,7 +134,7 @@ org.apache.httpcomponents httpclient - 4.5.2 + 4.5.13 org.apache.httpcomponents diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java index 33f72bee5c..8cdcc9c0a2 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java +++ b/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; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/FileCommonDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/FileCommonDTO.java new file mode 100644 index 0000000000..494c636a95 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/FileCommonDTO.java @@ -0,0 +1,42 @@ +package com.epmet.commons.tools.dto.form; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/12/21 15:37 + */ +@NoArgsConstructor +@Data +public class FileCommonDTO implements Serializable { + + private static final long serialVersionUID = -5307959406648243353L; + /** + * 文件名 + */ + private String name; + /** + * url地址 + */ + private String url; + /** + * 文件类型(图片 - image、 视频 - video、 语音 - voice、 文档 - doc) + */ + private String type; + /** + * 后缀名 + */ + private String format; + /** + * 文件大小 kb + */ + private Integer size; + /** + * 语音或视频文件时长,单位秒 + */ + private Integer duration; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseParamDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseParamDTO.java index 9ad8df6cf4..8b400beb45 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseParamDTO.java +++ b/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; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java index 6f371a1e09..9235fe77a7 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java +++ b/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; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/AchievementTypeEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/AchievementTypeEnum.java new file mode 100644 index 0000000000..255d680c17 --- /dev/null +++ b/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; + } + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/BizTypeEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/BizTypeEnum.java new file mode 100644 index 0000000000..1dec273299 --- /dev/null +++ b/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; + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java index c1409342d6..44d229ec3b 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java +++ b/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; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/SourceTypeEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/SourceTypeEnum.java new file mode 100644 index 0000000000..fa44ed89a8 --- /dev/null +++ b/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; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 839d80dbd4..b7b70c5159 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -161,7 +161,28 @@ public enum EpmetErrorCode { OPEN_API_SIGN_ERROR(10104, "签名错误"), OPEN_API_PARAMS_APPID_DIFF(10105, "app_id不一致"), // app_id在请求参数中和在token中不一致 OPEN_API_REQUEST_EXPIRED(10106, "请求过期"), - OPEN_API_REQUEST_REPEAT(10107, "请求重复"); + OPEN_API_REQUEST_REPEAT(10107, "请求重复"), + + //楼院小组89 + GROUP_ACT_CANCELED_CAN_NOT_EDIT(8901,"活动已取消,不能编辑"), + GROUP_ACT_CLOSED_CAN_NOT_EDIT(8902,"活动已关闭,不能编辑"), + PLEASE_INPUT_ACT_CONTENT(8903,"请输入活动内容,或添加图片"), + GROUP_ACT_CONTENT_MAX(8904,"活动内容至多输入1000字"), + GROUP_ACT_IMG_MAX(8905,"最多可添加3张图片"), + PARTY_MEMBER_CREATE_BRANCH_GROUP(8906,"您不是党员,不能创建支部小组"), + NOT_IN_GROUP_CAN_NOT_VIEW(8907,"当前内容仅允许组内成员查看"), + PARTY_MEMBER_JOIN_BRANCH_GROUP(8908,"您不是党员,不能加入支部小组"), + GROUP_ACT_CAN_NOT_CANCEL(8909,"当前活动已关闭或已取消"), + CHANGE_LEADER(8910,"请先转移组长身份在退组"), + + //8910的msg动态赋值 + GROUP_ACT_CAN_NOT_COMMENT(8910,"当前活动,不能评论"), + SIGN_IN_TIME_NOT_START(8911,"未到签到时间,不允许签到"), + SIGN_IN_TIME_PASSED(8912,"当前时间已超过签到时间"), + INVITATION_NOT_EXIST(8913,"链接不存在"), + NOTICE_EXPIRATION_TIME(8914,"通知过期时间不能早于当前时间"), + NOTICE_BE_OVERDUE(8915,"通知已过期不允许再次变更"); + private int code; private String msg; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index 763ce76d3e..0dfa22915c 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -8,7 +8,9 @@ package com.epmet.commons.tools.redis; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.utils.DateUtils; import org.apache.commons.lang3.StringUtils; /** @@ -429,4 +431,32 @@ public class RedisKeys { public static String getThirdPlatformAccessTokenKey(String platformId) { return rootPrefix.concat("thirdplatform:accesstoken:").concat(platformId); } + + /** + * @return 设置组员已读、未读标识 + * @param source :act notice + * @param groupId 小组id + * @param sourceId 活动id,或者通知id + * @author yinzuomei + * @description groupread:202104:act:groupId:actId + * @Date 2021/4/22 16:38 + **/ + public static String getGroupMsgReadKey(String source, String groupId, String sourceId) { + String currentMonth= DateUtils.getBeforeNMonth(NumConstant.ZERO); + return "groupread:".concat(currentMonth).concat(":").concat(source).concat(":").concat(groupId).concat(":").concat(sourceId); + } + + /** + * @return 设置应读人员标识 ,默认全部赋值1 + * @param source :act notice + * @param groupId 小组id + * @param sourceId 活动id,或者通知id + * @author yinzuomei + * @description groupread:user:202104:act:groupId:actId + * @Date 2021/4/22 16:38 + **/ + public static String getGroupMsgShouldReadUser(String source, String groupId, String sourceId) { + String currentMonth= DateUtils.getBeforeNMonth(NumConstant.ZERO); + return "groupread:user:".concat(currentMonth).concat(":").concat(source).concat(":").concat(groupId).concat(":").concat(sourceId); + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java index dac7d44896..cbd00c3aeb 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java @@ -13,10 +13,7 @@ import com.epmet.commons.tools.exception.RenException; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; -import org.springframework.data.redis.core.HashOperations; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.data.redis.core.StringRedisTemplate; -import org.springframework.data.redis.core.ZSetOperations; +import org.springframework.data.redis.core.*; import org.springframework.data.redis.support.atomic.RedisAtomicLong; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; @@ -422,4 +419,19 @@ public class RedisUtils { return redisTemplate.hasKey(key); } + public Boolean setBit(String key, long offset, boolean value) { + return redisTemplate.opsForValue().setBit(key, offset, value); + } + + public Boolean getBit(String key, long offset) { + return redisTemplate.opsForValue().getBit(key, offset); + } + + public Long bitCount(String key) { + return redisTemplate.execute((RedisCallback) con -> con.bitCount(key.getBytes())); + } + + public Long bitCount(String key, int start, int end) { + return redisTemplate.execute((RedisCallback) con -> con.bitCount(key.getBytes(), start, end)); + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java index 3217260019..1886bd8300 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java +++ b/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字符串 diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java index 74809f9d30..eeac282cd8 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java +++ b/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() { diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SendMqMsgUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SendMqMsgUtils.java index 7d9889d77b..ac6a2d440c 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SendMqMsgUtils.java +++ b/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().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 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 stringResult = sendMsg(mqBaseMsgDTO); + } + /** * desc:发送mq消息 diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/UniqueIdGenerator.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/UniqueIdGenerator.java index fcefbdf2ca..a1c19557d1 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/UniqueIdGenerator.java +++ b/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()); } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/OkHttpUtil.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/OkHttpUtil.java index e329a1f7df..7292e492e8 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/OkHttpUtil.java +++ b/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 diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/UserInfosResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/UserInfosResultDTO.java index 19bfd88186..f4cfd43b40 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/UserInfosResultDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/UserInfosResultDTO.java @@ -17,5 +17,6 @@ public class UserInfosResultDTO implements Serializable { private String userId; private String userShowName; private String headPhoto; + private String realName; } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupEntity.java index 7fc47655e4..33b4b9243e 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupEntity.java @@ -83,4 +83,9 @@ Ps: 如果一个小组被拒绝,当前小组的状态将永久停留在“审 * VISIT_SWITCH 小组是否允许参观:允许:open;不允许:closed */ private String visitSwitch; + + /** + * 小组类型(ordinary:楼院小组 branch:支部小组) + */ + private String groupType; } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/impl/ResiGroupServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/impl/ResiGroupServiceImpl.java index 5e5c727555..253d42f78b 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/impl/ResiGroupServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/impl/ResiGroupServiceImpl.java @@ -5,9 +5,11 @@ import com.epmet.dataaggre.constant.DataSourceConstant; import com.epmet.dataaggre.dao.resigroup.ResiGroupDao; import com.epmet.dataaggre.dao.resigroup.ResiTopicDao; import com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO; +import com.epmet.dataaggre.dto.resigroup.ResiGroupDTO; import com.epmet.dataaggre.dto.resigroup.ResiTopicDTO; import com.epmet.dataaggre.dto.resigroup.form.CandidateListFormDTO; import com.epmet.dataaggre.dto.resigroup.result.CandidateListResultDTO; +import com.epmet.dataaggre.entity.resigroup.ResiGroupEntity; import com.epmet.dataaggre.redis.ResiGroupRedis; import com.epmet.dataaggre.service.epmetuser.EpmetUserService; import com.epmet.dataaggre.service.resigroup.ResiGroupService; @@ -63,12 +65,18 @@ public class ResiGroupServiceImpl implements ResiGroupService { List userIds = result.stream().map(m -> m.getUserId()).collect(Collectors.toList()); // 查询用户信息【名字 头像】 List userInfos = epmetUserService.selectUserInfosByUserIds(userIds); + //查询小组信息 + ResiGroupEntity group = resiGroupDao.selectById(formDTO.getGroupId()); result.forEach(r -> { if (!CollectionUtils.isEmpty(userInfos)){ userInfos.forEach(u -> { if (r.getUserId().equals(u.getUserId())){ r.setHeadPhoto(u.getHeadPhoto()); - r.setUserShowName(u.getUserShowName()); + if("branch".equals(group.getGroupType())){ + r.setUserShowName(u.getRealName()); + }else { + r.setUserShowName(u.getUserShowName()); + } } }); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml index 489908227d..1ce45a28d8 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml @@ -12,7 +12,8 @@ WHEN GENDER = '2' THEN '女士' ELSE '先生/女士' END ) AS userShowName, - HEAD_IMG_URL AS headPhoto + HEAD_IMG_URL AS headPhoto, + CONCAT(STREET,'-',REAL_NAME) AS realName FROM user_base_info WHERE DEL_FLAG = 0 AND diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexExcelDataListener.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexExcelDataListener.java index 9870714357..3fe392276f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexExcelDataListener.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexExcelDataListener.java @@ -157,7 +157,7 @@ public class IndexExcelDataListener extends AnalysisEventListener { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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"); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java index 952d7b4ba5..ecc2d38a9b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java +++ b/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; + }*/ } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java index bcec9ddd31..c383ae1b41 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java +++ b/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); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/IndexGroupServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/IndexGroupServiceImpl.java index 50092d64db..00c019e1ff 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/IndexGroupServiceImpl.java +++ b/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 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; } -} \ No newline at end of file +} diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.11__groupAchievementRule.sql b/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.11__groupAchievementRule.sql new file mode 100644 index 0000000000..c249201058 --- /dev/null +++ b/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'); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java index aeb67a2314..15ff440c80 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java @@ -239,6 +239,7 @@ public class ActLiveRecServiceImpl extends BaseServiceImplcom.epmet epmet-commons-rocketmq 2.0.0 - compile diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java index f3f98bac35..282dc7b711 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java +++ b/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"; + } diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/UserMessageFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/UserMessageFormDTO.java index f3298183d6..e00bb88342 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/UserMessageFormDTO.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/UserMessageFormDTO.java @@ -58,7 +58,7 @@ public class UserMessageFormDTO implements Serializable { private String readFlag; /** - * 调用者 + * 调用者 【分内部调用和外部调用,内部调用值为空,外部默认为:外挂-站内信】 */ private String referer; } diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/send/SendMqMsgUtil.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/send/SendMqMsgUtil.java index 2a382127b9..4e8e7c954a 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/send/SendMqMsgUtil.java +++ b/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; + } + } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java index c82b22701b..db9be4c1ba 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java +++ b/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; } diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/BizPointTotalDetailDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/BizPointTotalDetailDTO.java new file mode 100644 index 0000000000..f057816b87 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/BizPointUserTotalDetailDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/BizPointUserTotalDetailDTO.java new file mode 100644 index 0000000000..3e5dc04f11 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/UserPointActionLogDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/UserPointActionLogDTO.java index 113572b051..4f8523d82a 100644 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/UserPointActionLogDTO.java +++ b/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 * */ diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/GroupPointFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/GroupPointFormDTO.java new file mode 100644 index 0000000000..8da5ab5729 --- /dev/null +++ b/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; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/GroupPointRankingResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/GroupPointRankingResultDTO.java new file mode 100644 index 0000000000..275a5917ba --- /dev/null +++ b/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; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/GroupPointRuleResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/GroupPointRuleResultDTO.java new file mode 100644 index 0000000000..05717983ee --- /dev/null +++ b/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 rules; + /** + * 个人贡献概述 + */ + private String contriSummary; + + /** + * 小组积分概述 + */ + private String groupSummary; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointRankingResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointRankingResultDTO.java new file mode 100644 index 0000000000..c063eb8286 --- /dev/null +++ b/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; +} diff --git a/epmet-module/epmet-point/epmet-point-server/pom.xml b/epmet-module/epmet-point/epmet-point-server/pom.xml index 3181de8195..082549fee0 100644 --- a/epmet-module/epmet-point/epmet-point-server/pom.xml +++ b/epmet-module/epmet-point/epmet-point-server/pom.xml @@ -87,6 +87,12 @@ 2.0.0 compile + + com.epmet + resi-group-client + 2.0.0 + compile + diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/GroupPointController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/GroupPointController.java new file mode 100644 index 0000000000..4984d2ce0b --- /dev/null +++ b/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> + * @author zhaoqifeng + * @date 2021/4/21 14:02 + */ + @PostMapping("pointranking") + public Result> pointRanking(@LoginUser TokenDto tokenDto, @RequestBody GroupPointFormDTO formDTO) { + List list = bizPointUserTotalDetailService.pointRanking(tokenDto, formDTO); + return new Result>().ok(list); + } + + /** + * 网格小组积分排行 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @author zhaoqifeng + * @date 2021/4/21 14:02 + */ + @PostMapping("grouppointranking") + public Result> groupPointRanking(@RequestBody GroupPointFormDTO formDTO) { + List list = bizPointTotalDetailService.groupPointRanking(formDTO); + return new Result>().ok(list); + } + + /** + * 小组积分详情 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author zhaoqifeng + * @date 2021/4/21 14:02 + */ + @PostMapping("pointdetail") + public Result pointDetail(@RequestBody GroupPointFormDTO formDTO) { + GroupPointDetailResultDTO result = bizPointTotalDetailService.pointDetail(formDTO); + return new Result().ok(result); + } + + /** + * 小组积分规则 + * @author zhaoqifeng + * @date 2021/4/22 15:36 + * @param tokenDto + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("pointrule") + public Result pointRule(@LoginUser TokenDto tokenDto) { + GroupPointRuleResultDTO result = pointRuleService.getGroupRule(tokenDto.getCustomerId()); + result.setContriSummary(ModuleConstant.CONTRI_SUMMARY); + result.setGroupSummary(ModuleConstant.GROUP_RULE_SUMMARY); + return new Result().ok(result); + } +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/BizPointTotalDetailDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/BizPointTotalDetailDao.java new file mode 100644 index 0000000000..26e05f5a7b --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 { + /** + * 根据业务类型查找数据 + * @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); +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/BizPointUserTotalDetailDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/BizPointUserTotalDetailDao.java new file mode 100644 index 0000000000..0813114d27 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 { + + /** + * 获取今日积分增量 + * @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); + +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java index 40c3277d6d..a2c1963e85 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java @@ -53,4 +53,14 @@ public interface UserPointActionLogDao extends BaseDao * @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); } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/InvitationAccessRecordEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/BizPointTotalDetailEntity.java similarity index 64% rename from epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/InvitationAccessRecordEntity.java rename to epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/BizPointTotalDetailEntity.java index c1317f423e..b05bc59705 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/InvitationAccessRecordEntity.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/BizPointTotalDetailEntity.java @@ -15,10 +15,8 @@ * along with this program. If not, see . */ -package com.epmet.dataaggre.entity.resigroup; +package com.epmet.entity; -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -28,37 +26,46 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * 邀请链接访问表 + * 按业务类型积分总计 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-12-25 + * @since v1.0.0 2021-04-20 */ @Data @EqualsAndHashCode(callSuper=false) -@TableName("invitation_access_record") -public class InvitationAccessRecordEntity extends BaseEpmetEntity { +@TableName("biz_point_total_detail") +public class BizPointTotalDetailEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; /** - * 邀请链接主键group_invitation.id + * 客户ID */ - private String invitationId; + private String customerId; /** - * 用户idcustomer_user.id + * 组织Id */ - private String customerUserId; + private String agencyId; /** - * 状态:(已浏览 - viewed 、 同意加入小组 - tried 、 成功入群 - success) + * 网格ID */ - private String state; + private String gridId; - /** - * 客户ID - */ - @TableField(fill = FieldFill.INSERT) - private String customerId; + /** + * 业务类型:小组:group + */ + private String bizType; + + /** + * 业务类型的对象id + */ + private String objectId; + + /** + * OBJECTID的总积分 总积分=objectId下所有的用户积分 + */ + private Integer totalPoint; } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/BizPointUserTotalDetailEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/BizPointUserTotalDetailEntity.java new file mode 100644 index 0000000000..e0f2960604 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/UserPointActionLogEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/UserPointActionLogEntity.java index b52ed79b2f..2a282b06f3 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/UserPointActionLogEntity.java +++ b/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 * */ diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/BizPointTotalDetailService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/BizPointTotalDetailService.java new file mode 100644 index 0000000000..f72e49ba39 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-04-20 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-04-20 + */ + List list(Map 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 + * @author zhaoqifeng + * @date 2021/4/21 14:05 + */ + List groupPointRanking(GroupPointFormDTO formDTO); +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/BizPointUserTotalDetailService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/BizPointUserTotalDetailService.java new file mode 100644 index 0000000000..51e8172f7c --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-04-20 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-04-20 + */ + List list(Map 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 + * @author zhaoqifeng + * @date 2021/4/21 14:06 + */ + List 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); +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointRuleService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointRuleService.java index 28ec8991c2..cd39750f34 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointRuleService.java +++ b/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 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); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java index 8a35954ef0..892fd67a11 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java @@ -123,4 +123,14 @@ public interface UserPointActionLogService extends BaseService + * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 implements BizPointTotalDetailService { + + @Autowired + private ResiGroupOpenFeignClient resiGroupOpenFeignClient; + @Autowired + private BizPointUserTotalDetailService bizPointUserTotalDetailService; + @Autowired + private UserPointActionLogService userPointActionLogService; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, BizPointTotalDetailDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, BizPointTotalDetailDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper 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 result = resiGroupOpenFeignClient.groupPointDetail(formDTO.getGroupId()); + if (!result.success() || null == result.getData()) { + throw new RenException(result.getCode(), result.getMsg()); + } + GroupPointDetailResultDTO detail = result.getData(); + QueryWrapper 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 + * @author zhaoqifeng + * @date 2021/4/21 14:05 + */ + @Override + public List groupPointRanking(GroupPointFormDTO formDTO) { + List list; + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("BIZ_TYPE", "group") + .eq("GRID_ID", formDTO.getGridId()) + .eq("DEL_FLAG", NumConstant.ZERO_STR) + .orderByDesc("TOTAL_POINT"); + List totalDetailList = baseDao.selectList(wrapper); + Result> 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; + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/BizPointUserTotalDetailServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/BizPointUserTotalDetailServiceImpl.java new file mode 100644 index 0000000000..1e3563fb6d --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 implements BizPointUserTotalDetailService { + + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + @Autowired + private ResiGroupOpenFeignClient resiGroupOpenFeignClient; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, BizPointUserTotalDetailDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, BizPointUserTotalDetailDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper 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 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 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 + * @author zhaoqifeng + * @date 2021/4/21 14:06 + */ + @Override + public List pointRanking(TokenDto tokenDto, GroupPointFormDTO formDTO) { + List list = new ArrayList<>(); + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("BIZ_TYPE", "group") + .eq("OBJECT_ID", formDTO.getGroupId()) + .eq("DEL_FLAG", NumConstant.ZERO_STR) + .orderByDesc("TOTAL_POINT"); + List userTotalList = baseDao.selectList(wrapper); + AtomicInteger i = new AtomicInteger(1); + + //获取小组信息 + Result group = resiGroupOpenFeignClient.getGroupDetail(formDTO.getGroupId()); + if (!group.success() || null == group.getData()) { + throw new RenException(group.getCode(), group.getMsg()); + } + List 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 userIds = memberList.stream().map(ResiGroupMemberDTO :: getCustomerUserId).collect(Collectors.toList()); + Result> 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); + } + +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdjustmentLogServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdjustmentLogServiceImpl.java index 3d943ba887..e5aad18cef 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdjustmentLogServiceImpl.java +++ b/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 list = new ArrayList<>(); + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("CUSTOMER_ID", customerId) + .eq("DEL_FLAG", NumConstant.ZERO_STR); + List 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) { diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java index 3fce5f3edd..af4b5fd499 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java +++ b/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 page(Map params) { IPage page = baseDao.selectPage( @@ -253,7 +254,7 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl 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【%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 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 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; + } } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/ModuleConstant.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/ModuleConstant.java index be66473992..b65cab7b2a 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/ModuleConstant.java +++ b/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 = "组内贡献是指组内成员在本组进行活动时所获取的积分贡献值。"; } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.10__updateRule.sql b/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.10__updateRule.sql new file mode 100644 index 0000000000..e9fa5a7fd7 --- /dev/null +++ b/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'); diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.9__groupPoint.sql b/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.9__groupPoint.sql new file mode 100644 index 0000000000..3e22e64f7a --- /dev/null +++ b/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`; \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/BizPointTotalDetailDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/BizPointTotalDetailDao.xml new file mode 100644 index 0000000000..e1e8202e83 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/BizPointTotalDetailDao.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/BizPointUserTotalDetailDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/BizPointUserTotalDetailDao.xml new file mode 100644 index 0000000000..a846469881 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/BizPointUserTotalDetailDao.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml index 23d372e0e7..c18c78976b 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml +++ b/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} UPDATE point_rule @@ -50,4 +54,4 @@ - \ No newline at end of file + diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml index 8e9a860b37..c7c6bf89c2 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml @@ -65,4 +65,12 @@ AND CREATED_TIME #{right} + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxLoginServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxLoginServiceImpl.java index ed715cb344..95f8b34591 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxLoginServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxLoginServiceImpl.java @@ -51,8 +51,10 @@ public class WxLoginServiceImpl implements WxLoginService { String resultStr = HttpClientManager.getInstance().sendGet(WxLoginConstant.WXCODE_BY_OPENID, map).getData(); HashMap hashMap = JSON.parseObject(resultStr, HashMap.class); if (null != hashMap.get("errcode")) { - logger.error("wxcode换取openid接口调用失败"); - throw new RenException(hashMap.get("errmsg")); + //45011:API 调用太频繁,请稍候再试;40029: code 无效 【错误码:https://developers.weixin.qq.com/doc/oplatform/Return_codes/Return_code_descriptions_new.html】 + throw new RenException(String.format("wxcode换取用户基本信息失败,wxcode->%s,错误码->%s,错误信息->%s", wxCode, hashMap.get("errcode"), hashMap.get("errmsg"))); + /*logger.error("wxcode换取openid接口调用失败"); + throw new RenException(hashMap.get("errmsg"));*/ } String openid = hashMap.get("openid"); String sessionKey = hashMap.get("session_key"); diff --git a/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/result/ActDetailGovResultDTO.java b/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/result/ActDetailGovResultDTO.java new file mode 100644 index 0000000000..2c321843ee --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/result/ActDetailGovResultDTO.java @@ -0,0 +1,146 @@ +package com.epmet.dto.result; + +import com.epmet.commons.tools.dto.form.FileCommonDTO; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 工作端小组内,活动详情返参DTO + * + * @author yinzuomei@elink-cn.com + * @date 2021/4/29 9:30 + */ +@Data +public class ActDetailGovResultDTO implements Serializable { + private static final long serialVersionUID = 3982724635100043221L; + + private String groupActId; + + /** + * 小组id + */ + private String groupId; + + /** + * 活动标题; + */ + private String title; + + /** + * 活动时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date startTime; + + /** + * 活动所属类别编码 + */ + private String categoryCode; + + /** + * 上级类别编码 + */ + private String parentCode; + + private String menuCode; + + /** + * 活动类别名称;eg:支部建设-三会一课 + */ + private String allCategoryName; + + /** + * 活动地点 + */ + private String address; + + /** + * 应参加人数组长填入;此列也是应签到人数; + */ + private Integer shouldAttend; + + /** + * 活动状态:已发布:published;已取消:canceled;已变更:changed;已关闭:closed + */ + private String status; + + /** + * 签到开始时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date signInStartTime; + + /** + * 签到截止时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date signInEndTime; + + /** + * 是否填写总结?1:已填写;0:未填写 + */ + private Integer summaryFlag; + + /** + * 取消时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date canceledTime; + + /** + * 关闭时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date closedTime; + + /** + * 活动发布人用户id + */ + private String publishUserId; + + /** + * 内容列表 + */ + private List textList; + + /** + * 图片列表 + */ + private List imgArrayList; + + /** + * 图片列表,最多3张 + */ + private List imgList; + + //以下字段需要单独赋值 + /** + * 取消原因 + */ + private String canceledReason; + + /** + * 已签到人数(有人签到自动+1) + */ + private Integer signedInNum; + + /** + * 网格id + */ + private String gridId; + + /** + * 客户id + */ + private String customerId; + + /** + * 最后一次编辑时间;首次发布与CREATED_TIME一致 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date changedTime; +} diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiGroupController.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiGroupController.java index 4ee3b04ee8..08b7284e19 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiGroupController.java +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiGroupController.java @@ -2,15 +2,15 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.RequirePermission; +import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.enums.RequirePermissionEnum; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.result.ActDetailGovResultDTO; +import com.epmet.resi.group.dto.act.form.ActDetailFormDTO; import com.epmet.resi.group.dto.group.form.*; import com.epmet.resi.group.dto.group.result.*; -import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.resi.group.dto.group.form.GovGroupSummarizeFromDTO; -import com.epmet.resi.group.dto.group.form.GroupAuditedFromDTO; import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; import com.epmet.service.ResiGroupService; import org.springframework.beans.factory.annotation.Autowired; @@ -175,5 +175,19 @@ public class ResiGroupController { return groupOpenFeignClient.govAuditEdit(param); } - + /** + * @return com.epmet.commons.tools.utils.Result + * @param tokenDto + * @param actDetailFormDTO + * @author yinzuomei + * @description 工作端查看小组内活动详情 + * @Date 2021/4/29 9:38 + **/ + @PostMapping("actdetail") + public Result queryActDetailForWork(@LoginUser TokenDto tokenDto, @RequestBody ActDetailFormDTO actDetailFormDTO){ + actDetailFormDTO.setUserId(tokenDto.getUserId()); + actDetailFormDTO.setClient(AppClientConstant.APP_GOV); + ValidatorUtils.validateEntity(actDetailFormDTO,ActDetailFormDTO.AddUserInternalGroup.class); + return new Result().ok(resiGroupService.queryActDetailForWork(actDetailFormDTO)); + } } diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiTopicController.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiTopicController.java index 6686e605f6..444b81dc02 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiTopicController.java +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiTopicController.java @@ -6,8 +6,10 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.resi.group.dto.comment.form.ResiQueryCommentFormDTO; import com.epmet.resi.group.dto.comment.result.GovCommentResultDTO; +import com.epmet.resi.group.dto.topic.form.AllMessagesFormDTO; import com.epmet.resi.group.dto.topic.form.ResiTopicDetailFormDTO; import com.epmet.resi.group.dto.topic.form.ResiTopicPageFormDTO; +import com.epmet.resi.group.dto.topic.result.AllMessagesResultDTO; import com.epmet.resi.group.dto.topic.result.GovHiddenTopicInfoResultDTO; import com.epmet.resi.group.dto.topic.result.GovTopicInfoResultDTO; import com.epmet.resi.group.dto.topic.result.ResiTopicDetailResultDTO; @@ -70,6 +72,18 @@ public class ResiTopicController { return resiTopicService.topicDetail(topicDetailFormDTO); } - + /** + * @Description 小组内所有历史消息【话题,通知,活动】 + * @Param tokenDto + * @Param topicPageFormDTO + * @author zxc + * @date 2021/4/28 上午10:41 + */ + @PostMapping("allmessages") + public Result> allMessages(@LoginUser TokenDto tokenDto, @RequestBody AllMessagesFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, AllMessagesFormDTO.AllMessagesForm.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + return new Result>().ok(resiTopicService.allMessages(formDTO)); + } } diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/ResiGroupFeignClient.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/ResiGroupFeignClient.java index 2fc38efdf0..ee668f7ba6 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/ResiGroupFeignClient.java +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/ResiGroupFeignClient.java @@ -6,6 +6,8 @@ import com.epmet.controller.TestFormDTO1; import com.epmet.controller.TestResultDTO1; import com.epmet.dto.result.GridProcessingCountResultDTO; import com.epmet.feign.fallback.ResiGroupFeignClientFallBack; +import com.epmet.resi.group.dto.act.form.ActDetailFormDTO; +import com.epmet.resi.group.dto.act.result.ActDetailResultDTO; import com.epmet.resi.group.dto.comment.form.ResiQueryCommentFormDTO; import com.epmet.resi.group.dto.comment.result.ResiCommentResultDTO; import com.epmet.resi.group.dto.group.form.*; @@ -151,4 +153,14 @@ public interface ResiGroupFeignClient { @PostMapping(value = "/resi/group/group/test",consumes = MediaType.APPLICATION_JSON_VALUE) Result test(@RequestBody TestFormDTO1 testFormDTO1); + + /** + * @return com.epmet.commons.tools.utils.Result + * @param actDetailFormDTO + * @author yinzuomei + * @description 查询活动详情 + * @Date 2021/4/29 9:57 + **/ + @PostMapping(value = "/resi/group/act/actdetail-internal",consumes = MediaType.APPLICATION_JSON_VALUE) + Result queryActDetailInternal(@RequestBody ActDetailFormDTO actDetailFormDTO); } diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/ResiGroupFeignClientFallBack.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/ResiGroupFeignClientFallBack.java index 588142a4f0..413022ea78 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/ResiGroupFeignClientFallBack.java +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/ResiGroupFeignClientFallBack.java @@ -7,6 +7,8 @@ import com.epmet.controller.TestFormDTO1; import com.epmet.controller.TestResultDTO1; import com.epmet.dto.result.GridProcessingCountResultDTO; import com.epmet.feign.ResiGroupFeignClient; +import com.epmet.resi.group.dto.act.form.ActDetailFormDTO; +import com.epmet.resi.group.dto.act.result.ActDetailResultDTO; import com.epmet.resi.group.dto.comment.form.ResiQueryCommentFormDTO; import com.epmet.resi.group.dto.comment.result.ResiCommentResultDTO; import com.epmet.resi.group.dto.group.form.GovGroupSummarizeFromDTO; @@ -120,4 +122,16 @@ public class ResiGroupFeignClientFallBack implements ResiGroupFeignClient { public Result test(TestFormDTO1 testFormDTO1) { return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "test", testFormDTO1); } + + /** + * @param actDetailFormDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 查询活动详情 + * @Date 2021/4/29 9:57 + **/ + @Override + public Result queryActDetailInternal(ActDetailFormDTO actDetailFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "queryActDetailInternal", actDetailFormDTO); + } } diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiGroupService.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiGroupService.java index 02dc4e458d..2609cb7b87 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiGroupService.java +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiGroupService.java @@ -1,10 +1,10 @@ package com.epmet.service; import com.epmet.commons.tools.utils.Result; -import com.epmet.resi.group.dto.group.form.GovGroupSummarizeFromDTO; -import com.epmet.resi.group.dto.group.form.GroupAuditedFromDTO; -import com.epmet.resi.group.dto.group.result.*; +import com.epmet.dto.result.ActDetailGovResultDTO; +import com.epmet.resi.group.dto.act.form.ActDetailFormDTO; import com.epmet.resi.group.dto.group.form.*; +import com.epmet.resi.group.dto.group.result.*; import java.util.List; @@ -74,4 +74,5 @@ public interface ResiGroupService { **/ Result disagreeApplying(DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO); + ActDetailGovResultDTO queryActDetailForWork(ActDetailFormDTO actDetailFormDTO); } diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiTopicService.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiTopicService.java index ac12a9fcfe..0b30bc2734 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiTopicService.java +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiTopicService.java @@ -3,8 +3,10 @@ package com.epmet.service; import com.epmet.commons.tools.utils.Result; import com.epmet.resi.group.dto.comment.form.ResiQueryCommentFormDTO; import com.epmet.resi.group.dto.comment.result.GovCommentResultDTO; +import com.epmet.resi.group.dto.topic.form.AllMessagesFormDTO; import com.epmet.resi.group.dto.topic.form.ResiTopicDetailFormDTO; import com.epmet.resi.group.dto.topic.form.ResiTopicPageFormDTO; +import com.epmet.resi.group.dto.topic.result.AllMessagesResultDTO; import com.epmet.resi.group.dto.topic.result.GovHiddenTopicInfoResultDTO; import com.epmet.resi.group.dto.topic.result.GovTopicInfoResultDTO; import com.epmet.resi.group.dto.topic.result.ResiTopicDetailResultDTO; @@ -53,5 +55,13 @@ public interface ResiTopicService { **/ Result> topicComments(ResiQueryCommentFormDTO queryCommentFormDTO); + /** + * @Description 小组内所有历史消息【话题,通知,活动】 + * @Param formDTO + * @author zxc + * @date 2021/4/28 下午1:29 + */ + List allMessages(AllMessagesFormDTO formDTO); + } diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiGroupServiceImpl.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiGroupServiceImpl.java index 28cb001f5e..81231e26f2 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiGroupServiceImpl.java +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiGroupServiceImpl.java @@ -1,11 +1,14 @@ package com.epmet.service.impl; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.ActDetailGovResultDTO; import com.epmet.feign.ResiGroupFeignClient; -import com.epmet.resi.group.dto.group.form.GovGroupSummarizeFromDTO; -import com.epmet.resi.group.dto.group.form.GroupAuditedFromDTO; -import com.epmet.resi.group.dto.group.result.*; +import com.epmet.resi.group.dto.act.form.ActDetailFormDTO; +import com.epmet.resi.group.dto.act.result.ActDetailResultDTO; import com.epmet.resi.group.dto.group.form.*; +import com.epmet.resi.group.dto.group.result.*; import com.epmet.service.ResiGroupService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -57,5 +60,15 @@ public class ResiGroupServiceImpl implements ResiGroupService{ return resiGroupFeignClient.disagreeApplying(disAgreeApplyGroupFormDTO); } + @Override + public ActDetailGovResultDTO queryActDetailForWork(ActDetailFormDTO actDetailFormDTO) { + Result actDetailResult=resiGroupFeignClient.queryActDetailInternal(actDetailFormDTO); + if(actDetailResult.success()&&null!=actDetailResult.getData()){ + ActDetailGovResultDTO resultDTO= ConvertUtils.sourceToTarget(actDetailResult.getData(),ActDetailGovResultDTO.class); + return resultDTO; + } + throw new RenException("调用resi-group服务,查询活动详情异常"); + } + } diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiTopicServiceImpl.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiTopicServiceImpl.java index a51eebbed6..260dee432e 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiTopicServiceImpl.java +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiTopicServiceImpl.java @@ -1,20 +1,21 @@ package com.epmet.service.impl; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.Result; import com.epmet.feign.ResiGroupFeignClient; import com.epmet.resi.group.dto.comment.form.ResiQueryCommentFormDTO; import com.epmet.resi.group.dto.comment.result.GovCommentResultDTO; import com.epmet.resi.group.dto.comment.result.ResiCommentResultDTO; +import com.epmet.resi.group.dto.topic.form.AllMessagesFormDTO; import com.epmet.resi.group.dto.topic.form.ResiTopicDetailFormDTO; import com.epmet.resi.group.dto.topic.form.ResiTopicPageFormDTO; -import com.epmet.resi.group.dto.topic.result.GovHiddenTopicInfoResultDTO; -import com.epmet.resi.group.dto.topic.result.GovTopicInfoResultDTO; -import com.epmet.resi.group.dto.topic.result.ResiTopicDetailResultDTO; -import com.epmet.resi.group.dto.topic.result.ResiTopicInfoResultDTO; +import com.epmet.resi.group.dto.topic.result.*; +import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; import com.epmet.service.ResiTopicService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.List; @@ -24,6 +25,8 @@ public class ResiTopicServiceImpl implements ResiTopicService { @Autowired private ResiGroupFeignClient resiGroupFeignClient; + @Autowired + private ResiGroupOpenFeignClient resiGroupOpenFeignClient; /** * @Description 政府端群组管理-屏蔽话题列表查询 @@ -125,4 +128,22 @@ public class ResiTopicServiceImpl implements ResiTopicService { return new Result>().ok(commentsResult); } + + /** + * @Description 小组内所有历史消息【话题,通知,活动】 + * @Param formDTO + * @author zxc + * @date 2021/4/28 下午1:29 + */ + @Override + public List allMessages(AllMessagesFormDTO formDTO) { + Result> listResult = resiGroupOpenFeignClient.allMessages(formDTO); + if (!listResult.success()){ + throw new RenException(listResult.getMsg()); + } + if (CollectionUtils.isEmpty(listResult.getData())){ + return new ArrayList<>(); + } + return listResult.getData(); + } } diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java index 2977849e22..190cbaf2f8 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java +++ b/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 getCategoryTagList(@RequestBody CategoryTagListFormDTO formDTO); + + /** + * @param customerId + * @Description 根据客户Id获取 议题列表 + * @Author sun + **/ + @PostMapping(value = "/gov/issue/issue/getissuelist") + Result> getIssueList(@RequestParam String customerId); } diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java index d8cc8c9d92..67e41d309a 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java +++ b/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 getCategoryTagList(CategoryTagListFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "getCategoryTagList", formDTO); } + + @Override + public Result> getIssueList(String customerId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "getIssueList", customerId); + } } diff --git a/epmet-module/gov-issue/gov-issue-server/pom.xml b/epmet-module/gov-issue/gov-issue-server/pom.xml index be5748e35b..f05f5775bf 100644 --- a/epmet-module/gov-issue/gov-issue-server/pom.xml +++ b/epmet-module/gov-issue/gov-issue-server/pom.xml @@ -216,7 +216,6 @@ 192.168.1.130:9876;192.168.1.132:9876 - epmet_message diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueController.java index c64573730a..a539727606 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueController.java +++ b/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>().ok(issueService.getClosedListByGroup(formDTO)); } + /** + * desc: 获取议题列表 + * + * @param customerId + * @return com.epmet.commons.tools.utils.Result> + * @author LiuJanJun + * @date 2021/4/27 10:19 上午 + */ + @PostMapping("getissuelist") + public Result> getIssueList(@RequestParam String customerId) { + return new Result>().ok(issueService.getIssueList(customerId)); + } + } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java index e22236e324..90e06f1185 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java @@ -315,4 +315,14 @@ public interface IssueService extends BaseService { * @return java.util.List */ List getClosedListByGroup(AllIssueFormDTO formDTO); + + /** + * desc: 根据客户Id获取议题列表 + * + * @param customerId + * @return java.util.List + * @author LiuJanJun + * @date 2021/4/27 10:23 上午 + */ + List getIssueList(String customerId); } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index 9b6bdb6688..7532a52fdb 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/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 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 imp return baseDao.selectClosedListByTopic(formDTO); } + @Override + public List getIssueList(String customerId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda() + .eq(IssueEntity::getCustomerId,customerId) + .eq(IssueEntity::getDelFlag,NumConstant.ZERO_STR); + List issueEntities = baseDao.selectList(queryWrapper); + if (CollectionUtils.isEmpty(issueEntities)){ + return null; + } + return ConvertUtils.sourceToTarget(issueEntities,IssueDTO.class); + } + } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridInfoResultDTO.java index 83bf82bfbf..e723142dee 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridInfoResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridInfoResultDTO.java @@ -87,5 +87,10 @@ public class GridInfoResultDTO implements Serializable { * 网格所属机关名称 */ private String parentAgencyName; + + /** + * 网格的所有上级组织 + */ + private String pids; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java index b378946ff3..bfe0f9f00f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java +++ b/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(); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgListener.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgListener.java deleted file mode 100644 index 6ddc79801b..0000000000 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgListener.java +++ /dev/null @@ -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 { - - 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; - } -} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgRolesListener.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgRolesListener.java index 97a15d7e56..010e2044a3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgRolesListener.java +++ b/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()); @@ -53,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重试 @@ -68,8 +69,8 @@ public class InitCustomerOrgRolesListener implements MessageListenerConcurrently } /** - * @Description 构造dto * @return + * @Description 构造dto * @author wxz * @date 2021.01.06 15:03 */ @@ -99,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; + }*/ } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java index 5c2c4599de..107616d691 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java @@ -486,6 +486,7 @@ public class CustomerGridServiceImpl extends BaseServiceImpl AND customer_name LIKE concat('%', trim(#{customerName}), '%') + ORDER BY + created_time DESC SELECT - ID AS "customerId", - CUSTOMER_NAME, - TITLE, - VALIDITY_TIME, - ORGANIZATION_LEVEL, - LOGO, - GRID_NUMBER + id AS "customerId", + customer_name, + title, + validity_time, + organization_level, + logo, + grid_number FROM customer WHERE - DEL_FLAG = '0' + del_flag = '0' AND customer_name LIKE concat('%', trim(#{customerName}), '%') + ORDER BY + created_time DESC + SELECT + acd.CATEGORY_CODE as menuCode, + acd.CATEGORY_NAME as categoryName, + acd.PARENT_CODE as parentCode + FROM + act_category_dict acd + WHERE + acd.DEL_FLAG = '0' + AND acd.CUSTOMER_ID = #{customerId} + AND acd.`LEVEL` = '1' + order by acd.sort asc + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActCommentDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActCommentDao.xml new file mode 100644 index 0000000000..fd7e1bf6e7 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActCommentDao.xml @@ -0,0 +1,22 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActOperationRecordDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActOperationRecordDao.xml new file mode 100644 index 0000000000..46f3194d11 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActOperationRecordDao.xml @@ -0,0 +1,21 @@ + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActReadRecordDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActReadRecordDao.xml new file mode 100644 index 0000000000..2e1b70570d --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActReadRecordDao.xml @@ -0,0 +1,34 @@ + + + + + + + + delete from act_read_record where GROUP_ACT_ID=#{groupActId} + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSignInCodeDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSignInCodeDao.xml new file mode 100644 index 0000000000..a2bcffeb71 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSignInCodeDao.xml @@ -0,0 +1,15 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSignInRecordDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSignInRecordDao.xml new file mode 100644 index 0000000000..ec3207549b --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSignInRecordDao.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSummaryContentDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSummaryContentDao.xml new file mode 100644 index 0000000000..50ca8f4ece --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSummaryContentDao.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSummaryDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSummaryDao.xml new file mode 100644 index 0000000000..3782a2104c --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActSummaryDao.xml @@ -0,0 +1,16 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/GroupActContentDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/GroupActContentDao.xml new file mode 100644 index 0000000000..2e9e1540c9 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/GroupActContentDao.xml @@ -0,0 +1,25 @@ + + + + + + + delete from group_act_content + WHERE + GROUP_ACT_ID = #{groupActId} + + + + + \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/resigroup/EnterGroupSwitchDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/GroupActInfoDao.xml similarity index 63% rename from epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/resigroup/EnterGroupSwitchDao.xml rename to epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/GroupActInfoDao.xml index cdb6940650..70b86b20e5 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/resigroup/EnterGroupSwitchDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/GroupActInfoDao.xml @@ -1,6 +1,8 @@ - + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/GroupEditSubmitRecordDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/GroupEditSubmitRecordDao.xml index b9b2924cdb..d282690dea 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/GroupEditSubmitRecordDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/GroupEditSubmitRecordDao.xml @@ -72,6 +72,7 @@ edit.GROUP_ID, groupp.GROUP_NAME, groupp.GROUP_HEAD_PHOTO, + groupp.GROUP_TYPE, edit.READ_FLAG, edit.MESSAGE_TEXT, DATE_FORMAT( edit.CREATED_TIME, '%Y-%m-%d %H:%i' ) AS createdTime diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/GroupMessageDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/GroupMessageDao.xml new file mode 100644 index 0000000000..0921766109 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/GroupMessageDao.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupAchievementConfigDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupAchievementConfigDao.xml new file mode 100644 index 0000000000..cce26029ed --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupAchievementConfigDao.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupAchievementStatsDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupAchievementStatsDao.xml new file mode 100644 index 0000000000..2d18215754 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupAchievementStatsDao.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO resi_group_achievement_stats + ( + ID, + CUSTOMER_ID, + GROUP_ID, + ACHIEVEMENT_ID, + ACHIEVEMENT_NAME, + ACHIEVEMENT_TYPE, + ARRIVE_TIME, + CURRENT_VALUE, + TARGET_VALUE, + IS_ARRIVE, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) + VALUES + + ( + #{item.id}, + #{item.customerId}, + #{item.groupId}, + #{item.achievementId}, + #{item.achievementName}, + #{item.achievementType}, + #{item.arriveTime}, + #{item.currentValue}, + #{item.targetValue}, + #{item.isArrive}, + #{item.delFlag}, + #{item.revision}, + #{item.createdBy}, + #{item.createdTime}, + #{item.updatedBy}, + #{item.updatedTime} + ) + + ON DUPLICATE KEY UPDATE + + CURRENT_VALUE = values(CURRENT_VALUE), + TARGET_VALUE = values(TARGET_VALUE), + ARRIVE_TIME = if(IS_ARRIVE,ARRIVE_TIME,values(ARRIVE_TIME)), + IS_ARRIVE = VALUES(IS_ARRIVE), + UPDATED_TIME = VALUES(UPDATED_TIME), + + UPDATED_BY = VALUES(UPDATED_BY) + + + + diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml index 760a420020..74c02e9907 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml @@ -24,7 +24,8 @@ rgs.TOTAL_MEMBERS , rgs.TOTAL_PARTY_MEMBERS , rg.STATE , - rgm.GROUP_LEADER_FLAG + rgm.GROUP_LEADER_FLAG, + rg.GROUP_TYPE FROM resi_group_member rgm LEFT JOIN resi_group rg ON ( rgm.RESI_GROUP_ID = rg.ID ) @@ -64,6 +65,7 @@ rg.id AS groupId, rg.GROUP_HEAD_PHOTO AS groupHeadPhoto, rg.GROUP_NAME AS groupName, + rg.GROUP_TYPE AS groupType, rgs.TOTAL_MEMBERS AS totalMember, rgs.TOTAL_PARTY_MEMBERS AS totalPartyMember FROM @@ -85,6 +87,7 @@ and rg.CUSTOMER_ID=#{customerId} and rg.GRID_ID=#{gridId} and rg.STATE ='approved' + and rg.GROUP_TYPE != 'branch' order by totalMember desc,rg.LATEST_TOPIC_PUBLISH_DATE desc LIMIT #{pageNo}, #{pageSize} @@ -98,7 +101,8 @@ rg.GROUP_NAME AS groupName, rgs.TOTAL_MEMBERS AS totalMember, rgs.TOTAL_PARTY_MEMBERS AS totalPartyMember, - rg.STATE AS groupState + rg.STATE AS groupState, + rg.GROUP_TYPE AS groupType FROM resi_group_member rgm LEFT JOIN resi_group rg ON ( rgm.RESI_GROUP_ID = rg.ID ) @@ -140,6 +144,7 @@ rgs.TOTAL_MEMBERS AS totalMember, rgs.TOTAL_PARTY_MEMBERS AS totalPartyMember, rgm.GROUP_LEADER_FLAG AS leaderFlag, + CONCAT('LV', rg.level) AS level, ( SELECT count(1) @@ -242,6 +247,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupSetupDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupSetupDao.xml new file mode 100644 index 0000000000..edbedc2b35 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupSetupDao.xml @@ -0,0 +1,19 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/resigroup/InvitationAccessRecordDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/invitation/InvitationRecordDao.xml similarity index 62% rename from epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/resigroup/InvitationAccessRecordDao.xml rename to epmet-module/resi-group/resi-group-server/src/main/resources/mapper/invitation/InvitationRecordDao.xml index c17cdfca9d..00ed2225bb 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/resigroup/InvitationAccessRecordDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/invitation/InvitationRecordDao.xml @@ -1,7 +1,8 @@ - + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml index 620bac3066..243b301d19 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml @@ -191,4 +191,61 @@ ORDER BY rgm.CREATED_TIME DESC + + + + + + + + + + + + + UPDATE resi_group_member + SET DEL_FLAG = '1', + `STATUS` = 'exit', + UPDATED_TIME = NOW(), + UPDATED_BY = #{updatedBy} + WHERE + id = #{id} + diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeAttachmentDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeAttachmentDao.xml new file mode 100644 index 0000000000..5423a4620a --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeAttachmentDao.xml @@ -0,0 +1,31 @@ + + + + + + + + + DELETE + FROM + notice_attachment + WHERE + notice_id = #{noticeId} + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeCommentDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeCommentDao.xml new file mode 100644 index 0000000000..a5612ddcbf --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeCommentDao.xml @@ -0,0 +1,22 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeDao.xml new file mode 100644 index 0000000000..332dfa0b5c --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeDao.xml @@ -0,0 +1,21 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReadRecordDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReadRecordDao.xml new file mode 100644 index 0000000000..3848b66959 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeReadRecordDao.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + DELETE + FROM + notice_read_record + WHERE + notice_id = #{noticeId} + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml index a527b720ef..b5f35a8a7a 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml @@ -378,15 +378,18 @@ diff --git a/epmet-module/resi-group/resi-group-server/src/test/com/epmet/modules/group/service/impl/StatsAchievementServiceImplTest.java b/epmet-module/resi-group/resi-group-server/src/test/com/epmet/modules/group/service/impl/StatsAchievementServiceImplTest.java new file mode 100644 index 0000000000..c38cf87259 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/test/com/epmet/modules/group/service/impl/StatsAchievementServiceImplTest.java @@ -0,0 +1,37 @@ +package com.epmet.modules.group.service.impl; + +import com.epmet.modules.group.service.StatsAchievementService; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class StatsAchievementServiceImplTest { + @Autowired + private StatsAchievementService statsAchievementService; + + @Test + public void initAll() { + Boolean aBoolean = statsAchievementService.initAllGroupAchievement(null); + System.out.println(aBoolean); + } + + @Test + public void calculateAcm() { + +// String customerId = "test_cid"; +// String groupId = "test_groupId"; +// String achievementType = "member"; +// Boolean aBoolean = statsAchievementService.calculateAcm(customerId, groupId, achievementType); +// System.out.println(aBoolean); + + String customerId = "test_cid"; + String groupId = "test_groupId"; + String achievementType = "toissue"; + Boolean aBoolean = statsAchievementService.calculateAcm(customerId, groupId, achievementType); + System.out.println(aBoolean); + } +} diff --git a/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/TopicInfoDTO.java b/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/TopicInfoDTO.java index 6dcf993139..86e0daefb2 100644 --- a/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/TopicInfoDTO.java +++ b/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/TopicInfoDTO.java @@ -40,4 +40,10 @@ public class TopicInfoDTO implements Serializable { */ private Long publishedTime; + /** + * 小组类型(ordinary:楼院小组 branch:支部小组) + */ + private String groupType; + + } diff --git a/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/result/IssueInitiatorResultDTO.java b/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/result/IssueInitiatorResultDTO.java index 08e0113ace..8b5a7d7a81 100644 --- a/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/result/IssueInitiatorResultDTO.java +++ b/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/result/IssueInitiatorResultDTO.java @@ -16,5 +16,9 @@ public class IssueInitiatorResultDTO implements Serializable { * 议题发起人(山东路168-尹女士) */ private String issueInitiator; + /** + * 议题发起人真实姓名 + */ + private String realUserName; } diff --git a/epmet-module/resi-hall/resi-hall-server/pom.xml b/epmet-module/resi-hall/resi-hall-server/pom.xml index 4acf9d35d9..d974439daf 100644 --- a/epmet-module/resi-hall/resi-hall-server/pom.xml +++ b/epmet-module/resi-hall/resi-hall-server/pom.xml @@ -51,6 +51,12 @@ 2.0.0 compile + + com.epmet + epmet-user-client + 2.0.0 + compile + diff --git a/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index 64c1d9361b..163fda848c 100644 --- a/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -45,6 +45,8 @@ public class IssueServiceImpl implements IssueService { private GovIssueOpenFeignClient govIssueOpenFeignClient; @Autowired private LoginUserUtil loginUserUtil; + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; /** * @param issueDetail @@ -62,13 +64,7 @@ public class IssueServiceImpl implements IssueService { return issueDetailResult; } BeanUtils.copyProperties(issueResult, issueDetailResult); - //话题发起人 - IssueInitiatorFormDTO initiatorFormDTO = new IssueInitiatorFormDTO(); - initiatorFormDTO.setUserId(issueResult.getUserId()); - if (!StringUtils.isBlank(issueResult.getUserId())) { - IssueInitiatorResultDTO initiatorResult = userFeignClient.selectIssueInitiator(initiatorFormDTO).getData(); - issueDetailResult.setIssueInitiator(initiatorResult == null ? HallConstat.NULL_CHARACTER_STRING : initiatorResult.getIssueInitiator()); - } + //网格名称 BelongGridNameFormDTO belongGridName = new BelongGridNameFormDTO(); belongGridName.setGridId(issueResult.getGridId()); @@ -79,10 +75,39 @@ public class IssueServiceImpl implements IssueService { //话题信息 TopicInfoFormDTO topicInfoFormDTO = new TopicInfoFormDTO(); topicInfoFormDTO.setTopicId(issueResult.getTopicId()); + TopicInfoDTO topicInfoDTOResult = new TopicInfoDTO(); if (!StringUtils.isBlank(issueResult.getTopicId())) { - TopicInfoDTO topicInfoDTOResult = resiGroupFeignClient.selectDetail(topicInfoFormDTO).getData(); + topicInfoDTOResult = resiGroupFeignClient.selectDetail(topicInfoFormDTO).getData(); issueDetailResult.setTopicInfo(topicInfoDTOResult == null ? new TopicInfoDTO() : topicInfoDTOResult); } + + /*if("branch".equals(topicInfoDTOResult.getGroupType())){//支部小组话题发起人显示真实姓名 + List userIdList = new ArrayList<>(); + userIdList.add(issueResult.getUserId()); + Result> result = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList); + if (!result.success()) { + throw new RenException("调用user服务,获取用户基础数据失败"); + } + List resultDTOList = result.getData(); + resultDTOList.forEach(re->{ + if(issueResult.getUserId().equals(re.getUserId())){ + //话题发起人 + String street = re.getStreet() == null ? "" : re.getStreet() + "-"; + String realName = re.getRealName() == null ? "" : re.getRealName(); + issueDetailResult.setIssueInitiator(street + realName); + } + }); + } else { + //话题发起人 + IssueInitiatorFormDTO initiatorFormDTO = new IssueInitiatorFormDTO(); + initiatorFormDTO.setUserId(issueResult.getUserId()); + if (!StringUtils.isBlank(issueResult.getUserId())) { + IssueInitiatorResultDTO initiatorResult = userFeignClient.selectIssueInitiator(initiatorFormDTO).getData(); + issueDetailResult.setIssueInitiator(initiatorResult == null ? HallConstat.NULL_CHARACTER_STRING : initiatorResult.getIssueInitiator()); + } + }*/ + issueDetailResult.setIssueInitiator(topicInfoDTOResult.getPublishedUser()); + //判断是否投票 CheckVoteFormDTO formDTO = new CheckVoteFormDTO(); formDTO.setIssueId(issueDetail.getIssueId()); diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserBadgesFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserBadgesFormDTO.java new file mode 100644 index 0000000000..4585b1d080 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserBadgesFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.form; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2021/4/22 下午4:13 + * @DESC + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class UserBadgesFormDTO implements Serializable { + + private static final long serialVersionUID = -5211565974325345262L; + + private String customerId; + + private List userIds; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IssueInitiatorResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IssueInitiatorResultDTO.java index 08e0113ace..8b5a7d7a81 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IssueInitiatorResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IssueInitiatorResultDTO.java @@ -16,5 +16,9 @@ public class IssueInitiatorResultDTO implements Serializable { * 议题发起人(山东路168-尹女士) */ private String issueInitiator; + /** + * 议题发起人真实姓名 + */ + private String realUserName; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBadgesResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBadgesResultDTO.java new file mode 100644 index 0000000000..f0230c0772 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBadgesResultDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2021/4/22 下午4:09 + * @DESC + */ +@Data +public class UserBadgesResultDTO implements Serializable { + + private static final long serialVersionUID = -1504387869251002117L; + + private String userId; + + private List badgeIcons; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserInfoOnEnterGridResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserInfoOnEnterGridResultDTO.java index 0e5cd22fef..0bada1c5ee 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserInfoOnEnterGridResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserInfoOnEnterGridResultDTO.java @@ -51,7 +51,11 @@ public class UserInfoOnEnterGridResultDTO implements Serializable{ private List userRoleList; /** - * + * XX街道-Y先生/女士 如果是未认证居民,这一列为空 */ private String userStreetName; + /** + * XX街道-YYY 如果是未认证居民,这一列为空 + */ + private String userStreetTrueName; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserInfoResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserInfoResultDTO.java new file mode 100644 index 0000000000..0189aaa6e8 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserInfoResultDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/4/20 下午5:51 + * @DESC + */ +@Data +public class UserInfoResultDTO implements Serializable { + + private static final long serialVersionUID = 6003815400792121273L; + + private String userId; + + /** + * 发布者的全称(街道-姓氏先生/女士)【专项组显示真实名】 + */ + private String releaseUserName; + + /** + * 话题发布者的头像Url + */ + private String releaseUserHeadPhoto; + + /** + * 手机号 + */ + private String mobile; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index 52fe2a04cb..f85ba6d782 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -512,4 +512,22 @@ public interface EpmetUserOpenFeignClient { **/ @PostMapping(value = "/epmetuser/customerstaff/getcustomerstafflist") Result getCustomerStaffList(@RequestBody List staffIdList); + + /** + * @Description 查询此人是不是党员,true是党员,false不是党员 + * @Param userId + * @author zxc + * @date 2021/4/19 下午4:34 + */ + @GetMapping(value = "/epmetuser/userrole/ispartymember") + Result selectIsPartyMemberByUserId(@RequestParam("userId") String userId); + + /** + * @Description 查询用户徽章 + * @Param formDTO + * @author zxc + * @date 2021/4/22 下午4:17 + */ + @PostMapping("/epmetuser/badge/userbadges") + Result> userBadges(@RequestBody UserBadgesFormDTO formDTO); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 6230e5d875..518cca9cef 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -363,4 +363,14 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result getCustomerStaffList(List staffIdList) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffList", staffIdList); } + + @Override + public Result selectIsPartyMemberByUserId(String userId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectIsPartyMemberByUserId", userId); + } + + @Override + public Result> userBadges(UserBadgesFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "userBadges", formDTO); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java index edf52d1f97..a5d13c581f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java @@ -179,4 +179,15 @@ public class BadgeController { public Result> queryGridAuditingBadgeCount(@RequestBody List gridIdList) { return new Result>().ok(badgeService.queryGridAuditingBadgeCount(gridIdList)); } + + /** + * @Description 查询用户徽章 + * @Param formDTO + * @author zxc + * @date 2021/4/22 下午4:17 + */ + @PostMapping("userbadges") + public Result> userBadges(@RequestBody UserBadgesFormDTO formDTO){ + return new Result>().ok(badgeService.userBadges(formDTO)); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java index 8752f909d6..ea4c5b010e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java @@ -134,6 +134,17 @@ public class UserRoleController { return userRoleService.getUserRoleInfoByUserId(userId); } + /** + * @Description 查询此人是不是党员,true是党员,false不是党员 + * @Param userId + * @author zxc + * @date 2021/4/19 下午4:34 + */ + @GetMapping("ispartymember") + public Result selectIsPartyMemberByUserId(@RequestParam("userId") String userId){ + return new Result().ok(userRoleService.selectIsPartyMemberByUserId(userId)); + } + /** * 获取用户居民权限 * @author zhaoqifeng diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java index 82ebd8445c..dea59dfff7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java @@ -82,6 +82,14 @@ public interface UserRoleDao extends BaseDao { */ List selectPartyMemberUserIds(); + /** + * @Description 查询此人是不是党员 + * @Param userId + * @author zxc + * @date 2021/4/19 下午4:29 + */ + Integer selectIsPartyMemberByUserId(@Param("userId")String userId); + /** * 获取居民权限 * @author zhaoqifeng diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/BadgeService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/BadgeService.java index b409d5709b..f89f180458 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/BadgeService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/BadgeService.java @@ -21,10 +21,7 @@ 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.BadgeDTO; -import com.epmet.dto.form.AddBadgeFormDTO; -import com.epmet.dto.form.BadgeAuditFormDTO; -import com.epmet.dto.form.BadgeFormDTO; -import com.epmet.dto.form.EditBadgeFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.BadgeEntity; @@ -187,4 +184,12 @@ public interface BadgeService extends BaseService { * @Date 2020/11/12 15:56 **/ List queryGridAuditingBadgeCount(List gridIdList); + + /** + * @Description 查询用户徽章 + * @Param formDTO + * @author zxc + * @date 2021/4/22 下午4:17 + */ + List userBadges(UserBadgesFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserRoleService.java index 0d1f15295b..ae47c9291a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserRoleService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserRoleService.java @@ -123,6 +123,14 @@ public interface UserRoleService extends BaseService { **/ Result> getUserRoleInfoByUserId(String userId); + /** + * @Description 查询此人是不是党员,true是党员,false不是党员 + * @Param userId + * @author zxc + * @date 2021/4/19 下午4:34 + */ + Boolean selectIsPartyMemberByUserId(String userId); + /** * 获取用户居民权限 * @author zhaoqifeng diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java index 3a92a310fb..dcdd39d4f1 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java @@ -29,6 +29,8 @@ import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.ValidateException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; @@ -56,6 +58,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.*; +import java.util.stream.Collectors; /** * 徽章 @@ -83,6 +86,8 @@ public class BadgeServiceImpl extends BaseServiceImpl imp private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; @Autowired private UserBadgeDao userBadgeDao; + @Autowired + private RedisUtils redisUtils; @Override @@ -449,4 +454,30 @@ public class BadgeServiceImpl extends BaseServiceImpl imp return baseDao.queryGridAuditingBadgeCount(gridIdList); } + /** + * @Description 查询用户徽章 + * @Param formDTO + * @author zxc + * @date 2021/4/22 下午4:17 + */ + @Override + public List userBadges(UserBadgesFormDTO formDTO) { + String customerId = formDTO.getCustomerId(); + List userIds = formDTO.getUserIds(); + if (CollectionUtils.isEmpty(userIds)){ + return new ArrayList<>(); + } + List result = new ArrayList<>(); + userIds.forEach(userId -> { + List badges = redisUtils.lrange(RedisKeys.getResiUserBadgeKey(customerId, userId), NumConstant.ZERO, NumConstant.ONE_NEG, UserBadgeUnitFormDTO.class); + if (!CollectionUtils.isEmpty(badges)){ + UserBadgesResultDTO b = new UserBadgesResultDTO(); + b.setUserId(userId); + b.setBadgeIcons(badges.stream().map(m -> m.getBadgeIcon()).collect(Collectors.toList())); + result.add(b); + } + }); + return result; + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java index 8c6c448689..e2aaae2963 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java @@ -273,6 +273,7 @@ public class RegisterRelationServiceImpl extends BaseServiceImpl>().ok(list); } + /** + * @Description 查询此人是不是党员,true是党员,false不是党员 + * @Param userId + * @author zxc + * @date 2021/4/19 下午4:34 + */ + @Override + public Boolean selectIsPartyMemberByUserId(String userId) { + Integer num = baseDao.selectIsPartyMemberByUserId(userId); + if (null != num && num > NumConstant.ZERO){ + return true; + } + return false; + } + /** * 获取用户居民权限 * diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml index 1dca8f531b..fb360d3a39 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml @@ -142,13 +142,20 @@ '-', uri.surname, CASE - WHEN uw.sex = '1' THEN - '先生' - WHEN uw.sex = '2' THEN - '女士' - ELSE '先生/女士' - END - ) AS issueInitiator + WHEN uw.sex = '1' THEN + '先生' + WHEN uw.sex = '2' THEN + '女士' + ELSE + '先生/女士' + END + ) AS issueInitiator, + CONCAT( + uri.street, + '-', + uri.surname, + uri.NAME + ) AS realUserName FROM user_resi_info uri LEFT JOIN user_wechat uw ON uw.user_id = uri.user_id diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml index a453220166..7f3b21a0dd 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml @@ -126,4 +126,16 @@ AND ur.CUSTOMER_ID = #{customerId} + + +