From 1151fa405da847e0afe526b3ed28c4a1fb3c5a38 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期一, 13 十月 2025 17:00:54 +0800
Subject: [PATCH] bug修改
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TOrderController.java | 44 +++++++++++++++++++++++++++-----------------
1 files changed, 27 insertions(+), 17 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TOrderController.java
index b6a9583..88cc9c4 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TOrderController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TOrderController.java
@@ -152,12 +152,14 @@
"}";
String authorization = getAuthorization(body);
+ System.err.println("支付请求"+body);
org.apache.http.HttpResponse response = post(LakalaConfig.getServerUrl() + apiPath, body, authorization);
if (response.getStatusLine().getStatusCode() != 200) {
return R.fail(500, "请求失败,statusCode " + response.getStatusLine()
+ IOUtils.toString(response.getEntity().getContent(), ENCODING));
}
String responseStr = IOUtils.toString(response.getEntity().getContent(), ENCODING);
+ System.err.println("支付结果"+responseStr);
erpProcurement.setPayNumber(outTradeNo);
@@ -228,6 +230,7 @@
map.put("merchant_no", erpProcurement.getMerchantNo());
map.put("log_no", erpProcurement.getPayTransactionId());
map.put("log_date", DateUtils.dateTime());
+ map.put("cal_type", "0");
map.put("notify_url", "http://221.182.45.100:8089/t-sys-order/messageSeparateHandle");
String time = DateUtils.dateTimeNow();
@@ -246,22 +249,10 @@
// 平台应得分账
BigDecimal payMoney = erpProcurement.getMoney();
ArrayList<HashMap<String, Object>> objects = new ArrayList<>();
- // 根据供应商id分组
- Map<String, List<TErpProcurementGoods>> collect = list.stream().collect(Collectors.groupingBy(TErpProcurementGoods::getSupplierId));
-// for (Map.Entry<String, List<TErpProcurementGoods>> entry : collect.entrySet()) {
-// HashMap<String, Object> map1 = new HashMap<>();
-// String supplierId = entry.getKey();
-// TCrmSupplier supplier = crmSupplierService.getById(supplierId);
-// List<TErpProcurementGoods> value = entry.getValue();
-// BigDecimal reduce = value.stream().map(TErpProcurementGoods::getSupplierMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
-// payMoney = payMoney.subtract(reduce);
-// map1.put("recv_no", supplier.getRecvMerchantNo());
-// map1.put("separate_value", reduce.multiply(BigDecimal.valueOf(100)).intValue() + "");
-//// objects.add(map1);
-// }
+
HashMap<String, Object> map1 = new HashMap<>();
//TODO hzt
- map1.put("recv_no", "SR2024000006413");
+ map1.put("recv_no", "SR2024021195402");
// 手续费
BigDecimal bigDecimal = allMoney.multiply(new BigDecimal("0.038")).setScale(2, RoundingMode.HALF_UP);
payMoney = payMoney.subtract(bigDecimal);
@@ -270,6 +261,25 @@
if(payMoney.doubleValue()>0){
objects.add(map1);
}
+
+ // 根据供应商id分组
+ Map<String, List<TErpProcurementGoods>> collect = list.stream().collect(Collectors.groupingBy(TErpProcurementGoods::getSupplierId));
+ for (Map.Entry<String, List<TErpProcurementGoods>> entry : collect.entrySet()) {
+ HashMap<String, Object> map2 = new HashMap<>();
+ String supplierId = entry.getKey();
+ TCrmSupplier supplier = crmSupplierService.getById(supplierId);
+// List<TErpProcurementGoods> value = entry.getValue();
+// BigDecimal reduce = value.stream().map(TErpProcurementGoods::getSupplierMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
+// payMoney = payMoney.subtract(reduce);
+ map2.put("recv_merchant_no", supplier.getRecvMerchantNo());
+ int count = allMoney.subtract(payMoney).multiply(BigDecimal.valueOf(100)).intValue();
+ if(count>0){
+ map2.put("separate_value", count+ "");
+
+ objects.add(map2);
+ }
+ }
+
erpProcurement.setMoney(payMoney);
erpProcurement.setOutSeparateNo(outTradeNo);
erpProcurementService.updateById(erpProcurement);
@@ -323,7 +333,7 @@
JSONArray jsonArray = JSONArray.parseArray(detail_datas.toString());
if("SEPARATE".equals(cmd_type.toString())){
TErpProcurement erpProcurement = erpProcurementService.getOne(new LambdaQueryWrapper<TErpProcurement>().eq(TErpProcurement::getOutSeparateNo, o.toString()));
- if ( erpProcurement!=null && "SUCCESS".equals(status)) {
+ if ( erpProcurement!=null && "SUCCESS".equals(status) && erpProcurement.getRefundStatus()!=1) {
erpProcurement.setRefundStatus(1);
erpProcurementService.updateById(erpProcurement);
// 修改分账状态
@@ -340,7 +350,7 @@
}
}else if("FALLBACK".equals(cmd_type.toString())){
TErpProcurement erpProcurement = erpProcurementService.getOne(new LambdaQueryWrapper<TErpProcurement>().eq(TErpProcurement::getRefundOutSeparateNo, o.toString()));
- if ( erpProcurement!=null && "SUCCESS".equals(status) && erpProcurement.getRefundStatus()==1) {
+ if ( erpProcurement!=null && "SUCCESS".equals(status) && erpProcurement.getRefundStatus()!=2) {
erpProcurement.setRefundStatus(2);
erpProcurementService.updateById(erpProcurement);
List<TErpProcurementGoods> list1 = erpProcurementGoodsService.list(new LambdaQueryWrapper<TErpProcurementGoods>().eq(TErpProcurementGoods::getProcurementId, erpProcurement.getId()));
@@ -480,7 +490,7 @@
// }
HashMap<String, Object> map1 = new HashMap<>();
// TODO hzt
- map1.put("recv_no", "SR2024000006413");
+ map1.put("recv_no", "SR2024021195402");
map1.put("amt", erpProcurement.getMoney().multiply(BigDecimal.valueOf(100)).intValue() + "");
objects.add(map1);
map.put("total_amt",erpProcurement.getMoney().multiply(BigDecimal.valueOf(100)).intValue() + "");
--
Gitblit v1.7.1