|
|
@@ -11,6 +11,7 @@ import com.iformall.common.IdWorker; |
|
|
import com.iformall.domain.po.*; |
|
|
import com.iformall.domain.po.*; |
|
|
import com.iformall.domain.vo.WxCreditHistoryVo; |
|
|
import com.iformall.domain.vo.WxCreditHistoryVo; |
|
|
import com.iformall.enums.EnumBusiness; |
|
|
import com.iformall.enums.EnumBusiness; |
|
|
|
|
|
import com.iformall.enums.EnumScoreRules; |
|
|
import com.iformall.enums.EnumScoreType; |
|
|
import com.iformall.enums.EnumScoreType; |
|
|
import com.iformall.enums.EnumUserType; |
|
|
import com.iformall.enums.EnumUserType; |
|
|
import com.iformall.exception.MallinkException; |
|
|
import com.iformall.exception.MallinkException; |
|
|
@@ -62,6 +63,14 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
RedisLock redisLock; |
|
|
RedisLock redisLock; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void clearCreditByYear() { |
|
|
|
|
|
WxScoreRules wxScoreRules = new WxScoreRules(); |
|
|
|
|
|
wxScoreRules.setType(EnumScoreRules.CREDIT.getCode()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageInfo<WxCreditHistory> listAsPage(WxCreditHistory record, Integer pageIndex, Integer pageSize) { |
|
|
public PageInfo<WxCreditHistory> listAsPage(WxCreditHistory record, Integer pageIndex, Integer pageSize) { |
|
|
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCreditHistoryMapper.findList(record)); |
|
|
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCreditHistoryMapper.findList(record)); |
|
|
@@ -165,7 +174,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { |
|
|
if (creditChangeNum != 0) { |
|
|
if (creditChangeNum != 0) { |
|
|
Long total = Long.valueOf(currentCreditAmount) + Long.valueOf(creditChangeNum); |
|
|
Long total = Long.valueOf(currentCreditAmount) + Long.valueOf(creditChangeNum); |
|
|
if (total > Integer.MAX_VALUE) { |
|
|
if (total > Integer.MAX_VALUE) { |
|
|
throw new MallinkException(ErrorCode.CREDIT_TOO_MUCH); |
|
|
|
|
|
|
|
|
throw new MallinkException(ErrorCode.OUT_OF_CREDIT); |
|
|
} |
|
|
} |
|
|
if (total < 0) { |
|
|
if (total < 0) { |
|
|
throw new MallinkException(ErrorCode.CREDIT_NOT_ENOUGH); |
|
|
throw new MallinkException(ErrorCode.CREDIT_NOT_ENOUGH); |
|
|
@@ -323,8 +332,9 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private int spendCredit(WxCreditHistory record) { |
|
|
private int spendCredit(WxCreditHistory record) { |
|
|
int spendCredit = record.getCreditNum(); |
|
|
|
|
|
return spendCredit; |
|
|
|
|
|
|
|
|
//根据商户id和花费金额计算需要新增的积分 |
|
|
|
|
|
Map<String,Integer> map = findByMerchantIdAndSpend(record.getMerchantId(),record.getSpendStr(),record.getTenantId()); |
|
|
|
|
|
return map.get("credit"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private int changeCredit(WxCreditHistory record) { |
|
|
private int changeCredit(WxCreditHistory record) { |
|
|
|