Browse Source

update

release_toaliyun_real
xiaohanzi 5 years ago
parent
commit
2e0393371a
8 changed files with 43 additions and 16 deletions
  1. +1
    -1
      mallinkCApi/src/main/java/com/iformall/controller/WxCardPayController.java
  2. +2
    -1
      mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java
  3. +4
    -3
      mallinkService/src/main/java/com/iformall/service/WxCardSpendService.java
  4. +10
    -10
      mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java
  5. +0
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java
  6. +4
    -0
      mallinkService/src/main/java/com/iformall/service/pay/PayServiceFactory.java
  7. +8
    -0
      mallinkService/src/main/java/com/iformall/service/pay/service/share/PayShareAdapterService.java
  8. +14
    -0
      mallinkService/src/main/java/com/iformall/service/pay/service/share/neupos/NeuPosPayShareService.java

+ 1
- 1
mallinkCApi/src/main/java/com/iformall/controller/WxCardPayController.java View File

@@ -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());


+ 2
- 1
mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java View File

@@ -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);


+ 4
- 3
mallinkService/src/main/java/com/iformall/service/WxCardSpendService.java View File

@@ -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;
}

+ 10
- 10
mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java View File

@@ -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() ||


+ 0
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java View File

@@ -489,7 +489,6 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
try {
// 核销分账
shareAfterVerify(couponOrder, bUser.getMerchantId(),couponOrder.getPayVendor());
111111111111111111111
} catch (Exception e) {
logger.error(e.getMessage());
}


+ 4
- 0
mallinkService/src/main/java/com/iformall/service/pay/PayServiceFactory.java View File

@@ -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<Integer, PayShareAdapterService>();
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;
}


+ 8
- 0
mallinkService/src/main/java/com/iformall/service/pay/service/share/PayShareAdapterService.java View File

@@ -15,8 +15,16 @@ import com.iformall.service.pay.entity.PayShareResult;
*/
public interface PayShareAdapterService {

/**
* 账单类型
* @return
*/
public Integer getType();
/**
* 分账类型
* @return
*/
public Integer getProfitSharingType();
/**


+ 14
- 0
mallinkService/src/main/java/com/iformall/service/pay/service/share/neupos/NeuPosPayShareService.java View File

@@ -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{

}

Loading…
Cancel
Save