From 09ac251a089f5bb79d59a12bf2f932dda12c4ca2 Mon Sep 17 00:00:00 2001
From: xin <1099200748@qq.com>
Date: Thu, 10 Jul 2025 15:53:17 +0800
Subject: [PATCH] 小程序:微信授权登录;根据订单号查询订单操作日志

---
 oying-system/src/main/java/com/oying/modules/sh/rest/OrderReturnOperationLogController.java    |    2 -
 oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderOperationLogServiceImpl.java |    5 ++
 oying-system/src/main/resources/mapper/sh/OrderMapper.xml                                      |   16 ++++----
 oying-system/src/main/java/com/oying/modules/security/service/dto/AuthUserWeixinDto.java       |    4 ++
 oying-system/src/main/java/com/oying/modules/sh/rest/OrderOperationLogController.java          |   15 ++-----
 oying-system/src/main/java/com/oying/modules/sh/domain/request/AuditOrderReturn.java           |   27 +++++++++++++
 oying-system/src/main/java/com/oying/modules/sh/service/OrderOperationLogService.java          |    2 +
 oying-system/src/main/java/com/oying/modules/sh/mapper/OrderOperationLogMapper.java            |    2 +
 oying-system/src/main/resources/config/application.yml                                         |    2 
 oying-system/src/main/resources/mapper/sh/OrderOperationLogMapper.xml                          |    6 +++
 oying-system/src/main/java/com/oying/modules/sh/rest/OrderProductSnapshotController.java       |    2 
 oying-system/src/main/java/com/oying/modules/security/rest/AuthController.java                 |   12 ++----
 12 files changed, 65 insertions(+), 30 deletions(-)

diff --git a/oying-system/src/main/java/com/oying/modules/security/rest/AuthController.java b/oying-system/src/main/java/com/oying/modules/security/rest/AuthController.java
index 8a48e10..25a76cc 100644
--- a/oying-system/src/main/java/com/oying/modules/security/rest/AuthController.java
+++ b/oying-system/src/main/java/com/oying/modules/security/rest/AuthController.java
@@ -147,22 +147,18 @@
     public static final String OLD = "OLD";
     public static final String NEW = "NEW";
 
