k94314517
2025-04-08 5689b40db45e6492921e7c8b6a4226972f1da767
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
package com.doumee.api.web;
 
import com.doumee.config.Jwt.JwtTokenUtil;
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.business.model.Workorder;
import com.doumee.dao.web.dto.UpdEmailDTO;
import com.doumee.service.business.ManagersService;
import com.doumee.service.business.MemberService;
import com.doumee.service.business.WorkorderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.java.Log;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.server.ServerWebExchange;
 
import javax.annotation.Resource;
 
/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Rk
 * @create 2025/4/8 9:35
 */
@RestController
@Api(tags ="工单上报")
@RequestMapping("/web/workOrder")
public class WebWorkOrderController {
 
 
    @Resource
    private JwtTokenUtil jwtTokenUtil;
 
    @Resource
    private WorkorderService workorderService;
 
    @Resource
    private ManagersService managersService;
 
 
 
    @LoginRequired
    @ApiOperation("风险上报")
    @PostMapping("/create")
    public ApiResponse create (@RequestBody Workorder workorder, @RequestHeader(JwtTokenUtil.HEADER_KEY) String token, ServerWebExchange serverWebExchange) {
        try {
            ServerHttpRequest request = serverWebExchange.getRequest();
            Member user =  jwtTokenUtil.getUserInfoByToken(token);
            workorder.setMemberId(user.getId());
            workorderService.create(workorder);
            return ApiResponse.success("操作成功");
        }catch (BusinessException e){
            return ApiResponse.failed(e.getCode(),e.getMessage());
        }catch (Exception e){
            e.printStackTrace();
            return ApiResponse.failed(ResponseStatus.SERVER_ERROR);
        }
    }
 
 
 
    @LoginRequired
    @ApiOperation("风险上报详情")
    @GetMapping("/detail")
    public ApiResponse<Workorder> detail (@RequestParam Integer id, @RequestHeader(JwtTokenUtil.HEADER_KEY) String token, ServerWebExchange serverWebExchange) {
        try {
            ServerHttpRequest request = serverWebExchange.getRequest();
            return ApiResponse.success(workorderService.getDetail(id));
        }catch (BusinessException e){
            return ApiResponse.failed(e.getCode(),e.getMessage());
        }catch (Exception e){
            e.printStackTrace();
            return ApiResponse.failed(ResponseStatus.SERVER_ERROR);
        }
    }
 
 
 
 
 
 
 
 
}