diff --git a/imt-server/imt-module-data/imt-module-data-api/src/main/java/com/inspur/module/data/DataQueryApi.java b/imt-server/imt-module-data/imt-module-data-api/src/main/java/com/inspur/module/data/DataQueryApi.java new file mode 100644 index 0000000..6786838 --- /dev/null +++ b/imt-server/imt-module-data/imt-module-data-api/src/main/java/com/inspur/module/data/DataQueryApi.java @@ -0,0 +1,19 @@ +package com.inspur.module.data; + +import java.util.Map; + +/** + * @Author zhangjunwen + * @create 2024/10/10 + */ +public interface DataQueryApi { + /** + * 获取最新一条fanuc数据 + */ + public Map getLatestFanucData(String equipId); + + /** + * 获取最老一条fanuc数据 + */ + public Map getOldestFanucData(String equipId); +} diff --git a/imt-server/imt-module-data/imt-module-data-biz/pom.xml b/imt-server/imt-module-data/imt-module-data-biz/pom.xml index 01115e3..524ae8b 100644 --- a/imt-server/imt-module-data/imt-module-data-biz/pom.xml +++ b/imt-server/imt-module-data/imt-module-data-biz/pom.xml @@ -18,6 +18,12 @@ + + com.inspur + imt-module-data-api + 2.2.0-jdk8-snapshot + + com.inspur imt-common diff --git a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/api/DataQueryApiImpl.java b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/api/DataQueryApiImpl.java new file mode 100644 index 0000000..f9d68c0 --- /dev/null +++ b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/api/DataQueryApiImpl.java @@ -0,0 +1,36 @@ +package com.inspur.module.data.api; + +import com.inspur.module.data.DataQueryApi; +import com.inspur.module.data.service.IDataQueryService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Map; + +/** + * @Author zhangjunwen + * @create 2024/10/10 + */ +@Service +public class DataQueryApiImpl implements DataQueryApi { + + @Resource + private IDataQueryService dataQueryService; + + @Override + public Map getLatestFanucData(String equipId) { + String columns = "power_time,process_num,total_process,work_time"; + Map latestDataMap = dataQueryService.getLatestData(equipId,"gateway_fanuc_data", columns); + return latestDataMap; + } + + /** + * 获取最老一条fanuc数据 + */ + @Override + public Map getOldestFanucData(String equipId){ + String columns = "power_time,process_num,total_process,work_time"; + Map oldestDataMap = dataQueryService.getOldestData(equipId,"gateway_fanuc_data", columns); + return oldestDataMap; + } +} diff --git a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/DataQueryController.java b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/DataQueryController.java index 6865416..6a808e7 100644 --- a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/DataQueryController.java +++ b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/DataQueryController.java @@ -149,7 +149,7 @@ public class DataQueryController { HttpServletResponse response) throws IOException, ParseException { List list = (List)dataQueryService.selectDataListByPages(equipId,tableName,startTime,endTime,null,null).get("list"); // 导出 Excel - ExcelUtils.write(response, "机床振动参数报警记录.xls", "振动数据", VibrDataRespVO.class, + ExcelUtils.write(response, "机床加速度参数报警记录.xls", "加速度数据", VibrDataRespVO.class, BeanUtils.toBean(list, VibrDataRespVO.class)); } diff --git a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/vo/CurrentDataRespVO.java b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/vo/CurrentDataRespVO.java index 6bf9d50..815524b 100644 --- a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/vo/CurrentDataRespVO.java +++ b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/vo/CurrentDataRespVO.java @@ -14,10 +14,10 @@ public class CurrentDataRespVO { @ExcelProperty("时间") private String time; - @ExcelProperty("x轴推屑电流") - private String x_push_temp; + @ExcelProperty("排屑1电流(A)") + private String chip_removal_1; - @ExcelProperty("y轴推屑电流") - private String y_push_temp; + @ExcelProperty("排屑2电流(A)") + private String chip_removal_2; } diff --git a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/vo/PressDataRespVO.java b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/vo/PressDataRespVO.java index d4ff859..b00b21a 100644 --- a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/vo/PressDataRespVO.java +++ b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/vo/PressDataRespVO.java @@ -15,12 +15,12 @@ public class PressDataRespVO { @ExcelProperty("时间") private String time; - @ExcelProperty("x轴润滑压力") - private String x_lube_press; + @ExcelProperty("液压1(bar)") + private String hy_1; - @ExcelProperty("y轴润滑压力") - private String y_lube_press; + @ExcelProperty("液压2(bar)") + private String hy_2; - @ExcelProperty("z轴润滑压力") - private String z_lube_press; + @ExcelProperty("液压3(bar)") + private String hy_3; } diff --git a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/vo/ProcessDataRespVO.java b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/vo/ProcessDataRespVO.java index 39e87ab..3932ba7 100644 --- a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/vo/ProcessDataRespVO.java +++ b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/vo/ProcessDataRespVO.java @@ -14,15 +14,15 @@ public class ProcessDataRespVO { @ExcelProperty("时间") private String time; - @ExcelProperty("加工总件数") - private String work_total; + @ExcelProperty("加工总件数(件)") + private String total_process; - @ExcelProperty("加工时长") + @ExcelProperty("加工件数(件)") + private String process_num; + + @ExcelProperty("加工时长(分钟)") private String work_time; - @ExcelProperty("通电时间") - private String on_time; - - @ExcelProperty("加工件数") - private String work_items; + @ExcelProperty("通电时间(分钟)") + private String power_time; } diff --git a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/vo/TempDataRespVO.java b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/vo/TempDataRespVO.java index 5a46d0f..f81c863 100644 --- a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/vo/TempDataRespVO.java +++ b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/vo/TempDataRespVO.java @@ -14,12 +14,36 @@ public class TempDataRespVO { @ExcelProperty("时间") private String time; - @ExcelProperty("x轴轴承温度") - private String x_bear_temp; + @ExcelProperty("X+温度(℃)") + private String xp_temp; - @ExcelProperty("y轴轴承温度") - private String y_bear_temp; + @ExcelProperty("X0温度(℃)") + private String x0_temp; - @ExcelProperty("x轴轴承温度") - private String z_bear_temp; + @ExcelProperty("X-温度(℃)") + private String xn_temp; + + @ExcelProperty("Y+温度(℃)") + private String yp_temp; + + @ExcelProperty("Y0温度(℃)") + private String y0_temp; + + @ExcelProperty("Y-温度(℃)") + private String yn_temp; + + @ExcelProperty("Z+温度(℃)") + private String zp_temp; + + @ExcelProperty("Z0温度(℃)") + private String z0_temp; + + @ExcelProperty("Z-温度(℃)") + private String zn_temp; + + @ExcelProperty("排屑1温度(℃)") + private String cr1_temp; + + @ExcelProperty("排屑2温度(℃)") + private String cr2_temp; } diff --git a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/vo/VibrDataRespVO.java b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/vo/VibrDataRespVO.java index ab78a6b..ed36607 100644 --- a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/vo/VibrDataRespVO.java +++ b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/controller/admin/query/vo/VibrDataRespVO.java @@ -14,6 +14,57 @@ public class VibrDataRespVO { @ExcelProperty("时间") private String time; - @ExcelProperty("y轴熵值") - private String x_entropy; + @ExcelProperty("X加速度RMS") + private String x_aclr_rms; + + @ExcelProperty("Y加速度RMS") + private String y_aclr_rms; + + @ExcelProperty("Z加速度RMS") + private String z_aclr_rms; + + @ExcelProperty("X速度RMS") + private String x_speed_rms; + + @ExcelProperty("Y速度RMS") + private String y_speed_rms; + + @ExcelProperty("Z速度RMS") + private String z_speed_rms; + + @ExcelProperty("X位移RMS") + private String x_dis_rms; + + @ExcelProperty("Y位移RMS") + private String y_dis_rms; + + @ExcelProperty("Z位移RMS") + private String z_dis_rms; + + @ExcelProperty("X加速度峰值") + private String x_aclr_peak; + + @ExcelProperty("Y加速度峰值") + private String y_aclr_peak; + + @ExcelProperty("Z加速度峰值") + private String z_aclr_peak; + + @ExcelProperty("X速度峰值") + private String x_speed_peak; + + @ExcelProperty("Y速度峰值") + private String y_speed_peak; + + @ExcelProperty("Z速度峰值") + private String z_speed_peak; + + @ExcelProperty("X位移峰值") + private String x_dis_peak; + + @ExcelProperty("Y位移峰值") + private String y_dis_peak; + + @ExcelProperty("Z位移峰值") + private String z_dis_peak; } diff --git a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/mqtt/MyMqttCallback.java b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/mqtt/MyMqttCallback.java index 16db6af..b94dc3a 100644 --- a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/mqtt/MyMqttCallback.java +++ b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/mqtt/MyMqttCallback.java @@ -6,6 +6,7 @@ import com.inspur.module.data.service.InfluxDBService; import com.inspur.module.system.api.alarm.AlarmRulesApi; import com.inspur.module.system.api.alarm.dto.AlarmRulesRespDTO; import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDO; +import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDetailsDTO; import com.inspur.module.system.service.gatewayinfo.GatewayInfoService; import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; import org.eclipse.paho.client.mqttv3.MqttCallback; @@ -139,7 +140,7 @@ public class MyMqttCallback implements MqttCallback { */ private Map getGatewayMapping(String gatewayCode) { GatewayInfoService gatewayInfoService = SpringUtils.getBean(GatewayInfoService.class); - GatewayInfoDO gatewayInfo = gatewayInfoService.getGatewayInfoByGatewayCode(gatewayCode); + GatewayInfoDetailsDTO gatewayInfo = gatewayInfoService.getGatewayInfoByGatewayCode(gatewayCode); if(gatewayInfo == null){ return null; } @@ -244,7 +245,7 @@ public class MyMqttCallback implements MqttCallback { fields.put(v,(Double.parseDouble(msg.get(k).toString()) - 400) * 1.25); break; case "temp": - fields.put(v,Double.parseDouble(msg.get(k).toString()) * 0.1); + fields.put(v,Double.parseDouble(msg.get(k).toString()) / 10.0); break; default: fields.put(v,msg.get(k)); @@ -258,7 +259,7 @@ public class MyMqttCallback implements MqttCallback { int alarmNum = alarmRulesApi.alarmRulesFilter(fields, rules); logger.info("本次产生报警{}条",alarmNum); } - influxDBService.insert(measurement,tags, fields); + influxDBService.insert(measurement, tags, fields); logger.info("数据已插入{}表中!",measurement); } diff --git a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/service/DataQueryService.java b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/service/DataQueryService.java index db95a7e..e269d5a 100644 --- a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/service/DataQueryService.java +++ b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/service/DataQueryService.java @@ -1,5 +1,6 @@ package com.inspur.module.data.service; +import cn.hutool.core.collection.CollUtil; import com.inspur.framework.common.util.date.DateUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -7,6 +8,7 @@ import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import java.text.ParseException; +import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoUnit; @@ -23,16 +25,16 @@ import java.util.stream.Collectors; @Service @Validated @Slf4j -public class DataQueryService implements IDataQueryService{ +public class DataQueryService implements IDataQueryService { @Autowired private InfluxDBService influxDBService; @Override - public Map selectDataListByPages(String equipId,String tableName,String startTime,String endTime, Integer pageSize, Integer pageNum){ + public Map selectDataListByPages(String equipId, String tableName, String startTime, String endTime, Integer pageSize, Integer pageNum) { Map resMap = new HashMap<>(); //TODO 分页查找条数,根据设备id、表名、时间范围、页码、每页条数 - List> dataList = queryDataByTime(tableName, null, startTime, endTime, pageNum, pageSize); + List> dataList = queryDataByTime(tableName, equipId, startTime, endTime, pageNum, pageSize); dataList.forEach(map -> { try { String time = map.get("time").toString(); @@ -41,10 +43,14 @@ public class DataQueryService implements IDataQueryService{ throw new RuntimeException(e); } }); - //TODO 时间需要将查询到的UTC时间转为系统时间(北京时间) + //TODO 时间需要将查询到的UTC时间转为系统时间(北京时间) // DateUtils.tranUTC2LocalDateTime("2024-08-28T08:00:00Z"); //TODO 查询数据总条数 - long total = countDataList(tableName, "x_push_temp", null, startTime, endTime); + long total = 0L; + if (dataList.size() != 0) { + List keys = new ArrayList<>(dataList.get(0).keySet()); + total = countDataList(tableName, keys.get(0), null, startTime, endTime); + } resMap.put("list", dataList); resMap.put("total", total); return resMap; @@ -70,13 +76,13 @@ public class DataQueryService implements IDataQueryService{ // } List> list = selectDataByColumnNameandDateSegmentation(equipId, tableName, columnName, startTime, endTime, intervalHours); Map resMap = new HashMap<>(); - if (list.size() == 0){ + if (list.size() == 0) { return null; } List columnList = new ArrayList<>(); - List timelist = new ArrayList<>(); - if(intervalHours > 6){ + List timelist = new ArrayList<>(); + if (intervalHours > 6) { columnName = "mean"; } for (Map data : list) { @@ -93,49 +99,49 @@ public class DataQueryService implements IDataQueryService{ /** * 根据设备id获取排屑电流数据 */ - public Map getCurrentData(String equipId, String startTime, String endTime){ + public Map getCurrentData(String equipId, String startTime, String endTime) { String tableName = "gateway_current_data"; String columnName = "chip_removal_1,chip_removal_2"; - return getAllData2ChartData(equipId,tableName,columnName, startTime, endTime); + return getAllData2ChartData(equipId, tableName, columnName, startTime, endTime); } /** * 根据设备id获取液压数据 */ - public Map getPressData(String equipId, String startTime, String endTime){ + public Map getPressData(String equipId, String startTime, String endTime) { String tableName = "gateway_hy_data"; String columnName = "hy_1,hy_2,hy_3"; - return getAllData2ChartData(equipId,tableName,columnName, startTime, endTime); + return getAllData2ChartData(equipId, tableName, columnName, startTime, endTime); } /** * 根据设备id获取温度数据 */ - public Map getTempData(String equipId, String startTime, String endTime){ + public Map getTempData(String equipId, String startTime, String endTime) { String tableName = "gateway_temp_data"; String columnName = "cr1_temp,cr2_temp,x0_temp,xp_temp,xn_temp,y0_temp,yp_temp,yn_temp,z0_temp,zp_temp,zn_temp"; - return getAllData2ChartData(equipId,tableName,columnName, startTime, endTime); + return getAllData2ChartData(equipId, tableName, columnName, startTime, endTime); } /** * 根据设备id获取振动数据 */ - public Map getVibrData(String equipId, String startTime, String endTime){ + public Map getVibrData(String equipId, String startTime, String endTime) { String tableName = "gateway_aclr_data"; String columnName = "x_aclr_rms,x_speed_rms,x_dis_rms,y_aclr_rms,y_speed_rms,y_dis_rms,z_aclr_rms,z_speed_rms,z_dis_rms," + "x_aclr_peak,x_speed_peak,x_dis_peak,y_aclr_peak,y_speed_peak,y_dis_peak,z_aclr_peak,z_speed_peak,z_dis_peak"; - return getAllData2ChartData(equipId,tableName,columnName, startTime, endTime); + return getAllData2ChartData(equipId, tableName, columnName, startTime, endTime); } /** * 根据设备id获取工作数据 */ - public Map getWorkData(String equipId, String startTime, String endTime){ + public Map getWorkData(String equipId, String startTime, String endTime) { String tableName = "gateway_fanuc_data"; String columnName = "power_time,process_num,total_process,work_time"; - Map resultMap = getAllData2ChartData(equipId,tableName,columnName, startTime, endTime); - if(resultMap == null){ + Map resultMap = getAllData2ChartData(equipId, tableName, columnName, startTime, endTime); + if (resultMap == null) { return null; } List workTimeList = (List) resultMap.get("work_time"); @@ -145,42 +151,72 @@ public class DataQueryService implements IDataQueryService{ return resultMap; } - public Map getAllData2ChartData(String equipId,String tableName,String columns, String startTime, String endTime){ + /** + * 查询当日最新一条数据 + */ + public Map getLatestData(String equipId, String tableName, String columns){ + + LocalDate now = LocalDate.now(); + LocalDateTime startOfDay = now.atStartOfDay(); + String beginTime = DateUtils.localDateTimeToUTC(startOfDay); + String endTime = DateUtils.localDateTimeToUTC(LocalDateTime.now()); + List> dataList = selectOneDataByColumnsandDate(equipId, tableName, columns, beginTime, endTime, "desc"); + if (CollUtil.isEmpty(dataList)) { + return null; + } + return dataList.get(0); + + } + + @Override + public Map getOldestData(String equipId, String tableName, String columns) { + LocalDate now = LocalDate.now(); + LocalDateTime startOfDay = now.atStartOfDay(); + String beginTime = DateUtils.localDateTimeToUTC(startOfDay); + String endTime = DateUtils.localDateTimeToUTC(LocalDateTime.now()); + List> dataList = selectOneDataByColumnsandDate(equipId, tableName, columns, beginTime, endTime, "asc"); + if (CollUtil.isEmpty(dataList)) { + return null; + } + return dataList.get(0); + } + + public Map getAllData2ChartData(String equipId, String tableName, String columns, String startTime, String endTime) { LocalDateTime stime = DateUtils.tranUTCtoLocalDateTime(startTime); LocalDateTime etime = DateUtils.tranUTCtoLocalDateTime(endTime); long intervalHours = ChronoUnit.HOURS.between(stime, etime); List> list = selectDataByColumnNameandDateSegmentation(equipId, tableName, columns, startTime, endTime, intervalHours); Map resMap = new HashMap<>(); - if (list.size() == 0){ + if (list.size() == 0) { return null; } List columnList = new ArrayList<>(); - List timelist = new ArrayList<>(); + List timelist = new ArrayList<>(); String[] columnName = columns.split(","); - if(intervalHours > 6){ - for(int i=0;i < columnName.length;i++){ + if (intervalHours > 6) { + for (int i = 0; i < columnName.length; i++) { columnName[i] = "mean_" + columnName[i]; } } for (String cn : columnName) { - if(cn.trim().length() == 0){ + if (cn.trim().length() == 0) { continue; } String realCn = cn; - if(cn.startsWith("mean")){ + if (cn.startsWith("mean")) { realCn = cn.replaceFirst("mean_", ""); } - resMap.put(realCn, list.stream().map(map->{ - Double data = (Double)map.get(cn); - if("gateway_temp_data".equals(tableName)){//温度处理 - return data/10.0; - } - if("work_time".equals(columnName) || "power_time".equals(columnName)){//时间转小时 - return data/60.0; - } - return data; + resMap.put(realCn, list.stream().map(map -> { + Double data = (Double) map.get(cn); + if ("gateway_temp_data".equals(tableName)) {//温度处理 + return data / 10.0; + } + if ("work_time".equals(columnName) || "power_time".equals(columnName)) {//时间转小时 + return data / 60.0; + } + return data; }).collect(Collectors.toList())); resMap.put("time", list.stream().map(map -> DateUtils.utcToCst(map.get("time").toString())).collect(Collectors.toList())); } @@ -189,19 +225,18 @@ public class DataQueryService implements IDataQueryService{ } /** - *按照策略分段查询数据列表 + * 按照策略分段查询数据列表 */ - private List> selectDataByColumnNameandDateSegmentation(String equipId, String tableName, String columnName, String startTime, String endTime,long intervalHours) - { + private List> selectDataByColumnNameandDateSegmentation(String equipId, String tableName, String columnName, String startTime, String endTime, long intervalHours) { List> list = new ArrayList<>(); - if(intervalHours <= 6){//6小时内全查 - list = selectDataByColumnNameandDate(null,tableName, columnName, startTime, endTime); - }else if(intervalHours <= 7*24 ){//7天内,每30s一个 - list = selectLongTimeDataByColumnNameandDate(null,tableName, columnName, startTime, endTime, "30s"); - }else if(intervalHours <= 30*24 ){//30天内,每2min一个 - list = selectLongTimeDataByColumnNameandDate(null,tableName, columnName, startTime, endTime, "2m"); - }else if (intervalHours <= 90*24){//90天以上,每6min一个 - list = selectLongTimeDataByColumnNameandDate(null,tableName, columnName, startTime, endTime, "6m"); + if (intervalHours <= 6) {//6小时内全查 + list = selectDataByColumnNameandDate(null, tableName, columnName, startTime, endTime); + } else if (intervalHours <= 7 * 24) {//7天内,每30s一个 + list = selectLongTimeDataByColumnNameandDate(null, tableName, columnName, startTime, endTime, "30s"); + } else if (intervalHours <= 30 * 24) {//30天内,每2min一个 + list = selectLongTimeDataByColumnNameandDate(null, tableName, columnName, startTime, endTime, "2m"); + } else if (intervalHours <= 90 * 24) {//90天以上,每6min一个 + list = selectLongTimeDataByColumnNameandDate(null, tableName, columnName, startTime, endTime, "6m"); } return list; } @@ -209,26 +244,26 @@ public class DataQueryService implements IDataQueryService{ private List> queryDataByTime(String tableName, String equipId, String beginTime, String endTime, Integer pageNum, Integer pageSize) { StringBuilder sql = new StringBuilder("select * from ") .append("\"").append(tableName).append("\""); - if(equipId != null){ + if (equipId != null) { sql.append(" where equip_id = '").append(equipId).append("'"); } - if(beginTime != null){ - if(!sql.toString().contains("where")){ + if (beginTime != null) { + if (!sql.toString().contains("where")) { sql.append(" where"); - }else{ + } else { sql.append(" and"); } sql.append(" time >= '").append(beginTime).append("'"); } - if(endTime != null){ - if(!sql.toString().contains("where")){ + if (endTime != null) { + if (!sql.toString().contains("where")) { sql.append(" where"); - }else{ + } else { sql.append(" and"); } sql.append(" time <= '").append(endTime).append("'"); } - if(pageNum != null || pageSize != null) { + if (pageNum != null || pageSize != null) { sql.append(" order by time desc ") .append(" limit ").append(pageSize) .append(" offset ").append((pageNum - 1) * pageSize); @@ -238,24 +273,24 @@ public class DataQueryService implements IDataQueryService{ return influxDBService.queryResultProcess(influxDBService.query(sql.toString())); } - private long countDataList(String tableName,String field, String equipId, String beginTime, String endTime){ + private long countDataList(String tableName, String field, String equipId, String beginTime, String endTime) { StringBuilder sql = new StringBuilder("select count(").append(field).append(") from ") .append("\"").append(tableName).append("\""); - if(equipId != null){ + if (equipId != null) { sql.append(" where equip_id = '").append(equipId).append("'"); } - if(beginTime != null){ - if(!sql.toString().contains("where")){ + if (beginTime != null) { + if (!sql.toString().contains("where")) { sql.append(" where"); - }else{ + } else { sql.append(" and"); } sql.append(" time >= '").append(beginTime).append("'"); } - if(endTime != null){ - if(!sql.toString().contains("where")){ + if (endTime != null) { + if (!sql.toString().contains("where")) { sql.append(" where"); - }else{ + } else { sql.append(" and"); } sql.append(" time <= '").append(endTime).append("'"); @@ -266,30 +301,31 @@ public class DataQueryService implements IDataQueryService{ /** * 根据字段名称和起止时间查询数据 - * @param tableName 表名 + * + * @param tableName 表名 * @param columnName 字段名称 - * @param beginTime 起始时间 - * @param endTime 结束时间 + * @param beginTime 起始时间 + * @param endTime 结束时间 * @return 数据 */ - private List> selectDataByColumnNameandDate(String equipId, String tableName, String columnName, String beginTime, String endTime){ + private List> selectDataByColumnNameandDate(String equipId, String tableName, String columnName, String beginTime, String endTime) { StringBuilder sql = new StringBuilder("select time,").append(columnName).append(" from ") .append("\"").append(tableName).append("\"");//TODO 修改时间 - if(equipId != null){ + if (equipId != null) { sql.append(" where equip_id = '").append(equipId).append("'"); } - if(beginTime != null){ - if(!sql.toString().contains("where")){ + if (beginTime != null) { + if (!sql.toString().contains("where")) { sql.append(" where"); - }else{ + } else { sql.append(" and"); } sql.append(" time >= '").append(beginTime).append("'"); } - if(endTime != null){ - if(!sql.toString().contains("where")){ + if (endTime != null) { + if (!sql.toString().contains("where")) { sql.append(" where"); - }else{ + } else { sql.append(" and"); } sql.append(" time <= '").append(endTime).append("'"); @@ -300,27 +336,27 @@ public class DataQueryService implements IDataQueryService{ /** * 查询长时间数据,每分钟取一条展示(最长3个月) */ - private List> selectLongTimeDataByColumnNameandDate(String equipId,String tableName, String columnName, String beginTime, String endTime, String interval){ - if(columnName.split(",").length > 1){ + private List> selectLongTimeDataByColumnNameandDate(String equipId, String tableName, String columnName, String beginTime, String endTime, String interval) { + if (columnName.split(",").length > 1) { columnName = "*"; } StringBuilder sql = new StringBuilder("select time, mean(").append(columnName).append(") from ") .append("\"").append(tableName).append("\""); - if(equipId != null){ + if (equipId != null) { sql.append(" where equip_id = '").append(equipId).append("'"); } - if(beginTime != null){ - if(!sql.toString().contains("where")){ + if (beginTime != null) { + if (!sql.toString().contains("where")) { sql.append(" where"); - }else{ + } else { sql.append(" and"); } sql.append(" time >= '").append(beginTime).append("'"); } - if(endTime != null){ - if(!sql.toString().contains("where")){ + if (endTime != null) { + if (!sql.toString().contains("where")) { sql.append(" where"); - }else{ + } else { sql.append(" and"); } sql.append(" time <= '").append(endTime).append("'"); @@ -329,4 +365,31 @@ public class DataQueryService implements IDataQueryService{ return influxDBService.queryResultProcess(influxDBService.query(sql.toString())); } + private List> selectOneDataByColumnsandDate(String equipId, String tableName, String columns, String beginTime, String endTime, String orderType) { + StringBuilder sql = new StringBuilder("select time,").append(columns).append(" from ") + .append("\"").append(tableName).append("\""); + if (equipId != null) { + sql.append(" where equip_id = '").append(equipId).append("'"); + } + if (beginTime != null) { + if (!sql.toString().contains("where")) { + sql.append(" where"); + } else { + sql.append(" and"); + } + sql.append(" time >= '").append(beginTime).append("'"); + } + if (endTime != null) { + if (!sql.toString().contains("where")) { + sql.append(" where"); + } else { + sql.append(" and"); + } + sql.append(" time <= '").append(endTime).append("'"); + } + sql.append("order by time ") + .append(orderType) + .append(" limit 1"); + return influxDBService.queryResultProcess(influxDBService.query(sql.toString())); + } } diff --git a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/service/IDataQueryService.java b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/service/IDataQueryService.java index 5a1bdc5..130f9d6 100644 --- a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/service/IDataQueryService.java +++ b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/service/IDataQueryService.java @@ -46,4 +46,14 @@ public interface IDataQueryService { * 根据设备id获取工作数据 */ public Map getWorkData(String equipId, String startTime, String endTime); + + /** + * 查询当日最新一条数据 + */ + public Map getLatestData(String equipId, String tableName, String columns); + + /** + * 查询当日最旧一条数据 + */ + public Map getOldestData(String equipId, String tableName, String columns); } diff --git a/imt-server/imt-module-system/imt-module-system-biz/pom.xml b/imt-server/imt-module-system/imt-module-system-biz/pom.xml index 156b480..c2e6508 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/pom.xml +++ b/imt-server/imt-module-system/imt-module-system-biz/pom.xml @@ -155,6 +155,12 @@ 2.2.0-jdk8-snapshot compile + + com.inspur + imt-module-data-api + 2.2.0-jdk8-snapshot + compile + diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/api/alarm/AlarmRulesApiImpl.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/api/alarm/AlarmRulesApiImpl.java index 73839d1..b79047d 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/api/alarm/AlarmRulesApiImpl.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/api/alarm/AlarmRulesApiImpl.java @@ -11,6 +11,7 @@ import com.inspur.module.system.controller.equip.vo.EquipInfoSaveReqVO; import com.inspur.module.system.dal.dataobject.alarm.AlarmDataDO; import com.inspur.module.system.dal.dataobject.alarm.AlarmDataDTO; import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDO; +import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDTO; import com.inspur.module.system.service.alarm.AlarmDataService; import com.inspur.module.system.service.alarm.AlarmRulesService; import com.inspur.module.system.service.alarm.EquipAlarmDataService; @@ -169,7 +170,7 @@ public class AlarmRulesApiImpl implements AlarmRulesApi{ */ private String refreshEquipAlarmData(AlarmRulesRespDTO rule){ //TODO 查询时要查询趋势报警信息 - List equipAlarmData = equipAlarmDataService.getEquipAlarmDataByEquipId(rule.getEquipId(),0); + List equipAlarmData = equipAlarmDataService.getEquipAlarmDataByEquipId(rule.getEquipId(),0); if(equipAlarmData == null || equipAlarmData.size() == 0){ return equipAlarmDataService.createEquipAlarmData(new EquipAlarmDataSaveReqVO(null,rule.getEquipId(), rule.getComponentId(),rule.getAlarmLevel(),0,LocalDateTime.now(),LocalDateTime.now(),0,null)); @@ -188,7 +189,7 @@ public class AlarmRulesApiImpl implements AlarmRulesApi{ */ private String changeEquipStatusByRule(AlarmRulesRespDTO rule){ - List equipAlarmData = equipAlarmDataService.getEquipAlarmDataByEquipId(rule.getEquipId(),null); + List equipAlarmData = equipAlarmDataService.getEquipAlarmDataByEquipId(rule.getEquipId(),null); if(equipAlarmData == null || equipAlarmData.size() == 0){ return equipAlarmDataService.createEquipAlarmData(new EquipAlarmDataSaveReqVO(null,rule.getEquipId(), rule.getComponentId(),rule.getAlarmLevel(),1,LocalDateTime.now(),LocalDateTime.now(),0,judgeEquipAnalyzeStatusByAlarmLevel(rule.getAlarmLevel()))); diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/alarm/AlarmRulesController.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/alarm/AlarmRulesController.java index 06062de..dd2212a 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/alarm/AlarmRulesController.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/alarm/AlarmRulesController.java @@ -1,5 +1,6 @@ package com.inspur.module.system.controller.admin.alarm; +import com.inspur.module.system.dal.dataobject.alarm.AlarmRulesDTO; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -56,7 +57,7 @@ public class AlarmRulesController { @Operation(summary = "改变报警规则状态") @PreAuthorize("@ss.hasPermission('imt:alarm-rules:change')") public CommonResult changeAlarmRulesStatus(@Valid @RequestBody AlarmRulesSaveReqVO updateReqVO) { - AlarmRulesDO alarmRules = alarmRulesService.getAlarmRules(updateReqVO.getAlarmId()); + AlarmRulesDTO alarmRules = alarmRulesService.getAlarmRules(updateReqVO.getAlarmId()); updateReqVO.setStatus(alarmRules.getStatus() == 0 ? 1 : 0); alarmRulesService.updateAlarmRules(updateReqVO); return success(true); @@ -76,7 +77,7 @@ public class AlarmRulesController { @Parameter(name = "id", description = "编号", required = true, example = "1024") @PreAuthorize("@ss.hasPermission('imt:alarm-rules:query')") public CommonResult getAlarmRules(@RequestParam("id") String id) { - AlarmRulesDO alarmRules = alarmRulesService.getAlarmRules(id); + AlarmRulesDTO alarmRules = alarmRulesService.getAlarmRules(id); return success(BeanUtils.toBean(alarmRules, AlarmRulesRespVO.class)); } @@ -84,7 +85,7 @@ public class AlarmRulesController { @Operation(summary = "获得机床报警规则分页") @PreAuthorize("@ss.hasPermission('imt:alarm-rules:query')") public CommonResult> getAlarmRulesPage(@Valid AlarmRulesPageReqVO pageReqVO) { - PageResult pageResult = alarmRulesService.getAlarmRulesPage(pageReqVO); + PageResult pageResult = alarmRulesService.getAlarmRulesPage(pageReqVO); return success(BeanUtils.toBean(pageResult, AlarmRulesRespVO.class)); } @@ -95,7 +96,7 @@ public class AlarmRulesController { public void exportAlarmRulesExcel(@Valid AlarmRulesPageReqVO pageReqVO, HttpServletResponse response) throws IOException { pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); - List list = alarmRulesService.getAlarmRulesPage(pageReqVO).getList(); + List list = alarmRulesService.getAlarmRulesPage(pageReqVO).getList(); // 导出 Excel ExcelUtils.write(response, "机床报警规则.xls", "数据", AlarmRulesRespVO.class, BeanUtils.toBean(list, AlarmRulesRespVO.class)); diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/alarm/EquipAlarmDataController.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/alarm/EquipAlarmDataController.java index 7e14ff6..3f90cfe 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/alarm/EquipAlarmDataController.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/alarm/EquipAlarmDataController.java @@ -1,6 +1,7 @@ package com.inspur.module.system.controller.admin.alarm; +import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDTO; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -72,7 +73,7 @@ public class EquipAlarmDataController { @Parameter(name = "id", description = "编号", required = true, example = "1024") @PreAuthorize("@ss.hasPermission('imt:equip-alarm-data:query')") public CommonResult getEquipAlarmData(@RequestParam("id") String id) { - EquipAlarmDataDO equipAlarmData = equipAlarmDataService.getEquipAlarmData(id); + EquipAlarmDataDTO equipAlarmData = equipAlarmDataService.getEquipAlarmData(id); return success(BeanUtils.toBean(equipAlarmData, EquipAlarmDataRespVO.class)); } @@ -80,7 +81,7 @@ public class EquipAlarmDataController { @Operation(summary = "获得机床设备报警数据分页") @PreAuthorize("@ss.hasPermission('imt:equip-alarm-data:query')") public CommonResult> getEquipAlarmDataPage(@Valid EquipAlarmDataPageReqVO pageReqVO) { - PageResult pageResult = equipAlarmDataService.getEquipAlarmDataPage(pageReqVO); + PageResult pageResult = equipAlarmDataService.getEquipAlarmDataPage(pageReqVO); return success(BeanUtils.toBean(pageResult, EquipAlarmDataRespVO.class)); } @@ -91,7 +92,7 @@ public class EquipAlarmDataController { public void exportEquipAlarmDataExcel(@Valid EquipAlarmDataPageReqVO pageReqVO, HttpServletResponse response) throws IOException { pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); - List list = equipAlarmDataService.getEquipAlarmDataPage(pageReqVO).getList(); + List list = equipAlarmDataService.getEquipAlarmDataPage(pageReqVO).getList(); // 导出 Excel ExcelUtils.write(response, "机床设备报警数据.xls", "数据", EquipAlarmDataRespVO.class, BeanUtils.toBean(list, EquipAlarmDataRespVO.class)); @@ -100,7 +101,7 @@ public class EquipAlarmDataController { @Operation(summary = "获取报警提交维修工单详情") @GetMapping("/getSubmitOrderDetails/{alarmId}") @PreAuthorize("@ss.hasPermission('imt:equip-alarm-data:query')") - public CommonResult getSubmitOrderDetails(@PathVariable("alarmId") String alarmId) { + public CommonResult getSubmitOrderDetails(@PathVariable("alarmId") String alarmId) { return success(equipAlarmDataService.getSubmitOrderDetails(alarmId)); } diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/gatewayinfo/GatewayInfoController.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/gatewayinfo/GatewayInfoController.java index e2ea745..82a8eb3 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/gatewayinfo/GatewayInfoController.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/gatewayinfo/GatewayInfoController.java @@ -1,5 +1,6 @@ package com.inspur.module.system.controller.admin.gatewayinfo; +import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDetailsDTO; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -10,7 +11,6 @@ import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Operation; -import javax.validation.constraints.*; import javax.validation.*; import javax.servlet.http.*; import java.util.*; @@ -71,7 +71,7 @@ public class GatewayInfoController { @Parameter(name = "id", description = "编号", required = true, example = "1024") @PreAuthorize("@ss.hasPermission('imt:gateway-info:query')") public CommonResult getGatewayInfo(@RequestParam("id") String id) { - GatewayInfoDO gatewayInfo = gatewayInfoService.getGatewayInfo(id); + GatewayInfoDetailsDTO gatewayInfo = gatewayInfoService.getGatewayInfo(id); return success(BeanUtils.toBean(gatewayInfo, GatewayInfoRespVO.class)); } @@ -79,7 +79,7 @@ public class GatewayInfoController { @Operation(summary = "获得机床网关信息分页") @PreAuthorize("@ss.hasPermission('imt:gateway-info:query')") public CommonResult> getGatewayInfoPage(@Valid GatewayInfoPageReqVO pageReqVO) { - PageResult pageResult = gatewayInfoService.getGatewayInfoPage(pageReqVO); + PageResult pageResult = gatewayInfoService.getGatewayInfoPage(pageReqVO); return success(BeanUtils.toBean(pageResult, GatewayInfoRespVO.class)); } @@ -90,7 +90,7 @@ public class GatewayInfoController { public void exportGatewayInfoExcel(@Valid GatewayInfoPageReqVO pageReqVO, HttpServletResponse response) throws IOException { pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); - List list = gatewayInfoService.getGatewayInfoPage(pageReqVO).getList(); + List list = gatewayInfoService.getGatewayInfoPage(pageReqVO).getList(); // 导出 Excel ExcelUtils.write(response, "机床网关信息.xls", "数据", GatewayInfoRespVO.class, BeanUtils.toBean(list, GatewayInfoRespVO.class)); diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notice/NoticeController.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notice/NoticeController.java index 1bf4158..77e4e34 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notice/NoticeController.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notice/NoticeController.java @@ -104,6 +104,8 @@ public class NoticeController { Assert.notNull(notice, "公告不能为空"); // 直接插入站内信表 notice.setId(null); + notice.setCreateTime(null); + notice.setUpdateTime(null); NotifyMessageDO notifyMessage = BeanUtils.toBean(notice, NotifyMessageDO.class); notifyMessage.setTemplateNickname(SecurityFrameworkUtils.getLoginUserNickname()); notifyMessage.setTemplateType(notice.getType()); diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/EquipInfoController.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/EquipInfoController.java index ab1f5bd..f3969e4 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/EquipInfoController.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/EquipInfoController.java @@ -7,6 +7,7 @@ import com.inspur.module.system.controller.equip.vo.*; import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO; import com.inspur.module.system.service.baseData.CustomerInfoService; import com.inspur.module.system.service.baseData.ModelInfoService; +import com.inspur.module.system.service.equip.EquipDashboardService; import com.inspur.module.system.service.equip.EquipInfoService; import org.springframework.web.bind.annotation.*; @@ -52,6 +53,9 @@ public class EquipInfoController { @Resource private CustomerInfoService customerInfoService; + @Resource + private EquipDashboardService equipDashboardService; + @PostMapping("/create") @Operation(summary = "创建机床信息") @PreAuthorize("@ss.hasPermission('imt:equip-info:create')") @@ -151,4 +155,9 @@ public class EquipInfoController { return success(equipInfoService.getEquipInfoDetailsById(id)); } + @GetMapping("/dashboard") + @Operation(summary = "设备看板详情") + public CommonResult> getAllEquipDashboardDetailsById() { + return success(equipDashboardService.getAllEquipDashboardDetails()); + } } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/vo/EquipDashboardDetailsRespVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/vo/EquipDashboardDetailsRespVO.java new file mode 100644 index 0000000..9284413 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/vo/EquipDashboardDetailsRespVO.java @@ -0,0 +1,97 @@ +package com.inspur.module.system.controller.equip.vo; + +import lombok.Data; + +/** + * 设备详情 + * @Author zhangjunwen + * @create 2024/10/10 + */ +@Data +public class EquipDashboardDetailsRespVO { + + /** + * 设备id + */ + private String equipId; + + /** + * 设备编号 + */ + private String equipNo; + + /** + * 设备名称 + */ + private String equipName; + + /** + * 客户信息id + */ + private String customerId; + + /** + * 客户信息 + */ + private String customerName; + + /** + * 机床型号id + */ + private String modelId; + + /** + * 机床型号 + */ + private String modelName; + + /** + * 机床状态 + */ + private Integer status; + + /** + * 机床运行状态 + */ + private Integer runStatus; + + /** + * 报警数量 + */ + private Long alarmNum; + + /** + * 通电时间 + */ + private Double powerTime = 0.0; + + /** + * 加工时长 + */ + private Double workTime = 0.0; + + /** + * 加工件数 + */ + private Integer processNum = 0; + + /** + * 今日工作时长 + */ + private Double todayWorkTime = 0.0; + + /** + * 今日加工件数 + */ + private Integer todayProcessNum = 0; + + /** + * 今日效率 + */ + private Double todayEfficiency = 0.0; + + /** + * 维修状态 + */ + private Integer maintenanceStatus; +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/alarm/AlarmDataDTO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/alarm/AlarmDataDTO.java index 9a10673..6dfe17b 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/alarm/AlarmDataDTO.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/alarm/AlarmDataDTO.java @@ -96,6 +96,11 @@ public class AlarmDataDTO { */ private String equipNo; + /** + * 设备名称 + */ + private String equipName; + /** * 组件名称 */ diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/alarm/AlarmRulesDO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/alarm/AlarmRulesDO.java index c5514bf..f51055a 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/alarm/AlarmRulesDO.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/alarm/AlarmRulesDO.java @@ -89,10 +89,4 @@ public class AlarmRulesDO extends BaseDO { * 排序 */ private Integer sort; - - private String equipNo; - - private String customerName; - - private String componentName; } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/alarm/AlarmRulesDTO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/alarm/AlarmRulesDTO.java new file mode 100644 index 0000000..91538e7 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/alarm/AlarmRulesDTO.java @@ -0,0 +1,106 @@ +package com.inspur.module.system.dal.dataobject.alarm; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @Author zhangjunwen + * @create 2024/10/11 + */ +@Data +public class AlarmRulesDTO { + + /** + * 报警规则信息id + */ + @TableId(type = IdType.ASSIGN_UUID) + private String alarmId; + /** + * 报警信息的key + */ + private String alarmNameKey; + /** + * 报警规则信息名称 + */ + private String alarmName; + /** + * 报警规则信息单位 + */ + private String alarmInfoUnit; + /** + * 机床设备id + */ + private String equipId; + /** + * 机床组件id + */ + private String componentId; + /** + * 报警规则上限值 + */ + private BigDecimal alertUpperBound; + /** + * 报警规则下限值 + */ + private BigDecimal alertLowerBound; + /** + * 报警规则信息的类型(0:阈值报警,1:趋势报警) + */ + private Integer type; + /** + * 状态(0:启用,1:停用) + */ + private Integer status; + /** + * 报警可能原因描述 + */ + private String reasonDescription; + /** + * 备注 + */ + private String remark; + /** + * 规则描述 + */ + private String referenceName; + /** + * 判断规则 + */ + private String referenceCon; + /** + * 等级 + */ + private Integer alarmLevel; + /** + * 排序 + */ + private Integer sort; + + /** + * 设备编号 + */ + private String equipNo; + + /** + * 设备型号 + */ + private String modelName; + + /** + * 设备名称 + */ + private String equipName; + + /** + * 客户名 + */ + private String customerName; + + /** + * 组件名 + */ + private String componentName; +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/alarm/EquipAlarmDataDO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/alarm/EquipAlarmDataDO.java index b12e313..3e457bb 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/alarm/EquipAlarmDataDO.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/alarm/EquipAlarmDataDO.java @@ -62,23 +62,4 @@ public class EquipAlarmDataDO extends BaseDO { */ private Integer equipAnalyseStatus; - /** - * 客户名 - */ - private String customerName; - - /** - * 设备编号 - */ - private String equipNo; - - /** - * 设备型号 - */ - private String modelName; - - /** - * 组件名 - */ - private String componentName; } diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/alarm/EquipAlarmDataDTO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/alarm/EquipAlarmDataDTO.java new file mode 100644 index 0000000..005830a --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/alarm/EquipAlarmDataDTO.java @@ -0,0 +1,76 @@ +package com.inspur.module.system.dal.dataobject.alarm; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @Author zhangjunwen + * @create 2024/10/11 + */ +@Data +public class EquipAlarmDataDTO { + + private String equipAlarmId; + /** + * 机床设备id + */ + private String equipId; + /** + * 机床组件id + */ + private String componentId; + /** + * 报警等级(1:1级,2:2级,3:3级) + *

+ * 枚举 {@link TODO alarm_level 对应的类} + */ + private Integer alarmLevel; + /** + * 报警类型(0:阈值报警 1:趋势报警) + */ + private Integer alarmType; + /** + * 首次报警时间 + */ + private LocalDateTime firstAlarmTime; + /** + * 最新报警时间 + */ + private LocalDateTime latestAlarmTime; + /** + * 状态(0:待处理,1:已处理) + */ + private Integer status; + /** + * 机床分析状态(0:正常,1:磨损中,2:磨损严重) + */ + private Integer equipAnalyseStatus; + + /** + * 客户名 + */ + private String customerName; + + /** + * 设备编号 + */ + private String equipNo; + + /** + * 设备名称 + */ + private String equipName; + + /** + * 设备型号 + */ + private String modelName; + + /** + * 组件名 + */ + private String componentName; +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/gatewayinfo/GatewayInfoDO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/gatewayinfo/GatewayInfoDO.java index 2c0b1ea..4d3a332 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/gatewayinfo/GatewayInfoDO.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/gatewayinfo/GatewayInfoDO.java @@ -78,18 +78,4 @@ public class GatewayInfoDO extends BaseDO { */ private String gatewayCode; - /** - * 客户名称 - */ - private String customerName; - - /** - * 设备编号 - */ - private String equipNo; - - /** - * 机床型号 - */ - private String modelName; } diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/gatewayinfo/GatewayInfoDetailsDTO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/gatewayinfo/GatewayInfoDetailsDTO.java new file mode 100644 index 0000000..dbc66f0 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/gatewayinfo/GatewayInfoDetailsDTO.java @@ -0,0 +1,86 @@ +package com.inspur.module.system.dal.dataobject.gatewayinfo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; + +/** + * @Author zhangjunwen + * @create 2024/10/10 + */ +@Data +public class GatewayInfoDetailsDTO { + + /** + * 机床网关id + */ + @TableId(type = IdType.ASSIGN_UUID) + private String gatewayId; + /** + * 机床网关名称 + */ + private String gatewayName; + /** + * 机床网关型号 + */ + private String gatewayModel; + /** + * 机床网关生产厂商 + */ + private String gatewayMfg; + /** + * 机床网关位置 + */ + private String gatewayLocation; + /** + * 固件版本 + */ + private String firmwareVersion; + /** + * ip地址 + */ + private String ipAddress; + /** + * 规格参数 + */ + private String gatewaySpn; + /** + * 状态(0:正常,1:异常,2:停机) + *

+ */ + private Integer status; + /** + * 备注 + */ + private String remark; + /** + * 网关图片路径 + */ + private String gatewayPicPath; + + /** + * 设备id + */ + private String equipId; + + /** + * 网关编号 + */ + private String gatewayCode; + + /** + * 客户名称 + */ + private String customerName; + + /** + * 设备编号 + */ + private String equipNo; + + /** + * 机床型号 + */ + private String modelName; + +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/alarm/AlarmDataMapper.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/alarm/AlarmDataMapper.java index ce62481..45ac335 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/alarm/AlarmDataMapper.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/alarm/AlarmDataMapper.java @@ -8,11 +8,17 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.inspur.framework.common.pojo.PageResult; import com.inspur.framework.mybatis.core.query.LambdaQueryWrapperX; import com.inspur.framework.mybatis.core.mapper.BaseMapperX; +import com.inspur.framework.mybatis.core.query.MPJLambdaWrapperX; import com.inspur.framework.tenant.core.aop.TenantIgnore; import com.inspur.module.system.controller.imtIndex.vo.ImtIndexAlarmListVO; import com.inspur.module.system.dal.dataobject.alarm.AlarmDataDO; import com.inspur.module.system.dal.dataobject.alarm.AlarmDataDTO; import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDO; +import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDTO; +import com.inspur.module.system.dal.dataobject.baseData.CustomerInfoDO; +import com.inspur.module.system.dal.dataobject.baseData.ModelInfoDO; +import com.inspur.module.system.dal.dataobject.equip.ComponentInfoDO; +import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO; import org.apache.ibatis.annotations.Mapper; import com.inspur.module.system.controller.admin.alarm.vo.*; import org.apache.ibatis.annotations.Param; @@ -64,17 +70,90 @@ public interface AlarmDataMapper extends BaseMapperX { } + /** + * 分页查询参数报警列表 + */ + default PageResult selectAlarmDataDetailsList(AlarmDataPageReqVO reqVO) { + MPJLambdaWrapperX wrapper = new MPJLambdaWrapperX<>(); + wrapper.selectAll(AlarmDataDO.class) + .selectAs(EquipInfoDO::getEquipNo, AlarmDataDTO::getEquipNo) + .selectAs(EquipInfoDO::getEquipName, AlarmDataDTO::getEquipName) + .selectAs(ModelInfoDO::getModelName, AlarmDataDTO::getModelName) + .selectAs(CustomerInfoDO::getCustomerName, AlarmDataDTO::getCustomerName) + .selectAs(ComponentInfoDO::getComponentName, AlarmDataDTO::getComponentName) + .leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, AlarmDataDO::getEquipId) + .leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId) + .leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId) + .leftJoin(ComponentInfoDO.class, ComponentInfoDO::getComponentId, AlarmDataDO::getComponentId) + .eq(AlarmDataDO::getStatus, 0) + .eqIfExists(AlarmDataDO::getAlarmRulesId, reqVO.getAlarmRulesId()) + .eqIfExists(AlarmDataDO::getEquipId, reqVO.getEquipId()) + .eqIfExists(AlarmDataDO::getComponentId, reqVO.getComponentId()) + .eqIfExists(AlarmDataDO::getNameKey, reqVO.getNameKey()) + .eqIfExists(AlarmDataDO::getAlarmType, reqVO.getAlarmType()) + .orderByDesc(AlarmDataDO::getCreateTime); + if(Objects.nonNull(reqVO.getFirstAlarmTime())){ + wrapper.geIfExists(AlarmDataDO::getFirstAlarmTime, reqVO.getFirstAlarmTime()[0]) + .leIfExists(AlarmDataDO::getFirstAlarmTime, reqVO.getFirstAlarmTime()[1]); + } + if(Objects.nonNull(reqVO.getLastAlarmTime())){ + wrapper.geIfExists(AlarmDataDO::getLastAlarmTime, reqVO.getLastAlarmTime()[0]) + .leIfExists(AlarmDataDO::getLastAlarmTime, reqVO.getLastAlarmTime()[1]); + } + return selectJoinPage(reqVO, AlarmDataDTO.class, wrapper); + } + /** * 查询参数报警列表 */ public IPage selectAlarmDataList(IPage page, @Param("reqVO") AlarmDataPageReqVO reqVO); + /** + * 根据id查询参数报警详情 + */ + default AlarmDataDTO selectAlarmDataDetailsById(Long id){ + return selectJoinOne(AlarmDataDTO.class, new MPJLambdaWrapperX() + .selectAll(AlarmDataDO.class) + .selectAs(EquipInfoDO::getEquipNo, AlarmDataDTO::getEquipNo) + .selectAs(EquipInfoDO::getEquipName, AlarmDataDTO::getEquipName) + .selectAs(ModelInfoDO::getModelName, AlarmDataDTO::getModelName) + .selectAs(CustomerInfoDO::getCustomerName, AlarmDataDTO::getCustomerName) + .selectAs(ComponentInfoDO::getComponentName, AlarmDataDTO::getComponentName) + .leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, AlarmDataDO::getEquipId) + .leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId) + .leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId) + .leftJoin(ComponentInfoDO.class, ComponentInfoDO::getComponentId, AlarmDataDO::getComponentId) + .eq(AlarmDataDO::getStatus, 0) + .eq(AlarmDataDO::getAlarmDataId, id) + ); + } + /** * 根据id查询参数报警 */ @TenantIgnore public AlarmDataDTO selectAlarmDataById(@Param("id") Long id); + /** + * 根据规则id查询参数报警 + */ + default AlarmDataDTO selectAlarmDataListByRulesId(@Param("alarmRulesId") String alarmRulesId) { + return selectJoinOne(AlarmDataDTO.class, new MPJLambdaWrapperX() + .selectAll(AlarmDataDO.class) + .selectAs(EquipInfoDO::getEquipNo, AlarmDataDTO::getEquipNo) + .selectAs(EquipInfoDO::getEquipName, AlarmDataDTO::getEquipName) + .selectAs(ModelInfoDO::getModelName, AlarmDataDTO::getModelName) + .selectAs(CustomerInfoDO::getCustomerName, AlarmDataDTO::getCustomerName) + .selectAs(ComponentInfoDO::getComponentName, AlarmDataDTO::getComponentName) + .leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, AlarmDataDO::getEquipId) + .leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId) + .leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId) + .leftJoin(ComponentInfoDO.class, ComponentInfoDO::getComponentId, AlarmDataDO::getComponentId) + .eq(AlarmDataDO::getStatus, 0) + .eq(AlarmDataDO::getAlarmRulesId, alarmRulesId) + ); + } + /** * 根据规则id查询参数报警 */ diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/alarm/AlarmRulesMapper.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/alarm/AlarmRulesMapper.java index 9dcb143..540eee1 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/alarm/AlarmRulesMapper.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/alarm/AlarmRulesMapper.java @@ -4,7 +4,16 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.inspur.framework.common.pojo.PageResult; import com.inspur.framework.mybatis.core.query.LambdaQueryWrapperX; import com.inspur.framework.mybatis.core.mapper.BaseMapperX; +import com.inspur.framework.mybatis.core.query.MPJLambdaWrapperX; +import com.inspur.module.system.controller.admin.gatewayinfo.vo.GatewayInfoPageReqVO; import com.inspur.module.system.dal.dataobject.alarm.AlarmRulesDO; +import com.inspur.module.system.dal.dataobject.alarm.AlarmRulesDTO; +import com.inspur.module.system.dal.dataobject.baseData.CustomerInfoDO; +import com.inspur.module.system.dal.dataobject.baseData.ModelInfoDO; +import com.inspur.module.system.dal.dataobject.equip.ComponentInfoDO; +import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO; +import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDO; +import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDetailsDTO; import org.apache.ibatis.annotations.Mapper; import com.inspur.module.system.controller.admin.alarm.vo.*; import org.apache.ibatis.annotations.Param; @@ -40,16 +49,74 @@ public interface AlarmRulesMapper extends BaseMapperX { .orderByDesc(AlarmRulesDO::getAlarmId)); } + /** + * 分页查询设备报警规则列表 + */ + default PageResult selectAlarmRulesDetailsList(@Param("reqVO") AlarmRulesPageReqVO reqVO) { + return selectJoinPage(reqVO, AlarmRulesDTO.class, new MPJLambdaWrapperX() + .selectAll(AlarmRulesDO.class) + .selectAs(EquipInfoDO::getEquipNo, AlarmRulesDTO::getEquipNo) + .selectAs(EquipInfoDO::getEquipName, AlarmRulesDTO::getEquipName) + .selectAs(ModelInfoDO::getModelName, AlarmRulesDTO::getModelName) + .selectAs(CustomerInfoDO::getCustomerName, AlarmRulesDTO::getCustomerName) + .selectAs(ComponentInfoDO::getComponentName, AlarmRulesDTO::getComponentName) + .leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, AlarmRulesDO::getEquipId) + .leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId) + .leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId) + .leftJoin(ComponentInfoDO.class, ComponentInfoDO::getComponentId, AlarmRulesDO::getComponentId) + .eqIfExists(AlarmRulesDO::getEquipId, reqVO.getEquipId()) + .eqIfExists(AlarmRulesDO::getType, reqVO.getType()) + .eqIfExists(AlarmRulesDO::getAlarmLevel, reqVO.getAlarmLevel()) + .likeIfExists(AlarmRulesDO::getAlarmName, reqVO.getAlarmName()) + .likeIfExists(AlarmRulesDO::getAlarmNameKey, reqVO.getAlarmNameKey()) + ); + } /** * 查询设备报警规则列表 */ public IPage selectAlarmRulesList(IPage page, @Param("reqVO") AlarmRulesPageReqVO reqVO); + /** + * 根据id查询报警规则信息 + */ + default AlarmRulesDTO selectAlarmRulesDetailsById(String id){ + return selectJoinOne(AlarmRulesDTO.class,new MPJLambdaWrapperX() + .selectAll(AlarmRulesDO.class) + .selectAs(EquipInfoDO::getEquipNo, AlarmRulesDTO::getEquipNo) + .selectAs(ModelInfoDO::getModelName, AlarmRulesDTO::getModelName) + .selectAs(CustomerInfoDO::getCustomerName, AlarmRulesDTO::getCustomerName) + .leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, AlarmRulesDO::getEquipId) + .leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId) + .leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId) + .eq(AlarmRulesDO::getAlarmId, id) + ); + } + /** * 根据id查询报警规则 */ public AlarmRulesDO selectAlarmRulesById(@Param("id") String id); + /** + * 根据设备id查询报警规则 + */ + default List getAlarmRulesDetailsListByEquipId(String equipId){ + return selectJoinList(AlarmRulesDTO.class,new MPJLambdaWrapperX() + .selectAll(AlarmRulesDO.class) + .selectAs(EquipInfoDO::getEquipNo, AlarmRulesDTO::getEquipNo) + .selectAs(EquipInfoDO::getEquipName, AlarmRulesDTO::getEquipName) + .selectAs(ModelInfoDO::getModelName, AlarmRulesDTO::getModelName) + .selectAs(CustomerInfoDO::getCustomerName, AlarmRulesDTO::getCustomerName) + .selectAs(ComponentInfoDO::getComponentName, AlarmRulesDTO::getComponentName) + .leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, AlarmRulesDO::getEquipId) + .leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId) + .leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId) + .leftJoin(ComponentInfoDO.class, ComponentInfoDO::getComponentId, AlarmRulesDO::getComponentId) + .eq(AlarmRulesDO::getStatus, 0) + .eq(AlarmRulesDO::getEquipId, equipId) + ); + } + /** * 根据设备id查询报警规则 */ diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/alarm/EquipAlarmDataMapper.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/alarm/EquipAlarmDataMapper.java index 7449936..d9b54e4 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/alarm/EquipAlarmDataMapper.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/alarm/EquipAlarmDataMapper.java @@ -4,8 +4,15 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.inspur.framework.common.pojo.PageResult; import com.inspur.framework.mybatis.core.query.LambdaQueryWrapperX; import com.inspur.framework.mybatis.core.mapper.BaseMapperX; +import com.inspur.framework.mybatis.core.query.MPJLambdaWrapperX; import com.inspur.module.system.dal.dataobject.alarm.AlarmRulesDO; +import com.inspur.module.system.dal.dataobject.alarm.AlarmRulesDTO; import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDO; +import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDTO; +import com.inspur.module.system.dal.dataobject.baseData.CustomerInfoDO; +import com.inspur.module.system.dal.dataobject.baseData.ModelInfoDO; +import com.inspur.module.system.dal.dataobject.equip.ComponentInfoDO; +import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO; import org.apache.ibatis.annotations.Mapper; import com.inspur.module.system.controller.admin.alarm.vo.*; import org.apache.ibatis.annotations.Param; @@ -33,22 +40,95 @@ public interface EquipAlarmDataMapper extends BaseMapperX { .orderByDesc(EquipAlarmDataDO::getEquipAlarmId)); } + /** + * 分页查询设备报警列表 + */ + default PageResult selectEquipAlarmDetailsList(@Param("reqVO") EquipAlarmDataPageReqVO reqVO) { + MPJLambdaWrapperX wrapper = new MPJLambdaWrapperX<>(); + wrapper.selectAll(EquipAlarmDataDO.class) + .selectAs(EquipInfoDO::getEquipNo, EquipAlarmDataDTO::getEquipNo) + .selectAs(EquipInfoDO::getEquipName, EquipAlarmDataDTO::getEquipName) + .selectAs(ModelInfoDO::getModelName, EquipAlarmDataDTO::getModelName) + .selectAs(CustomerInfoDO::getCustomerName, EquipAlarmDataDTO::getCustomerName) + .selectAs(ComponentInfoDO::getComponentName, EquipAlarmDataDTO::getComponentName) + .leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, EquipAlarmDataDO::getEquipId) + .leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId) + .leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId) + .leftJoin(ComponentInfoDO.class, ComponentInfoDO::getComponentId, EquipAlarmDataDO::getComponentId) + .eq(EquipAlarmDataDO::getStatus, 0) + .eqIfExists(EquipAlarmDataDO::getEquipId, reqVO.getEquipId()) + .eqIfExists(EquipAlarmDataDO::getComponentId, reqVO.getComponentId()) + .eqIfExists(EquipAlarmDataDO::getAlarmLevel, reqVO.getAlarmLevel()) + .eqIfExists(EquipAlarmDataDO::getAlarmType, reqVO.getAlarmType()) + .orderByDesc(EquipAlarmDataDO::getFirstAlarmTime); + if(reqVO.getFirstAlarmTime() != null){ + wrapper.geIfExists(EquipAlarmDataDO::getFirstAlarmTime, reqVO.getFirstAlarmTime()[0]) + .leIfExists(EquipAlarmDataDO::getFirstAlarmTime, reqVO.getFirstAlarmTime()[1]); + } + return selectJoinPage(reqVO, EquipAlarmDataDTO.class, wrapper); + } + /** * 查询设备报警列表 */ public IPage selectEquipAlarmList(IPage page, @Param("reqVO") EquipAlarmDataPageReqVO reqVO); + /** + * 根据id查询设备报警信息 + */ + default EquipAlarmDataDTO selectEquipAlarmDetailsById(String id){ + return selectJoinOne(EquipAlarmDataDTO.class,new MPJLambdaWrapperX() + .selectAll(EquipAlarmDataDO.class) + .selectAs(EquipInfoDO::getEquipNo, EquipAlarmDataDTO::getEquipNo) + .selectAs(EquipInfoDO::getEquipName, EquipAlarmDataDTO::getEquipName) + .selectAs(ModelInfoDO::getModelName, EquipAlarmDataDTO::getModelName) + .selectAs(CustomerInfoDO::getCustomerName, EquipAlarmDataDTO::getCustomerName) + .selectAs(ComponentInfoDO::getComponentName, EquipAlarmDataDTO::getComponentName) + .leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, EquipAlarmDataDO::getEquipId) + .leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId) + .leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId) + .leftJoin(ComponentInfoDO.class, ComponentInfoDO::getComponentId, EquipAlarmDataDO::getComponentId) + .eq(EquipAlarmDataDO::getEquipAlarmId, id) + ); + } + /** * 根据id查询设备报警 */ public EquipAlarmDataDO selectEquipAlarmById(@Param("id") String id); + /** + * 通过设备id查询设备报警列表 + */ + default List getEquipAlarmDataDetailsByEquipIdAndAlarmType(@Param("equipId") String equipId, + @Param("alarmType") Integer alarmType){ + return selectJoinList(EquipAlarmDataDTO.class,new MPJLambdaWrapperX() + .selectAll(EquipAlarmDataDO.class) + .selectAs(EquipInfoDO::getEquipNo, EquipAlarmDataDTO::getEquipNo) + .selectAs(EquipInfoDO::getEquipName, EquipAlarmDataDTO::getEquipName) + .selectAs(ModelInfoDO::getModelName, EquipAlarmDataDTO::getModelName) + .selectAs(CustomerInfoDO::getCustomerName, EquipAlarmDataDTO::getCustomerName) + .selectAs(ComponentInfoDO::getComponentName, EquipAlarmDataDTO::getComponentName) + .leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, EquipAlarmDataDO::getEquipId) + .leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId) + .leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId) + .leftJoin(ComponentInfoDO.class, ComponentInfoDO::getComponentId, EquipAlarmDataDO::getComponentId) + .eq(EquipAlarmDataDO::getEquipId, equipId) + .eq(EquipAlarmDataDO::getAlarmType, alarmType) + ); + } + /** * 通过设备id查询设备报警数据 */ List getEquipAlarmDataByEquipIdAndAlarmType(@Param("equipId") String equipId, @Param("alarmType") Integer alarmType); + /** + * 获取报警提交维修工单详情 + */ + + /** * 获取报警提交维修工单详情 * diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/gatewayinfo/GatewayInfoMapper.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/gatewayinfo/GatewayInfoMapper.java index e3b5126..c866d51 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/gatewayinfo/GatewayInfoMapper.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/gatewayinfo/GatewayInfoMapper.java @@ -6,9 +6,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.inspur.framework.common.pojo.PageResult; import com.inspur.framework.mybatis.core.query.LambdaQueryWrapperX; import com.inspur.framework.mybatis.core.mapper.BaseMapperX; -import com.inspur.module.system.controller.admin.alarm.vo.EquipAlarmDataPageReqVO; -import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDO; +import com.inspur.framework.mybatis.core.query.MPJLambdaWrapperX; +import com.inspur.module.system.dal.dataobject.baseData.CustomerInfoDO; +import com.inspur.module.system.dal.dataobject.baseData.ModelInfoDO; +import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO; import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDO; +import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDetailsDTO; import org.apache.ibatis.annotations.Mapper; import com.inspur.module.system.controller.admin.gatewayinfo.vo.*; import org.apache.ibatis.annotations.Param; @@ -29,21 +32,82 @@ public interface GatewayInfoMapper extends BaseMapperX { .orderByDesc(GatewayInfoDO::getGatewayId)); } + /** + * 联合查询网关信息列表 + */ + default PageResult selectGatewayDetailsList(@Param("reqVO") GatewayInfoPageReqVO reqVO) { + return selectJoinPage(reqVO, GatewayInfoDetailsDTO.class, new MPJLambdaWrapperX() + .selectAll(GatewayInfoDO.class) + .selectAs(EquipInfoDO::getEquipNo, GatewayInfoDetailsDTO::getEquipNo) + .selectAs(ModelInfoDO::getModelName, GatewayInfoDetailsDTO::getModelName) + .selectAs(CustomerInfoDO::getCustomerName, GatewayInfoDetailsDTO::getCustomerName) + .leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, GatewayInfoDO::getEquipId) + .leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId) + .leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId) + .eqIfExists(GatewayInfoDO::getEquipId, reqVO.getEquipId()) + .likeIfExists(GatewayInfoDO::getGatewayName, reqVO.getGatewayName()) + .likeIfExists(GatewayInfoDO::getGatewayModel, reqVO.getGatewayModel()) + .likeIfExists(GatewayInfoDO::getGatewayCode, reqVO.getGatewayCode()) + ); + } + /** * 查询网关信息列表 */ public IPage selectGatewayList(IPage page, @Param("reqVO") GatewayInfoPageReqVO reqVO); - /** - * 根据id查询网关信息 - */ + default GatewayInfoDetailsDTO selectGatewayDetailsById(String id){ + return selectJoinOne(GatewayInfoDetailsDTO.class,new MPJLambdaWrapperX() + .selectAll(GatewayInfoDO.class) + .selectAs(EquipInfoDO::getEquipNo, GatewayInfoDetailsDTO::getEquipNo) + .selectAs(ModelInfoDO::getModelName, GatewayInfoDetailsDTO::getModelName) + .selectAs(CustomerInfoDO::getCustomerName, GatewayInfoDetailsDTO::getCustomerName) + .leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, GatewayInfoDO::getEquipId) + .leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId) + .leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId) + .eq(GatewayInfoDO::getGatewayId, id) + ); + } + public GatewayInfoDO selectGatewayById(@Param("id") String id); + /** + * 根据网关编号查询网关信息 + */ + default GatewayInfoDetailsDTO selectGatewayDetailsByGatewayCode(String gatewayCode){ + return selectJoinOne(GatewayInfoDetailsDTO.class,new MPJLambdaWrapperX() + .selectAll(GatewayInfoDO.class) + .selectAs(EquipInfoDO::getEquipNo, GatewayInfoDetailsDTO::getEquipNo) + .selectAs(ModelInfoDO::getModelName, GatewayInfoDetailsDTO::getModelName) + .selectAs(CustomerInfoDO::getCustomerName, GatewayInfoDetailsDTO::getCustomerName) + .leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, GatewayInfoDO::getEquipId) + .leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId) + .leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId) + .eq(GatewayInfoDO::getGatewayCode, gatewayCode) + .eq(GatewayInfoDO::getStatus, 0) + ); + } + /** * 根据网关编号查询网关信息 */ public GatewayInfoDO selectGatewayByGatewayCode(@Param("gatewayCode") String gatewayCode); + /** + * 获取网关信息列表 + */ + default List selectAllGatewayDetailsList(){ + return selectJoinList(GatewayInfoDetailsDTO.class,new MPJLambdaWrapperX() + .selectAll(GatewayInfoDO.class) + .selectAs(EquipInfoDO::getEquipNo, GatewayInfoDetailsDTO::getEquipNo) + .selectAs(ModelInfoDO::getModelName, GatewayInfoDetailsDTO::getModelName) + .selectAs(CustomerInfoDO::getCustomerName, GatewayInfoDetailsDTO::getCustomerName) + .leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, GatewayInfoDO::getEquipId) + .leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId) + .leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId) + ); + } + /** * 获取网关信息列表 */ diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/notify/NotifyMessageMapper.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/notify/NotifyMessageMapper.java index fbf6b13..8287b55 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/notify/NotifyMessageMapper.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/notify/NotifyMessageMapper.java @@ -55,17 +55,17 @@ public interface NotifyMessageMapper extends BaseMapperX { default List selectUnreadListByUserIdAndUserType(Long userId, Integer userType, Integer size) { return selectList(new QueryWrapperX() // 由于要使用 limitN 语句,所以只能用 QueryWrapperX - .eq("user_id", userId) - .eq("user_type", userType) +// .eq("user_id", userId) +// .eq("user_type", userType) .eq("read_status", false) .orderByDesc("id").limitN(size)); } default Long selectUnreadCountByUserIdAndUserType(Long userId, Integer userType) { return selectCount(new LambdaQueryWrapperX() - .eq(NotifyMessageDO::getReadStatus, false) - .eq(NotifyMessageDO::getUserId, userId) - .eq(NotifyMessageDO::getUserType, userType)); + .eq(NotifyMessageDO::getReadStatus, false)); +// .eq(NotifyMessageDO::getUserId, userId) +// .eq(NotifyMessageDO::getUserType, userType)); } } diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/AlarmDataServiceImpl.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/AlarmDataServiceImpl.java index 6222715..5c76941 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/AlarmDataServiceImpl.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/AlarmDataServiceImpl.java @@ -41,7 +41,6 @@ public class AlarmDataServiceImpl implements AlarmDataService { private EquipAlarmDataService equipAlarmDataService; @Override - @TenantIgnore public Long createAlarmData(AlarmDataSaveReqVO createReqVO) { // 插入 AlarmDataDO alarmData = BeanUtils.toBean(createReqVO, AlarmDataDO.class); @@ -51,7 +50,6 @@ public class AlarmDataServiceImpl implements AlarmDataService { } @Override - @TenantIgnore public void updateAlarmData(AlarmDataSaveReqVO updateReqVO) { // 校验存在 validateAlarmDataExists(updateReqVO.getAlarmDataId()); @@ -61,7 +59,6 @@ public class AlarmDataServiceImpl implements AlarmDataService { } @Override - @TenantIgnore public void deleteAlarmData(Long id) { // 校验存在 validateAlarmDataExists(id); @@ -69,25 +66,23 @@ public class AlarmDataServiceImpl implements AlarmDataService { alarmDataMapper.deleteById(id); } - @TenantIgnore private void validateAlarmDataExists(Long id) { - if (alarmDataMapper.selectAlarmDataById(id) == null) { + if (alarmDataMapper.selectAlarmDataDetailsById(id) == null) { throw exception(ALARM_DATA_NOT_EXISTS); } } @Override - @TenantIgnore public AlarmDataDTO getAlarmData(Long id) { - return alarmDataMapper.selectAlarmDataById(id); + return alarmDataMapper.selectAlarmDataDetailsById(id); } @Override - @TenantIgnore public PageResult getAlarmDataPage(AlarmDataPageReqVO pageReqVO) { - IPage page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()); - alarmDataMapper.selectAlarmDataList(page, pageReqVO); - return new PageResult<>(page.getRecords(), page.getTotal()); +// IPage page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()); +// alarmDataMapper.selectAlarmDataList(page, pageReqVO); +// return new PageResult<>(page.getRecords(), page.getTotal()); + return alarmDataMapper.selectAlarmDataDetailsList(pageReqVO); } /** @@ -95,7 +90,6 @@ public class AlarmDataServiceImpl implements AlarmDataService { * @return 参数报警列表数据 */ @Override - @TenantIgnore public List getAlarmDataList(String equipAlarmId){ AlarmDataPageReqVO alarmData = new AlarmDataPageReqVO(); alarmData.setEquipAlarmId(equipAlarmId); @@ -106,7 +100,6 @@ public class AlarmDataServiceImpl implements AlarmDataService { * 关闭制定设备报警id下的所有参数报警记录 */ @Override - @TenantIgnore @Transactional public int closeAllAlarmDataByEquipAlarmId(String equipAlarmId){ List alarmDataList = alarmDataMapper.selectAlarmDatas(new AlarmDataPageReqVO().setEquipAlarmId(equipAlarmId)); @@ -119,9 +112,8 @@ public class AlarmDataServiceImpl implements AlarmDataService { } @Override - @TenantIgnore public AlarmDataDTO getAlarmDataByRulesId(String ruleId){ - return alarmDataMapper.selectAlarmDataByRulesId(ruleId); + return alarmDataMapper.selectAlarmDataListByRulesId(ruleId); } @Override diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/AlarmRulesService.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/AlarmRulesService.java index 801292a..a8a499d 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/AlarmRulesService.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/AlarmRulesService.java @@ -4,6 +4,7 @@ import javax.validation.*; import com.inspur.module.system.controller.admin.alarm.vo.*; import com.inspur.module.system.dal.dataobject.alarm.AlarmRulesDO; import com.inspur.framework.common.pojo.PageResult; +import com.inspur.module.system.dal.dataobject.alarm.AlarmRulesDTO; import java.util.List; @@ -42,7 +43,7 @@ public interface AlarmRulesService { * @param id 编号 * @return 机床报警规则 */ - AlarmRulesDO getAlarmRules(String id); + AlarmRulesDTO getAlarmRules(String id); /** * 获得机床报警规则分页 @@ -50,10 +51,10 @@ public interface AlarmRulesService { * @param pageReqVO 分页查询 * @return 机床报警规则分页 */ - PageResult getAlarmRulesPage(AlarmRulesPageReqVO pageReqVO); + PageResult getAlarmRulesPage(AlarmRulesPageReqVO pageReqVO); /** * 根据设备id查询报警规则 */ - List getAlarmRulesListByEquipId(String equipId); + List getAlarmRulesListByEquipId(String equipId); } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/AlarmRulesServiceImpl.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/AlarmRulesServiceImpl.java index de779fc..8afa4e5 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/AlarmRulesServiceImpl.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/AlarmRulesServiceImpl.java @@ -3,6 +3,7 @@ package com.inspur.module.system.service.alarm; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.inspur.framework.tenant.core.aop.TenantIgnore; +import com.inspur.module.system.dal.dataobject.alarm.AlarmRulesDTO; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -36,7 +37,6 @@ public class AlarmRulesServiceImpl implements AlarmRulesService { private StringRedisTemplate stringRedisTemplate; @Override - @TenantIgnore public String createAlarmRules(AlarmRulesSaveReqVO createReqVO) { // 插入 AlarmRulesDO alarmRules = BeanUtils.toBean(createReqVO, AlarmRulesDO.class); @@ -48,7 +48,6 @@ public class AlarmRulesServiceImpl implements AlarmRulesService { } @Override - @TenantIgnore public void updateAlarmRules(AlarmRulesSaveReqVO updateReqVO) { // 校验存在 validateAlarmRulesExists(updateReqVO.getAlarmId()); @@ -58,7 +57,6 @@ public class AlarmRulesServiceImpl implements AlarmRulesService { } @Override - @TenantIgnore public void deleteAlarmRules(String id) { // 校验存在 validateAlarmRulesExists(id); @@ -66,9 +64,8 @@ public class AlarmRulesServiceImpl implements AlarmRulesService { alarmRulesMapper.deleteById(id); } - @TenantIgnore private void validateAlarmRulesExists(String id) { - AlarmRulesDO alarmRule = alarmRulesMapper.selectAlarmRulesById(id); + AlarmRulesDTO alarmRule = alarmRulesMapper.selectAlarmRulesDetailsById(id); if (alarmRule == null) { throw exception(ALARM_RULES_NOT_EXISTS); }else{ @@ -77,23 +74,21 @@ public class AlarmRulesServiceImpl implements AlarmRulesService { } @Override - @TenantIgnore - public AlarmRulesDO getAlarmRules(String id) { - return alarmRulesMapper.selectAlarmRulesById(id); + public AlarmRulesDTO getAlarmRules(String id) { + return alarmRulesMapper.selectAlarmRulesDetailsById(id); } @Override - @TenantIgnore - public PageResult getAlarmRulesPage(AlarmRulesPageReqVO pageReqVO) { - IPage page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()); - alarmRulesMapper.selectAlarmRulesList(page, pageReqVO); - return new PageResult<>(page.getRecords(), page.getTotal()); + public PageResult getAlarmRulesPage(AlarmRulesPageReqVO pageReqVO) { +// IPage page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()); +// alarmRulesMapper.selectAlarmRulesList(page, pageReqVO); +// return new PageResult<>(page.getRecords(), page.getTotal()); + return alarmRulesMapper.selectAlarmRulesDetailsList(pageReqVO); } @Override - @TenantIgnore - public List getAlarmRulesListByEquipId(String equipId){ - return alarmRulesMapper.getAlarmRulesListByEquipId(equipId); + public List getAlarmRulesListByEquipId(String equipId){ + return alarmRulesMapper.getAlarmRulesDetailsListByEquipId(equipId); } } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/EquipAlarmDataService.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/EquipAlarmDataService.java index 268100f..2efad6e 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/EquipAlarmDataService.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/EquipAlarmDataService.java @@ -7,6 +7,7 @@ import com.inspur.module.system.controller.admin.alarm.vo.*; import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDO; import com.inspur.framework.common.pojo.PageResult; import com.inspur.framework.common.pojo.PageParam; +import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDTO; /** * 机床设备报警数据 Service 接口 @@ -43,7 +44,7 @@ public interface EquipAlarmDataService { * @param id 编号 * @return 机床设备报警数据 */ - EquipAlarmDataDO getEquipAlarmData(String id); + EquipAlarmDataDTO getEquipAlarmData(String id); /** * 获得机床设备报警数据分页 @@ -51,12 +52,12 @@ public interface EquipAlarmDataService { * @param pageReqVO 分页查询 * @return 机床设备报警数据分页 */ - PageResult getEquipAlarmDataPage(EquipAlarmDataPageReqVO pageReqVO); + PageResult getEquipAlarmDataPage(EquipAlarmDataPageReqVO pageReqVO); /** * 通过设备id查询设备报警数据 */ - List getEquipAlarmDataByEquipId(String equipId,Integer alarmType); + List getEquipAlarmDataByEquipId(String equipId,Integer alarmType); /** * 获取报警提交维修工单详情 @@ -66,7 +67,7 @@ public interface EquipAlarmDataService { * @param alarmId 报警id * @return com.inspur.module.system.controller.admin.alarm.vo.AlarmSubmitOrderDetailsVO */ - AlarmSubmitOrderDetailsVO getSubmitOrderDetails(String alarmId); + EquipAlarmDataDTO getSubmitOrderDetails(String alarmId); /** * 判断报警是否已经提交工单 diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/EquipAlarmDataServiceImpl.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/EquipAlarmDataServiceImpl.java index e029a9a..75dcc8c 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/EquipAlarmDataServiceImpl.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/EquipAlarmDataServiceImpl.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.inspur.framework.tenant.core.aop.TenantIgnore; import com.inspur.module.system.dal.dataobject.alarm.AlarmRulesDO; +import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDTO; import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO; import com.inspur.module.system.dal.mysql.maintenance.MaintenanceOrderMapper; import org.springframework.stereotype.Service; @@ -45,7 +46,6 @@ public class EquipAlarmDataServiceImpl implements EquipAlarmDataService { private MaintenanceOrderMapper maintenanceOrderMapper; @Override - @TenantIgnore public String createEquipAlarmData(EquipAlarmDataSaveReqVO createReqVO) { // 插入 EquipAlarmDataDO equipAlarmData = BeanUtils.toBean(createReqVO, EquipAlarmDataDO.class); @@ -55,7 +55,6 @@ public class EquipAlarmDataServiceImpl implements EquipAlarmDataService { } @Override - @TenantIgnore public void updateEquipAlarmData(EquipAlarmDataSaveReqVO updateReqVO) { // 校验存在 validateEquipAlarmDataExists(updateReqVO.getEquipAlarmId()); @@ -65,7 +64,6 @@ public class EquipAlarmDataServiceImpl implements EquipAlarmDataService { } @Override - @TenantIgnore public void deleteEquipAlarmData(String id) { // 校验存在 validateEquipAlarmDataExists(id); @@ -73,41 +71,36 @@ public class EquipAlarmDataServiceImpl implements EquipAlarmDataService { equipAlarmDataMapper.deleteById(id); } - @TenantIgnore private void validateEquipAlarmDataExists(String id) { - if (equipAlarmDataMapper.selectEquipAlarmById(id) == null) { + if (equipAlarmDataMapper.selectEquipAlarmDetailsById(id) == null) { throw exception(EQUIP_ALARM_DATA_NOT_EXISTS); } } @Override - @TenantIgnore - public EquipAlarmDataDO getEquipAlarmData(String id) { - return equipAlarmDataMapper.selectEquipAlarmById(id); + public EquipAlarmDataDTO getEquipAlarmData(String id) { + return equipAlarmDataMapper.selectEquipAlarmDetailsById(id); } @Override - @TenantIgnore - public PageResult getEquipAlarmDataPage(EquipAlarmDataPageReqVO pageReqVO) { - IPage page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()); - equipAlarmDataMapper.selectEquipAlarmList(page, pageReqVO); - return new PageResult<>(page.getRecords(), page.getTotal()); + public PageResult getEquipAlarmDataPage(EquipAlarmDataPageReqVO pageReqVO) { +// IPage page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()); +// equipAlarmDataMapper.selectEquipAlarmList(page, pageReqVO); +// return new PageResult<>(page.getRecords(), page.getTotal()); + return equipAlarmDataMapper.selectEquipAlarmDetailsList(pageReqVO); } @Override - @TenantIgnore - public List getEquipAlarmDataByEquipId(String equipId,Integer alarmType) { - return equipAlarmDataMapper.getEquipAlarmDataByEquipIdAndAlarmType(equipId,alarmType); + public List getEquipAlarmDataByEquipId(String equipId,Integer alarmType) { + return equipAlarmDataMapper.getEquipAlarmDataDetailsByEquipIdAndAlarmType(equipId,alarmType); } @Override - @TenantIgnore - public AlarmSubmitOrderDetailsVO getSubmitOrderDetails(String alarmId) { - return equipAlarmDataMapper.getSubmitOrderDetails(alarmId); + public EquipAlarmDataDTO getSubmitOrderDetails(String alarmId) { + return equipAlarmDataMapper.selectEquipAlarmDetailsById(alarmId); } @Override - @TenantIgnore public String isSubmitOrder(String alarmId) { List list = maintenanceOrderMapper.selectList(new LambdaQueryWrapper() .eq(MaintenanceOrderDO::getAlarmId, alarmId) diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/EquipDashboardService.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/EquipDashboardService.java new file mode 100644 index 0000000..6b8980c --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/EquipDashboardService.java @@ -0,0 +1,18 @@ +package com.inspur.module.system.service.equip; + +import com.inspur.module.system.controller.equip.vo.EquipDashboardDetailsRespVO; + +import java.util.List; + +/** + * @Author zhangjunwen + * @create 2024/10/10 + */ +public interface EquipDashboardService { + + /** + * 设备看板详情 + */ + List getAllEquipDashboardDetails(); + +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/EquipDashboardServiceImpl.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/EquipDashboardServiceImpl.java new file mode 100644 index 0000000..061c121 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/EquipDashboardServiceImpl.java @@ -0,0 +1,93 @@ +package com.inspur.module.system.service.equip; + +import cn.hutool.core.collection.CollUtil; +import com.inspur.framework.common.util.object.BeanUtils; +import com.inspur.module.data.DataQueryApi; +import com.inspur.module.system.controller.equip.vo.EquipDashboardDetailsRespVO; +import com.inspur.module.system.dal.dataobject.baseData.ModelInfoDO; +import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO; +import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO; +import com.inspur.module.system.dal.mysql.equip.EquipInfoMapper; +import com.inspur.module.system.service.alarm.AlarmDataService; +import com.inspur.module.system.service.baseData.CustomerInfoService; +import com.inspur.module.system.service.baseData.ModelInfoService; +import com.inspur.module.system.service.maintenance.MaintenanceOrderService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * @Author zhangjunwen + * @create 2024/10/10 + */ +@Service +public class EquipDashboardServiceImpl implements EquipDashboardService{ + + @Resource + private EquipInfoMapper equipInfoMapper; + + @Resource + private ModelInfoService modelInfoService; + + @Resource + private MaintenanceOrderService maintenanceOrderService; + + @Resource + private AlarmDataService alarmDataService; + + @Resource + private DataQueryApi dataQueryApi; + + /** + * 设备看板详情 + */ + public List getAllEquipDashboardDetails(){ + List equipInfoList = equipInfoMapper.selectList(); + List dashboardDetailsResp = new ArrayList<>(); + if(!CollUtil.isNotEmpty(equipInfoList)){ + return null; + } + + for (EquipInfoDO equipInfoDO : equipInfoList) { + EquipDashboardDetailsRespVO vo = BeanUtils.toBean(equipInfoDO, EquipDashboardDetailsRespVO.class); + //设置设备型号 + if (Objects.nonNull(vo.getModelId())){ + ModelInfoDO modelInfo = modelInfoService.getModelInfo(vo.getModelId()); + if (Objects.nonNull(modelInfo)){ + //设置设备型号 + vo.setModelName(modelInfo.getModelName()); + } + } + + Long alarmNum = alarmDataService.getAlarmCountByEquipId(vo.getEquipId()); + vo.setAlarmNum(alarmNum); + + if(Objects.nonNull(equipInfoDO.getRunStatus()) && equipInfoDO.getRunStatus() != 2) { + //获取工作数据、 + Map latestDataMap = dataQueryApi.getLatestFanucData(vo.getEquipId()); + Map oldestDataMap = dataQueryApi.getOldestFanucData(vo.getEquipId()); + if (CollUtil.isNotEmpty(latestDataMap) && CollUtil.isNotEmpty(oldestDataMap)) { + vo.setPowerTime(Double.parseDouble(latestDataMap.get("power_time").toString()) / 60.0); + vo.setWorkTime(Double.parseDouble(latestDataMap.get("work_time").toString()) / 60.0); + vo.setProcessNum((int) Double.parseDouble(latestDataMap.get("process_num").toString())); + vo.setTodayWorkTime((Double.parseDouble(latestDataMap.get("work_time").toString()) - Double.parseDouble(oldestDataMap.get("work_time").toString())) / 60.0); + vo.setTodayProcessNum((int) (Double.parseDouble(latestDataMap.get("process_num").toString()) - Double.parseDouble(oldestDataMap.get("process_num").toString()))); + vo.setTodayEfficiency(vo.getTodayProcessNum() / vo.getTodayWorkTime()); + } + }else{//维修状态 + MaintenanceOrderDO maintenanceOrderDO = maintenanceOrderService.getLatestMaintenanceOrder(vo.getEquipId()); + if(Objects.nonNull(maintenanceOrderDO) && Objects.nonNull(maintenanceOrderDO.getStatus())){ + vo.setMaintenanceStatus(maintenanceOrderDO.getStatus()); + }else { + vo.setMaintenanceStatus(0); + } + } + dashboardDetailsResp.add(vo); + } + return dashboardDetailsResp; + } +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/EquipInfoService.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/EquipInfoService.java index f6f7331..1fbb455 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/EquipInfoService.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/EquipInfoService.java @@ -79,4 +79,5 @@ public interface EquipInfoService { * @return com.inspur.module.system.controller.equip.vo.EquipInfoDetailsVO */ EquipInfoDetailsVO getEquipInfoDetailsById(String id); -} \ No newline at end of file + +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/EquipInfoServiceImpl.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/EquipInfoServiceImpl.java index 30ee677..1ba4037 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/EquipInfoServiceImpl.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/EquipInfoServiceImpl.java @@ -2,17 +2,22 @@ package com.inspur.module.system.service.equip; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.inspur.framework.common.pojo.PageResult; import com.inspur.framework.tenant.core.aop.TenantIgnore; +import com.inspur.module.data.DataQueryApi; import com.inspur.module.system.controller.baseData.vo.CustomerInfoSelectionVO; import com.inspur.module.system.controller.equip.vo.*; import com.inspur.module.system.dal.dataobject.baseData.CustomerInfoDO; import com.inspur.module.system.dal.dataobject.baseData.ModelInfoDO; import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO; +import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO; import com.inspur.module.system.dal.mysql.equip.EquipInfoMapper; import com.inspur.module.system.enums.ErrorCodeConstants; +import com.inspur.module.system.service.alarm.AlarmDataService; import com.inspur.module.system.service.baseData.CustomerInfoService; import com.inspur.module.system.service.baseData.ModelInfoService; +import com.inspur.module.system.service.maintenance.MaintenanceOrderService; import org.springframework.stereotype.Service; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -41,6 +46,7 @@ public class EquipInfoServiceImpl implements EquipInfoService { @Resource private ModelInfoService modelInfoService; + @Override public String createEquipInfo(EquipInfoSaveReqVO createReqVO) { // 插入 @@ -97,7 +103,9 @@ public class EquipInfoServiceImpl implements EquipInfoService { List list = new ArrayList<>(); if (CollUtil.isNotEmpty(customerList)){ //所有机床信息 - List equipInfoList = equipInfoMapper.selectList(); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.orderBy(true,true,"create_time"); + List equipInfoList = equipInfoMapper.selectList(queryWrapper); Map> equipInfoMap = equipInfoList.stream().collect(Collectors.groupingBy(EquipInfoDO::getCustomerId)); customerList.forEach(item -> { EquipCascaderVO vo = new EquipCascaderVO(); @@ -109,7 +117,7 @@ public class EquipInfoServiceImpl implements EquipInfoService { equipInfoDOList.forEach(equip -> { EquipCascaderVO equipCascaderVO = new EquipCascaderVO(); equipCascaderVO.setId(equip.getEquipId()); - equipCascaderVO.setName(equip.getEquipNo()); + equipCascaderVO.setName(equip.getEquipName()); children.add(equipCascaderVO); }); if (CollUtil.isNotEmpty(children)){ @@ -170,4 +178,5 @@ public class EquipInfoServiceImpl implements EquipInfoService { } throw exception(ErrorCodeConstants.EQUIP_INFO_NOT_EXISTS); } + } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/gatewayinfo/GatewayInfoService.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/gatewayinfo/GatewayInfoService.java index 565deb8..c737da0 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/gatewayinfo/GatewayInfoService.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/gatewayinfo/GatewayInfoService.java @@ -6,7 +6,7 @@ import javax.validation.*; import com.inspur.module.system.controller.admin.gatewayinfo.vo.*; import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDO; import com.inspur.framework.common.pojo.PageResult; -import com.inspur.framework.common.pojo.PageParam; +import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDetailsDTO; /** * 机床网关信息 Service 接口 @@ -43,7 +43,7 @@ public interface GatewayInfoService { * @param id 编号 * @return 机床网关信息 */ - GatewayInfoDO getGatewayInfo(String id); + GatewayInfoDetailsDTO getGatewayInfo(String id); /** * 获得机床网关信息分页 @@ -51,17 +51,17 @@ public interface GatewayInfoService { * @param pageReqVO 分页查询 * @return 机床网关信息分页 */ - PageResult getGatewayInfoPage(GatewayInfoPageReqVO pageReqVO); + PageResult getGatewayInfoPage(GatewayInfoPageReqVO pageReqVO); /** * 获取机床网关列表 */ - List getGatewayInfoList(); + List getGatewayInfoList(); /** * 根据机床网关编号获取机床网关信息 */ - GatewayInfoDO getGatewayInfoByGatewayCode(String gatewayCode); + GatewayInfoDetailsDTO getGatewayInfoByGatewayCode(String gatewayCode); /** * 根据网关id获取机床网关网卡信息和参数信息 diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/gatewayinfo/GatewayInfoServiceImpl.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/gatewayinfo/GatewayInfoServiceImpl.java index 1d2040c..e852678 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/gatewayinfo/GatewayInfoServiceImpl.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/gatewayinfo/GatewayInfoServiceImpl.java @@ -1,12 +1,10 @@ package com.inspur.module.system.service.gatewayinfo; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.inspur.framework.common.util.json.JsonUtils; import com.inspur.framework.tenant.core.aop.TenantIgnore; -import com.inspur.module.system.dal.dataobject.alarm.AlarmRulesDO; import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayCardInfoDO; import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayCardParamsDO; +import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDetailsDTO; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; @@ -14,14 +12,12 @@ import javax.annotation.PostConstruct; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; -import org.springframework.transaction.annotation.Transactional; import java.util.*; import com.inspur.module.system.controller.admin.gatewayinfo.vo.*; import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDO; import com.inspur.framework.common.pojo.PageResult; -import com.inspur.framework.common.pojo.PageParam; import com.inspur.framework.common.util.object.BeanUtils; import com.inspur.module.system.dal.mysql.gatewayinfo.GatewayInfoMapper; @@ -52,9 +48,9 @@ public class GatewayInfoServiceImpl implements GatewayInfoService { @PostConstruct public void init() { - List gatewayInfoList = getGatewayInfoList(); + List gatewayInfoList = getGatewayInfoList(); - for (GatewayInfoDO gatewayInfo : gatewayInfoList) { + for (GatewayInfoDetailsDTO gatewayInfo : gatewayInfoList) { getGatewayCardAndParamByCatch(gatewayInfo.getGatewayId()); } } @@ -91,31 +87,32 @@ public class GatewayInfoServiceImpl implements GatewayInfoService { @TenantIgnore private void validateGatewayInfoExists(String id) { - if (gatewayInfoMapper.selectGatewayById(id) == null) { + if (gatewayInfoMapper.selectGatewayDetailsById(id) == null) { throw exception(GATEWAY_INFO_NOT_EXISTS); } } @Override @TenantIgnore - public GatewayInfoDO getGatewayInfo(String id) { - return gatewayInfoMapper.selectGatewayById(id); + public GatewayInfoDetailsDTO getGatewayInfo(String id) { + return gatewayInfoMapper.selectGatewayDetailsById(id); } @Override @TenantIgnore - public PageResult getGatewayInfoPage(GatewayInfoPageReqVO pageReqVO) { - IPage page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()); - gatewayInfoMapper.selectGatewayList(page, pageReqVO); - return new PageResult<>(page.getRecords(), page.getTotal()); + public PageResult getGatewayInfoPage(GatewayInfoPageReqVO pageReqVO) { +// IPage page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()); +// gatewayInfoMapper.selectGatewayList(page, pageReqVO); +// return new PageResult<>(page.getRecords(), page.getTotal()); + return gatewayInfoMapper.selectGatewayDetailsList(pageReqVO); } /** * 获取机床网关列表 */ @Override - public List getGatewayInfoList(){ - return gatewayInfoMapper.selectAllGatewayList(); + public List getGatewayInfoList(){ + return gatewayInfoMapper.selectAllGatewayDetailsList(); } /** @@ -123,8 +120,8 @@ public class GatewayInfoServiceImpl implements GatewayInfoService { */ @Override @TenantIgnore - public GatewayInfoDO getGatewayInfoByGatewayCode(String gatewayCode){ - return gatewayInfoMapper.selectGatewayByGatewayCode(gatewayCode); + public GatewayInfoDetailsDTO getGatewayInfoByGatewayCode(String gatewayCode){ + return gatewayInfoMapper.selectGatewayDetailsByGatewayCode(gatewayCode); } /** diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderService.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderService.java index 1a44d71..05df871 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderService.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderService.java @@ -119,4 +119,9 @@ public interface MaintenanceOrderService { * @return java.lang.Boolean */ Boolean submitPatrolPlan(MaintenanceSubmitPatrolPlanVO vo); + + /** + * 根据设备id获取最新的一条维修工单 + */ + MaintenanceOrderDO getLatestMaintenanceOrder(String equipId); } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderServiceImpl.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderServiceImpl.java index 70e19a0..538ad8f 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderServiceImpl.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderServiceImpl.java @@ -288,4 +288,9 @@ public class MaintenanceOrderServiceImpl implements MaintenanceOrderService { public Boolean submitPatrolPlan(MaintenanceSubmitPatrolPlanVO vo) { return maintenanceOrderMapper.updateById(new MaintenanceOrderDO().setMaintenanceOrderId(vo.getMaintenanceOrderId()).setPatrolPlan(vo.getPatrolPlan())) > 0; } + + @Override + public MaintenanceOrderDO getLatestMaintenanceOrder(String equipId){ + return maintenanceOrderMapper.selectOne(new LambdaQueryWrapper().eq(MaintenanceOrderDO::getEquipId, equipId).orderByDesc(MaintenanceOrderDO::getCreateTime)); + } } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/resources/mapper/gatewayinfo/GatewayInfoMapper.xml b/imt-server/imt-module-system/imt-module-system-biz/src/main/resources/mapper/gatewayinfo/GatewayInfoMapper.xml index 6c7c94e..63d49db 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/resources/mapper/gatewayinfo/GatewayInfoMapper.xml +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/resources/mapper/gatewayinfo/GatewayInfoMapper.xml @@ -21,7 +21,7 @@ - select igi.gateway_id,igi.equip_id,igi.gateway_name,igi.gateway_model,igi.gateway_code,igi.gateway_mfg,igi.gateway_location,igi.firmware_version,igi.ip_address,igi.gateway_spn,igi.status,igi.gateway_pic_path,igi.remark,iei.equip_no,imi.model_name,ic.customer_name FROM `imt_gateway_info` igi + select igi.gateway_id,igi.equip_id,igi.gateway_name,igi.gateway_model,igi.gateway_code,igi.gateway_mfg,igi.gateway_location,igi.firmware_version,igi.ip_address,igi.gateway_spn,igi.status,igi.gateway_pic_path,igi.remark FROM `imt_gateway_info` igi left join imt_equip_info iei on igi.equip_id = iei.equip_id left join imt_model_info imi on iei.model_id = imi.model_id left join imt_customer_info ic on iei.customer_id = ic.customer_id diff --git a/imt-server/imt-server/src/main/resources/application.yaml b/imt-server/imt-server/src/main/resources/application.yaml index 81921d7..5cd0677 100644 --- a/imt-server/imt-server/src/main/resources/application.yaml +++ b/imt-server/imt-server/src/main/resources/application.yaml @@ -287,6 +287,7 @@ imt: - rep_demo_jianpiao - tmp_report_data_1 - tmp_report_data_income + - imt_model_info ignore-caches: - permission_menu_ids - oauth_client diff --git a/imt-ui/src/api/system/equip/equipInfo.js b/imt-ui/src/api/system/equip/equipInfo.js index 034c814..81ca26a 100644 --- a/imt-ui/src/api/system/equip/equipInfo.js +++ b/imt-ui/src/api/system/equip/equipInfo.js @@ -1,77 +1,85 @@ -import request from '@/utils/request' +import request from "@/utils/request"; // 创建机床信息 export function createEquipInfo(data) { return request({ - url: '/equip/equipInfo/create', - method: 'post', - data: data - }) + url: "/equip/equipInfo/create", + method: "post", + data: data, + }); } // 更新机床信息 export function updateEquipInfo(data) { return request({ - url: '/equip/equipInfo/update', - method: 'put', - data: data - }) + url: "/equip/equipInfo/update", + method: "put", + data: data, + }); } // 删除机床信息 export function deleteEquipInfo(id) { return request({ - url: '/equip/equipInfo/delete?id=' + id, - method: 'delete' - }) + url: "/equip/equipInfo/delete?id=" + id, + method: "delete", + }); } // 获得机床信息 export function getEquipInfo(id) { return request({ - url: '/equip/equipInfo/get?id=' + id, - method: 'get' - }) + url: "/equip/equipInfo/get?id=" + id, + method: "get", + }); } // 获得机床信息分页 export function getEquipInfoPage(params) { return request({ - url: '/equip/equipInfo/page', - method: 'get', - params - }) + url: "/equip/equipInfo/page", + method: "get", + params, + }); } // 导出机床信息 Excel export function exportEquipInfoExcel(params) { return request({ - url: '/equip/equipInfo/export-excel', - method: 'get', + url: "/equip/equipInfo/export-excel", + method: "get", params, - responseType: 'blob' - }) + responseType: "blob", + }); } // 机床信息下拉 export function getEquipSelection() { return request({ - url: '/equip/equipInfo/selection', - method: 'get' - }) + url: "/equip/equipInfo/selection", + method: "get", + }); } // 机床信息级联 export function getEquipCascader() { return request({ - url: '/equip/equipInfo/cascader', - method: 'get' - }) + url: "/equip/equipInfo/cascader", + method: "get", + }); } // 获得机床详情 export function getEquipInfoDetails(id) { return request({ - url: '/equip/equipInfo/details/' + id, - method: 'get' - }) + url: "/equip/equipInfo/details/" + id, + method: "get", + }); +} + +// 机床看板详情 +export function getEquipDashboard() { + return request({ + url: "/equip/equipInfo/dashboard", + method: "get", + }); } diff --git a/imt-ui/src/layout/components/Message/index.vue b/imt-ui/src/layout/components/Message/index.vue index c27e8ee..7b30246 100644 --- a/imt-ui/src/layout/components/Message/index.vue +++ b/imt-ui/src/layout/components/Message/index.vue @@ -1,40 +1,81 @@