|
|
@ -258,7 +258,7 @@ public class TradeOrderSchedule { |
|
|
|
@Scheduled(cron="0 0/1 * * * ?") |
|
|
|
@Scheduled(cron="0 0/1 * * * ?") |
|
|
|
public void tradeOrderSettle() { |
|
|
|
public void tradeOrderSettle() { |
|
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
|
param.put("status", "3"); |
|
|
|
param.put("statusList", "3,6"); |
|
|
|
param.put("settleAmountIsNull", true); |
|
|
|
param.put("settleAmountIsNull", true); |
|
|
|
|
|
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
@ -329,6 +329,9 @@ public class TradeOrderSchedule { |
|
|
|
|
|
|
|
|
|
|
|
for (BsTradeOrderRefund tradeOrderRefund : tradeOrderRefundList) { |
|
|
|
for (BsTradeOrderRefund tradeOrderRefund : tradeOrderRefundList) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
// 查询交易
|
|
|
|
|
|
|
|
BsTradeOrder tradeOrder = tradeOrderService.getOrderByOutTradeNo(tradeOrderRefund.getOutTradeNo()); |
|
|
|
|
|
|
|
if (tradeOrder != null && tradeOrder.getSettleAmount() != null) { |
|
|
|
// 查询手续费
|
|
|
|
// 查询手续费
|
|
|
|
JSONObject queryTrans = laKaLaTradeService.queryTradeOrderRefundTrans(tradeOrderRefund.getRefundNo()); |
|
|
|
JSONObject queryTrans = laKaLaTradeService.queryTradeOrderRefundTrans(tradeOrderRefund.getRefundNo()); |
|
|
|
if (queryTrans != null) { |
|
|
|
if (queryTrans != null) { |
|
|
@ -337,25 +340,6 @@ public class TradeOrderSchedule { |
|
|
|
tradeOrderRefund.setSettleDate(queryTrans.getDate("clear_date")); |
|
|
|
tradeOrderRefund.setSettleDate(queryTrans.getDate("clear_date")); |
|
|
|
tradeOrderRefundService.editOrderRefund(tradeOrderRefund); |
|
|
|
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); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BsTradeSettle tradeSettle = new BsTradeSettle(); |
|
|
|
BsTradeSettle tradeSettle = new BsTradeSettle(); |
|
|
|
tradeSettle.setCompanyId(tradeOrder.getCompanyId()); |
|
|
|
tradeSettle.setCompanyId(tradeOrder.getCompanyId()); |
|
|
|
tradeSettle.setAgentId(tradeOrder.getAgentId()); |
|
|
|
tradeSettle.setAgentId(tradeOrder.getAgentId()); |
|
|
@ -383,6 +367,10 @@ public class TradeOrderSchedule { |
|
|
|
tradeSettle.setFeeRate(tradeOrder.getFeeRate()); |
|
|
|
tradeSettle.setFeeRate(tradeOrder.getFeeRate()); |
|
|
|
tradeSettle.setOrgOutTradeNo(tradeOrder.getOutTradeNo()); |
|
|
|
tradeSettle.setOrgOutTradeNo(tradeOrder.getOutTradeNo()); |
|
|
|
tradeSettleService.editData(tradeSettle); |
|
|
|
tradeSettleService.editData(tradeSettle); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tradeOrder.setShdFeeAmt(tradeOrder.getShdFeeAmt().subtract(tradeOrderRefund.getShdFeeAmt())); |
|
|
|
|
|
|
|
tradeOrder.setSettleAmount(tradeOrder.getSettleAmount().subtract(tradeOrderRefund.getSettleAmount())); |
|
|
|
|
|
|
|
tradeOrderService.editOrder(tradeOrder); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|