122 changed files with 5090 additions and 248 deletions
@ -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"; |
|||
} |
|||
|
@ -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; |
|||
} |
@ -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; |
|||
} |
@ -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; |
|||
} |
|||
} |
@ -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; |
|||
} |
|||
|
|||
} |
@ -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; |
|||
|
|||
} |
@ -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; |
|||
} |
@ -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'); |
@ -0,0 +1,101 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 按业务类型积分总计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-04-20 |
|||
*/ |
|||
@Data |
|||
public class BizPointTotalDetailDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 组织Id |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 业务类型:小组:group |
|||
*/ |
|||
private String bizType; |
|||
|
|||
/** |
|||
* 业务类型的对象id |
|||
*/ |
|||
private String objectId; |
|||
|
|||
/** |
|||
* OBJECTID的总积分 总积分=objectId下所有的用户积分 |
|||
*/ |
|||
private Integer totalPoint; |
|||
|
|||
/** |
|||
* 删除标识 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,106 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 按业务类型积分总计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-04-20 |
|||
*/ |
|||
@Data |
|||
public class BizPointUserTotalDetailDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 组织Id |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 业务类型:小组:group |
|||
*/ |
|||
private String bizType; |
|||
|
|||
/** |
|||
* 业务类型的对象id |
|||
*/ |
|||
private String objectId; |
|||
|
|||
/** |
|||
* OBJECTID的总积分 总积分=objectId下所有的用户积分 |
|||
*/ |
|||
private Integer totalPoint; |
|||
|
|||
/** |
|||
* 删除标识 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -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; |
|||
} |
@ -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; |
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2021/4/22 15:15 |
|||
*/ |
|||
@Data |
|||
public class GroupPointRuleResultDTO implements Serializable { |
|||
private static final long serialVersionUID = -1651136821935977327L; |
|||
private List<String> rules; |
|||
/** |
|||
* 个人贡献概述 |
|||
*/ |
|||
private String contriSummary; |
|||
|
|||
/** |
|||
* 小组积分概述 |
|||
*/ |
|||
private String groupSummary; |
|||
} |
@ -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; |
|||
} |
@ -0,0 +1,96 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.form.GroupPointFormDTO; |
|||
import com.epmet.dto.result.GroupPointRuleResultDTO; |
|||
import com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO; |
|||
import com.epmet.dto.result.GroupPointRankingResultDTO; |
|||
import com.epmet.dto.result.PointRankingResultDTO; |
|||
import com.epmet.service.BizPointTotalDetailService; |
|||
import com.epmet.service.BizPointUserTotalDetailService; |
|||
import com.epmet.service.PointRuleService; |
|||
import com.epmet.utils.ModuleConstant; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* 小组积分 |
|||
* @date 2021/4/21 9:45 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("group/point") |
|||
public class GroupPointController { |
|||
|
|||
@Autowired |
|||
private BizPointUserTotalDetailService bizPointUserTotalDetailService; |
|||
@Autowired |
|||
private BizPointTotalDetailService bizPointTotalDetailService; |
|||
@Autowired |
|||
private PointRuleService pointRuleService; |
|||
|
|||
/** |
|||
* 小组积分贡献榜 |
|||
* |
|||
* @param tokenDto |
|||
* @param formDTO |
|||
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.dto.result.PointRankingResultDTO>> |
|||
* @author zhaoqifeng |
|||
* @date 2021/4/21 14:02 |
|||
*/ |
|||
@PostMapping("pointranking") |
|||
public Result<List<PointRankingResultDTO>> pointRanking(@LoginUser TokenDto tokenDto, @RequestBody GroupPointFormDTO formDTO) { |
|||
List<PointRankingResultDTO> list = bizPointUserTotalDetailService.pointRanking(tokenDto, formDTO); |
|||
return new Result<List<PointRankingResultDTO>>().ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 网格小组积分排行 |
|||
* |
|||
* @param formDTO |
|||
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.dto.result.GroupPointRankingResultDTO>> |
|||
* @author zhaoqifeng |
|||
* @date 2021/4/21 14:02 |
|||
*/ |
|||
@PostMapping("grouppointranking") |
|||
public Result<List<GroupPointRankingResultDTO>> groupPointRanking(@RequestBody GroupPointFormDTO formDTO) { |
|||
List<GroupPointRankingResultDTO> list = bizPointTotalDetailService.groupPointRanking(formDTO); |
|||
return new Result<List<GroupPointRankingResultDTO>>().ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 小组积分详情 |
|||
* |
|||
* @param formDTO |
|||
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO> |
|||
* @author zhaoqifeng |
|||
* @date 2021/4/21 14:02 |
|||
*/ |
|||
@PostMapping("pointdetail") |
|||
public Result<GroupPointDetailResultDTO> pointDetail(@RequestBody GroupPointFormDTO formDTO) { |
|||
GroupPointDetailResultDTO result = bizPointTotalDetailService.pointDetail(formDTO); |
|||
return new Result<GroupPointDetailResultDTO>().ok(result); |
|||
} |
|||
|
|||
/** |
|||
* 小组积分规则 |
|||
* @author zhaoqifeng |
|||
* @date 2021/4/22 15:36 |
|||
* @param tokenDto |
|||
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.GroupPointRuleResultDTO> |
|||
*/ |
|||
@PostMapping("pointrule") |
|||
public Result<GroupPointRuleResultDTO> pointRule(@LoginUser TokenDto tokenDto) { |
|||
GroupPointRuleResultDTO result = pointRuleService.getGroupRule(tokenDto.getCustomerId()); |
|||
result.setContriSummary(ModuleConstant.CONTRI_SUMMARY); |
|||
result.setGroupSummary(ModuleConstant.GROUP_RULE_SUMMARY); |
|||
return new Result<GroupPointRuleResultDTO>().ok(result); |
|||
} |
|||
} |
@ -0,0 +1,43 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.dto.BizPointTotalDetailDTO; |
|||
import com.epmet.entity.BizPointTotalDetailEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
/** |
|||
* 按业务类型积分总计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-04-20 |
|||
*/ |
|||
@Mapper |
|||
public interface BizPointTotalDetailDao extends BaseDao<BizPointTotalDetailEntity> { |
|||
/** |
|||
* 根据业务类型查找数据 |
|||
* @author zhaoqifeng |
|||
* @date 2021/4/20 16:57 |
|||
* @param type |
|||
* @param objectId |
|||
* @return com.epmet.dto.BizPointTotalDetailDTO |
|||
*/ |
|||
BizPointTotalDetailDTO selectDataByObject(@Param("type")String type, @Param("objectId")String objectId); |
|||
} |
@ -0,0 +1,44 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.BizPointUserTotalDetailEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
/** |
|||
* 按业务类型积分总计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-04-20 |
|||
*/ |
|||
@Mapper |
|||
public interface BizPointUserTotalDetailDao extends BaseDao<BizPointUserTotalDetailEntity> { |
|||
|
|||
/** |
|||
* 获取今日积分增量 |
|||
* @author zhaoqifeng |
|||
* @date 2021/4/21 16:56 |
|||
* @param type |
|||
* @param objectId |
|||
* @return java.lang.Integer |
|||
*/ |
|||
Integer selectIncrease(@Param("type")String type, @Param("objectId")String objectId); |
|||
|
|||
} |
@ -0,0 +1,71 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 按业务类型积分总计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-04-20 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("biz_point_total_detail") |
|||
public class BizPointTotalDetailEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 组织Id |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 业务类型:小组:group |
|||
*/ |
|||
private String bizType; |
|||
|
|||
/** |
|||
* 业务类型的对象id |
|||
*/ |
|||
private String objectId; |
|||
|
|||
/** |
|||
* OBJECTID的总积分 总积分=objectId下所有的用户积分 |
|||
*/ |
|||
private Integer totalPoint; |
|||
|
|||
} |
@ -0,0 +1,76 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 按业务类型积分总计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-04-20 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("biz_point_user_total_detail") |
|||
public class BizPointUserTotalDetailEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 组织Id |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 业务类型:小组:group |
|||
*/ |
|||
private String bizType; |
|||
|
|||
/** |
|||
* 业务类型的对象id |
|||
*/ |
|||
private String objectId; |
|||
|
|||
/** |
|||
* OBJECTID的总积分 总积分=objectId下所有的用户积分 |
|||
*/ |
|||
private Integer totalPoint; |
|||
|
|||
} |
@ -0,0 +1,129 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.BizPointTotalDetailDTO; |
|||
import com.epmet.dto.form.GroupPointFormDTO; |
|||
import com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO; |
|||
import com.epmet.dto.result.GroupPointRankingResultDTO; |
|||
import com.epmet.entity.BizPointTotalDetailEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 按业务类型积分总计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-04-20 |
|||
*/ |
|||
public interface BizPointTotalDetailService extends BaseService<BizPointTotalDetailEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<BizPointTotalDetailDTO> |
|||
* @author generator |
|||
* @date 2021-04-20 |
|||
*/ |
|||
PageData<BizPointTotalDetailDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<BizPointTotalDetailDTO> |
|||
* @author generator |
|||
* @date 2021-04-20 |
|||
*/ |
|||
List<BizPointTotalDetailDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return BizPointTotalDetailDTO |
|||
* @author generator |
|||
* @date 2021-04-20 |
|||
*/ |
|||
BizPointTotalDetailDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-04-20 |
|||
*/ |
|||
void save(BizPointTotalDetailDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-04-20 |
|||
*/ |
|||
void update(BizPointTotalDetailDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-04-20 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* 根据业务类型查找数据 |
|||
* |
|||
* @param type |
|||
* @param objectId |
|||
* @return com.epmet.dto.BizPointTotalDetailDTO |
|||
* @author zhaoqifeng |
|||
* @date 2021/4/20 16:53 |
|||
*/ |
|||
BizPointTotalDetailDTO getDataByObject(String type, String objectId); |
|||
|
|||
/** |
|||
* 小组积分详情 |
|||
* |
|||
* @param formDTO |
|||
* @return com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO |
|||
* @author zhaoqifeng |
|||
* @date 2021/4/21 14:05 |
|||
*/ |
|||
GroupPointDetailResultDTO pointDetail(GroupPointFormDTO formDTO); |
|||
|
|||
/** |
|||
* 网格小组积分排行 |
|||
* |
|||
* @param formDTO |
|||
* @return java.util.List<com.epmet.dto.result.GroupPointRankingResultDTO> |
|||
* @author zhaoqifeng |
|||
* @date 2021/4/21 14:05 |
|||
*/ |
|||
List<GroupPointRankingResultDTO> groupPointRanking(GroupPointFormDTO formDTO); |
|||
} |
@ -0,0 +1,143 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.dto.BizPointUserTotalDetailDTO; |
|||
import com.epmet.dto.form.GroupPointFormDTO; |
|||
import com.epmet.dto.result.PointRankingResultDTO; |
|||
import com.epmet.entity.BizPointUserTotalDetailEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 按业务类型积分总计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-04-20 |
|||
*/ |
|||
public interface BizPointUserTotalDetailService extends BaseService<BizPointUserTotalDetailEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<BizPointUserTotalDetailDTO> |
|||
* @author generator |
|||
* @date 2021-04-20 |
|||
*/ |
|||
PageData<BizPointUserTotalDetailDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<BizPointUserTotalDetailDTO> |
|||
* @author generator |
|||
* @date 2021-04-20 |
|||
*/ |
|||
List<BizPointUserTotalDetailDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return BizPointUserTotalDetailDTO |
|||
* @author generator |
|||
* @date 2021-04-20 |
|||
*/ |
|||
BizPointUserTotalDetailDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-04-20 |
|||
*/ |
|||
void save(BizPointUserTotalDetailDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-04-20 |
|||
*/ |
|||
void update(BizPointUserTotalDetailDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-04-20 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
|
|||
/** |
|||
* 根据业务类型查找用户数据 |
|||
* |
|||
* @param type |
|||
* @param objectId |
|||
* @param userId |
|||
* @return com.epmet.dto.BizPointTotalDetailDTO |
|||
* @author zhaoqifeng |
|||
* @date 2021/4/20 16:53 |
|||
*/ |
|||
BizPointUserTotalDetailDTO getDataByObject(String type, String objectId, String userId); |
|||
|
|||
/** |
|||
* 根据业务类型查找积分总和 |
|||
* |
|||
* @param type |
|||
* @param objectId |
|||
* @return java.lang.Integer |
|||
* @author zhaoqifeng |
|||
* @date 2021/4/20 17:21 |
|||
*/ |
|||
Integer getTotalByObject(String type, String objectId); |
|||
|
|||
/** |
|||
* 小组积分贡献榜 |
|||
* |
|||
* @param tokenDto |
|||
* @param formDTO |
|||
* @return java.util.List<com.epmet.dto.result.PointRankingResultDTO> |
|||
* @author zhaoqifeng |
|||
* @date 2021/4/21 14:06 |
|||
*/ |
|||
List<PointRankingResultDTO> pointRanking(TokenDto tokenDto, GroupPointFormDTO formDTO); |
|||
|
|||
/** |
|||
* 获取今日增量 |
|||
* @author zhaoqifeng |
|||
* @date 2021/4/21 16:41 |
|||
* @param type |
|||
* @param objectId |
|||
* @return java.lang.Integer |
|||
*/ |
|||
Integer getIncrease(String type, String objectId); |
|||
} |
@ -0,0 +1,212 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.constant.FieldConstant; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dao.BizPointTotalDetailDao; |
|||
import com.epmet.dto.BizPointTotalDetailDTO; |
|||
import com.epmet.dto.form.GroupPointFormDTO; |
|||
import com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO; |
|||
import com.epmet.dto.result.GroupPointRankingResultDTO; |
|||
import com.epmet.entity.BizPointTotalDetailEntity; |
|||
import com.epmet.resi.group.dto.group.ResiGroupDTO; |
|||
import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; |
|||
import com.epmet.service.BizPointTotalDetailService; |
|||
import com.epmet.service.BizPointUserTotalDetailService; |
|||
import com.epmet.service.UserPointActionLogService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.text.Collator; |
|||
import java.util.*; |
|||
import java.util.concurrent.atomic.AtomicInteger; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 按业务类型积分总计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-04-20 |
|||
*/ |
|||
@Service |
|||
public class BizPointTotalDetailServiceImpl extends BaseServiceImpl<BizPointTotalDetailDao, BizPointTotalDetailEntity> implements BizPointTotalDetailService { |
|||
|
|||
@Autowired |
|||
private ResiGroupOpenFeignClient resiGroupOpenFeignClient; |
|||
@Autowired |
|||
private BizPointUserTotalDetailService bizPointUserTotalDetailService; |
|||
@Autowired |
|||
private UserPointActionLogService userPointActionLogService; |
|||
|
|||
@Override |
|||
public PageData<BizPointTotalDetailDTO> page(Map<String, Object> params) { |
|||
IPage<BizPointTotalDetailEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, BizPointTotalDetailDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<BizPointTotalDetailDTO> list(Map<String, Object> params) { |
|||
List<BizPointTotalDetailEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, BizPointTotalDetailDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<BizPointTotalDetailEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<BizPointTotalDetailEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public BizPointTotalDetailDTO get(String id) { |
|||
BizPointTotalDetailEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, BizPointTotalDetailDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(BizPointTotalDetailDTO dto) { |
|||
BizPointTotalDetailEntity entity = ConvertUtils.sourceToTarget(dto, BizPointTotalDetailEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(BizPointTotalDetailDTO dto) { |
|||
BizPointTotalDetailEntity entity = ConvertUtils.sourceToTarget(dto, BizPointTotalDetailEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
/** |
|||
* 根据业务类型查找数据 |
|||
* |
|||
* @param type |
|||
* @param objectId |
|||
* @return com.epmet.dto.BizPointTotalDetailDTO |
|||
* @author zhaoqifeng |
|||
* @date 2021/4/20 16:53 |
|||
*/ |
|||
@Override |
|||
public BizPointTotalDetailDTO getDataByObject(String type, String objectId) { |
|||
return baseDao.selectDataByObject(type, objectId); |
|||
} |
|||
|
|||
/** |
|||
* 小组积分详情 |
|||
* |
|||
* @param formDTO |
|||
* @return com.epmet.resi.group.dto.group.result.GroupPointDetailResultDTO |
|||
* @author zhaoqifeng |
|||
* @date 2021/4/21 14:05 |
|||
*/ |
|||
@Override |
|||
public GroupPointDetailResultDTO pointDetail(GroupPointFormDTO formDTO) { |
|||
Result<GroupPointDetailResultDTO> result = resiGroupOpenFeignClient.groupPointDetail(formDTO.getGroupId()); |
|||
if (!result.success() || null == result.getData()) { |
|||
throw new RenException(result.getCode(), result.getMsg()); |
|||
} |
|||
GroupPointDetailResultDTO detail = result.getData(); |
|||
QueryWrapper<BizPointTotalDetailEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq("BIZ_TYPE", "group") |
|||
.eq("OBJECT_ID", formDTO.getGroupId()) |
|||
.eq("DEL_FLAG", NumConstant.ZERO_STR); |
|||
BizPointTotalDetailEntity entity = baseDao.selectOne(wrapper); |
|||
Integer increase = userPointActionLogService.getIncrease("group", formDTO.getGroupId()); |
|||
detail.setIncrease(increase.toString()); |
|||
if (null == entity) { |
|||
detail.setToUpgrade(detail.getNextLevelPoint()); |
|||
detail.setTotal(NumConstant.ZERO_STR); |
|||
detail.setCurrentPoint(NumConstant.ZERO_STR); |
|||
} else { |
|||
int toUpgrade = Integer.parseInt(detail.getNextLevelPoint()) - entity.getTotalPoint(); |
|||
detail.setToUpgrade(Integer.toString(toUpgrade)); |
|||
detail.setTotal(entity.getTotalPoint().toString()); |
|||
detail.setCurrentPoint(entity.getTotalPoint().toString()); |
|||
} |
|||
return detail; |
|||
} |
|||
|
|||
/** |
|||
* 网格小组积分排行 |
|||
* |
|||
* @param formDTO |
|||
* @return java.util.List<com.epmet.dto.result.GroupPointRankingResultDTO> |
|||
* @author zhaoqifeng |
|||
* @date 2021/4/21 14:05 |
|||
*/ |
|||
@Override |
|||
public List<GroupPointRankingResultDTO> groupPointRanking(GroupPointFormDTO formDTO) { |
|||
List<GroupPointRankingResultDTO> list; |
|||
QueryWrapper<BizPointTotalDetailEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq("BIZ_TYPE", "group") |
|||
.eq("GRID_ID", formDTO.getGridId()) |
|||
.eq("DEL_FLAG", NumConstant.ZERO_STR) |
|||
.orderByDesc("TOTAL_POINT"); |
|||
List<BizPointTotalDetailEntity> totalDetailList = baseDao.selectList(wrapper); |
|||
Result<List<ResiGroupDTO>> groupList = resiGroupOpenFeignClient.getGroupListByGrid(formDTO.getGridId()); |
|||
list = groupList.getData().stream().map(item -> { |
|||
GroupPointRankingResultDTO dto = new GroupPointRankingResultDTO(); |
|||
dto.setGroupId(item.getId()); |
|||
dto.setGroupName(item.getGroupName()); |
|||
dto.setPoint(NumConstant.ZERO_STR); |
|||
if (formDTO.getGroupId().equals(item.getId())) { |
|||
dto.setIsMine(NumConstant.ONE_STR); |
|||
} else { |
|||
dto.setIsMine(NumConstant.ZERO_STR); |
|||
} |
|||
return dto; |
|||
}).collect(Collectors.toList()); |
|||
list.forEach(item -> totalDetailList.stream().filter(detail -> item.getGroupId().equals(detail.getObjectId())).forEach(total -> { |
|||
item.setPoint(total.getTotalPoint().toString()); |
|||
|
|||
})); |
|||
list = |
|||
list.stream().sorted(Comparator.comparing(GroupPointRankingResultDTO :: getPoint, Comparator.comparingInt(Integer::parseInt)).reversed() |
|||
.thenComparing(GroupPointRankingResultDTO::getGroupName, Collator.getInstance(Locale.CHINA))) |
|||
.collect(Collectors.toList()); |
|||
AtomicInteger i = new AtomicInteger(1); |
|||
list.forEach(dto -> { |
|||
dto.setRanking(String.valueOf(i.getAndIncrement())); |
|||
}); |
|||
return list; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,251 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.constant.FieldConstant; |
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.constant.StrConstant; |
|||
import com.epmet.commons.tools.enums.BizTypeEnum; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dao.BizPointUserTotalDetailDao; |
|||
import com.epmet.dto.BizPointUserTotalDetailDTO; |
|||
import com.epmet.dto.form.GroupPointFormDTO; |
|||
import com.epmet.dto.result.PointRankingResultDTO; |
|||
import com.epmet.dto.result.UserBaseInfoResultDTO; |
|||
import com.epmet.entity.BizPointUserTotalDetailEntity; |
|||
import com.epmet.feign.EpmetUserOpenFeignClient; |
|||
import com.epmet.resi.group.dto.group.ResiGroupDTO; |
|||
import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; |
|||
import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; |
|||
import com.epmet.service.BizPointUserTotalDetailService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.text.Collator; |
|||
import java.util.*; |
|||
import java.util.concurrent.atomic.AtomicInteger; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 按业务类型积分总计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-04-20 |
|||
*/ |
|||
@Service |
|||
public class BizPointUserTotalDetailServiceImpl extends BaseServiceImpl<BizPointUserTotalDetailDao, BizPointUserTotalDetailEntity> implements BizPointUserTotalDetailService { |
|||
|
|||
@Autowired |
|||
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|||
@Autowired |
|||
private ResiGroupOpenFeignClient resiGroupOpenFeignClient; |
|||
|
|||
@Override |
|||
public PageData<BizPointUserTotalDetailDTO> page(Map<String, Object> params) { |
|||
IPage<BizPointUserTotalDetailEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, BizPointUserTotalDetailDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<BizPointUserTotalDetailDTO> list(Map<String, Object> params) { |
|||
List<BizPointUserTotalDetailEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, BizPointUserTotalDetailDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<BizPointUserTotalDetailEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<BizPointUserTotalDetailEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public BizPointUserTotalDetailDTO get(String id) { |
|||
BizPointUserTotalDetailEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, BizPointUserTotalDetailDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(BizPointUserTotalDetailDTO dto) { |
|||
BizPointUserTotalDetailEntity entity = ConvertUtils.sourceToTarget(dto, BizPointUserTotalDetailEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(BizPointUserTotalDetailDTO dto) { |
|||
BizPointUserTotalDetailEntity entity = ConvertUtils.sourceToTarget(dto, BizPointUserTotalDetailEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
/** |
|||
* 根据业务类型查找用户数据 |
|||
* |
|||
* @param type |
|||
* @param objectId |
|||
* @param userId |
|||
* @return com.epmet.dto.BizPointTotalDetailDTO |
|||
* @author zhaoqifeng |
|||
* @date 2021/4/20 16:53 |
|||
*/ |
|||
@Override |
|||
public BizPointUserTotalDetailDTO getDataByObject(String type, String objectId, String userId) { |
|||
QueryWrapper<BizPointUserTotalDetailEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq("BIZ_TYPE", type) |
|||
.eq("OBJECT_ID", objectId) |
|||
.eq("USER_ID", userId) |
|||
.eq("DEL_FLAG", NumConstant.ZERO_STR); |
|||
BizPointUserTotalDetailEntity entity = baseDao.selectOne(wrapper); |
|||
return ConvertUtils.sourceToTarget(entity, BizPointUserTotalDetailDTO.class); |
|||
} |
|||
|
|||
/** |
|||
* 根据业务类型查找积分总和 |
|||
* |
|||
* @param type |
|||
* @param objectId |
|||
* @return java.lang.Integer |
|||
* @author zhaoqifeng |
|||
* @date 2021/4/20 17:21 |
|||
*/ |
|||
@Override |
|||
public Integer getTotalByObject(String type, String objectId) { |
|||
QueryWrapper<BizPointUserTotalDetailEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.select("IFNULL(SUM(TOTAL_POINT), 0) as TOTAL_POINT") |
|||
.eq("BIZ_TYPE", type) |
|||
.eq("OBJECT_ID", objectId) |
|||
.eq("DEL_FLAG", NumConstant.ZERO_STR); |
|||
BizPointUserTotalDetailEntity entity = baseDao.selectOne(wrapper); |
|||
if (null == entity) { |
|||
return NumConstant.ZERO; |
|||
} |
|||
return entity.getTotalPoint(); |
|||
} |
|||
|
|||
public static void main(String[] args) { |
|||
System.out.println(BizTypeEnum.ACTIVITY.getType()); |
|||
} |
|||
|
|||
/** |
|||
* 小组积分贡献榜 |
|||
* |
|||
* @param tokenDto |
|||
* @param formDTO |
|||
* @return java.util.List<com.epmet.dto.result.PointRankingResultDTO> |
|||
* @author zhaoqifeng |
|||
* @date 2021/4/21 14:06 |
|||
*/ |
|||
@Override |
|||
public List<PointRankingResultDTO> pointRanking(TokenDto tokenDto, GroupPointFormDTO formDTO) { |
|||
List<PointRankingResultDTO> list = new ArrayList<>(); |
|||
QueryWrapper<BizPointUserTotalDetailEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq("BIZ_TYPE", "group") |
|||
.eq("OBJECT_ID", formDTO.getGroupId()) |
|||
.eq("DEL_FLAG", NumConstant.ZERO_STR) |
|||
.orderByDesc("TOTAL_POINT"); |
|||
List<BizPointUserTotalDetailEntity> userTotalList = baseDao.selectList(wrapper); |
|||
AtomicInteger i = new AtomicInteger(1); |
|||
|
|||
//获取小组信息
|
|||
Result<ResiGroupDTO> group = resiGroupOpenFeignClient.getGroupDetail(formDTO.getGroupId()); |
|||
if (!group.success() || null == group.getData()) { |
|||
throw new RenException(group.getCode(), group.getMsg()); |
|||
} |
|||
List<ResiGroupMemberDTO> memberList = group.getData().getMemberList(); |
|||
list = memberList.stream().map(item -> { |
|||
PointRankingResultDTO dto = new PointRankingResultDTO(); |
|||
dto.setUserId(item.getCustomerUserId()); |
|||
dto.setPoint(NumConstant.ZERO_STR); |
|||
if (tokenDto.getUserId().equals(item.getCustomerUserId())) { |
|||
dto.setIsMine(NumConstant.ONE_STR); |
|||
} else { |
|||
dto.setIsMine(NumConstant.ZERO_STR); |
|||
} |
|||
return dto; |
|||
}).collect(Collectors.toList()); |
|||
list.forEach(item -> userTotalList.stream().filter(user -> user.getUserId().equals(item.getUserId())).forEach(total -> { |
|||
item.setPoint(total.getTotalPoint().toString()); |
|||
})); |
|||
//获取用户信息
|
|||
List<String> userIds = memberList.stream().map(ResiGroupMemberDTO :: getCustomerUserId).collect(Collectors.toList()); |
|||
Result<List<UserBaseInfoResultDTO>> userInfoListResult = epmetUserOpenFeignClient.queryUserBaseInfo(userIds); |
|||
if (!userInfoListResult.success() || null == userInfoListResult.getData()) { |
|||
throw new RenException(userInfoListResult.getCode(), userInfoListResult.getMsg()); |
|||
} |
|||
list.forEach(item -> userInfoListResult.getData().stream().filter(baseInfo -> item.getUserId().equals(baseInfo.getUserId())).forEach( |
|||
user -> { |
|||
//楼院小组显示昵称,支部小组显示姓名
|
|||
if (("ordinary").equals(group.getData().getGroupType())) { |
|||
item.setName(user.getNickname()); |
|||
} else { |
|||
item.setName(StrConstant.EPMETY_STR); |
|||
if (StringUtils.isNotBlank(user.getSurname())){ |
|||
item.setName(user.getSurname()); |
|||
} |
|||
if (StringUtils.isNotBlank(user.getName())){ |
|||
item.setName(item.getName().concat(user.getName())); |
|||
} |
|||
} |
|||
item.setHeadPhoto(user.getHeadImgUrl()); |
|||
} |
|||
)); |
|||
list = list.stream().sorted(Comparator.comparing(PointRankingResultDTO :: getPoint, Comparator.comparingInt(Integer::parseInt)).reversed() |
|||
.thenComparing(PointRankingResultDTO::getName, Collator.getInstance(Locale.CHINA))) |
|||
.collect(Collectors.toList()); |
|||
list.forEach(item -> item.setRanking(String.valueOf(i.getAndIncrement()))); |
|||
return list; |
|||
} |
|||
|
|||
/** |
|||
* 获取今日增量 |
|||
* |
|||
* @param type |
|||
* @param objectId |
|||
* @return java.lang.Integer |
|||
* @author zhaoqifeng |
|||
* @date 2021/4/21 16:41 |
|||
*/ |
|||
@Override |
|||
public Integer getIncrease(String type, String objectId) { |
|||
return baseDao.selectIncrease(type, objectId); |
|||
} |
|||
|
|||
} |
@ -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'); |
@ -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`; |
@ -0,0 +1,33 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.dao.BizPointTotalDetailDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.BizPointTotalDetailEntity" id="bizPointTotalDetailMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="agencyId" column="AGENCY_ID"/> |
|||
<result property="gridId" column="GRID_ID"/> |
|||
<result property="bizType" column="BIZ_TYPE"/> |
|||
<result property="objectId" column="OBJECT_ID"/> |
|||
<result property="totalPoint" column="TOTAL_POINT"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
<select id="selectDataByObject" resultType="com.epmet.dto.BizPointTotalDetailDTO"> |
|||
select ID, |
|||
CUSTOMER_ID, |
|||
AGENCY_ID, |
|||
GRID_ID, |
|||
TOTAL_POINT |
|||
from biz_point_total_detail |
|||
where BIZ_TYPE = #{type} |
|||
and OBJECT_ID = #{objectId} |
|||
</select> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,32 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.dao.BizPointUserTotalDetailDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.BizPointUserTotalDetailEntity" id="bizPointUserTotalDetailMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="agencyId" column="AGENCY_ID"/> |
|||
<result property="gridId" column="GRID_ID"/> |
|||
<result property="userId" column="USER_ID"/> |
|||
<result property="bizType" column="BIZ_TYPE"/> |
|||
<result property="objectId" column="OBJECT_ID"/> |
|||
<result property="totalPoint" column="TOTAL_POINT"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
<select id="selectIncrease" resultType="java.lang.Integer"> |
|||
SELECT IFNULL(SUM(TOTAL_POINT), 0) |
|||
FROM biz_point_user_total_detail |
|||
WHERE |
|||
BIZ_TYPE = #{type} |
|||
AND OBJECT_ID = #{objectId} |
|||
AND DATE_FORMAT(CREATED_TIME, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d') |
|||
</select> |
|||
|
|||
|
|||
</mapper> |
@ -1,100 +0,0 @@ |
|||
package com.epmet.mq.listener; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; |
|||
import com.epmet.commons.rocketmq.constants.TopicConstants; |
|||
import com.epmet.commons.rocketmq.messages.InitCustomerMQMsg; |
|||
import com.epmet.commons.tools.distributedlock.DistributedLock; |
|||
import com.epmet.commons.tools.exception.ExceptionUtils; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.constant.UserWorkType; |
|||
import com.epmet.dto.CustomerAgencyDTO; |
|||
import com.epmet.dto.form.AddAgencyAndStaffFormDTO; |
|||
import com.epmet.dto.form.AdminStaffFromDTO; |
|||
import com.epmet.service.AgencyService; |
|||
import org.apache.rocketmq.common.message.MessageExt; |
|||
import org.apache.rocketmq.spring.annotation.MessageModel; |
|||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
|||
import org.apache.rocketmq.spring.core.RocketMQListener; |
|||
import org.redisson.api.RLock; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.concurrent.TimeUnit; |
|||
|
|||
/** |
|||
* 监听初始化客户动作,为客户初始化角色列表 |
|||
*/ |
|||
//@RocketMQMessageListener(topic = TopicConstants.INIT_CUSTOMER,
|
|||
// consumerGroup = ConsomerGroupConstants.INIT_CUSTOMER_ORG_ROLES_GROUP,
|
|||
// messageModel = MessageModel.CLUSTERING,
|
|||
// selectorExpression = "*")
|
|||
//@Component
|
|||
public class InitCustomerOrgListener implements RocketMQListener<MessageExt> { |
|||
|
|||
private Logger logger = LoggerFactory.getLogger(getClass()); |
|||
|
|||
@Autowired |
|||
private AgencyService agencyService; |
|||
|
|||
@Autowired |
|||
private DistributedLock distributedLock; |
|||
|
|||
@Override |
|||
public void onMessage(MessageExt messageExt) { |
|||
String msg = new String(messageExt.getBody()); |
|||
logger.info("初始化客户-初始化组织信息-收到消息内容:{}", msg); |
|||
InitCustomerMQMsg msgObj = JSON.parseObject(msg, InitCustomerMQMsg.class); |
|||
|
|||
RLock lock = null; |
|||
try { |
|||
lock = distributedLock.getLock(String.format("lock:init_customer_org:%s", msgObj.getCustomerId()), |
|||
30l, 30l, TimeUnit.SECONDS); |
|||
agencyService.saveRootAgency(constructRootAndAgencyDTO(msgObj)); |
|||
} catch (RenException e) { |
|||
// 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试
|
|||
logger.error("【RocketMQ】初始化客户组织失败:".concat(ExceptionUtils.getErrorStackTrace(e))); |
|||
} catch (Exception e) { |
|||
// 不是我们自己抛出的异常,可以让MQ重试
|
|||
logger.error("【RocketMQ】初始化客户组织失败:".concat(ExceptionUtils.getErrorStackTrace(e))); |
|||
throw e; |
|||
} finally { |
|||
distributedLock.unLock(lock); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* @Description 构造dto |
|||
* @return |
|||
* @author wxz |
|||
* @date 2021.01.06 15:03 |
|||
*/ |
|||
private AddAgencyAndStaffFormDTO constructRootAndAgencyDTO(InitCustomerMQMsg msgObj) { |
|||
AddAgencyAndStaffFormDTO agencyAndStaff = new AddAgencyAndStaffFormDTO(); |
|||
//客户组织信息
|
|||
CustomerAgencyDTO agencyDTO = new CustomerAgencyDTO(); |
|||
agencyDTO.setId(msgObj.getAgency().getAgencyId()); |
|||
agencyDTO.setCustomerId(msgObj.getCustomerId()); |
|||
agencyDTO.setOrganizationName(msgObj.getAgency().getOrganizationName()); |
|||
agencyDTO.setLevel(msgObj.getAgency().getLevel()); |
|||
agencyDTO.setAreaCode(msgObj.getAgency().getAreaCode()); |
|||
agencyDTO.setProvince(msgObj.getAgency().getProvince()); |
|||
agencyDTO.setCity(msgObj.getAgency().getCity()); |
|||
agencyDTO.setDistrict(msgObj.getAgency().getDistrict()); |
|||
agencyAndStaff.setAgencyDTO(agencyDTO); |
|||
|
|||
//客户管理员信息
|
|||
AdminStaffFromDTO staffSubmitFrom = new AdminStaffFromDTO(); |
|||
staffSubmitFrom.setCustomerId(msgObj.getCustomerId()); |
|||
staffSubmitFrom.setAgencyId(msgObj.getStaff().getAgencyId()); |
|||
staffSubmitFrom.setGender(msgObj.getStaff().getGender()); |
|||
staffSubmitFrom.setMobile(msgObj.getStaff().getMobile()); |
|||
staffSubmitFrom.setName(msgObj.getStaff().getName()); |
|||
staffSubmitFrom.setWorkType(UserWorkType.FULL_TIME); |
|||
agencyAndStaff.setStaffDTO(staffSubmitFrom); |
|||
|
|||
return agencyAndStaff; |
|||
} |
|||
} |
@ -0,0 +1,62 @@ |
|||
package com.epmet.mq; |
|||
|
|||
import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; |
|||
import com.epmet.commons.rocketmq.constants.TopicConstants; |
|||
import com.epmet.mq.listener.InitCustomerComponentsListener; |
|||
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer; |
|||
import org.apache.rocketmq.client.consumer.listener.MessageListener; |
|||
import org.apache.rocketmq.client.exception.MQClientException; |
|||
import org.apache.rocketmq.common.protocol.heartbeat.MessageModel; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import javax.annotation.PostConstruct; |
|||
|
|||
@Component |
|||
public class RocketMQConsumerRegister { |
|||
|
|||
@Value("${rocketmq.name-server}") |
|||
private String nameServer; |
|||
|
|||
/** |
|||
* @return |
|||
* @Description 注册监听器 |
|||
* @author wxz |
|||
* @date 2021.03.03 16:09 |
|||
*/ |
|||
@PostConstruct |
|||
public void registerAllListeners() { |
|||
try { |
|||
register(nameServer, ConsomerGroupConstants.INIT_CUSTOMER_COMPONENTS_GROUP, MessageModel.CLUSTERING, TopicConstants.INIT_CUSTOMER, "*", new InitCustomerComponentsListener()); |
|||
} catch (MQClientException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
|
|||
public void register(String nameServer, String group, MessageModel messageModel, String topic, String subException, MessageListener listener) throws MQClientException { |
|||
// 实例化消费者
|
|||
DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(group); |
|||
|
|||
// 设置NameServer的地址
|
|||
consumer.setNamesrvAddr(nameServer); |
|||
consumer.setMessageModel(messageModel); |
|||
consumer.setInstanceName(buildInstanceName()); |
|||
// 订阅一个或者多个Topic,以及Tag来过滤需要消费的消息
|
|||
consumer.subscribe(topic, subException); |
|||
// 注册回调实现类来处理从broker拉取回来的消息
|
|||
consumer.registerMessageListener(listener); |
|||
// 启动消费者实例
|
|||
consumer.start(); |
|||
} |
|||
|
|||
private String buildInstanceName() { |
|||
String instanceName = ""; |
|||
for (int i = 0; i < 4; i++) { |
|||
int t = (int) (Math.random() * 10); |
|||
instanceName = instanceName.concat(t + ""); |
|||
} |
|||
|
|||
return instanceName; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,111 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.resi.group.dto.group; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 小组成就统计表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-04-19 |
|||
*/ |
|||
@Data |
|||
public class ResiGroupAchievementStatsDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户Id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 小组Id |
|||
*/ |
|||
private String groupId; |
|||
|
|||
/** |
|||
* 里程ID |
|||
*/ |
|||
private String achievementId; |
|||
|
|||
/** |
|||
* 里程名称 |
|||
*/ |
|||
private String achievementName; |
|||
|
|||
/** |
|||
* 实现时间 |
|||
*/ |
|||
private Date arriveTime; |
|||
|
|||
/** |
|||
* 当前值 |
|||
*/ |
|||
private Integer currentValue; |
|||
|
|||
/** |
|||
* 目标值 |
|||
*/ |
|||
private Integer targetValue; |
|||
|
|||
/** |
|||
* 目标是否实现,是:1;否:0 |
|||
*/ |
|||
private Integer isArrive; |
|||
|
|||
/** |
|||
* 删除标记 0:未删除,1:已删除 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.epmet.resi.group.dto.group.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2021/4/19 15:57 |
|||
*/ |
|||
@Data |
|||
public class GroupFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 5330629771935235995L; |
|||
private String groupId; |
|||
private String gridId; |
|||
} |
@ -0,0 +1,41 @@ |
|||
package com.epmet.resi.group.dto.group.result; |
|||
|
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2021/4/19 14:19 |
|||
*/ |
|||
@NoArgsConstructor |
|||
@Data |
|||
public class AchievementDetailResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 2426917315141725167L; |
|||
/** |
|||
* 小组创建时间 |
|||
*/ |
|||
private Long createdDate; |
|||
private List<AchievementBean> achievement; |
|||
|
|||
@NoArgsConstructor |
|||
@Data |
|||
public static class AchievementBean { |
|||
/** |
|||
* 达成时间 |
|||
*/ |
|||
private Long completionDate; |
|||
/** |
|||
* 成就描述(分拼在一起) |
|||
*/ |
|||
private String describe; |
|||
/** |
|||
* 是否达成 0,1 |
|||
*/ |
|||
private Integer isArrive; |
|||
} |
|||
} |
@ -0,0 +1,46 @@ |
|||
package com.epmet.resi.group.dto.group.result; |
|||
|
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2021/4/21 10:37 |
|||
*/ |
|||
@NoArgsConstructor |
|||
@Data |
|||
public class GroupPointDetailResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -1158521486690554498L; |
|||
/** |
|||
* 小组当前等级 |
|||
*/ |
|||
private String level; |
|||
/** |
|||
* 总积分 |
|||
*/ |
|||
private String total; |
|||
/** |
|||
* 今日增长 |
|||
*/ |
|||
private String increase; |
|||
/** |
|||
* 距离升级所需积分 |
|||
*/ |
|||
private String toUpgrade; |
|||
/** |
|||
* 下一等级积分 |
|||
*/ |
|||
private String nextLevelPoint; |
|||
/** |
|||
* 下一等级 |
|||
*/ |
|||
private String nextLevel; |
|||
/** |
|||
* 当前积分 |
|||
*/ |
|||
private String currentPoint; |
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.epmet.resi.group.dto.member.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2021/4/22 9:24 |
|||
*/ |
|||
@Data |
|||
public class AchievementResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 8079550501852632061L; |
|||
private String groupId; |
|||
private String achievementDesc; |
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.epmet.resi.group.dto.member.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2021/4/22 9:42 |
|||
*/ |
|||
@Data |
|||
public class GroupAchievementDTO implements Serializable { |
|||
private static final long serialVersionUID = 2195790168656351743L; |
|||
private String groupId; |
|||
private String groupName; |
|||
private String achievementName; |
|||
} |
@ -0,0 +1,57 @@ |
|||
package com.epmet.modules.group.dao; /** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
|
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.modules.group.entity.ResiGroupAchievementConfigEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 小组成就配置表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-04-19 |
|||
*/ |
|||
@Mapper |
|||
public interface ResiGroupAchievementConfigDao extends BaseDao<ResiGroupAchievementConfigEntity> { |
|||
|
|||
/** |
|||
* desc: 获取成就配置 比targetValue |
|||
* |
|||
* @param achievementType |
|||
* @param offset |
|||
* @param pageSize |
|||
* @return java.util.List<com.epmet.modules.group.entity.ResiGroupAchievementConfigEntity> |
|||
* @author LiuJanJun |
|||
* @date 2021/4/21 10:04 下午 |
|||
*/ |
|||
List<ResiGroupAchievementConfigEntity> selectMoreThanOneByValue(@Param("achievementType") String achievementType, @Param("offset") int offset, @Param("pageSize") int pageSize); |
|||
|
|||
/** |
|||
* desc: 获取最后一条配置 |
|||
* |
|||
* @param achievementType |
|||
* @return com.epmet.modules.group.entity.ResiGroupAchievementConfigEntity |
|||
* @author LiuJanJun |
|||
* @date 2021/4/22 1:58 下午 |
|||
*/ |
|||
ResiGroupAchievementConfigEntity getLastOne(@Param("achievementType") String achievementType); |
|||
} |
@ -0,0 +1,68 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.modules.group.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.modules.group.entity.ResiGroupAchievementStatsEntity; |
|||
import com.epmet.resi.group.dto.group.ResiGroupAchievementStatsDTO; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 小组成就统计表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-04-19 |
|||
*/ |
|||
@Mapper |
|||
public interface ResiGroupAchievementStatsDao extends BaseDao<ResiGroupAchievementStatsEntity> { |
|||
/** |
|||
* 获取未完成的成就 |
|||
* |
|||
* @param groupId |
|||
* @return java.util.List<com.epmet.resi.group.dto.group.ResiGroupMilestoneStatsDTO> |
|||
* @author zhaoqifeng |
|||
* @date 2021/4/19 15:52 |
|||
*/ |
|||
List<ResiGroupAchievementStatsDTO> selectUnAchieved(@Param("groupId") String groupId); |
|||
|
|||
/** |
|||
* desc: 获取级别最低的最后一个未实现的成就 |
|||
* |
|||
* @param customerId |
|||
* @param groupId |
|||
* @param achievementType |
|||
* @return com.epmet.modules.group.entity.ResiGroupAchievementStatsEntity |
|||
* @author LiuJanJun |
|||
* @date 2021/4/21 8:34 下午 |
|||
*/ |
|||
ResiGroupAchievementStatsEntity selectLastUnAchieved(@Param("customerId") String customerId, @Param("groupId") String groupId, @Param("achievementType") String achievementType); |
|||
|
|||
/** |
|||
* desc: 插入或更新成就 |
|||
* |
|||
* @param list |
|||
* @param updateAll |
|||
* @return int |
|||
* @author LiuJanJun |
|||
* @date 2021/4/22 3:03 下午 |
|||
*/ |
|||
int saveOrUpdate(@Param("list") List<ResiGroupAchievementStatsEntity> list, @Param("updateAll") boolean updateAll); |
|||
} |
@ -0,0 +1,58 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.modules.group.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* 小组成就配置表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-04-19 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("resi_group_achievement_config") |
|||
public class ResiGroupAchievementConfigEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户Id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 里程名称 |
|||
*/ |
|||
private String achievementName; |
|||
|
|||
/** |
|||
* 目标值 |
|||
*/ |
|||
private Integer targetValue; |
|||
|
|||
/** |
|||
* 里程类型:小组人数:member;topic:话题数;转议题数:toIssue;话题解决数:resloveTopic |
|||
*/ |
|||
private String achievementType; |
|||
|
|||
} |
@ -0,0 +1,86 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.modules.group.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 小组成就统计表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-04-19 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("resi_group_achievement_stats") |
|||
public class ResiGroupAchievementStatsEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户Id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 小组Id |
|||
*/ |
|||
private String groupId; |
|||
|
|||
/** |
|||
* 成就ID |
|||
*/ |
|||
private String achievementId; |
|||
|
|||
/** |
|||
* 成就名称 |
|||
*/ |
|||
private String achievementName; |
|||
|
|||
/** |
|||
* 成就类型 |
|||
*/ |
|||
private String achievementType; |
|||
|
|||
/** |
|||
* 实现时间 |
|||
*/ |
|||
private Date arriveTime; |
|||
|
|||
/** |
|||
* 当前值 |
|||
*/ |
|||
private Integer currentValue; |
|||
|
|||
/** |
|||
* 目标值 |
|||
*/ |
|||
private Integer targetValue; |
|||
|
|||
/** |
|||
* 目标是否实现,是:1;否:0 |
|||
*/ |
|||
private Integer isArrive; |
|||
|
|||
} |
@ -0,0 +1,138 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.modules.group.service; |
|||
|
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.constant.StrConstant; |
|||
import com.epmet.commons.tools.enums.AchievementTypeEnum; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.utils.UniqueIdGenerator; |
|||
import com.epmet.modules.group.entity.ResiGroupAchievementConfigEntity; |
|||
import com.epmet.modules.group.entity.ResiGroupAchievementStatsEntity; |
|||
import com.epmet.modules.support.GroupAchievementUtils; |
|||
import com.epmet.resi.group.dto.group.ResiGroupAchievementStatsDTO; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* desc:实时计算小组成就完成情况 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-04-19 |
|||
*/ |
|||
public abstract class AbstractStatsAchievementService { |
|||
|
|||
@Autowired |
|||
private ResiGroupAchievementConfigService achievementConfigService; |
|||
@Autowired |
|||
private ResiGroupAchievementStatsService achievementStatsService; |
|||
|
|||
|
|||
/** |
|||
* desc: 根据成绩类型 分页获取成就配置 按targetValue 升序 |
|||
* |
|||
* @param pageNum |
|||
* @param pageSize |
|||
* @return java.util.List<com.epmet.modules.group.entity.ResiGroupAchievementConfigEntity> |
|||
* @author LiuJanJun |
|||
* @date 2021/4/22 1:36 下午 |
|||
*/ |
|||
protected List<ResiGroupAchievementConfigEntity> getAchievementConfigPage(int pageNum, int pageSize, String achievementType) { |
|||
return achievementConfigService.selectMoreThanOneByValue(achievementType, (pageNum - NumConstant.ONE) * pageSize, pageSize); |
|||
} |
|||
|
|||
/** |
|||
* desc:初始化配置5条 |
|||
* |
|||
* @param achievementType |
|||
* @return |
|||
*/ |
|||
protected List<ResiGroupAchievementConfigEntity> initAchievementConfig(String achievementType) { |
|||
AchievementTypeEnum anEnum = AchievementTypeEnum.getEnum(achievementType); |
|||
if (anEnum == null) { |
|||
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode()); |
|||
} |
|||
if (AchievementTypeEnum.MEMBER.getCode().equals(anEnum.getCode())) { |
|||
throw new RenException("小组人数都到10000啦?"); |
|||
} |
|||
ResiGroupAchievementConfigEntity lastOne = achievementConfigService.getLastOne(achievementType); |
|||
if (lastOne == null){ |
|||
throw new RenException("小组成就配置有误,type:{}",achievementType); |
|||
} |
|||
List<ResiGroupAchievementConfigEntity> newConfigList = new ArrayList<>(); |
|||
Integer nextTargetValue = null; |
|||
int preValue = lastOne.getTargetValue(); |
|||
String oldName = lastOne.getAchievementName().replace(String.valueOf(lastOne.getTargetValue()), StrConstant.UNDER_LINE); |
|||
for (int i = 0; i < 5; i++) { |
|||
nextTargetValue = GroupAchievementUtils.getNextTargetValue(achievementType, preValue); |
|||
ResiGroupAchievementConfigEntity next = new ResiGroupAchievementConfigEntity(); |
|||
//生成ID 自增
|
|||
next.setId(UniqueIdGenerator.generate24()); |
|||
next.setCustomerId(lastOne.getCustomerId()); |
|||
next.setAchievementName(oldName.replace(StrConstant.UNDER_LINE, String.valueOf(nextTargetValue))); |
|||
preValue = nextTargetValue; |
|||
next.setTargetValue(nextTargetValue); |
|||
next.setAchievementType(lastOne.getAchievementType()); |
|||
newConfigList.add(next); |
|||
} |
|||
achievementConfigService.insertBatch(newConfigList); |
|||
return newConfigList; |
|||
} |
|||
|
|||
/** |
|||
* desc: 插入或新增成就统计 |
|||
* |
|||
* @param haveArrive |
|||
* @param updateAll |
|||
* @return void |
|||
* @author LiuJanJun |
|||
* @date 2021/4/25 12:26 下午 |
|||
*/ |
|||
protected Integer saveOrUpdate(List<ResiGroupAchievementStatsEntity> haveArrive, boolean updateAll){ |
|||
return achievementStatsService.saveOrUpdate(haveArrive,updateAll); |
|||
} |
|||
|
|||
/** |
|||
* desc: 获取小组最后一个未实现的成就 |
|||
* |
|||
* @param customerId |
|||
* @param groupId |
|||
* @param achievementType |
|||
* @return com.epmet.modules.group.entity.ResiGroupAchievementStatsEntity |
|||
* @author LiuJanJun |
|||
* @date 2021/4/25 12:28 下午 |
|||
*/ |
|||
protected ResiGroupAchievementStatsEntity selectLastUnAchieved(String customerId, String groupId, String achievementType){ |
|||
return achievementStatsService.selectLastUnAchieved(customerId, groupId, achievementType); |
|||
} |
|||
|
|||
/** |
|||
* desc: 更新小组成就 |
|||
* |
|||
* @param recordDTO |
|||
* @return java.lang.Integer |
|||
* @author LiuJanJun |
|||
* @date 2021/4/25 12:30 下午 |
|||
*/ |
|||
protected void update(ResiGroupAchievementStatsDTO recordDTO){ |
|||
achievementStatsService.update(recordDTO); |
|||
} |
|||
} |
@ -0,0 +1,36 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.modules.group.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.modules.group.entity.ResiGroupAchievementConfigEntity; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 小组成就配置表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-04-19 |
|||
*/ |
|||
public interface ResiGroupAchievementConfigService extends BaseService<ResiGroupAchievementConfigEntity> { |
|||
|
|||
ResiGroupAchievementConfigEntity getLastOne(String achievementType); |
|||
|
|||
List<ResiGroupAchievementConfigEntity> selectMoreThanOneByValue(String achievementType,int offset,int pageSize); |
|||
} |
@ -0,0 +1,84 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.modules.group.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.modules.group.entity.ResiGroupAchievementStatsEntity; |
|||
import com.epmet.resi.group.dto.group.ResiGroupAchievementStatsDTO; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 小组成就统计表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-04-19 |
|||
*/ |
|||
public interface ResiGroupAchievementStatsService extends BaseService<ResiGroupAchievementStatsEntity> { |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-04-19 |
|||
*/ |
|||
void update(ResiGroupAchievementStatsDTO dto); |
|||
|
|||
/** |
|||
* 已达成的成就 |
|||
* @author zhaoqifeng |
|||
* @date 2021/4/19 15:15 |
|||
* @param groupId |
|||
* @return java.util.List<com.epmet.resi.group.dto.group.ResiGroupMilestoneStatsDTO> |
|||
*/ |
|||
List<ResiGroupAchievementStatsDTO> getAchieved(String groupId); |
|||
|
|||
/** |
|||
* 未达成的成就 |
|||
* @author zhaoqifeng |
|||
* @date 2021/4/19 15:15 |
|||
* @param groupId |
|||
* @return java.util.List<com.epmet.resi.group.dto.group.ResiGroupMilestoneStatsDTO> |
|||
*/ |
|||
List<ResiGroupAchievementStatsDTO> getUnAchieved(String groupId); |
|||
|
|||
/** |
|||
* desc: 获取最后未实现的成就 实际每种类型 数据库只存在一条未实现的成就 |
|||
* |
|||
* @param customerId |
|||
* @param groupId |
|||
* @param achievementType |
|||
* @return com.epmet.modules.group.entity.ResiGroupAchievementStatsEntity |
|||
* @author LiuJanJun |
|||
* @date 2021/4/22 2:35 下午 |
|||
*/ |
|||
ResiGroupAchievementStatsEntity selectLastUnAchieved(String customerId, String groupId, String achievementType); |
|||
|
|||
/** |
|||
* desc: 插入或更新成就 |
|||
* |
|||
* @param haveArrive |
|||
* @param updateAll |
|||
* @return int |
|||
* @author LiuJanJun |
|||
* @date 2021/4/22 3:03 下午 |
|||
*/ |
|||
int saveOrUpdate(List<ResiGroupAchievementStatsEntity> haveArrive, boolean updateAll); |
|||
} |
@ -0,0 +1,51 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.modules.group.service; |
|||
|
|||
/** |
|||
* desc:实时计算小组成就完成情况 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-04-19 |
|||
*/ |
|||
public interface StatsAchievementService{ |
|||
|
|||
/** |
|||
* desc: 初始化所有小组的各种成就入口 |
|||
* |
|||
* @param customerId |
|||
* @return java.lang.Boolean |
|||
* @author LiuJanJun |
|||
* @date 2021/4/20 |
|||
*/ |
|||
Boolean initAllGroupAchievement(String customerId); |
|||
|
|||
/** |
|||
* desc: 根据小组Id计算小组成就 入口 |
|||
* |
|||
* @param customerId |
|||
* @param groupId |
|||
* @param achievementType 成就类型 小组人数、话题数、转议题数、小组内问题解决数 |
|||
* @return java.lang.Boolean |
|||
* @author LiuJanJun |
|||
* @date 2021/4/20 |
|||
*/ |
|||
Boolean calculateAcm(String customerId, String groupId, String achievementType); |
|||
|
|||
|
|||
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue