| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.dao.dto.CancelOrderDTO; |
| | | import com.doumee.dao.dto.CreateOrderDTO; |
| | | import com.doumee.dao.dto.DriverVerifyDTO; |
| | | import com.doumee.dao.dto.ShopVerifyDTO; |
| | | 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.util.Objects; |
| | | |
| | | /** |
| | | * è®¢åæ¥å£ |
| | | * |
| | | * @Author : Rk |
| | | * @create 2025/7/15 15:49 |
| | | */ |
| | | @Api(tags = "è®¢åæ¥å£") |
| | | @Trace(exclude = true) |
| | | @RestController |
| | | @RequestMapping("/web/order") |
| | | @Slf4j |
| | | public class OrdersApi extends ApiController { |
| | | |
| | | @Autowired |
| | | private OrdersService ordersService; |
| | | |
| | | @Autowired |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @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 = "å¾
æ¯ä»è®¢åéæ°å¤èµ·å¾®ä¿¡æ¯ä»") |
| | | @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 = "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())); |
| | | } |
| | | |
| | | @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<MyOrderDetailVO> detail(@PathVariable Integer orderId) { |
| | | return ApiResponse.success("æ¥è¯¢æå", ordersService.findMyOrderDetail(orderId, getMemberId())); |
| | | } |
| | | |
| | | @LoginRequired |
| | | @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 = "æ¥è¯¢è®¢å龿天æ°åé¾æè´¹ç¨") |
| | | @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)); |
| | | } |
| | | |
| | | @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)); |
| | | } |
| | | |
| | | |
| | | } |