EquipmentStatisticsController.java
12.4 KB
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
package com.skua.modules.statistics.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.query.QueryGenerator;
import com.skua.modules.equipment.entity.EquipmentInfo;
import com.skua.modules.equipment.service.IEquipmentInfoService;
import com.skua.modules.equipment.vo.EquipmentNewMaintenancePlanVO;
import com.skua.modules.erp.entity.ErpProblem;
import com.skua.modules.statistics.entity.EquipmentInfoDuration;
import com.skua.modules.statistics.service.IEquipmentInfoDurationService;
import com.skua.modules.statistics.vo.EquipmentFailurelVO;
import com.skua.modules.statistics.service.IEquipmentStatisticsService;
import com.skua.modules.statistics.vo.EquipmentOperationRecordVO;
import com.skua.modules.statistics.vo.EquipmentRepairMaintainTaskCostDetailVO;
import com.skua.modules.statistics.vo.EquipmentRepairMaintainTaskCostVO;
import com.skua.tool.util.JSUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
/**
* @auther kangwei
* @create 2025-03-12-17:38
*/
@Slf4j
@Api(tags = "/设备统计分析")
@RestController
@RequestMapping("/web/equipment/statistics")
public class EquipmentStatisticsController {
@Autowired
private IEquipmentStatisticsService equipmentStatisticsService;
@Autowired
private IEquipmentInfoService equipmentInfoService;
@Autowired
private IEquipmentInfoDurationService equipmentInfoDurationService;
//
@ApiOperation(value = "设备看板-维修维护费用列表", notes = "设备看板-维修维护费用列表")
@GetMapping(value = "/repairMaintainTaskCostList")
public Result<List<EquipmentRepairMaintainTaskCostVO>> repairMaintainTaskCostList( String startTime, String endTime) {
Result<List<EquipmentRepairMaintainTaskCostVO>> result = new Result<>();
try {
String departIds = BaseContextHandler.getDeparts();
List<EquipmentRepairMaintainTaskCostVO> dataList = equipmentStatisticsService.repairMaintainTaskCostList(JSUtils.quoteEach(departIds,","),startTime,endTime);
result.setSuccess(true);
result.setResult(dataList);
} catch (Exception e) {
log.error("维修维护费用列表", e.getMessage());
result.error500("维修维护费用列表");
}
return result;
}
@ApiOperation(value = "设备看板-维修维护费用-详情列表", notes = "设备看板-维修维护费用-详情列表")
@GetMapping(value = "/repairMaintainTaskCostDetailList")
public Result<List<EquipmentRepairMaintainTaskCostDetailVO>> repairMaintainTaskCostDetailList(String departId, String startTime, String endTime) {
Result<List<EquipmentRepairMaintainTaskCostDetailVO>> result = new Result<>();
try {
List<EquipmentRepairMaintainTaskCostDetailVO> dataList = equipmentStatisticsService.repairMaintainTaskCostDetailList(departId,startTime,endTime);
result.setSuccess(true);
result.setResult(dataList);
} catch (Exception e) {
log.error("设备看板-维修维护费用-详情列表", e.getMessage());
result.error500("异常:"+e.getMessage());
}
return result;
}
@ApiOperation(value = "A类设备运行情况-故障信息", notes = "A类设备运行情况-故障信息")
@GetMapping(value = "/equipmentFailurePage")
public Result<IPage<EquipmentFailurelVO>> queryEquipmentFailurePage(EquipmentFailurelVO equipmentFailurelVO,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
Result<IPage<EquipmentFailurelVO>> result = new Result<>();
Page<EquipmentFailurelVO> page = new Page<EquipmentFailurelVO>(pageNo, pageSize);
try {
/* if(StringUtils.isNotEmpty(equipmentFailurelVO.getStartTime())){
equipmentFailurelVO.setStartTime( equipmentFailurelVO.getStartTime()+" 00:00:00");
}
if(StringUtils.isNotEmpty(equipmentFailurelVO.getEndTime())){
equipmentFailurelVO.setEndTime( equipmentFailurelVO.getEndTime()+" 23:59:59");
}*/
IPage<EquipmentFailurelVO> dataList = equipmentStatisticsService.queryEquipmentFailurePage(page,equipmentFailurelVO);
result.setSuccess(true);
result.setResult(dataList);
} catch (Exception e) {
log.error("A类设备运行情况-故障信息", e.getMessage());
result.error500("异常:"+e.getMessage());
}
return result;
}
@ApiOperation(value = "A类设备运行情况-故障信息--故障信号列表", notes = "A类设备运行情况-故障信息--故障信号列表")
@GetMapping(value = "/equipmentAlarmList")
public Result<List<Map<String,Object>>> queryEquipmentAlarmList(String equipmentId, String startTime, String endTime) {
Result<List<Map<String,Object>>> result = new Result<>();
try {
List<Map<String,Object>> dataList = equipmentStatisticsService.queryEquipmentAlarmList(equipmentId,startTime,endTime);
result.setSuccess(true);
result.setResult(dataList);
} catch (Exception e) {
log.error("A类设备运行情况-故障信息--故障信号列表", e.getMessage());
result.error500("异常:"+e.getMessage());
}
return result;
}
/* @ApiOperation(value = "A类设备运行情况-运行时长", notes = "A类设备运行情况-故障信息--故障工单列表")
@GetMapping(value = "/equipmentOperationRecordList")
public Result<List<EquipmentOperationRecordVO>> equipmentOperationRecordList(String departIds, String startTime, String endTime) {
Result<List<EquipmentOperationRecordVO>> result = new Result<>();
try {
List<EquipmentOperationRecordVO> dataList = equipmentStatisticsService.queryEquipmentOperationRecordList(departIds,startTime,endTime);
result.setSuccess(true);
result.setResult(dataList);
} catch (Exception e) {
log.error("A类设备运行情况-故障信息--故障工单列表", e.getMessage());
result.error500("异常:"+e.getMessage());
}
return result;
}*/
@AutoLog(value = "A类设备运行情况-健康度")
@ApiOperation(value = "A类设备运行情况-健康度", notes = "A类设备运行情况-健康度")
@GetMapping(value = "/queryEquipmentInfoByPage")
public Result<IPage<EquipmentInfo>> queryEquipmentInfoByPage(EquipmentInfo equipmentInfo, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize ,HttpServletRequest req ) throws Exception {
Result<IPage<EquipmentInfo>> result = new Result<IPage<EquipmentInfo>>();
QueryWrapper<EquipmentInfo> queryWrapper = QueryGenerator.initQueryWrapper(equipmentInfo, req.getParameterMap());
// queryWrapper.eq("depart_id", BaseContextHandler.getRealDepartId());
/* if(equipmentInfo.getDepartId()==null){
equipmentInfo.setDepartId(BaseContextHandler.getDeparts());
}*/
/* if(model==1){
queryWrapper.isNotNull("digital_twins_struct_code");
queryWrapper.last(" and digital_twins_struct_code != ''");
}*/
Page<EquipmentInfo> page = new Page<EquipmentInfo>(pageNo, pageSize);
// queryWrapper.orderByDesc("create_time");
IPage<EquipmentInfo> pageList = equipmentInfoService.page(page,queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
@AutoLog(value = "A类设备运行情况-运行时长")
@ApiOperation(value = "A类设备运行情况-运行时长", notes = "A类设备运行情况-运行时长")
@GetMapping(value = "/queryEquipmentInfoDurationByPage")
public Result<IPage<EquipmentInfoDuration>> queryEquipmentInfoDurationByPage(EquipmentInfoDuration equipmentInfo, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize , HttpServletRequest req ) throws Exception {
Result<IPage<EquipmentInfoDuration>> result = new Result<IPage<EquipmentInfoDuration>>();
QueryWrapper<EquipmentInfoDuration> queryWrapper = QueryGenerator.initQueryWrapper(equipmentInfo, req.getParameterMap());
// queryWrapper.eq("depart_id", BaseContextHandler.getRealDepartId());
/* if(equipmentInfo.getDepartId()==null){
equipmentInfo.setDepartId(BaseContextHandler.getDeparts());
}*/
/* if(model==1){
queryWrapper.isNotNull("digital_twins_struct_code");
queryWrapper.last(" and digital_twins_struct_code != ''");
}*/
Page<EquipmentInfoDuration> page = new Page<EquipmentInfoDuration>(pageNo, pageSize);
// queryWrapper.orderByDesc("create_time");
IPage<EquipmentInfoDuration> pageList = equipmentInfoDurationService.queryPageList(page,queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
@ApiOperation(value = "A类设备运行-设备运行时长--详情列表", notes = "A类设备运行-设备运行时长--详情列表")
@GetMapping(value = "/equipmentOperationRecordList")
public Result<List<Map<String, Object>>> equipmentOperationRecordDetail(String departId,String equipmentId, String startTime, String endTime) {
Result<List<Map<String, Object>>> result = new Result<>();
try {
List<Map<String, Object>> dataList = equipmentStatisticsService.queryEquipmentOperationRecordDetail(departId,equipmentId,startTime,endTime);
result.setSuccess(true);
result.setResult(dataList);
} catch (Exception e) {
log.error("维修维护费用列表", e.getMessage());
result.error500("维修维护费用列表");
}
return result;
}
/* @ApiOperation(value = "设备看板-设备故障分页列表", notes = "设备看板-设备故障分页列表")
@GetMapping(value = "/equipmentFailurePage")
public Result<IPage<EquipmentInfo>> queryEquipmentFailurePage(EquipmentInfo equipmentInfo,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<EquipmentInfo>> result = new Result<>();
Page<EquipmentInfo> page = new Page<EquipmentInfo>(pageNo, pageSize);
try {
*//* if(StringUtils.isNotEmpty(equipmentFailurelVO.getStartTime())){
equipmentFailurelVO.setStartTime( equipmentFailurelVO.getStartTime()+" 00:00:00");
}
if(StringUtils.isNotEmpty(equipmentFailurelVO.getEndTime())){
equipmentFailurelVO.setEndTime( equipmentFailurelVO.getEndTime()+" 23:59:59");
}*//*
QueryWrapper<EquipmentInfo> queryWrapper = QueryGenerator.initQueryWrapper(equip mentInfo, req.getParameterMap());
IPage<EquipmentInfo> pageList = equipmentInfoService.page(page,queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
} catch (Exception e) {
log.error("维修维护费用列表", e.getMessage());
result.error500("维修维护费用列表");
}
return result;
}*/
}