From bb05129db40db646a59ddc90cb097edf063140c1 Mon Sep 17 00:00:00 2001
From: xin <1099200748@qq.com>
Date: Thu, 28 Aug 2025 17:01:54 +0800
Subject: [PATCH] 订单-sql优化
---
oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml | 2 +-
oying-system/src/main/java/com/oying/modules/hwc/service/impl/CallbackServiceImpl.java | 3 ---
oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderReturnServiceImpl.java | 4 +++-
oying-system/src/main/resources/mapper/sh/OrderOperationLogMapper.xml | 2 +-
4 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/oying-system/src/main/java/com/oying/modules/hwc/service/impl/CallbackServiceImpl.java b/oying-system/src/main/java/com/oying/modules/hwc/service/impl/CallbackServiceImpl.java
index 3af99bd..b90ba99 100644
--- a/oying-system/src/main/java/com/oying/modules/hwc/service/impl/CallbackServiceImpl.java
+++ b/oying-system/src/main/java/com/oying/modules/hwc/service/impl/CallbackServiceImpl.java
@@ -1,6 +1,5 @@
package com.oying.modules.hwc.service.impl;
-import com.oying.exception.BadRequestException;
import com.oying.modules.hwc.service.CallbackService;
import com.oying.modules.hwc.utils.SignUtil;
import com.oying.modules.hwc.utils.XmlUtils;
@@ -78,7 +77,6 @@
response.getWriter().write(respString);
} catch (Exception e) {
log.error("汇旺财支付回调失败:{}", map.toString());
- throw new BadRequestException("操作失败,原因:" + e.getMessage());
}
}
@@ -114,7 +112,6 @@
response.getWriter().write(respString);
} catch (Exception e) {
log.error("汇旺财退款回调失败:{}", map.toString());
- System.out.println("操作失败,原因:" + e.getMessage());
}
}
}
diff --git a/oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderReturnServiceImpl.java b/oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderReturnServiceImpl.java
index ddf7a31..337325d 100644
--- a/oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderReturnServiceImpl.java
+++ b/oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderReturnServiceImpl.java
@@ -79,7 +79,8 @@
@Override
@Transactional(rollbackFor = Exception.class)
public synchronized void create(ReturnOrder resources) {
- Order order = orderService.queryByOrderNum(resources.getOrderNum());
+ OrderResponse response = orderService.getByOrderNum(resources.getOrderNum());
+ Order order = response.getOrder();
if (order == null) {
throw new BadRequestException("订单不存在!");
}
@@ -137,6 +138,7 @@
}
}
productSnapshotService.saveBatch(productSnapshots);
+ operationLogService.create(response, OrderStatusEnum.FIFTEEN, null);
}
private static OrderReturnProductSnapshot getSnapshot(OrderProductSnapshot snapshot, String returnNum) {
diff --git a/oying-system/src/main/resources/mapper/sh/OrderOperationLogMapper.xml b/oying-system/src/main/resources/mapper/sh/OrderOperationLogMapper.xml
index 0133cf3..21bb698 100644
--- a/oying-system/src/main/resources/mapper/sh/OrderOperationLogMapper.xml
+++ b/oying-system/src/main/resources/mapper/sh/OrderOperationLogMapper.xml
@@ -44,7 +44,7 @@
from sh_order_operation_log
where order_num = #{orderNum}
<if test="type!= null and type != ''">
- operation_type = #{type}
+ and operation_type = #{type}
</if>
order by log_id
</select>
diff --git a/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml b/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml
index edeaadc..2829091 100644
--- a/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml
+++ b/oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml
@@ -158,7 +158,7 @@
) o
left join sh_order_return_product_snapshot as p on p.return_num = o.return_num
<include refid="Where_Sql_Product"/>
- order by o.order_id desc
+ order by o.return_id desc
</select>
<select id="getByReturnNum" resultMap="BaseResultMap">
select o.* from ( select
--
Gitblit v1.9.3