吴羡
5 小时以前 2f07589b54d56085af77b50d580890cd4130b444
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
package com.ruoyi.device.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.device.dto.DeviceMaintenancePlanDetailsDto;
import com.ruoyi.device.dto.DeviceMaintenancePlanDto;
import com.ruoyi.device.pojo.DeviceMaintenancePlan;
import com.ruoyi.device.pojo.DeviceMaintenancePlanDetails;
import com.ruoyi.device.service.DeviceMaintenancePlanDetailsService;
import com.ruoyi.device.service.DeviceMaintenancePlanService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.SneakyThrows;
import org.springframework.web.bind.annotation.*;
 
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import java.util.Map;
 
/**
 * <p>
 * 设备保养计划表 前端控制器
 * </p>
 *
 * @author 江苏鵷雏网络科技有限公司
 * @since 2024-12-16 06:10:52
 */
@Tag(name = "设备保养计划")
@RestController
@RequestMapping("/deviceMaintenancePlan")
public class DeviceMaintenancePlanController {
    @Resource
    private DeviceMaintenancePlanService deviceMaintenancePlanService;
 
    @Resource
    private DeviceMaintenancePlanDetailsService deviceMaintenancePlanDetailsService;
 
    /**
     * 分页查询设备保养计划
     * @return
     */
    @Operation(summary = "分页查询设备保养计划")
    @GetMapping("selectDeviceMaintenancePlanByPage")
    public Result<IPage<DeviceMaintenancePlan>> selectDeviceMaintenancePlanByPage(Page page, DeviceMaintenancePlanDto itemParameter){
        return deviceMaintenancePlanService.selectDeviceMaintenancePlanByPage(page, itemParameter);
    }
 
    /**
     * 新增设备保养计划
     * @param deviceMaintenancePlanDto 设备保养计划
     */
    @Operation(summary = "新增设备保养计划")
    @PostMapping("/addMaintenancePlan")
    public Result addMaintenancePlan(@RequestBody DeviceMaintenancePlanDto deviceMaintenancePlanDto) {
        return deviceMaintenancePlanService.addMaintenancePlan(deviceMaintenancePlanDto);
    }
 
    /**
     * 修改设备保养计划
     * @param deviceMaintenancePlanDto 设备保养计划
     */
    @Operation(summary = "修改设备保养计划")
    @PostMapping("/updateMaintenancePlan")
    public Result updateMaintenancePlan(@RequestBody DeviceMaintenancePlanDto deviceMaintenancePlanDto) {
        return deviceMaintenancePlanService.updateMaintenancePlan(deviceMaintenancePlanDto);
    }
 
    /**
     * 删除设备保养计划
     * @param deviceMaintenancePlanDto 设备保养计划
     */
    @Operation(summary = "删除设备保养计划")
    @DeleteMapping("/deleteMaintenancePlan")
    public Result deleteMaintenancePlan(DeviceMaintenancePlanDto deviceMaintenancePlanDto) {
        return deviceMaintenancePlanService.deleteMaintenancePlan(deviceMaintenancePlanDto);
    }
 
    /**
     * 查询设备保养计划详情
     */
    @Operation(summary = "查询设备保养计划详情")
    @GetMapping("/getMaintenancePlanDetail")
    public Result<DeviceMaintenancePlanDto> getMaintenancePlanDetail(Integer maintenancePlanId) {
        return deviceMaintenancePlanService.getMaintenancePlanDetail(maintenancePlanId);
    }
 
    /**
     * 按年份查询设备保养计划(不存在则自动创建),并自动补全已到点的设备明细
     */
    @Operation(summary = "按年份查询设备保养计划(自动创建并补全到点明细)")
    @GetMapping("/getPlanByYear")
    public Result<DeviceMaintenancePlanDto> getPlanByYear(String planYear) {
        return Result.success(deviceMaintenancePlanService.getOrCreatePlanByYear(planYear));
    }
 
    /**
     * 设备保养计划详情列表(含到点标红)
     */
    @Operation(summary = "设备保养计划详情列表")
    @GetMapping("/pageMaintenancePlanDetail")
    public Result<IPage<DeviceMaintenancePlanDetailsDto>> pageMaintenancePlanDetail(Page page, Integer planId, String deviceName, String deviceNumber) {
        return Result.success(deviceMaintenancePlanService.pageMaintenancePlanDetail(page, planId, deviceName, deviceNumber));
    }
 
    /**
     * 修改设备保养计划详情
     */
    @Operation(summary = "修改设备保养计划详情")
    @PostMapping("/updateMaintenancePlanDetail")
    public Result updateMaintenancePlanDetail(@RequestBody DeviceMaintenancePlanDetails deviceMaintenancePlanDetails) {
        return Result.success(deviceMaintenancePlanDetailsService.updateById(deviceMaintenancePlanDetails));
    }
 
    /**
     * 删除设备保养计划详情
     */
    @Operation(summary = "删除设备保养计划详情")
    @DeleteMapping("/delMaintenancePlanDetail")
    public Result delMaintenancePlanDetail(Integer maintenancePlanDetailId) {
        return Result.success(deviceMaintenancePlanDetailsService.removeById(maintenancePlanDetailId));
    }
 
    /**
     * 导出设备保养计划
     */
    @Operation(summary = "导出设备保养计划")
    @GetMapping("/exportDeviceMaintenancePlan")
    public Result exportDeviceMaintenancePlan(@RequestParam("maintenancePlanId") Integer maintenancePlanId, HttpServletResponse response) {
        return deviceMaintenancePlanService.exportDeviceMaintenancePlanDto(maintenancePlanId, response);
    }
 
    /**
     * 提交审核
     */
    @Operation(summary = "提交审核")
    @PostMapping("/submitReviewMaintenancePlanStatus")
    public Result submitReviewMaintenancePlanStatus(@RequestBody DeviceMaintenancePlanDto deviceMaintenancePlanDto) {
        return deviceMaintenancePlanService.submitReviewMaintenancePlanStatus(deviceMaintenancePlanDto);
    }
 
    /**
     * 审核设备保养计划状态
     */
    @Operation(summary = "审核设备保养计划状态")
    @PostMapping("/reviewMaintenancePlanStatus")
    public Result reviewMaintenancePlanStatus(@RequestBody DeviceMaintenancePlanDto deviceMaintenancePlanDto) {
        return deviceMaintenancePlanService.reviewMaintenancePlanStatus(deviceMaintenancePlanDto);
    }
}