diff --git a/schedule/src/main/java/com/hfkj/schedule/TradeOrderSchedule.java b/schedule/src/main/java/com/hfkj/schedule/TradeOrderSchedule.java index 2f40fbd..40c3535 100644 --- a/schedule/src/main/java/com/hfkj/schedule/TradeOrderSchedule.java +++ b/schedule/src/main/java/com/hfkj/schedule/TradeOrderSchedule.java @@ -329,32 +329,16 @@ public class TradeOrderSchedule { for (BsTradeOrderRefund tradeOrderRefund : tradeOrderRefundList) { try { - // 查询手续费 - JSONObject queryTrans = laKaLaTradeService.queryTradeOrderRefundTrans(tradeOrderRefund.getRefundNo()); - if (queryTrans != null) { - tradeOrderRefund.setShdFeeAmt(new BigDecimal(queryTrans.getString("fee_amount").replace("-",""))); - tradeOrderRefund.setSettleAmount(new BigDecimal(queryTrans.getString("settle_amount").replace(",","").replace("-",""))); - tradeOrderRefund.setSettleDate(queryTrans.getDate("clear_date")); - tradeOrderRefundService.editOrderRefund(tradeOrderRefund); - - // 查询交易 - BsTradeOrder tradeOrder = tradeOrderService.getOrderByOutTradeNo(tradeOrderRefund.getOutTradeNo()); - if (tradeOrder != null) { - if (tradeOrder.getSettleAmount() == null) { - // 查询手续费 - JSONObject tradeOrderTrans = laKaLaTradeService.queryTradeOrderTrans(tradeOrder.getOutTradeNo()); - if (tradeOrderTrans != null && tradeOrderTrans.getString("trade_state").equals("03")) { - tradeOrder.setShdFeeAmt(tradeOrderTrans.getBigDecimal("fee_amount")); - tradeOrder.setSettleAmount(new BigDecimal(tradeOrderTrans.getString("settle_amount").replace(",",""))); - tradeOrder.setSettleDate(tradeOrderTrans.getDate("clear_date")); - tradeOrder.setFeeRate(new BigDecimal(tradeOrderTrans.getString("fee_rate").split(",")[0])); - tradeOrderService.editOrder(tradeOrder); - } - } - tradeOrder.setShdFeeAmt(tradeOrder.getShdFeeAmt().subtract(tradeOrderRefund.getShdFeeAmt())); - tradeOrder.setSettleAmount(tradeOrder.getSettleAmount().subtract(tradeOrderRefund.getSettleAmount())); - tradeOrderService.editOrder(tradeOrder); - + // 查询交易 + BsTradeOrder tradeOrder = tradeOrderService.getOrderByOutTradeNo(tradeOrderRefund.getOutTradeNo()); + if (tradeOrder != null && tradeOrder.getSettleAmount() != null) { + // 查询手续费 + JSONObject queryTrans = laKaLaTradeService.queryTradeOrderRefundTrans(tradeOrderRefund.getRefundNo()); + if (queryTrans != null) { + tradeOrderRefund.setShdFeeAmt(new BigDecimal(queryTrans.getString("fee_amount").replace("-",""))); + tradeOrderRefund.setSettleAmount(new BigDecimal(queryTrans.getString("settle_amount").replace(",","").replace("-",""))); + tradeOrderRefund.setSettleDate(queryTrans.getDate("clear_date")); + tradeOrderRefundService.editOrderRefund(tradeOrderRefund); BsTradeSettle tradeSettle = new BsTradeSettle(); tradeSettle.setCompanyId(tradeOrder.getCompanyId()); @@ -383,6 +367,10 @@ public class TradeOrderSchedule { tradeSettle.setFeeRate(tradeOrder.getFeeRate()); tradeSettle.setOrgOutTradeNo(tradeOrder.getOutTradeNo()); tradeSettleService.editData(tradeSettle); + + tradeOrder.setShdFeeAmt(tradeOrder.getShdFeeAmt().subtract(tradeOrderRefund.getShdFeeAmt())); + tradeOrder.setSettleAmount(tradeOrder.getSettleAmount().subtract(tradeOrderRefund.getSettleAmount())); + tradeOrderService.editOrder(tradeOrder); } } } catch (Exception e) {