Browse Source

用户发放积分

master
wangchao 5 years ago
parent
commit
011fdf2c19
  1. 1
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/AdjustmentController.java
  2. 2
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdjustmentLogServiceImpl.java
  3. 13
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointVerificationLogServiceImpl.java
  4. 2
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointTotalServiceImpl.java
  5. 2
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAdjustmentLogDao.xml
  6. 2
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml

1
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/AdjustmentController.java

@ -83,6 +83,7 @@ public class AdjustmentController {
@PostMapping("adjust")
public Result adjustPoint(@LoginUser TokenDto token, @RequestBody PointAdjustmentFormDTO param){
param.setOperatorId(token.getUserId());
param.setCustomerId(token.getCustomerId());
ValidatorUtils.validateEntity(param, PointAdjustmentFormDTO.PointAdjustmentGroup.class);
pointAdjustmentLogService.adjustPoint(param);
return new Result();

2
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdjustmentLogServiceImpl.java

@ -178,7 +178,7 @@ public class PointAdjustmentLogServiceImpl extends BaseServiceImpl<PointAdjustme
if(null == param.getPoint()) throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
Date currentTime = new Date();
Integer point = param.getPoint();
if(StringUtils.equals(ModuleConstant.OPERATION_TYPE_MINUS,param.getAdjustmentType())){
if(StringUtils.equals(ModuleConstant.OPERATION_TYPE_MINUS,param.getAdjustmentType()) || param.getAdjustmentType().toLowerCase().contains("m")){
if(point > NumConstant.ZERO){
point *= NumConstant.ONE_NEG;
}

13
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointVerificationLogServiceImpl.java

@ -236,7 +236,8 @@ public class PointVerificationLogServiceImpl extends BaseServiceImpl<PointVerifi
@Override
@Transactional(rollbackFor = Exception.class)
public PointVerificationResultDTO verifyPoint(PointVerificationFormDTO verificationParam) {
Date currentTime = new Date();
DimIdGenerator.DimIdBean dim = DimIdGenerator.getDimIdBean(new Date());
PointVerificationResultDTO result = new PointVerificationResultDTO();
ResiCommonUserIdFormDTO userId = new ResiCommonUserIdFormDTO();
userId.setUserId(verificationParam.getUserId());
@ -260,7 +261,7 @@ public class PointVerificationLogServiceImpl extends BaseServiceImpl<PointVerifi
String agencyId = ModuleConstant.EMPTY_STR;
String operatorName = ModuleConstant.EMPTY_STR;
PointVerificationStatisticalDailyEntity statistical = new PointVerificationStatisticalDailyEntity();
PointVerificationStatisticalDailyEntity statistical = new PointVerificationStatisticalDailyEntity();
if(staffResult.success() && null != staffResult.getData()){
statistical = ConvertUtils.sourceToTarget(staffResult.getData(),PointVerificationStatisticalDailyEntity.class);
customerId = staffResult.getData().getCustomerId();
@ -270,6 +271,7 @@ public class PointVerificationLogServiceImpl extends BaseServiceImpl<PointVerifi
//1.记录积分行为日志 - 居民端
UserPointActionLogEntity action = new UserPointActionLogEntity();
action.setCustomerId(customerId);
action.setCreatedBy(verificationParam.getOperatorId());
action.setUserId(verificationParam.getUserId());
action.setActionFlag(ModuleConstant.OPERATION_TYPE_MINUS);
@ -291,7 +293,7 @@ public class PointVerificationLogServiceImpl extends BaseServiceImpl<PointVerifi
verificationLog.setAddress(verificationParam.getAddress());
pointVerificationLogDao.insert(verificationLog);
//3.记录积分日统计表
DimIdGenerator.DimIdBean dim = DimIdGenerator.getDimIdBean(currentTime);
UserPointStatisticalDailyEntity userStatistical = ConvertUtils.sourceToTarget(dim,UserPointStatisticalDailyEntity.class);
userStatistical.setUserId(verificationParam.getUserId());
userStatistical.setActionFlag(ModuleConstant.OPERATION_TYPE_EXCHANGE);
@ -300,6 +302,11 @@ public class PointVerificationLogServiceImpl extends BaseServiceImpl<PointVerifi
userPointStatisticalDailyService.insertOrUpdate(userStatistical);
//4.记录积分核销日统计 - 政府端
statistical.setVerificatedPoint(point * NumConstant.ONE_NEG);
statistical.setDateId(dim.getDateId());
statistical.setWeekId(dim.getWeekId());
statistical.setMonthId(dim.getMonthId());
statistical.setQuarterId(dim.getQuarterId());
statistical.setYearId(dim.getYearId());
pointVerificationStatisticalDailyService.insertOrUpdate(statistical);
//5.更新用户总积分表
UserPointTotalEntity userPoint = new UserPointTotalEntity();

2
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointTotalServiceImpl.java

@ -223,7 +223,7 @@ public class UserPointTotalServiceImpl extends BaseServiceImpl<UserPointTotalDao
@Override
public void insertOrUpdate(UserPointTotalEntity entity) {
UserPointTotalEntity existed = baseDao.selectIfExisted(entity.getUserId());
if(null != existed && StringUtils.isBlank(existed.getId())){
if(null != existed && StringUtils.isNotBlank(existed.getId())){
existed.setUsedPoint(null == existed.getUsedPoint() ? entity.getUsedPoint() : entity.getUsedPoint() + existed.getUsedPoint());
existed.setUsablePoint(null == existed.getUsablePoint() ? entity.getUsablePoint() : entity.getUsablePoint() + existed.getUsablePoint());
existed.setTotalPoint(null == existed.getTotalPoint() ? entity.getTotalPoint() : entity.getTotalPoint() + existed.getTotalPoint());

2
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAdjustmentLogDao.xml

@ -27,7 +27,7 @@
adjust_reason AS reason,
DATE_FORMAT( created_time, '%Y-%m-%d %H:%i:%s' ) AS date,
CASE
action_flag
ADJUSTMENT_TYPE
WHEN 'plus' THEN
CONCAT( '+', POINT ) ELSE CONCAT( '-', POINT )
END AS POINT

2
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml

@ -48,7 +48,7 @@
<select id="selectIfExisted" resultType="com.epmet.entity.UserPointTotalEntity">
SELECT
ID,
USERD_POINT,
USED_POINT,
USABLE_POINT,
TOTAL_POINT
FROM

Loading…
Cancel
Save