jiangping
2025-04-22 3dd12d913b5d9c2096e53f9d14475c534b813e6b
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package com.doumee.api.web;
 
import com.doumee.config.Jwt.JwtTokenUtil;
import com.doumee.config.annotation.EncryptionReq;
import com.doumee.config.annotation.EncryptionResp;
import com.doumee.config.annotation.LoginRequired;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.ApiResponse;
import com.doumee.dao.business.model.Member;
import com.doumee.dao.web.vo.CategoryVO;
import com.doumee.service.business.CategoryService;
import com.doumee.service.business.MemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.server.ServerWebExchange;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Rk
 * @create 2025/4/8 9:31
 */
@RestController
@Api(tags ="获取分类信息")
@RequestMapping("/web/category")
public class WebCategoryController {
 
    @Resource
    private JwtTokenUtil jwtTokenUtil;
 
    @Resource
    private CategoryService categoryService;
 
    @LoginRequired
    @GetMapping("/categoryTree")
    @ApiOperation("获取分类类别获取分类树")
    @EncryptionReq
    @EncryptionResp
    public ApiResponse<List<CategoryVO>> categoryVOTree(@RequestParam String categoryType,Integer categoryId, @RequestHeader(JwtTokenUtil.HEADER_KEY) String token){
        try {
 
            jwtTokenUtil.getUserInfoByToken(token);
            return ApiResponse.success(categoryService.getCategoryVOTree(categoryType,categoryId));
        }catch (BusinessException e){
            return ApiResponse.failed(e.getCode(),e.getMessage());
        }catch (Exception e){
            return ApiResponse.failed(ResponseStatus.SERVER_ERROR);
        }
    }
 
    @LoginRequired
    @GetMapping("/getCategoryVOForGCXTree")
    @ApiOperation("获取分类类别获取分类树 - 观察项")
    @EncryptionReq
    @EncryptionResp
    public ApiResponse<List<CategoryVO>> getCategoryVOForGCXTree(@RequestParam Integer categoryId, @RequestHeader(JwtTokenUtil.HEADER_KEY) String token){
        try {
 
            jwtTokenUtil.getUserInfoByToken(token);
            return ApiResponse.success(categoryService.getCategoryVOForGCXTree(categoryId));
        }catch (BusinessException e){
            return ApiResponse.failed(e.getCode(),e.getMessage());
        }catch (Exception e){
            return ApiResponse.failed(ResponseStatus.SERVER_ERROR);
        }
    }
 
 
    @LoginRequired
    @GetMapping("/categoryList")
    @ApiOperation("获取分类类别获取分类列表")
    @EncryptionReq
    @EncryptionResp
    public ApiResponse<List<CategoryVO>> categoryList(Integer categoryType,Integer isRoot ,@RequestHeader(JwtTokenUtil.HEADER_KEY) String token){
        try {
            jwtTokenUtil.getUserInfoByToken(token);
            return ApiResponse.success(categoryService.getCategoryVOList(categoryType,isRoot));
        }catch (BusinessException e){
            return ApiResponse.failed(e.getCode(),e.getMessage());
        }catch (Exception e){
            return ApiResponse.failed(ResponseStatus.SERVER_ERROR);
        }
    }
}