jiangping
2025-04-18 0960aa02e50db0860d5d515dd7a46b302e599f1c
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
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.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.model.Managers;
import com.doumee.dao.business.model.Member;
import com.doumee.dao.business.model.Workorder;
import com.doumee.dao.web.dto.*;
import com.doumee.dao.web.vo.WorkOrderDataVO;
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.apache.shiro.authz.annotation.RequiresPermissions;
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: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) {
        try {
            Member user =  jwtTokenUtil.getUserInfoByToken(token);
            workorder.setMemberId(user.getId());
            return ApiResponse.success(workorderService.create(workorder));
        }catch (BusinessException e){
            return ApiResponse.failed(e.getCode(),e.getMessage());
        }catch (Exception e){
            e.printStackTrace();
            return ApiResponse.failed(ResponseStatus.SERVER_ERROR);
        }
    }
 
 
    @LoginRequired
    @ApiOperation("通知人查询")
    @PostMapping("/managersList")
    public ApiResponse<List<Managers>> managersList (@RequestBody Managers model, @RequestHeader(JwtTokenUtil.HEADER_KEY) String token) {
        try {
 
            return ApiResponse.success(managersService.findList(model));
        }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) {
        try {
            return ApiResponse.success(workorderService.getDetail(id,jwtTokenUtil.getUserInfoByToken(token)));
        }catch (BusinessException e){
            return ApiResponse.failed(e.getCode(),e.getMessage());
        }catch (Exception e){
            e.printStackTrace();
            return ApiResponse.failed(ResponseStatus.SERVER_ERROR);
        }
    }
 
 
 
    @LoginRequired
    @ApiOperation("工单关闭")
    @PostMapping("/closeWorkOrder")
    public ApiResponse closeWorkOrder(@RequestBody CloseDTO closeDTO, @RequestHeader(JwtTokenUtil.HEADER_KEY) String token) {
        try {
            closeDTO.setMember(jwtTokenUtil.getUserInfoByToken(token));
            workorderService.closeWorkOrder(closeDTO);
            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("工单指派")
    @PostMapping("/passOn")
    public ApiResponse passOn(@RequestBody PassOnDTO passOnDTO, @RequestHeader(JwtTokenUtil.HEADER_KEY) String token) {
        try {
            passOnDTO.setMember(jwtTokenUtil.getUserInfoByToken(token));
            workorderService.passOn(passOnDTO);
            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("/urge")
    public ApiResponse urge(@RequestParam Integer workorderId, @RequestHeader(JwtTokenUtil.HEADER_KEY) String token) {
        try {
            workorderService.urge(workorderId,jwtTokenUtil.getUserInfoByToken(token));
            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("工单抄送")
    @PostMapping("/sendCopy")
    public ApiResponse sendCopy(@RequestBody SendCopyDTO sendCopyDTO, @RequestHeader(JwtTokenUtil.HEADER_KEY) String token) {
        try {
            sendCopyDTO.setMember(jwtTokenUtil.getUserInfoByToken(token));
            workorderService.sendCopy(sendCopyDTO);
            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("SHE、跌绊滑报表")
    @PostMapping("/getWorkOrderData")
    public ApiResponse<List<WorkOrderDataVO>> getWorkOrderData(@RequestBody OrderDataDTO orderDataDTO, @RequestHeader(JwtTokenUtil.HEADER_KEY) String token) {
        try {
 
            return ApiResponse.success(workorderService.getWorkOrderData(orderDataDTO));
        }catch (BusinessException e){
            return ApiResponse.failed(e.getCode(),e.getMessage());
        }catch (Exception e){
            e.printStackTrace();
            return ApiResponse.failed(ResponseStatus.SERVER_ERROR);
        }
    }
 
 
 
    @LoginRequired
    @ApiOperation("分页查询")
    @PostMapping("/page")
    public ApiResponse<PageData<Workorder>> findPage (@RequestBody PageWrap<Workorder> pageWrap,@RequestHeader(JwtTokenUtil.HEADER_KEY) String token) {
        try {
            Member member = jwtTokenUtil.getUserInfoByToken(token);
            pageWrap.getModel().setQwId(member.getQwId());
            return ApiResponse.success(workorderService.findPage(pageWrap));
        }catch (BusinessException e){
            return ApiResponse.failed(e.getCode(),e.getMessage());
        }catch (Exception e){
            e.printStackTrace();
            return ApiResponse.failed(ResponseStatus.SERVER_ERROR);
        }
 
 
    }
 
}