فهرست منبع

实时大屏功能完善3

wangxiaofei 4 ماه پیش
والد
کامیت
186b70bbab
30فایلهای تغییر یافته به همراه932 افزوده شده و 391 حذف شده
  1. 10 2
      pom.xml
  2. 13 0
      taphole-camera/src/main/java/com.sckj.camera/model/bo/CameraBO.java
  3. 3 0
      taphole-camera/src/main/java/com.sckj.camera/model/entity/Camera.java
  4. 32 10
      taphole-camera/src/main/java/com.sckj.camera/service/CameraServiceImpl.java
  5. 5 0
      taphole-common/pom.xml
  6. 32 0
      taphole-common/src/main/java/com/sckj/common/util/ExcelUtils.java
  7. 111 88
      taphole-common/src/main/java/com/sckj/common/util/RedisUtils.java
  8. 4 0
      taphole-iron/pom.xml
  9. 0 79
      taphole-iron/src/main/java/com/sckj/iron/controller/IronVisualScreenController.java
  10. 18 6
      taphole-iron/src/main/java/com/sckj/iron/controller/TIronDataController.java
  11. 226 0
      taphole-iron/src/main/java/com/sckj/iron/controller/TIronVisualScreenController.java
  12. 9 0
      taphole-iron/src/main/java/com/sckj/iron/dto/CameraDTO.java
  13. 5 26
      taphole-iron/src/main/java/com/sckj/iron/dto/RealtimeData.java
  14. 1 1
      taphole-iron/src/main/java/com/sckj/iron/entity/TIronData.java
  15. 25 10
      taphole-iron/src/main/java/com/sckj/iron/entity/TIronParam.java
  16. 3 3
      taphole-iron/src/main/java/com/sckj/iron/entity/TIronStep.java
  17. 25 2
      taphole-iron/src/main/java/com/sckj/iron/entity/TL2Data.java
  18. 1 0
      taphole-iron/src/main/java/com/sckj/iron/mapper/TIronParamMapper.java
  19. 6 10
      taphole-iron/src/main/java/com/sckj/iron/service/impl/TIronParamServiceImpl.java
  20. 33 18
      taphole-iron/src/main/java/com/sckj/iron/service/impl/TL2DataServiceImpl.java
  21. 216 78
      taphole-iron/src/main/java/com/sckj/iron/socketio/DeviceEventListener.java
  22. 1 1
      taphole-iron/src/main/java/com/sckj/iron/socketio/IronRealtimeListener.java
  23. 22 3
      taphole-iron/src/main/java/com/sckj/iron/socketio/PushData.java
  24. 39 0
      taphole-iron/src/main/java/com/sckj/iron/validate/TIronDataSearchScreenValidate.java
  25. 28 16
      taphole-iron/src/main/java/com/sckj/iron/validate/TIronDataSearchValidate.java
  26. 23 15
      taphole-iron/src/main/java/com/sckj/iron/validate/TIronParamCreateValidate.java
  27. 15 6
      taphole-iron/src/main/java/com/sckj/iron/validate/TIronParamSearchValidate.java
  28. 23 14
      taphole-iron/src/main/java/com/sckj/iron/validate/TIronParamUpdateValidate.java
  29. 2 2
      taphole-iron/src/main/java/com/sckj/iron/vo/IronStepVO.java
  30. 1 1
      taphole-opc/src/main/java/com/sckj/opc/dto/L2Data.java

+ 10 - 2
pom.xml

@@ -49,7 +49,7 @@
         <oshi-core.version>6.1.2</oshi-core.version>
         <sa-token.version>1.32.0</sa-token.version>
         <sa-token-redis.version>1.32.0</sa-token-redis.version>
-        <easyexcel.version>3.1.3</easyexcel.version>
+        <easyexcel.version>3.3.4</easyexcel.version>
         <quartz-scheduler.version>2.3.2</quartz-scheduler.version>
 
         <qiniu.version>7.9.5</qiniu.version>
@@ -64,6 +64,7 @@
         <druid.version>1.2.23</druid.version>
 
         <milo.version>0.6.13</milo.version>
+        <fastexcel.version>1.1.0</fastexcel.version>
 
     </properties>
 
@@ -219,7 +220,7 @@
                 <version>${aliyun-java.version}</version>
             </dependency>
 
-            <!-- EasyExcel -->
+            <!-- EasyExcel-->
             <dependency>
                 <groupId>com.alibaba</groupId>
                 <artifactId>easyexcel</artifactId>
@@ -378,12 +379,19 @@
                 <artifactId>taphole-iron</artifactId>
                 <version>${taphole.version}</version>
             </dependency>
+
             <dependency>
                 <groupId>com.sckj</groupId>
                 <artifactId>taphole-opc</artifactId>
                 <version>${taphole.version}</version>
             </dependency>
 
+<!--            <dependency>-->
+<!--                <groupId>cn.idev.excel</groupId>-->
+<!--                <artifactId>fastexcel</artifactId>-->
+<!--                <version>${fastexcel.version}</version>-->
+<!--            </dependency>-->
+
         </dependencies>
     </dependencyManagement>
 

+ 13 - 0
taphole-camera/src/main/java/com.sckj.camera/model/bo/CameraBO.java

@@ -0,0 +1,13 @@
+package com.sckj.camera.model.bo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class CameraBO implements Serializable {
+    private static final long serialVersionUID = 1L;
+    private Long id;
+    private String status;
+    private Integer sort;
+}

+ 3 - 0
taphole-camera/src/main/java/com.sckj.camera/model/entity/Camera.java

@@ -70,4 +70,7 @@ public class Camera extends BaseEntity {
     //品牌 (1-海康,目前只有海康)
     private String brand;
 
+    //显示顺序
+    private Integer sort;
+
 }

+ 32 - 10
taphole-camera/src/main/java/com.sckj.camera/service/CameraServiceImpl.java

@@ -1,10 +1,12 @@
 package com.sckj.camera.service;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.sckj.camera.hik.HCNetTools;
 import com.sckj.camera.manager.CameraProperties;
 import com.sckj.camera.manager.HikCameraManager;
+import com.sckj.camera.model.bo.CameraBO;
 import com.sckj.camera.model.dto.CameraDTO;
 import com.sckj.camera.model.dto.ResultDTO;
 import com.sckj.camera.model.entity.Camera;
@@ -39,7 +41,6 @@ import java.util.List;
 import static com.sckj.common.util.ConfigUtils.set;
 
 @Service
