From 4d72326f20f97f76d2b087e69c2dc23439514a68 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Sun, 25 Apr 2021 16:31:54 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=A7=AF=E5=88=86?= =?UTF-8?q?=E8=A1=8C=E4=B8=BA=E8=AE=B0=E5=BD=95=E6=95=B0=E6=8D=AE=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=EF=BC=8C=E6=B7=BB=E5=8A=A0sourceType=EF=BC=8C?= =?UTF-8?q?=E5=A1=AB=E5=85=85sourceId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/tools/enums/BizTypeEnum.java | 27 ++++++++ .../commons/tools/enums/SourceTypeEnum.java | 30 +++++++++ .../com/epmet/dto/UserPointActionLogDTO.java | 10 +++ .../entity/UserPointActionLogEntity.java | 10 +++ .../BizPointUserTotalDetailServiceImpl.java | 6 ++ .../impl/UserPointActionLogServiceImpl.java | 61 ++++++++++++++++--- 6 files changed, 137 insertions(+), 7 deletions(-) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/BizTypeEnum.java create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/SourceTypeEnum.java 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..21b1806ab0 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/BizTypeEnum.java @@ -0,0 +1,27 @@ +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", "活动"); + + /** + * 类型 + */ + private String type; + /** + * 描述 + */ + private String typeDesc; + +} 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..7e51ad56dd --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/SourceTypeEnum.java @@ -0,0 +1,30 @@ +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", "邀请进组"), + VOLUNTEER("volunteer", "志愿者"); + + /** + * 类型 + */ + private String type; + /** + * 描述 + */ + private String typeDesc; +} 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 0141538298..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,16 @@ public class UserPointActionLogDTO implements Serializable { */ private String actionFlag; + /** + * 业务类型:小组:group + */ + private String bizType; + + /** + * 业务类型的对象id + */ + private String objectId; + private String sourceType; /** 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 2a1a33d61e..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,16 @@ public class UserPointActionLogEntity extends BaseEpmetEntity { */ private String eventId; + /** + * 业务类型:小组:group + */ + private String bizType; + + /** + * 业务类型的对象id + */ + private String objectId; + private String sourceType; /** 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 index 1904a5bf29..4cb139d7d2 100644 --- 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 @@ -21,6 +21,8 @@ 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.enums.BizTypeEnum; +import com.epmet.commons.tools.enums.EventEnum; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; @@ -158,6 +160,10 @@ public class BizPointUserTotalDetailServiceImpl 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 From aba5083abaf64417779a01e4b6ee6852bf700117 Mon Sep 17 00:00:00 2001 From: jianjun Date: Sun, 25 Apr 2021 16:38:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=A7=AF=E5=88=86=E8=A7=84=E5=88=99?= =?UTF-8?q?=E6=A6=82=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/result/GroupPointRuleResultDTO.java | 9 +++++++++ .../java/com/epmet/controller/GroupPointController.java | 3 +++ .../src/main/java/com/epmet/utils/ModuleConstant.java | 3 +++ 3 files changed, 15 insertions(+) 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 index 6a14bebb4a..05717983ee 100644 --- 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 @@ -14,4 +14,13 @@ import java.util.List; 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-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 index f016acbe7b..4984d2ce0b 100644 --- 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 @@ -11,6 +11,7 @@ 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; @@ -88,6 +89,8 @@ public class GroupPointController { @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/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 = "组内贡献是指组内成员在本组进行活动时所获取的积分贡献值。"; }