From e88b02c55145624e6b8ef8f4cbd56d22b9bdfff9 Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期一, 13 一月 2025 20:00:36 +0800
Subject: [PATCH] 12.18
---
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java | 155 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 152 insertions(+), 3 deletions(-)
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java
index 7ac38db..3c86592 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java
@@ -1,8 +1,25 @@
package com.ruoyi.order.controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.web.controller.BaseController;
+import com.ruoyi.common.core.web.page.PageInfo;
+import com.ruoyi.common.core.web.page.TableDataInfo;
+import com.ruoyi.common.security.service.TokenService;
+import com.ruoyi.order.model.Order;
+import com.ruoyi.order.model.RefundPass;
+import com.ruoyi.order.service.OrderService;
+import com.ruoyi.order.service.RefundPassService;
+import com.ruoyi.order.vo.*;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.Arrays;
+import java.util.List;
/**
* <p>
@@ -14,7 +31,139 @@
*/
@RestController
@RequestMapping("/refund-pass")
-public class RefundPassController {
+public class RefundPassController extends BaseController {
+
+ @Resource
+ private RefundPassService refundPassService;
+
+ @Resource
+ private TokenService tokenService;
+
+ @Resource
+ private OrderService orderService;
+
+
+ @ResponseBody
+ @PostMapping("/applyRefundPass")
+ @ApiOperation(value = "售后申请", tags = {"我的订单-个人中心-小程序"})
+ public R applyRefundPass(@RequestBody ApplyRefundPass applyRefundPass){
+ return refundPassService.applyRefundPass(applyRefundPass);
+ }
+
+ @ResponseBody
+ @GetMapping("/getRefundPass/{orderId}")
+ @ApiOperation(value = "获取售后详情", tags = {"我的订单-个人中心-小程序"})
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "orderId", value = "订单id", required = true, dataType = "long"),
+ })
+ public R<RefundPass> getRefundPass(@PathVariable("orderId") Long orderId){
+ Long userid = tokenService.getLoginUserApplet().getUserid();
+ Order order = orderService.getById(orderId);
+ if(!order.getAppUserId().equals(userid)){
+ return R.fail("权限不足");
+ }
+ RefundPass one = refundPassService.getOne(new LambdaQueryWrapper<RefundPass>().eq(RefundPass::getOrderId, orderId)
+ .eq(RefundPass::getDelFlag, 0).last(" order by create_time desc limit 0,1"));
+ one.setIdStr(one.getId().toString());
+ return R.ok(one);
+ }
+
+
+ @ResponseBody
+ @PutMapping("/cancelRefundPass/{id}")
+ @ApiOperation(value = "取消售后", tags = {"我的订单-个人中心-小程序"})
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "id", value = "售后数据id", required = true, dataType = "long"),
+ })
+ public R cancelRefundPass(@PathVariable("id") Long id){
+ RefundPass refundPass = refundPassService.getById(id);
+ if(null == refundPass){
+ return R.fail();
+ }
+ Long userid = tokenService.getLoginUserApplet().getUserid();
+ Order order = orderService.getById(refundPass.getOrderId());
+ if(!order.getAppUserId().equals(userid)){
+ return R.fail("权限不足");
+ }
+ if(Arrays.asList(2, 3).contains(refundPass.getStatus())){
+ return R.fail("售后取消失败");
+ }
+// refundPass.setDelFlag(1);
+ refundPassService.removeById(id);
+ order.setOrderStatus(4);
+ orderService.updateById(order);
+ return R.ok();
+ }
+
+
+ @ResponseBody
+ @PostMapping("/deliverGoodsRefundPass")
+ @ApiOperation(value = "售后已发货操作", tags = {"我的订单-个人中心-小程序"})
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "id", value = "售后数据id", required = true, dataType = "long"),
+ @ApiImplicitParam(name = "code", value = "快递单号", required = true, dataType = "string"),
+ })
+ public R deliverGoodsRefundPass(@RequestBody DeliverGoodsRefundPass pass){
+ RefundPass refundPass = refundPassService.getById(pass.getId());
+ if(null == refundPass){
+ return R.fail();
+ }
+ Long userid = tokenService.getLoginUserApplet().getUserid();
+ Order order = orderService.getById(refundPass.getOrderId());
+ if(!order.getAppUserId().equals(userid)){
+ return R.fail("权限不足");
+ }
+ if(4 != refundPass.getStatus()){
+ return R.fail("操作失败");
+ }
+ refundPass.setStatus(5);
+ refundPass.setCode(pass.getCode());
+ refundPassService.updateById(refundPass);
+ return R.ok();
+ }
+
+
+
+ @ResponseBody
+ @GetMapping("/getOrderRefundPassList")
+ @ApiOperation(value = "获取售后列表数据", tags = {"管理后台-售后管理", "门店后台-售后管理"})
+ public R<PageInfo<OrderRefundPassList>> getOrderRefundPassList(OrderRefundPassListVo refundPassListVo){
+ return R.ok(refundPassService.getOrderRefundPassList(refundPassListVo));
+ }
+
+
+ @ResponseBody
+ @PostMapping("/authPassStatus")
+ @ApiOperation(value = "审核售后", tags = {"管理后台-售后管理", "门店后台-售后管理"})
+ public R authPassStatus(@RequestBody AuthPassStatus authPassStatus){
+ return refundPassService.authPassStatus(authPassStatus.getId(), authPassStatus.getStatus(), authPassStatus.getPassRemark());
+ }
+
+
+ @ResponseBody
+ @PutMapping("/refundPassReceive/{id}")
+ @ApiOperation(value = "售后确认收货操作", tags = {"管理后台-售后管理"})
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "id", value = "售后数据id", required = true, dataType = "long"),
+ })
+ public R refundPassReceive(@PathVariable("id") Long id){
+ return refundPassService.refundPassReceive(id);
+ }
+
+
+
+ @ResponseBody
+ @GetMapping("/getRefundPassInfo/{id}")
+ @ApiOperation(value = "获取售后数据详情", tags = {"管理后台-售后管理", "门店后台-售后管理"})
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "id", value = "售后数据id", required = true, dataType = "long"),
+ })
+ public R<RefundPassInfo> getRefundPassInfo(@PathVariable("id") Long id){
+ RefundPassInfo refundPassInfo = refundPassService.getRefundPassInfo(id);
+ return R.ok(refundPassInfo);
+ }
+
+
}
--
Gitblit v1.7.1