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
package com.ruoyi.device.service;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.device.dto.DeviceMaintenancePlanDetailsDto;
import com.ruoyi.device.dto.DeviceMaintenancePlanDto;
import com.ruoyi.device.pojo.Device;
import com.ruoyi.device.pojo.DeviceMaintenanceAttachment;
import com.ruoyi.device.pojo.DeviceMaintenancePlan;
import com.ruoyi.device.pojo.DeviceMaintenancePlanDetails;
import org.springframework.web.multipart.MultipartFile;
 
import jakarta.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.util.List;
 
/**
 * <p>
 * 设备保养计划表 服务类
 * </p>
 *
 * @author 江苏鵷雏网络科技有限公司
 * @since 2024-12-16 06:10:52
 */
public interface DeviceMaintenancePlanService extends IService<DeviceMaintenancePlan> {
 
    /**
     * 分页查询设备保养计划
     * @param page 当前页
     * @param deviceMaintenancePlanDto 设备保养计划
     * @return
     */
    Result<IPage<DeviceMaintenancePlan>> selectDeviceMaintenancePlanByPage(Page page, DeviceMaintenancePlanDto deviceMaintenancePlanDto);
 
    /**
     * 新增设备保养计划
     *
     * @param deviceMaintenancePlanDto 设备保养计划
     */
    Result addMaintenancePlan(DeviceMaintenancePlanDto deviceMaintenancePlanDto);
 
    /**
     * 修改设备保养计划
     *
     * @param deviceMaintenancePlanDto 设备保养计划
     */
    Result updateMaintenancePlan(DeviceMaintenancePlanDto deviceMaintenancePlanDto);
 
    /**
     * 删除设备保养计划
     * @param deviceMaintenancePlanDto 设备保养计划
     */
    Result deleteMaintenancePlan(DeviceMaintenancePlanDto deviceMaintenancePlanDto);
 
    /**
     * 导出设备保养计划
     *
     * @param maintenancePlanId 设备保养计划id
     * @param response          响应
     */
    Result exportDeviceMaintenancePlanDto(Integer maintenancePlanId, HttpServletResponse response);
 
    /**
     * 查看设备保养计划详情
     * @param maintenancePlanId 设备保养计划id
     * @return
     */
    Result<DeviceMaintenancePlanDto> getMaintenancePlanDetail(Integer maintenancePlanId);
 
    /**
     * 提交审核
     * @param deviceMaintenancePlanDto
     * @return
     */
    Result submitReviewMaintenancePlanStatus(DeviceMaintenancePlanDto deviceMaintenancePlanDto);
 
    /**
     * 审核设备保养计划状态
     * @param deviceMaintenancePlanDto 设备保养计划
     * @return
     */
    Result reviewMaintenancePlanStatus(DeviceMaintenancePlanDto deviceMaintenancePlanDto);
 
    /**
     * 按年份查询设备保养计划(不存在则自动创建),并自动补全已到点的设备明细
     * @param planYear 计划年份
     * @return 设备保养计划
     */
    DeviceMaintenancePlanDto getOrCreatePlanByYear(String planYear);
 
    /**
     * 保养计划年份列表:删除没有任何明细的空年份计划后,返回有明细的年份(倒序)
     * @return 年份列表
     */
    List<String> getMaintenancePlanYears();
 
    /**
     * 设备档案变更后,立即把设备登记到下次保养日期所在年份的设备保养计划明细
     * @param device 设备
     */
    void syncDeviceMaintenanceDetail(Device device);
 
    /**
     * 审核通过后,按审核通过当天滚动设备档案的最近/下次保养日期
     * @param deviceId 设备id
     * @param maintenanceDate 保养完成日期(审核通过当天)
     */
    void updateDeviceMaintenanceDate(Integer deviceId, LocalDate maintenanceDate);
 
    /**
     * 审核通过后,把计划明细归到审核完成年份的计划下(提前完成的明细不再留在原计划年份)
     * @param maintenancePlanDetailId 保养计划明细id
     * @param reviewDate 审核完成日期
     */
    void reclassifyMaintenanceDetailByReviewDate(Integer maintenancePlanDetailId, LocalDate reviewDate);
 
    /**
     * 分页查询设备保养计划详情(含到点标红)
     */
    IPage<DeviceMaintenancePlanDetailsDto> pageMaintenancePlanDetail(Page page, Integer planId, String deviceName, String deviceNumber);
 
    /**
     * 为保养记录找一条可关联的计划明细;没有可用明细时在当前年度计划新增本轮明细
     * @param deviceId 设备id
     * @param maintenancePlanDetailId 指定的计划明细id,为空则自动匹配
     * @param maintenanceDate 保养日期
     */
    DeviceMaintenancePlanDetails resolveMaintenancePlanDetail(Integer deviceId, Integer maintenancePlanDetailId, LocalDate maintenanceDate);
 
    /**
     * 修改设备保养计划详情(已审核的明细不允许修改)
     */
    boolean updateMaintenancePlanDetail(DeviceMaintenancePlanDetails detail);
 
    /**
     * 删除设备保养计划详情;已出审核结果的记录随历史留档,未审核的记录随明细一起删除
     */
    boolean removeMaintenancePlanDetail(Integer maintenancePlanDetailId);
 
    /**
     * 查询计划明细附件列表
     */
    List<DeviceMaintenanceAttachment> selectAttachments(Integer maintenancePlanDetailId);
 
    /**
     * 上传计划明细附件
     */
    DeviceMaintenanceAttachment uploadAttachment(Integer maintenancePlanDetailId, MultipartFile file);
 
    /**
     * 删除计划明细附件
     */
    boolean deleteAttachment(Long id);
}