diff --git a/mallinkService/src/main/java/com/iformall/utils/CreditUtil.java b/mallinkService/src/main/java/com/iformall/utils/CreditUtil.java index 79cb78357..b0a778086 100644 --- a/mallinkService/src/main/java/com/iformall/utils/CreditUtil.java +++ b/mallinkService/src/main/java/com/iformall/utils/CreditUtil.java @@ -101,10 +101,20 @@ public class CreditUtil { log.info("积分倍率计算:未设置生日或生日条件未匹配={}", wxCUserBasicInfo.getScoreDate()); } } else { - //发过生日券的用户或者享受过生日积分倍率的用户 - if (Objects.nonNull(wxCUserBasicInfo.getScoreDate()) && DateUtils.birthdaysBetween(wxCUserBasicInfo.getScoreDate()) == 0) { - birthdayScale = getBirthdayScoreScale(tenantId, wxScoreRulesService); + if(Objects.nonNull(wxCUserBasicInfo.getScoreDate())){ + int scoreYear = DateUtils.getYear(wxCUserBasicInfo.getScoreDate()); + int year = DateUtils.getYear(new Date()); + if(scoreYear == year && DateUtils.birthdaysBetween(wxCUserBasicInfo.getScoreDate()) == 0){ + birthdayScale = getBirthdayScoreScale(tenantId, wxScoreRulesService); + }else{ + if (Objects.nonNull(wxCUserBasicInfo.getBirthdate()) && DateUtils.birthdaysBetween(wxCUserBasicInfo.getBirthdate()) == 0) { + birthdayScale = getBirthdayScoreScale(tenantId,wxScoreRulesService); + } else { + log.info("积分倍率计算:未设置生日或生日条件未匹配={}", wxCUserBasicInfo.getScoreDate()); + } + } } + } //配置了生日积分倍率,保存到上下文 diff --git a/mallinkService/src/main/java/com/iformall/utils/DateUtils.java b/mallinkService/src/main/java/com/iformall/utils/DateUtils.java index 4fca5a105..2e84f4da0 100755 --- a/mallinkService/src/main/java/com/iformall/utils/DateUtils.java +++ b/mallinkService/src/main/java/com/iformall/utils/DateUtils.java @@ -1329,4 +1329,18 @@ public class DateUtils { int month = cal.get(Calendar.MONTH) + 1; return month; } + + /** + * 获取当前日期是哪年
+ * + * @param date + * @return 获取当前日期是哪年 + */ + public static int getYear(Date date) { + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + int year = cal.get(Calendar.YEAR); + return year; + } + }