zss
2025-01-13 8d85246f061e3da623c7b9eb4e323ee724b4de0b
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
package com.yuanchu.mom.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.mom.annotation.ValueAuth;
import com.yuanchu.mom.pojo.DeviceAcceptance;
import com.yuanchu.mom.pojo.DeviceAcceptanceFile;
import com.yuanchu.mom.service.DeviceAcceptanceFileService;
import com.yuanchu.mom.service.DeviceAcceptanceService;
import com.yuanchu.mom.utils.JackSonUtil;
import com.yuanchu.mom.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
 
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
 
/**
 * <p>
 * 设备验收(装备) 前端控制器
 * </p>
 *
 * @author 江苏鵷雏网络科技有限公司
 * @since 2024-12-20 01:45:14
 */
@Api(tags = "设备验收(装备)")
@AllArgsConstructor
@RestController
@RequestMapping("/deviceAcceptance")
public class DeviceAcceptanceController {
 
    private DeviceAcceptanceService deviceAcceptanceService;
    private DeviceAcceptanceFileService deviceAcceptanceFileService;
 
    /**
     * 设备验收列表
     * @param data
     * @return
     */
    @ApiOperation(value = "设备验收列表")
    @PostMapping("/pageDeviceAcceptance")
    public Result<IPage<DeviceAcceptance>> pageDeviceAcceptance(@RequestBody Map<String, Object> data) throws Exception {
        Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class);
        DeviceAcceptance deviceAcceptance = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), DeviceAcceptance.class);
        return Result.success(deviceAcceptanceService.pageDeviceAcceptance(page, deviceAcceptance));
    }
 
    /**
     * 查询设备验收
     * @return
     */
    @ApiOperation(value = "查询设备验收")
    @GetMapping("/getDeviceAcceptance")
    public Result getDeviceAcceptance(Integer acceptanceId){
        return Result.success(deviceAcceptanceService.getById(acceptanceId));
    }
 
    /**
     * 删除设备验收
     * @return
     */
    @ApiOperation(value = "删除设备验收")
    @GetMapping("/delDeviceAcceptance")
    public Result delDeviceAcceptance(Integer acceptanceId){
        return Result.success(deviceAcceptanceService.removeById(acceptanceId));
    }
 
    /**
     * 新增设备验收
     * @return
     */
    @ApiOperation(value = "新增设备验收")
    @PostMapping("/addDeviceAcceptance")
    public Result addDeviceAcceptance(@RequestBody DeviceAcceptance deviceAcceptance){
        return Result.success(deviceAcceptanceService.save(deviceAcceptance));
    }
 
    /**
     * 新增设备验收
     * @return
     */
    @ApiOperation(value = "编辑设备验收")
    @PostMapping("/updateDeviceAcceptance")
    public Result updateDeviceAcceptance(@RequestBody DeviceAcceptance deviceAcceptance){
        return Result.success(deviceAcceptanceService.updateById(deviceAcceptance));
    }
 
    /**
     * 设备验收导出
     * @param acceptanceId  设备验收id
     * @param response   响应体
     * @return
     */
    @ValueAuth
    @ApiOperation(value = "设备验收导出")
    @GetMapping("/exportDeviceAcceptance")
    public void exportDeviceAcceptance(Integer acceptanceId, HttpServletResponse response){
        deviceAcceptanceService.exportDeviceAcceptance(acceptanceId, response);
    }
 
    /**
     * 设备验收附件新增
     * @param acceptanceId
     * @param file
     * @return
     */
    @ValueAuth
    @ApiOperation(value = "设备验收附件新增")
    @PostMapping("/uploadDeviceAcceptanceFile")
    public Result<?> uploadDeviceAcceptanceFile(Integer acceptanceId, MultipartFile file) {
        return Result.success(deviceAcceptanceService.uploadDeviceAcceptanceFile(acceptanceId, file));
    }
 
 
    /**
     * 设备验收附件列表
     * @return
     */
    @ValueAuth
    @ApiOperation(value = "设备验收附件列表")
    @GetMapping("/getDeviceAcceptanceFileList")
    public Result<List<DeviceAcceptanceFile>> getVerifyMethodFileList(Integer acceptanceId){
        return Result.success(deviceAcceptanceFileService.list(Wrappers.<DeviceAcceptanceFile>lambdaQuery()
                .eq(DeviceAcceptanceFile::getAcceptanceId, acceptanceId)));
    }
 
    /**
     * 设备验收附件删除
     * @return
     */
    @ValueAuth
    @ApiOperation(value = "设备验收附件删除")
    @GetMapping("/delDeviceAcceptanceFileList")
    public Result delDeviceAcceptanceFileList(Integer acceptanceFileId){
        return Result.success(deviceAcceptanceFileService.removeById(acceptanceFileId));
    }
}