|
|
|
@@ -1,8 +1,10 @@ |
|
|
|
package com.iformall.service.impl; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.iformall.common.IdWorker; |
|
|
|
import com.iformall.domain.po.*; |
|
|
|
import com.iformall.enums.EnumBusiness; |
|
|
|
import com.iformall.enums.EnumScoreType; |
|
|
|
import com.iformall.mapper.WxScoreHistoryMapper; |
|
|
|
import com.iformall.mapper.WxScoreRulesMapper; |
|
|
|
@@ -10,6 +12,7 @@ import com.iformall.service.WxCUserBasicInfoService; |
|
|
|
import com.iformall.service.WxCUserService; |
|
|
|
import com.iformall.service.WxScoreRulesService; |
|
|
|
import com.iformall.utils.RedisUtils; |
|
|
|
import jdk.nashorn.internal.ir.IdentNode; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
@@ -147,7 +150,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { |
|
|
|
return addScoreNumber; |
|
|
|
} |
|
|
|
|
|
|
|
private int payAddScore(WxOrder order, String bussinessId) { |
|
|
|
private int payAddScore(WxOrder order, Integer businessId) { |
|
|
|
int addScoreNumber = 0; |
|
|
|
// 订单金额为0时不计入 |
|
|
|
if (order.getPayment() == 0) |
|
|
|
@@ -158,9 +161,23 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { |
|
|
|
// 2. 获取成长值 by id |
|
|
|
JSONObject payRule = scoreRules.getRuleObj(EnumScoreType.CONSUMPTION); |
|
|
|
// 3. 获取成长值 by 业态 |
|
|
|
JSONObject busRule = payRule.getJSONObject(bussinessId); |
|
|
|
if(busRule == null) { |
|
|
|
busRule = payRule.getJSONObject("6"); // 其他 bussinessId 6 |
|
|
|
JSONObject busRule = null; |
|
|
|
JSONObject busRuleOther = null; |
|
|
|
JSONArray busRules = payRule.getJSONArray("childs"); |
|
|
|
if(busRules != null) { |
|
|
|
for(int i=0;i<busRules.size();i++) { |
|
|
|
JSONObject bus = (JSONObject)busRules.get(i); |
|
|
|
Integer businessId1 = bus.getInteger("businessId"); |
|
|
|
if (businessId.equals(businessId1)) { |
|
|
|
busRule = bus; |
|
|
|
} |
|
|
|
if (businessId1.equals(EnumBusiness.OTHER.getCode())) { |
|
|
|
busRuleOther = bus; |
|
|
|
} |
|
|
|
} |
|
|
|
if(busRule == null) { |
|
|
|
busRule = busRuleOther; |
|
|
|
} |
|
|
|
} |
|
|
|
if (busRule == null) { |
|
|
|
busRule = payRule; |
|
|
|
@@ -316,7 +333,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { |
|
|
|
switch (scoreType){ |
|
|
|
case CONSUMPTION: { |
|
|
|
WxOrder order = (WxOrder) param1; |
|
|
|
String bussinessId = param2.toString(); |
|
|
|
Integer bussinessId = (Integer) param2; |
|
|
|
return payAddScore(order, bussinessId); |
|
|
|
} |
|
|
|
default: { |
|
|
|
|