|
@ -196,11 +196,27 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi |
|
|
|
|
|
|
|
|
PointRuleEntity ruleInfo = pointRuleService.getByEventCodeAndCustomerId(event.getCustomerId(),eventCode); |
|
|
PointRuleEntity ruleInfo = pointRuleService.getByEventCodeAndCustomerId(event.getCustomerId(),eventCode); |
|
|
if(null != ruleInfo && StringUtils.equals(NumConstant.ONE_STR,ruleInfo.getEnabledFlag())){ |
|
|
if(null != ruleInfo && StringUtils.equals(NumConstant.ONE_STR,ruleInfo.getEnabledFlag())){ |
|
|
|
|
|
Date dateCheck = null; |
|
|
//判断积分规则的积分单位 次、天、分钟、小时
|
|
|
//判断积分规则的积分单位 次、天、分钟、小时
|
|
|
|
|
|
if(StringUtils.equals(ModuleConstant.POINT_UNIT_TIME,ruleInfo.getPointUnit())){ |
|
|
|
|
|
//次
|
|
|
|
|
|
}else if(StringUtils.equals(ModuleConstant.POINT_UNIT_DAY,ruleInfo.getPointUnit())){ |
|
|
|
|
|
//天
|
|
|
|
|
|
//在selectSumByEvent时要校验时间区间
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
|
calendar.setTime(new Date()); |
|
|
|
|
|
calendar.set(Calendar.HOUR_OF_DAY, NumConstant.ZERO); |
|
|
|
|
|
calendar.set(Calendar.MINUTE, NumConstant.ZERO); |
|
|
|
|
|
calendar.set(Calendar.SECOND, NumConstant.ZERO); |
|
|
|
|
|
dateCheck = calendar.getTime(); |
|
|
|
|
|
}else{ |
|
|
|
|
|
//其余积分单位
|
|
|
|
|
|
//TODO..
|
|
|
|
|
|
logger.warn(String.format("当前规则属于按%s计分,系统尚不支持响应此类积分规则的事件"),ruleInfo.getPointUnit()); |
|
|
|
|
|
} |
|
|
//校验是否达到上限
|
|
|
//校验是否达到上限
|
|
|
if(ruleInfo.getUpLimit() > NumConstant.ZERO){ |
|
|
if(ruleInfo.getUpLimit() > NumConstant.ZERO){ |
|
|
Integer sum = baseDao.selectSumByEvent(event.getUserId(),eventCode,event.getSourceId(),event.getCustomerId()); |
|
|
Integer sum = baseDao.selectSumByEvent(event.getUserId(),eventCode,event.getSourceId(),event.getCustomerId(),dateCheck); |
|
|
if(null == sum) sum = NumConstant.ZERO; |
|
|
if(null == sum) sum = NumConstant.ZERO; |
|
|
if(StringUtils.equals(ModuleConstant.OPERATION_TYPE_PLUS,ruleInfo.getOperateType())){ |
|
|
if(StringUtils.equals(ModuleConstant.OPERATION_TYPE_PLUS,ruleInfo.getOperateType())){ |
|
|
sum += ruleInfo.getPoint(); |
|
|
sum += ruleInfo.getPoint(); |
|
|