From 9534df9c12adc71274c994df8765c788222a0f7b Mon Sep 17 00:00:00 2001
From: 彭雪彬 <1724387007@qq.com>
Date: Thu, 04 Sep 2025 10:34:03 +0800
Subject: [PATCH] 返回抛出异常
---
oying-system/src/main/java/com/oying/modules/rider/rest/WxRiderController.java | 37 +++++++++++++++++++++++++++----------
1 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/oying-system/src/main/java/com/oying/modules/rider/rest/WxRiderController.java b/oying-system/src/main/java/com/oying/modules/rider/rest/WxRiderController.java
index caaee55..a67cab8 100644
--- a/oying-system/src/main/java/com/oying/modules/rider/rest/WxRiderController.java
+++ b/oying-system/src/main/java/com/oying/modules/rider/rest/WxRiderController.java
@@ -1,15 +1,18 @@
package com.oying.modules.rider.rest;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.oying.exception.BadRequestException;
import com.oying.modules.rider.domain.*;
import com.oying.modules.rider.domain.dto.RiderIncomeDetailQueryCriteria;
import com.oying.modules.rider.domain.dto.RiderOrderRecordQueryCriteria;
import com.oying.modules.rider.domain.dto.RiderWithdrawalRecordQueryCriteria;
+import com.oying.modules.rider.domain.vo.OrderDeliveryPhotosVo;
import com.oying.modules.rider.domain.vo.OrderRiderOperationVo;
import com.oying.modules.rider.service.*;
import com.oying.modules.rider.utils.Constants;
import com.oying.utils.PageResult;
import com.oying.utils.R;
+import com.oying.utils.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
@@ -37,6 +40,8 @@
private final RiderInfoService riderInfoService;
private final RiderOrderRecordService riderOrderRecordService;
+
+ private final RiderDeliveryPhotosService riderDeliveryPhotosService;
@GetMapping("getRiderSourceInfo/{riderId}")
@@ -96,8 +101,8 @@
// @PreAuthorize("@el.check('riderOrderRecord:list')")
public ResponseEntity<?> riderGrabOrder(@PathVariable String orderNum) {
// 订单号不能为空
- if (orderNum == null || orderNum.equals("")) {
- return ResponseEntity.ok(R.fail(Constants.HTTP_CODE_FAIL, "订单号不能为空"));
+ if (StringUtils.isBlank(orderNum)) {
+ throw new BadRequestException("订单号不能为空");
}
R result = riderOrderRecordService.riderGrabOrder(orderNum);
return ResponseEntity.ok(result);
@@ -108,8 +113,8 @@
// @PreAuthorize("@el.check('riderOrderRecord:list')")
public ResponseEntity<?> riderCancelOrder(@PathVariable String orderNum) {
// 订单号不能为空
- if (orderNum == null || orderNum.equals("")) {
- return ResponseEntity.ok(R.fail(Constants.HTTP_CODE_FAIL, "订单号不能为空"));
+ if (StringUtils.isBlank(orderNum)) {
+ throw new BadRequestException("订单号不能为空");
}
R result = riderOrderRecordService.riderCancelOrder(orderNum);
return ResponseEntity.ok(R.success(result));
@@ -120,8 +125,8 @@
// @PreAuthorize("@el.check('riderOrderRecord:list')")
public ResponseEntity<?> riderCompleteOrder(@PathVariable String orderNum) {
// 订单号不能为空
- if (orderNum == null || orderNum.equals("")) {
- return ResponseEntity.ok(R.fail(Constants.HTTP_CODE_FAIL, "订单号不能为空"));
+ if (StringUtils.isBlank(orderNum)) {
+ throw new BadRequestException("订单号不能为空");
}
R result = riderOrderRecordService.riderCompleteOrder(orderNum);
return ResponseEntity.ok(R.success(result));
@@ -130,12 +135,24 @@
@PostMapping("riderOperationOrder")
@ApiOperation("骑手上报到店/取货配送")
// @PreAuthorize("@el.check('riderOrderRecord:list')")
- public ResponseEntity<?> riderOperationOrder(@RequestBody OrderRiderOperationVo orderRiderOperation) {
+ public ResponseEntity<?> riderOperationOrder(@RequestBody OrderRiderOperationVo orderRiderOperationVo) {
// 订单号不能为空
- if (orderRiderOperation.getOrderNum() == null || orderRiderOperation.getOrderNum().equals("")) {
- return ResponseEntity.ok(R.fail(Constants.HTTP_CODE_FAIL, "订单号不能为空"));
+ if (StringUtils.isBlank(orderRiderOperationVo.getOrderNum())) {
+ throw new BadRequestException("订单号不能为空");
}
- R result = riderOrderRecordService.riderOperationOrder(orderRiderOperation);
+ R result = riderOrderRecordService.riderOperationOrder(orderRiderOperationVo);
+ return ResponseEntity.ok(R.success(result));
+ }
+
+ @PostMapping("riderDeliveryPhotos")
+ @ApiOperation("骑手上传图片记录")
+ // @PreAuthorize("@el.check('riderOrderRecord:list')")
+ public ResponseEntity<?> riderDeliveryPhotos(@RequestBody OrderDeliveryPhotosVo orderDeliveryPhotosVo) {
+ // 订单号不能为空
+ if (StringUtils.isBlank(orderDeliveryPhotosVo.getOrderNum())) {
+ throw new BadRequestException("订单号不能为空");
+ }
+ Boolean result = riderDeliveryPhotosService.riderDeliveryPhotos(orderDeliveryPhotosVo);
return ResponseEntity.ok(R.success(result));
}
--
Gitblit v1.9.3