From e50954f0708ecbbc672352102ae3b24279d40cc1 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期四, 16 四月 2026 20:12:50 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/gtzxinglijicun
---
server/web/src/main/java/com/doumee/api/web/OrdersApi.java | 241 ++++++++++++++++++++++++++++++++++-------------
1 files changed, 173 insertions(+), 68 deletions(-)
diff --git a/server/web/src/main/java/com/doumee/api/web/OrdersApi.java b/server/web/src/main/java/com/doumee/api/web/OrdersApi.java
index fe1eea4..5292cb9 100644
--- a/server/web/src/main/java/com/doumee/api/web/OrdersApi.java
+++ b/server/web/src/main/java/com/doumee/api/web/OrdersApi.java
@@ -1,112 +1,217 @@
package com.doumee.api.web;
import com.doumee.core.annotation.LoginRequired;
+import com.doumee.core.annotation.LoginShopRequired;
import com.doumee.core.annotation.trace.Trace;
import com.doumee.core.model.ApiResponse;
-import com.doumee.dao.business.model.Areas;
-import com.doumee.dao.business.model.Banner;
-import com.doumee.dao.business.model.Category;
-import com.doumee.dao.dto.CalculateLocalPriceDTO;
-import com.doumee.dao.dto.CalculateRemotePriceDTO;
-import com.doumee.dao.vo.AccountResponse;
-import com.doumee.dao.vo.PriceCalculateVO;
-import com.doumee.service.business.AreasService;
-import com.doumee.service.business.BannerService;
-import com.doumee.service.business.CategoryService;
+import com.doumee.core.model.PageData;
+import com.doumee.core.model.PageWrap;
+import com.doumee.dao.dto.CancelOrderDTO;
+import com.doumee.dao.dto.CommentOrderDTO;
+import com.doumee.dao.dto.ConfirmArriveDTO;
+import com.doumee.dao.dto.CreateOrderDTO;
+import com.doumee.dao.dto.DriverVerifyDTO;
+import com.doumee.dao.dto.ShopVerifyDTO;
+import com.doumee.dao.dto.StoreOutDTO;
+import com.doumee.dao.dto.MyOrderDTO;
+import com.doumee.dao.vo.MyOrderDetailVO;
+import com.doumee.dao.vo.MyOrderVO;
+import com.doumee.dao.vo.OverdueFeeVO;
+import com.doumee.dao.vo.PayResponse;
import com.doumee.service.business.OrdersService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
-import java.math.BigDecimal;
-import java.util.List;
+import java.util.Objects;
/**
- * Created by IntelliJ IDEA.
+ * 璁㈠崟鎺ュ彛
*
* @Author : Rk
* @create 2025/7/15 15:49
*/
-@Api(tags = "閰嶇疆绫绘帴鍙�")
+@Api(tags = "璁㈠崟鎺ュ彛")
@Trace(exclude = true)
@RestController
-@RequestMapping("/web/config")
+@RequestMapping("/web/order")
@Slf4j
-public class ConfigApi extends ApiController{
-
- @Autowired
- private CategoryService categoryService;
-
- @Autowired
- private AreasService areasService;
-
- @Autowired
- private BannerService bannerService;
+public class OrdersApi extends ApiController {
@Autowired
private OrdersService ordersService;
- @ApiOperation(value = "鑾峰彇鍒嗙被鍒楄〃", notes = "灏忕▼搴忕")
- @GetMapping("/getCategoryList")
- @ApiImplicitParams({
- @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "type", value = "绫诲瀷:1=杞﹁締绫诲瀷;2=鐗╁搧鍒嗙被;3=鐗╁搧绛夌骇;4=鐗╁搧灏哄;", required = true)
- })
- public ApiResponse<List<Category>> getCategoryList(@RequestParam Integer type) {
- return ApiResponse.success("鎿嶄綔鎴愬姛",categoryService.getCategoryList(type));
- }
+ @Autowired
+ private RedisTemplate<String, Object> redisTemplate;
- @ApiOperation(value = "鑾峰彇寮�鏀惧煄甯傚垪琛�", notes = "杩斿洖宸插紑鏀惧煄甯傦紝鍚瀛楁瘝锛屾寜棣栧瓧姣嶆帓搴�")
- @GetMapping("/getOpenCityList")
- public ApiResponse<List<Areas>> getOpenCityList() {
- return ApiResponse.success("鎿嶄綔鎴愬姛", areasService.getOpenCityList());
- }
-
- @ApiOperation(value = "鑾峰彇杞挱鍥惧垪琛�", notes = "鏍规嵁浣嶇疆杩斿洖杞挱鍥撅紝鍚浘鐗囧叏璺緞")
- @GetMapping("/getBannerList")
- @ApiImplicitParams({
- @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "position", value = "浣嶇疆:0=浼氬憳绔椤佃疆鎾�;1=鍙告満APP寮曞椤�;", required = true)
- })
- public ApiResponse<List<Banner>> getBannerList(@RequestParam Integer position) {
- return ApiResponse.success("鎿嶄綔鎴愬姛", bannerService.findListByPosition(position));
- }
-
- @ApiOperation(value = "鑾峰彇鍩庡競宸插紑閫氱墿鍝佸昂瀵�", notes = "鏍规嵁鍩庡競涓婚敭鏌ヨ宸插紑閫氱殑鐗╁搧灏哄(category type=4)")
- @GetMapping("/getCitySizeList")
- @ApiImplicitParams({
- @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "cityId", value = "鍩庡競涓婚敭", required = true)
- })
- public ApiResponse<List<Category>> getCitySizeList(@RequestParam Integer cityId) {
- return ApiResponse.success("鎿嶄綔鎴愬姛", categoryService.getCitySizeList(cityId));
+ @LoginRequired
+ @ApiOperation(value = "鍒涘缓璁㈠崟", notes = "鍒涘缓灏卞湴/寮傚湴瀵勫瓨璁㈠崟锛岃繑鍥炲井淇℃敮浠樺弬鏁�")
+ @PostMapping("/create")
+ public ApiResponse<PayResponse> createOrder(@RequestBody @Valid CreateOrderDTO dto) {
+ PayResponse payResponse = ordersService.createOrder(dto, getMemberId());
+ if (Objects.nonNull(payResponse) && StringUtils.isNotBlank(payResponse.getLockKey())) {
+ redisTemplate.delete(payResponse.getLockKey());
+ }
+ return ApiResponse.success("鎿嶄綔鎴愬姛", payResponse);
}
@LoginRequired
- @ApiOperation(value = "璁$畻淇濅环璐圭敤", notes = "鏍规嵁鎶ヤ环閲戦璁$畻淇濅环璐圭敤")
- @GetMapping("/calculateInsuranceFee")
+ @ApiOperation(value = "缁х画鏀粯", notes = "寰呮敮浠樿鍗曢噸鏂板敜璧峰井淇℃敮浠�")
+ @PostMapping("/continuePay/{orderId}")
+ public ApiResponse<PayResponse> continuePay(@PathVariable Integer orderId) {
+ return ApiResponse.success("鎿嶄綔鎴愬姛", ordersService.continuePay(orderId, getMemberId()));
+ }
+
+ @LoginRequired
+ @ApiOperation(value = "浼氬憳璁㈠崟鍒嗛〉", notes = "灏忕▼搴忕锛屾寜鐘舵�佺瓫閫�")
+ @PostMapping("/myPage")
@ApiImplicitParams({
- @ApiImplicitParam(paramType = "query", dataType = "BigDecimal", name = "declaredValue", value = "鎶ヤ环閲戦", required = true),
+ @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "鐢ㄦ埛token鍊�", required = true),
+ })
+ public ApiResponse<PageData<MyOrderVO>> myPage(@RequestBody @Validated PageWrap<MyOrderDTO> pageWrap) {
+ return ApiResponse.success("鏌ヨ鎴愬姛", ordersService.findMyOrderPage(pageWrap, getMemberId()));
+ }
+
+ @LoginShopRequired
+ @ApiOperation(value = "闂ㄥ簵璁㈠崟鍒嗛〉", notes = "闂ㄥ簵绔紝鏌ヨ瀛樹欢/鍙栦欢闂ㄥ簵涓哄綋鍓嶉棬搴楃殑璁㈠崟")
+ @PostMapping("/shopPage")
+ @ApiImplicitParams({
+ @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "闂ㄥ簵token鍊�", required = true)
+ })
+ public ApiResponse<PageData<MyOrderVO>> shopPage(@RequestBody @Validated PageWrap<MyOrderDTO> pageWrap) {
+ return ApiResponse.success("鏌ヨ鎴愬姛", ordersService.findShopOrderPage(pageWrap, getShopId()));
+ }
+
+ @LoginRequired
+ @ApiOperation(value = "浼氬憳璁㈠崟璇︽儏", notes = "灏忕▼搴忕锛屾煡璇㈠綋鍓嶄細鍛樼殑璁㈠崟璇︽儏")
+ @GetMapping("/detail/{orderId}")
+ @ApiImplicitParams({
+ @ApiImplicitParam(paramType = "path", dataType = "Integer", name = "orderId", value = "璁㈠崟涓婚敭", required = true),
@ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "鐢ㄦ埛token鍊�", required = true)
})
- public ApiResponse<BigDecimal> calculateInsuranceFee(@RequestParam BigDecimal declaredValue) {
- return ApiResponse.success("鎿嶄綔鎴愬姛", ordersService.calculateInsuranceFee(declaredValue));
+ public ApiResponse<MyOrderDetailVO> detail(@PathVariable Integer orderId) {
+ return ApiResponse.success("鏌ヨ鎴愬姛", ordersService.findMyOrderDetail(orderId, getMemberId()));
}
@LoginRequired
- @ApiOperation(value = "璁$畻灏卞湴瀛樺彇棰勪及璐圭敤", notes = "鏍规嵁鍩庡競銆佸ぉ鏁般�佺墿鍝佺被鍨嬪拰鏁伴噺璁$畻灏卞湴瀛樺彇棰勪及璐圭敤")
- @PostMapping("/calculateLocalPrice")
- public ApiResponse<PriceCalculateVO> calculateLocalPrice(@RequestBody @Valid CalculateLocalPriceDTO dto) {
- return ApiResponse.success("鎿嶄綔鎴愬姛", ordersService.calculateLocalPrice(dto));
+ @ApiOperation(value = "浼氬憳鍙栨秷璁㈠崟", notes = "浠呭紓鍦板瘎瀛樿鍗曞彲鍙栨秷")
+ @PostMapping("/cancel")
+ @ApiImplicitParams({
+ @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "鐢ㄦ埛token鍊�", required = true)
+ })
+ public ApiResponse cancel(@RequestBody @Validated CancelOrderDTO dto) {
+ ordersService.cancelOrder(dto.getOrderId(), getMemberId(), dto.getCancelReason());
+ return ApiResponse.success("鎿嶄綔鎴愬姛");
}
@LoginRequired
- @ApiOperation(value = "璁$畻寮傚湴瀛樺彇棰勪及璐圭敤", notes = "鏍规嵁璺濈銆佺墿鍝佺被鍨嬪拰鏁伴噺璁$畻寮傚湴瀛樺彇棰勪及璐圭敤")
- @PostMapping("/calculateRemotePrice")
- public ApiResponse<PriceCalculateVO> calculateRemotePrice(@RequestBody @Valid CalculateRemotePriceDTO dto) {
- return ApiResponse.success("鎿嶄綔鎴愬姛", ordersService.calculateRemotePrice(dto));
+ @ApiOperation(value = "鏌ヨ瓒呮椂璐圭敤", notes = "鏌ヨ璁㈠崟閫炬湡澶╂暟鍜岄�炬湡璐圭敤")
+ @GetMapping("/overdueFee/{orderId}")
+ @ApiImplicitParams({
+ @ApiImplicitParam(paramType = "path", dataType = "Integer", name = "orderId", value = "璁㈠崟涓婚敭", required = true),
+ @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "鐢ㄦ埛token鍊�", required = true)
+ })
+ public ApiResponse<OverdueFeeVO> overdueFee(@PathVariable Integer orderId) {
+ return ApiResponse.success("鏌ヨ鎴愬姛", ordersService.calculateOverdueFee(orderId));
+ }
+
+ @LoginRequired
+ @ApiOperation(value = "閫炬湡璐圭敤鏀粯", notes = "閫炬湡璁㈠崟鍞よ捣寰俊鏀粯")
+ @PostMapping("/payOverdueFee/{orderId}")
+ @ApiImplicitParams({
+ @ApiImplicitParam(paramType = "path", dataType = "Integer", name = "orderId", value = "璁㈠崟涓婚敭", required = true),
+ @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "鐢ㄦ埛token鍊�", required = true)
+ })
+ public ApiResponse<PayResponse> payOverdueFee(@PathVariable Integer orderId) {
+ return ApiResponse.success("鎿嶄綔鎴愬姛", ordersService.payOverdueFee(orderId, getMemberId()));
+ }
+
+ @LoginRequired
+ @ApiOperation(value = "浼氬憳鍒犻櫎璁㈠崟", notes = "浠呭凡瀹屾垚/宸插彇娑�/宸查��娆捐鍗曞彲鍒犻櫎锛岄�昏緫鍒犻櫎")
+ @PostMapping("/delete/{orderId}")
+ @ApiImplicitParams({
+ @ApiImplicitParam(paramType = "path", dataType = "Integer", name = "orderId", value = "璁㈠崟涓婚敭", required = true),
+ @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "鐢ㄦ埛token鍊�", required = true)
+ })
+ public ApiResponse deleteOrder(@PathVariable Integer orderId) {
+ ordersService.deleteMyOrder(orderId, getMemberId());
+ return ApiResponse.success("鍒犻櫎鎴愬姛");
+ }
+
+ @LoginShopRequired
+ @ApiOperation(value = "闂ㄥ簵鏍搁攢鏀朵欢", notes = "闂ㄥ簵閫氳繃鏍搁攢鐮佺‘璁ゆ敹浠�/鍙栦欢")
+ @PostMapping("/shopVerify")
+ @ApiImplicitParams({
+ @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "闂ㄥ簵token鍊�", required = true)
+ })
+ public ApiResponse shopVerify(@RequestBody @Validated ShopVerifyDTO dto) {
+ ordersService.shopVerifyOrder(dto.getVerifyCode(), getShopId(), dto.getImages(), dto.getRemark());
+ return ApiResponse.success("鏍搁攢鎴愬姛");
+ }
+
+ @LoginShopRequired
+ @ApiOperation(value = "鏍搁攢鍙告満鐮�", notes = "寮傚湴瀵勫瓨涓旀湁鍙栦欢闂ㄥ簵鐨勮鍗曪紝閫氳繃鍙告満鏍搁攢鐮佺‘璁ゅ埌搴�")
+ @PostMapping("/driverVerify")
+ @ApiImplicitParams({
+ @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "鐢ㄦ埛token鍊�", required = true)
+ })
+ public ApiResponse driverVerify(@RequestBody @Validated DriverVerifyDTO dto) {
+ ordersService.driverVerifyOrder(dto.getVerifyCode(), dto.getImages(), dto.getRemark(), getShopId());
+ return ApiResponse.success("鏍搁攢鎴愬姛");
+ }
+
+ @LoginShopRequired
+ @ApiOperation(value = "闂ㄥ簵璁㈠崟璇︽儏", notes = "闂ㄥ簵绔煡璇㈣鍗曡鎯咃紝鏀寔璁㈠崟涓婚敭鎴栨牳閿�鐮佹煡璇�")
+ @GetMapping("/shopDetail")
+ @ApiImplicitParams({
+ @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "闂ㄥ簵token鍊�", required = true),
+ @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "orderId", value = "璁㈠崟涓婚敭"),
+ @ApiImplicitParam(paramType = "query", dataType = "String", name = "verifyCode", value = "鏍搁攢鐮�")
+ })
+ public ApiResponse<MyOrderDetailVO> shopDetail(@RequestParam(required = false) Integer orderId,
+ @RequestParam(required = false) String verifyCode) {
+ return ApiResponse.success("鏌ヨ鎴愬姛", ordersService.findShopOrderDetail(orderId, verifyCode));
+ }
+
+ @LoginShopRequired
+ @ApiOperation(value = "闂ㄥ簵纭鍑哄簱", notes = "鍙栦欢闂ㄥ簵纭鍑哄簱锛岃鍗曞畬鎴�")
+ @PostMapping("/storeOut")
+ @ApiImplicitParams({
+ @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "闂ㄥ簵token鍊�", required = true)
+ })
+ public ApiResponse storeOut(@RequestBody @Validated StoreOutDTO dto) {
+ ordersService.confirmStoreOut(dto.getOrderId(), getShopId(), dto.getImages(), dto.getRemark());
+ return ApiResponse.success("鍑哄簱鎴愬姛");
+ }
+
+ @LoginShopRequired
+ @ApiOperation(value = "纭椤惧鍒板簵", notes = "闂ㄥ簵纭椤惧宸插埌搴楀彇浠讹紝妫�鏌ラ�炬湡/閫�娆�")
+ @PostMapping("/confirmArrived")
+ @ApiImplicitParams({
+ @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "闂ㄥ簵token鍊�", required = true)
+ })
+ public ApiResponse confirmArrived(@RequestBody @Validated ConfirmArriveDTO dto) {
+ ordersService.confirmCustomerArrived(dto.getOrderId(), getShopId());
+ return ApiResponse.success("鎿嶄綔鎴愬姛");
+ }
+
+ @LoginRequired
+ @ApiOperation(value = "璁㈠崟璇勪环", notes = "宸插畬鎴愪笖鏈瘎浠风殑璁㈠崟鍙繘琛岃瘎浠�")
+ @PostMapping("/comment")
+ @ApiImplicitParams({
+ @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "鐢ㄦ埛token鍊�", required = true)
+ })
+ public ApiResponse comment(@RequestBody @Validated CommentOrderDTO dto) {
+ ordersService.commentOrder(dto, getMemberId());
+ return ApiResponse.success("璇勪环鎴愬姛");
}
--
Gitblit v1.9.3