|
|
|
@@ -1,10 +1,9 @@ |
|
|
|
package com.iformall.utils; |
|
|
|
|
|
|
|
import com.iformall.domain.po.WxCUser; |
|
|
|
import com.iformall.domain.po.WxCUserBasicInfo; |
|
|
|
import com.iformall.domain.po.WxLevelConfig; |
|
|
|
import com.iformall.domain.po.WxScoreRules; |
|
|
|
import com.iformall.domain.po.*; |
|
|
|
import com.iformall.mapper.WxLevelConfigMapper; |
|
|
|
import com.iformall.service.WxCouponActionLogService; |
|
|
|
import com.iformall.service.WxCouponOrderService; |
|
|
|
import com.iformall.service.WxScoreRulesService; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
@@ -20,7 +19,7 @@ public class CreditUtil { |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public static int calUserCredit(int creditOrigin, WxCUser wxCUser, WxLevelConfigMapper wxLevelConfigMapper, WxCUserBasicInfo wxCUserBasicInfo, WxScoreRulesService wxScoreRulesService) { |
|
|
|
public static int calUserCredit(int creditOrigin, WxCUser wxCUser, Integer scaleFromDb, WxCUserBasicInfo wxCUserBasicInfo, WxScoreRulesService wxScoreRulesService) { |
|
|
|
if (Objects.isNull(wxCUser) || Objects.isNull(wxCUserBasicInfo)) { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
@@ -28,13 +27,14 @@ public class CreditUtil { |
|
|
|
int levelScale = WxLevelConfig.DEFAULT_SCALE; |
|
|
|
Integer score = wxCUser.getScore(); |
|
|
|
if (Objects.nonNull(score)) { |
|
|
|
Integer scaleFromDb = wxLevelConfigMapper.getScale(wxCUser.getTenantId(), wxCUser.getScore()); |
|
|
|
if (Objects.nonNull(scaleFromDb)) { |
|
|
|
levelScale = scaleFromDb; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 获取生日积分倍率: |
|
|
|
int birthdayScale = WxScoreRules.DEFAULT_SCALE; |
|
|
|
// TODO,如有修改生日,生日积分倍率也只在一天有效 |
|
|
|
//判断是否生日当天 |
|
|
|
if (Objects.nonNull(wxCUserBasicInfo.getBirthdate()) && DateUtils.birthdaysBetween(wxCUserBasicInfo.getBirthdate()) == 0) { |
|
|
|
WxScoreRules rules = wxScoreRulesService.getCreditRules(wxCUser.getTenantId()); |
|
|
|
|