Merge branch 'pre' into sxf

yy_dev
胡锐 1 year ago
commit 86846f0ede
  1. 44
      schedule/src/main/java/com/hfkj/schedule/TradeOrderSchedule.java
  2. 14
      service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java

@ -258,12 +258,12 @@ 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();
calendar.add(Calendar.DAY_OF_MONTH, -2); calendar.add(Calendar.DAY_OF_MONTH, -2);
param.put("payTimeS", calendar.getTimeInMillis()); param.put("payTimeS", calendar.getTimeInMillis());
List<BsTradeOrder> tradeOrderList = tradeOrderService.getTradeOrderList(param); List<BsTradeOrder> tradeOrderList = tradeOrderService.getTradeOrderList(param);
for (BsTradeOrder tradeOrder : tradeOrderList) { for (BsTradeOrder tradeOrder : tradeOrderList) {
@ -329,32 +329,16 @@ public class TradeOrderSchedule {
for (BsTradeOrderRefund tradeOrderRefund : tradeOrderRefundList) { for (BsTradeOrderRefund tradeOrderRefund : tradeOrderRefundList) {
try { try {
// 查询手续费 // 查询交易
JSONObject queryTrans = laKaLaTradeService.queryTradeOrderRefundTrans(tradeOrderRefund.getRefundNo()); BsTradeOrder tradeOrder = tradeOrderService.getOrderByOutTradeNo(tradeOrderRefund.getOutTradeNo());
if (queryTrans != null) { if (tradeOrder != null && tradeOrder.getSettleAmount() != null) {
tradeOrderRefund.setShdFeeAmt(new BigDecimal(queryTrans.getString("fee_amount").replace("-",""))); // 查询手续费
tradeOrderRefund.setSettleAmount(new BigDecimal(queryTrans.getString("settle_amount").replace(",","").replace("-",""))); JSONObject queryTrans = laKaLaTradeService.queryTradeOrderRefundTrans(tradeOrderRefund.getRefundNo());
tradeOrderRefund.setSettleDate(queryTrans.getDate("clear_date")); if (queryTrans != null) {
tradeOrderRefundService.editOrderRefund(tradeOrderRefund); 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"));
BsTradeOrder tradeOrder = tradeOrderService.getOrderByOutTradeNo(tradeOrderRefund.getOutTradeNo()); tradeOrderRefundService.editOrderRefund(tradeOrderRefund);
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());
@ -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) {

@ -24,10 +24,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service("tradeOrderService") @Service("tradeOrderService")
public class BsTradeOrderServiceImpl implements BsTradeOrderService { public class BsTradeOrderServiceImpl implements BsTradeOrderService {
@ -405,6 +402,15 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService {
criteria.andStatusEqualTo(MapUtils.getInteger(param, "status")); criteria.andStatusEqualTo(MapUtils.getInteger(param, "status"));
} }
if (StringUtils.isNotBlank(MapUtils.getString(param, "statusList"))) {
String[] statusLists = MapUtils.getString(param, "statusList").split(",");
List<Integer> statusList = new ArrayList<>();
for (String s : statusLists) {
statusList.add(Integer.parseInt(s));
}
criteria.andStatusIn(statusList);
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "settleAmountIsNull"))) { if (StringUtils.isNotBlank(MapUtils.getString(param, "settleAmountIsNull"))) {
criteria.andSettleAmountIsNull(); criteria.andSettleAmountIsNull();
} }

Loading…
Cancel
Save