releaserelease_toaliyun_real
| @@ -408,10 +408,17 @@ public class WxOrderController extends BaseController { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "订单ID转换异常"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "订单ID转换异常"); | ||||
| } | } | ||||
| wxOrder.setId(id); | wxOrder.setId(id); | ||||
| final WxOrderCouponPressVo orderCouponPressVo = wxOrderService.detailPressVo(wxOrder); | |||||
| if (orderCouponPressVo == null) | |||||
| try { | |||||
| final WxOrderCouponPressVo orderCouponPressVo = wxOrderService.detailPressVo(wxOrder); | |||||
| if (orderCouponPressVo == null) { | |||||
| logger.error("orderCouponPressVo is null: " + orderId); | |||||
| return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); | |||||
| } | |||||
| return new ResultData(orderCouponPressVo); | |||||
| } catch (Exception e) { | |||||
| logger.error("SQL: " + e.getMessage()); | |||||
| return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); | return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); | ||||
| return new ResultData(orderCouponPressVo); | |||||
| } | |||||
| } | } | ||||
| @@ -58,5 +58,9 @@ public class WxCardInfo extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "是否支持转送(0:不支持,1支持)", name = "supportTransfer") | @io.swagger.annotations.ApiModelProperty(value = "是否支持转送(0:不支持,1支持)", name = "supportTransfer") | ||||
| private Integer supportTransfer; | private Integer supportTransfer; | ||||
| public boolean isBuyed() { | |||||
| return saleAmount > 0; | |||||
| } | |||||
| } | } | ||||
| @@ -206,7 +206,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| Integer subsidyFee = subsidyFeeD.intValue(); | Integer subsidyFee = subsidyFeeD.intValue(); | ||||
| logger.info("补贴额: " + subsidyFee); | logger.info("补贴额: " + subsidyFee); | ||||
| if (cardInfo.getSaleAmount().equals(0) || subsidyFee > 0) { | if (cardInfo.getSaleAmount().equals(0) || subsidyFee > 0) { | ||||
| // 有补贴时入库 | |||||
| // 有补贴时入库, 免费卡消费时, 或者有补贴金额时 | |||||
| int iSubChargeFee = PayUtils.getPayRate(subsidyFee, payAccount.getRate(), false); | int iSubChargeFee = PayUtils.getPayRate(subsidyFee, payAccount.getRate(), false); | ||||
| Integer realSubsidyFee = subsidyFee - iSubChargeFee; | Integer realSubsidyFee = subsidyFee - iSubChargeFee; | ||||
| WxMerchantSubsidy merchantSubsidy = new WxMerchantSubsidy(); | WxMerchantSubsidy merchantSubsidy = new WxMerchantSubsidy(); | ||||
| @@ -246,27 +246,31 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| } | } | ||||
| if (payAccount.checkShare()) { | if (payAccount.checkShare()) { | ||||
| // 9. 分账 | |||||
| try { | |||||
| shareForCardPay(record, record.getCardId(), record.getOrderId(), record.getId()); | |||||
| } catch (MallinkException e) { | |||||
| logger.error(e.getMessage()); | |||||
| if (ErrorCode.PROFIT_SHARING_NUM_UP_LIMIT.getCode() == e.getErrorCode() || | |||||
| ErrorCode.PROFIT_SHARING_TIME_EXPIRED.getCode() == e.getErrorCode()) { | |||||
| // 分账已到20次限制,后面只记录,不分账 | |||||
| // 分账已过期,后面只记录,不分账 | |||||
| logger.error("分账已到20次限制,后面只记录,无法分账"); | |||||
| try { | |||||
| creteMerchantSubsidy(record, curDate, idWorker, coupon, payment); | |||||
| } catch (Exception ex) { | |||||
| logger.error("分账已到20次限制,记录到结算表失败"); | |||||
| // 分账 | |||||
| if (cardInfo.isBuyed()) { | |||||
| // 9. 只有有价卡才能分账 | |||||
| try { | |||||
| shareForCardPay(record, record.getCardId(), record.getOrderId(), record.getId()); | |||||
| } catch (MallinkException e) { | |||||
| logger.error(e.getMessage()); | |||||
| if (ErrorCode.PROFIT_SHARING_NUM_UP_LIMIT.getCode() == e.getErrorCode() || | |||||
| ErrorCode.PROFIT_SHARING_TIME_EXPIRED.getCode() == e.getErrorCode()) { | |||||
| // 分账已到20次限制,后面只记录,不分账 | |||||
| // 分账已过期,后面只记录,不分账 | |||||
| logger.error("分账已到20次限制,后面只记录,无法分账"); | |||||
| try { | |||||
| creteMerchantSubsidy(record, curDate, idWorker, coupon, payment); | |||||
| } catch (Exception ex) { | |||||
| logger.error("分账已到20次限制,记录到结算表失败"); | |||||
| } | |||||
| } else { | |||||
| throw new MallinkException(e.getErrorCode(), e.getMessage()); | |||||
| } | } | ||||
| } else { | |||||
| throw new MallinkException(e.getErrorCode(), e.getMessage()); | |||||
| } | } | ||||
| } | } | ||||
| } else { | } else { | ||||
| if (cardInfo.getSaleAmount() > 0 && payment > 0) { | |||||
| // 有价储值卡消费时,如果未启用分账,金额也记入补贴表,可能会导致查询错误, TODO | |||||
| if (cardInfo.isBuyed() && payment > 0) { | |||||
| try { | try { | ||||
| creteMerchantSubsidy(record, curDate, idWorker, coupon, payment); | creteMerchantSubsidy(record, curDate, idWorker, coupon, payment); | ||||
| } catch (Exception ex) { | } catch (Exception ex) { | ||||
| @@ -2,6 +2,7 @@ package com.iformall.service.impl; | |||||
| import com.alibaba.fastjson.JSONArray; | import com.alibaba.fastjson.JSONArray; | ||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| @@ -562,6 +563,15 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| @Override | @Override | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| public void subsidyAfterVerify(WxCouponOrder couponOrder, Long merchantId) { | public void subsidyAfterVerify(WxCouponOrder couponOrder, Long merchantId) { | ||||
| // 检查补贴是否入库 | |||||
| List<WxMerchantSubsidy> wmsList = wxMerchantSubsidyMapper.selectList( | |||||
| new LambdaQueryWrapper<WxMerchantSubsidy>().eq(WxMerchantSubsidy::getOrderId, couponOrder.getOrderId()) | |||||
| .eq(WxMerchantSubsidy::getType, EnumMerchantSubsidyType.MANUAL) | |||||
| ); | |||||
| if (wmsList.size() > 0) { | |||||
| logger.error("补贴已经入库: (orderId,type)-({},1)", couponOrder.getOrderId()); | |||||
| return; | |||||
| } | |||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| WxCouponMerchant couponMerchantQ = new WxCouponMerchant(); | WxCouponMerchant couponMerchantQ = new WxCouponMerchant(); | ||||