From d7d48a129064e9351c6fcc76e2d7fdefe9ea4346 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 28 Aug 2023 18:09:43 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hfkj/schedule/TradeOrderSchedule.java | 40 +++++++------------ 1 file changed, 14 insertions(+), 26 deletions(-) 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) { From 24ba0a8a2f1650a235523e1db0699bde1743dd1a Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 29 Aug 2023 10:09:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hfkj/schedule/TradeOrderSchedule.java | 4 ++-- .../hfkj/service/impl/BsTradeOrderServiceImpl.java | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/schedule/src/main/java/com/hfkj/schedule/TradeOrderSchedule.java b/schedule/src/main/java/com/hfkj/schedule/TradeOrderSchedule.java index 40c3535..b313d88 100644 --- a/schedule/src/main/java/com/hfkj/schedule/TradeOrderSchedule.java +++ b/schedule/src/main/java/com/hfkj/schedule/TradeOrderSchedule.java @@ -258,12 +258,12 @@ public class TradeOrderSchedule { @Scheduled(cron="0 0/1 * * * ?") public void tradeOrderSettle() { Map param = new HashMap<>(); - param.put("status", "3"); + param.put("statusList", "3,6"); param.put("settleAmountIsNull", true); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_MONTH, -2); - param.put("payTimeS", calendar.getTimeInMillis()); + param.put("payTimeS", calendar.getTimeInMillis()); List tradeOrderList = tradeOrderService.getTradeOrderList(param); for (BsTradeOrder tradeOrder : tradeOrderList) { diff --git a/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java b/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java index aeb22f5..eeb7c0b 100644 --- a/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java @@ -24,10 +24,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; @Service("tradeOrderService") public class BsTradeOrderServiceImpl implements BsTradeOrderService { @@ -405,6 +402,15 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService { criteria.andStatusEqualTo(MapUtils.getInteger(param, "status")); } + if (StringUtils.isNotBlank(MapUtils.getString(param, "statusList"))) { + String[] statusLists = MapUtils.getString(param, "statusList").split(","); + List statusList = new ArrayList<>(); + for (String s : statusLists) { + statusList.add(Integer.parseInt(s)); + } + criteria.andStatusIn(statusList); + } + if (StringUtils.isNotBlank(MapUtils.getString(param, "settleAmountIsNull"))) { criteria.andSettleAmountIsNull(); }