-    @Log("微信授权登录")
-    @ApiOperation("微信授权登录")
+    @Log("小程序:微信授权登录")
+    @ApiOperation("小程序:微信授权登录")
     @AnonymousPostMapping(value = "/login/weixin")
     public ResponseEntity<Object> loginWeixin(@Validated @RequestBody AuthUserWeixinDto authUser, HttpServletRequest request) throws Exception {
         JSONObject jsonObject;
-        switch (authUser.getCode()) {
+        switch (authUser.getType()) {
             case OLD:
                 jsonObject = weiXinService.code2Session(authUser.getCode());
                 String openid = jsonObject.getString("openid");
                 User userDto = userService.findByOpenid(openid);
                 if (userDto == null) {
-                    Map<String, Object> authInfo = new HashMap<String, Object>(2) {{
-                        put("token", openid);
-                        put("member", null);
-                    }};
-                    return ResponseEntity.ok(authInfo);
+                    return ResponseEntity.ok(R.success(openid));
                 }
                 authUser.setUsername(userDto.getUsername());
                 break;
diff --git a/oying-system/src/main/java/com/oying/modules/security/service/dto/AuthUserWeixinDto.java b/oying-system/src/main/java/com/oying/modules/security/service/dto/AuthUserWeixinDto.java
index 17a31eb..e440229 100644
--- a/oying-system/src/main/java/com/oying/modules/security/service/dto/AuthUserWeixinDto.java
+++ b/oying-system/src/main/java/com/oying/modules/security/service/dto/AuthUserWeixinDto.java
@@ -4,6 +4,8 @@
 import lombok.Getter;
 import lombok.Setter;
 
+import javax.validation.constraints.NotBlank;
+
 /**
  * @author xin
  * @description
@@ -17,8 +19,10 @@
     private String username;
 
     @ApiModelProperty(value = "微信code")
+    @NotBlank
     private String code;
 
     @ApiModelProperty(value = "类型默认:OLD,注册:NEW",example = "OLD")
+    @NotBlank
     private String type = "OLD";
 }
diff --git a/oying-system/src/main/java/com/oying/modules/sh/domain/request/AuditOrderReturn.java b/oying-system/src/main/java/com/oying/modules/sh/domain/request/AuditOrderReturn.java
new file mode 100644
index 0000000..4133bab
--- /dev/null
+++ b/oying-system/src/main/java/com/oying/modules/sh/domain/request/AuditOrderReturn.java
@@ -0,0 +1,27 @@
+package com.oying.modules.sh.domain.request;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/**
+ * @author xin
+ * @description
+ * @date 2025/7/9 20:59
+ */
+@Getter
+@Setter
+public class AuditOrderReturn {
+
+    @ApiModelProperty(value = "退单号")
+    private String returnNum;
+    @ApiModelProperty(value = "审核状态")
+    private String auditStatus;
+    @ApiModelProperty(value = "备注")
+    private String message;
+    @ApiModelProperty(value = "金额")
+    private BigDecimal amount;
+
+}
diff --git a/oying-system/src/main/java/com/oying/modules/sh/mapper/OrderOperationLogMapper.java b/oying-system/src/main/java/com/oying/modules/sh/mapper/OrderOperationLogMapper.java
index 0760f6d..8d97f9c 100644
--- a/oying-system/src/main/java/com/oying/modules/sh/mapper/OrderOperationLogMapper.java
+++ b/oying-system/src/main/java/com/oying/modules/sh/mapper/OrderOperationLogMapper.java
@@ -19,4 +19,6 @@
     IPage<OrderOperationLog> findAll(@Param("criteria") OrderOperationLogQueryCriteria criteria, Page<Object> page);
 
     List<OrderOperationLog> findAll(@Param("criteria") OrderOperationLogQueryCriteria criteria);
+
+    List<OrderOperationLog> getByOrderNum(String orderNum);
 }
diff --git a/oying-system/src/main/java/com/oying/modules/sh/rest/OrderOperationLogController.java b/oying-system/src/main/java/com/oying/modules/sh/rest/OrderOperationLogController.java
index 0d43c87..3ef4e6f 100644
--- a/oying-system/src/main/java/com/oying/modules/sh/rest/OrderOperationLogController.java
+++ b/oying-system/src/main/java/com/oying/modules/sh/rest/OrderOperationLogController.java
@@ -1,7 +1,5 @@
 package com.oying.modules.sh.rest;
 
-import com.oying.annotation.Log;
-import com.oying.modules.sh.domain.OrderOperationLog;
 import com.oying.modules.sh.service.OrderOperationLogService;
 import com.oying.modules.sh.domain.dto.OrderOperationLogQueryCriteria;
 import com.oying.utils.R;
@@ -10,7 +8,6 @@
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import io.swagger.annotations.*;
 
@@ -46,12 +43,10 @@
         return new ResponseEntity<>(R.success(orderOperationLogService.queryAll(criteria, page)), HttpStatus.OK);
     }
 
-    @PostMapping
-    @Log("新增订单操作日志")
-    @ApiOperation("新增订单操作日志")
-    @PreAuthorize("@el.check('orderOperationLog:add')")
-    public ResponseEntity<Object> createOrderOperationLog(@Validated @RequestBody OrderOperationLog resources) {
-        orderOperationLogService.create(resources);
-        return new ResponseEntity<>(R.success(), HttpStatus.CREATED);
+    @GetMapping("getByOrderNum")
+    @ApiOperation("根据订单号查询订单操作日志")
+    @PreAuthorize("@el.check('orderOperationLog:list')")
+    public ResponseEntity<Object> queryOrderOperationLog(@RequestParam String orderNum) {
+        return new ResponseEntity<>(R.success(orderOperationLogService.getByOrderNum(orderNum)), HttpStatus.OK);
     }
 }
diff --git a/oying-system/src/main/java/com/oying/modules/sh/rest/OrderProductSnapshotController.java b/oying-system/src/main/java/com/oying/modules/sh/rest/OrderProductSnapshotController.java
index 972139c..4530653 100644
--- a/oying-system/src/main/java/com/oying/modules/sh/rest/OrderProductSnapshotController.java
+++ b/oying-system/src/main/java/com/oying/modules/sh/rest/OrderProductSnapshotController.java
@@ -26,7 +26,7 @@
     private final OrderProductSnapshotService orderProductSnapshotService;
 
     @GetMapping
-    @ApiOperation("查询订单商品快照")
+    @ApiOperation("根据订单号查询订单商品快照")
     public ResponseEntity<Object> queryOrderProductSnapshot(@RequestParam String orderNum) {
         return new ResponseEntity<>(R.success(orderProductSnapshotService.queryOrderProductSnapshot(orderNum)), HttpStatus.OK);
     }
diff --git a/oying-system/src/main/java/com/oying/modules/sh/rest/OrderReturnOperationLogController.java b/oying-system/src/main/java/com/oying/modules/sh/rest/OrderReturnOperationLogController.java
index fa07c1d..6b6b72c 100644
--- a/oying-system/src/main/java/com/oying/modules/sh/rest/OrderReturnOperationLogController.java
+++ b/oying-system/src/main/java/com/oying/modules/sh/rest/OrderReturnOperationLogController.java
@@ -1,6 +1,5 @@
 package com.oying.modules.sh.rest;
 
-import com.oying.annotation.Log;
 import com.oying.modules.sh.domain.OrderReturnOperationLog;
 import com.oying.modules.sh.service.OrderReturnOperationLogService;
 import com.oying.modules.sh.domain.dto.OrderReturnOperationLogQueryCriteria;
@@ -9,7 +8,6 @@
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import io.swagger.annotations.*;
 import java.io.IOException;
diff --git a/oying-system/src/main/java/com/oying/modules/sh/service/OrderOperationLogService.java b/oying-system/src/main/java/com/oying/modules/sh/service/OrderOperationLogService.java
index 03a8b0b..3f1ed13 100644
--- a/oying-system/src/main/java/com/oying/modules/sh/service/OrderOperationLogService.java
+++ b/oying-system/src/main/java/com/oying/modules/sh/service/OrderOperationLogService.java
@@ -56,4 +56,6 @@
     * @throws IOException /
     */
     void download(List<OrderOperationLog> all, HttpServletResponse response) throws IOException;
+
+    List<OrderOperationLog> getByOrderNum(String orderNum);
 }
