|
|
|
@@ -19,11 +19,13 @@ import com.iformall.service.WxCreditHistoryService; |
|
|
|
import com.iformall.service.WxScoreRulesService; |
|
|
|
import com.iformall.utils.RedisLock; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
@@ -147,8 +149,9 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { |
|
|
|
//验证此用户是否存在 |
|
|
|
throw new MallinkException(ErrorCode.USER_IS_EMPTY); |
|
|
|
} |
|
|
|
//获取当前用户总积分 |
|
|
|
//int currentCreditAmount = wxCreditHistoryMapper.creditAmount(record.getCUserId()); |
|
|
|
if (StringUtils.isNotEmpty(record.getSpendStr())) { |
|
|
|
record.setSpend(new BigDecimal(record.getSpendStr()).multiply(new BigDecimal(100)).intValue()); |
|
|
|
} |
|
|
|
int currentCreditAmount = 0; |
|
|
|
//获取当前用户总积分规则:优先获取wxCUserBasicInfo中数据 若不存在 再获取wxCUser表中数据 |
|
|
|
if (wxCUserBasicInfo != null && wxCUserBasicInfo.getCredit() != null && wxCUserBasicInfo.getCredit() > 0) { |
|
|
|
@@ -197,14 +200,16 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Integer> findByMerchantIdAndSpend(Long merchantId, Integer spend, String tenantId) { |
|
|
|
public Map<String, Integer> findByMerchantIdAndSpend(Long merchantId, String spendStr, String tenantId) { |
|
|
|
WxMerchant wxMerchant = wxMerchantMapper.selectByPrimaryKey(merchantId); |
|
|
|
Map<String, Integer> creditMap = Maps.newHashMap(); |
|
|
|
if (wxMerchant != null && wxMerchant.getBusinessId() != null) { |
|
|
|
WxCreditHistory wxCreditHistory = new WxCreditHistory(); |
|
|
|
wxCreditHistory.setBusinessId(Long.valueOf(wxMerchant.getBusinessId())); |
|
|
|
wxCreditHistory.setTenantId(tenantId); |
|
|
|
wxCreditHistory.setSpend(spend); |
|
|
|
if (StringUtils.isNotEmpty(spendStr)) { |
|
|
|
wxCreditHistory.setSpend(new BigDecimal(spendStr).multiply(new BigDecimal(100)).intValue()); |
|
|
|
} |
|
|
|
int credit = payAddCredit(wxCreditHistory); |
|
|
|
creditMap.put("credit", credit); |
|
|
|
} |
|
|
|
|