2D监控
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
package com.ruoyi.dynamicMonitoring.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.dynamicMonitoring.service.IDynamicMonitoringService;
|
||||
|
||||
/**
|
||||
* 大屏堆垛机数据Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/dynamicMonitoring/list")
|
||||
public class DynamicMonitoringController {
|
||||
@Autowired
|
||||
private IDynamicMonitoringService largeScreenDdjService;
|
||||
|
||||
/**
|
||||
* 查询堆垛机数据列表
|
||||
*/
|
||||
@GetMapping("/ddjList")
|
||||
public AjaxResult ddjList() {
|
||||
List<Map<String, Object>> list = largeScreenDdjService.queryDdjList();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询输送机数据列表
|
||||
*/
|
||||
@GetMapping("/ssjList")
|
||||
public AjaxResult ssjList() {
|
||||
List<Map<String, Object>> list = largeScreenDdjService.querySsjList();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询异常设备列表
|
||||
*/
|
||||
@GetMapping("/alarmList")
|
||||
public AjaxResult alarmList() {
|
||||
Map<String, Object> alarmData = largeScreenDdjService.queryAlarmList();
|
||||
AjaxResult result = new AjaxResult(200, "操作成功");
|
||||
result.put("alarm", alarmData.get("alarm"));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.ruoyi.dynamicMonitoring.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 大屏堆垛机数据Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface IDynamicMonitoringService {
|
||||
/**
|
||||
* 查询堆垛机数据列表
|
||||
*
|
||||
* @return 堆垛机数据列表
|
||||
*/
|
||||
public List<Map<String, Object>> queryDdjList();
|
||||
|
||||
/**
|
||||
* 查询输送机数据列表
|
||||
*
|
||||
* @return 输送机数据列表
|
||||
*/
|
||||
public List<Map<String, Object>> querySsjList();
|
||||
|
||||
/**
|
||||
* 查询异常设备列表
|
||||
*
|
||||
* @return 异常设备列表
|
||||
*/
|
||||
public Map<String, Object> queryAlarmList();
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.ruoyi.dynamicMonitoring.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.device.ddj.domain.MsgDdj;
|
||||
import com.ruoyi.device.ddj.mapper.MsgDdjMapper;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.device.ssj.mapper.DeviceSsjMapper;
|
||||
import com.ruoyi.dynamicMonitoring.service.IDynamicMonitoringService;
|
||||
|
||||
/**
|
||||
* 大屏堆垛机数据Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class DynamicMonitoringServiceImpl implements IDynamicMonitoringService {
|
||||
@Autowired
|
||||
private MsgDdjMapper msgDdjMapper;
|
||||
|
||||
@Autowired
|
||||
private DeviceSsjMapper deviceSsjMapper;
|
||||
|
||||
/**
|
||||
* 查询堆垛机数据列表
|
||||
*
|
||||
* @return 堆垛机数据列表
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> queryDdjList() {
|
||||
List<MsgDdj> ddjList = msgDdjMapper.selectMsgDdjList(null);
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
|
||||
for (MsgDdj ddj : ddjList) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", ddj.getId().toString());
|
||||
map.put("name", ddj.getName());
|
||||
map.put("zxjd", ddj.getJdbz().toString());
|
||||
map.put("sbzt", ddj.getSbzt().toString());
|
||||
map.put("rwh", ddj.getRwh().toString());
|
||||
map.put("yp", ddj.getYph().toString());
|
||||
map.put("ywz", ddj.getYlh().toString());
|
||||
map.put("yc", ddj.getYch().toString());
|
||||
map.put("mbp", ddj.getMbph().toString());
|
||||
map.put("mbwz", ddj.getMblh().toString());
|
||||
map.put("mbc", ddj.getMbch().toString());
|
||||
resultList.add(map);
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询输送机数据列表
|
||||
*
|
||||
* @return 输送机数据列表
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> querySsjList() {
|
||||
List<DeviceSsj> ssjList = deviceSsjMapper.selectDeviceSsjList(null);
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
|
||||
for (DeviceSsj ssj : ssjList) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", ssj.getDeviceCode());
|
||||
map.put("name", ssj.getName());
|
||||
map.put("kx", String.valueOf(ssj.getKx()));
|
||||
map.put("dw", String.valueOf(ssj.getDw()));
|
||||
map.put("rwh", String.valueOf(ssj.getTaskNo()));
|
||||
map.put("sbzt", ssj.getException());
|
||||
map.put("trayCode", ssj.getTrayCode());
|
||||
resultList.add(map);
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询异常设备列表
|
||||
*
|
||||
* @return 异常设备列表
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> queryAlarmList() {
|
||||
List<Map<String, Object>> alarmList = new ArrayList<>();
|
||||
|
||||
// 查询堆垛机状态异常的设备(状态码>1000)
|
||||
List<MsgDdj> ddjList = msgDdjMapper.selectMsgDdjList(null);
|
||||
for (MsgDdj ddj : ddjList) {
|
||||
if (ddj.getSbzt() != null && ddj.getSbzt() > 1000) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", ddj.getId().toString());
|
||||
map.put("name", "堆垛机");
|
||||
map.put("code", ddj.getSbzt().toString());
|
||||
map.put("content", null);
|
||||
alarmList.add(map);
|
||||
}
|
||||
}
|
||||
|
||||
// 查询输送机状态异常的设备(状态码>3)
|
||||
List<DeviceSsj> ssjList = deviceSsjMapper.selectDeviceSsjList(null);
|
||||
for (DeviceSsj ssj : ssjList) {
|
||||
if (ssj.getException() > 3) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", ssj.getDeviceCode());
|
||||
map.put("name", "输送机");
|
||||
map.put("code", String.valueOf(ssj.getException()));
|
||||
map.put("content", null);
|
||||
alarmList.add(map);
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("alarm", alarmList);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.ruoyi.largeScreen.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.largeScreen.service.ILargeScreenDdjService;
|
||||
|
||||
/**
|
||||
* 大屏堆垛机数据Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/largeScreen/ddj")
|
||||
public class LargeScreenDdjController {
|
||||
@Autowired
|
||||
private ILargeScreenDdjService largeScreenDdjService;
|
||||
|
||||
/**
|
||||
* 查询堆垛机数据列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list() {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("msg", "操作成功");
|
||||
result.put("code", 0);
|
||||
result.put("data", largeScreenDdjService.queryDdjList());
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.ruoyi.largeScreen.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 大屏堆垛机数据Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ILargeScreenDdjService {
|
||||
/**
|
||||
* 查询堆垛机数据列表
|
||||
*
|
||||
* @return 堆垛机数据列表
|
||||
*/
|
||||
public List<Map<String, Object>> queryDdjList();
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.ruoyi.largeScreen.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.device.ddj.domain.MsgDdj;
|
||||
import com.ruoyi.device.ddj.mapper.MsgDdjMapper;
|
||||
import com.ruoyi.largeScreen.service.ILargeScreenDdjService;
|
||||
|
||||
/**
|
||||
* 大屏堆垛机数据Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class LargeScreenDdjServiceImpl implements ILargeScreenDdjService {
|
||||
@Autowired
|
||||
private MsgDdjMapper msgDdjMapper;
|
||||
|
||||
/**
|
||||
* 查询堆垛机数据列表
|
||||
*
|
||||
* @return 堆垛机数据列表
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> queryDdjList() {
|
||||
List<MsgDdj> ddjList = msgDdjMapper.selectMsgDdjList(null);
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
|
||||
for (MsgDdj ddj : ddjList) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", ddj.getId().toString());
|
||||
map.put("name", ddj.getName());
|
||||
map.put("zxjd", ddj.getJdbz().toString());
|
||||
map.put("sbzt", ddj.getSbzt().toString());
|
||||
map.put("rwh", ddj.getRwh().toString());
|
||||
map.put("yp", ddj.getYph().toString());
|
||||
map.put("ywz", ddj.getYlh().toString());
|
||||
map.put("yc", ddj.getYch().toString());
|
||||
map.put("mbp", ddj.getMbph().toString());
|
||||
map.put("mbwz", ddj.getMblh().toString());
|
||||
map.put("mbc", ddj.getMbch().toString());
|
||||
resultList.add(map);
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
}
|
||||
@@ -19,10 +19,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="dw" column="dw" />
|
||||
<result property="trayCode" column="tray_code" />
|
||||
<result property="taskNo" column="task_no" />
|
||||
<result property="exception" column="exception" />
|
||||
<result property="traySize" column="tray_size" />
|
||||
<result property="allowPut" column="allow_put" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDeviceSsjVo">
|
||||
select id, device_code , name , type, ip_address, plc_db_read_address, is_active, create_time, plc_db_write_address, rkqq, kx, dw, tray_code, task_no from device_ssj
|
||||
select id, device_code , name , type, ip_address, plc_db_read_address, is_active, create_time, plc_db_write_address, rkqq, kx, dw, tray_code, task_no,exception,tray_size,allow_put from device_ssj
|
||||
</sql>
|
||||
|
||||
<select id="selectDeviceSsjList" parameterType="DeviceSsj" resultMap="DeviceSsjResult">
|
||||
@@ -40,6 +43,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="dw != null and dw != ''"> and dw = #{dw}</if>
|
||||
<if test="trayCode != null and trayCode != ''"> and tray_code = #{trayCode}</if>
|
||||
<if test="taskNo != null and taskNo != ''"> and task_no = #{taskNo}</if>
|
||||
<if test="exception != null and exception != ''"> and exception = #{exception}</if>
|
||||
<if test="traySize != null and traySize != ''"> and tray_size = #{traySize}</if>
|
||||
<if test="allowPut != null and allowPut != ''"> and allow_put = #{allowPut}</if>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user