From 2e0393371ab268d06dab251b75eeb855cdcdd9d3 Mon Sep 17 00:00:00 2001 From: xiaohanzi Date: Sun, 2 Aug 2020 10:15:51 +0800 Subject: [PATCH] update --- .../controller/WxCardPayController.java | 2 +- .../iformall/service/impl/PosServiceImpl.java | 3 ++- .../iformall/service/WxCardSpendService.java | 7 ++++--- .../service/impl/WxCardSpendServiceImpl.java | 20 +++++++++---------- .../impl/WxCouponOrderServiceImpl.java | 1 - .../service/pay/PayServiceFactory.java | 4 ++++ .../service/share/PayShareAdapterService.java | 8 ++++++++ .../share/neupos/NeuPosPayShareService.java | 14 +++++++++++++ 8 files changed, 43 insertions(+), 16 deletions(-) create mode 100644 mallinkService/src/main/java/com/iformall/service/pay/service/share/neupos/NeuPosPayShareService.java diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxCardPayController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxCardPayController.java index 1f041d20a..4244628b7 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxCardPayController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxCardPayController.java @@ -180,7 +180,7 @@ public class WxCardPayController extends BaseController { record.setRemark("操作于["+payWay.getMessage()+"("+payWay.getCode()+")]"); try { - return wxCardSpendService.createCardSpend(record, order, couponMerchant); + return wxCardSpendService.createCardSpend(record, order, couponMerchant,payWay); } catch (MallinkException e) { logger.error("card spend error, req 2: " + record.toString() + ", e:" + e.getMessage()); return new ResultData(e.getErrorCode(), e.getMessage()); diff --git a/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java b/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java index 987228e29..cd7c9da6d 100644 --- a/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java +++ b/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java @@ -2169,6 +2169,7 @@ public class PosServiceImpl implements PosService { WxCouponOrder updateCO = new WxCouponOrder(); updateCO.setId(couponOrderId); updateCO.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode()); + updateCO.setPayVendor(EnumPayWay.PAY_WAY_POS_NEU.getCode()); couponOrderMapper.updateById(updateCO); } WxCouponOrderCVo couponOrderCVo = couponOrderService.detailCUserVo(posPayOrderNo); @@ -2269,7 +2270,7 @@ public class PosServiceImpl implements PosService { WxCardSpend cardSpend = cardSpendService.getById(cardSpendId); if (cardSpend != null) { cardSpend.setOrderId(order.getId()); - cardSpendService.cardSpendForPosPay(scoreCreditCalc, cardSpend, merchant, buUser); + cardSpendService.cardSpendForPosPay(scoreCreditCalc, cardSpend, merchant, buUser,payOrder.getPayVendor()); } else { logger.error("卡支付ID未发现: " + cardSpendId); throw new MallinkException(ErrorCode.POS_CARD_ORDER_NOT_FOUND); diff --git a/mallinkService/src/main/java/com/iformall/service/WxCardSpendService.java b/mallinkService/src/main/java/com/iformall/service/WxCardSpendService.java index 29d369d0f..438b9386d 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCardSpendService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCardSpendService.java @@ -6,6 +6,7 @@ import com.iformall.domain.po.*; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.PromotionCalc; import com.iformall.domain.vo.WxCardSpendVo; +import com.iformall.enums.EnumPayWay; import com.iformall.exception.MallinkException; import javax.servlet.http.HttpServletRequest; @@ -27,7 +28,7 @@ public interface WxCardSpendService { * @param order * @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 cardSpendId */ - void shareForCardPay(TenantEntity tenantEntity, Long cardId, Long orderId, Long cardSpendId); + void shareForCardPay(TenantEntity tenantEntity, Long cardId, Long orderId, Long cardSpendId,Integer payWay); /** * cardPay交易流水导出 @@ -109,5 +110,5 @@ public interface WxCardSpendService { */ WxCardSpend cardSpendForPosPrePay(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; } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java index 25bf7522e..99ba50fcb 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java @@ -92,7 +92,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { @Override @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(); final IdWorker idWorker = IdWorker.get(); // 1. get card info @@ -250,7 +250,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { if (cardInfo.getSaleAmount() > 0) { // 9. 只有有价卡才能分账 try { - shareForCardPay(record, record.getCardId(), record.getOrderId(), record.getId()); + shareForCardPay(record, record.getCardId(), record.getOrderId(), record.getId(),payWay.getCode()); } catch (MallinkException e) { logger.error(e.getMessage()); if (ErrorCode.PROFIT_SHARING_NUM_UP_LIMIT.getCode() == e.getErrorCode() || @@ -435,7 +435,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { shareOrder.updateTenantInfo(wxCardInfo); shareOrder.setMerchantId(0L); // 卡完结,默认给0 shareOrder.setTransactionId(cardInfo.getTransactionId()); - cardShareFinished(cardInfo, shareOrder); + cardShareFinished(cardInfo, shareOrder,couponOrder.getPayVendor()); } catch (MallinkException e) { logger.error("微信分账: " + e.getMessage()); throw new MallinkException(e.getErrorCode(), e.getMessage()); @@ -454,7 +454,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { @Override @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; try { @@ -508,7 +508,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { shareOrder.updateTenantInfo(tenantEntity); shareOrder.setTransactionId(cardInfo.getTransactionId()); shareOrder.setShareAmount(cardSpend.getRealPayment()); - ResultData resultData = profitSharingOrderService.createSharingOrder(shareOrder); + ResultData resultData = profitSharingOrderService.createSharingOrder(shareOrder,payWay); if (resultData.code != Result.SUCCESS) { // 分账异常 logger.error(resultData.message); @@ -531,7 +531,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { if (cardSpend.getCardRemainRealAmount() > 0) { // 卡已被抵扣,但是分账还有余额 shareOrder.setMerchantId(0L); // 卡完结,填0 - cardShareFinished(cardInfo, shareOrder); + cardShareFinished(cardInfo, shareOrder,couponOrder.getPayVendor()); } } } else { @@ -550,7 +550,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { * @param cardInfo * @param shareOrder */ - private void cardShareFinished(WxCardInfo cardInfo, WxSharingOrderDto shareOrder) { + private void cardShareFinished(WxCardInfo cardInfo, WxSharingOrderDto shareOrder,Integer payWay) { Date curDate = new Date(); // card spend 添加一条 记录] final IdWorker idWorker = IdWorker.get(); @@ -597,7 +597,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { shareOrder.setShareAmount(cardInfo.getRemainingShareFeeAmount()); } shareOrder.setType(EnumProfitSharingOrderType.PROFIT_SHARING_MULTI_FINISH.getCode()); - profitSharingOrderService.finishSharingOrder(shareOrder); + profitSharingOrderService.finishSharingOrder(shareOrder,payWay); } @Override @@ -780,7 +780,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { @Override @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(); Date curDate = new Date(); // 1. update card_spend @@ -871,7 +871,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { // 9. 分账 try { - shareForCardPay(record, record.getCardId(), record.getOrderId(), record.getId()); + shareForCardPay(record, record.getCardId(), record.getOrderId(), record.getId(),payWay); } catch (MallinkException e) { logger.error(e.getMessage()); if (ErrorCode.PROFIT_SHARING_NUM_UP_LIMIT.getCode() == e.getErrorCode() || diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java index 0db9ad480..54cc9b7b8 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java @@ -489,7 +489,6 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { try { // 核销分账 shareAfterVerify(couponOrder, bUser.getMerchantId(),couponOrder.getPayVendor()); - 111111111111111111111 } catch (Exception e) { logger.error(e.getMessage()); } diff --git a/mallinkService/src/main/java/com/iformall/service/pay/PayServiceFactory.java b/mallinkService/src/main/java/com/iformall/service/pay/PayServiceFactory.java index 5daa321c7..d68379b7d 100644 --- a/mallinkService/src/main/java/com/iformall/service/pay/PayServiceFactory.java +++ b/mallinkService/src/main/java/com/iformall/service/pay/PayServiceFactory.java @@ -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.maPay.WxMiniMaPayAdapterService; 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; /** @@ -37,6 +38,8 @@ public class PayServiceFactory { WxPayOrderService wxPayOrderService; @Autowired WxPayShareService wxShareService; + @Autowired + NeuPosPayShareService neuPosPayShareService; public PayAdapterService getPayAdapterService(Integer type) throws MallinkException{ PayAdapterService service = getServiceMap().get(type); @@ -84,6 +87,7 @@ public class PayServiceFactory { shareMap = new ConcurrentHashMap(); shareMap.put(EnumPayWay.PAY_WAY_WECHAT.getCode(), wxShareService); shareMap.put(EnumPayWay.PAY_WAY_WECHAT_MA.getCode(), wxShareService); + shareMap.put(EnumPayWay.PAY_WAY_POS_NEU.getCode(), neuPosPayShareService); } return shareMap; } diff --git a/mallinkService/src/main/java/com/iformall/service/pay/service/share/PayShareAdapterService.java b/mallinkService/src/main/java/com/iformall/service/pay/service/share/PayShareAdapterService.java index 309b21e9e..7ee28bea7 100644 --- a/mallinkService/src/main/java/com/iformall/service/pay/service/share/PayShareAdapterService.java +++ b/mallinkService/src/main/java/com/iformall/service/pay/service/share/PayShareAdapterService.java @@ -15,8 +15,16 @@ import com.iformall.service.pay.entity.PayShareResult; */ public interface PayShareAdapterService { + /** + * 账单类型 + * @return + */ public Integer getType(); + /** + * 分账类型 + * @return + */ public Integer getProfitSharingType(); /** diff --git a/mallinkService/src/main/java/com/iformall/service/pay/service/share/neupos/NeuPosPayShareService.java b/mallinkService/src/main/java/com/iformall/service/pay/service/share/neupos/NeuPosPayShareService.java new file mode 100644 index 000000000..b00d0fad0 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/pay/service/share/neupos/NeuPosPayShareService.java @@ -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{ + +}