Merge branch 'zjw'
This commit is contained in:
commit
d3a2de1b4d
@ -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<String, Object> getLatestFanucData(String equipId);
|
||||
|
||||
/**
|
||||
* 获取最老一条fanuc数据
|
||||
*/
|
||||
public Map<String, Object> getOldestFanucData(String equipId);
|
||||
}
|
@ -18,6 +18,12 @@
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.inspur</groupId>
|
||||
<artifactId>imt-module-data-api</artifactId>
|
||||
<version>2.2.0-jdk8-snapshot</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.inspur</groupId>
|
||||
<artifactId>imt-common</artifactId>
|
||||
|
@ -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<String, Object> getLatestFanucData(String equipId) {
|
||||
String columns = "power_time,process_num,total_process,work_time";
|
||||
Map<String, Object> latestDataMap = dataQueryService.getLatestData(equipId,"gateway_fanuc_data", columns);
|
||||
return latestDataMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最老一条fanuc数据
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getOldestFanucData(String equipId){
|
||||
String columns = "power_time,process_num,total_process,work_time";
|
||||
Map<String, Object> oldestDataMap = dataQueryService.getOldestData(equipId,"gateway_fanuc_data", columns);
|
||||
return oldestDataMap;
|
||||
}
|
||||
}
|
@ -149,7 +149,7 @@ public class DataQueryController {
|
||||
HttpServletResponse response) throws IOException, ParseException {
|
||||
List<VibrDataRespVO> list = (List<VibrDataRespVO>)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));
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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<String, Object> 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);
|
||||
}
|
||||
|
||||
|
@ -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<String, Object> selectDataListByPages(String equipId,String tableName,String startTime,String endTime, Integer pageSize, Integer pageNum){
|
||||
public Map<String, Object> selectDataListByPages(String equipId, String tableName, String startTime, String endTime, Integer pageSize, Integer pageNum) {
|
||||
Map<String, Object> resMap = new HashMap<>();
|
||||
//TODO 分页查找条数,根据设备id、表名、时间范围、页码、每页条数
|
||||
List<Map<String, Object>> dataList = queryDataByTime(tableName, null, startTime, endTime, pageNum, pageSize);
|
||||
List<Map<String, Object>> dataList = queryDataByTime(tableName, equipId, startTime, endTime, pageNum, pageSize);
|
||||
dataList.forEach(map -> {
|
||||
try {
|
||||
String time = map.get("time").toString();
|
||||
@ -44,7 +46,11 @@ public class DataQueryService implements IDataQueryService{
|
||||
//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<String> 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<Map<String, Object>> list = selectDataByColumnNameandDateSegmentation(equipId, tableName, columnName, startTime, endTime, intervalHours);
|
||||
Map<String, Object> resMap = new HashMap<>();
|
||||
if (list.size() == 0){
|
||||
if (list.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<Object> columnList = new ArrayList<>();
|
||||
List<String> timelist = new ArrayList<>();
|
||||
if(intervalHours > 6){
|
||||
if (intervalHours > 6) {
|
||||
columnName = "mean";
|
||||
}
|
||||
for (Map<String, Object> data : list) {
|
||||
@ -93,49 +99,49 @@ public class DataQueryService implements IDataQueryService{
|
||||
/**
|
||||
* 根据设备id获取排屑电流数据
|
||||
*/
|
||||
public Map<String, Object> getCurrentData(String equipId, String startTime, String endTime){
|
||||
public Map<String, Object> 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<String, Object> getPressData(String equipId, String startTime, String endTime){
|
||||
public Map<String, Object> 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<String, Object> getTempData(String equipId, String startTime, String endTime){
|
||||
public Map<String, Object> 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<String, Object> getVibrData(String equipId, String startTime, String endTime){
|
||||
public Map<String, Object> 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<String, Object> getWorkData(String equipId, String startTime, String endTime){
|
||||
public Map<String, Object> getWorkData(String equipId, String startTime, String endTime) {
|
||||
String tableName = "gateway_fanuc_data";
|
||||
String columnName = "power_time,process_num,total_process,work_time";
|
||||
Map<String, Object> resultMap = getAllData2ChartData(equipId,tableName,columnName, startTime, endTime);
|
||||
if(resultMap == null){
|
||||
Map<String, Object> resultMap = getAllData2ChartData(equipId, tableName, columnName, startTime, endTime);
|
||||
if (resultMap == null) {
|
||||
return null;
|
||||
}
|
||||
List<Double> workTimeList = (List<Double>) resultMap.get("work_time");
|
||||
@ -145,40 +151,70 @@ public class DataQueryService implements IDataQueryService{
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
public Map<String, Object> getAllData2ChartData(String equipId,String tableName,String columns, String startTime, String endTime){
|
||||
/**
|
||||
* 查询当日最新一条数据
|
||||
*/
|
||||
public Map<String, Object> 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<Map<String, Object>> dataList = selectOneDataByColumnsandDate(equipId, tableName, columns, beginTime, endTime, "desc");
|
||||
if (CollUtil.isEmpty(dataList)) {
|
||||
return null;
|
||||
}
|
||||
return dataList.get(0);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> 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<Map<String, Object>> dataList = selectOneDataByColumnsandDate(equipId, tableName, columns, beginTime, endTime, "asc");
|
||||
if (CollUtil.isEmpty(dataList)) {
|
||||
return null;
|
||||
}
|
||||
return dataList.get(0);
|
||||
}
|
||||
|
||||
public Map<String, Object> 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<Map<String, Object>> list = selectDataByColumnNameandDateSegmentation(equipId, tableName, columns, startTime, endTime, intervalHours);
|
||||
Map<String, Object> resMap = new HashMap<>();
|
||||
if (list.size() == 0){
|
||||
if (list.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<Object> columnList = new ArrayList<>();
|
||||
List<String> 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;
|
||||
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;
|
||||
if ("work_time".equals(columnName) || "power_time".equals(columnName)) {//时间转小时
|
||||
return data / 60.0;
|
||||
}
|
||||
return data;
|
||||
}).collect(Collectors.toList()));
|
||||
@ -189,19 +225,18 @@ public class DataQueryService implements IDataQueryService{
|
||||
}
|
||||
|
||||
/**
|
||||
*按照策略分段查询数据列表
|
||||
* 按照策略分段查询数据列表
|
||||
*/
|
||||
private List<Map<String, Object>> selectDataByColumnNameandDateSegmentation(String equipId, String tableName, String columnName, String startTime, String endTime,long intervalHours)
|
||||
{
|
||||
private List<Map<String, Object>> selectDataByColumnNameandDateSegmentation(String equipId, String tableName, String columnName, String startTime, String endTime, long intervalHours) {
|
||||
List<Map<String, Object>> 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<Map<String, Object>> 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 columnName 字段名称
|
||||
* @param beginTime 起始时间
|
||||
* @param endTime 结束时间
|
||||
* @return 数据
|
||||
*/
|
||||
private List<Map<String, Object>> selectDataByColumnNameandDate(String equipId, String tableName, String columnName, String beginTime, String endTime){
|
||||
private List<Map<String, Object>> 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<Map<String, Object>> selectLongTimeDataByColumnNameandDate(String equipId,String tableName, String columnName, String beginTime, String endTime, String interval){
|
||||
if(columnName.split(",").length > 1){
|
||||
private List<Map<String, Object>> 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<Map<String, Object>> 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()));
|
||||
}
|
||||
}
|
||||
|
@ -46,4 +46,14 @@ public interface IDataQueryService {
|
||||
* 根据设备id获取工作数据
|
||||
*/
|
||||
public Map<String, Object> getWorkData(String equipId, String startTime, String endTime);
|
||||
|
||||
/**
|
||||
* 查询当日最新一条数据
|
||||
*/
|
||||
public Map<String, Object> getLatestData(String equipId, String tableName, String columns);
|
||||
|
||||
/**
|
||||
* 查询当日最旧一条数据
|
||||
*/
|
||||
public Map<String, Object> getOldestData(String equipId, String tableName, String columns);
|
||||
}
|
||||
|
@ -155,6 +155,12 @@
|
||||
<version>2.2.0-jdk8-snapshot</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.inspur</groupId>
|
||||
<artifactId>imt-module-data-api</artifactId>
|
||||
<version>2.2.0-jdk8-snapshot</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -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<EquipAlarmDataDO> equipAlarmData = equipAlarmDataService.getEquipAlarmDataByEquipId(rule.getEquipId(),0);
|
||||
List<EquipAlarmDataDTO> 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<EquipAlarmDataDO> equipAlarmData = equipAlarmDataService.getEquipAlarmDataByEquipId(rule.getEquipId(),null);
|
||||
List<EquipAlarmDataDTO> 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())));
|
||||
|
@ -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<Boolean> 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<AlarmRulesRespVO> 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<PageResult<AlarmRulesRespVO>> getAlarmRulesPage(@Valid AlarmRulesPageReqVO pageReqVO) {
|
||||
PageResult<AlarmRulesDO> pageResult = alarmRulesService.getAlarmRulesPage(pageReqVO);
|
||||
PageResult<AlarmRulesDTO> 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<AlarmRulesDO> list = alarmRulesService.getAlarmRulesPage(pageReqVO).getList();
|
||||
List<AlarmRulesDTO> list = alarmRulesService.getAlarmRulesPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "机床报警规则.xls", "数据", AlarmRulesRespVO.class,
|
||||
BeanUtils.toBean(list, AlarmRulesRespVO.class));
|
||||
|
@ -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<EquipAlarmDataRespVO> 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<PageResult<EquipAlarmDataRespVO>> getEquipAlarmDataPage(@Valid EquipAlarmDataPageReqVO pageReqVO) {
|
||||
PageResult<EquipAlarmDataDO> pageResult = equipAlarmDataService.getEquipAlarmDataPage(pageReqVO);
|
||||
PageResult<EquipAlarmDataDTO> 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<EquipAlarmDataDO> list = equipAlarmDataService.getEquipAlarmDataPage(pageReqVO).getList();
|
||||
List<EquipAlarmDataDTO> 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<AlarmSubmitOrderDetailsVO> getSubmitOrderDetails(@PathVariable("alarmId") String alarmId) {
|
||||
public CommonResult<EquipAlarmDataDTO> getSubmitOrderDetails(@PathVariable("alarmId") String alarmId) {
|
||||
return success(equipAlarmDataService.getSubmitOrderDetails(alarmId));
|
||||
}
|
||||
|
||||
|
@ -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<GatewayInfoRespVO> 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<PageResult<GatewayInfoRespVO>> getGatewayInfoPage(@Valid GatewayInfoPageReqVO pageReqVO) {
|
||||
PageResult<GatewayInfoDO> pageResult = gatewayInfoService.getGatewayInfoPage(pageReqVO);
|
||||
PageResult<GatewayInfoDetailsDTO> 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<GatewayInfoDO> list = gatewayInfoService.getGatewayInfoPage(pageReqVO).getList();
|
||||
List<GatewayInfoDetailsDTO> list = gatewayInfoService.getGatewayInfoPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "机床网关信息.xls", "数据", GatewayInfoRespVO.class,
|
||||
BeanUtils.toBean(list, GatewayInfoRespVO.class));
|
||||
|
@ -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());
|
||||
|
@ -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<List<EquipDashboardDetailsRespVO>> getAllEquipDashboardDetailsById() {
|
||||
return success(equipDashboardService.getAllEquipDashboardDetails());
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
@ -96,6 +96,11 @@ public class AlarmDataDTO {
|
||||
*/
|
||||
private String equipNo;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String equipName;
|
||||
|
||||
/**
|
||||
* 组件名称
|
||||
*/
|
||||
|
@ -89,10 +89,4 @@ public class AlarmRulesDO extends BaseDO {
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
private String equipNo;
|
||||
|
||||
private String customerName;
|
||||
|
||||
private String componentName;
|
||||
}
|
@ -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;
|
||||
}
|
@ -62,23 +62,4 @@ public class EquipAlarmDataDO extends BaseDO {
|
||||
*/
|
||||
private Integer equipAnalyseStatus;
|
||||
|
||||
/**
|
||||
* 客户名
|
||||
*/
|
||||
private String customerName;
|
||||
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private String equipNo;
|
||||
|
||||
/**
|
||||
* 设备型号
|
||||
*/
|
||||
private String modelName;
|
||||
|
||||
/**
|
||||
* 组件名
|
||||
*/
|
||||
private String componentName;
|
||||
}
|
||||
|
@ -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级)
|
||||
* <p>
|
||||
* 枚举 {@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;
|
||||
}
|
@ -78,18 +78,4 @@ public class GatewayInfoDO extends BaseDO {
|
||||
*/
|
||||
private String gatewayCode;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
private String customerName;
|
||||
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private String equipNo;
|
||||
|
||||
/**
|
||||
* 机床型号
|
||||
*/
|
||||
private String modelName;
|
||||
}
|
||||
|
@ -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:停机)
|
||||
* <p>
|
||||
*/
|
||||
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;
|
||||
|
||||
}
|
@ -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<AlarmDataDO> {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询参数报警列表
|
||||
*/
|
||||
default PageResult<AlarmDataDTO> selectAlarmDataDetailsList(AlarmDataPageReqVO reqVO) {
|
||||
MPJLambdaWrapperX<AlarmDataDO> 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<AlarmDataDTO> selectAlarmDataList(IPage<AlarmDataDTO> page, @Param("reqVO") AlarmDataPageReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 根据id查询参数报警详情
|
||||
*/
|
||||
default AlarmDataDTO selectAlarmDataDetailsById(Long id){
|
||||
return selectJoinOne(AlarmDataDTO.class, new MPJLambdaWrapperX<AlarmDataDO>()
|
||||
.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<AlarmDataDO>()
|
||||
.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查询参数报警
|
||||
*/
|
||||
|
@ -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<AlarmRulesDO> {
|
||||
.orderByDesc(AlarmRulesDO::getAlarmId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询设备报警规则列表
|
||||
*/
|
||||
default PageResult<AlarmRulesDTO> selectAlarmRulesDetailsList(@Param("reqVO") AlarmRulesPageReqVO reqVO) {
|
||||
return selectJoinPage(reqVO, AlarmRulesDTO.class, new MPJLambdaWrapperX<AlarmRulesDO>()
|
||||
.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<AlarmRulesDO> selectAlarmRulesList(IPage<AlarmRulesDO> page, @Param("reqVO") AlarmRulesPageReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 根据id查询报警规则信息
|
||||
*/
|
||||
default AlarmRulesDTO selectAlarmRulesDetailsById(String id){
|
||||
return selectJoinOne(AlarmRulesDTO.class,new MPJLambdaWrapperX<AlarmRulesDO>()
|
||||
.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<AlarmRulesDTO> getAlarmRulesDetailsListByEquipId(String equipId){
|
||||
return selectJoinList(AlarmRulesDTO.class,new MPJLambdaWrapperX<AlarmRulesDO>()
|
||||
.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查询报警规则
|
||||
*/
|
||||
|
@ -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<EquipAlarmDataDO> {
|
||||
.orderByDesc(EquipAlarmDataDO::getEquipAlarmId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询设备报警列表
|
||||
*/
|
||||
default PageResult<EquipAlarmDataDTO> selectEquipAlarmDetailsList(@Param("reqVO") EquipAlarmDataPageReqVO reqVO) {
|
||||
MPJLambdaWrapperX<EquipAlarmDataDO> 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<EquipAlarmDataDO> selectEquipAlarmList(IPage<EquipAlarmDataDO> page, @Param("reqVO") EquipAlarmDataPageReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 根据id查询设备报警信息
|
||||
*/
|
||||
default EquipAlarmDataDTO selectEquipAlarmDetailsById(String id){
|
||||
return selectJoinOne(EquipAlarmDataDTO.class,new MPJLambdaWrapperX<EquipAlarmDataDO>()
|
||||
.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<EquipAlarmDataDTO> getEquipAlarmDataDetailsByEquipIdAndAlarmType(@Param("equipId") String equipId,
|
||||
@Param("alarmType") Integer alarmType){
|
||||
return selectJoinList(EquipAlarmDataDTO.class,new MPJLambdaWrapperX<EquipAlarmDataDO>()
|
||||
.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<EquipAlarmDataDO> getEquipAlarmDataByEquipIdAndAlarmType(@Param("equipId") String equipId,
|
||||
@Param("alarmType") Integer alarmType);
|
||||
|
||||
/**
|
||||
* 获取报警提交维修工单详情
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 获取报警提交维修工单详情
|
||||
*
|
||||
|
@ -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<GatewayInfoDO> {
|
||||
.orderByDesc(GatewayInfoDO::getGatewayId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 联合查询网关信息列表
|
||||
*/
|
||||
default PageResult<GatewayInfoDetailsDTO> selectGatewayDetailsList(@Param("reqVO") GatewayInfoPageReqVO reqVO) {
|
||||
return selectJoinPage(reqVO, GatewayInfoDetailsDTO.class, new MPJLambdaWrapperX<GatewayInfoDO>()
|
||||
.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<GatewayInfoDO> selectGatewayList(IPage<GatewayInfoDO> page, @Param("reqVO") GatewayInfoPageReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 根据id查询网关信息
|
||||
*/
|
||||
default GatewayInfoDetailsDTO selectGatewayDetailsById(String id){
|
||||
return selectJoinOne(GatewayInfoDetailsDTO.class,new MPJLambdaWrapperX<GatewayInfoDO>()
|
||||
.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<GatewayInfoDO>()
|
||||
.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<GatewayInfoDetailsDTO> selectAllGatewayDetailsList(){
|
||||
return selectJoinList(GatewayInfoDetailsDTO.class,new MPJLambdaWrapperX<GatewayInfoDO>()
|
||||
.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)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取网关信息列表
|
||||
*/
|
||||
|
@ -55,17 +55,17 @@ public interface NotifyMessageMapper extends BaseMapperX<NotifyMessageDO> {
|
||||
|
||||
default List<NotifyMessageDO> selectUnreadListByUserIdAndUserType(Long userId, Integer userType, Integer size) {
|
||||
return selectList(new QueryWrapperX<NotifyMessageDO>() // 由于要使用 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<NotifyMessageDO>()
|
||||
.eq(NotifyMessageDO::getReadStatus, false)
|
||||
.eq(NotifyMessageDO::getUserId, userId)
|
||||
.eq(NotifyMessageDO::getUserType, userType));
|
||||
.eq(NotifyMessageDO::getReadStatus, false));
|
||||
// .eq(NotifyMessageDO::getUserId, userId)
|
||||
// .eq(NotifyMessageDO::getUserType, userType));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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<AlarmDataDTO> getAlarmDataPage(AlarmDataPageReqVO pageReqVO) {
|
||||
IPage<AlarmDataDTO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
alarmDataMapper.selectAlarmDataList(page, pageReqVO);
|
||||
return new PageResult<>(page.getRecords(), page.getTotal());
|
||||
// IPage<AlarmDataDTO> 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<AlarmDataDO> 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<AlarmDataDO> 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
|
||||
|
@ -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<AlarmRulesDO> getAlarmRulesPage(AlarmRulesPageReqVO pageReqVO);
|
||||
PageResult<AlarmRulesDTO> getAlarmRulesPage(AlarmRulesPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 根据设备id查询报警规则
|
||||
*/
|
||||
List<AlarmRulesDO> getAlarmRulesListByEquipId(String equipId);
|
||||
List<AlarmRulesDTO> getAlarmRulesListByEquipId(String equipId);
|
||||
}
|
@ -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<AlarmRulesDO> getAlarmRulesPage(AlarmRulesPageReqVO pageReqVO) {
|
||||
IPage<AlarmRulesDO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
alarmRulesMapper.selectAlarmRulesList(page, pageReqVO);
|
||||
return new PageResult<>(page.getRecords(), page.getTotal());
|
||||
public PageResult<AlarmRulesDTO> getAlarmRulesPage(AlarmRulesPageReqVO pageReqVO) {
|
||||
// IPage<AlarmRulesDO> 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<AlarmRulesDO> getAlarmRulesListByEquipId(String equipId){
|
||||
return alarmRulesMapper.getAlarmRulesListByEquipId(equipId);
|
||||
public List<AlarmRulesDTO> getAlarmRulesListByEquipId(String equipId){
|
||||
return alarmRulesMapper.getAlarmRulesDetailsListByEquipId(equipId);
|
||||
}
|
||||
}
|
@ -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<EquipAlarmDataDO> getEquipAlarmDataPage(EquipAlarmDataPageReqVO pageReqVO);
|
||||
PageResult<EquipAlarmDataDTO> getEquipAlarmDataPage(EquipAlarmDataPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 通过设备id查询设备报警数据
|
||||
*/
|
||||
List<EquipAlarmDataDO> getEquipAlarmDataByEquipId(String equipId,Integer alarmType);
|
||||
List<EquipAlarmDataDTO> 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);
|
||||
|
||||
/**
|
||||
* 判断报警是否已经提交工单
|
||||
|
@ -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<EquipAlarmDataDO> getEquipAlarmDataPage(EquipAlarmDataPageReqVO pageReqVO) {
|
||||
IPage<EquipAlarmDataDO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
equipAlarmDataMapper.selectEquipAlarmList(page, pageReqVO);
|
||||
return new PageResult<>(page.getRecords(), page.getTotal());
|
||||
public PageResult<EquipAlarmDataDTO> getEquipAlarmDataPage(EquipAlarmDataPageReqVO pageReqVO) {
|
||||
// IPage<EquipAlarmDataDO> 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<EquipAlarmDataDO> getEquipAlarmDataByEquipId(String equipId,Integer alarmType) {
|
||||
return equipAlarmDataMapper.getEquipAlarmDataByEquipIdAndAlarmType(equipId,alarmType);
|
||||
public List<EquipAlarmDataDTO> 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<MaintenanceOrderDO> list = maintenanceOrderMapper.selectList(new LambdaQueryWrapper<MaintenanceOrderDO>()
|
||||
.eq(MaintenanceOrderDO::getAlarmId, alarmId)
|
||||
|
@ -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<EquipDashboardDetailsRespVO> getAllEquipDashboardDetails();
|
||||
|
||||
}
|
@ -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<EquipDashboardDetailsRespVO> getAllEquipDashboardDetails(){
|
||||
List<EquipInfoDO> equipInfoList = equipInfoMapper.selectList();
|
||||
List<EquipDashboardDetailsRespVO> 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<String, Object> latestDataMap = dataQueryApi.getLatestFanucData(vo.getEquipId());
|
||||
Map<String, Object> 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;
|
||||
}
|
||||
}
|
@ -79,4 +79,5 @@ public interface EquipInfoService {
|
||||
* @return com.inspur.module.system.controller.equip.vo.EquipInfoDetailsVO
|
||||
*/
|
||||
EquipInfoDetailsVO getEquipInfoDetailsById(String id);
|
||||
|
||||
}
|
@ -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<EquipCascaderVO> list = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(customerList)){
|
||||
//所有机床信息
|
||||
List<EquipInfoDO> equipInfoList = equipInfoMapper.selectList();
|
||||
QueryWrapper<EquipInfoDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.orderBy(true,true,"create_time");
|
||||
List<EquipInfoDO> equipInfoList = equipInfoMapper.selectList(queryWrapper);
|
||||
Map<String, List<EquipInfoDO>> 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);
|
||||
}
|
||||
|
||||
}
|
@ -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<GatewayInfoDO> getGatewayInfoPage(GatewayInfoPageReqVO pageReqVO);
|
||||
PageResult<GatewayInfoDetailsDTO> getGatewayInfoPage(GatewayInfoPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获取机床网关列表
|
||||
*/
|
||||
List<GatewayInfoDO> getGatewayInfoList();
|
||||
List<GatewayInfoDetailsDTO> getGatewayInfoList();
|
||||
|
||||
/**
|
||||
* 根据机床网关编号获取机床网关信息
|
||||
*/
|
||||
GatewayInfoDO getGatewayInfoByGatewayCode(String gatewayCode);
|
||||
GatewayInfoDetailsDTO getGatewayInfoByGatewayCode(String gatewayCode);
|
||||
|
||||
/**
|
||||
* 根据网关id获取机床网关网卡信息和参数信息
|
||||
|
@ -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<GatewayInfoDO> gatewayInfoList = getGatewayInfoList();
|
||||
List<GatewayInfoDetailsDTO> 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<GatewayInfoDO> getGatewayInfoPage(GatewayInfoPageReqVO pageReqVO) {
|
||||
IPage<GatewayInfoDO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
gatewayInfoMapper.selectGatewayList(page, pageReqVO);
|
||||
return new PageResult<>(page.getRecords(), page.getTotal());
|
||||
public PageResult<GatewayInfoDetailsDTO> getGatewayInfoPage(GatewayInfoPageReqVO pageReqVO) {
|
||||
// IPage<GatewayInfoDO> 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<GatewayInfoDO> getGatewayInfoList(){
|
||||
return gatewayInfoMapper.selectAllGatewayList();
|
||||
public List<GatewayInfoDetailsDTO> 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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,4 +119,9 @@ public interface MaintenanceOrderService {
|
||||
* @return java.lang.Boolean
|
||||
*/
|
||||
Boolean submitPatrolPlan(MaintenanceSubmitPatrolPlanVO vo);
|
||||
|
||||
/**
|
||||
* 根据设备id获取最新的一条维修工单
|
||||
*/
|
||||
MaintenanceOrderDO getLatestMaintenanceOrder(String equipId);
|
||||
}
|
@ -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<MaintenanceOrderDO>().eq(MaintenanceOrderDO::getEquipId, equipId).orderByDesc(MaintenanceOrderDO::getCreateTime));
|
||||
}
|
||||
}
|
@ -21,7 +21,7 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectGatewayInfoVo">
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -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",
|
||||
});
|
||||
}
|
||||
|
@ -1,40 +1,81 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-popover placement="bottom" width="600" trigger="click">
|
||||
<el-popover
|
||||
placement="bottom"
|
||||
width="600"
|
||||
trigger="click"
|
||||
>
|
||||
<!-- icon 展示 -->
|
||||
<el-badge slot="reference" :is-dot="unreadCount > 0" type="danger">
|
||||
<svg-icon icon-class="message" @click="getList"/>
|
||||
<el-badge
|
||||
slot="reference"
|
||||
:is-dot="unreadCount > 0"
|
||||
type="danger"
|
||||
>
|
||||
<svg-icon
|
||||
icon-class="message"
|
||||
@click="getList"
|
||||
/>
|
||||
</el-badge>
|
||||
|
||||
<!-- 弹出列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column width="120" property="templateNickname" label="发送人" />
|
||||
<el-table-column width="180" property="createTime" label="发送时间">
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
>
|
||||
<el-table-column
|
||||
width="120"
|
||||
property="templateNickname"
|
||||
label="发送人"
|
||||
/>
|
||||
<el-table-column
|
||||
width="180"
|
||||
property="createTime"
|
||||
label="发送时间"
|
||||
>
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="类型" align="center" prop="templateType" width="100">
|
||||
<el-table-column
|
||||
label="类型"
|
||||
align="center"
|
||||
prop="templateType"
|
||||
width="100"
|
||||
>
|
||||
<template v-slot="scope">
|
||||
<dict-tag :type="DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE" :value="scope.row.templateType" />
|
||||
<dict-tag
|
||||
:type="DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE"
|
||||
:value="scope.row.templateType"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column property="templateContent" label="内容" />
|
||||
<el-table-column
|
||||
property="title"
|
||||
label="标题"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
</el-table>
|
||||
|
||||
<!-- 更多 -->
|
||||
<div style="text-align: right; margin-top: 10px">
|
||||
<el-button type="primary" size="mini" @click="goMyList">查看全部</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="mini"
|
||||
@click="goMyList"
|
||||
>查看全部</el-button>
|
||||
</div>
|
||||
</el-popover>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getUnreadNotifyMessageCount, getUnreadNotifyMessageList} from "@/api/system/notify/message";
|
||||
import {
|
||||
getUnreadNotifyMessageCount,
|
||||
getUnreadNotifyMessageList,
|
||||
} from "@/api/system/notify/message";
|
||||
|
||||
export default {
|
||||
name: 'NotifyMessage',
|
||||
name: "NotifyMessage",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
@ -43,38 +84,38 @@ export default {
|
||||
list: [],
|
||||
// 未读数量,
|
||||
unreadCount: 0,
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
// 首次加载小红点
|
||||
this.getUnreadCount()
|
||||
this.getUnreadCount();
|
||||
// 轮询刷新小红点
|
||||
setInterval(() => {
|
||||
this.getUnreadCount()
|
||||
},1000 * 60 * 2)
|
||||
this.getUnreadCount();
|
||||
}, 1000 * 60 * 2);
|
||||
},
|
||||
methods: {
|
||||
getList: function() {
|
||||
getList: function () {
|
||||
this.loading = true;
|
||||
getUnreadNotifyMessageList().then(response => {
|
||||
getUnreadNotifyMessageList().then((response) => {
|
||||
this.list = response.data;
|
||||
this.loading = false;
|
||||
// 强制设置 unreadCount 为 0,避免小红点因为轮询太慢,不消除
|
||||
this.unreadCount = 0
|
||||
this.unreadCount = 0;
|
||||
});
|
||||
},
|
||||
getUnreadCount: function() {
|
||||
getUnreadNotifyMessageCount().then(response => {
|
||||
getUnreadCount: function () {
|
||||
getUnreadNotifyMessageCount().then((response) => {
|
||||
this.unreadCount = response.data;
|
||||
})
|
||||
},
|
||||
goMyList: function() {
|
||||
this.$router.push({
|
||||
name: 'MyNotifyMessage'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
goMyList: function () {
|
||||
this.$router.push({
|
||||
name: "MyNotifyMessage",
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
.el-badge__content.is-fixed {
|
||||
|
@ -42,13 +42,17 @@
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="机床设备" prop="equipId">
|
||||
<el-form-item
|
||||
label="机床设备"
|
||||
prop="equipId"
|
||||
>
|
||||
<el-cascader
|
||||
v-model="cascaderValue"
|
||||
:options="equipCascader"
|
||||
:props="{ value: 'id',label: 'name',children: 'children'}"
|
||||
clearable
|
||||
@change="cascaderChange"></el-cascader>
|
||||
@change="cascaderChange"
|
||||
></el-cascader>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="等级"
|
||||
@ -144,11 +148,11 @@
|
||||
align="center"
|
||||
prop="equipNo"
|
||||
/>
|
||||
<el-table-column
|
||||
<!-- <el-table-column
|
||||
label="机床组件"
|
||||
align="center"
|
||||
prop="componentName"
|
||||
/>
|
||||
/> -->
|
||||
<el-table-column
|
||||
label="规则上限值"
|
||||
align="center"
|
||||
@ -283,13 +287,17 @@
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="机床设备" prop="equipId">
|
||||
<el-form-item
|
||||
label="机床设备"
|
||||
prop="equipId"
|
||||
>
|
||||
<el-cascader
|
||||
v-model="cascaderValue"
|
||||
:options="equipCascader"
|
||||
:props="{ value: 'id',label: 'name',children: 'children'}"
|
||||
clearable
|
||||
@change="cascaderChange"></el-cascader>
|
||||
@change="cascaderChange"
|
||||
></el-cascader>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="等级"
|
||||
@ -585,7 +593,10 @@
|
||||
<script>
|
||||
import * as AlarmRulesApi from "@/api/system/alarm/alarmrules";
|
||||
import AlarmRulesForm from "./AlarmRulesForm.vue";
|
||||
import {getEquipCascader, getEquipSelection} from "@/api/system/equip/equipInfo";
|
||||
import {
|
||||
getEquipCascader,
|
||||
getEquipSelection,
|
||||
} from "@/api/system/equip/equipInfo";
|
||||
export default {
|
||||
name: "AlarmRules",
|
||||
components: {
|
||||
@ -593,7 +604,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
cascaderValue:[],
|
||||
cascaderValue: [],
|
||||
equipCascader: [],
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
@ -692,24 +703,24 @@ export default {
|
||||
this.loading = true;
|
||||
this.queryParams.type = this.activeName === "threshold" ? 0 : 1;
|
||||
const res = await AlarmRulesApi.getAlarmRulesPage(this.queryParams);
|
||||
await getEquipCascader().then(res=>{
|
||||
res.forEach(item=>{
|
||||
if (item.children == null){
|
||||
await getEquipCascader().then((res) => {
|
||||
res.forEach((item) => {
|
||||
if (item.children == null) {
|
||||
item.disabled = true;
|
||||
}
|
||||
})
|
||||
});
|
||||
this.equipCascader = res;
|
||||
})
|
||||
});
|
||||
this.list = res.data.list;
|
||||
this.total = res.data.total;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
cascaderChange(value){
|
||||
if (value.length > 0){
|
||||
cascaderChange(value) {
|
||||
if (value.length > 0) {
|
||||
this.queryParams.equipId = value[1];
|
||||
}else {
|
||||
} else {
|
||||
this.queryParams.equipId = null;
|
||||
}
|
||||
},
|
||||
|
@ -99,6 +99,27 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="租户绑定"
|
||||
prop="tenantId"
|
||||
>
|
||||
<el-select
|
||||
v-model="formData.tenantId"
|
||||
placeholder="请选择租户名"
|
||||
style="width:100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in tenantLists"
|
||||
:key="parseInt(item.id)"
|
||||
:label="item.label"
|
||||
:value="parseInt(item.value)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item
|
||||
label="备注"
|
||||
prop="remark"
|
||||
@ -129,6 +150,7 @@
|
||||
<script>
|
||||
import * as CustomerInfoApi from "@/api/system/baseData/customerInfo";
|
||||
import { getAreaTree } from "@/api/system/area";
|
||||
import { getTenantList } from "@/api/system/tenant";
|
||||
|
||||
export default {
|
||||
name: "CustomerInfoForm",
|
||||
@ -167,6 +189,8 @@ export default {
|
||||
{ required: true, message: "请选择所属行业", trigger: "change" },
|
||||
],
|
||||
},
|
||||
|
||||
tenantLists: [],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
@ -174,8 +198,14 @@ export default {
|
||||
const list = res.data;
|
||||
this.areaTree = this.handleTreeList(list);
|
||||
});
|
||||
this.getTenantLists();
|
||||
},
|
||||
methods: {
|
||||
getTenantLists() {
|
||||
getTenantList().then((res) => {
|
||||
this.tenantLists = res.data;
|
||||
});
|
||||
},
|
||||
areaTreeChange(value) {
|
||||
console.log(value);
|
||||
},
|
||||
|
@ -12,6 +12,18 @@
|
||||
@click="startRefresh"
|
||||
>自动刷新</div>
|
||||
</div> -->
|
||||
<div
|
||||
class="equip-select"
|
||||
style="width:20%;margin-left: 1%;"
|
||||
>
|
||||
<el-cascader
|
||||
v-model="cascaderValue"
|
||||
:options="equipCascader"
|
||||
:props="{emitPath: false,value: 'id',label: 'name',children: 'children'}"
|
||||
@change="cascaderChange"
|
||||
style="width:100%"
|
||||
></el-cascader>
|
||||
</div>
|
||||
<el-tabs
|
||||
v-model="activeName"
|
||||
type="border-card"
|
||||
@ -20,7 +32,7 @@
|
||||
>
|
||||
<el-tab-pane
|
||||
label="电流数据"
|
||||
name="gateway_channel_current_data"
|
||||
name="gateway_current_data"
|
||||
>
|
||||
<div style="display: flex;justify-content: space-between;">
|
||||
<el-button
|
||||
@ -80,15 +92,15 @@
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="x轴推屑电流(A)"
|
||||
label="排屑1电流(A)"
|
||||
align="center"
|
||||
prop="x_push_temp"
|
||||
prop="chip_removal_1"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="y轴推屑电流(A)"
|
||||
label="排屑2电流(A)"
|
||||
align="center"
|
||||
prop="y_push_temp"
|
||||
prop="chip_removal_2"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
</el-table>
|
||||
@ -102,7 +114,7 @@
|
||||
</el-tab-pane>
|
||||
<el-tab-pane
|
||||
label="液压数据"
|
||||
name="gateway_channel_hydra_data"
|
||||
name="gateway_hy_data"
|
||||
>
|
||||
<div style="display: flex;justify-content: space-between;">
|
||||
<el-button
|
||||
@ -162,21 +174,21 @@
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="x轴润滑液压"
|
||||
label="液压1(bar)"
|
||||
align="center"
|
||||
prop="x_lube_press"
|
||||
prop="hy_1"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="y轴润滑液压"
|
||||
label="液压2(bar)"
|
||||
align="center"
|
||||
prop="y_lube_press"
|
||||
prop="hy_2"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="z轴润滑液压"
|
||||
label="液压3(bar)"
|
||||
align="center"
|
||||
prop="y_lube_press"
|
||||
prop="hy_3"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
</el-table>
|
||||
@ -189,8 +201,8 @@
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane
|
||||
label="振动数据"
|
||||
name="gateway_channel_vibr_data"
|
||||
label="加速度数据"
|
||||
name="gateway_aclr_data"
|
||||
>
|
||||
<div style="display: flex;justify-content: space-between;">
|
||||
<el-button
|
||||
@ -237,6 +249,7 @@
|
||||
label="序号"
|
||||
type="index"
|
||||
align="center"
|
||||
fixed
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.$index + 1}}</span>
|
||||
@ -247,12 +260,115 @@
|
||||
align="center"
|
||||
prop="time"
|
||||
width="200"
|
||||
fixed
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="Y轴熵值(g/s)"
|
||||
label="X加速度RMS"
|
||||
align="center"
|
||||
prop="x_entropy"
|
||||
prop="x_aclr_rms"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="Y加速度RMS"
|
||||
align="center"
|
||||
prop="y_aclr_rms"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="Z加速度RMS"
|
||||
align="center"
|
||||
prop="z_aclr_rms"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="X速度RMS"
|
||||
align="center"
|
||||
prop="x_speed_rms"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="Y速度RMS"
|
||||
align="center"
|
||||
prop="y_speed_rms"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="Z速度RMS"
|
||||
align="center"
|
||||
prop="z_speed_rms"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="X位移RMS"
|
||||
align="center"
|
||||
prop="x_dis_rms"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="Y位移RMS"
|
||||
align="center"
|
||||
prop="y_dis_rms"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="Z位移RMS"
|
||||
align="center"
|
||||
prop="z_dis_rms"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="X加速度峰值"
|
||||
align="center"
|
||||
prop="x_aclr_peak"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="Y加速度峰值"
|
||||
align="center"
|
||||
prop="y_aclr_peak"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="Z加速度峰值"
|
||||
align="center"
|
||||
prop="z_aclr_peak"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="X速度峰值"
|
||||
align="center"
|
||||
prop="x_speed_peak"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="Y速度峰值"
|
||||
align="center"
|
||||
prop="y_speed_peak"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="Z速度峰值"
|
||||
align="center"
|
||||
prop="z_speed_peak"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="X位移峰值"
|
||||
align="center"
|
||||
prop="x_dis_peak"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="Y位移峰值"
|
||||
align="center"
|
||||
prop="y_dis_peak"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="Z位移峰值"
|
||||
align="center"
|
||||
prop="z_dis_peak"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
</el-table>
|
||||
@ -266,7 +382,7 @@
|
||||
</el-tab-pane>
|
||||
<el-tab-pane
|
||||
label="温度数据"
|
||||
name="gateway_channel_temp_data"
|
||||
name="gateway_temp_data"
|
||||
>
|
||||
<div style="display: flex;justify-content: space-between;">
|
||||
<el-button
|
||||
@ -313,6 +429,7 @@
|
||||
label="序号"
|
||||
type="index"
|
||||
align="center"
|
||||
fixed
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.$index + 1}}</span>
|
||||
@ -323,42 +440,73 @@
|
||||
align="center"
|
||||
prop="time"
|
||||
width="200"
|
||||
fixed
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="x轴轴承温度(℃)"
|
||||
label="X+温度(℃)"
|
||||
align="center"
|
||||
prop="x_bear_temp"
|
||||
prop="xp_temp"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="y轴轴承温度(℃)"
|
||||
label="X0温度(℃)"
|
||||
align="center"
|
||||
prop="y_bear_temp"
|
||||
prop="x0_temp"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="z轴轴承温度(℃)"
|
||||
label="X-温度(℃)"
|
||||
align="center"
|
||||
prop="z_bear_temp"
|
||||
prop="xn_temp"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="x轴排屑温度(℃)"
|
||||
label="Y+温度(℃)"
|
||||
align="center"
|
||||
prop="x_debris_temp"
|
||||
prop="yp_temp"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="z轴排屑温度(℃)"
|
||||
label="Y0温度(℃)"
|
||||
align="center"
|
||||
prop="z_debris_temp"
|
||||
prop="y0_temp"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="室温(℃)"
|
||||
label="Y-温度(℃)"
|
||||
align="center"
|
||||
prop="at_temp"
|
||||
prop="yn_temp"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="Z+温度(℃)"
|
||||
align="center"
|
||||
prop="zp_temp"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="Z0温度(℃)"
|
||||
align="center"
|
||||
prop="z0_temp"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="Z-温度(℃)"
|
||||
align="center"
|
||||
prop="zn_temp"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="排屑1温度(℃)"
|
||||
align="center"
|
||||
prop="cr1_temp"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="排屑2温度(℃)"
|
||||
align="center"
|
||||
prop="cr2_temp"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
</el-table>
|
||||
@ -372,7 +520,7 @@
|
||||
</el-tab-pane>
|
||||
<el-tab-pane
|
||||
label="CNC加工数据"
|
||||
name="gateway_channel_work_data"
|
||||
name="gateway_fanuc_data"
|
||||
>
|
||||
<div style="display: flex;justify-content: space-between;">
|
||||
<el-button
|
||||
@ -434,25 +582,25 @@
|
||||
<el-table-column
|
||||
label="加工总件数(件)"
|
||||
align="center"
|
||||
prop="work_total"
|
||||
prop="total_process"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="加工时长(小时)"
|
||||
label="加工时长(分钟)"
|
||||
align="center"
|
||||
prop="work_time"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="通电时间(小时)"
|
||||
label="通电时间(分钟)"
|
||||
align="center"
|
||||
prop="on_time"
|
||||
prop="power_time"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="加工件数(件)"
|
||||
align="center"
|
||||
prop="work_items"
|
||||
prop="process_num"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
</el-table>
|
||||
@ -477,6 +625,7 @@ import {
|
||||
exportTempDataExcel,
|
||||
exportProcessDataExcel,
|
||||
} from "@/api/data/query.js";
|
||||
import { getEquipCascader } from "@/api/system/equip/equipInfo";
|
||||
export default {
|
||||
name: "dataLog",
|
||||
data() {
|
||||
@ -498,18 +647,38 @@ export default {
|
||||
},
|
||||
dataList: [],
|
||||
refresh: false,
|
||||
activeName: "gateway_channel_current_data",
|
||||
activeName: "gateway_current_data",
|
||||
datetime: this.getDefaultTimeRange(),
|
||||
cascaderValue: null,
|
||||
equipCascader: [],
|
||||
// getDataTimer: null,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.queryParams.startTime = this.datetime[0];
|
||||
this.queryParams.endTime = this.datetime[1];
|
||||
this.getList();
|
||||
this.getEquipCascaderInfo();
|
||||
// this.startRefresh();
|
||||
},
|
||||
methods: {
|
||||
getEquipCascaderInfo() {
|
||||
getEquipCascader().then((res) => {
|
||||
res.forEach((item) => {
|
||||
if (item.children == null) {
|
||||
item.disabled = true;
|
||||
}
|
||||
});
|
||||
if (res && res[0].children) {
|
||||
this.queryParams.equipId = this.cascaderValue = res[0].children[0].id;
|
||||
}
|
||||
this.equipCascader = res;
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
cascaderChange(value) {
|
||||
this.queryParams.equipId = value;
|
||||
this.getList();
|
||||
},
|
||||
handleTabClick() {
|
||||
//this.stopRefresh();
|
||||
// this.datetime = this.getDefaultTimeRange();
|
||||
@ -557,23 +726,23 @@ export default {
|
||||
this.exportLoading = true;
|
||||
var data = null;
|
||||
switch (this.activeName) {
|
||||
case "gateway_channel_current_data":
|
||||
case "gateway_current_data":
|
||||
data = await exportCurrentDataExcel(this.queryParams);
|
||||
this.$download.excel(data, "机床电流参数报警记录.xls");
|
||||
break;
|
||||
case "gateway_channel_hydra_data":
|
||||
case "gateway_hy_data":
|
||||
data = await exportPressDataExcel(this.queryParams);
|
||||
this.$download.excel(data, "机床液压参数报警记录.xls");
|
||||
break;
|
||||
case "gateway_channel_vibr_data":
|
||||
case "gateway_aclr_data":
|
||||
data = await exportVibrDataExcel(this.queryParams);
|
||||
this.$download.excel(data, "机床振动参数报警记录.xls");
|
||||
this.$download.excel(data, "机床加速度参数报警记录.xls");
|
||||
break;
|
||||
case "gateway_channel_temp_data":
|
||||
case "gateway_temp_data":
|
||||
data = await exportTempDataExcel(this.queryParams);
|
||||
this.$download.excel(data, "机床温度参数报警记录.xls");
|
||||
break;
|
||||
case "gateway_channel_work_data":
|
||||
case "gateway_fanuc_data":
|
||||
data = await exportProcessDataExcel(this.queryParams);
|
||||
this.$download.excel(data, "机床生产参数报警记录.xls");
|
||||
break;
|
||||
@ -666,7 +835,7 @@ export default {
|
||||
async getList() {
|
||||
try {
|
||||
this.loading = true;
|
||||
this.queryParams.equipId = "2e3d0190e63eda526da89d6c751f08f3"; //暂时固定设备
|
||||
//this.queryParams.equipId = "2e3d0190e63eda526da89d6c751f08f3"; //暂时固定设备
|
||||
this.queryParams.tableName = this.activeName;
|
||||
const res = await getDataList(this.queryParams);
|
||||
this.dataList = res.data.list;
|
||||
|
@ -1,9 +1,13 @@
|
||||
<template>
|
||||
<div :class="getClass(equipList.length)">
|
||||
<div
|
||||
v-loading="loading"
|
||||
:class="getClass(equipList.length)"
|
||||
>
|
||||
<el-card
|
||||
v-for="(item, index) in equipList"
|
||||
:key="index"
|
||||
class="box-card"
|
||||
style="margin-top:2%"
|
||||
>
|
||||
<div
|
||||
slot="header"
|
||||
@ -13,6 +17,10 @@
|
||||
<span class="name">设备型号:</span>
|
||||
<span class="prop">{{ item.modelName }}</span>
|
||||
</div>
|
||||
<div class="equ-info">
|
||||
<span class="name">设备名称:</span>
|
||||
<span class="prop">{{ item.equipName }}</span>
|
||||
</div>
|
||||
<div class="equ-info">
|
||||
<span class="name">设备编号:</span>
|
||||
<span class="prop">{{ item.equipNo }}</span>
|
||||
@ -57,37 +65,37 @@
|
||||
>
|
||||
<div class="equ-content">
|
||||
<span class="con-name">通电时间</span>
|
||||
<span class="con-prop">{{ item.powerTime }}</span>
|
||||
<span class="con-prop">{{ item.powerTime.toFixed(2) + " 小时" }}</span>
|
||||
</div>
|
||||
<div class="equ-content">
|
||||
<span class="con-name">加工件数</span>
|
||||
<span class="con-prop">{{ item.processNum }}</span>
|
||||
<span class="con-prop">{{ item.processNum + " 件"}}</span>
|
||||
</div>
|
||||
<div class="equ-content">
|
||||
<span class="con-name">加工时长</span>
|
||||
<span class="con-prop">{{ item.workTime }}</span>
|
||||
<span class="con-prop">{{ item.workTime.toFixed(2) + " 小时" }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="item.status == 0"
|
||||
v-if="item.runStatus === 0"
|
||||
class="content"
|
||||
style="margin-top:5%"
|
||||
>
|
||||
<div class="equ-content">
|
||||
<span class="con-name">今日工作时间</span>
|
||||
<span class="con-prop">{{ item.dailyWorkTime + "小时" }} </span>
|
||||
<span class="con-prop">{{ item.todayWorkTime.toFixed(2) + " 小时" }} </span>
|
||||
</div>
|
||||
<div class="equ-content">
|
||||
<span class="con-name">今日加工件数</span>
|
||||
<span class="con-prop">{{ item.dailyProcessNum + "件" }} </span>
|
||||
<span class="con-prop">{{ item.todayProcessNum + " 件" }} </span>
|
||||
</div>
|
||||
<div class="equ-content">
|
||||
<span class="con-name">今日效率</span>
|
||||
<span class="con-prop">{{ item.dailyEffect +"件/每小时" }} </span>
|
||||
<span class="con-prop">{{ item.todayEfficiency.toFixed(2) +" 件/每小时" }} </span>
|
||||
</div>
|
||||
</div>
|
||||
<el-card
|
||||
v-if="item.status == 2"
|
||||
v-if="item.runStatus == 2"
|
||||
style="margin-top:15px"
|
||||
>
|
||||
<div class="maintanance">
|
||||
@ -123,51 +131,55 @@
|
||||
</template>
|
||||
<script>
|
||||
import * as EquipInfoApi from "@/api/system/equip/equipInfo";
|
||||
import { getEquipDashboard } from "@/api/system/equip/equipInfo";
|
||||
export default {
|
||||
name: "EquipInfo",
|
||||
data() {
|
||||
return {
|
||||
equipList: [
|
||||
{
|
||||
modelName: "MK15043",
|
||||
equipNo: 370577891,
|
||||
runStatus: 1,
|
||||
status: 0,
|
||||
alarmNum: 1,
|
||||
powerTime: "13:00:00",
|
||||
processNum: 100,
|
||||
workTime: "08:30:21",
|
||||
maintananceStatus: 1,
|
||||
dailyWorkTime: 7.6,
|
||||
dailyProcessNum: 238,
|
||||
dailyEffect: 31.3,
|
||||
},
|
||||
{
|
||||
modelName: "QB18043",
|
||||
equipNo: 370755763,
|
||||
runStatus: 0,
|
||||
status: 2,
|
||||
alarmNum: 5,
|
||||
powerTime: "09:00:00",
|
||||
processNum: 100,
|
||||
workTime: "03:24:11",
|
||||
maintananceStatus: 2,
|
||||
dailyWorkTime: 7.6,
|
||||
dailyProcessNum: 238,
|
||||
dailyEffect: 31.3,
|
||||
},
|
||||
// {
|
||||
// modelName: "MK15043",
|
||||
// equipNo: 370577891,
|
||||
// runStatus: 1,
|
||||
// status: 0,
|
||||
// alarmNum: 1,
|
||||
// powerTime: "13:00:00",
|
||||
// processNum: 100,
|
||||
// workTime: "08:30:21",
|
||||
// maintananceStatus: 1,
|
||||
// dailyWorkTime: 7.6,
|
||||
// dailyProcessNum: 238,
|
||||
// dailyEffect: 31.3,
|
||||
// },
|
||||
// {
|
||||
// modelName: "QB18043",
|
||||
// equipNo: 370755763,
|
||||
// runStatus: 0,
|
||||
// status: 2,
|
||||
// alarmNum: 5,
|
||||
// powerTime: "09:00:00",
|
||||
// processNum: 100,
|
||||
// workTime: "03:24:11",
|
||||
// maintananceStatus: 2,
|
||||
// dailyWorkTime: 7.6,
|
||||
// dailyProcessNum: 238,
|
||||
// dailyEffect: 31.3,
|
||||
// },
|
||||
],
|
||||
loading: false,
|
||||
};
|
||||
},
|
||||
created() {},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
async getList() {
|
||||
try {
|
||||
this.loading = true;
|
||||
const res = await EquipInfoApi.getEquipInfoPage(this.queryParams);
|
||||
this.list = res.data.list;
|
||||
this.total = res.data.total;
|
||||
const res = await getEquipDashboard();
|
||||
this.equipList = res.data;
|
||||
this.loading = false;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user