-@Transactional
 public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> {
 
     private final Logger logger = LoggerFactory.getLogger(CameraServiceImpl.class);
@@ -68,7 +69,7 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> {
         updateById(camera);
     }
 
-    public AjaxResult enabledCameraMsg(){
+    public AjaxResult enabledCameraMsg() {
         String[] status = new String[]{"1", "2"};
         List<Camera> cameraList = baseMapper.selectList(
                 new QueryWrapper<Camera>().in("status", status).orderByDesc("id"));
@@ -80,12 +81,12 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> {
         return AjaxResult.success();
     }
 
-    public AjaxResult statusChange(Long id){
+    public AjaxResult statusChange(Long id) {
         Camera camera = baseMapper.selectOne(
                 new QueryWrapper<Camera>()
                         .eq("id", id)
                         .last("limit 1"));
-        if (camera == null){
+        if (camera == null) {
             return AjaxResult.failed("该相机不存在");
         }
         camera.setStatus(camera.getStatus().equals("1") ? "2" : "1");
@@ -120,7 +121,7 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> {
         logger.info("自动开启视频推送");
         QueryWrapper<Camera> queryWrapper = new QueryWrapper<>();
         //排除禁用的设备
-        queryWrapper.lambda().ne(Camera::getStatus, "0").eq(Camera::getType,"1");
+        queryWrapper.lambda().ne(Camera::getStatus, "0").eq(Camera::getType, "1");
 
         List<Camera> cameraList = list(queryWrapper);
         if (ObjectUtils.isEmpty(cameraList)) {
@@ -160,7 +161,7 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> {
      * @param rtspName
      * @return
      */
-    private ResultDTO pushStream(CameraDTO cameraDTO, String appName, String rtspName)   {
+    private ResultDTO pushStream(CameraDTO cameraDTO, String appName, String rtspName) {
         ResultDTO resultDTO = new ResultDTO();
         String rtmpUrl = "rtmp://" + cameraProperties.getRtmp().getRtmphost() + "/live/" + appName; //rtmp链
         String flvUrl = "http://" + cameraProperties.getRtmp().getHttphost() + "/live/" + appName + ".live.flv"; //live-flv链
@@ -219,7 +220,7 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> {
         String channelNumberStr = cameraDTO.getChannelNumber() + "02"; //新通道(2012年之后设备,02代表子码流)
         String rtspName = "rtsp://" + cameraDTO.getAccount() + ":" + cameraDTO.getPassword() + "@" + cameraDTO.getIp() + ":554/" + channelNumberStr + "?transportmode=unicast"; //新码流
         resultDTO.setRtspUrl(rtspName);
-        resultDTO.setWebrtcUrl("http://"+cameraProperties.getRtmp().getWebrtchost());
+        resultDTO.setWebrtcUrl("http://" + cameraProperties.getRtmp().getWebrtchost());
         return resultDTO;
     }
 
@@ -259,7 +260,7 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> {
             rtspName += cameraDTO.getVcr().getAccount() + ":" + cameraDTO.getVcr().getPassword() + "@" + cameraDTO.getVcr().getIp() + ":554/Streaming/tracks/" + channelNumberStr + "?starttime=" + startTime;
         }
         resultDTO.setRtspUrl(rtspName);
-        resultDTO.setWebrtcUrl("http://"+cameraProperties.getRtmp().getWebrtchost());
+        resultDTO.setWebrtcUrl("http://" + cameraProperties.getRtmp().getWebrtchost());
         return resultDTO;
     }
 
@@ -396,6 +397,7 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> {
         }
         return ffmpegService.stopTranscoding(taskName);
     }
+
     /**
      * 停止推流
      *
@@ -406,9 +408,9 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> {
             return false;
         }
         QueryWrapper<CameraFlow> queryWrapper = new QueryWrapper<>();
-        queryWrapper.lambda().likeLeft(CameraFlow::getTaskName,ip.replace(".",""));
+        queryWrapper.lambda().likeLeft(CameraFlow::getTaskName, ip.replace(".", ""));
         List<CameraFlow> list = flowService.list(queryWrapper);
-        if(ObjectUtils.isEmpty(list)){
+        if (ObjectUtils.isEmpty(list)) {
             return false;
         }
         return ffmpegService.stopTranscoding(list.get(0).getTaskName());
@@ -432,5 +434,25 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> {
 //        }
 //    }
 
+    @Transactional
+    public void updateBatchs(List<CameraBO> cameraList) {
+        for (CameraBO camera : cameraList) {
+            Camera queryData = getById(camera.getId());
+            if (ObjectUtils.isEmpty(queryData)) {
+                throw new OperateException(String.format("传入的ID不存在:%s", camera.getId()));
+            }
+
+            LambdaUpdateWrapper<Camera> wrapper = new LambdaUpdateWrapper<>();
+            wrapper.eq(Camera::getId, camera.getId());
+            if (ObjectUtils.isNotEmpty(camera.getStatus())) {
+                wrapper.set(Camera::getStatus, camera.getStatus());
+            }
+            if (camera.getSort() != null) {
+                wrapper.set(Camera::getSort, camera.getSort());
+            }
+            update(wrapper);
+        }
+    }
+
 
 }

+ 5 - 0
taphole-common/pom.xml

@@ -302,6 +302,11 @@
         </dependency>
         <!--   utgard   end   -->
 
+<!--        <dependency>-->
+<!--            <groupId>cn.idev.excel</groupId>-->
+<!--            <artifactId>fastexcel</artifactId>-->
+<!--        </dependency>-->
+
     </dependencies>
 
 </project>

+ 32 - 0
taphole-common/src/main/java/com/sckj/common/util/ExcelUtils.java

@@ -0,0 +1,32 @@
+package com.sckj.common.util;
+
+import com.alibaba.excel.EasyExcel;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.util.List;
+
+public class ExcelUtils {
+    /***
+     * 导出Excel
+     * @param data
+     * @param clazz
+     * @param sheetName
+     * @param fileName
+     * @param response
+     * @throws IOException
+     */
+    public static void exportExcel(List<?> data, Class<?> clazz, String sheetName, String fileName, HttpServletResponse response) throws IOException {
+        String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replace("+", "%20");
+        response.setContentType("application/vnd.ms-excel");
+        response.setCharacterEncoding("utf8");
+        response.setHeader("Content-disposition", "attachment;filename=" + encodedFileName);
+        ServletOutputStream outputStream = response.getOutputStream();
+        EasyExcel.write(outputStream, clazz)
+                .sheet(sheetName)
+                .doWrite(data);
+        outputStream.close();
+    }
+}

+ 111 - 88
taphole-common/src/main/java/com/sckj/common/util/RedisUtils.java

@@ -25,8 +25,8 @@ public class RedisUtils {
     /**
      * 注入Redis
      *
-     * @author fzr
      * @param redisTemplate Redis对象
+     * @author fzr
      */
     @Resource
     public void setRedisTemplate(RedisTemplate<String, Object> redisTemplate) {
@@ -36,8 +36,8 @@ public class RedisUtils {
     /**
      * 对象句柄
      *
-     * @author fzr
      * @return RedisTemplate
+     * @author fzr
      */
     public static RedisTemplate<String, Object> handler() {
         return redisTemplate;
@@ -46,9 +46,9 @@ public class RedisUtils {
     /**
      * 指定缓存失效时间
      *
-     * @author fzr
-     * @param key 键
+     * @param key    键
      * @param second 时间(秒)
+     * @author fzr
      */
     public static void expire(String key, Long second) {
         key = redisPrefix + key;
@@ -58,9 +58,9 @@ public class RedisUtils {
     /**
      * 指定缓存失效时间
      *
-     * @author fzr
-     * @param key 键
+     * @param key         键
      * @param millisecond 时间(毫秒)
+     * @author fzr
      */
     public static void pExpire(String key, Long millisecond) {
         key = redisPrefix + key;
@@ -70,8 +70,8 @@ public class RedisUtils {
     /**
      * 指定缓存永久有效
      *
-     * @author fzr
      * @param key 键
+     * @author fzr
      */
     public static void persist(String key) {
         key = redisPrefix + key;
@@ -81,9 +81,9 @@ public class RedisUtils {
     /**
      * 根据key获取过期时间
      *
-     * @author fzr
      * @param key 键不能为null
      * @return 返回0代表为永久有效(秒)
+     * @author fzr
      */
     public static Long ttl(String key) {
         key = redisPrefix + key;
@@ -93,9 +93,9 @@ public class RedisUtils {
     /**
      * 根据key获取过期时间
      *
-     * @author fzr
      * @param key 键不能为null
      * @return 返回0代表为永久有效(毫秒)
+     * @author fzr
      */
     public static Long pTtl(String key) {
         key = redisPrefix + key;
@@ -105,9 +105,9 @@ public class RedisUtils {
     /**
      * 判断key是否存在
      *
-     * @author fzr
      * @param key 键
      * @return true=存在,false=不存在
+     * @author fzr
      */
     public static Boolean exists(String key) {
         key = redisPrefix + key;
@@ -117,8 +117,8 @@ public class RedisUtils {
     /**
      * 删除1个或多个键
      *
-     * @author fzr
      * @param key 键(一个或多个)
+     * @author fzr
      */
     @SuppressWarnings("unchecked")
     public static void del(String... key) {
@@ -126,7 +126,7 @@ public class RedisUtils {
             key[0] = redisPrefix + key[0];
             redisTemplate.delete(key[0]);
         } else {
-            for (int i=0; key.length > i; i++) {
+            for (int i = 0; key.length > i; i++) {
                 key[i] = redisPrefix + key[i];
             }
             redisTemplate.delete((Collection<String>) CollectionUtils.arrayToList(key));
@@ -136,9 +136,9 @@ public class RedisUtils {
     /**
      * 给key赋值一个新的key名
      *
-     * @author fzr
      * @param oldKey 旧的key
      * @param newKey 新的key
+     * @author fzr
      */
     public static void rename(String oldKey, String newKey) {
         oldKey = redisPrefix + oldKey;
@@ -149,10 +149,10 @@ public class RedisUtils {
     /**
      * 将当前数据库的key移动到给定的数据库db当中
      *
-     * @author fzr
      * @param key 键
-     * @param db 库
+     * @param db  
      * @return Boolean
+     * @author fzr
      */
     public static Boolean move(String key, int db) {
         key = redisPrefix + key;
@@ -162,10 +162,10 @@ public class RedisUtils {
     /**
      * 获取匹配的key值
      *
-     * @author fzr
-     * @author fzr
      * @param pattern 通配符(*, ?, [])
      * @return Set
+     * @author fzr
+     * @author fzr
      */
     public static Set<String> keys(String pattern) {
         return redisTemplate.keys(pattern);
@@ -174,9 +174,9 @@ public class RedisUtils {
     /**
      * 随机返回一个key
      *
+     * @return String
      * @author fzr
      * @author fzr
-     * @return String
      */
     public static String randomKey() {
         return redisTemplate.randomKey();
@@ -187,9 +187,9 @@ public class RedisUtils {
     /**
      * 按匹配获取或有KEY
      *
-     * @author fzr
      * @param pattern 规则
      * @return Set<String>
+     * @author fzr
      */
     public static Set<String> matchSet(String pattern) {
         Set<String> keys = new LinkedHashSet<>();
@@ -215,9 +215,9 @@ public class RedisUtils {
     /**
      * 获取key的值
      *
-     * @author fzr
      * @param key 键
      * @return Object
+     * @author fzr
      */
     public static Object get(String key) {
         key = redisPrefix + key;
@@ -227,10 +227,10 @@ public class RedisUtils {
     /**
      * 获取旧值并设置新值
      *
-     * @author fzr
-     * @param key 键
+     * @param key    键
      * @param newVal 新值
      * @return Object
+     * @author fzr
      */
     public static Object getSet(String key, Object newVal) {
         key = redisPrefix + key;
@@ -240,9 +240,9 @@ public class RedisUtils {
     /**
      * 设置键值对
      *
-     * @author fzr
-     * @param key 键
+     * @param key   键
      * @param value 值
+     * @author fzr
      */
     public static void set(String key, Object value) {
         key = redisPrefix + key;
@@ -252,10 +252,10 @@ public class RedisUtils {
     /**
      * 设置键值对并设置时间
      *
-     * @author fzr
-     * @param key 键
+     * @param key   键
      * @param value 值
-     * @param time time要大于0 如果time小于等于0 将设置无限期
+     * @param time  time要大于0 如果time小于等于0 将设置无限期
+     * @author fzr
      */
     public static void set(String key, Object value, long time) {
         key = redisPrefix + key;
@@ -269,10 +269,10 @@ public class RedisUtils {
     /**
      * 递增
      *
-     * @author fzr
-     * @param key 键
+     * @param key   键
      * @param delta 要增加几(大于0)
      * @return Long
+     * @author fzr
      */
     public static Long incr(String key, long delta) {
         if (delta < 0) {
@@ -285,10 +285,10 @@ public class RedisUtils {
     /**
      * 递减
      *
-     * @author fzr
-     * @param key 键
+     * @param key   键
      * @param delta 要减少几(小于0)
      * @return Long
+     * @author fzr
      */
     public static Long decr(String key, long delta) {
         if (delta < 0) {
@@ -303,10 +303,10 @@ public class RedisUtils {
     /**
      * 获取key中field域的值
      *
-     * @author fzr
-     * @param key 键 不能为null
+     * @param key   键 不能为null
      * @param field 项 不能为null
      * @return 值
+     * @author fzr
      */
     public static Object hGet(String key, String field) {
         key = redisPrefix + key;
@@ -316,10 +316,10 @@ public class RedisUtils {
     /**
      * 判断key中有没有field域名
      *
-     * @author fzr
-     * @param key 键
+     * @param key   键
      * @param field 字段
      * @return Boolean
+     * @author fzr
      */
     public static Boolean hExists(String key, Object field) {
         key = redisPrefix + key;
@@ -329,9 +329,9 @@ public class RedisUtils {
     /**
      * 获取hashKey对应的所有键值
      *
-     * @author fzr
      * @param key 键
      * @return 对应的多个键值
+     * @author fzr
      */
     public Map<Object, Object> hmGet(String key) {
         key = redisPrefix + key;
@@ -341,9 +341,9 @@ public class RedisUtils {
     /**
      * 设置field1->N个域,对应的值是value1->N
      *
-     * @author fzr
      * @param key 键
      * @param map 对应多个键值
+     * @author fzr
      */
     public static void hmSet(String key, Map<String, Object> map) {
         key = redisPrefix + key;
@@ -353,10 +353,10 @@ public class RedisUtils {
     /**
      * HashSet 并设置时间
      *
-     * @author fzr
-     * @param key 键
-     * @param map 对应多个键值
+     * @param key  键
+     * @param map  对应多个键值
      * @param time 时间(秒)
+     * @author fzr
      */
     public static void hmSet(String key, Map<String, Object> map, long time) {
         key = redisPrefix + key;
@@ -369,10 +369,10 @@ public class RedisUtils {
     /**
      * 向一张hash表中放入数据,如果不存在将创建
      *
-     * @author fzr
-     * @param key 键
-     * @param item 项
+     * @param key   键
+     * @param item  项
      * @param value 值
+     * @author fzr
      */
     public static void hSet(String key, String item, Object value) {
         key = redisPrefix + key;
@@ -382,12 +382,12 @@ public class RedisUtils {
     /**
      * 向一张hash表中放入数据,如果不存在将创建
      *
-     * @author fzr
-     * @param key 键
-     * @param item 项
+     * @param key   键
+     * @param item  项
      * @param value 值
-     * @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间
+     * @param time  时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间
      * @return true 成功 false失败
+     * @author fzr
      */
     public static boolean hSet(String key, String item, Object value, long time) {
         key = redisPrefix + key;
@@ -401,9 +401,9 @@ public class RedisUtils {
     /**
      * 删除hash表中的值
      *
-     * @author fzr
-     * @param key 键 不能为null
+     * @param key  键 不能为null
      * @param item 项 可以使多个 不能为null
+     * @author fzr
      */
     public static void hDel(String key, Object... item) {
         key = redisPrefix + key;
@@ -413,10 +413,10 @@ public class RedisUtils {
     /**
      * 判断hash表中是否有该项的值
      *
-     * @author fzr
-     * @param key 键 不能为null
+     * @param key  键 不能为null
      * @param item 项 不能为null
      * @return true 存在 false不存在
+     * @author fzr
      */
     public static boolean hHasKey(String key, String item) {
         key = redisPrefix + key;
@@ -426,11 +426,11 @@ public class RedisUtils {
     /**
      * hash递增 如果不存在,就会创建一个并把新增后的值返回
      *
-     * @author fzr
-     * @param key 键
+     * @param key  键
      * @param item 项
-     * @param by 要增加几(大于0)
+     * @param by   要增加几(大于0)
      * @return double
+     * @author fzr
      */
     public static double hIncr(String key, String item, long by) {
         key = redisPrefix + key;
@@ -440,11 +440,11 @@ public class RedisUtils {
     /**
      * hash递减
      *
-     * @author fzr
-     * @param key 键
+     * @param key  键
      * @param item 项
-     * @param by 要减少记(小于0)
+     * @param by   要减少记(小于0)
      * @return double
+     * @author fzr
      */
     public static double hDecr(String key, String item, long by) {
         key = redisPrefix + key;
@@ -456,9 +456,9 @@ public class RedisUtils {
     /**
      * 根据key获取Set中的所有值
      *
-     * @author fzr
      * @param key 键
      * @return Set
+     * @author fzr
      */
     public static Set<Object> sGet(String key) {
         key = redisPrefix + key;
@@ -468,10 +468,10 @@ public class RedisUtils {
     /**
      * 根据value从一个set中查询,是否存在
      *
-     * @author fzr
-     * @param key 键
+     * @param key   键
      * @param value 值
      * @return true 存在 false不存在
+     * @author fzr
      */
     public Boolean sHasKey(String key, Object value) {
         key = redisPrefix + key;
@@ -481,10 +481,10 @@ public class RedisUtils {
     /**
      * 将数据放入set缓存
      *
-     * @author fzr
-     * @param key 键
+     * @param key    键
      * @param values 值 可以是多个
      * @return 成功个数
+     * @author fzr
      */
     public static Long sSet(String key, Object... values) {
         key = redisPrefix + key;
@@ -494,11 +494,11 @@ public class RedisUtils {
     /**
      * 将set数据放入缓存
      *
-     * @author fzr
-     * @param key 键
-     * @param time 时间(秒)
+     * @param key    键
+     * @param time   时间(秒)
      * @param values 值 可以是多个
      * @return 成功个数
+     * @author fzr
      */
     public Long sSetAndTime(String key, long time, Object... values) {
         key = redisPrefix + key;
@@ -508,9 +508,9 @@ public class RedisUtils {
     /**
      * 获取set缓存的长度
      *
-     * @author fzr
      * @param key 键
      * @return Long
+     * @author fzr
      */
     public Long sGetSetSize(String key) {
         key = redisPrefix + key;
@@ -520,10 +520,10 @@ public class RedisUtils {
     /**
      * 移除值为value的
      *
-     * @author fzr
-     * @param key 键
+     * @param key    键
      * @param values 值 可以是多个
      * @return 移除的个数
+     * @author fzr
      */
     public Long setRemove(String key, Object... values) {
         key = redisPrefix + key;
@@ -535,11 +535,11 @@ public class RedisUtils {
     /**
      * 获取list缓存的内容
      *
-     * @author fzr
-     * @param key 键
+     * @param key   键
      * @param start 开始
-     * @param end 结束 0 到 -1代表所有值
+     * @param end   结束 0 到 -1代表所有值
      * @return List
+     * @author fzr
      */
     public List<Object> lGet(String key, long start, long end) {
         key = redisPrefix + key;
@@ -549,9 +549,9 @@ public class RedisUtils {
     /**
      * 获取list缓存的长度
      *
-     * @author fzr
      * @param key 键
      * @return Long
+     * @author fzr
      */
     public Long lGetListSize(String key) {
         key = redisPrefix + key;
@@ -561,10 +561,10 @@ public class RedisUtils {
     /**
      * 通过索引获取list中的值
      *
-     * @author fzr
-     * @param key 键
+     * @param key   键
      * @param index 索引 index>=0时,0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推
      * @return Object
+     * @author fzr
      */
     public Object lGetIndex(String key, long index) {
         key = redisPrefix + key;
@@ -574,10 +574,10 @@ public class RedisUtils {
     /**
      * 将list放入缓存
      *
-     * @author fzr
-     * @param key 键
+     * @param key   键
      * @param value 值
      * @return boolean
+     * @author fzr
      */
     public boolean lSet(String key, Object value) {
         key = redisPrefix + key;
@@ -588,11 +588,11 @@ public class RedisUtils {
     /**
      * 将list放入缓存
      *
-     * @author fzr
-     * @param key 键
-     * @param value 值
+     * @param key    键
+     * @param value  值
      * @param second 时间(秒)
      * @return boolean
+     * @author fzr
      */
     public boolean lSet(String key, Object value, long second) {
         key = redisPrefix + key;
@@ -605,10 +605,10 @@ public class RedisUtils {
     /**
      * 将list放入缓存
      *
-     * @author fzr
-     * @param key 键
+     * @param key   键
      * @param value 值
      * @return boolean
+     * @author fzr
      */
     public boolean lSet(String key, List<Object> value) {
         key = redisPrefix + key;
@@ -619,11 +619,11 @@ public class RedisUtils {
     /**
      * 将list放入缓存
      *
-     * @author fzr
-     * @param key 键
+     * @param key   键
      * @param value 值
-     * @param time 时间(秒)
+     * @param time  时间(秒)
      * @return boolean
+     * @author fzr
      */
     public boolean lSet(String key, List<Object> value, Long time) {
         key = redisPrefix + key;
@@ -636,11 +636,11 @@ public class RedisUtils {
     /**
      * 根据索引修改list中的某条数据
      *
-     * @author fzr
-     * @param key 键
+     * @param key   键
      * @param index 索引
      * @param value 值
      * @return boolean
+     * @author fzr
      */
     public boolean lUpdateIndex(String key, Long index, Object value) {
         key = redisPrefix + key;
@@ -651,15 +651,38 @@ public class RedisUtils {
     /**
      * 移除N个值为value
      *
-     * @author fzr
-     * @param key 键
+     * @param key   键
      * @param count 移除多少个
      * @param value 值
      * @return 移除的个数
+     * @author fzr
      */
     public Long lRemove(String key, Long count, Object value) {
         key = redisPrefix + key;
         return redisTemplate.opsForList().remove(key, count, value);
     }
 
+    /***
+     * 添加指定数量的数据
+     * @param key
+     * @param element
+     * @param maxSize
+     */
+    public static void addFixedElement(String key, Object element, int maxSize) {
+        // 将新的对象数组添加到列表头部
+        redisTemplate.opsForList().leftPush(key, element);
+        // 修剪列表,只保留前 6 个元素
+        redisTemplate.opsForList().trim(key, 0, maxSize - 1);
+    }
+
+    /***
+     * 获取定数量的数据
+     * @param key
+     * @return
+     */
+    public static List<Object> getFixedElement(String key) {
+        // 获取列表中的所有元素
+        return redisTemplate.opsForList().range(key, 0, -1);
+    }
+
 }

+ 4 - 0
taphole-iron/pom.xml

@@ -30,6 +30,10 @@
             <groupId>com.sckj</groupId>
             <artifactId>taphole-opc</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.sckj</groupId>
+            <artifactId>taphole-camera</artifactId>
+        </dependency>
     </dependencies>
 
 </project>

+ 0 - 79
taphole-iron/src/main/java/com/sckj/iron/controller/IronVisualScreenController.java

@@ -1,79 +0,0 @@
-package com.sckj.iron.controller;
-
-import com.sckj.common.aop.NotLogin;
-import com.sckj.common.aop.NotPower;
-import com.sckj.common.core.AjaxResult;
-import com.sckj.iron.entity.TL2Data;
-import com.sckj.iron.service.impl.IronLoginServiceImpl;
-import com.sckj.iron.service.impl.TL2DataServiceImpl;
-import com.sckj.iron.validate.IronLoginValidate;
-import com.sckj.iron.vo.IronLoginVo;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
-/**
- * @Author feng
- * @Date 2024-11-18 上午 09:44
- * @Description 可视化大屏登录
- */
-@RestController
-@RequestMapping("api/visual/screen")
-@Api(tags = "可视化大屏")
-public class IronVisualScreenController {
-
-    @Resource
-    IronLoginServiceImpl ironLoginService;
-
-    @Resource
-    TL2DataServiceImpl tl2DataService;
-
-
-
-    @NotLogin
-    @PostMapping("/login")
-    @ApiOperation(value="登录系统")
-    public AjaxResult<IronLoginVo> login(@Validated() @RequestBody IronLoginValidate loginsValidate) {
-        IronLoginVo vo = ironLoginService.login(loginsValidate);
-        return AjaxResult.success(vo);
-    }
-
-    @NotPower
-    @PostMapping("/logout")
-    @ApiOperation(value="退出登录")
-    public AjaxResult<Object> logout(HttpServletRequest request) {
-        ironLoginService.logout(request.getHeader("token"));
-        return AjaxResult.success();
-    }
-
-
-
-    @NotLogin
-    @PostMapping("/getDeviceInfo")
-    @ApiOperation(value="获取设备信息")
-    public AjaxResult<Object> getDeviceInfo(String loginsValidate) {
-        String vo = ironLoginService.getDeviceInfo(loginsValidate);
-        return AjaxResult.success(vo);
-    }
-
-    //获取炼铁数据信息
-    @NotLogin
-    @PostMapping("/getMainElement")
-    @ApiOperation(value="获取设备信息")
-    public AjaxResult<Object> getMainElement(){
-        List<TL2Data> vo = tl2DataService.getLatest6Data();
-        return AjaxResult.success(vo);
-    }
-
-
-
-
-}

+ 18 - 6
taphole-iron/src/main/java/com/sckj/iron/controller/TIronDataController.java

@@ -6,8 +6,11 @@ import com.sckj.common.core.PageResult;
 import com.sckj.common.validate.commons.IdValidate;
 import com.sckj.common.validate.commons.PageValidate;
 import com.sckj.common.validator.annotation.IDMust;
+import com.sckj.iron.entity.TL2Data;
 import com.sckj.iron.service.impl.TIronDataServiceImpl;
+import com.sckj.iron.service.impl.TL2DataServiceImpl;
 import com.sckj.iron.validate.TIronDataCreateValidate;
+import com.sckj.iron.validate.TIronDataSearchScreenValidate;
 import com.sckj.iron.validate.TIronDataSearchValidate;
 import com.sckj.iron.vo.TIronDataDetailVo;
 import com.sckj.iron.vo.TIronDataListedVo;
@@ -27,16 +30,19 @@ public class TIronDataController {
     @Resource
     TIronDataServiceImpl iTIronDataService;
 
+    @Resource
+    TL2DataServiceImpl tl2DataService;
+
     @GetMapping("/list")
-    @ApiOperation(value="出铁数据列表")
+    @ApiOperation(value = "出铁数据列表")
     public AjaxResult<PageResult<TIronDataListedVo>> list(@Validated PageValidate pageValidate,
-                                                     @Validated TIronDataSearchValidate searchValidate) {
+                                                          @Validated TIronDataSearchValidate searchValidate) {
         PageResult<TIronDataListedVo> list = iTIronDataService.list(pageValidate, searchValidate);
         return AjaxResult.success(list);
     }
 
     @GetMapping("/detail")
-    @ApiOperation(value="出铁数据详情")
+    @ApiOperation(value = "出铁数据详情")
     public AjaxResult<TIronDataDetailVo> detail(@Validated @IDMust() @RequestParam("id") Integer id) {
         TIronDataDetailVo detail = iTIronDataService.detail(id);
         return AjaxResult.success(detail);
@@ -44,7 +50,7 @@ public class TIronDataController {
 
     @Log(title = "出铁数据新增")
     @PostMapping("/add")
-    @ApiOperation(value="出铁数据新增")
+    @ApiOperation(value = "出铁数据新增")
     public AjaxResult<Object> add(@Validated @RequestBody TIronDataCreateValidate createValidate) {
         iTIronDataService.add(createValidate);
         return AjaxResult.success();
@@ -52,7 +58,7 @@ public class TIronDataController {
 
     @Log(title = "出铁数据删除")
     @PostMapping("/del")
-    @ApiOperation(value="出铁数据删除")
+    @ApiOperation(value = "出铁数据删除")
     public AjaxResult<Object> del(@Validated @RequestBody IdValidate idValidate) {
         iTIronDataService.del(idValidate.getId());
         return AjaxResult.success();
@@ -60,9 +66,15 @@ public class TIronDataController {
 
     @Log(title = "出铁数据批量删除")
     @PostMapping("/del_ex")
-    @ApiOperation(value="出铁数据批量删除")
+    @ApiOperation(value = "出铁数据批量删除")
     public AjaxResult<Object> del_ex(@RequestBody List<Long> ids) {
         return iTIronDataService.del_ex(ids);
     }
 
+
+
+
+
+
+
 }

+ 226 - 0
taphole-iron/src/main/java/com/sckj/iron/controller/TIronVisualScreenController.java

@@ -0,0 +1,226 @@
+package com.sckj.iron.controller;
+
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.github.pagehelper.PageHelper;
+import com.sckj.camera.manager.CameraProperties;
+import com.sckj.camera.model.bo.CameraBO;
+import com.sckj.camera.model.entity.Camera;
+import com.sckj.camera.service.CameraServiceImpl;
+import com.sckj.common.aop.NotLogin;
+import com.sckj.common.aop.NotPower;
+import com.sckj.common.core.AjaxResult;
+import com.sckj.common.util.RedisUtils;
+import com.sckj.common.validate.commons.PageValidate;
+import com.sckj.iron.dto.CameraDTO;
+import com.sckj.iron.entity.TIronParam;
+import com.sckj.iron.entity.TL2Data;
+import com.sckj.iron.service.impl.IronLoginServiceImpl;
+import com.sckj.iron.service.impl.TIronParamServiceImpl;
+import com.sckj.iron.service.impl.TL2DataServiceImpl;
+import com.sckj.iron.socketio.DeviceEventListener;
+import com.sckj.iron.validate.IronLoginValidate;
+import com.sckj.iron.validate.TIronDataSearchScreenValidate;
+import com.sckj.iron.vo.IronLoginVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author feng
+ * @Date 2024-11-18 上午 09:44
+ * @Description 可视化大屏登录
+ */
+@RestController
+@RequestMapping("api/visualscreen")
+@Api(tags = "可视化大屏")
+public class TIronVisualScreenController {
+
+    @Resource
+    IronLoginServiceImpl ironLoginService;
+
+    @Resource
+    TL2DataServiceImpl tl2DataService;
+
+    @Resource
+    private CameraServiceImpl cameraService;
+
+    @Resource
+    TIronParamServiceImpl iTIronParamService;
+
+    @Resource
+    private CameraProperties cameraProperties;
+
+
+    @NotLogin
+    @PostMapping("/login")
+    @ApiOperation(value = "登录系统")
+    public AjaxResult<IronLoginVo> login(@Validated() @RequestBody IronLoginValidate loginsValidate) {
+        IronLoginVo vo = ironLoginService.login(loginsValidate);
+        return AjaxResult.success(vo);
+    }
+
+    @NotPower
+    @PostMapping("/logout")
+    @ApiOperation(value = "退出登录")
+    public AjaxResult<Object> logout(HttpServletRequest request) {
+        ironLoginService.logout(request.getHeader("token"));
+        return AjaxResult.success();
+    }
+
+
+    /***
+     * 从L2获取铁水成分数据
+     * @return
+     */
+    @NotLogin
+    @PostMapping("/getIronElement")
+    @ApiOperation(value = "获取铁水成分数据")
+    public AjaxResult getIronElement() {
+        List vo = RedisUtils.getFixedElement(DeviceEventListener.IRON_ELEMENT);
+        return AjaxResult.success(vo);
+    }
+
+    /***
+     * 获取铁水流速数据
+     * @return
+     */
+    @PostMapping("/getIronSpeed")
+    @ApiOperation(value = "获取铁水流速数据")
+    public AjaxResult getIronSpeed() {
+        List vo = RedisUtils.getFixedElement(DeviceEventListener.IRON_SPEED);
+        return AjaxResult.success(vo);
+    }
+
+    /***
+     * 获取铁流量数据
+     * @return
+     */
+    @PostMapping("/getIronWeight")
+    @ApiOperation(value = "获取铁流量数据")
+    public AjaxResult getIronWeight() {
+        List vo = RedisUtils.getFixedElement(DeviceEventListener.IRON_WEIGHT);
+        return AjaxResult.success(vo);
+    }
+
+    /***
+     * 获取铁水温度数据
+     * @return
+     */
+    @PostMapping("/getIronTemp")
+    @ApiOperation(value = "获取铁水温度数据")
+    public AjaxResult getIronTemp() {
+        List vo = RedisUtils.getFixedElement(DeviceEventListener.IRON_TEMP);
+        return AjaxResult.success(vo);
+    }
+
+
+    @PostMapping("/getIronData")
+    @ApiOperation(value = "查询出铁数据")
+    public AjaxResult queryIronData(@Validated PageValidate pageValidate, TIronDataSearchScreenValidate ironDataSearchScreenValidate) {
+        //出铁操作
+        TL2Data tl2Data = new TL2Data();
+        BeanUtils.copyProperties(ironDataSearchScreenValidate, tl2Data);
+        PageHelper.startPage(pageValidate.getPageNo(), pageValidate.getPageSize());
+        return AjaxResult.success(tl2DataService.queryIronData(tl2Data));
+    }
+
+
+    @PostMapping("/exportIronData")
+    @ApiOperation(value = "导出出铁数据")
+    public void exportIronData(TIronDataSearchScreenValidate ironDataSearchScreenValidate, HttpServletResponse response) throws IOException {
+        //出铁操作
+        TL2Data tl2Data = new TL2Data();
+        BeanUtils.copyProperties(ironDataSearchScreenValidate, tl2Data);
+        tl2DataService.exportIronData(tl2Data, response);
+    }
+
+    /**
+     * 摄像头登录
+     *
+     * @return
+     */
+    @ApiOperation("获取摄像头列表")
+    @PostMapping("/getCameraInfo")
+    public AjaxResult list() {
+        List<Camera> normalCameras = cameraService.lambdaQuery().eq(Camera::getStatus, "1").orderByAsc(Camera::getSort).list();
+        List<Camera> bannerCameras = cameraService.lambdaQuery().eq(Camera::getStatus, "2").orderByAsc(Camera::getSort).list();
+        TIronParam tIronParam = iTIronParamService.lambdaQuery().eq(TIronParam::getParamType, "cameraParam").eq(TIronParam::getParamName, "cameraPlayDuration").one();
+        Map<String, Object> map = new HashMap<>();
+        map.put("normalList", normalCameras);
+        map.put("bannerList", bannerCameras);
+        map.put("cameraPlayDuration", tIronParam.getParamValue());
+        return AjaxResult.success(map);
+    }
+
+    /**
+     * 摄像头登录
+     *
+     * @return
+     */
+    @ApiOperation("设置摄像头是否轮播、顺序")
+    @PostMapping("/updateCamera")
+    public AjaxResult updateCamera(@RequestBody List<CameraBO> cameraList) {
+        if (ObjectUtils.isEmpty(cameraList)) {
+            return AjaxResult.failed("传入的摄像头列表数据为空");
+        }
+        cameraService.updateBatchs(cameraList);
+        return AjaxResult.success();
+    }
+
+
+    /**
+     * 摄像头播放
+     *
+     * @param cameraId 相机信息ID
+     * @return ResultDTO
+     */
+    @ApiOperation("摄像头播放")
+    @PostMapping("/playCamera")
+    public AjaxResult playCamera(Long cameraId) {
+        Camera camera = cameraService.getById(cameraId);
+        if (ObjectUtils.isEmpty(camera)) {
+            return AjaxResult.failed("该摄像头不存在");
+        }
+        String channelNumberStr = 1 + "02"; //新通道(2012年之后设备,02代表子码流)
+        String rtspName = "rtsp://" + camera.getAccount() + ":" + camera.getPassword() + "@" + camera.getIp() + ":554/" + channelNumberStr + "?transportmode=unicast"; //新码流
+        String webrtcUrl = "http://" + cameraProperties.getRtmp().getWebrtchost();
+        CameraDTO cameraDTO = new CameraDTO();
+        cameraDTO.setRtmpUrl(webrtcUrl);
+        cameraDTO.setRtspUrl(rtspName);
+        return AjaxResult.success(cameraDTO);
+    }
+
+    /**
+     * 摄像头登录
+     *
+     * @return
+     */
+    @ApiOperation("设置摄像头轮播参数")
+    @PostMapping("/updateCameraParam")
+    public AjaxResult cameraParamUpdate(Integer cameraPlayDuration) {
+        try {
+            iTIronParamService.lambdaUpdate().eq(TIronParam::getParamType, "cameraParam").eq(TIronParam::getParamName, "cameraPlayDuration")
+                    .set(TIronParam::getParamValue, cameraPlayDuration).update();
+        } catch (Exception e) {
+            e.printStackTrace();
+            return AjaxResult.failed("失败");
+        }
+        return AjaxResult.success();
+    }
+
+
+}

+ 9 - 0
taphole-iron/src/main/java/com/sckj/iron/dto/CameraDTO.java

@@ -0,0 +1,9 @@
+package com.sckj.iron.dto;
+
+import lombok.Data;
+
+@Data
+public class CameraDTO {
+    private String rtspUrl;
+    private String rtmpUrl;
+}

+ 5 - 26
taphole-iron/src/main/java/com/sckj/iron/dto/RealtimeData.java

@@ -11,36 +11,15 @@ import org.springframework.stereotype.Component;
 @Data
 @Component
 public class RealtimeData {
-//    private Object ironSpeed;
-//
-//    private Object ironWeight;
-//
-//    private Object ironTemp;
-//
-//    private Object ironElement;
-//
-//
-//    //出铁状态
-//    private Object ironState;
-//
-//    //鱼雷罐车到位状态
-//    private Object ironSpeed1;
-//
-//    //拔炮状态
-//    private Object ironSpeed2;
-//
-//    //摆动溜咀
-//    private Object bdlzState;
-//
-//    //冲渣状态
-//    private Object czState;
-
-    private String key;
+
+//    private String key;
 
     private Object value;
 
-    private String desc;
+    private String unit;
 
+    private String desc;
 
+    private String time;
 
 }

+ 1 - 1
taphole-iron/src/main/java/com/sckj/iron/entity/TIronData.java

@@ -30,7 +30,7 @@ public class TIronData implements Serializable {
     private Date updateTime;
 
     @TableId(value="id", type= IdType.AUTO)
-    @ApiModelProperty(value = "")
+    @ApiModelProperty(value = "id")
     private Long id;
 
     @ApiModelProperty(value = "铁口编号")

+ 25 - 10
taphole-iron/src/main/java/com/sckj/iron/entity/TIronParam.java

@@ -34,19 +34,34 @@ public class TIronParam implements Serializable {
     @ApiModelProperty(value = "")
     private Long id;
 
-    @ApiModelProperty(value = "开口耗时(s)")
-    private BigDecimal kkhs;
+//    @ApiModelProperty(value = "开口耗时(s)")
+//    private BigDecimal openHours;
+//
+//    @ApiModelProperty(value = "出铁时间(s)")
+//    private BigDecimal ironTime;
+//
+//    @ApiModelProperty(value = "出铁量(t)")
+//    private BigDecimal ironWeight;
+//
+//    @ApiModelProperty(value = "出铁流速(t/s)")
+//    private BigDecimal ironSpeed;
+//
+//    @ApiModelProperty(value = "铁水温度变化(℃/s)")
+//    private BigDecimal ironwaterTemp;
 
-    @ApiModelProperty(value = "出铁时间(s)")
-    private BigDecimal ctsj;
+    @ApiModelProperty(value = "铁口区域编号")
+    private Long tapholeId;
 
-    @ApiModelProperty(value = "出铁量(t)")
-    private BigDecimal ctl;
+    @ApiModelProperty(value = "锅炉编号")
+    private Long boilerId;
 
-    @ApiModelProperty(value = "出铁流速(t/s)")
-    private BigDecimal ctls;
+    @ApiModelProperty(value = "参数类型")
+    private String paramType;
 
-    @ApiModelProperty(value = "铁水温度变化(℃/s)")
-    private BigDecimal tswdbh;
+    @ApiModelProperty(value = "参数名称")
+    private String paramName;
+
+    @ApiModelProperty(value = "参数值")
+    private String paramValue;
 
 }

+ 3 - 3
taphole-iron/src/main/java/com/sckj/iron/entity/TIronStep.java

@@ -41,9 +41,6 @@ public class TIronStep implements Serializable {
     @ApiModelProperty(value = "通过条件")
     private String stepCondition;
 
-    @ApiModelProperty(value = "下一步")
-    private String nextStep;
-
     @ApiModelProperty(value = "节点类型(start、end、node、child)")
     private String nodeType;
 
@@ -62,4 +59,7 @@ public class TIronStep implements Serializable {
     @ApiModelProperty(value = "订阅点名称(通道.设备.标识)")
     private String pointName;
 
+    @ApiModelProperty(value = "步骤名称表达式")
+    private String stepNameExpression;
+
 }

+ 25 - 2
taphole-iron/src/main/java/com/sckj/iron/entity/TL2Data.java

@@ -1,5 +1,7 @@
 package com.sckj.iron.entity;
 
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -18,67 +20,88 @@ public class TL2Data implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @ApiModelProperty(value = "创建时间")
+    @ExcelIgnore
     private Date createTime;
 
     @TableId(value="id", type= IdType.AUTO)
     @ApiModelProperty(value = "id")
+    @ExcelIgnore
     private Long id;
 
     @ApiModelProperty(value = "锅炉编号")
+    @ExcelIgnore
     private Long boilerId;
 
     @ApiModelProperty(value = "铁口区域编号")
+    @ExcelProperty("铁口区域编号")
     private Long tapholeId;
 
     @ApiModelProperty(value = "出铁次数编号")
+    @ExcelProperty("出铁次数编号")
     private String ironNo;
 
     @ApiModelProperty(value = "出铁时间")
+    @ExcelProperty("出铁时间")
     private String ironCosttime;
 
     @ApiModelProperty(value = "实际出铁量")
-    private double ironWeight;
+    @ExcelProperty("实际出铁量")
+    private Double ironWeight;
 
     @ApiModelProperty(value = "实际渣量")
+    @ExcelProperty("实际渣量")
     private String slagWeight;
 
     @ApiModelProperty(value = "铁水平均温度")
+    @ExcelIgnore
     private String avgTemp;
 
     @ApiModelProperty(value = "泥炮量")
+    @ExcelIgnore
     private String mudWeight;
 
     @ApiModelProperty(value = "钻杆直径")
+    @ExcelIgnore
     private String pollMm;
 
     @ApiModelProperty(value = "开口深度")
+    @ExcelIgnore
     private String openDepth;
 
     @ApiModelProperty(value = "上料总干量")
-    private double totalDry;
+    @ExcelIgnore
+    private Double totalDry;
 
     @ApiModelProperty(value = "开始时间")
+    @ExcelProperty("开始时间")
     private String ironStarttime;
 
+    @ExcelProperty("结束时间")
     @ApiModelProperty(value = "结束时间")
     private String ironEndtime;
 
 
     @ApiModelProperty(value = "碳")
+    @ExcelIgnore
     private String elementC;
 
+    @ExcelIgnore
     @ApiModelProperty(value = "硅")
     private String elementSi;
 
+    @ExcelIgnore
     @ApiModelProperty(value = "锰")
     private String elementMn;
 
+    @ExcelIgnore
     @ApiModelProperty(value = "磷")
     private String elementP;
 
+    @ExcelIgnore
     @ApiModelProperty(value = "硫")
     private String elementS;
 
+    @ExcelIgnore
     @ApiModelProperty(value = "钛")
     private String elementTi;
 

+ 1 - 0
taphole-iron/src/main/java/com/sckj/iron/mapper/TIronParamMapper.java

@@ -10,4 +10,5 @@ import org.apache.ibatis.annotations.Mapper;
  */
 @Mapper
 public interface TIronParamMapper extends IBaseMapper<TIronParam> {
+
 }

+ 6 - 10
taphole-iron/src/main/java/com/sckj/iron/service/impl/TIronParamServiceImpl.java

@@ -98,11 +98,9 @@ public class TIronParamServiceImpl extends ServiceImpl<TIronParamMapper, TIronPa
         TIronParam model = new TIronParam();
         model.setCreateTime(new Date(System.currentTimeMillis()));
         model.setCreateBy(String.valueOf(TapholeAdminThreadLocal.getAdminUsername()));
-        model.setKkhs(createValidate.getKkhs());
-        model.setCtsj(createValidate.getCtsj());
-        model.setCtl(createValidate.getCtl());
-        model.setCtls(createValidate.getCtls());
-        model.setTswdbh(createValidate.getTswdbh());
+        model.setParamType(createValidate.getParamType());
+        model.setParamName(createValidate.getParamName());
+        model.setParamValue(createValidate.getParamValue());
         tIronParamMapper.insert(model);
     }
 
@@ -122,11 +120,9 @@ public class TIronParamServiceImpl extends ServiceImpl<TIronParamMapper, TIronPa
 
         model.setUpdateBy(String.valueOf(TapholeAdminThreadLocal.getAdminUsername()));
         model.setUpdateTime(new Date(System.currentTimeMillis()));
-        model.setKkhs(updateValidate.getKkhs());
-        model.setCtsj(updateValidate.getCtsj());
-        model.setCtl(updateValidate.getCtl());
-        model.setCtls(updateValidate.getCtls());
-        model.setTswdbh(updateValidate.getTswdbh());
+        model.setParamType(updateValidate.getParamType());
+        model.setParamName(updateValidate.getParamName());
+        model.setParamValue(updateValidate.getParamValue());
         tIronParamMapper.updateById(model);
     }
 

+ 33 - 18
taphole-iron/src/main/java/com/sckj/iron/service/impl/TL2DataServiceImpl.java

@@ -2,29 +2,15 @@ package com.sckj.iron.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.sckj.common.TapholeAdminThreadLocal;
-import com.sckj.common.core.AjaxResult;
-import com.sckj.common.core.PageResult;
-import com.sckj.common.validate.commons.PageValidate;
-import com.sckj.iron.entity.TIronData;
+import com.sckj.common.util.ExcelUtils;
 import com.sckj.iron.entity.TL2Data;
-import com.sckj.iron.mapper.TIronDataMapper;
 import com.sckj.iron.mapper.TL2DataMapper;
-import com.sckj.iron.validate.TIronDataCreateValidate;
-import com.sckj.iron.validate.TIronDataSearchValidate;
-import com.sckj.iron.vo.TIronDataDetailVo;
-import com.sckj.iron.vo.TIronDataListedVo;
-import org.springframework.beans.BeanUtils;
+import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.stereotype.Service;
-import org.springframework.util.Assert;
-import org.springframework.util.CollectionUtils;
 
-import javax.annotation.Resource;
-import java.util.Date;
-import java.util.LinkedList;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
 import java.util.List;
 
 /**
@@ -58,5 +44,34 @@ public class TL2DataServiceImpl extends ServiceImpl<TL2DataMapper, TL2Data> {
         return list;
     }
 
+    /***
+     * 获取最新6条数据
+     * @return
+     */
+    public List<TL2Data> queryIronData(TL2Data tl2Data) {
+        QueryWrapper<TL2Data> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda()
+                .eq(ObjectUtils.isNotEmpty(tl2Data.getSlagWeight()), TL2Data::getSlagWeight, tl2Data.getSlagWeight())
+                .eq(ObjectUtils.isNotEmpty(tl2Data.getIronWeight()), TL2Data::getIronWeight, tl2Data.getIronWeight())
+                .eq(ObjectUtils.isNotEmpty(tl2Data.getIronCosttime()), TL2Data::getIronCosttime, tl2Data.getIronCosttime())
+                .eq(ObjectUtils.isNotEmpty(tl2Data.getIronNo()), TL2Data::getIronNo, tl2Data.getIronNo())
+                .eq(ObjectUtils.isNotEmpty(tl2Data.getIronStarttime()), TL2Data::getIronStarttime, tl2Data.getIronStarttime())
+                .eq(ObjectUtils.isNotEmpty(tl2Data.getIronEndtime()), TL2Data::getIronEndtime, tl2Data.getIronEndtime())
+                .eq(ObjectUtils.isNotEmpty(tl2Data.getTapholeId()), TL2Data::getTapholeId, tl2Data.getTapholeId())
+        ;
+        return list(queryWrapper);
+    }
+
+    /***
+     * 导出数据
+     * @param tl2Data
+     * @param response
+     * @throws IOException
+     */
+    public void exportIronData(TL2Data tl2Data, HttpServletResponse response)  throws IOException {
+        List<TL2Data> tl2DataList = queryIronData(tl2Data);
+        ExcelUtils.exportExcel(tl2DataList,TL2Data.class,"出铁数据","出铁数据",response);
+    }
+
 
 }

+ 216 - 78
taphole-iron/src/main/java/com/sckj/iron/socketio/DeviceEventListener.java

@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.corundumstudio.socketio.SocketIOClient;
 import com.corundumstudio.socketio.annotation.OnEvent;
 import com.google.common.eventbus.Subscribe;
+import com.sckj.common.core.AjaxResult;
 import com.sckj.common.eventbus.EventListener;
 import com.sckj.common.socketio.SocketUtil;
+import com.sckj.common.util.RedisUtils;
 import com.sckj.iron.dto.IronStepDTO;
 import com.sckj.iron.dto.RealtimeData;
 import com.sckj.iron.dto.TrendData;
@@ -17,11 +19,13 @@ import com.sckj.iron.vo.IronStepVO;
 import com.sckj.opc.dto.L2Data;
 import com.sckj.opc.entity.OPCData;
 import com.sckj.opc.opcua.L2DataServiceImpl;
+import com.sckj.opc.service.OPCDataServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.expression.spel.standard.SpelExpressionParser;
 import org.springframework.expression.spel.support.StandardEvaluationContext;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.PostConstruct;
@@ -66,20 +70,30 @@ public class DeviceEventListener extends EventListener {
     @Resource
     private L2DataServiceImpl l2DataServiceImpl;
 
+    @Resource
+    OPCDataServiceImpl opcDataService;
+
     //实时数据
-    Map<String, Object> realtimeDataMap = new HashMap<>();
+    Map<String, Object> mRealtimeData = new HashMap<>();
+
+    //实时状态
+    Map<String, Object> mRealtimeStatus = new HashMap<>();
 
 
     @Resource
     TrendData trendData;
 
+    //L1
+    private OPCData mOPCData;
+
+    //L2
     private L2Data mL2Data;
 
     // 1.创建表达式解析器
     private SpelExpressionParser parser = new SpelExpressionParser();
 
     // 2.创建变量上下文,设置变量
-    private StandardEvaluationContext ctx = new StandardEvaluationContext();
+    private StandardEvaluationContext mContext = new StandardEvaluationContext();
 
     //出铁步骤
     private List<IronStepVO> mSteps;
@@ -91,16 +105,29 @@ public class DeviceEventListener extends EventListener {
 
     //是否出铁中
     //1 出铁中    0 出铁结束
-    private boolean ironLoading = false;
-
-    private OPCData mOPCData;
-
-    //1号出铁标记
-    private static final String TAG_IRON_OPERATE1 = "AOD25606.PV";
-
+    private boolean ironLoading1 = false;
+    private boolean ironLoading2 = false;
+    private boolean ironLoading3 = false;
+    private boolean ironLoading4 = false;
+
+    //1号出铁状态标记
+    private static final String TAG_TAPHOLE1_STATUS = "AOD25606.PV";
+    //2号出铁状态标记
+    private static final String TAG_TAPHOLE2_STATUS = "AOD25622.PV";
+    //3号出铁状态标记
+    private static final String TAG_TAPHOLE3_STATUS = "AOD25706.PV";
+    //4号出铁状态标记
+    private static final String TAG_TAPHOLE4_STATUS = "AOD25722.PV";
     //铁水温度
     private static final String TAG_IRON_TEMP = "CL510104.CPV";
-
+    //1TH-1号车受铁速度
+    private static final String TAG_CAR11 = "WZ540101.PV";
+    //1TH-2号车受铁速度
+    private static final String TAG_CAR12 = "WZ540201.PV";
+    //1TH-1号车总重
+    private static final String TAG_IRON_WEIGHT11 = "WI5401.PV";
+    //1TH-2号车TPC总重
+    private static final String TAG_IRON_WEIGHT12 = "WI5402.PV";
 
     //预判和确认出铁
     private static final String ypqrct = "lnct";
@@ -108,15 +135,34 @@ public class DeviceEventListener extends EventListener {
     //铁量差计算
     private static final String tlc = "tlc";
 
-    //1TH-1号车受铁速度
-    private static final String TAG_CAR1 = "WZ540101.PV";
-    //1TH-2号车受铁速度
-    private static final String TAG_CAR2 = "WZ540201.PV";
+    //最近任一铁口出铁结束时间
+    private Date lastIronEndTimeRecently;
+
+    @Resource(name = "taskExecutor")
+    ThreadPoolTaskExecutor taskExecutor;
+
+    //铁水成分
+    public static final String IRON_ELEMENT = "ironElement";
+    //铁水温度
+    public static final String IRON_TEMP = "ironTemp";
+    //铁水流速
+    public static final String IRON_SPEED = "ironSpeed";
+    //重量
+    public static final String IRON_WEIGHT = "ironWeight";
+    //出铁状态
+    private static final String IRON_STATUS = "ironStatus";
+
+    //鱼雷罐车
+    private static final String CAR_STATUS = "ylgc";
+    //拔炮
+    private static final String GUN_STATUS = "npkkj";
+    //摆动溜咀
+    private static final String MOUTH_STATUS = "bdlz";
+    //冲渣状态
+    private static final String FLUSH_STATUS = "flushStatus";
+    //预计出铁结束时间
+    private static final String PLAN_END_TIME = "planEndTime";
 
-    //1TH-1号车总重
-    private static final String TAG_IRON_WEIGHT1 = "WI5401.PV";
-    //1TH-2号车TPC总重
-    private static final String TAG_IRON_WEIGHT2 = "WI5402.PV";
 
     @PostConstruct
     public void init() {
@@ -133,6 +179,8 @@ public class DeviceEventListener extends EventListener {
             return;
         }
         this.mOPCData = opcData;
+        //异步保存OPC数据
+        taskExecutor.submit(() -> opcDataService.save(mOPCData));
         //出铁操作
         operate();
 
@@ -141,6 +189,7 @@ public class DeviceEventListener extends EventListener {
 
         //实时数据
         realtime();
+
     }
 
     /***
@@ -162,6 +211,9 @@ public class DeviceEventListener extends EventListener {
         //将L2实时数据保存到数据库
         tl2DataService.saveOrUpdate(tl2Data);
 
+        //将L2实时数据保存到Redis
+        RedisUtils.addFixedElement(IRON_ELEMENT, l2Data, 6);
+
         for (IronStepVO stepDTO : mSteps) {
             if (NODE.equalsIgnoreCase(stepDTO.getNodeType())) {
                 //处理子项
@@ -225,6 +277,7 @@ public class DeviceEventListener extends EventListener {
 
     }
 
+
     //实时数据显示
     private void realtime() {
         //铁水温度
@@ -236,90 +289,124 @@ public class DeviceEventListener extends EventListener {
         if (ObjectUtils.isNotEmpty(mOPCData)) {
             if (mOPCData.getPointName().contains(TAG_IRON_TEMP)) {
                 RealtimeData realtimeData = new RealtimeData();
-                realtimeData.setValue(mOPCData.getData() + "℃");
+                realtimeData.setValue(mOPCData.getData());
+                realtimeData.setUnit("℃");
                 realtimeData.setDesc("铁水温度");
-                realtimeDataMap.put("ironTemp", realtimeData);
+                realtimeData.setTime(mOPCData.getServerTime().toString());
+                mRealtimeData.put(IRON_TEMP, realtimeData);
+                //redis添加数据
+                RedisUtils.addFixedElement(IRON_TEMP, realtimeData, 6);
             }
 
-            if (mOPCData.getPointName().contains(TAG_CAR1) || mOPCData.getPointName().contains(TAG_CAR2)) {
+            if (mOPCData.getPointName().contains(TAG_CAR11) || mOPCData.getPointName().contains(TAG_CAR12)) {
 //            1TH-1号车受铁速度
                 RealtimeData realtimeData = new RealtimeData();
-                realtimeData.setValue(mOPCData.getData() + "t/s");
+                realtimeData.setValue(mOPCData.getData());
+                realtimeData.setUnit("t/s");
 
-                RealtimeData ironSpeed = (RealtimeData) realtimeDataMap.get("ironSpeed");
+                RealtimeData ironSpeed = (RealtimeData) mRealtimeData.get(IRON_SPEED);
                 RealtimeData[] speeds = null;
                 if (ObjectUtils.isEmpty(ironSpeed)) {
                     ironSpeed = new RealtimeData();
                     ironSpeed.setDesc("铁水流速");
                     speeds = new RealtimeData[2];
                     ironSpeed.setValue(speeds);
-                    realtimeDataMap.put("ironSpeed", ironSpeed);
+                    mRealtimeData.put(IRON_SPEED, ironSpeed);
                 } else {
                     speeds = (RealtimeData[]) ironSpeed.getValue();
                 }
 
-                if (mOPCData.getPointName().contains(TAG_CAR1)) {
+                if (mOPCData.getPointName().contains(TAG_CAR11)) {
                     realtimeData.setDesc("1号车");
                     speeds[0] = realtimeData;
                 } else {
                     realtimeData.setDesc("2号车");
                     speeds[1] = realtimeData;
                 }
-//                ironSpeed.setValue(speeds);
-//                realtimeDataMap.put("ironSpeed", ironSpeed);
+
+                //只在两个都有数据的时候才添加
+                if (ObjectUtils.isNotEmpty(speeds)
+                        && ObjectUtils.isNotEmpty(speeds[0]) && ObjectUtils.isNotEmpty(speeds[0].getValue())
+                        && ObjectUtils.isNotEmpty(speeds[1]) && ObjectUtils.isNotEmpty(speeds[1].getValue())
+                ) {
+                    ironSpeed.setTime(mOPCData.getServerTime().toString());
+                    RedisUtils.addFixedElement(IRON_SPEED, ironSpeed, 6);
+                }
             }
 
-            if (mOPCData.getPointName().contains(TAG_IRON_WEIGHT1) || mOPCData.getPointName().contains(TAG_IRON_WEIGHT2)) {
+            if (mOPCData.getPointName().contains(TAG_IRON_WEIGHT11) || mOPCData.getPointName().contains(TAG_IRON_WEIGHT12)) {
 //              铁水流量
-                RealtimeData ironWeight = (RealtimeData) realtimeDataMap.get("ironWeight");
+                RealtimeData ironWeight = (RealtimeData) mRealtimeData.get(IRON_WEIGHT);
                 if (ObjectUtils.isEmpty(ironWeight)) {
                     ironWeight = new RealtimeData();
                     ironWeight.setDesc("铁水流量");
+                    ironWeight.setUnit("t");
                     ironWeight.setValue(new BigDecimal(String.valueOf(mOPCData.getData())));
-                    realtimeDataMap.put("ironWeight", ironWeight);
+                    mRealtimeData.put(IRON_WEIGHT, ironWeight);
+
+                    ironWeight.setTime(mOPCData.getServerTime().toString());
+                    RedisUtils.addFixedElement(IRON_WEIGHT, ironWeight, 6);
                 } else {
                     BigDecimal bigDecimalOld = ((BigDecimal) ironWeight.getValue());
                     BigDecimal bigDecimalNew = new BigDecimal(mOPCData.getData().toString());
                     BigDecimal add = bigDecimalOld.add(bigDecimalNew);
                     ironWeight.setValue(add);
+
+                    ironWeight.setTime(mOPCData.getServerTime().toString());
+                    RedisUtils.addFixedElement(IRON_WEIGHT, ironWeight, 6);
                 }
             }
 
-            if (mOPCData.getPointName().contains(TAG_IRON_OPERATE1)) {
+
+            if (mOPCData.getPointName().contains(TAG_TAPHOLE1_STATUS)) {
                 RealtimeData realtimeData = new RealtimeData();
                 realtimeData.setValue(mOPCData.getData());
                 realtimeData.setDesc("出铁状态");
-                realtimeDataMap.put("ctzt", realtimeData);
+                mRealtimeStatus.put(IRON_STATUS, realtimeData);
             }
 
-            if (mOPCData.getPointName().contains(TAG_IRON_OPERATE1)) {
+//            if (mOPCData.getPointName().contains(CAR_STATUS)) {
+//                RealtimeData realtimeData = new RealtimeData();
+//                realtimeData.setValue(mOPCData.getData());
+//                realtimeData.setDesc("鱼雷罐车到位状态");
+//                mRealtimeDataMap.put(CAR_STATUS, realtimeData);
+//            }
+
+
+//            if (mOPCData.getPointName().contains(TAG_IRON_STATUS1)) {
+//                RealtimeData realtimeData = new RealtimeData();
+//                realtimeData.setValue(mOPCData.getData());
+//                realtimeData.setDesc("拔炮状态");
+//                mRealtimeDataMap.put(GUN_STATUS, realtimeData);
+//            }
+//
+//
+//            if (mOPCData.getPointName().contains(TAG_IRON_STATUS1)) {
+//                RealtimeData realtimeData = new RealtimeData();
+//                realtimeData.setValue(mOPCData.getData());
+//                realtimeData.setDesc("摆动溜咀");
+//                mRealtimeDataMap.put(MOUTH_STATUS, realtimeData);
+//            }
+
+            if (mOPCData.getPointName().contains(FLUSH_STATUS)) {
                 RealtimeData realtimeData = new RealtimeData();
                 realtimeData.setValue(mOPCData.getData());
-                realtimeData.setDesc("鱼雷罐车到位状态");
-                realtimeDataMap.put("ylgc", realtimeData);
+                realtimeData.setDesc("冲渣状态");
+                mRealtimeStatus.put(FLUSH_STATUS, realtimeData);
             }
 
-
-            if (mOPCData.getPointName().contains(TAG_IRON_OPERATE1)) {
+            if (mOPCData.getPointName().contains(PLAN_END_TIME)) {
                 RealtimeData realtimeData = new RealtimeData();
                 realtimeData.setValue(mOPCData.getData());
-                realtimeData.setDesc("拔炮状态");
-                realtimeDataMap.put("bpzt", realtimeData);
+                realtimeData.setDesc("预计出铁结束时间");
+                mRealtimeData.put(PLAN_END_TIME, realtimeData);
             }
 
 
-            if (mOPCData.getPointName().contains(TAG_IRON_OPERATE1)) {
-                RealtimeData realtimeData = new RealtimeData();
-                realtimeData.setValue(mOPCData.getData());
-                realtimeData.setDesc("摆动溜咀");
-                realtimeDataMap.put("bdlz", realtimeData);
-            }
-
-            if (mOPCData.getPointName().contains(TAG_IRON_OPERATE1)) {
-                RealtimeData realtimeData = new RealtimeData();
-                realtimeData.setValue(mOPCData.getData());
-                realtimeData.setDesc("冲渣状态");
-                realtimeDataMap.put("czzt", realtimeData);
+            float yc = Float.valueOf(ObjectUtils.defaultIfNull(mContext.lookupVariable("yc"), "0").toString());
+            if (yc > 190) {
+                log.info("预警出铁");
+                PushData.send2Warn(AjaxResult.success("预警出铁"));
             }
 
         }
@@ -331,12 +418,14 @@ public class DeviceEventListener extends EventListener {
             String elementS = mL2Data.getElementS();
 
             RealtimeData realtimeData = new RealtimeData();
-            realtimeData.setValue(elementSi + "%");
+            realtimeData.setValue(elementSi);
+            realtimeData.setUnit("%");
             realtimeData.setDesc("硅");
 
             RealtimeData realtimeData2 = new RealtimeData();
-            realtimeData.setValue(elementS + "%");
-            realtimeData.setDesc("硫");
+            realtimeData2.setValue(elementS);
+            realtimeData2.setUnit("%");
+            realtimeData2.setDesc("硫");
 
             List<RealtimeData> realtimeDataList = new ArrayList<>();
             realtimeDataList.add(realtimeData);
@@ -344,15 +433,15 @@ public class DeviceEventListener extends EventListener {
 
             RealtimeData realtimeData3 = new RealtimeData();
             realtimeData3.setValue(realtimeDataList);
-            realtimeData2.setDesc("铁水成分");
+            realtimeData3.setDesc("铁水成分");
 
-            realtimeDataMap.put("ironElement", realtimeData3);
+            mRealtimeData.put(IRON_ELEMENT, realtimeData3);
         }
 
-
-        log.info("实时数据:{}", realtimeDataMap);
-
-        PushData.send2Realtime(realtimeDataMap);
+        //推送实时数据
+        PushData.send2RealtimeData(mRealtimeData);
+        //推送实时状态
+        PushData.send2RealtimeStatus(mRealtimeStatus);
 
     }
 
@@ -411,7 +500,7 @@ public class DeviceEventListener extends EventListener {
         ironReady();
 
 
-        PushData.send2Operation(mSteps, ironLoading);
+        PushData.send2Operation(mSteps, ironLoading1);
 
     }
 
@@ -490,13 +579,25 @@ public class DeviceEventListener extends EventListener {
         //根据PLC订阅的数据,AOD25606.PV=1为出铁中,AOD25606.PV=0出铁结束的信号,进行判断
         //为1表示开始出铁,此时如果未超过10分钟,就取消定时器
         //出铁结束
-        if (mOPCData.getPointName().contains(TAG_IRON_OPERATE1)) {
-
+        if (mOPCData.getPointName().contains(TAG_TAPHOLE1_STATUS)) {
             //1:出铁中
             //0:出铁结束
-            ironLoading = "1".equals(mOPCData.getData());
+            ironLoading1 = "1".equals(mOPCData.getData());
+
+            if ("1".equals(mOPCData.getData())) {
+                //由 0 -> 1
+                //表明1号铁口正在出铁
+                //根据理论铁量、实时铁水流速,推测距离出铁结束的剩余时间
+                //剩余时间=总时间-已经流去的时间
+//                mContext.lookupVariable("");
+                //计算理论铁量= 矿批 × 综合品位 × 1.06,其中矿批是指L2中的干量
+
+//                Date ironTime = mOPCData.getServerTime();
+//                lastIronEndTimeRecently
 
-            if ("0".equals(mOPCData.getData())) {
+
+            } else if ("0".equals(mOPCData.getData())) {
+                //由 1-> 0
                 try {
                     timer.cancel(); // 终止定时器
                 } catch (Exception e) {
@@ -509,7 +610,18 @@ public class DeviceEventListener extends EventListener {
                 LambdaQueryWrapper<TIronData> queryWrapper = new QueryWrapper<TIronData>().lambda().orderByDesc(TIronData::getCtcsbh);
                 List<TIronData> oldIronDataList = ironDataService.list(queryWrapper);
             }
+
+        }
+
+
+        if (mOPCData.getPointName().contains(TAG_TAPHOLE1_STATUS)
+                || mOPCData.getPointName().contains(TAG_TAPHOLE2_STATUS)
+                || mOPCData.getPointName().contains(TAG_TAPHOLE3_STATUS)
+                || mOPCData.getPointName().contains(TAG_TAPHOLE4_STATUS)
+        ) {
+            lastIronEndTimeRecently = mOPCData.getServerTime();
         }
+
     }
 
     /***
@@ -518,21 +630,21 @@ public class DeviceEventListener extends EventListener {
      */
     private void validateStepPass(IronStepVO stepVO) {
         //根据唯一名称设置环境变量
-        ctx.setVariable(stepVO.getIdentifier(), stepVO.getData());
-        String flowName = stepVO.getStepName();
+        mContext.setVariable(stepVO.getIdentifier(), stepVO.getData());
+        String flowName = "";
         try {
             if ("calc".equalsIgnoreCase(stepVO.getNodeType())) {
-                flowName = parser.parseExpression(flowName).getValue(ctx, String.class);
+                flowName = parser.parseExpression(stepVO.getStepNameExpression()).getValue(mContext, String.class);
             } else {
-                flowName = parser.parseExpression("'" + flowName + "'").getValue(ctx, String.class);
+                flowName = parser.parseExpression("'" + stepVO.getStepName() + "'").getValue(mContext, String.class);
             }
-            stepVO.setFlowName(flowName);
+            stepVO.setStepName(flowName);
         } catch (Exception e) {
-            log.error("stepName:{},flowName:{}", stepVO.getStepName(),flowName);
+            log.error("stepId:{},identifier:{},stepName:{}", stepVO.getStepId(), stepVO.getIdentifier(), flowName);
         }
 
         //非流程必须项,直接放行
-        if ("0".equals(stepVO.getIdentifier())) {
+        if ("0".equals(stepVO.getRequired())) {
             stepVO.setPassResult(1);
             return;
         }
@@ -540,7 +652,7 @@ public class DeviceEventListener extends EventListener {
         if (ObjectUtils.isNotEmpty(stepVO.getStepCondition())) {
             boolean result = false;
             try {
-                result = parser.parseExpression(stepVO.getStepCondition()).getValue(ctx, Boolean.class);
+                result = parser.parseExpression(stepVO.getStepCondition()).getValue(mContext, Boolean.class);
             } catch (Exception e) {
                 result = false;
             }
@@ -583,23 +695,49 @@ public class DeviceEventListener extends EventListener {
         log.info("--->userId : {}", userId);
         for (IronStepVO stepDTO : mSteps) {
             for (IronStepVO child : stepDTO.getChilds()) {
-                if (validateUserData(message, userId, child)) {
+                if (validateManualData(message, userId, child)) {
                     return;
                 }
             }
-            if (validateUserData(message, userId, stepDTO)) {
+            if (validateManualData(message, userId, stepDTO)) {
                 return;
             }
         }
     }
 
-    private boolean validateUserData(IronStepDTO message, String userId, IronStepVO stepDTO) {
-        if (stepDTO.getStepId().equals(message.getStepId())) {
+    private boolean validateManualData(IronStepDTO message, String userId, IronStepVO stepDTO) {
+        if (Objects.equals(stepDTO.getStepId(), message.getStepId()) && Objects.equals(stepDTO.getIdentifier(), message.getIdentifier()) && Objects.equals("2", stepDTO.getConfirmMode())) {
             stepDTO.setData(message.getData());
             setStepResult(mSteps);
-            PushData.send2Operation(mSteps, ironLoading);
+            PushData.send2Operation(mSteps, ironLoading1);
             //这里手动记录时间
             log.info("userId:{},stepId:{},identifier:{},data:{},pass:{}", userId, message.getStepId(), message.getIdentifier(), message.getData(), message.isPass());
+
+
+            if (Objects.equals(message.getIdentifier(), CAR_STATUS)) {
+                RealtimeData realtimeData = new RealtimeData();
+                realtimeData.setValue(message.getData());
+                realtimeData.setDesc("鱼雷罐车到位状态");
+                mRealtimeStatus.put(CAR_STATUS, realtimeData);
+            }
+
+            if (Objects.equals(message.getIdentifier(), GUN_STATUS)) {
+                RealtimeData realtimeData = new RealtimeData();
+                realtimeData.setValue(message.getData());
+                realtimeData.setDesc("拔炮状态");
+                mRealtimeStatus.put(GUN_STATUS, realtimeData);
+            }
+
+
+            if (Objects.equals(message.getIdentifier(), MOUTH_STATUS)) {
+                RealtimeData realtimeData = new RealtimeData();
+                realtimeData.setValue(message.getData());
+                realtimeData.setDesc("摆动溜嘴状态");
+                mRealtimeStatus.put(MOUTH_STATUS, realtimeData);
+            }
+
+            PushData.send2RealtimeStatus(mRealtimeStatus);
+
             return true;
         }
         return false;

+ 1 - 1
taphole-iron/src/main/java/com/sckj/iron/socketio/IronRealtimeListener.java

@@ -65,7 +65,7 @@ public class IronRealtimeListener extends EventListener {
         String pointName = opcData.getPointName();
         Object data = opcData.getData();
 
-        PushData.send2Realtime("");
+        PushData.send2RealtimeData("");
     }
 
 

+ 22 - 3
taphole-iron/src/main/java/com/sckj/iron/socketio/PushData.java

@@ -30,7 +30,11 @@ public class PushData {
     /**
      * 实时数据
      **/
-    public static final String IRON_REALTIME = "IRON_REALTIME";
+    public static final String IRON_REALTIME_DATA = "IRON_REALTIME_DATA";
+    /**
+     * 实时数据
+     **/
+    public static final String IRON_REALTIME_STATUS = "IRON_REALTIME_STATUS";
 
     /***
      * 一、炉前准备:铁摆系统正常、泥炮开口机准备完毕、人员到位
@@ -123,13 +127,28 @@ public class PushData {
      * @return
      * @Param
      **/
-    public static void send2Realtime(Object message) {
+    public static void send2RealtimeData(Object message) {
+        if (SocketUtil.connectMap.isEmpty()) {
+            return;
+        }
+        //
+        for (Map.Entry<String, SocketIOClient> entry : SocketUtil.connectMap.entrySet()) {
+            entry.getValue().sendEvent(PushData.IRON_REALTIME_DATA, AjaxResult.success(message));
+        }
+    }
+    /**
+     * 实时数据
+     *
+     * @return
+     * @Param
+     **/
+    public static void send2RealtimeStatus(Object message) {
         if (SocketUtil.connectMap.isEmpty()) {
             return;
         }
         //
         for (Map.Entry<String, SocketIOClient> entry : SocketUtil.connectMap.entrySet()) {
-            entry.getValue().sendEvent(PushData.IRON_REALTIME, AjaxResult.success(message));
+            entry.getValue().sendEvent(PushData.IRON_REALTIME_STATUS, AjaxResult.success(message));
         }
     }
 

+ 39 - 0
taphole-iron/src/main/java/com/sckj/iron/validate/TIronDataSearchScreenValidate.java

@@ -0,0 +1,39 @@
+package com.sckj.iron.validate;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+@ApiModel("出铁数据搜素参数")
+public class TIronDataSearchScreenValidate implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "锅炉编号")
+    private Long boilerId;
+
+    @ApiModelProperty(value = "铁口区域编号")
+    private Long tapholeId;
+
+    @ApiModelProperty(value = "出铁次数编号")
+    private String ironNo;
+
+    @ApiModelProperty(value = "出铁时间")
+    private String ironCosttime;
+
+    @ApiModelProperty(value = "实际出铁量")
+    private double ironWeight;
+
+    @ApiModelProperty(value = "实际渣量")
+    private String slagWeight;
+
+    @ApiModelProperty(value = "开始时间")
+    private String ironStarttime;
+
+    @ApiModelProperty(value = "结束时间")
+    private String ironEndtime;
+
+}

+ 28 - 16
taphole-iron/src/main/java/com/sckj/iron/validate/TIronDataSearchValidate.java

@@ -13,31 +13,43 @@ public class TIronDataSearchValidate implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
-    @ApiModelProperty(value = "铁口编号")
-    private Integer tkbh;
+    @ApiModelProperty(value = "锅炉编号")
+    private Long boilerId;
+
+    @ApiModelProperty(value = "铁口区域编号")
+    private Long tapholeId;
 
     @ApiModelProperty(value = "出铁次数编号")
-    private Integer ctcsbh;
+    private String ironNo;
 
     @ApiModelProperty(value = "出铁时间")
-    private String ctsj;
+    private String ironCosttime;
+
+    @ApiModelProperty(value = "实际出铁量")
+    private double ironWeight;
+
+    @ApiModelProperty(value = "实际渣量")
+    private String slagWeight;
+
+    @ApiModelProperty(value = "铁水平均温度")
+    private String avgTemp;
 
-    @ApiModelProperty(value = "出铁量")
-    private String ctl;
+    @ApiModelProperty(value = "泥炮量")
+    private String mudWeight;
 
-    @ApiModelProperty(value = "渣量")
-    private String zl;
+    @ApiModelProperty(value = "钻杆直径")
+    private String pollMm;
 
-    @ApiModelProperty(value = "危害程度")
-    private String whcd;
+    @ApiModelProperty(value = "开口深度")
+    private String openDepth;
 
-    @ApiModelProperty(value = "设备区域")
-    private String sbqy;
+    @ApiModelProperty(value = "上料总干量")
+    private double totalDry;
 
-    @ApiModelProperty(value = "时间")
-    private String sj;
+    @ApiModelProperty(value = "开始时间")
+    private String ironStarttime;
 
-    @ApiModelProperty(value = "次数")
-    private String cs;
+    @ApiModelProperty(value = "结束时间")
+    private String ironEndtime;
 
 }

+ 23 - 15
taphole-iron/src/main/java/com/sckj/iron/validate/TIronParamCreateValidate.java

@@ -19,19 +19,27 @@ public class TIronParamCreateValidate implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
-    @ApiModelProperty(value = "开口耗时(s)")
-    private BigDecimal kkhs;
-
-    @ApiModelProperty(value = "出铁时间(s)")
-    private BigDecimal ctsj;
-
-    @ApiModelProperty(value = "出铁量(t)")
-    private BigDecimal ctl;
-
-    @ApiModelProperty(value = "出铁流速(t/s)")
-    private BigDecimal ctls;
-
-    @ApiModelProperty(value = "铁水温度变化(℃/s)")
-    private BigDecimal tswdbh;
-
+//    @ApiModelProperty(value = "开口耗时(s)")
+//    private BigDecimal kkhs;
+//
+//    @ApiModelProperty(value = "出铁时间(s)")
+//    private BigDecimal ctsj;
+//
+//    @ApiModelProperty(value = "出铁量(t)")
+//    private BigDecimal ctl;
+//
+//    @ApiModelProperty(value = "出铁流速(t/s)")
+//    private BigDecimal ctls;
+//
+//    @ApiModelProperty(value = "铁水温度变化(℃/s)")
+//    private BigDecimal tswdbh;
+
+    @ApiModelProperty(value = "参数类型")
+    private String paramType;
+
+    @ApiModelProperty(value = "参数名称")
+    private String paramName;
+
+    @ApiModelProperty(value = "参数值")
+    private String paramValue;
 }

+ 15 - 6
taphole-iron/src/main/java/com/sckj/iron/validate/TIronParamSearchValidate.java

@@ -18,13 +18,22 @@ public class TIronParamSearchValidate implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
-    @ApiModelProperty(value = "开口耗时(s)")
-    private BigDecimal kkhs;
+//    @ApiModelProperty(value = "开口耗时(s)")
+//    private BigDecimal kkhs;
+//
+//    @ApiModelProperty(value = "出铁时间(s)")
+//    private BigDecimal ctsj;
+//
+//    @ApiModelProperty(value = "出铁量(t)")
+//    private BigDecimal ctl;
 
-    @ApiModelProperty(value = "出铁时间(s)")
-    private BigDecimal ctsj;
+    @ApiModelProperty(value = "参数类型")
+    private String paramType;
 
-    @ApiModelProperty(value = "出铁量(t)")
-    private BigDecimal ctl;
+    @ApiModelProperty(value = "参数名称")
+    private String paramName;
+
+    @ApiModelProperty(value = "参数值")
+    private String paramValue;
 
 }

+ 23 - 14
taphole-iron/src/main/java/com/sckj/iron/validate/TIronParamUpdateValidate.java

@@ -21,19 +21,28 @@ public class TIronParamUpdateValidate implements Serializable {
     @ApiModelProperty(value = "主键id")
     private Long id;
 
-    @ApiModelProperty(value = "开口耗时(s)")
-    private BigDecimal kkhs;
-
-    @ApiModelProperty(value = "出铁时间(s)")
-    private BigDecimal ctsj;
-
-    @ApiModelProperty(value = "出铁量(t)")
-    private BigDecimal ctl;
-
-    @ApiModelProperty(value = "出铁流速(t/s)")
-    private BigDecimal ctls;
-
-    @ApiModelProperty(value = "铁水温度变化(℃/s)")
-    private BigDecimal tswdbh;
+//    @ApiModelProperty(value = "开口耗时(s)")
+//    private BigDecimal kkhs;
+//
+//    @ApiModelProperty(value = "出铁时间(s)")
+//    private BigDecimal ctsj;
+//
+//    @ApiModelProperty(value = "出铁量(t)")
+//    private BigDecimal ctl;
+//
+//    @ApiModelProperty(value = "出铁流速(t/s)")
+//    private BigDecimal ctls;
+//
+//    @ApiModelProperty(value = "铁水温度变化(℃/s)")
+//    private BigDecimal tswdbh;
+
+    @ApiModelProperty(value = "参数类型")
+    private String paramType;
+
+    @ApiModelProperty(value = "参数名称")
+    private String paramName;
+
+    @ApiModelProperty(value = "参数值")
+    private String paramValue;
 
 }

+ 2 - 2
taphole-iron/src/main/java/com/sckj/iron/vo/IronStepVO.java

@@ -49,8 +49,8 @@ public class IronStepVO {
     @ApiModelProperty(value = "流程是否必须项(0否 1是)")
     private String required;
 
-    @ApiModelProperty(value = "步骤名称")
-    private String flowName;
+    @ApiModelProperty(value = "步骤名称表达式")
+    private String stepNameExpression;
 
     public IronStepVO() {
         this.childs = new ArrayList<>();

+ 1 - 1
taphole-opc/src/main/java/com/sckj/opc/dto/L2Data.java

@@ -105,7 +105,7 @@ public class L2Data implements Serializable {
         data.elementSi = dis.readUTF();
         data.elementMn = dis.readUTF();
         data.elementP = dis.readUTF();
-        data.elementP = dis.readUTF();
+        data.elementS = dis.readUTF();
         data.elementTi = dis.readUTF();
         return data;
     }