设备、传感器信息;大屏接口的开发;数据接口修改

This commit is contained in:
zhangjunwen 2024-04-03 09:26:29 +08:00
parent 9d530c8f23
commit 54ff266258
22 changed files with 2079 additions and 177 deletions

View File

@ -0,0 +1,105 @@
package com.inspur.web.controller.equip;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.inspur.common.annotation.Log;
import com.inspur.common.core.controller.BaseController;
import com.inspur.common.core.domain.AjaxResult;
import com.inspur.common.enums.BusinessType;
import com.inspur.equip.domain.IpcEquipInfo;
import com.inspur.equip.service.IIpcEquipInfoService;
import com.inspur.common.utils.poi.ExcelUtil;
import com.inspur.common.core.page.TableDataInfo;
/**
* 设备信息Controller
*
* @Author zhangjunwen
* @create 2024/4/1
*/
@RestController
@RequestMapping("/equip/info")
public class IpcEquipInfoController extends BaseController
{
@Autowired
private IIpcEquipInfoService ipcEquipInfoService;
/**
* 查询设备信息列表
*/
@PreAuthorize("@ss.hasPermi('equip:info:list')")
@GetMapping("/list")
public TableDataInfo list(IpcEquipInfo ipcEquipInfo)
{
startPage();
List<IpcEquipInfo> list = ipcEquipInfoService.selectIpcEquipInfoList(ipcEquipInfo);
return getDataTable(list);
}
/**
* 导出设备信息列表
*/
@PreAuthorize("@ss.hasPermi('equip:info:export')")
@Log(title = "设备信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, IpcEquipInfo ipcEquipInfo)
{
List<IpcEquipInfo> list = ipcEquipInfoService.selectIpcEquipInfoList(ipcEquipInfo);
ExcelUtil<IpcEquipInfo> util = new ExcelUtil<IpcEquipInfo>(IpcEquipInfo.class);
util.exportExcel(response, list, "设备信息数据");
}
/**
* 获取设备信息详细信息
*/
@PreAuthorize("@ss.hasPermi('equip:info:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return AjaxResult.success(ipcEquipInfoService.selectIpcEquipInfoById(id));
}
/**
* 新增设备信息
*/
@PreAuthorize("@ss.hasPermi('equip:info:add')")
@Log(title = "设备信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody IpcEquipInfo ipcEquipInfo)
{
return toAjax(ipcEquipInfoService.insertIpcEquipInfo(ipcEquipInfo));
}
/**
* 修改设备信息
*/
@PreAuthorize("@ss.hasPermi('equip:info:edit')")
@Log(title = "设备信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody IpcEquipInfo ipcEquipInfo)
{
return toAjax(ipcEquipInfoService.updateIpcEquipInfo(ipcEquipInfo));
}
/**
* 删除设备信息
*/
@PreAuthorize("@ss.hasPermi('equip:info:remove')")
@Log(title = "设备信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(ipcEquipInfoService.deleteIpcEquipInfoByIds(ids));
}
}

View File

@ -0,0 +1,89 @@
package com.inspur.web.controller.industrial;
import com.inspur.common.core.domain.AjaxResult;
import com.inspur.industrial.service.IDataQueryService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* 传感器数据查询控制器
* @Author zhangjunwen
* @create 2024/4/2
*/
@RestController
@RequestMapping("/dataQuery")
public class DataQueryController {
@Resource
private IDataQueryService dataQueryService;
/**
* 获取超压底缸大屏数据
* @return
*/
@GetMapping("/bottomCyl")
public AjaxResult getBottomCylScreenData()
{
return AjaxResult.success(dataQueryService.queryBottomCylScreenData());
}
/**
* 获取可控中高辊顶辊大屏数据
* @return
*/
@GetMapping("/topScoller")
public AjaxResult getTopScollerScreenData()
{
return AjaxResult.success(dataQueryService.queryTopScollerScreenData());
}
/**
* 获取可控中高辊底辊大屏数据
* @return
*/
@GetMapping("/bottomScoller")
public AjaxResult getBottomScollerScreenData()
{
return AjaxResult.success(dataQueryService.queryBottomScollerScreenData());
}
/**
* 根据时间查询超压底缸数据
*/
@GetMapping("/bottomCylByDate")
public AjaxResult queryBottomCylByColumnNameandDate(@RequestParam("columnName")String columnName,
@RequestParam("startTime") String startTime,
@RequestParam("endTime") String endTime)
{
String tableName = "zfipc_industrial_monitor_data1";
return AjaxResult.success(dataQueryService.queryScreenDataByColumnNameandDate(tableName, columnName, startTime, endTime));
}
/**
* 根据时间查询可控中高辊顶辊数据
*/
@GetMapping("/topScollerByDate")
public AjaxResult queryTopScollerByColumnNameandDate(@RequestParam("columnName")String columnName,
@RequestParam("startTime") String startTime,
@RequestParam("endTime") String endTime)
{
String tableName = "zfipc_industrial_monitor_data2";
return AjaxResult.success(dataQueryService.queryScreenDataByColumnNameandDate(tableName, columnName, startTime, endTime));
}
/**
* 根据时间查询可控中高辊顶辊数据
*/
@GetMapping("/bottomScollerByDate")
public AjaxResult queryBottomScollerByColumnNameandDate(@RequestParam("columnName")String columnName,
@RequestParam("startTime") String startTime,
@RequestParam("endTime") String endTime)
{
String tableName = "zfipc_industrial_monitor_data3";
return AjaxResult.success(dataQueryService.queryScreenDataByColumnNameandDate(tableName, columnName, startTime, endTime));
}
}

View File

@ -0,0 +1,105 @@
package com.inspur.web.controller.sensor;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.inspur.common.annotation.Log;
import com.inspur.common.core.controller.BaseController;
import com.inspur.common.core.domain.AjaxResult;
import com.inspur.common.enums.BusinessType;
import com.inspur.sensor.domain.IpcSensorInfo;
import com.inspur.sensor.service.IIpcSensorInfoService;
import com.inspur.common.utils.poi.ExcelUtil;
import com.inspur.common.core.page.TableDataInfo;
/**
* 传感器信息Controller
*
* @Author zhangjunwen
* @create 2024/4/1
*/
@RestController
@RequestMapping("/sensor/info")
public class IpcSensorInfoController extends BaseController
{
@Autowired
private IIpcSensorInfoService ipcSensorInfoService;
/**
* 查询传感器信息列表
*/
@PreAuthorize("@ss.hasPermi('sensor:info:list')")
@GetMapping("/list")
public TableDataInfo list(IpcSensorInfo ipcSensorInfo)
{
startPage();
List<IpcSensorInfo> list = ipcSensorInfoService.selectIpcSensorInfoList(ipcSensorInfo);
return getDataTable(list);
}
/**
* 导出传感器信息列表
*/
@PreAuthorize("@ss.hasPermi('sensor:info:export')")
@Log(title = "传感器信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, IpcSensorInfo ipcSensorInfo)
{
List<IpcSensorInfo> list = ipcSensorInfoService.selectIpcSensorInfoList(ipcSensorInfo);
ExcelUtil<IpcSensorInfo> util = new ExcelUtil<IpcSensorInfo>(IpcSensorInfo.class);
util.exportExcel(response, list, "传感器信息数据");
}
/**
* 获取传感器信息详细信息
*/
@PreAuthorize("@ss.hasPermi('sensor:info:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return AjaxResult.success(ipcSensorInfoService.selectIpcSensorInfoById(id));
}
/**
* 新增传感器信息
*/
@PreAuthorize("@ss.hasPermi('sensor:info:add')")
@Log(title = "传感器信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody IpcSensorInfo ipcSensorInfo)
{
return toAjax(ipcSensorInfoService.insertIpcSensorInfo(ipcSensorInfo));
}
/**
* 修改传感器信息
*/
@PreAuthorize("@ss.hasPermi('sensor:info:edit')")
@Log(title = "传感器信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody IpcSensorInfo ipcSensorInfo)
{
return toAjax(ipcSensorInfoService.updateIpcSensorInfo(ipcSensorInfo));
}
/**
* 删除传感器信息
*/
@PreAuthorize("@ss.hasPermi('sensor:info:remove')")
@Log(title = "传感器信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(ipcSensorInfoService.deleteIpcSensorInfoByIds(ids));
}
}

View File

@ -65,7 +65,7 @@
<dependency>
<groupId>com.infiniteautomation</groupId>
<artifactId>modbus4j</artifactId>
<version>3.0.3</version>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>

View File

@ -53,92 +53,113 @@ public class IPCData2SyncThread implements Runnable {
batch.addLocator(16, BaseLocator.holdingRegister(1, 29, DataType.TWO_BYTE_INT_UNSIGNED));// 颗粒度21um,int
batch.setContiguousRequests(false);
BatchResults<Integer> results = master.send(batch);*/
String measurement = "zfipc_monitor_data2_list";
//可控中高辊顶辊液压系统
String measurement = "zfipc_industrial_monitor_data2";
Map<String,String> tags = new TreeMap();
tags.put("equ_id","S02-27-001");
tags.put("equ_id","5d6c1a1374ea490a91e1361c1f5400aa");
Map<String,Object> fields = new TreeMap();
// 主电机电流
fields.put("zdjdl",(float) 0 + Math.random());
// 主泵输出流量
fields.put("zbscll",(float) 0 + Math.random());
// 冷却循环电机电流
fields.put("lqxhdjdl",(float) 0 + Math.random());
// 系统电流
fields.put("sys_cur",(float) 0 + Math.random());
// 系统流量
fields.put("sys_flw",(float) 0 + Math.random());
// 系统压力
fields.put("xtyl",(float) 0 + Math.random());
// 液位
fields.put("yw",(float) 0 + Math.random());
fields.put("sys_press",(float) 0 + Math.random());
// 系统液位
fields.put("sys_level",(float) 0 + Math.random());
fields.put("ywcsz",0.5);
fields.put("ywmin",0.3);
fields.put("ywmax",1);
// 液温
fields.put("ywen",(float) 0 + Math.random());
// 系统温度
fields.put("sys_temp",(float) 0 + Math.random());
// 油液颗粒度
fields.put("yykld4",(float) 0 + Math.random());
fields.put("yykld6",(float) 0 + Math.random());
fields.put("yykld14",(float) 0 + Math.random());
fields.put("yykld21",(float) 0 + Math.random());
fields.put("gran4",(float) 0 + Math.random());
fields.put("gran6",(float) 0 + Math.random());
fields.put("gran14",(float) 0 + Math.random());
fields.put("gran21",(float) 0 + Math.random());
//产线车速
fields.put("line_speed",(float) 0 + Math.random());
// 油水检测
fields.put("ysjc",(float) 0 + Math.random());
fields.put("oil_water",(float) 0 + Math.random());
// 油品粘度
fields.put("ypnd",(float) 0 + Math.random());
// 铁磁检测
fields.put("tcjc",(float) 0 + Math.random());
fields.put("visc",(float) 0 + Math.random());
//
// // 主泵输出流量
// fields.put("zbscll",(float) 0 + Math.random());
// // 冷却循环电机电流
// fields.put("lqxhdjdl",(float) 0 + Math.random());
// // 系统压力
// fields.put("xtyl",(float) 0 + Math.random());
// // 液位
// fields.put("yw",(float) 0 + Math.random());
// fields.put("ywcsz",0.5);
// fields.put("ywmin",0.3);
// fields.put("ywmax",1);
// // 液温
// fields.put("ywen",(float) 0 + Math.random());
// // 油液颗粒度
// fields.put("yykld4",(float) 0 + Math.random());
// fields.put("yykld6",(float) 0 + Math.random());
// fields.put("yykld14",(float) 0 + Math.random());
// fields.put("yykld21",(float) 0 + Math.random());
// // 油水检测
// fields.put("ysjc",(float) 0 + Math.random());
// // 油品粘度
// fields.put("ypnd",(float) 0 + Math.random());
// // 铁磁检测
// fields.put("tcjc",(float) 0 + Math.random());
// 一压区比例减压阀
fields.put("yqbljyf1",(float) 0 + Math.random());
fields.put("press1",(float) 0 + Math.random());
// 二压区比例减压阀
fields.put("yqbljyf2",(float) 0 + Math.random());
fields.put("press2",(float) 0 + Math.random());
// 三压区比例减压阀
fields.put("yqbljyf3",(float) 0 + Math.random());
fields.put("press3",(float) 0 + Math.random());
// 四压区比例减压阀
fields.put("yqbljyf4",(float) 0 + Math.random());
fields.put("press4",(float) 0 + Math.random());
// 五压区比例减乐阀
fields.put("yqbljyf5",(float) 0 + Math.random());
fields.put("press5",(float) 0 + Math.random());
// 六压区比例减压阀
fields.put("yqbljyf6",(float) 0 + Math.random());
fields.put("press6",(float) 0 + Math.random());
// 七压区比例减压阀
fields.put("yqbljyf7",(float) 0 + Math.random());
fields.put("press7",(float) 0 + Math.random());
// 八压区比例减压阀
fields.put("yqbljyf8",(float) 0 + Math.random());
fields.put("press8",(float) 0 + Math.random());
// 九压区比例减压阀
fields.put("yqbljyf9",(float) 0 + Math.random());
fields.put("press9",(float) 0 + Math.random());
// 十压区比例减乐阀
fields.put("yqbljyf10",(float) 0 + Math.random());
fields.put("press10",(float) 0 + Math.random());
// 十一压区比例减压阀
fields.put("yqbljyf11",(float) 0 + Math.random());
fields.put("press11",(float) 0 + Math.random());
// 一压区流量
fields.put("yqll1",(float) 0 + Math.random());
fields.put("flw1",(float) 0 + Math.random());
// 二压区流量
fields.put("yqll2",(float) 0 + Math.random());
fields.put("flw2",(float) 0 + Math.random());
// 三压区流量
fields.put("yqll3",(float) 0 + Math.random());
fields.put("flw3",(float) 0 + Math.random());
// 四压区流量
fields.put("yqll4",(float) 0 + Math.random());
fields.put("flw4",(float) 0 + Math.random());
// 五压区流量
fields.put("yqll5",(float) 0 + Math.random());
fields.put("flw5",(float) 0 + Math.random());
// 六压区流量
fields.put("yqll6",(float) 0 + Math.random());
fields.put("flw6",(float) 0 + Math.random());
// 七压区流量
fields.put("yqll7",(float) 0 + Math.random());
fields.put("flw7",(float) 0 + Math.random());
// 八压区流量
fields.put("yqll8",(float) 0 + Math.random());
fields.put("flw8",(float) 0 + Math.random());
// 九压区流量
fields.put("yqll9",(float) 0 + Math.random());
fields.put("flw9",(float) 0 + Math.random());
// 十压区流量
fields.put("yqll10",(float) 0 + Math.random());
fields.put("flw10",(float) 0 + Math.random());
// 十一压区流量
fields.put("yqll11",(float) 0 + Math.random());
fields.put("flw11",(float) 0 + Math.random());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
String format = simpleDateFormat.format(new Date());
fields.put("insertTime",format);
InfluxDBService i = SpringUtils.getBean(InfluxDBService.class);
// 判断并处理报警数据
JudgeUtil.judgeAndSaveAlarmData(fields,"2");
// JudgeUtil.judgeAndSaveAlarmData(fields,"2");
i.insert(measurement,tags,fields);
} catch (Exception e) {
e.printStackTrace();

View File

@ -54,88 +54,86 @@ public class IPCData3SyncThread implements Runnable {
batch.setContiguousRequests(false);
BatchResults<Integer> results = master.send(batch);*/
String measurement = "zfipc_monitor_data3_list";
String measurement = "zfipc_industrial_monitor_data3";
Map<String,String> tags = new TreeMap();
tags.put("equ_id","S02-27-001");
tags.put("equ_id","8b2d5cb04e254c15ade1e53a4f594f3f");
Map<String,Object> fields = new TreeMap();
// 主电机电流
fields.put("zdjdl",(float) 0 + Math.random());
// 主泵输出流量
fields.put("zbscll",(float) 0 + Math.random());
// 冷却循环电机电流
fields.put("lqxhdjdl",(float) 0 + Math.random());
// 系统电流
fields.put("sys_cur",(float) 0 + Math.random());
// 系统流量
fields.put("sys_flw",(float) 0 + Math.random());
// 系统压力
fields.put("xtyl",(float) 0 + Math.random());
// 液位
fields.put("yw",(float) 0 + Math.random());
fields.put("sys_press",(float) 0 + Math.random());
// 系统液位
fields.put("sys_level",(float) 0 + Math.random());
fields.put("ywcsz",0.5);
fields.put("ywmin",0.3);
fields.put("ywmax",1);
// 液温
fields.put("ywen",(float) 0 + Math.random());
// 系统温度
fields.put("sys_temp",(float) 0 + Math.random());
// 油液颗粒度
fields.put("yykld4",(float) 0 + Math.random());
fields.put("yykld6",(float) 0 + Math.random());
fields.put("yykld14",(float) 0 + Math.random());
fields.put("yykld21",(float) 0 + Math.random());
fields.put("gran4",(float) 0 + Math.random());
fields.put("gran6",(float) 0 + Math.random());
fields.put("gran14",(float) 0 + Math.random());
fields.put("gran21",(float) 0 + Math.random());
//产线车速
fields.put("line_speed",(float) 0 + Math.random());
// 油水检测
fields.put("ysjc",(float) 0 + Math.random());
fields.put("oil_water",(float) 0 + Math.random());
// 油品粘度
fields.put("ypnd",(float) 0 + Math.random());
// 铁磁检测
fields.put("tcjc",(float) 0 + Math.random());
fields.put("visc",(float) 0 + Math.random());
// 一压区比例减压阀
fields.put("yqbljyf1",(float) 0 + Math.random());
fields.put("press1",(float) 0 + Math.random());
// 二压区比例减压阀
fields.put("yqbljyf2",(float) 0 + Math.random());
fields.put("press2",(float) 0 + Math.random());
// 三压区比例减压阀
fields.put("yqbljyf3",(float) 0 + Math.random());
fields.put("press3",(float) 0 + Math.random());
// 四压区比例减压阀
fields.put("yqbljyf4",(float) 0 + Math.random());
fields.put("press4",(float) 0 + Math.random());
// 五压区比例减乐阀
fields.put("yqbljyf5",(float) 0 + Math.random());
fields.put("press5",(float) 0 + Math.random());
// 六压区比例减压阀
fields.put("yqbljyf6",(float) 0 + Math.random());
fields.put("press6",(float) 0 + Math.random());
// 七压区比例减压阀
fields.put("yqbljyf7",(float) 0 + Math.random());
fields.put("press7",(float) 0 + Math.random());
// 八压区比例减压阀
fields.put("yqbljyf8",(float) 0 + Math.random());
fields.put("press8",(float) 0 + Math.random());
// 九压区比例减压阀
fields.put("yqbljyf9",(float) 0 + Math.random());
fields.put("press9",(float) 0 + Math.random());
// 十压区比例减乐阀
fields.put("yqbljyf10",(float) 0 + Math.random());
fields.put("press10",(float) 0 + Math.random());
// 十一压区比例减压阀
fields.put("yqbljyf11",(float) 0 + Math.random());
fields.put("press11",(float) 0 + Math.random());
// 一压区流量
fields.put("yqll1",(float) 0 + Math.random());
fields.put("flw1",(float) 0 + Math.random());
// 二压区流量
fields.put("yqll2",(float) 0 + Math.random());
fields.put("flw2",(float) 0 + Math.random());
// 三压区流量
fields.put("yqll3",(float) 0 + Math.random());
fields.put("flw3",(float) 0 + Math.random());
// 四压区流量
fields.put("yqll4",(float) 0 + Math.random());
fields.put("flw4",(float) 0 + Math.random());
// 五压区流量
fields.put("yqll5",(float) 0 + Math.random());
fields.put("flw5",(float) 0 + Math.random());
// 六压区流量
fields.put("yqll6",(float) 0 + Math.random());
fields.put("flw6",(float) 0 + Math.random());
// 七压区流量
fields.put("yqll7",(float) 0 + Math.random());
fields.put("flw7",(float) 0 + Math.random());
// 八压区流量
fields.put("yqll8",(float) 0 + Math.random());
fields.put("flw8",(float) 0 + Math.random());
// 九压区流量
fields.put("yqll9",(float) 0 + Math.random());
fields.put("flw9",(float) 0 + Math.random());
// 十压区流量
fields.put("yqll10",(float) 0 + Math.random());
fields.put("flw10",(float) 0 + Math.random());
// 十一压区流量
fields.put("yqll11",(float) 0 + Math.random());
fields.put("flw11",(float) 0 + Math.random());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
String format = simpleDateFormat.format(new Date());
fields.put("insertTime",format);
InfluxDBService i = SpringUtils.getBean(InfluxDBService.class);
// 判断并处理报警数据
JudgeUtil.judgeAndSaveAlarmData(fields,"3");
// JudgeUtil.judgeAndSaveAlarmData(fields,"3");
i.insert(measurement,tags,fields);
} catch (Exception e) {
e.printStackTrace();

View File

@ -34,108 +34,137 @@ public class IPCDataSyncThread implements Runnable {
@Override
public void run() {
try {
/* BatchRead<Integer> batch = new BatchRead<Integer>();
batch.addLocator(0, BaseLocator.holdingRegister(1, 0, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 进油压力,float
batch.addLocator(1, BaseLocator.holdingRegister(1, 2, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 进油油液温度,float
batch.addLocator(2, BaseLocator.holdingRegister(1, 4, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 回油油液温度,float
batch.addLocator(3, BaseLocator.holdingRegister(1, 6, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 油水监测,float
batch.addLocator(4, BaseLocator.holdingRegister(1, 8, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 油液粘度,float
batch.addLocator(5, BaseLocator.holdingRegister(1, 10, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 力传感器,float
batch.addLocator(6, BaseLocator.holdingRegister(1, 12, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 速度传感器,float
batch.addLocator(7, BaseLocator.holdingRegister(1, 14, DataType.FOUR_BYTE_FLOAT_SWAPPED));// X1轴位置传感器一,float
batch.addLocator(8, BaseLocator.holdingRegister(1, 16, DataType.FOUR_BYTE_FLOAT_SWAPPED));// X2轴位置传感器二,float
batch.addLocator(9, BaseLocator.holdingRegister(1, 18, DataType.FOUR_BYTE_FLOAT_SWAPPED));// Y1轴位置传感器三,float
batch.addLocator(10, BaseLocator.holdingRegister(1, 20, DataType.FOUR_BYTE_FLOAT_SWAPPED));// Y2轴位置传感器四,float
batch.addLocator(11, BaseLocator.holdingRegister(1, 22, DataType.FOUR_BYTE_FLOAT_SWAPPED));// Z轴位置传感器五,float
batch.addLocator(12, BaseLocator.holdingRegister(1, 24, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 油液密度,float
batch.addLocator(13, BaseLocator.holdingRegister(1, 26, DataType.TWO_BYTE_INT_UNSIGNED));// 颗粒度4um,int
batch.addLocator(14, BaseLocator.holdingRegister(1, 27, DataType.TWO_BYTE_INT_UNSIGNED));// 颗粒度6um,int
batch.addLocator(15, BaseLocator.holdingRegister(1, 28, DataType.TWO_BYTE_INT_UNSIGNED));// 颗粒度14um,int
batch.addLocator(16, BaseLocator.holdingRegister(1, 29, DataType.TWO_BYTE_INT_UNSIGNED));// 颗粒度21um,int
batch.setContiguousRequests(false);
BatchResults<Integer> results = master.send(batch);*/
String measurement = "zfipc_monitor_data1_list";
// BatchRead<Integer> batch = new BatchRead<Integer>();
//
// batch.addLocator(0, BaseLocator.holdingRegister(1, 0, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 进油压力,float
// batch.addLocator(1, BaseLocator.holdingRegister(1, 2, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 进油油液温度,float
// batch.addLocator(2, BaseLocator.holdingRegister(1, 4, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 回油油液温度,float
// batch.addLocator(3, BaseLocator.holdingRegister(1, 6, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 油水监测,float
// batch.addLocator(4, BaseLocator.holdingRegister(1, 8, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 油液粘度,float
// batch.addLocator(5, BaseLocator.holdingRegister(1, 10, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 力传感器,float
// batch.addLocator(6, BaseLocator.holdingRegister(1, 12, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 速度传感器,float
// batch.addLocator(7, BaseLocator.holdingRegister(1, 14, DataType.FOUR_BYTE_FLOAT_SWAPPED));// X1轴位置传感器一,float
// batch.addLocator(8, BaseLocator.holdingRegister(1, 16, DataType.FOUR_BYTE_FLOAT_SWAPPED));// X2轴位置传感器二,float
// batch.addLocator(9, BaseLocator.holdingRegister(1, 18, DataType.FOUR_BYTE_FLOAT_SWAPPED));// Y1轴位置传感器三,float
// batch.addLocator(10, BaseLocator.holdingRegister(1, 20, DataType.FOUR_BYTE_FLOAT_SWAPPED));// Y2轴位置传感器四,float
// batch.addLocator(11, BaseLocator.holdingRegister(1, 22, DataType.FOUR_BYTE_FLOAT_SWAPPED));// Z轴位置传感器五,float
// batch.addLocator(12, BaseLocator.holdingRegister(1, 24, DataType.FOUR_BYTE_FLOAT_SWAPPED));// 油液密度,float
// batch.addLocator(13, BaseLocator.holdingRegister(1, 26, DataType.TWO_BYTE_INT_UNSIGNED));// 颗粒度4um,int
// batch.addLocator(14, BaseLocator.holdingRegister(1, 27, DataType.TWO_BYTE_INT_UNSIGNED));// 颗粒度6um,int
// batch.addLocator(15, BaseLocator.holdingRegister(1, 28, DataType.TWO_BYTE_INT_UNSIGNED));// 颗粒度14um,int
// batch.addLocator(16, BaseLocator.holdingRegister(1, 29, DataType.TWO_BYTE_INT_UNSIGNED));// 颗粒度21um,int
// batch.setContiguousRequests(false);
// BatchResults<Integer> results = master.send(batch);
//超压底缸加压液压系统
String measurement = "zfipc_industrial_monitor_data1";
Map<String,String> tags = new TreeMap();
tags.put("equ_id","S02-27-001");
tags.put("equ_id","e2ae4710b516419c84d1d4a819429348");
Map<String,Object> fields = new TreeMap();
// 主电机电流
fields.put("zdjdl",(float) 0 + Math.random());
// 泵输出流量
fields.put("bscll",(float) 0 + Math.random());
// 系统电流
fields.put("sys_cur",(float) 0 + Math.random());
// 系统流量
fields.put("sys_flw",(float) 0 + Math.random());
// 系统压力
fields.put("xtyl",(float) 0 + Math.random());
// 液位
fields.put("yw",(float) 0 + Math.random());
fields.put("sys_press",(float) 0 + Math.random());
// 系统液位
fields.put("sys_level",(float) 0 + Math.random());
fields.put("ywcsz",0.5);
fields.put("ywmin",0.3);
fields.put("ywmax",1);
// 液温
fields.put("ywe",(float) 0 + Math.random());
// 系统温度
fields.put("sys_temp",(float) 0 + Math.random());
// 油液颗粒度
fields.put("yykld4",(float) 0 + Math.random());
fields.put("yykld6",(float) 0 + Math.random());
fields.put("yykld14",(float) 0 + Math.random());
fields.put("yykld21",(float) 0 + Math.random());
fields.put("gran4",(float) 0 + Math.random());
fields.put("gran6",(float) 0 + Math.random());
fields.put("gran14",(float) 0 + Math.random());
fields.put("gran21",(float) 0 + Math.random());
// 油水检测
fields.put("ysjc",(float) 0 + Math.random());
fields.put("oil_water",(float) 0 + Math.random());
// 油品粘度
fields.put("ypnd",(float) 0 + Math.random());
fields.put("visc",(float) 0 + Math.random());
// 操作侧软辊流量
fields.put("czcrgll",(float) 0 + Math.random());
fields.put("opr_soft_flw",(float) 0 + Math.random());
// 操作侧热辊流量
fields.put("czcregll",(float) 0 + Math.random());
fields.put("opr_hot_flw",(float) 0 + Math.random());
// 传动侧软辊流量
fields.put("cdcrgll",(float) 0 + Math.random());
fields.put("driven_soft_flw",(float) 0 + Math.random());
// 传动侧热辊流量
fields.put("cdcregll",(float) 0 + Math.random());
// 车速
fields.put("cs",(float) 0 + Math.random());
// 底缸操作侧油缸位移
fields.put("dgczcygwy",(float) 0 + Math.random());
// 底缸传动侧油缸位移
fields.put("dgcdcygwy",(float) 0 + Math.random());
// 底缸操作侧比例伺服阀
fields.put("dgczcblsff",(float) 0 + Math.random());
// 底缸操作侧比例减压阀
fields.put("dgczcbljyf",(float) 0 + Math.random());
// 底缸传动侧比例伺服阀
fields.put("dgcdcblsff",(float) 0 + Math.random());
// 底缸传动侧比例减压阀
fields.put("dgcdcbljyf",(float) 0 + Math.random());
// TS软辊比例减压阀(TS软辊实际压力)
fields.put("tsrgsjyl",(float) 0 + Math.random());
// TS热辊比例减压阀(TS热辊实际压力)
fields.put("tsregsjyl",(float) 0 + Math.random());
// TS热辊合辊压力
fields.put("tsreghgyl",0.8);
// TS热辊加压压力
fields.put("tsregjyyl",0.7);
// TS软辊辊合辊压力
fields.put("tsrghgyl",0.5);
// TS软辊加压压力
fields.put("tsrgjyyl",0.4);
// DS软辊比例减压阀(DS软辊实际压力)
fields.put("dsrgsjyl",(float) 0 + Math.random());
// DS热辊比例减压阀(DS热辊实际压力)
fields.put("dsregsjyl",(float) 0 + Math.random());
// DS热辊合辊压力
fields.put("dsreghgyl",0.8);
// DS热辊加压压力
fields.put("dsregjyyl",0.7);
// DS软辊合辊压力
fields.put("dsrghgyl",0.5);
// DS软辊加压压力
fields.put("dsrgjyyl",0.4);
fields.put("driven_hot_flw",(float) 0 + Math.random());
//操作侧底缸比例换向阀
fields.put("opr_servo",(float) 0 + Math.random());
//传动侧比例换向阀
fields.put("driven_servo",(float) 0 + Math.random());
//操作侧底缸压力
fields.put("opr_bottom_press",(float) 0 + Math.random());
//传动侧底缸压力
fields.put("driven_bottom_press",(float) 0 + Math.random());
//操作侧软辊压力
fields.put("opr_soft_real_press",(float) 0 + Math.random());//实际压力
fields.put("opr_soft_bond_press",(float) 0 + Math.random());//合辊压力
fields.put("opr_soft_act_press",(float) 0 + Math.random());//加压压力
//操作侧热辊压力
fields.put("opr_hot_real_press",(float) 0 + Math.random());
fields.put("opr_hot_bond_press",(float) 0 + Math.random());
fields.put("opr_hot_act_press",(float) 0 + Math.random());
//传动侧软辊压力
fields.put("driven_soft_real_press",(float) 0 + Math.random());//实际
fields.put("driven_soft_bond_press",(float) 0 + Math.random());//合辊
fields.put("driven_soft_act_press",(float) 0 + Math.random());//加压
//传动侧热辊压力
fields.put("driven_hot_real_press",(float) 0 + Math.random());
fields.put("driven_hot_bond_press",(float) 0 + Math.random());
fields.put("driven_hot_act_press",(float) 0 + Math.random());
//操作侧底缸位移
fields.put("opr_bottom_dis",(float) 0 + Math.random());
//传动侧底缸位移
fields.put("driven_bottom_dis",(float) 0 + Math.random());
// // 车速
// fields.put("cs",(float) 0 + Math.random());
// // 底缸操作侧油缸位移
// fields.put("dgczcygwy",(float) 0 + Math.random());
// // 底缸传动侧油缸位移
// fields.put("dgcdcygwy",(float) 0 + Math.random());
// // 底缸操作侧比例伺服阀
// fields.put("dgczcblsff",(float) 0 + Math.random());
// // 底缸操作侧比例减压阀
// fields.put("dgczcbljyf",(float) 0 + Math.random());
// // 底缸传动侧比例伺服阀
// fields.put("dgcdcblsff",(float) 0 + Math.random());
// // 底缸传动侧比例减压阀
// fields.put("dgcdcbljyf",(float) 0 + Math.random());
// // TS软辊比例减压阀(TS软辊实际压力)
// fields.put("tsrgsjyl",(float) 0 + Math.random());
// // TS热辊比例减压阀(TS热辊实际压力)
// fields.put("tsregsjyl",(float) 0 + Math.random());
// // TS热辊合辊压力
// fields.put("tsreghgyl",0.8);
// // TS热辊加压压力
// fields.put("tsregjyyl",0.7);
// // TS软辊辊合辊压力
// fields.put("tsrghgyl",0.5);
// // TS软辊加压压力
// fields.put("tsrgjyyl",0.4);
// // DS软辊比例减压阀(DS软辊实际压力)
// fields.put("dsrgsjyl",(float) 0 + Math.random());
// // DS热辊比例减压阀(DS热辊实际压力)
// fields.put("dsregsjyl",(float) 0 + Math.random());
// // DS热辊合辊压力
// fields.put("dsreghgyl",0.8);
// // DS热辊加压压力
// fields.put("dsregjyyl",0.7);
// // DS软辊合辊压力
// fields.put("dsrghgyl",0.5);
// // DS软辊加压压力
// fields.put("dsrgjyyl",0.4);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
String format = simpleDateFormat.format(new Date());
fields.put("insertTime",format);
InfluxDBService i = SpringUtils.getBean(InfluxDBService.class);
// 判断并处理报警数据
JudgeUtil.judgeAndSaveAlarmData(fields,"1");
// JudgeUtil.judgeAndSaveAlarmData(fields,"1");
i.insert(measurement,tags,fields);
} catch (Exception e) {
e.printStackTrace();

View File

@ -0,0 +1,112 @@
package com.inspur.equip.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.inspur.common.annotation.Excel;
import com.inspur.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 设备信息对象 ipc_equip_info
*
* @Author zhangjunwen
* @create 2024/4/1
*/
public class IpcEquipInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 设备id */
private String id;
/** 设备型号 */
@Excel(name = "设备型号")
private String equipNum;
/** 设备名称 */
@Excel(name = "设备名称")
private String equipName;
/** 生产厂商 */
@Excel(name = "生产厂商")
private String equipManufacturer;
/** 序列号 */
@Excel(name = "序列号")
private String equipSerialNum;
/** 出厂日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出厂日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date equipProductionDate;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setEquipNum(String equipNum)
{
this.equipNum = equipNum;
}
public String getEquipNum()
{
return equipNum;
}
public void setEquipName(String equipName)
{
this.equipName = equipName;
}
public String getEquipName()
{
return equipName;
}
public void setEquipManufacturer(String equipManufacturer)
{
this.equipManufacturer = equipManufacturer;
}
public String getEquipManufacturer()
{
return equipManufacturer;
}
public void setEquipSerialNum(String equipSerialNum)
{
this.equipSerialNum = equipSerialNum;
}
public String getEquipSerialNum()
{
return equipSerialNum;
}
public void setEquipProductionDate(Date equipProductionDate)
{
this.equipProductionDate = equipProductionDate;
}
public Date getEquipProductionDate()
{
return equipProductionDate;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("equipNum", getEquipNum())
.append("equipName", getEquipName())
.append("equipManufacturer", getEquipManufacturer())
.append("equipSerialNum", getEquipSerialNum())
.append("equipProductionDate", getEquipProductionDate())
.append("remark", getRemark())
.toString();
}
}

View File

@ -0,0 +1,62 @@
package com.inspur.equip.mapper;
import java.util.List;
import com.inspur.equip.domain.IpcEquipInfo;
/**
* 设备信息Mapper接口
*
* @Author zhangjunwen
* @create 2024/4/1
*/
public interface IpcEquipInfoMapper
{
/**
* 查询设备信息
*
* @param id 设备信息主键
* @return 设备信息
*/
public IpcEquipInfo selectIpcEquipInfoById(String id);
/**
* 查询设备信息列表
*
* @param ipcEquipInfo 设备信息
* @return 设备信息集合
*/
public List<IpcEquipInfo> selectIpcEquipInfoList(IpcEquipInfo ipcEquipInfo);
/**
* 新增设备信息
*
* @param ipcEquipInfo 设备信息
* @return 结果
*/
public int insertIpcEquipInfo(IpcEquipInfo ipcEquipInfo);
/**
* 修改设备信息
*
* @param ipcEquipInfo 设备信息
* @return 结果
*/
public int updateIpcEquipInfo(IpcEquipInfo ipcEquipInfo);
/**
* 删除设备信息
*
* @param id 设备信息主键
* @return 结果
*/
public int deleteIpcEquipInfoById(String id);
/**
* 批量删除设备信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteIpcEquipInfoByIds(String[] ids);
}

View File

@ -0,0 +1,62 @@
package com.inspur.equip.service;
import java.util.List;
import com.inspur.equip.domain.IpcEquipInfo;
/**
* 设备信息Service接口
*
* @Author zhangjunwen
* @create 2024/4/1
*/
public interface IIpcEquipInfoService
{
/**
* 查询设备信息
*
* @param id 设备信息主键
* @return 设备信息
*/
public IpcEquipInfo selectIpcEquipInfoById(String id);
/**
* 查询设备信息列表
*
* @param ipcEquipInfo 设备信息
* @return 设备信息集合
*/
public List<IpcEquipInfo> selectIpcEquipInfoList(IpcEquipInfo ipcEquipInfo);
/**
* 新增设备信息
*
* @param ipcEquipInfo 设备信息
* @return 结果
*/
public int insertIpcEquipInfo(IpcEquipInfo ipcEquipInfo);
/**
* 修改设备信息
*
* @param ipcEquipInfo 设备信息
* @return 结果
*/
public int updateIpcEquipInfo(IpcEquipInfo ipcEquipInfo);
/**
* 批量删除设备信息
*
* @param ids 需要删除的设备信息主键集合
* @return 结果
*/
public int deleteIpcEquipInfoByIds(String[] ids);
/**
* 删除设备信息信息
*
* @param id 设备信息主键
* @return 结果
*/
public int deleteIpcEquipInfoById(String id);
}

View File

@ -0,0 +1,94 @@
package com.inspur.equip.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.inspur.equip.mapper.IpcEquipInfoMapper;
import com.inspur.equip.domain.IpcEquipInfo;
import com.inspur.equip.service.IIpcEquipInfoService;
/**
* 设备信息Service业务层处理
*
* @Author zhangjunwen
* @create 2024/4/1
*/
@Service
public class IpcEquipInfoServiceImpl implements IIpcEquipInfoService
{
@Autowired
private IpcEquipInfoMapper ipcEquipInfoMapper;
/**
* 查询设备信息
*
* @param id 设备信息主键
* @return 设备信息
*/
@Override
public IpcEquipInfo selectIpcEquipInfoById(String id)
{
return ipcEquipInfoMapper.selectIpcEquipInfoById(id);
}
/**
* 查询设备信息列表
*
* @param ipcEquipInfo 设备信息
* @return 设备信息
*/
@Override
public List<IpcEquipInfo> selectIpcEquipInfoList(IpcEquipInfo ipcEquipInfo)
{
return ipcEquipInfoMapper.selectIpcEquipInfoList(ipcEquipInfo);
}
/**
* 新增设备信息
*
* @param ipcEquipInfo 设备信息
* @return 结果
*/
@Override
public int insertIpcEquipInfo(IpcEquipInfo ipcEquipInfo)
{
return ipcEquipInfoMapper.insertIpcEquipInfo(ipcEquipInfo);
}
/**
* 修改设备信息
*
* @param ipcEquipInfo 设备信息
* @return 结果
*/
@Override
public int updateIpcEquipInfo(IpcEquipInfo ipcEquipInfo)
{
return ipcEquipInfoMapper.updateIpcEquipInfo(ipcEquipInfo);
}
/**
* 批量删除设备信息
*
* @param ids 需要删除的设备信息主键
* @return 结果
*/
@Override
public int deleteIpcEquipInfoByIds(String[] ids)
{
return ipcEquipInfoMapper.deleteIpcEquipInfoByIds(ids);
}
/**
* 删除设备信息信息
*
* @param id 设备信息主键
* @return 结果
*/
@Override
public int deleteIpcEquipInfoById(String id)
{
return ipcEquipInfoMapper.deleteIpcEquipInfoById(id);
}
}

View File

@ -0,0 +1,36 @@
package com.inspur.industrial.service;
import java.util.Map;
/**
* 采集数据查询业务层接口
* @Author zhangjunwen
* @create 2024/4/1
*/
public interface IDataQueryService {
/**
* 查询最近一分钟内数据超压底缸加压液压系统大屏数据
*/
public Map<String, Object> queryBottomCylScreenData();
/**
* 查询最近一分钟内顶辊数据
* @return
*/
public Map<String, Object> queryTopScollerScreenData();
/**
* 查询最近一分钟内底辊数据
* @return
*/
public Map<String, Object> queryBottomScollerScreenData();
/**
* 根据起止时间和字段名称查询数据
*/
public Map<String, Object> queryScreenDataByColumnNameandDate(String tableName, String columnName, String startTime, String endTime);
}

View File

@ -0,0 +1,352 @@
package com.inspur.industrial.service.impl;
import com.inspur.industrial.service.IDataQueryService;
import com.inspur.industrial.utils.InfluxdbTimeUtil;
import com.inspur.system.domain.SysConfig;
import com.inspur.system.service.ISysConfigService;
import com.inspur.system.service.influx.InfluxDBService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author zhangjunwen
* @create 2024/4/1
*/
@Service
public class DataQueryService implements IDataQueryService {
@Resource
private InfluxDBService influxDBUtils;
@Resource
private ISysConfigService sysConfigService;
/**
* 查询一分钟内超压底缸的数据
* @return
*/
@Override
public Map<String, Object> queryBottomCylScreenData(){
List<Map<String, Object>> list = selectAllDataByEquId("zfipc_industrial_monitor_data1", "e2ae4710b516419c84d1d4a819429348", 60);
Map<String, Object> resMap = new HashMap<>();
resMap.put("sysflw", list.get(0).get("sys_flw"));//系统流量
resMap.put("sysprs", list.get(0).get("sys_press"));//系统压力
resMap.put("syslevel", list.get(0).get("sys_level"));//系统液位
resMap.put("syslevelinit", Integer.parseInt(sysConfigService.selectConfigByKey("sys.liquidlevel.init")));//液位初始值
//TODO 获取系统液位高值和低值
resMap.put("systemp",list.get(0).get("sys_temp"));//系统温度
resMap.put("syshumid",list.get(0).get("oil_water"));//系统湿度
resMap.put("sysvisc",list.get(0).get("visc"));//系统粘度
//系统颗粒度
resMap.put("sysgran4",list.get(0).get("gran4"));
resMap.put("sysgran6",list.get(0).get("gran6"));
resMap.put("sysgran14",list.get(0).get("gran14"));
resMap.put("sysgran21",list.get(0).get("gran21"));
// Map<String, Object> oprsoftflw = (Map<String, Object>) new HashMap<>().put("oprsoftflw",list.get(0).get("opr_soft_flw") );//操作侧软辊流量
// Map<String, Object> oprhotflw = (Map<String, Object>) new HashMap<>().put("oprhotflw",list.get(0).get("opr_hot_flw") );//操作侧热辊流量
// Map<String, Object> drivensoftflw = (Map<String, Object>) new HashMap<>().put("drivensoftflw",list.get(0).get("driven_soft_flw") );//传动侧软辊流量
// Map<String, Object> drivenhotflw = (Map<String, Object>) new HashMap<>().put("drivenhotflw",list.get(0).get("driven_hot_flw") );//传动侧软辊流量
resMap.put("oprservo",list.get(0).get("opr_servo"));//操作侧底缸比例换向阀
resMap.put("drivenservo",list.get(0).get("driven_servo"));//操作侧底缸比例换向阀
//功率= 3IUcosΦ/1000
resMap.put("syspower",Math.sqrt(3)*Float.parseFloat(list.get(0).get("sys_cur").toString())*380*0.86/1000);
//系统效率 = 系统压力*系统流量/系统功率
double power = (double) resMap.get("syspower");
double sysflw = (double)resMap.get("sysflw");
double pressure = (double)resMap.get("sysprs");
resMap.put("syseff",pressure * sysflw/power);
List<Object> syscur = new ArrayList<>();//系统电流
List<Object> oprbottompress = new ArrayList<>();//底缸操作侧压力
List<Object> drivenbottompress = new ArrayList<>();//底缸传动侧压力
List<Object> oprsoftrealpress = new ArrayList<>();//操作侧软辊压力
List<Object> oprsoftbondpress = new ArrayList<>();//操作侧软辊合辊压力
List<Object> oprsoftactpress = new ArrayList<>();//操作侧软辊加压压力
List<Object> oprhotrealpress = new ArrayList<>();//操作侧热辊压力
List<Object> oprhotbondpress = new ArrayList<>();//操作侧热辊合辊压力
List<Object> oprhotactpress = new ArrayList<>();//操作侧热辊加压压力
List<Object> drivensoftrealpress = new ArrayList<>();//传动侧软辊压力
List<Object> drivensoftbondpress = new ArrayList<>();//传动侧软辊合辊压力
List<Object> drivensoftactpress = new ArrayList<>();//传动侧软辊加压压力
List<Object> drivenhotrealpress = new ArrayList<>();//传动侧热辊压力
List<Object> drivenhotbondpress = new ArrayList<>();//传动侧热辊合辊压力
List<Object> drivenhotactpress = new ArrayList<>();//传动侧热辊加压压力
List<Object> oprbottomdis = new ArrayList<>();//操作侧底缸位移
List<Object> drivenbottomdis = new ArrayList<>();//传动侧底缸位移
List<String> timelist = new ArrayList<>();
for (int i = list.size() - 1; i >= 0; i--) {
Map<String, Object> data = list.get(i);
syscur.add(data.get("sys_cur"));
oprbottompress.add(data.get("opr_bottom_press") == null ? 0 : data.get("opr_bottom_press"));
drivenbottompress.add(data.get("driven_bottom_press") == null ? 0 : data.get("driven_bottom_press"));
oprsoftrealpress.add(data.get("opr_soft_real_press") == null ? 0 : data.get("opr_soft_real_press"));
oprsoftbondpress.add(data.get("opr_soft_bond_press") == null ? 0 : data.get("opr_soft_bond_press"));
oprsoftactpress.add(data.get("opr_soft_act_press") == null ? 0 : data.get("opr_soft_act_press"));
oprhotrealpress.add(data.get("opr_hot_real_press") == null ? 0 : data.get("opr_hot_real_press"));
oprhotbondpress.add(data.get("opr_hot_bond_press") == null ? 0 : data.get("opr_hot_bond_press"));
oprhotactpress.add(data.get("opr_hot_act_press") == null ? 0 : data.get("opr_hot_act_press"));
drivensoftrealpress.add(data.get("driven_soft_real_press") == null ? 0 : data.get("driven_soft_real_press"));
drivensoftbondpress.add(data.get("driven_soft_bond_press") == null ? 0 : data.get("driven_soft_bond_press"));
drivensoftactpress.add(data.get("driven_soft_act_press") == null ? 0 : data.get("driven_soft_act_press"));
drivenhotrealpress.add(data.get("driven_hot_real_press") == null ? 0 : data.get("driven_hot_real_press"));
drivenhotbondpress.add(data.get("driven_hot_bond_press") == null ? 0 : data.get("driven_hot_bond_press"));
drivenhotactpress.add(data.get("driven_hot_act_press") == null ? 0 : data.get("driven_hot_act_press"));
oprbottomdis.add(data.get("opr_bottom_dis") == null ? 0 : data.get("opr_bottom_dis"));
drivenbottomdis.add(data.get("driven_bottom_dis") == null ? 0 : data.get("driven_bottom_dis"));
LocalDateTime time = InfluxdbTimeUtil.utcToCst(data.get("time").toString());
timelist.add( time.getMinute() < 10 ? "0" + time.getMinute() : time.getMinute() + ":" + (time.getSecond() < 10 ? "0" + time.getSecond() : time.getSecond()));
}
resMap.put("syscur",syscur);
resMap.put("oprbottompress",oprbottompress);
resMap.put("drivenbottompress",drivenbottompress);
resMap.put("oprsoftrealpress",oprsoftrealpress);
resMap.put("oprsoftbondpress",oprsoftbondpress);
resMap.put("oprsoftactpress",oprsoftactpress);
resMap.put("oprhotrealpress",oprhotrealpress);
resMap.put("oprhotbondpress",oprhotbondpress);
resMap.put("oprhotactpress",oprhotactpress);
resMap.put("drivensoftrealpress",drivensoftrealpress);
resMap.put("drivensoftbondpress",drivensoftbondpress);
resMap.put("drivensoftactpress",drivensoftactpress);
resMap.put("drivenhotrealpress",drivenhotrealpress);
resMap.put("drivenhotbondpress",drivenhotbondpress);
resMap.put("drivenhotactpress",drivenhotactpress);
resMap.put("oprbottomdis",oprbottomdis);
resMap.put("drivenbottomdis",drivenbottomdis);
resMap.put("timelist",timelist);
return resMap;
}
/**
* 查询最近一分钟内顶辊数据
* @return
*/
@Override
public Map<String, Object> queryTopScollerScreenData(){
List<Map<String, Object>> list = selectAllDataByEquId("zfipc_industrial_monitor_data2", "5d6c1a1374ea490a91e1361c1f5400aa", 60);
return queryScollerData(list);
}
/**
* 查询最近一分钟内底辊数据
* @return
*/
@Override
public Map<String, Object> queryBottomScollerScreenData(){
List<Map<String, Object>> list = selectAllDataByEquId("zfipc_industrial_monitor_data3", "8b2d5cb04e254c15ade1e53a4f594f3f", 60);
return queryScollerData(list);
}
/**
* 根据起止时间和字段名称查询数据
*/
@Override
public Map<String, Object> queryScreenDataByColumnNameandDate(String tableName,String columnName, String startTime, String endTime){
String utcStartTime = InfluxdbTimeUtil.cstToUtc(startTime);
String utcEndTime = InfluxdbTimeUtil.cstToUtc(endTime);
Map<String, Object> resMap = new HashMap<>();
List<Map<String, Object>> list = selectDataByColumnNameandDate(tableName, columnName, utcStartTime, utcEndTime);
if (list.size() == 0){
return null;
}
List<Object> columnList = new ArrayList<>();
List<String> timelist = new ArrayList<>();
list.forEach(data ->{
columnList.add(data.get(columnName));
LocalDateTime time = InfluxdbTimeUtil.utcToCst(data.get("time").toString());
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
timelist.add(time.format(formatter));
});
resMap.put("y", columnList);
resMap.put("x", timelist);
return resMap;
}
/**
* 根据设备id查询最近num条数据
* @param tableName 表名
* @param equipId 设备id
* @param num 条数
* @return 数据
*/
private List<Map<String, Object>> selectAllDataByEquId(String tableName, String equipId, int num){
String sql = "select * from " + tableName + " where equ_id = '" + equipId + "' order by time desc limit " + num;
return influxDBUtils.queryResultProcess(influxDBUtils.query(sql));
}
/**
* 根据字段名称和起止时间查询数据
* @param tableName 表名
* @param columnName 字段名称
* @param startTime 起始时间
* @param endTime 结束时间
* @return 数据
*/
private List<Map<String, Object>> selectDataByColumnNameandDate(String tableName, String columnName, String startTime, String endTime){
String sql = "select time," + columnName + " from " + tableName + " where time >= '" + startTime + "' and time <= '" + endTime + "'";
return influxDBUtils.queryResultProcess(influxDBUtils.query(sql));
}
/**
* 查询辊子的数据
* @param list 查询的数据
* @return 辊子大屏数据
*/
private Map<String, Object> queryScollerData(List<Map<String, Object>> list)
{
Map<String, Object> resMap = new HashMap<>();
resMap.put("sysflw", list.get(0).get("sys_flw"));//系统流量
resMap.put("sysprs", list.get(0).get("sys_press"));//系统压力
resMap.put("syslevel", list.get(0).get("sys_level"));//系统液位
resMap.put("syslevelinit", Integer.parseInt(sysConfigService.selectConfigByKey("sys.liquidlevel.init")));//液位初始值
//TODO 获取系统液位高值和低值
resMap.put("systemp",list.get(0).get("sys_temp"));//系统温度
resMap.put("syshumid",list.get(0).get("oil_water"));//系统湿度
resMap.put("sysvisc",list.get(0).get("visc"));//系统粘度
//系统颗粒度
resMap.put("sysgran4",list.get(0).get("gran4"));
resMap.put("sysgran6",list.get(0).get("gran6"));
resMap.put("sysgran14",list.get(0).get("gran14"));
resMap.put("sysgran21",list.get(0).get("gran21"));
resMap.put("linespeed",list.get(0).get("line_speed"));//车速
//功率= 3IUcosΦ/1000
resMap.put("syspower",Math.sqrt(3)*Float.parseFloat(list.get(0).get("sys_cur").toString())*380*0.86/1000);
//系统效率 = 系统压力*系统流量/系统功率
double power = (double) resMap.get("syspower");
double sysflw = (double)resMap.get("sysflw");
double pressure = (double)resMap.get("sysprs");
resMap.put("syseff",pressure * sysflw/power);
List<Object> syscur = new ArrayList<>();//系统电流
List<Object> flw1 = new ArrayList<>();//一区流量
List<Object> flw2 = new ArrayList<>();//二区流量
List<Object> flw3 = new ArrayList<>();//三区流量
List<Object> flw4 = new ArrayList<>();//四区流量
List<Object> flw5 = new ArrayList<>();//五区流量
List<Object> flw6 = new ArrayList<>();//六区流量
List<Object> flw7 = new ArrayList<>();//七区流量
List<Object> flw8 = new ArrayList<>();//八区流量
List<Object> flw9 = new ArrayList<>();//九区流量
List<Object> flw10 = new ArrayList<>();//十区流量
List<Object> flw11 = new ArrayList<>();//十一区流量
List<Object> prs1 = new ArrayList<>();//一区压力
List<Object> prs2 = new ArrayList<>();//二区压力
List<Object> prs3 = new ArrayList<>();//三区压力
List<Object> prs4 = new ArrayList<>();//四区压力
List<Object> prs5 = new ArrayList<>();//五区压力
List<Object> prs6 = new ArrayList<>();//六区压力
List<Object> prs7 = new ArrayList<>();//七区压力
List<Object> prs8 = new ArrayList<>();//八区压力
List<Object> prs9 = new ArrayList<>();//九区压力
List<Object> prs10 = new ArrayList<>();//十区压力
List<Object> prs11 = new ArrayList<>();//十一区压力
List<String> timelist = new ArrayList<>();
for (int i = list.size() - 1; i >= 0; i--) {
Map<String, Object> data = list.get(i);
syscur.add(data.get("sys_cur") == null ? 0 : data.get("sys_cur"));
flw1.add(data.get("flw1") == null ? 0 : data.get("flw1"));
flw2.add(data.get("flw2") == null ? 0 : data.get("flw2"));
flw3.add(data.get("flw3") == null ? 0 : data.get("flw3"));
flw4.add(data.get("flw4") == null ? 0 : data.get("flw4"));
flw5.add(data.get("flw5") == null ? 0 : data.get("flw5"));
flw6.add(data.get("flw6") == null ? 0 : data.get("flw6"));
flw7.add(data.get("flw7") == null ? 0 : data.get("flw7"));
flw8.add(data.get("flw8") == null ? 0 : data.get("flw8"));
flw9.add(data.get("flw9") == null ? 0 : data.get("flw9"));
flw10.add(data.get("flw10") == null ? 0 : data.get("flw10"));
flw11.add(data.get("flw11") == null ? 0 : data.get("flw11"));
prs1.add(data.get("press1") == null ? 0 : data.get("press1"));
prs2.add(data.get("press2") == null ? 0 : data.get("press2"));
prs3.add(data.get("press3") == null ? 0 : data.get("press3"));
prs4.add(data.get("press4") == null ? 0 : data.get("press4"));
prs5.add(data.get("press5") == null ? 0 : data.get("press5"));
prs6.add(data.get("press6") == null ? 0 : data.get("press6"));
prs7.add(data.get("press7") == null ? 0 : data.get("press7"));
prs8.add(data.get("press8") == null ? 0 : data.get("press8"));
prs9.add(data.get("press9") == null ? 0 : data.get("press9"));
prs10.add(data.get("press10") == null ? 0 : data.get("press10"));
prs11.add(data.get("press11") == null ? 0 : data.get("press11"));
LocalDateTime time = InfluxdbTimeUtil.utcToCst(data.get("time").toString());
timelist.add( time.getMinute() < 10 ? "0" + time.getMinute() : time.getMinute() + ":" + (time.getSecond() < 10 ? "0" + time.getSecond() : time.getSecond()));
}
resMap.put("syscur",syscur);
resMap.put("flw1",flw1);
resMap.put("flw2",flw2);
resMap.put("flw3",flw3);
resMap.put("flw4",flw4);
resMap.put("flw5",flw5);
resMap.put("flw6",flw6);
resMap.put("flw7",flw7);
resMap.put("flw8",flw8);
resMap.put("flw9",flw9);
resMap.put("flw10",flw10);
resMap.put("flw11",flw11);
resMap.put("prs1",prs1);
resMap.put("prs2",prs2);
resMap.put("prs3",prs3);
resMap.put("prs4",prs4);
resMap.put("prs5",prs5);
resMap.put("prs6",prs6);
resMap.put("prs7",prs7);
resMap.put("prs8",prs8);
resMap.put("prs9",prs9);
resMap.put("prs10",prs10);
resMap.put("prs11",prs11);
resMap.put("timelist",timelist);
return resMap;
}
}

View File

@ -0,0 +1,38 @@
package com.inspur.industrial.utils;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
/**
*influxdb时间工具类
* @Author zhangjunwen
* @create 2024/4/1
*/
public class InfluxdbTimeUtil {
/**
* 将utc时间转北京时间
* @param date utc时间
* @return 北京时间
*/
public static LocalDateTime utcToCst(String date) {
DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE_TIME;
LocalDateTime localDateTime = LocalDateTime.parse(date, formatter);
return localDateTime.plusHours(8);
}
/**
* 将北京时间转utc时间
* @param date 北京时间
* @return utc时间
* 例如输入2020-04-01T08:00:00.000
* 返回2020-04-01T00:00:00.000Z
*/
public static String cstToUtc(String date){
LocalDateTime localDateTime = LocalDateTime.parse(date);
String utcTime = localDateTime.atZone(ZoneId.of("UTC+8")).withZoneSameInstant(ZoneId.of("UTC")).format(DateTimeFormatter.ISO_DATE_TIME);
return utcTime.substring(0, utcTime.indexOf("Z")+1);
}
}

View File

@ -0,0 +1,123 @@
package com.inspur.sensor.domain;
import com.inspur.common.annotation.Excel;
import com.inspur.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 传感器信息对象 ipc_sensor_info
*
* @Author zhangjunwen
* @create 2024/4/1
*/
public class IpcSensorInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 传感器id */
private String id;
/** 传感器编号 */
@Excel(name = "传感器编号")
private String sensorNum;
/** 传感器名称 */
@Excel(name = "传感器名称")
private String sensorName;
/** 传感器型号 */
@Excel(name = "传感器型号")
private String sensorModel;
/** 生产厂商 */
@Excel(name = "生产厂商")
private String sensorManufacturer;
/** 类型 */
@Excel(name = "类型")
private String sensorType;
/** 设备id */
@Excel(name = "设备id")
private String equipId;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setSensorNum(String sensorNum)
{
this.sensorNum = sensorNum;
}
public String getSensorNum()
{
return sensorNum;
}
public void setSensorName(String sensorName)
{
this.sensorName = sensorName;
}
public String getSensorName()
{
return sensorName;
}
public void setSensorModel(String sensorModel)
{
this.sensorModel = sensorModel;
}
public String getSensorModel()
{
return sensorModel;
}
public void setSensorManufacturer(String sensorManufacturer)
{
this.sensorManufacturer = sensorManufacturer;
}
public String getSensorManufacturer()
{
return sensorManufacturer;
}
public void setSensorType(String sensorType)
{
this.sensorType = sensorType;
}
public String getSensorType()
{
return sensorType;
}
public void setEquipId(String equipId)
{
this.equipId = equipId;
}
public String getEquipId()
{
return equipId;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("sensorNum", getSensorNum())
.append("sensorName", getSensorName())
.append("sensorModel", getSensorModel())
.append("sensorManufacturer", getSensorManufacturer())
.append("sensorType", getSensorType())
.append("equipId", getEquipId())
.append("remark", getRemark())
.toString();
}
}

View File

@ -0,0 +1,62 @@
package com.inspur.sensor.mapper;
import java.util.List;
import com.inspur.sensor.domain.IpcSensorInfo;
/**
* 传感器信息Mapper接口
*
* @Author zhangjunwen
* @create 2024/4/1
*/
public interface IpcSensorInfoMapper
{
/**
* 查询传感器信息
*
* @param id 传感器信息主键
* @return 传感器信息
*/
public IpcSensorInfo selectIpcSensorInfoById(String id);
/**
* 查询传感器信息列表
*
* @param ipcSensorInfo 传感器信息
* @return 传感器信息集合
*/
public List<IpcSensorInfo> selectIpcSensorInfoList(IpcSensorInfo ipcSensorInfo);
/**
* 新增传感器信息
*
* @param ipcSensorInfo 传感器信息
* @return 结果
*/
public int insertIpcSensorInfo(IpcSensorInfo ipcSensorInfo);
/**
* 修改传感器信息
*
* @param ipcSensorInfo 传感器信息
* @return 结果
*/
public int updateIpcSensorInfo(IpcSensorInfo ipcSensorInfo);
/**
* 删除传感器信息
*
* @param id 传感器信息主键
* @return 结果
*/
public int deleteIpcSensorInfoById(String id);
/**
* 批量删除传感器信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteIpcSensorInfoByIds(String[] ids);
}

View File

@ -0,0 +1,62 @@
package com.inspur.sensor.service;
import java.util.List;
import com.inspur.sensor.domain.IpcSensorInfo;
/**
* 传感器信息Service接口
*
* @author inspur
* @date 2024-04-01
*/
public interface IIpcSensorInfoService
{
/**
* 查询传感器信息
*
* @param id 传感器信息主键
* @return 传感器信息
*/
public IpcSensorInfo selectIpcSensorInfoById(String id);
/**
* 查询传感器信息列表
*
* @param ipcSensorInfo 传感器信息
* @return 传感器信息集合
*/
public List<IpcSensorInfo> selectIpcSensorInfoList(IpcSensorInfo ipcSensorInfo);
/**
* 新增传感器信息
*
* @param ipcSensorInfo 传感器信息
* @return 结果
*/
public int insertIpcSensorInfo(IpcSensorInfo ipcSensorInfo);
/**
* 修改传感器信息
*
* @param ipcSensorInfo 传感器信息
* @return 结果
*/
public int updateIpcSensorInfo(IpcSensorInfo ipcSensorInfo);
/**
* 批量删除传感器信息
*
* @param ids 需要删除的传感器信息主键集合
* @return 结果
*/
public int deleteIpcSensorInfoByIds(String[] ids);
/**
* 删除传感器信息信息
*
* @param id 传感器信息主键
* @return 结果
*/
public int deleteIpcSensorInfoById(String id);
}

View File

@ -0,0 +1,94 @@
package com.inspur.sensor.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.inspur.sensor.mapper.IpcSensorInfoMapper;
import com.inspur.sensor.domain.IpcSensorInfo;
import com.inspur.sensor.service.IIpcSensorInfoService;
/**
* 传感器信息Service业务层处理
*
* @Author zhangjunwen
* @create 2024/4/1
*/
@Service
public class IpcSensorInfoServiceImpl implements IIpcSensorInfoService
{
@Autowired
private IpcSensorInfoMapper ipcSensorInfoMapper;
/**
* 查询传感器信息
*
* @param id 传感器信息主键
* @return 传感器信息
*/
@Override
public IpcSensorInfo selectIpcSensorInfoById(String id)
{
return ipcSensorInfoMapper.selectIpcSensorInfoById(id);
}
/**
* 查询传感器信息列表
*
* @param ipcSensorInfo 传感器信息
* @return 传感器信息
*/
@Override
public List<IpcSensorInfo> selectIpcSensorInfoList(IpcSensorInfo ipcSensorInfo)
{
return ipcSensorInfoMapper.selectIpcSensorInfoList(ipcSensorInfo);
}
/**
* 新增传感器信息
*
* @param ipcSensorInfo 传感器信息
* @return 结果
*/
@Override
public int insertIpcSensorInfo(IpcSensorInfo ipcSensorInfo)
{
return ipcSensorInfoMapper.insertIpcSensorInfo(ipcSensorInfo);
}
/**
* 修改传感器信息
*
* @param ipcSensorInfo 传感器信息
* @return 结果
*/
@Override
public int updateIpcSensorInfo(IpcSensorInfo ipcSensorInfo)
{
return ipcSensorInfoMapper.updateIpcSensorInfo(ipcSensorInfo);
}
/**
* 批量删除传感器信息
*
* @param ids 需要删除的传感器信息主键
* @return 结果
*/
@Override
public int deleteIpcSensorInfoByIds(String[] ids)
{
return ipcSensorInfoMapper.deleteIpcSensorInfoByIds(ids);
}
/**
* 删除传感器信息信息
*
* @param id 传感器信息主键
* @return 结果
*/
@Override
public int deleteIpcSensorInfoById(String id)
{
return ipcSensorInfoMapper.deleteIpcSensorInfoById(id);
}
}

View File

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.equip.mapper.IpcEquipInfoMapper">
<resultMap type="IpcEquipInfo" id="IpcEquipInfoResult">
<result property="id" column="id" />
<result property="equipNum" column="equip_num" />
<result property="equipName" column="equip_name" />
<result property="equipManufacturer" column="equip_manufacturer" />
<result property="equipSerialNum" column="equip_serial_num" />
<result property="equipProductionDate" column="equip_production_date" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectIpcEquipInfoVo">
select id, equip_num, equip_name, equip_manufacturer, equip_serial_num, equip_production_date, remark from ipc_equip_info
</sql>
<select id="selectIpcEquipInfoList" parameterType="IpcEquipInfo" resultMap="IpcEquipInfoResult">
<include refid="selectIpcEquipInfoVo"/>
<where>
<if test="equipNum != null and equipNum != ''"> and equip_num = #{equipNum}</if>
<if test="equipName != null and equipName != ''"> and equip_name like concat('%', #{equipName}, '%')</if>
<if test="equipManufacturer != null and equipManufacturer != ''"> and equip_manufacturer = #{equipManufacturer}</if>
<if test="equipSerialNum != null and equipSerialNum != ''"> and equip_serial_num = #{equipSerialNum}</if>
<if test="equipProductionDate != null "> and equip_production_date = #{equipProductionDate}</if>
</where>
</select>
<select id="selectIpcEquipInfoById" parameterType="String" resultMap="IpcEquipInfoResult">
<include refid="selectIpcEquipInfoVo"/>
where id = #{id}
</select>
<insert id="insertIpcEquipInfo" parameterType="IpcEquipInfo">
insert into ipc_equip_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="equipNum != null">equip_num,</if>
<if test="equipName != null">equip_name,</if>
<if test="equipManufacturer != null">equip_manufacturer,</if>
<if test="equipSerialNum != null">equip_serial_num,</if>
<if test="equipProductionDate != null">equip_production_date,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="equipNum != null">#{equipNum},</if>
<if test="equipName != null">#{equipName},</if>
<if test="equipManufacturer != null">#{equipManufacturer},</if>
<if test="equipSerialNum != null">#{equipSerialNum},</if>
<if test="equipProductionDate != null">#{equipProductionDate},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateIpcEquipInfo" parameterType="IpcEquipInfo">
update ipc_equip_info
<trim prefix="SET" suffixOverrides=",">
<if test="equipNum != null">equip_num = #{equipNum},</if>
<if test="equipName != null">equip_name = #{equipName},</if>
<if test="equipManufacturer != null">equip_manufacturer = #{equipManufacturer},</if>
<if test="equipSerialNum != null">equip_serial_num = #{equipSerialNum},</if>
<if test="equipProductionDate != null">equip_production_date = #{equipProductionDate},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteIpcEquipInfoById" parameterType="String">
delete from ipc_equip_info where id = #{id}
</delete>
<delete id="deleteIpcEquipInfoByIds" parameterType="String">
delete from ipc_equip_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.sensor.mapper.IpcSensorInfoMapper">
<resultMap type="IpcSensorInfo" id="IpcSensorInfoResult">
<result property="id" column="id" />
<result property="sensorNum" column="sensor_num" />
<result property="sensorName" column="sensor_name" />
<result property="sensorModel" column="sensor_model" />
<result property="sensorManufacturer" column="sensor_manufacturer" />
<result property="sensorType" column="sensor_type" />
<result property="equipId" column="equip_id" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectIpcSensorInfoVo">
select id, sensor_num, sensor_name, sensor_model, sensor_manufacturer, sensor_type, equip_id, remark from ipc_sensor_info
</sql>
<select id="selectIpcSensorInfoList" parameterType="IpcSensorInfo" resultMap="IpcSensorInfoResult">
<include refid="selectIpcSensorInfoVo"/>
<where>
<if test="sensorNum != null and sensorNum != ''"> and sensor_num = #{sensorNum}</if>
<if test="sensorName != null and sensorName != ''"> and sensor_name like concat('%', #{sensorName}, '%')</if>
<if test="sensorModel != null and sensorModel != ''"> and sensor_model = #{sensorModel}</if>
<if test="sensorManufacturer != null and sensorManufacturer != ''"> and sensor_manufacturer = #{sensorManufacturer}</if>
<if test="sensorType != null and sensorType != ''"> and sensor_type = #{sensorType}</if>
<if test="equipId != null and equipId != ''"> and equip_id = #{equipId}</if>
</where>
</select>
<select id="selectIpcSensorInfoById" parameterType="String" resultMap="IpcSensorInfoResult">
<include refid="selectIpcSensorInfoVo"/>
where id = #{id}
</select>
<insert id="insertIpcSensorInfo" parameterType="IpcSensorInfo">
insert into ipc_sensor_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="sensorNum != null">sensor_num,</if>
<if test="sensorName != null">sensor_name,</if>
<if test="sensorModel != null">sensor_model,</if>
<if test="sensorManufacturer != null">sensor_manufacturer,</if>
<if test="sensorType != null">sensor_type,</if>
<if test="equipId != null">equip_id,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="sensorNum != null">#{sensorNum},</if>
<if test="sensorName != null">#{sensorName},</if>
<if test="sensorModel != null">#{sensorModel},</if>
<if test="sensorManufacturer != null">#{sensorManufacturer},</if>
<if test="sensorType != null">#{sensorType},</if>
<if test="equipId != null">#{equipId},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateIpcSensorInfo" parameterType="IpcSensorInfo">
update ipc_sensor_info
<trim prefix="SET" suffixOverrides=",">
<if test="sensorNum != null">sensor_num = #{sensorNum},</if>
<if test="sensorName != null">sensor_name = #{sensorName},</if>
<if test="sensorModel != null">sensor_model = #{sensorModel},</if>
<if test="sensorManufacturer != null">sensor_manufacturer = #{sensorManufacturer},</if>
<if test="sensorType != null">sensor_type = #{sensorType},</if>
<if test="equipId != null">equip_id = #{equipId},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteIpcSensorInfoById" parameterType="String">
delete from ipc_sensor_info where id = #{id}
</delete>
<delete id="deleteIpcSensorInfoByIds" parameterType="String">
delete from ipc_sensor_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -5,7 +5,7 @@
"author": "",
"license": "MIT",
"scripts": {
"dev": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
"dev": "vue-cli-service serve",
"build:prod": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview",

View File

@ -19,7 +19,10 @@
class="dataCol"
>
<div class="dataDiv">
<div><span class="font-size-10">软辊合辊压力</span><span class="font-size-16">{{dsrghgyl}}</span><span class="font-size-8">bar</span></div>
<div><span
class="font-size-10"
@click="clicktest"
>软辊合辊压力</span><span class="font-size-16">{{dsrghgyl}}</span><span class="font-size-8">bar</span></div>
<div><span class="font-size-10">软辊加压压力</span><span class="font-size-16">{{dsrgjyyl}}</span><span class="font-size-8">bar</span></div>
<div><span class="font-size-10">软辊实际压力</span><span class="font-size-16">{{dsrgsjyl}}</span><span class="font-size-8">bar</span></div>
<div><span class="font-size-10">热辊合辊压力</span><span class="font-size-16">{{dsreghgyl}}</span><span class="font-size-8">bar</span></div>
@ -592,6 +595,64 @@
</el-container>
</el-col>
</el-row>
<el-dialog
:title="dialogTitle"
:visible.sync="isOpen"
:close-on-click-modal="false"
width="50%"
center
>
<div class="block">
<span class="demonstration">时间</span>
<el-date-picker
v-model="datetime"
type="datetime"
placeholder="选择日期时间"
>
</el-date-picker>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
> </el-button>
<el-button
icon="el-icon-refresh"
size="mini"
@click="resetQuery"
>重置</el-button>
</div>
<template v-if="chartLoading">
<div
v-if="!isNoData"
class="el-loading-mask"
>
<div class="el-loading-spinner">
<svg
viewBox="25 25 50 50"
class="circular"
>
<circle
cx="50"
cy="50"
r="20"
fill="none"
class="path"
></circle>
</svg>
</div>
</div>
</template>
<div
:visible="!chartLoading"
ref="chart"
:style="{ height: height }"
></div>
<div v-if="isNoData">
<span style="text-align:center">暂无数据</span>
</div>
</el-dialog>
</div>
</template>
@ -600,6 +661,14 @@ import * as echarts from "echarts";
import { isArray, merge } from "lodash";
import { cydgdata, cydgdataHistory } from "@/api/testScreen/testScreen.js";
import lbCompents from "../lb";
import {
listBottomCylData,
listTopScollerData,
listBottomScollerData,
getBottomCylDataByDate,
getTopScollerDataByDate,
getBottomScollerDataByDate,
} from "@/api/data/query.js";
export default {
name: "yxjk",
components: { lbCompents },
@ -683,6 +752,17 @@ export default {
dgczcygwy: 0,
//
percentage: 80,
dialogTitle: "",
isOpen: false,
chartLoading: false,
isNoData: false,
height: "300%",
queryParams: {
columnName: null,
startTime: null,
endTime: null,
},
datetime: "",
};
},
beforeDestroy() {
@ -692,6 +772,7 @@ export default {
mounted() {
this.queryDataInit();
this.intervalTask = setInterval(() => {
// this.test();
//
this.queryData();
}, 1000);
@ -702,6 +783,214 @@ export default {
}, 60 * 1000);
},
methods: {
formatDateTime(date) {
return (
date.getFullYear() +
"-" +
this.padZero(date.getMonth() + 1) +
"-" +
this.padZero(date.getDate()) +
"T" +
this.padZero(date.getHours()) +
":" +
this.padZero(date.getMinutes()) +
":" +
this.padZero(date.getSeconds())
);
},
padZero(num) {
return num < 10 ? "0" + num : num;
},
handleQuery() {
let startTime = new Date(this.datetime);
this.queryParams.startTime = this.formatDateTime(startTime);
let endTime = startTime;
endTime.setHours(endTime.getHours() + 10);
this.queryParams.endTime = this.formatDateTime(endTime);
console.log("查询的参数:", this.queryParams);
this.getData(this.queryParams);
},
resetQuery() {
this.datetime = new Date();
},
getData(queryObj) {
this.chartLoading = true;
//
getBottomCylDataByDate(queryObj).then((response) => {
if (response.data == null) {
this.chartLoading = false;
this.isNoData = true;
} else {
this.isNoData = false;
this.initchart(response.data);
}
});
},
initchart(data) {
let p = new Promise((resolve) => {
resolve();
});
p.then(() => {
this.chart = echarts.init(this.$refs.chart);
let option = {
color: ["#637DCB"],
title: {
text: "",
right: "100",
textStyle: { fontWeight: "normal", color: "#637DCB" },
},
toolbox: {
top: 0,
itemSize: 13, // icon
iconStyle: {
color: "transparent",
borderColor: "#fff",
},
feature: {
dataZoom: {
yAxisIndex: "none",
},
restore: { show: false },
saveAsImage: { show: false },
},
},
tooltip: {
//
trigger: "axis",
axisPointer: {
type: "line", // line线 shadow
},
backgroundColor: "#fff",
extraCssText: "box-shadow: 4px 4px 4px 2px rgba(0, 0, 0, 0.2)", //
textStyle: {
color: "#4E5969", //
},
formatter: (prams) => {
let name = parseFloat(_.get(prams, [0, "name"])).toFixed(4);
let value = parseFloat(_.get(prams, [0, "value"])).toFixed(4);
return (
"<span style='color:#6D85CE'>" +
`${name}` +
"," +
`${value}` +
"</span>"
);
},
},
xAxis: [
{
type: "category",
name: "ms",
data: data.x,
nameTextStyle: { fontSize: "9" },
axisLine: {
show: true,
lineStyle: {
color: "#fff",
width: 0, //
},
},
axisLabel: {
textStyle: {
color: "#fff",
fontSize: "9",
},
showMaxLabel: true,
showMinLabel: true,
},
},
],
yAxis: [
{
name: "dB",
type: "value",
nameLocation: "end",
nameTextStyle: {
color: "#fff",
fontSize: "9",
},
axisLine: {
show: false,
},
axisTick: {
show: false,
},
axisLabel: {
interval: 0,
textStyle: {
fontSize: "9",
color: "#fff",
},
},
splitLine: {
//线
show: true, //
lineStyle: {
color: "#3C506B", //线
type: "dashed", //线dashed线
},
},
},
],
grid: {
left: "3%",
right: "8%",
bottom: "18%",
top: "14%",
containLabel: true,
},
dataZoom: [
{
show: true,
type: "slider",
xAxisIndex: 0,
filterMode: "none",
start: 0,
end: data.x.length,
bottom: "1%",
fillerColor: "rgba(167,183,204,0.4)", //
borderColor: "#3C506B",
},
{
show: true,
type: "inside",
xAxisIndex: 0,
filterMode: "none",
start: 0,
end: 10,
bottom: "1%",
fillerColor: "rgba(167,183,204,0.4)", //
borderColor: "#E0E6F3",
},
],
series: [
{
type: "line",
data: data.y,
symbol: "none",
},
],
};
this.chart.setOption(option);
this.chartLoading = false;
});
},
clicktest(event) {
console.log("点击:", event.target.outerText);
var selected = event.target.outerText;
this.dialogTitle = selected + "历史记录查询";
this.isOpen = true;
this.isNoData = true;
if ((selected = "软辊合辊压力")) {
this.queryParams.columnName = "driven_soft_bond_press";
}
},
test() {
listTopScollerData().then((response) => {
console.log("底缸数据:", response.data);
});
},
queryHistoryData() {
cydgdataHistory().then((response) => {
//