| @@ -180,7 +180,7 @@ public class WxCardPayController extends BaseController { | |||||
| record.setRemark("操作于["+payWay.getMessage()+"("+payWay.getCode()+")]"); | record.setRemark("操作于["+payWay.getMessage()+"("+payWay.getCode()+")]"); | ||||
| try { | try { | ||||
| return wxCardSpendService.createCardSpend(record, order, couponMerchant); | |||||
| return wxCardSpendService.createCardSpend(record, order, couponMerchant,payWay); | |||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| logger.error("card spend error, req 2: " + record.toString() + ", e:" + e.getMessage()); | logger.error("card spend error, req 2: " + record.toString() + ", e:" + e.getMessage()); | ||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | return new ResultData(e.getErrorCode(), e.getMessage()); | ||||
| @@ -2169,6 +2169,7 @@ public class PosServiceImpl implements PosService { | |||||
| WxCouponOrder updateCO = new WxCouponOrder(); | WxCouponOrder updateCO = new WxCouponOrder(); | ||||
| updateCO.setId(couponOrderId); | updateCO.setId(couponOrderId); | ||||
| updateCO.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode()); | updateCO.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode()); | ||||
| updateCO.setPayVendor(EnumPayWay.PAY_WAY_POS_NEU.getCode()); | |||||
| couponOrderMapper.updateById(updateCO); | couponOrderMapper.updateById(updateCO); | ||||
| } | } | ||||
| WxCouponOrderCVo couponOrderCVo = couponOrderService.detailCUserVo(posPayOrderNo); | WxCouponOrderCVo couponOrderCVo = couponOrderService.detailCUserVo(posPayOrderNo); | ||||
| @@ -2269,7 +2270,7 @@ public class PosServiceImpl implements PosService { | |||||
| WxCardSpend cardSpend = cardSpendService.getById(cardSpendId); | WxCardSpend cardSpend = cardSpendService.getById(cardSpendId); | ||||
| if (cardSpend != null) { | if (cardSpend != null) { | ||||
| cardSpend.setOrderId(order.getId()); | cardSpend.setOrderId(order.getId()); | ||||
| cardSpendService.cardSpendForPosPay(scoreCreditCalc, cardSpend, merchant, buUser); | |||||
| cardSpendService.cardSpendForPosPay(scoreCreditCalc, cardSpend, merchant, buUser,payOrder.getPayVendor()); | |||||
| } else { | } else { | ||||
| logger.error("卡支付ID未发现: " + cardSpendId); | logger.error("卡支付ID未发现: " + cardSpendId); | ||||
| throw new MallinkException(ErrorCode.POS_CARD_ORDER_NOT_FOUND); | throw new MallinkException(ErrorCode.POS_CARD_ORDER_NOT_FOUND); | ||||
| @@ -6,6 +6,7 @@ import com.iformall.domain.po.*; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.PromotionCalc; | import com.iformall.domain.vo.PromotionCalc; | ||||
| import com.iformall.domain.vo.WxCardSpendVo; | import com.iformall.domain.vo.WxCardSpendVo; | ||||
| import com.iformall.enums.EnumPayWay; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| @@ -27,7 +28,7 @@ public interface WxCardSpendService { | |||||
| * @param order | * @param order | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| ResultData createCardSpend(WxCardSpend record, WxOrder order, WxCouponMerchant couponMerchant); | |||||
| ResultData createCardSpend(WxCardSpend record, WxOrder order, WxCouponMerchant couponMerchant,EnumPayWay payWay); | |||||
| /** | /** | ||||
| * 根据实体查询分页列表 | * 根据实体查询分页列表 | ||||
| @@ -97,7 +98,7 @@ public interface WxCardSpendService { | |||||
| * @param orderId | * @param orderId | ||||
| * @param cardSpendId | * @param cardSpendId | ||||
| */ | */ | ||||
| void shareForCardPay(TenantEntity tenantEntity, Long cardId, Long orderId, Long cardSpendId); | |||||
| void shareForCardPay(TenantEntity tenantEntity, Long cardId, Long orderId, Long cardSpendId,Integer payWay); | |||||
| /** | /** | ||||
| * cardPay交易流水导出 | * cardPay交易流水导出 | ||||
| @@ -109,5 +110,5 @@ public interface WxCardSpendService { | |||||
| */ | */ | ||||
| WxCardSpend cardSpendForPosPrePay(WxCardSpend record) throws MallinkException; | WxCardSpend cardSpendForPosPrePay(WxCardSpend record) throws MallinkException; | ||||
| WxCardInfo cardSpendForPosPrePayCancel(WxCardInfo cardInfo, WxCardSpend record) throws MallinkException; | WxCardInfo cardSpendForPosPrePayCancel(WxCardInfo cardInfo, WxCardSpend record) throws MallinkException; | ||||
| WxCardSpend cardSpendForPosPay(PromotionCalc scoreCreditCalc, WxCardSpend record, WxMerchant merchant, WxMerchantBUser buUser) throws MallinkException; | |||||
| WxCardSpend cardSpendForPosPay(PromotionCalc scoreCreditCalc, WxCardSpend record, WxMerchant merchant, WxMerchantBUser buUser,Integer payWay) throws MallinkException; | |||||
| } | } | ||||
| @@ -92,7 +92,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| @Override | @Override | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| public ResultData createCardSpend(WxCardSpend record, WxOrder order, WxCouponMerchant couponMerchant) { | |||||
| public ResultData createCardSpend(WxCardSpend record, WxOrder order, WxCouponMerchant couponMerchant,EnumPayWay payWay) { | |||||
| Date curDate = new Date(); | Date curDate = new Date(); | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| // 1. get card info | // 1. get card info | ||||
| @@ -250,7 +250,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| if (cardInfo.getSaleAmount() > 0) { | if (cardInfo.getSaleAmount() > 0) { | ||||
| // 9. 只有有价卡才能分账 | // 9. 只有有价卡才能分账 | ||||
| try { | try { | ||||
| shareForCardPay(record, record.getCardId(), record.getOrderId(), record.getId()); | |||||
| shareForCardPay(record, record.getCardId(), record.getOrderId(), record.getId(),payWay.getCode()); | |||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| if (ErrorCode.PROFIT_SHARING_NUM_UP_LIMIT.getCode() == e.getErrorCode() || | if (ErrorCode.PROFIT_SHARING_NUM_UP_LIMIT.getCode() == e.getErrorCode() || | ||||
| @@ -435,7 +435,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| shareOrder.updateTenantInfo(wxCardInfo); | shareOrder.updateTenantInfo(wxCardInfo); | ||||
| shareOrder.setMerchantId(0L); // 卡完结,默认给0 | shareOrder.setMerchantId(0L); // 卡完结,默认给0 | ||||
| shareOrder.setTransactionId(cardInfo.getTransactionId()); | shareOrder.setTransactionId(cardInfo.getTransactionId()); | ||||
| cardShareFinished(cardInfo, shareOrder); | |||||
| cardShareFinished(cardInfo, shareOrder,couponOrder.getPayVendor()); | |||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| logger.error("微信分账: " + e.getMessage()); | logger.error("微信分账: " + e.getMessage()); | ||||
| throw new MallinkException(e.getErrorCode(), e.getMessage()); | throw new MallinkException(e.getErrorCode(), e.getMessage()); | ||||
| @@ -454,7 +454,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| @Override | @Override | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| public void shareForCardPay(TenantEntity tenantEntity, Long cardId, Long orderId, Long cardSpendId) { | |||||
| public void shareForCardPay(TenantEntity tenantEntity, Long cardId, Long orderId, Long cardSpendId,Integer payWay) { | |||||
| // 微信已分账检查次数 | // 微信已分账检查次数 | ||||
| int psNum = 0; | int psNum = 0; | ||||
| try { | try { | ||||
| @@ -508,7 +508,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| shareOrder.updateTenantInfo(tenantEntity); | shareOrder.updateTenantInfo(tenantEntity); | ||||
| shareOrder.setTransactionId(cardInfo.getTransactionId()); | shareOrder.setTransactionId(cardInfo.getTransactionId()); | ||||
| shareOrder.setShareAmount(cardSpend.getRealPayment()); | shareOrder.setShareAmount(cardSpend.getRealPayment()); | ||||
| ResultData resultData = profitSharingOrderService.createSharingOrder(shareOrder); | |||||
| ResultData resultData = profitSharingOrderService.createSharingOrder(shareOrder,payWay); | |||||
| if (resultData.code != Result.SUCCESS) { | if (resultData.code != Result.SUCCESS) { | ||||
| // 分账异常 | // 分账异常 | ||||
| logger.error(resultData.message); | logger.error(resultData.message); | ||||
| @@ -531,7 +531,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| if (cardSpend.getCardRemainRealAmount() > 0) { | if (cardSpend.getCardRemainRealAmount() > 0) { | ||||
| // 卡已被抵扣,但是分账还有余额 | // 卡已被抵扣,但是分账还有余额 | ||||
| shareOrder.setMerchantId(0L); // 卡完结,填0 | shareOrder.setMerchantId(0L); // 卡完结,填0 | ||||
| cardShareFinished(cardInfo, shareOrder); | |||||
| cardShareFinished(cardInfo, shareOrder,couponOrder.getPayVendor()); | |||||
| } | } | ||||
| } | } | ||||
| } else { | } else { | ||||
| @@ -550,7 +550,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| * @param cardInfo | * @param cardInfo | ||||
| * @param shareOrder | * @param shareOrder | ||||
| */ | */ | ||||
| private void cardShareFinished(WxCardInfo cardInfo, WxSharingOrderDto shareOrder) { | |||||
| private void cardShareFinished(WxCardInfo cardInfo, WxSharingOrderDto shareOrder,Integer payWay) { | |||||
| Date curDate = new Date(); | Date curDate = new Date(); | ||||
| // card spend 添加一条 记录] | // card spend 添加一条 记录] | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| @@ -597,7 +597,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| shareOrder.setShareAmount(cardInfo.getRemainingShareFeeAmount()); | shareOrder.setShareAmount(cardInfo.getRemainingShareFeeAmount()); | ||||
| } | } | ||||
| shareOrder.setType(EnumProfitSharingOrderType.PROFIT_SHARING_MULTI_FINISH.getCode()); | shareOrder.setType(EnumProfitSharingOrderType.PROFIT_SHARING_MULTI_FINISH.getCode()); | ||||
| profitSharingOrderService.finishSharingOrder(shareOrder); | |||||
| profitSharingOrderService.finishSharingOrder(shareOrder,payWay); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -780,7 +780,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| @Override | @Override | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| public WxCardSpend cardSpendForPosPay(PromotionCalc scoreCreditCalc, WxCardSpend record, WxMerchant merchant, WxMerchantBUser buUser) throws MallinkException { | |||||
| public WxCardSpend cardSpendForPosPay(PromotionCalc scoreCreditCalc, WxCardSpend record, WxMerchant merchant, WxMerchantBUser buUser,Integer payWay) throws MallinkException { | |||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| Date curDate = new Date(); | Date curDate = new Date(); | ||||
| // 1. update card_spend | // 1. update card_spend | ||||
| @@ -871,7 +871,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| // 9. 分账 | // 9. 分账 | ||||
| try { | try { | ||||
| shareForCardPay(record, record.getCardId(), record.getOrderId(), record.getId()); | |||||
| shareForCardPay(record, record.getCardId(), record.getOrderId(), record.getId(),payWay); | |||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| if (ErrorCode.PROFIT_SHARING_NUM_UP_LIMIT.getCode() == e.getErrorCode() || | if (ErrorCode.PROFIT_SHARING_NUM_UP_LIMIT.getCode() == e.getErrorCode() || | ||||
| @@ -489,7 +489,6 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| try { | try { | ||||
| // 核销分账 | // 核销分账 | ||||
| shareAfterVerify(couponOrder, bUser.getMerchantId(),couponOrder.getPayVendor()); | shareAfterVerify(couponOrder, bUser.getMerchantId(),couponOrder.getPayVendor()); | ||||
| 111111111111111111111 | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| } | } | ||||
| @@ -17,6 +17,7 @@ import com.iformall.service.pay.service.pay.PayAdapterService; | |||||
| import com.iformall.service.pay.service.pay.miniApp.wx.appPay.WxMiniAppPayAdapterService; | import com.iformall.service.pay.service.pay.miniApp.wx.appPay.WxMiniAppPayAdapterService; | ||||
| import com.iformall.service.pay.service.pay.miniApp.wx.maPay.WxMiniMaPayAdapterService; | import com.iformall.service.pay.service.pay.miniApp.wx.maPay.WxMiniMaPayAdapterService; | ||||
| import com.iformall.service.pay.service.share.PayShareAdapterService; | import com.iformall.service.pay.service.share.PayShareAdapterService; | ||||
| import com.iformall.service.pay.service.share.neupos.NeuPosPayShareService; | |||||
| import com.iformall.service.pay.service.share.wx.WxPayShareService; | import com.iformall.service.pay.service.share.wx.WxPayShareService; | ||||
| /** | /** | ||||
| @@ -37,6 +38,8 @@ public class PayServiceFactory { | |||||
| WxPayOrderService wxPayOrderService; | WxPayOrderService wxPayOrderService; | ||||
| @Autowired | @Autowired | ||||
| WxPayShareService wxShareService; | WxPayShareService wxShareService; | ||||
| @Autowired | |||||
| NeuPosPayShareService neuPosPayShareService; | |||||
| public PayAdapterService getPayAdapterService(Integer type) throws MallinkException{ | public PayAdapterService getPayAdapterService(Integer type) throws MallinkException{ | ||||
| PayAdapterService service = getServiceMap().get(type); | PayAdapterService service = getServiceMap().get(type); | ||||
| @@ -84,6 +87,7 @@ public class PayServiceFactory { | |||||
| shareMap = new ConcurrentHashMap<Integer, PayShareAdapterService>(); | shareMap = new ConcurrentHashMap<Integer, PayShareAdapterService>(); | ||||
| shareMap.put(EnumPayWay.PAY_WAY_WECHAT.getCode(), wxShareService); | shareMap.put(EnumPayWay.PAY_WAY_WECHAT.getCode(), wxShareService); | ||||
| shareMap.put(EnumPayWay.PAY_WAY_WECHAT_MA.getCode(), wxShareService); | shareMap.put(EnumPayWay.PAY_WAY_WECHAT_MA.getCode(), wxShareService); | ||||
| shareMap.put(EnumPayWay.PAY_WAY_POS_NEU.getCode(), neuPosPayShareService); | |||||
| } | } | ||||
| return shareMap; | return shareMap; | ||||
| } | } | ||||
| @@ -15,8 +15,16 @@ import com.iformall.service.pay.entity.PayShareResult; | |||||
| */ | */ | ||||
| public interface PayShareAdapterService { | public interface PayShareAdapterService { | ||||
| /** | |||||
| * 账单类型 | |||||
| * @return | |||||
| */ | |||||
| public Integer getType(); | public Integer getType(); | ||||
| /** | |||||
| * 分账类型 | |||||
| * @return | |||||
| */ | |||||
| public Integer getProfitSharingType(); | public Integer getProfitSharingType(); | ||||
| /** | /** | ||||
| @@ -0,0 +1,14 @@ | |||||
| package com.iformall.service.pay.service.share.neupos; | |||||
| import org.springframework.stereotype.Service; | |||||
| import com.iformall.service.pay.service.share.wx.WxPayShareService; | |||||
| /** | |||||
| * 东软pos分账,实际走的是微信的一套 | |||||
| * @author alascor | |||||
| */ | |||||
| @Service | |||||
| public class NeuPosPayShareService extends WxPayShareService{ | |||||
| } | |||||