zhibing.pu
2024-08-17 a6f719ed24305f37528f55babddda516d7317cab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package com.ruoyi.order.controller;
 
 
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.order.api.model.TOrderAppeal;
import com.ruoyi.order.api.query.TOrderAppealQuery;
import com.ruoyi.order.api.vo.TOrderAppealVO;
import com.ruoyi.order.service.TOrderAppealService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xiaochen
 * @since 2024-08-07
 */
@RestController
@RequestMapping("/t-order-appeal")
public class TOrderAppealController {
 
    private final TOrderAppealService orderAppealService;
    private final TokenService tokenService;
 
    @Autowired
    public TOrderAppealController(TOrderAppealService orderAppealService, TokenService tokenService) {
        this.orderAppealService = orderAppealService;
        this.tokenService = tokenService;
    }
 
    /**
     * 查询订单申诉列表
     */
    @ApiOperation(tags = {"小程序-订单申诉"},value = "查询订单申诉分页列表")
    @PostMapping(value = "/pageList")
    public AjaxResult<PageInfo<TOrderAppealVO>> pageList(@RequestBody TOrderAppealQuery query) {
        // TODO 用户id 获取小程序当前登录用户id
        Long userId = tokenService.getLoginUser().getUserid();
        query.setAppUserId(userId);
        return AjaxResult.ok(orderAppealService.pageList(query));
    }
 
    /**
     * 查询订单申诉详情
     */
    @ApiOperation(tags = {"小程序-订单申诉"},value = "查询订单申诉详情")
    @GetMapping(value = "/getDetailById")
    public AjaxResult<TOrderAppealVO> getDetailById(@RequestParam("id") Integer id) {
        return AjaxResult.ok(orderAppealService.getDetailById(id));
    }
    
    
    
    @ResponseBody
    @GetMapping(value = "/addOrderAppeal")
    @ApiOperation(value = "申诉订单", tags = {"小程序-充电记录(个人中心)"})
    public AjaxResult addOrderAppeal(@RequestBody TOrderAppeal orderAppeal){
        Long appUserId = tokenService.getLoginUserApplet().getUserId();
        orderAppeal.setAppUserId(appUserId);
        orderAppeal.setStatus(1);
        orderAppealService.save(orderAppeal);
        return AjaxResult.success();
    }
}