|
|
@@ -1745,64 +1745,64 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
|
|
|
paymentMap.setBankTransactionId(orderResult.getBankTrxId());
|
|
|
}
|
|
|
order = fsStoreOrderMapper.selectFsStoreOrderByOrderId(Long.parseLong(storePayment.getBusinessId()));
|
|
|
- log.info("订单数据{}", order);
|
|
|
- BigDecimal divAmount = null;
|
|
|
- //默认全部进入中医院
|
|
|
- BigDecimal ysyAmount = storePayment.getPayMoney();
|
|
|
- HuifuOrderConfirm confirm = new HuifuOrderConfirm();
|
|
|
- //获取聚水潭分账商户
|
|
|
- FsAmountsShareMerchant queryMerchant = new FsAmountsShareMerchant();
|
|
|
- queryMerchant.setType(order.getErpType());
|
|
|
- List<FsAmountsShareMerchant> merchants = amountsShareMerchantService.selectFsAmountsShareMerchantList(queryMerchant);
|
|
|
-
|
|
|
- //支付金额大于等于0.1的进行分账 最低分账金额为0.1
|
|
|
- if (storePayment.getPayMoney().compareTo(new BigDecimal("0.1")) > -1) {
|
|
|
- if (order.getErpType() != null && order.getErpType() == 1) {
|
|
|
- if (merchants != null && !merchants.isEmpty()) {
|
|
|
- int i = (int) (Math.random() * merchants.size());
|
|
|
- FsAmountsShareMerchant merchant = merchants.get(i);
|
|
|
- //分账商户号
|
|
|
- confirm.setDivHfId(merchant.getMerchantAccount());
|
|
|
- //益寿缘分账金额
|
|
|
- ysyAmount = storePayment.getPayMoney().multiply(new BigDecimal("0.2"));
|
|
|
- //其它商户分账金额
|
|
|
- divAmount = storePayment.getPayMoney().subtract(ysyAmount);
|
|
|
- //分账明细数据
|
|
|
- FsShareAmountDetail shareAmountDetail = new FsShareAmountDetail();
|
|
|
- shareAmountDetail.setShareAmount(divAmount);
|
|
|
- shareAmountDetail.setMerchantId(merchant.getId());
|
|
|
- shareAmountDetail.setOrderCode(order.getOrderCode());
|
|
|
- shareAmountDetail.setOrderId(order.getOrderId());
|
|
|
- //添加分账明细
|
|
|
- shareAmountDetailService.insertFsShareAmountDetail(shareAmountDetail);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- log.info("开始确认订单分账..........");
|
|
|
- confirm.setYsyDivAmt(ysyAmount);
|
|
|
- confirm.setDivAmt(divAmount);
|
|
|
- confirm.setOrgReqSeqId("store-"+payCode);
|
|
|
- confirm.setOrgReqDate(DateTools.getCurrentDateYYYYMMDD());
|
|
|
- String orderSn = OrderCodeUtils.getOrderSn();
|
|
|
- if (StringUtils.isEmpty(orderSn)) {
|
|
|
- return R.error("订单生成失败,请重试");
|
|
|
- }
|
|
|
- //中医院商户号
|
|
|
- confirm.setMainHfId("6666000175632107");
|
|
|
- confirm.setReqSeqId(orderSn);
|
|
|
- confirm.setTotalAmount(storePayment.getPayMoney());
|
|
|
- result = huiFuService.confirmOrder(confirm);
|
|
|
- log.info("确认订单分账结束..........");
|
|
|
- if (result != null && result.getResp_code().equals("00000000") && (result.getTrans_stat().equals("S") || result.getTrans_stat().equals("P"))) {
|
|
|
- //分账标识
|
|
|
- paymentMap.setShareStatus(1);
|
|
|
- paymentMap.setIsShare(1);
|
|
|
- paymentMap.setShareDate(result.getReq_date());
|
|
|
- paymentMap.setShareCode(result.getReq_seq_id());
|
|
|
- } else {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- throw new CustomException("交易确认订单失败");
|
|
|
- }
|
|
|
+// log.info("订单数据{}", order);
|
|
|
+// BigDecimal divAmount = null;
|
|
|
+// //默认全部进入中医院
|
|
|
+// BigDecimal ysyAmount = storePayment.getPayMoney();
|
|
|
+// HuifuOrderConfirm confirm = new HuifuOrderConfirm();
|
|
|
+// //获取聚水潭分账商户
|
|
|
+// FsAmountsShareMerchant queryMerchant = new FsAmountsShareMerchant();
|
|
|
+// queryMerchant.setType(order.getErpType());
|
|
|
+// List<FsAmountsShareMerchant> merchants = amountsShareMerchantService.selectFsAmountsShareMerchantList(queryMerchant);
|
|
|
+//
|
|
|
+// //支付金额大于等于0.1的进行分账 最低分账金额为0.1
|
|
|
+// if (storePayment.getPayMoney().compareTo(new BigDecimal("0.1")) > -1) {
|
|
|
+// if (order.getErpType() != null && order.getErpType() == 1) {
|
|
|
+// if (merchants != null && !merchants.isEmpty()) {
|
|
|
+// int i = (int) (Math.random() * merchants.size());
|
|
|
+// FsAmountsShareMerchant merchant = merchants.get(i);
|
|
|
+// //分账商户号
|
|
|
+// confirm.setDivHfId(merchant.getMerchantAccount());
|
|
|
+// //益寿缘分账金额
|
|
|
+// ysyAmount = storePayment.getPayMoney().multiply(new BigDecimal("0.2"));
|
|
|
+// //其它商户分账金额
|
|
|
+// divAmount = storePayment.getPayMoney().subtract(ysyAmount);
|
|
|
+// //分账明细数据
|
|
|
+// FsShareAmountDetail shareAmountDetail = new FsShareAmountDetail();
|
|
|
+// shareAmountDetail.setShareAmount(divAmount);
|
|
|
+// shareAmountDetail.setMerchantId(merchant.getId());
|
|
|
+// shareAmountDetail.setOrderCode(order.getOrderCode());
|
|
|
+// shareAmountDetail.setOrderId(order.getOrderId());
|
|
|
+// //添加分账明细
|
|
|
+// shareAmountDetailService.insertFsShareAmountDetail(shareAmountDetail);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// log.info("开始确认订单分账..........");
|
|
|
+// confirm.setYsyDivAmt(ysyAmount);
|
|
|
+// confirm.setDivAmt(divAmount);
|
|
|
+// confirm.setOrgReqSeqId("store-"+payCode);
|
|
|
+// confirm.setOrgReqDate(DateTools.getCurrentDateYYYYMMDD());
|
|
|
+// String orderSn = OrderCodeUtils.getOrderSn();
|
|
|
+// if (StringUtils.isEmpty(orderSn)) {
|
|
|
+// return R.error("订单生成失败,请重试");
|
|
|
+// }
|
|
|
+// //中医院商户号
|
|
|
+// confirm.setMainHfId("6666000175632107");
|
|
|
+// confirm.setReqSeqId(orderSn);
|
|
|
+// confirm.setTotalAmount(storePayment.getPayMoney());
|
|
|
+// result = huiFuService.confirmOrder(confirm);
|
|
|
+// log.info("确认订单分账结束..........");
|
|
|
+// if (result != null && result.getResp_code().equals("00000000") && (result.getTrans_stat().equals("S") || result.getTrans_stat().equals("P"))) {
|
|
|
+// //分账标识
|
|
|
+// paymentMap.setShareStatus(1);
|
|
|
+// paymentMap.setIsShare(1);
|
|
|
+// paymentMap.setShareDate(result.getReq_date());
|
|
|
+// paymentMap.setShareCode(result.getReq_seq_id());
|
|
|
+// } else {
|
|
|
+// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+// throw new CustomException("交易确认订单失败");
|
|
|
+// }
|
|
|
fsStorePaymentMapper.updateFsStorePayment(paymentMap);
|
|
|
log.info(payCode + "已支付");
|
|
|
}
|
|
|
@@ -1850,20 +1850,20 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
|
|
|
storeOrder.setPayTime(new Date());
|
|
|
|
|
|
//确认订单返回结果
|
|
|
- log.info("确认交易返回数据{}========>",result);
|
|
|
- if (result != null ) {
|
|
|
- if (result.getResp_code().equals("00000000") && (result.getTrans_stat().equals("S") || result.getTrans_stat().equals("P"))) {
|
|
|
- storeOrder.setZyyDivAmount(result.getYsyAmount());
|
|
|
- storeOrder.setZyyHuifuId(result.getZyzHuifuId());
|
|
|
- if (result.getOtherAmount() != null && result.getOtherHuifuId() != null) {
|
|
|
- storeOrder.setDivHuifuId(result.getOtherHuifuId());
|
|
|
- storeOrder.setDivAmount(result.getOtherAmount());
|
|
|
- }
|
|
|
- } else {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- throw new CustomException("交易确认订单失败");
|
|
|
- }
|
|
|
- }
|
|
|
+// log.info("确认交易返回数据{}========>",result);
|
|
|
+// if (result != null ) {
|
|
|
+// if (result.getResp_code().equals("00000000") && (result.getTrans_stat().equals("S") || result.getTrans_stat().equals("P"))) {
|
|
|
+// storeOrder.setZyyDivAmount(result.getYsyAmount());
|
|
|
+// storeOrder.setZyyHuifuId(result.getZyzHuifuId());
|
|
|
+// if (result.getOtherAmount() != null && result.getOtherHuifuId() != null) {
|
|
|
+// storeOrder.setDivHuifuId(result.getOtherHuifuId());
|
|
|
+// storeOrder.setDivAmount(result.getOtherAmount());
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+// throw new CustomException("交易确认订单失败");
|
|
|
+// }
|
|
|
+// }
|
|
|
fsStoreOrderMapper.updateFsStoreOrder(storeOrder);
|
|
|
try {
|
|
|
//更新用户下单次数(获取阈值,当订单总价大于等于阈值,则下单次数+1)
|