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