Browse Source

Merge remote-tracking branch 'remotes/origin/dev_group_point' into dev_temp

master
jianjun 4 years ago
parent
commit
cc49322198
  1. 27
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/BizTypeEnum.java
  2. 30
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/SourceTypeEnum.java
  3. 10
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/UserPointActionLogDTO.java
  4. 9
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/GroupPointRuleResultDTO.java
  5. 3
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/GroupPointController.java
  6. 10
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/UserPointActionLogEntity.java
  7. 6
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/BizPointUserTotalDetailServiceImpl.java
  8. 61
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java
  9. 3
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/ModuleConstant.java

27
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;
}

30
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;
}

10
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;
/**

9
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<String> rules;
/**
* 个人贡献概述
*/
private String contriSummary;
/**
* 小组积分概述
*/
private String groupSummary;
}

3
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<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);
}
}

10
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;
/**

6
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<BizPoint
return entity.getTotalPoint();
}
public static void main(String[] args) {
System.out.println(BizTypeEnum.ACTIVITY.getType());
}
/**
* 小组积分贡献榜
*

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

@ -37,10 +37,7 @@ import com.epmet.dto.UserPointActionLogDTO;
import com.epmet.dto.form.CommonPageUserFormDTO;
import com.epmet.dto.result.ResiPointLogListResultDTO;
import com.epmet.dto.result.ResiPointLogPeriodResultDTO;
import com.epmet.entity.PointRuleEntity;
import com.epmet.entity.UserPointActionLogEntity;
import com.epmet.entity.UserPointStatisticalDailyEntity;
import com.epmet.entity.UserPointTotalEntity;
import com.epmet.entity.*;
import com.epmet.service.*;
import com.epmet.utils.DimIdGenerator;
import com.epmet.utils.ModuleConstant;
@ -326,6 +323,13 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
action.setSourceType(event.getSourceType());
action.setSourceId(event.getSourceId());
action.setOperatorAgencyId(event.getOpAgencyId());
if (("resi_group").equals(event.getEventClass())) {
action.setBizType("group");
action.setObjectId(event.getGroupId());
} else {
action.setBizType("activity");
action.setObjectId(event.getSourceId());
}
baseDao.insert(action);
//2.新增/修改用户积分日统计
DimIdGenerator.DimIdBean dimVal = DimIdGenerator.getDimIdBean(new Date());
@ -355,6 +359,7 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
//个人小组积分
BizPointUserTotalDetailDTO userTotalDetailDTO = bizPointUserTotalDetailService.getDataByObject("group", event.getGroupId(),
event.getUserId());
Integer userTotal = getUserTotalByObject("group", event.getGroupId(), event.getUserId());
if (null == userTotalDetailDTO) {
userTotalDetailDTO = new BizPointUserTotalDetailDTO();
userTotalDetailDTO.setCustomerId(event.getCustomerId());
@ -363,17 +368,17 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
userTotalDetailDTO.setUserId(event.getUserId());
userTotalDetailDTO.setBizType("group");
userTotalDetailDTO.setObjectId(event.getGroupId());
userTotalDetailDTO.setTotalPoint(ruleInfo.getPoint());
userTotalDetailDTO.setTotalPoint(userTotal);
bizPointUserTotalDetailService.save(userTotalDetailDTO);
} else {
userTotalDetailDTO.setTotalPoint(userTotalDetailDTO.getTotalPoint() + ruleInfo.getPoint());
userTotalDetailDTO.setTotalPoint(userTotal);
userTotalDetailDTO.setUpdatedTime(new Date());
bizPointUserTotalDetailService.update(userTotalDetailDTO);
}
//小组总积分
BizPointTotalDetailDTO totalDetailDTO = bizPointTotalDetailService.getDataByObject("group", event.getGroupId());
Integer total = bizPointUserTotalDetailService.getTotalByObject("group", event.getGroupId());
Integer total = getTotalByObject("group", event.getGroupId());
if (null == totalDetailDTO) {
totalDetailDTO = new BizPointTotalDetailDTO();
totalDetailDTO.setCustomerId(event.getCustomerId());
@ -451,4 +456,46 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
point.setUpdatedBy(grantPoint.getOperatorId());
userPointTotalService.insertOrUpdate(point);
}
private Integer getTotalByObject(String type, String objectId) {
QueryWrapper<UserPointActionLogEntity> wrapper = new QueryWrapper<>();
wrapper.select("IFNULL(SUM(POINT), 0) as POINT")
.eq("BIZ_TYPE", type)
.eq("OBJECT_ID", objectId)
.eq("ACTION_FLAG", "plus")
.eq("DEL_FLAG", NumConstant.ZERO_STR);
UserPointActionLogEntity entity1 = baseDao.selectOne(wrapper);
int plusTotal = null == entity1? NumConstant.ZERO : entity1.getPoint();
wrapper = new QueryWrapper<>();
wrapper.select("IFNULL(SUM(POINT), 0) as POINT")
.eq("BIZ_TYPE", type)
.eq("OBJECT_ID", objectId)
.eq("ACTION_FLAG", "minus")
.eq("DEL_FLAG", NumConstant.ZERO_STR);
UserPointActionLogEntity entity2 = baseDao.selectOne(wrapper);
int minusTotal = null == entity2? NumConstant.ZERO : entity2.getPoint();
return plusTotal - minusTotal;
}
private Integer getUserTotalByObject(String type, String objectId, String userId) {
QueryWrapper<UserPointActionLogEntity> wrapper = new QueryWrapper<>();
wrapper.select("IFNULL(SUM(POINT), 0) as POINT")
.eq("BIZ_TYPE", type)
.eq("OBJECT_ID", objectId)
.eq("USER_ID", userId)
.eq("ACTION_FLAG", "plus")
.eq("DEL_FLAG", NumConstant.ZERO_STR);
UserPointActionLogEntity entity1 = baseDao.selectOne(wrapper);
int plusTotal = null == entity1? NumConstant.ZERO : entity1.getPoint();
wrapper = new QueryWrapper<>();
wrapper.select("IFNULL(SUM(POINT), 0) as POINT")
.eq("BIZ_TYPE", type)
.eq("OBJECT_ID", objectId)
.eq("USER_ID", userId)
.eq("ACTION_FLAG", "minus")
.eq("DEL_FLAG", NumConstant.ZERO_STR);
UserPointActionLogEntity entity2 = baseDao.selectOne(wrapper);
int minusTotal = null == entity2? NumConstant.ZERO : entity2.getPoint();
return plusTotal - minusTotal;
}
}

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

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

Loading…
Cancel
Save