|
|
|
@@ -432,7 +432,7 @@ public class WxOrderServiceImpl implements WxOrderService { |
|
|
|
if (user.getCredit() == null || user.getCredit() < coupon.getSalePrice()) { |
|
|
|
throw new MallinkException(ErrorCode.CREDIT_NOT_ENOUGH); |
|
|
|
} |
|
|
|
//扣减积分操作记录 |
|
|
|
//-------此处为【积分支付】记录增加积分操作------- |
|
|
|
WxCreditHistory creditHistory = new WxCreditHistory(); |
|
|
|
//记录操作人类型 操作人id |
|
|
|
if (user.getOperatorType() == EnumUserType.MALLUSER.getCode()) { |
|
|
|
@@ -448,6 +448,8 @@ public class WxOrderServiceImpl implements WxOrderService { |
|
|
|
creditHistory.setTenantId(user.getTenantId()); |
|
|
|
creditHistory.setCreditType(EnumScoreType.CHANGE_CREDIT.getCode()); |
|
|
|
creditHistory.setCouponId(couponId); |
|
|
|
//如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户 |
|
|
|
setMerchantId(coupon, creditHistory); |
|
|
|
wxCreditHistoryService.saveOrUpdate(creditHistory); |
|
|
|
record.setType(EnumOrderType.CREDIT.getCode()); |
|
|
|
//积分支付时 变更订单状态为已支付 |
|
|
|
@@ -957,7 +959,7 @@ public class WxOrderServiceImpl implements WxOrderService { |
|
|
|
|
|
|
|
// 积分 计算 |
|
|
|
try { |
|
|
|
//扣减积分操作记录 |
|
|
|
//-------此处为【现金支付】记录增加积分操作------- |
|
|
|
WxCreditHistory creditHistory = new WxCreditHistory(); |
|
|
|
creditHistory.setOperatorType(EnumUserType.CUSER.getCode()); |
|
|
|
creditHistory.setOperatorId(user.getId()); |
|
|
|
@@ -969,18 +971,7 @@ public class WxOrderServiceImpl implements WxOrderService { |
|
|
|
creditHistory.setBusinessId(Long.valueOf(coupon.getBusiness())); |
|
|
|
creditHistory.setSpend(updateOrder.getPayment()); |
|
|
|
//如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户 |
|
|
|
WxCouponMerchant wxCouponMerchant = new WxCouponMerchant(); |
|
|
|
wxCouponMerchant.setProductId(coupon.getId()); |
|
|
|
wxCouponMerchant.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); |
|
|
|
List<WxCouponMerchant> list = wxCouponMerchantMapper.findList(wxCouponMerchant); |
|
|
|
if (list != null && list.size() > 0) { |
|
|
|
if (list.size() == 1) { |
|
|
|
creditHistory.setMerchantId(list.get(0).getMerchantId()); |
|
|
|
} |
|
|
|
if (list.size() > 1) { |
|
|
|
creditHistory.setMerchantId(Long.valueOf(EnumMerchantType.MERCHANT_MORE.getCode())); |
|
|
|
} |
|
|
|
} |
|
|
|
setMerchantId(coupon, creditHistory); |
|
|
|
wxCreditHistoryService.saveOrUpdate(creditHistory); |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("积分值:" + e.getMessage()); |
|
|
|
@@ -988,6 +979,21 @@ public class WxOrderServiceImpl implements WxOrderService { |
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
private void setMerchantId(WxCoupon coupon, WxCreditHistory creditHistory) { |
|
|
|
WxCouponMerchant wxCouponMerchant = new WxCouponMerchant(); |
|
|
|
wxCouponMerchant.setProductId(coupon.getId()); |
|
|
|
wxCouponMerchant.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); |
|
|
|
List<WxCouponMerchant> list = wxCouponMerchantMapper.findList(wxCouponMerchant); |
|
|
|
if (list != null && list.size() > 0) { |
|
|
|
if (list.size() == 1) { |
|
|
|
creditHistory.setMerchantId(list.get(0).getMerchantId()); |
|
|
|
} |
|
|
|
if (list.size() > 1) { |
|
|
|
creditHistory.setMerchantId(Long.valueOf(EnumMerchantType.MERCHANT_MORE.getCode())); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) |
|
|
|
public int microPayOrderSuccess(WxOrder updateOrder) { |
|
|
|
|