xin
2025-07-10 09ac251a089f5bb79d59a12bf2f932dda12c4ca2
小程序:微信授权登录;根据订单号查询订单操作日志
1 files added
11 files modified
95 ■■■■■ changed files
oying-system/src/main/java/com/oying/modules/security/rest/AuthController.java 12 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/security/service/dto/AuthUserWeixinDto.java 4 ●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/domain/request/AuditOrderReturn.java 27 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/mapper/OrderOperationLogMapper.java 2 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/rest/OrderOperationLogController.java 15 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/rest/OrderProductSnapshotController.java 2 ●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/rest/OrderReturnOperationLogController.java 2 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/service/OrderOperationLogService.java 2 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderOperationLogServiceImpl.java 5 ●●●●● patch | view | raw | blame | history
oying-system/src/main/resources/config/application.yml 2 ●●● patch | view | raw | blame | history
oying-system/src/main/resources/mapper/sh/OrderMapper.xml 16 ●●●● patch | view | raw | blame | history
oying-system/src/main/resources/mapper/sh/OrderOperationLogMapper.xml 6 ●●●●● patch | view | raw | blame | history
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;
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";
}
oying-system/src/main/java/com/oying/modules/sh/domain/request/AuditOrderReturn.java
New file
@@ -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;
}
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);
}
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);
    }
}
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);
    }
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;
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);
}
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);
oying-system/src/main/resources/config/application.yml
@@ -1,5 +1,5 @@
server:
  port: 8088
  port: 8000
  http2:
    # 启用 HTTP/2 支持,提升传输效率
    enabled: true
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">
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>