diff --git a/oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderOperationLogServiceImpl.java b/oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderOperationLogServiceImpl.java
index da8db8f..fd06f35 100644
--- a/oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderOperationLogServiceImpl.java
+++ b/oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderOperationLogServiceImpl.java
@@ -41,6 +41,11 @@
     }
 
     @Override
+    public List<OrderOperationLog> getByOrderNum(String orderNum) {
+        return orderOperationLogMapper.getByOrderNum(orderNum);
+    }
+
+    @Override
     @Transactional(rollbackFor = Exception.class)
     public void create(OrderOperationLog resources) {
         orderOperationLogMapper.insert(resources);
diff --git a/oying-system/src/main/resources/config/application.yml b/oying-system/src/main/resources/config/application.yml
index 3813cb4..b916632 100644
--- a/oying-system/src/main/resources/config/application.yml
+++ b/oying-system/src/main/resources/config/application.yml
@@ -1,5 +1,5 @@
 server:
-  port: 8088
+  port: 8000
   http2:
     # 启用 HTTP/2 支持,提升传输效率
     enabled: true
diff --git a/oying-system/src/main/resources/mapper/sh/OrderMapper.xml b/oying-system/src/main/resources/mapper/sh/OrderMapper.xml
index c647e5f..7162d03 100644
--- a/oying-system/src/main/resources/mapper/sh/OrderMapper.xml
+++ b/oying-system/src/main/resources/mapper/sh/OrderMapper.xml
@@ -51,28 +51,28 @@
         <include refid="Base_Column_List"/>
         from sh_order
         <where>
-            <if test="criteria.orderNum != null">
+            <if test="criteria.orderNum != null and criteria.orderNum != ''">
                 and order_num like concat('%',#{criteria.orderNum},'%')
             </if>
-            <if test="criteria.orderStatus != null">
+            <if test="criteria.orderStatus != null and criteria.orderStatus != ''">
                 and order_status = #{criteria.orderStatus}
             </if>
-            <if test="criteria.userId != null">
+            <if test="criteria.userId != null and criteria.userId != ''">
                 and user_id = #{criteria.userId}
             </if>
-            <if test="criteria.username != null">
+            <if test="criteria.username != null and criteria.username != ''">
                 and username like concat('%',#{criteria.username},'%')
             </if>
-            <if test="criteria.storeId != null">
+            <if test="criteria.storeId != null and criteria.storeId != ''">
                 and store_id = #{criteria.storeId}
             </if>
-            <if test="criteria.orderDescribe != null">
+            <if test="criteria.orderDescribe != null and criteria.orderDescribe != ''">
                 and order_describe like concat('%',#{criteria.orderDescribe},'%')
             </if>
-            <if test="criteria.payState != null">
+            <if test="criteria.payState != null and criteria.payState != ''">
                 and pay_state = #{criteria.payState}
             </if>
-            <if test="criteria.payType != null">
+            <if test="criteria.payType != null and criteria.payType != ''">
                 and pay_type = #{criteria.payType}
             </if>
             <if test="criteria.payTime != null and criteria.payTime.size() > 0">
diff --git a/oying-system/src/main/resources/mapper/sh/OrderOperationLogMapper.xml b/oying-system/src/main/resources/mapper/sh/OrderOperationLogMapper.xml
index f5dd43c..c975d0e 100644
--- a/oying-system/src/main/resources/mapper/sh/OrderOperationLogMapper.xml
+++ b/oying-system/src/main/resources/mapper/sh/OrderOperationLogMapper.xml
@@ -37,4 +37,10 @@
         </where>
         order by log_id desc
     </select>
+    <select id="getByOrderNum" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from sh_order_operation_log
+        where order_num = #{orderNum} order by log_id desc
+    </select>
 </mapper>

--
Gitblit v1.9.3