|
|
@ -578,4 +578,69 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi |
|
|
|
formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.selectPageResiPoin(formDTO)); |
|
|
|
return new PageData<>(pageInfo.getList(), pageInfo.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 需求完成,给志愿者发放积分 |
|
|
|
* @param list |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void grantServerPoint(List<BasePointEventMsg> list){ |
|
|
|
if (CollectionUtils.isEmpty(list)){ |
|
|
|
return; |
|
|
|
} |
|
|
|
list.forEach(grantPoint->{ |
|
|
|
if(StringUtils.equals(ModuleConstant.OPERATION_TYPE_MINUS,grantPoint.getActionFlag())){ |
|
|
|
//减
|
|
|
|
if(grantPoint.getPoint() > NumConstant.ZERO){ |
|
|
|
//保证负数
|
|
|
|
grantPoint.setPoint(grantPoint.getPoint() * NumConstant.ONE_NEG); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
//加
|
|
|
|
if(grantPoint.getPoint() < NumConstant.ZERO){ |
|
|
|
//保证正数
|
|
|
|
grantPoint.setPoint(grantPoint.getPoint() * NumConstant.ONE_NEG); |
|
|
|
} |
|
|
|
} |
|
|
|
//1.新增用户积分行为记录
|
|
|
|
UserPointActionLogEntity action = new UserPointActionLogEntity(); |
|
|
|
action.setCustomerId(grantPoint.getCustomerId()); |
|
|
|
action.setPoint(grantPoint.getPoint()); |
|
|
|
//完成了XXX的需求
|
|
|
|
action.setEventStatement(grantPoint.getRemark()); |
|
|
|
//需求分类表中一级分类的名称
|
|
|
|
action.setEventId(EventEnum.FINISH_USER_DEMAND.getEventTag()); |
|
|
|
action.setActionFlag(grantPoint.getActionFlag()); |
|
|
|
action.setUserId(grantPoint.getUserId()); |
|
|
|
action.setCreatedBy(grantPoint.getOperatorId()); |
|
|
|
action.setUpdatedBy(grantPoint.getOperatorId()); |
|
|
|
action.setSourceType(grantPoint.getSourceType()); |
|
|
|
action.setSourceId(grantPoint.getSourceId()); |
|
|
|
// 需求所属分类编码,对应objectId
|
|
|
|
action.setObjectId(grantPoint.getObjectId()); |
|
|
|
//需求所属分类-一级分类名称
|
|
|
|
action.setEventName(grantPoint.getEventName()); |
|
|
|
baseDao.insert(action); |
|
|
|
//2.新增/修改用户积分日统计
|
|
|
|
DimIdGenerator.DimIdBean dimVal = DimIdGenerator.getDimIdBean(new Date()); |
|
|
|
UserPointStatisticalDailyEntity statistical = ConvertUtils.sourceToTarget(dimVal,UserPointStatisticalDailyEntity.class); |
|
|
|
statistical.setPointChange(grantPoint.getPoint()); |
|
|
|
statistical.setActionFlag(grantPoint.getActionFlag()); |
|
|
|
statistical.setCustomerId(grantPoint.getCustomerId()); |
|
|
|
statistical.setUserId(grantPoint.getUserId()); |
|
|
|
statistical.setCreatedBy(grantPoint.getOperatorId()); |
|
|
|
statistical.setUpdatedBy(grantPoint.getOperatorId()); |
|
|
|
userPointStatisticalDailyService.insertOrUpdate(statistical); |
|
|
|
//3.新增/修改用户积分日统计
|
|
|
|
UserPointTotalEntity point = new UserPointTotalEntity(); |
|
|
|
point.setCustomerId(grantPoint.getCustomerId()); |
|
|
|
point.setUserId(grantPoint.getUserId()); |
|
|
|
point.setTotalPoint(grantPoint.getPoint()); |
|
|
|
point.setUsablePoint(grantPoint.getPoint()); |
|
|
|
point.setUsedPoint(NumConstant.ZERO); |
|
|
|
point.setCreatedBy(grantPoint.getOperatorId()); |
|
|
|
point.setUpdatedBy(grantPoint.getOperatorId()); |
|
|
|
userPointTotalService.insertOrUpdate(point); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |