监测数据看板功能更新
This commit is contained in:
parent
ca37310b18
commit
fd5a166fa4
@ -77,6 +77,46 @@ public class DataQueryController {
|
|||||||
return success(resMap);
|
return success(resMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getCurrentData")
|
||||||
|
@Operation(summary = "获取/查询网关电流数据列表")
|
||||||
|
@PreAuthorize("@ss.hasPermission('data:query:list')")
|
||||||
|
public CommonResult<Map<String, Object>> getCurrentData(String equipId, String startTime, String endTime){
|
||||||
|
Map<String, Object> resMap = dataQueryService.getCurrentData(equipId, startTime, endTime);
|
||||||
|
return success(resMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getPressData")
|
||||||
|
@Operation(summary = "获取/查询网关液压数据列表")
|
||||||
|
@PreAuthorize("@ss.hasPermission('data:query:list')")
|
||||||
|
public CommonResult<Map<String, Object>> getPressData(String equipId, String startTime, String endTime){
|
||||||
|
Map<String, Object> resMap = dataQueryService.getPressData(equipId, startTime, endTime);
|
||||||
|
return success(resMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getTempData")
|
||||||
|
@Operation(summary = "获取/查询网关温度数据列表")
|
||||||
|
@PreAuthorize("@ss.hasPermission('data:query:list')")
|
||||||
|
public CommonResult<Map<String, Object>> getTempData(String equipId, String startTime, String endTime){
|
||||||
|
Map<String, Object> resMap = dataQueryService.getTempData(equipId, startTime, endTime);
|
||||||
|
return success(resMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getVibrData")
|
||||||
|
@Operation(summary = "获取/查询网关振动数据列表")
|
||||||
|
@PreAuthorize("@ss.hasPermission('data:query:list')")
|
||||||
|
public CommonResult<Map<String, Object>> getVibrData(String equipId, String startTime, String endTime){
|
||||||
|
Map<String, Object> resMap = dataQueryService.getVibrData(equipId, startTime, endTime);
|
||||||
|
return success(resMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getWorkData")
|
||||||
|
@Operation(summary = "获取/查询网关工作数据列表")
|
||||||
|
@PreAuthorize("@ss.hasPermission('data:query:list')")
|
||||||
|
public CommonResult<Map<String, Object>> getWorkData(String equipId, String startTime, String endTime){
|
||||||
|
Map<String, Object> resMap = dataQueryService.getWorkData(equipId, startTime, endTime);
|
||||||
|
return success(resMap);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/export-current-excel")
|
@GetMapping("/export-current-excel")
|
||||||
@Operation(summary = "导出机床电流传感器参数 Excel")
|
@Operation(summary = "导出机床电流传感器参数 Excel")
|
||||||
@PreAuthorize("@ss.hasPermission('data:query:export')")
|
@PreAuthorize("@ss.hasPermission('data:query:export')")
|
||||||
|
@ -90,8 +90,12 @@ public class MyMqttCallback implements MqttCallback {
|
|||||||
String deviceType = (String) map.get("deviceType");
|
String deviceType = (String) map.get("deviceType");
|
||||||
String gatewayCode = deviceName.substring(0,17);
|
String gatewayCode = deviceName.substring(0,17);
|
||||||
Map<String,Object> mapping = getGatewayMapping(gatewayCode);
|
Map<String,Object> mapping = getGatewayMapping(gatewayCode);
|
||||||
|
if(mapping == null){
|
||||||
|
logger.info("未找到对应网关!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
String msgType = (String) mapping.get(deviceType + "MsgType");
|
String msgType = (String) mapping.get(deviceType + "MsgType");
|
||||||
if(map.get("msgType") != null && msgType.equals(map.get("msgType"))){
|
if(map.get("msgType") != null && msgType != null && msgType.equals(map.get("msgType"))){
|
||||||
process((String)mapping.get(deviceType),(String)mapping.get("equipId"),(Map<String,String>)mapping.get(deviceType + "Params"),(Map<String,Object>)map.get("msg"));
|
process((String)mapping.get(deviceType),(String)mapping.get("equipId"),(Map<String,String>)mapping.get(deviceType + "Params"),(Map<String,Object>)map.get("msg"));
|
||||||
}else{
|
}else{
|
||||||
logger.info("数据未存储!");
|
logger.info("数据未存储!");
|
||||||
@ -136,6 +140,9 @@ public class MyMqttCallback implements MqttCallback {
|
|||||||
private Map<String, Object> getGatewayMapping(String gatewayCode) {
|
private Map<String, Object> getGatewayMapping(String gatewayCode) {
|
||||||
GatewayInfoService gatewayInfoService = SpringUtils.getBean(GatewayInfoService.class);
|
GatewayInfoService gatewayInfoService = SpringUtils.getBean(GatewayInfoService.class);
|
||||||
GatewayInfoDO gatewayInfo = gatewayInfoService.getGatewayInfoByGatewayCode(gatewayCode);
|
GatewayInfoDO gatewayInfo = gatewayInfoService.getGatewayInfoByGatewayCode(gatewayCode);
|
||||||
|
if(gatewayInfo == null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
//通过配置获取
|
//通过配置获取
|
||||||
Map<String, Object> cardMapping = gatewayInfoService.getGatewayCardAndParamByCatch(gatewayInfo.getGatewayId());
|
Map<String, Object> cardMapping = gatewayInfoService.getGatewayCardAndParamByCatch(gatewayInfo.getGatewayId());
|
||||||
cardMapping.put("equipId", gatewayInfo.getEquipId());
|
cardMapping.put("equipId", gatewayInfo.getEquipId());
|
||||||
|
@ -14,6 +14,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author zhangjunwen
|
* @Author zhangjunwen
|
||||||
@ -57,17 +58,17 @@ public class DataQueryService implements IDataQueryService{
|
|||||||
LocalDateTime etime = DateUtils.tranUTCtoLocalDateTime(endTime);
|
LocalDateTime etime = DateUtils.tranUTCtoLocalDateTime(endTime);
|
||||||
long intervalHours = ChronoUnit.HOURS.between(stime, etime);
|
long intervalHours = ChronoUnit.HOURS.between(stime, etime);
|
||||||
|
|
||||||
List<Map<String, Object>> list = new ArrayList<>();
|
// List<Map<String, Object>> list = new ArrayList<>();
|
||||||
if(intervalHours <= 6){//6小时内全查
|
// if(intervalHours <= 6){//6小时内全查
|
||||||
list = selectDataByColumnNameandDate(null,tableName, columnName, startTime, endTime);
|
// list = selectDataByColumnNameandDate(null,tableName, columnName, startTime, endTime);
|
||||||
}else if(intervalHours <= 7*24 ){//7天内,每30s一个
|
// }else if(intervalHours <= 7*24 ){//7天内,每30s一个
|
||||||
list = selectLongTimeDataByColumnNameandDate(null,tableName, columnName, startTime, endTime, "30s");
|
// list = selectLongTimeDataByColumnNameandDate(null,tableName, columnName, startTime, endTime, "30s");
|
||||||
}else if(intervalHours <= 30*24 ){//30天内,每2min一个
|
// }else if(intervalHours <= 30*24 ){//30天内,每2min一个
|
||||||
list = selectLongTimeDataByColumnNameandDate(null,tableName, columnName, startTime, endTime, "2m");
|
// list = selectLongTimeDataByColumnNameandDate(null,tableName, columnName, startTime, endTime, "2m");
|
||||||
}else if (intervalHours <= 90*24){//90天以上,每4h一个
|
// }else if (intervalHours <= 90*24){//90天以上,每6min一个
|
||||||
list = selectLongTimeDataByColumnNameandDate(null,tableName, columnName, startTime, endTime, "6m");
|
// list = selectLongTimeDataByColumnNameandDate(null,tableName, columnName, startTime, endTime, "6m");
|
||||||
}
|
// }
|
||||||
|
List<Map<String, Object>> list = selectDataByColumnNameandDateSegmentation(equipId, tableName, columnName, startTime, endTime, intervalHours);
|
||||||
Map<String, Object> resMap = new HashMap<>();
|
Map<String, Object> resMap = new HashMap<>();
|
||||||
if (list.size() == 0){
|
if (list.size() == 0){
|
||||||
return null;
|
return null;
|
||||||
@ -89,6 +90,119 @@ public class DataQueryService implements IDataQueryService{
|
|||||||
return resMap;
|
return resMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备id获取排屑电流数据
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备id获取液压数据
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备id获取温度数据
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备id获取振动数据
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备id获取工作数据
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
List<Double> workTimeList = (List<Double>) resultMap.get("work_time");
|
||||||
|
List<Double> powerTimeList = (List<Double>) resultMap.get("power_time");
|
||||||
|
resultMap.put("work_time", workTimeList.stream().map(w -> w / 60.0).collect(Collectors.toList()));
|
||||||
|
resultMap.put("power_time", powerTimeList.stream().map(p -> p / 60.0).collect(Collectors.toList()));
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
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){
|
||||||
|
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++){
|
||||||
|
columnName[i] = "mean_" + columnName[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
for (String cn : columnName) {
|
||||||
|
if(cn.trim().length() == 0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String realCn = cn;
|
||||||
|
if(cn.startsWith("mean")){
|
||||||
|
realCn = cn.replaceFirst("mean_", "");
|
||||||
|
}
|
||||||
|
resMap.put(realCn, list.stream().map(map->{
|
||||||
|
Double data = (Double)map.get(cn);
|
||||||
|
if("gateway_temp_data".equals(tableName)){//温度处理
|
||||||
|
return data/10.0;
|
||||||
|
}
|
||||||
|
if("work_time".equals(columnName) || "power_time".equals(columnName)){//时间转小时
|
||||||
|
return data/60.0;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}).collect(Collectors.toList()));
|
||||||
|
resMap.put("time", list.stream().map(map -> DateUtils.utcToCst(map.get("time").toString())).collect(Collectors.toList()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return resMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*按照策略分段查询数据列表
|
||||||
|
*/
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
private List<Map<String, Object>> queryDataByTime(String tableName, String equipId, String beginTime, String endTime, Integer pageNum, Integer pageSize) {
|
private List<Map<String, Object>> queryDataByTime(String tableName, String equipId, String beginTime, String endTime, Integer pageNum, Integer pageSize) {
|
||||||
StringBuilder sql = new StringBuilder("select * from ")
|
StringBuilder sql = new StringBuilder("select * from ")
|
||||||
.append("\"").append(tableName).append("\"");
|
.append("\"").append(tableName).append("\"");
|
||||||
@ -184,6 +298,9 @@ public class DataQueryService implements IDataQueryService{
|
|||||||
* 查询长时间数据,每分钟取一条展示(最长3个月)
|
* 查询长时间数据,每分钟取一条展示(最长3个月)
|
||||||
*/
|
*/
|
||||||
private List<Map<String, Object>> selectLongTimeDataByColumnNameandDate(String equipId,String tableName, String columnName, String beginTime, String endTime, String interval){
|
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 ")
|
StringBuilder sql = new StringBuilder("select time, mean(").append(columnName).append(") from ")
|
||||||
.append("\"").append(tableName).append("\"");
|
.append("\"").append(tableName).append("\"");
|
||||||
if(equipId != null){
|
if(equipId != null){
|
||||||
|
@ -22,4 +22,28 @@ public interface IDataQueryService {
|
|||||||
*/
|
*/
|
||||||
public Map<String, Object> queryDataListByColumnNameandDate(String equipId, String tableName, String columnName, String startTime, String endTime) throws ParseException;
|
public Map<String, Object> queryDataListByColumnNameandDate(String equipId, String tableName, String columnName, String startTime, String endTime) throws ParseException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备id获取排屑电流数据
|
||||||
|
*/
|
||||||
|
public Map<String, Object> getCurrentData(String equipId, String startTime, String endTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备id获取液压数据
|
||||||
|
*/
|
||||||
|
public Map<String, Object> getPressData(String equipId, String startTime, String endTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备id获取温度数据
|
||||||
|
*/
|
||||||
|
public Map<String, Object> getTempData(String equipId, String startTime, String endTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备id获取振动数据
|
||||||
|
*/
|
||||||
|
public Map<String, Object> getVibrData(String equipId, String startTime, String endTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备id获取工作数据
|
||||||
|
*/
|
||||||
|
public Map<String, Object> getWorkData(String equipId, String startTime, String endTime);
|
||||||
}
|
}
|
||||||
|
@ -43,4 +43,9 @@ public interface GatewayInfoMapper extends BaseMapperX<GatewayInfoDO> {
|
|||||||
* 根据网关编号查询网关信息
|
* 根据网关编号查询网关信息
|
||||||
*/
|
*/
|
||||||
public GatewayInfoDO selectGatewayByGatewayCode(@Param("gatewayCode") String gatewayCode);
|
public GatewayInfoDO selectGatewayByGatewayCode(@Param("gatewayCode") String gatewayCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取网关信息列表
|
||||||
|
*/
|
||||||
|
public List<GatewayInfoDO> selectAllGatewayList();
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
package com.inspur.module.system.service.gatewayinfo;
|
package com.inspur.module.system.service.gatewayinfo;
|
||||||
|
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import com.inspur.module.system.controller.admin.gatewayinfo.vo.*;
|
import com.inspur.module.system.controller.admin.gatewayinfo.vo.*;
|
||||||
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayCardParamsDO;
|
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayCardParamsDO;
|
||||||
import com.inspur.framework.common.pojo.PageResult;
|
import com.inspur.framework.common.pojo.PageResult;
|
||||||
@ -29,6 +32,9 @@ public class GatewayCardParamsServiceImpl implements GatewayCardParamsService {
|
|||||||
@Resource
|
@Resource
|
||||||
private GatewayCardParamsMapper gatewayCardParamsMapper;
|
private GatewayCardParamsMapper gatewayCardParamsMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StringRedisTemplate stringRedisTemplate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String createGatewayCardParams(GatewayCardParamsSaveReqVO createReqVO) {
|
public String createGatewayCardParams(GatewayCardParamsSaveReqVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
@ -46,6 +52,10 @@ public class GatewayCardParamsServiceImpl implements GatewayCardParamsService {
|
|||||||
if(paramsList.isEmpty()){
|
if(paramsList.isEmpty()){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
String gatewayId = paramsList.get(0).getGatewayId();
|
||||||
|
if(Boolean.TRUE.equals(stringRedisTemplate.hasKey("cardmapping_" + gatewayId))){
|
||||||
|
stringRedisTemplate.delete("cardmapping_" + gatewayId);
|
||||||
|
}
|
||||||
List<GatewayCardParamsDO> gatewayCardParamsList = BeanUtils.toBean(paramsList, GatewayCardParamsDO.class);
|
List<GatewayCardParamsDO> gatewayCardParamsList = BeanUtils.toBean(paramsList, GatewayCardParamsDO.class);
|
||||||
return gatewayCardParamsMapper.insertBatch(gatewayCardParamsList);
|
return gatewayCardParamsMapper.insertBatch(gatewayCardParamsList);
|
||||||
}
|
}
|
||||||
@ -66,6 +76,10 @@ public class GatewayCardParamsServiceImpl implements GatewayCardParamsService {
|
|||||||
if (paramsList.isEmpty()){
|
if (paramsList.isEmpty()){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
String gatewayId = paramsList.get(0).getGatewayId();
|
||||||
|
if(Boolean.TRUE.equals(stringRedisTemplate.hasKey("cardmapping_" + gatewayId))){
|
||||||
|
stringRedisTemplate.delete("cardmapping_" + gatewayId);
|
||||||
|
}
|
||||||
List<GatewayCardParamsDO> gatewayCardParamsList = BeanUtils.toBean(paramsList, GatewayCardParamsDO.class);
|
List<GatewayCardParamsDO> gatewayCardParamsList = BeanUtils.toBean(paramsList, GatewayCardParamsDO.class);
|
||||||
return gatewayCardParamsMapper.updateBatch(gatewayCardParamsList);
|
return gatewayCardParamsMapper.updateBatch(gatewayCardParamsList);
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,11 @@ public interface GatewayInfoService {
|
|||||||
*/
|
*/
|
||||||
PageResult<GatewayInfoDO> getGatewayInfoPage(GatewayInfoPageReqVO pageReqVO);
|
PageResult<GatewayInfoDO> getGatewayInfoPage(GatewayInfoPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取机床网关列表
|
||||||
|
*/
|
||||||
|
List<GatewayInfoDO> getGatewayInfoList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据机床网关编号获取机床网关信息
|
* 根据机床网关编号获取机床网关信息
|
||||||
*/
|
*/
|
||||||
|
@ -10,6 +10,7 @@ import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayCardParamsDO;
|
|||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -49,6 +50,15 @@ public class GatewayInfoServiceImpl implements GatewayInfoService {
|
|||||||
@Resource
|
@Resource
|
||||||
private StringRedisTemplate stringRedisTemplate;
|
private StringRedisTemplate stringRedisTemplate;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
List<GatewayInfoDO> gatewayInfoList = getGatewayInfoList();
|
||||||
|
|
||||||
|
for (GatewayInfoDO gatewayInfo : gatewayInfoList) {
|
||||||
|
getGatewayCardAndParamByCatch(gatewayInfo.getGatewayId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@TenantIgnore
|
@TenantIgnore
|
||||||
public String createGatewayInfo(GatewayInfoSaveReqVO createReqVO) {
|
public String createGatewayInfo(GatewayInfoSaveReqVO createReqVO) {
|
||||||
@ -100,6 +110,14 @@ public class GatewayInfoServiceImpl implements GatewayInfoService {
|
|||||||
return new PageResult<>(page.getRecords(), page.getTotal());
|
return new PageResult<>(page.getRecords(), page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取机床网关列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<GatewayInfoDO> getGatewayInfoList(){
|
||||||
|
return gatewayInfoMapper.selectAllGatewayList();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据机床网关编号获取机床网关信息
|
* 根据机床网关编号获取机床网关信息
|
||||||
*/
|
*/
|
||||||
@ -117,12 +135,12 @@ public class GatewayInfoServiceImpl implements GatewayInfoService {
|
|||||||
public Map<String, Object> getGatewayCardAndParamByCatch(String gatewayId){
|
public Map<String, Object> getGatewayCardAndParamByCatch(String gatewayId){
|
||||||
//先从缓存中获取
|
//先从缓存中获取
|
||||||
if(Boolean.TRUE.equals(stringRedisTemplate.hasKey("cardmapping_" + gatewayId))){
|
if(Boolean.TRUE.equals(stringRedisTemplate.hasKey("cardmapping_" + gatewayId))){
|
||||||
return JsonUtils.parseObject(stringRedisTemplate.opsForValue().get("gateway_" + gatewayId), Map.class);
|
return JsonUtils.parseObject(stringRedisTemplate.opsForValue().get("cardmapping_" + gatewayId), Map.class);
|
||||||
}
|
}
|
||||||
//获取网卡信息
|
//获取网卡信息
|
||||||
List<GatewayCardInfoDO> cardList = gatewayCardInfoService.getGatewayCardInfoListByGatewayId(gatewayId);
|
List<GatewayCardInfoDO> cardList = gatewayCardInfoService.getGatewayCardInfoListByGatewayId(gatewayId);
|
||||||
//获取参数信息
|
//获取参数信息
|
||||||
List<GatewayCardParamsDO> paramsList = gatewayCardParamsService.getGatewayCardParamsByCardId(gatewayId);
|
List<GatewayCardParamsDO> paramsList = gatewayCardParamsService.getGatewayCardParamsByGatewayId(gatewayId);
|
||||||
if(cardList.size() == 0 || paramsList.size() == 0){
|
if(cardList.size() == 0 || paramsList.size() == 0){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -50,4 +50,8 @@
|
|||||||
and igi.status = 0
|
and igi.status = 0
|
||||||
and igi.deleted = '0'
|
and igi.deleted = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAllGatewayList" resultMap="GatewayInfoResult">
|
||||||
|
<include refid="selectGatewayInfoVo"/>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -67,3 +67,48 @@ export function exportProcessDataExcel(params) {
|
|||||||
responseType: "blob",
|
responseType: "blob",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 根据设备id和时间获取电流数据
|
||||||
|
export function getCurrentData(params) {
|
||||||
|
return request({
|
||||||
|
url: "/data/query/getCurrentData",
|
||||||
|
method: "get",
|
||||||
|
params: params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据设备id和时间获取液压数据
|
||||||
|
export function getPressData(params) {
|
||||||
|
return request({
|
||||||
|
url: "/data/query/getPressData",
|
||||||
|
method: "get",
|
||||||
|
params: params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据设备id和时间获取温度数据
|
||||||
|
export function getTempData(params) {
|
||||||
|
return request({
|
||||||
|
url: "/data/query/getTempData",
|
||||||
|
method: "get",
|
||||||
|
params: params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据设备id和时间获取振动数据
|
||||||
|
export function getVibrData(params) {
|
||||||
|
return request({
|
||||||
|
url: "/data/query/getVibrData",
|
||||||
|
method: "get",
|
||||||
|
params: params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据设备id和时间获取振动数据
|
||||||
|
export function getWorkData(params) {
|
||||||
|
return request({
|
||||||
|
url: "/data/query/getWorkData",
|
||||||
|
method: "get",
|
||||||
|
params: params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -33,6 +33,7 @@ export const DICT_TYPE = {
|
|||||||
ALARM_TYPE: "equip_alarm_type",
|
ALARM_TYPE: "equip_alarm_type",
|
||||||
CARD_TYPE: "card_type",
|
CARD_TYPE: "card_type",
|
||||||
MSG_TYPE: "msg_type",
|
MSG_TYPE: "msg_type",
|
||||||
|
EQUIP_RUN_STATUS: "equip_run_status",
|
||||||
// ========== SYSTEM 模块 ==========
|
// ========== SYSTEM 模块 ==========
|
||||||
SYSTEM_USER_SEX: "system_user_sex",
|
SYSTEM_USER_SEX: "system_user_sex",
|
||||||
SYSTEM_MENU_TYPE: "system_menu_type",
|
SYSTEM_MENU_TYPE: "system_menu_type",
|
||||||
|
@ -624,7 +624,6 @@ export default {
|
|||||||
if (this.datetime == null) {
|
if (this.datetime == null) {
|
||||||
this.datetime = this.getDefaultTimeRange();
|
this.datetime = this.getDefaultTimeRange();
|
||||||
}
|
}
|
||||||
// this.stopRefresh();
|
|
||||||
let startTime = new Date(this.datetime[0]);
|
let startTime = new Date(this.datetime[0]);
|
||||||
this.queryParams.startTime = startTime.toISOString();
|
this.queryParams.startTime = startTime.toISOString();
|
||||||
let endTime = new Date(this.datetime[1]);
|
let endTime = new Date(this.datetime[1]);
|
||||||
|
1543
imt-ui/src/views/system/data/monitordatadashboard/index.vue
Normal file
1543
imt-ui/src/views/system/data/monitordatadashboard/index.vue
Normal file
File diff suppressed because it is too large
Load Diff
226
imt-ui/src/views/system/equip/equipdashboard/index.vue
Normal file
226
imt-ui/src/views/system/equip/equipdashboard/index.vue
Normal file
@ -0,0 +1,226 @@
|
|||||||
|
<template>
|
||||||
|
<div :class="getClass(equipList.length)">
|
||||||
|
<el-card
|
||||||
|
v-for="(item, index) in equipList"
|
||||||
|
:key="index"
|
||||||
|
class="box-card"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
slot="header"
|
||||||
|
class="title"
|
||||||
|
>
|
||||||
|
<div class="equ-info">
|
||||||
|
<span class="name">设备型号:</span>
|
||||||
|
<span class="prop">{{ item.modelName }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="equ-info">
|
||||||
|
<span class="name">设备编号:</span>
|
||||||
|
<span class="prop">{{ item.equipNo }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="content">
|
||||||
|
<div class="equ-content">
|
||||||
|
<span class="con-name">运行状态</span>
|
||||||
|
|
||||||
|
<span
|
||||||
|
class="con-prop"
|
||||||
|
:style="statusColor(item.runStatus)"
|
||||||
|
>
|
||||||
|
<template>
|
||||||
|
<dict-tag
|
||||||
|
:type="DICT_TYPE.EQUIP_RUN_STATUS"
|
||||||
|
:value="item.runStatus"
|
||||||
|
/>
|
||||||
|
</template></span>
|
||||||
|
</div>
|
||||||
|
<div class="equ-content">
|
||||||
|
<span class="con-name">健康状态</span>
|
||||||
|
<span
|
||||||
|
class="con-prop"
|
||||||
|
:style="statusColor(item.status)"
|
||||||
|
>
|
||||||
|
<template>
|
||||||
|
<dict-tag
|
||||||
|
:type="DICT_TYPE.EQUIP_STATUS"
|
||||||
|
:value="item.status"
|
||||||
|
/>
|
||||||
|
</template></span>
|
||||||
|
</div>
|
||||||
|
<div class="equ-content">
|
||||||
|
<span class="con-name">报警数量</span>
|
||||||
|
<span class="con-prop">{{ item.alarmNum }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="content"
|
||||||
|
style="margin-top:5%"
|
||||||
|
>
|
||||||
|
<div class="equ-content">
|
||||||
|
<span class="con-name">通电时间</span>
|
||||||
|
<span class="con-prop">{{ item.powerTime }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="equ-content">
|
||||||
|
<span class="con-name">加工件数</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>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<el-card
|
||||||
|
v-if="item.status == 2"
|
||||||
|
style="margin-top:15px"
|
||||||
|
>
|
||||||
|
<div class="maintanance">
|
||||||
|
<span class="prograss-title">维修进度</span>
|
||||||
|
<el-steps
|
||||||
|
:active="item.maintananceStatus"
|
||||||
|
finish-status="success"
|
||||||
|
style="margin-top:10px"
|
||||||
|
align-center
|
||||||
|
>
|
||||||
|
<el-step title="未提交"></el-step>
|
||||||
|
<el-step title="审批中"></el-step>
|
||||||
|
<el-step title="已派单"></el-step>
|
||||||
|
<el-step title="维修中"></el-step>
|
||||||
|
<el-step title="已完成"></el-step>
|
||||||
|
</el-steps>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</el-card>
|
||||||
|
<!-- <el-card class="box-card">
|
||||||
|
<div
|
||||||
|
slot="header"
|
||||||
|
class="clearfix"
|
||||||
|
>
|
||||||
|
<span>卡片名称</span>
|
||||||
|
<el-button
|
||||||
|
style="float: right; padding: 3px 0"
|
||||||
|
type="text"
|
||||||
|
>操作按钮</el-button>
|
||||||
|
</div>
|
||||||
|
</el-card> -->
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import * as EquipInfoApi 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,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
modelName: "QB18043",
|
||||||
|
equipNo: 370755763,
|
||||||
|
runStatus: 0,
|
||||||
|
status: 2,
|
||||||
|
alarmNum: 5,
|
||||||
|
powerTime: "09:00:00",
|
||||||
|
processNum: 100,
|
||||||
|
workTime: "03:24:11",
|
||||||
|
maintananceStatus: 2,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {},
|
||||||
|
methods: {
|
||||||
|
/** 查询列表 */
|
||||||
|
async getList() {
|
||||||
|
try {
|
||||||
|
this.loading = true;
|
||||||
|
const res = await EquipInfoApi.getEquipInfoPage(this.queryParams);
|
||||||
|
this.list = res.data.list;
|
||||||
|
this.total = res.data.total;
|
||||||
|
} finally {
|
||||||
|
this.loading = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
statusColor(status) {
|
||||||
|
switch (status) {
|
||||||
|
case 0:
|
||||||
|
return "color:green";
|
||||||
|
case 1:
|
||||||
|
return "color:yellow";
|
||||||
|
case 2:
|
||||||
|
return "color: red";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getClass(num) {
|
||||||
|
if (num === 1) {
|
||||||
|
return "single-card";
|
||||||
|
} else {
|
||||||
|
return "dashboard";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
@font-face {
|
||||||
|
font-family: "BIAOTI";
|
||||||
|
src: url(../../../../assets/biaoti.ttf);
|
||||||
|
}
|
||||||
|
.dashboard {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 49% 49%;
|
||||||
|
column-gap: 2%;
|
||||||
|
margin: 1% 1% 1% 1%;
|
||||||
|
}
|
||||||
|
.single-card {
|
||||||
|
display: grid;
|
||||||
|
margin: 1% 1% 1% 1%;
|
||||||
|
}
|
||||||
|
.title {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
}
|
||||||
|
/* .equ-info {
|
||||||
|
} */
|
||||||
|
.name {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
.prop {
|
||||||
|
font-size: 16px;
|
||||||
|
color: darkgray;
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
gap: 2%;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
.equ-content {
|
||||||
|
display: grid;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.con-name {
|
||||||
|
font-family: "BIAOTI";
|
||||||
|
font-size: 20px;
|
||||||
|
/* font-weight: 700; */
|
||||||
|
}
|
||||||
|
.con-prop {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.maintanance {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.prograss-title {
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Reference in New Issue
Block a user