Bladeren bron

修改报警信息
修改打包相关的参数

dongjh 1 jaar geleden
bovenliggende
commit
4599643180
16 gewijzigde bestanden met toevoegingen van 599 en 63 verwijderingen
  1. 1 1
      jeecg-module-system/jeecg-system-start/pom.xml
  2. 3 1
      jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml
  3. 2 2
      jeecg-module-system/jeecg-system-start/src/main/resources/application-prod.yml
  4. 143 0
      module-guan/src/main/java/org/jeecg/modules/webaccess/controller/GuanAlarmController.java
  5. 22 0
      module-guan/src/main/java/org/jeecg/modules/webaccess/controller/WebAccessController.java
  6. 108 0
      module-guan/src/main/java/org/jeecg/modules/webaccess/entity/GuanAlarm.java
  7. 78 0
      module-guan/src/main/java/org/jeecg/modules/webaccess/entity/GuanRAlarm.java
  8. 2 32
      module-guan/src/main/java/org/jeecg/modules/webaccess/job/WAMsgJob.java
  9. 7 0
      module-guan/src/main/java/org/jeecg/modules/webaccess/mapper/GuanAlarmMapper.java
  10. 13 0
      module-guan/src/main/java/org/jeecg/modules/webaccess/mapper/GuanRAlarmMapper.java
  11. 28 0
      module-guan/src/main/java/org/jeecg/modules/webaccess/mapper/xml/GuanRAlarmMapper.xml
  12. 7 0
      module-guan/src/main/java/org/jeecg/modules/webaccess/service/IGuanAlarmService.java
  13. 13 0
      module-guan/src/main/java/org/jeecg/modules/webaccess/service/IGuanRAlarmService.java
  14. 138 27
      module-guan/src/main/java/org/jeecg/modules/webaccess/service/WebAccessService.java
  15. 11 0
      module-guan/src/main/java/org/jeecg/modules/webaccess/service/impl/GuanAlarmServiceImpl.java
  16. 23 0
      module-guan/src/main/java/org/jeecg/modules/webaccess/service/impl/GuanRAlarmServiceImpl.java

+ 1 - 1
jeecg-module-system/jeecg-system-start/pom.xml

@@ -9,7 +9,7 @@
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>jeecg-system-start</artifactId>
+    <artifactId>screenserver</artifactId>
     
     <dependencies>
         <!-- SYSTEM 系统管理模块 -->

+ 3 - 1
jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml

@@ -131,6 +131,7 @@ spring:
       datasource:
         master:
           url: jdbc:mysql://152.136.206.27:3306/guAn_rl?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+#          url: jdbc:mysql://127.0.0.1:3306/guAn_rl?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
           username: itdm-boot
           password: itdm-boot@2023
           driver-class-name: com.mysql.cj.jdbc.Driver
@@ -143,7 +144,7 @@ spring:
   #redis 配置
   redis:
     database: 0
-    host: 152.136.206.27
+    host: 127.0.0.1
     port: 6379
     password: ''
 #mybatis plus 设置
@@ -226,6 +227,7 @@ jeecg:
     logRetentionDays: 30
   #分布式锁配置
   redisson:
+#    address: 152.136.206.27:6379
     address: 127.0.0.1:6379
     password:
     type: STANDALONE

+ 2 - 2
jeecg-module-system/jeecg-system-start/src/main/resources/application-prod.yml

@@ -130,7 +130,7 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://152.136.206.27:3306/guAn_rl?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+          url: jdbc:mysql://127.0.0.1:3306/guAn_rl?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
           username: itdm-boot
           password: itdm-boot@2023
           driver-class-name: com.mysql.cj.jdbc.Driver
@@ -143,7 +143,7 @@ spring:
   #redis 配置
   redis:
     database: 0
-    host: 152.136.206.27
+    host: 127.0.0.1
     port: 6379
     password: ''
 #mybatis plus 设置

+ 143 - 0
module-guan/src/main/java/org/jeecg/modules/webaccess/controller/GuanAlarmController.java

@@ -0,0 +1,143 @@
+package org.jeecg.modules.webaccess.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.modules.webaccess.entity.GuanAlarm;
+import org.jeecg.modules.webaccess.service.IGuanAlarmService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Arrays;
+
+@Api(tags = "报警信息")
+@RestController
+@RequestMapping("/guan/alarm")
+@Slf4j
+public class GuanAlarmController extends JeecgController<GuanAlarm, IGuanAlarmService> {
+    @Autowired
+    private IGuanAlarmService guanAlarmService;
+
+
+    @ApiOperation(value = "报警信息", notes = "报警信息")
+    @GetMapping(value = "/list")
+    public Result<IPage<GuanAlarm>> queryList(GuanAlarm guanAlarm,
+                                              @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+                                              @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+                                              HttpServletRequest req) {
+        QueryWrapper<GuanAlarm> queryWrapper = QueryGenerator.initQueryWrapper(guanAlarm, req.getParameterMap());
+        Page<GuanAlarm> page = new Page<GuanAlarm>(pageNo, pageSize);
+        IPage<GuanAlarm> pageList = guanAlarmService.page(page, queryWrapper);
+        return Result.OK(pageList);
+    }
+
+    /**
+     *   添加
+     *
+     * @param guanAlarm
+     * @return
+     */
+    @AutoLog(value = "报警信息-添加")
+    @ApiOperation(value="报警信息-添加", notes="报警信息-添加")
+    @PostMapping(value = "/add")
+    public Result<String> add(@RequestBody GuanAlarm guanAlarm) {
+        guanAlarmService.save(guanAlarm);
+        return Result.OK("添加成功!");
+    }
+
+    /**
+     *  编辑
+     *
+     * @param guanAlarm
+     * @return
+     */
+    @AutoLog(value = "报警信息-编辑")
+    @ApiOperation(value="报警信息-编辑", notes="报警信息-编辑")
+    //@RequiresPermissions("org.jeecg.modules:dashboard_param:edit")
+    @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+    public Result<String> edit(@RequestBody GuanAlarm guanAlarm) {
+        guanAlarmService.updateById(guanAlarm);
+        return Result.OK("编辑成功!");
+    }
+
+    /**
+     *   通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "报警信息-通过id删除")
+    @ApiOperation(value="报警信息-通过id删除", notes="报警信息-通过id删除")
+    //@RequiresPermissions("org.jeecg.modules:dashboard_param:delete")
+    @DeleteMapping(value = "/delete")
+    public Result<String> delete(@RequestParam(name="id",required=true) String id) {
+        guanAlarmService.removeById(id);
+        return Result.OK("删除成功!");
+    }
+
+    /**
+     *  批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "报警信息-批量删除")
+    @ApiOperation(value="报警信息-批量删除", notes="报警信息-批量删除")
+    //@RequiresPermissions("org.jeecg.modules:dashboard_param:deleteBatch")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+        this.guanAlarmService.removeByIds(Arrays.asList(ids.split(",")));
+        return Result.OK("批量删除成功!");
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value="报警信息-通过id查询", notes="报警信息-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<GuanAlarm> queryById(@RequestParam(name="id",required=true) String id) {
+        GuanAlarm guanAlarm = guanAlarmService.getById(id);
+        if(guanAlarm==null) {
+            return Result.error("未找到对应数据");
+        }
+        return Result.OK(guanAlarm);
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param guanAlarm
+     */
+    //@RequiresPermissions("org.jeecg.modules:dashboard_param:exportXls")
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, GuanAlarm guanAlarm) {
+        return super.exportXls(request, guanAlarm, GuanAlarm.class, "报警信息表");
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    //@RequiresPermissions("org.jeecg.modules:dashboard_param:importExcel")
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, GuanAlarm.class);
+    }
+}

+ 22 - 0
module-guan/src/main/java/org/jeecg/modules/webaccess/controller/WebAccessController.java

@@ -129,4 +129,26 @@ public class WebAccessController {
 
         return Result.OK("获取成功", result);
     }
+
+    /**
+     * 获取大屏展示数据
+     */
+    @ApiOperation(value = "获取大屏展示数据", notes = "获取大屏展示数据")
+    @RequestMapping(value = "/getDashBoardData", method = RequestMethod.GET)
+    public Result getDashBoardData() {
+        String rtn = webAccessService.organizeDashData();
+
+        return Result.OK("获取成功", rtn);
+    }
+
+    /**
+     * 获取工艺流程图地址
+     */
+    @ApiOperation(value = "获取工艺流程图地址", notes = "获取工艺流程图地址")
+    @RequestMapping(value = "/getFlowUrl", method = RequestMethod.GET)
+    public Result getFlowUrl() {
+        String rtn = webAccessService.getFlowUrl();
+
+        return Result.OK("获取成功", rtn);
+    }
 }

+ 108 - 0
module-guan/src/main/java/org/jeecg/modules/webaccess/entity/GuanAlarm.java

@@ -0,0 +1,108 @@
+package org.jeecg.modules.webaccess.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+@Data
+@TableName("guan_alarm")
+public class GuanAlarm {
+    /**主键*/
+    @ApiModelProperty(value = "主键")
+    private Integer id;
+
+    /**点名称*/
+    @Excel(name = "点名称", width = 25)
+    @ApiModelProperty(value = "点名称")
+    private String tagname;
+
+    /**报警描述*/
+    @Excel(name = "报警描述", width = 100)
+    @ApiModelProperty(value = "报警描述")
+    private String description;
+
+    /**记录时间*/
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "记录时间")
+    private Date logtime;
+
+    /**警报等级*/
+    @Excel(name = "警报等级", width = 5)
+    @ApiModelProperty(value = "警报等级")
+    private String priority;
+
+    /**动作*/
+    @Excel(name = "动作", width = 40)
+    @ApiModelProperty(value = "动作")
+    private String action;
+
+    /**用户名*/
+    @Excel(name = "用户名", width = 16)
+    @ApiModelProperty(value = "用户名")
+    private String username;
+
+    /**节点名称*/
+    @Excel(name = "节点名称", width = 16)
+    @ApiModelProperty(value = "节点名称")
+    private String nodename;
+
+    /**节点IP*/
+    @Excel(name = "节点IP", width = 16)
+    @ApiModelProperty(value = "节点IP")
+    private String nodeip;
+
+    /**警报群组*/
+    @Excel(name = "警报群组", width = 5)
+    @ApiModelProperty(value = "警报群组")
+    private String almgroup;
+
+    /**警报值*/
+    @Excel(name = "警报值")
+    @ApiModelProperty(value = "警报值")
+    private Double alarmvalue;
+
+    /**警报设定值*/
+    @Excel(name = "警报设定值")
+    @ApiModelProperty(value = "警报设定值")
+    private Double alarmlimit;
+
+    /**恢复时间*/
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "恢复时间")
+    private Date restoretime;
+
+    /**所属年*/
+    @ApiModelProperty(value = "所属年")
+    private Integer year;
+
+    /**所属月*/
+    @ApiModelProperty(value = "所属月")
+    private Integer month;
+
+    /**日期*/
+    @ApiModelProperty(value = "日期")
+    private String day;
+
+    /**时间*/
+    @ApiModelProperty(value = "时间")
+    private String time;
+
+    /**所属年月*/
+    @ApiModelProperty(value = "所属年月")
+    private String yearmonth;
+
+    /**所属周*/
+    @ApiModelProperty(value = "所属周")
+    private Integer week;
+
+    /**周几*/
+    @ApiModelProperty(value = "周几")
+    private Integer dayofweek;
+}

+ 78 - 0
module-guan/src/main/java/org/jeecg/modules/webaccess/entity/GuanRAlarm.java

@@ -0,0 +1,78 @@
+package org.jeecg.modules.webaccess.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+@Data
+@TableName("guan_ralarm")
+public class GuanRAlarm {
+    /**主键*/
+    @ApiModelProperty(value = "主键")
+    private Integer id;
+
+    /**点名称*/
+    @Excel(name = "点名称", width = 25)
+    @ApiModelProperty(value = "点名称")
+    private String tagname;
+
+    /**报警描述*/
+    @Excel(name = "报警描述", width = 100)
+    @ApiModelProperty(value = "报警描述")
+    private String description;
+
+    /**记录时间*/
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "记录时间")
+    private Date logtime;
+
+    /**警报等级*/
+    @Excel(name = "警报等级", width = 5)
+    @ApiModelProperty(value = "警报等级")
+    private String priority;
+
+    /**动作*/
+    @Excel(name = "动作", width = 40)
+    @ApiModelProperty(value = "动作")
+    private String action;
+
+    /**用户名*/
+    @Excel(name = "用户名", width = 16)
+    @ApiModelProperty(value = "用户名")
+    private String username;
+
+    /**节点名称*/
+    @Excel(name = "节点名称", width = 16)
+    @ApiModelProperty(value = "节点名称")
+    private String nodename;
+
+    /**节点IP*/
+    @Excel(name = "节点IP", width = 16)
+    @ApiModelProperty(value = "节点IP")
+    private String nodeip;
+
+    /**警报群组*/
+    @Excel(name = "警报群组", width = 5)
+    @ApiModelProperty(value = "警报群组")
+    private String almgroup;
+
+    /**警报值*/
+    @Excel(name = "警报值")
+    @ApiModelProperty(value = "警报值")
+    private Double alarmvalue;
+
+    /**警报设定值*/
+    @Excel(name = "警报设定值")
+    @ApiModelProperty(value = "警报设定值")
+    private Double alarmlimit;
+
+    /**报警信息主键*/
+    @ApiModelProperty(value = "报警信息主键")
+    private Integer alarmid;
+}

+ 2 - 32
module-guan/src/main/java/org/jeecg/modules/webaccess/job/WAMsgJob.java

@@ -1,18 +1,13 @@
 package org.jeecg.modules.webaccess.job;
 
 import lombok.extern.slf4j.Slf4j;
-import net.sf.json.JSONArray;
-import net.sf.json.JSONObject;
-import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.message.websocket.WebSocket;
-import org.jeecg.modules.webaccess.dto.CirculateDTO;
 import org.jeecg.modules.webaccess.service.WebAccessService;
 import org.quartz.Job;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import java.util.List;
 
 @Slf4j
 public class WAMsgJob implements Job {
@@ -25,32 +20,7 @@ public class WAMsgJob implements Job {
 
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-
-        log.info(String.format(" 获取设备实时值! 时间:" + DateUtils.getTimestamp()));
-
-        JSONObject jsonObject = new JSONObject();
-
-        // 设备实时值
-        JSONArray tagArray = webAccessService.getDashboardTagNameValues();
-        jsonObject.put("设备实时值", tagArray);
-
-        // 设备历史值
-        JSONArray logArray = webAccessService.getDashboardDataLog();
-        jsonObject.put("设备历史值", logArray);
-
-        // 最新一条报警信息
-        JSONArray lastAlarmArray = webAccessService.getDashboardLastAlarm();
-        jsonObject.put("最新一条报警信息", lastAlarmArray);
-
-        // 预制曲线
-        List<CirculateDTO> yzqxList = webAccessService.getYzcx();
-        jsonObject.put("预制曲线", yzqxList);
-
-        // 报警信息列表
-//        JSONArray alarmArray = webAccessService.getDashboardPageAlarm();
-//        jsonObject.put("报警信息列表", alarmArray);
-
-//        webSocket.pushMessageByObject(jsonObject);
-        webSocket.pushMessage(jsonObject.toString());
+        String rtn = webAccessService.organizeDashData();
+        webSocket.pushMessage(rtn);
     }
 }

+ 7 - 0
module-guan/src/main/java/org/jeecg/modules/webaccess/mapper/GuanAlarmMapper.java

@@ -0,0 +1,7 @@
+package org.jeecg.modules.webaccess.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.webaccess.entity.GuanAlarm;
+
+public interface GuanAlarmMapper extends BaseMapper<GuanAlarm> {
+}

+ 13 - 0
module-guan/src/main/java/org/jeecg/modules/webaccess/mapper/GuanRAlarmMapper.java

@@ -0,0 +1,13 @@
+package org.jeecg.modules.webaccess.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.webaccess.entity.GuanRAlarm;
+
+public interface GuanRAlarmMapper extends BaseMapper<GuanRAlarm> {
+
+    /**
+     * 获取最新一条报警信息
+     * @return
+     */
+    public GuanRAlarm selectTop1Alarm();
+}

+ 28 - 0
module-guan/src/main/java/org/jeecg/modules/webaccess/mapper/xml/GuanRAlarmMapper.xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.webaccess.mapper.GuanRAlarmMapper">
+
+    <resultMap type="org.jeecg.modules.webaccess.entity.GuanRAlarm" id="GuanRAlarmResult">
+        <result property="id"    column="id"    />
+        <result property="tagname"    column="tagname"    />
+        <result property="description"    column="description"    />
+        <result property="logtime"    column="logtime"    />
+        <result property="priority"    column="priority"    />
+        <result property="action"    column="action"    />
+        <result property="username"    column="username"    />
+        <result property="nodename"    column="nodename"    />
+        <result property="nodeip"    column="nodeip"    />
+        <result property="almgroup"    column="almgroup"    />
+        <result property="alarmvalue"    column="alarmvalue"    />
+        <result property="alarmlimit"    column="alarmlimit"    />
+        <result property="alarmid"    column="alarmid"    />
+    </resultMap>
+
+
+    <select id="selectTop1Alarm" resultMap="GuanRAlarmResult">
+        select * from guan_ralarm
+        order by id desc
+        limit 1
+    </select>
+
+</mapper>

+ 7 - 0
module-guan/src/main/java/org/jeecg/modules/webaccess/service/IGuanAlarmService.java

@@ -0,0 +1,7 @@
+package org.jeecg.modules.webaccess.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.webaccess.entity.GuanAlarm;
+
+public interface IGuanAlarmService extends IService<GuanAlarm> {
+}

+ 13 - 0
module-guan/src/main/java/org/jeecg/modules/webaccess/service/IGuanRAlarmService.java

@@ -0,0 +1,13 @@
+package org.jeecg.modules.webaccess.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.webaccess.entity.GuanRAlarm;
+
+public interface IGuanRAlarmService extends IService<GuanRAlarm> {
+
+    /**
+     * 获取最新一条报警信息
+     * @return
+     */
+    public GuanRAlarm selectTop1Alarm();
+}

+ 138 - 27
module-guan/src/main/java/org/jeecg/modules/webaccess/service/WebAccessService.java

@@ -1,17 +1,21 @@
 package org.jeecg.modules.webaccess.service;
 
+import lombok.extern.slf4j.Slf4j;
 import net.sf.json.JSONArray;
 import net.sf.json.JSONObject;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.collections.map.HashedMap;
+import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.system.entity.SysDictItem;
 import org.jeecg.modules.system.service.ISysDictItemService;
 import org.jeecg.modules.webaccess.dto.CirculateDTO;
 import org.jeecg.modules.webaccess.dto.SectionDTO;
 import org.jeecg.modules.webaccess.dto.WaLogDTO;
 import org.jeecg.modules.webaccess.entity.GuanDashboardParam;
+import org.jeecg.modules.webaccess.entity.GuanRAlarm;
 import org.jeecg.modules.webaccess.entity.GuanTest;
 import org.jeecg.modules.webaccess.mapper.GuanDashboardParamMapper;
+import org.jeecg.modules.webaccess.mapper.GuanRAlarmMapper;
 import org.jeecg.modules.webaccess.mapper.GuanTestMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpEntity;
@@ -35,6 +39,7 @@ import java.util.jar.JarEntry;
  * 调用webaccess的接口
  */
 @Service
+@Slf4j
 public class WebAccessService {
 //    @Autowired
 //    private RestTemplate restTemplate;
@@ -48,10 +53,15 @@ public class WebAccessService {
     @Autowired
     private GuanTestMapper guanTestMapper;
 
+    @Autowired
+    private GuanRAlarmMapper guanRAlarmMapper;
+
+
     //region <<字典获取webaccess信息>>
     /**
      * 获取webaccess的API信息
-     * @param itemtext(group:组合API,single:单独某个信息,login:登录信息)
+     * @param itemtext 字典项名称
+     * @param type 获取类型(group:组合API,single:单独某个信息,login:登录信息)
      * @return
      */
     private String getDictItemDesc(String itemtext, String type) {
@@ -72,6 +82,17 @@ public class WebAccessService {
             return "";
         }
     }
+
+    /**
+     * 获取字典值
+     * @param itemtext(group:组合API,single:单独某个信息,login:登录信息)
+     * @return
+     */
+    private String getDictItemValue(String itemtext) {
+        SysDictItem dictItem = sysDictItemService.selectItemsByDictcodeAndItemtext("webaccess", itemtext);
+
+        return dictItem.getItemValue();
+    }
     //endregion
 
     //region <<webaccess API>>
@@ -766,12 +787,13 @@ public class WebAccessService {
      * 获取预制曲线
      * @return
      */
-    public List<CirculateDTO> getYzcx() {
+    public List<CirculateDTO> getYzcx(List<String> duans) {
+        List<CirculateDTO> circulates = new ArrayList<>();
         // 获取4个内部循环定义信息(启始段、结束段、次数)
-        List<CirculateDTO> circulates = getNbxh();
+        circulates = getNbxh();
 
         // 获取循环详细信息(温度、湿度、时间)
-        getCxsd(circulates);
+        getCxsd(circulates, duans);
 
         circulates.remove(circulates.size() - 1);
 
@@ -781,9 +803,10 @@ public class WebAccessService {
     /**
      * 获取循环详细信息(温度、湿度、时间)
      * @param circulates 循环信息
+     * @param duans 段标识
      * @return
      */
-    private void getCxsd(List<CirculateDTO> circulates) {
+    private void getCxsd(List<CirculateDTO> circulates, List<String> duans) {
         Integer allSecond = 0; // 累加的秒
 
         // 循环获取信息
@@ -796,6 +819,9 @@ public class WebAccessService {
 
                 List<SectionDTO> sections = new ArrayList<>();
                 for (int i = circulates.get(j).getBeginsec(); i <= circulates.get(j).getEndsec(); i++) {
+                    // 段标识
+                    duans.add(i + "");
+
                     int xb = i + 1; // 下标
                     String cxd = (xb < 10 ? "0" + xb : "" + xb);
 
@@ -808,21 +834,23 @@ public class WebAccessService {
 
                     // 温度
                     tags.clear();
-                    waLogDTO.setTagname("程序温度设定区域" + cxd);
+                    waLogDTO.setTagname("程序温度设定" + cxd);
                     tags.add(waLogDTO);
                     waparams = generateGetObject(tags);
-                    section.setTemperature(Float.parseFloat(getTagNameValues(waparams)));
+                    Float temperature = Float.parseFloat(getTagNameValues(waparams));
+                    section.setTemperature(temperature);
 
                     // 湿度
                     tags.clear();
-                    waLogDTO.setTagname("程序湿度设定区域" + cxd);
+                    waLogDTO.setTagname("程序湿度设定" + cxd);
                     tags.add(waLogDTO);
                     waparams = generateGetObject(tags);
-                    section.setHumidity(Float.parseFloat(getTagNameValues(waparams)));
+                    Float humidity = Float.parseFloat(getTagNameValues(waparams));
+                    section.setHumidity(humidity);
 
                     // 分
                     tags.clear();
-                    waLogDTO.setTagname("程序时间设定区域_分" + cxd);
+                    waLogDTO.setTagname("程序时间设定分" + cxd);
                     tags.add(waLogDTO);
                     waparams = generateGetObject(tags);
                     Integer minute = Integer.parseInt(getTagNameValues(waparams));
@@ -830,35 +858,38 @@ public class WebAccessService {
 
                     // 秒
                     tags.clear();
-                    waLogDTO.setTagname("程序时间设定区域_秒" + cxd);
+                    waLogDTO.setTagname("程序时间设定秒" + cxd);
                     tags.add(waLogDTO);
                     waparams = generateGetObject(tags);
                     Integer second = Integer.parseInt(getTagNameValues(waparams));
                     section.setSecond(second);
 
-                    // 时间
-                    Long hourl = TimeUnit.SECONDS.toHours(allSecond);
-                    String hours = hourl + "";
-                    if (hourl == 0) {
-                        hours = "00";
-                    } else if (hourl > 0 && hourl < 10) {
-                        hours = "0" + hourl;
-                    }
-                    Long minutel = TimeUnit.SECONDS.toMinutes(allSecond % 3600);
-                    String minutes = minutel + "";
-                    if (minutel == 0) {
-                        minutes = "00";
-                    } else if (minutel > 0 && minutel < 10) {
-                        minutes = "0" + minutel;
+                    // 虚拟一个开头,不然线不对
+                    if (allSecond == 0) {
+                        SectionDTO firstsection = new SectionDTO();
+                        firstsection.setSecname(-1);
+                        firstsection.setTemperature(temperature);
+                        firstsection.setHumidity(humidity);
+                        // 时间
+                        firstsection.setTime("00:00");
+                        allSecond += minute * 60 + second;
+
+                        sections.add(firstsection);
                     }
-                    section.setTime(hours + ":" + minutes);
 
+                    // 时间
+                    section.setTime(generateTime(allSecond));
                     allSecond += minute * 60 + second;
 
                     sections.add(section);
                 }
                 if (sections != null && sections.size() > 0) {
-                    circulates.get(j).setBegintime(sections.get(0).getTime());
+                    if (j == 0) {
+                        circulates.get(j).setBegintime(sections.get(0).getTime());
+                    }
+                    else {
+                        circulates.get(j).setBegintime(circulates.get(j - 1).getSections().get(circulates.get(j - 1).getSections().size() - 1).getTime());
+                    }
                     circulates.get(j).setEndtime(sections.get(sections.size() - 1).getTime());
                 }
                 circulates.get(j).setSections(sections);
@@ -867,6 +898,28 @@ public class WebAccessService {
     }
 
     /**
+     * 组合
+     */
+    private String generateTime(Integer allSecond) {
+        Long hourl = TimeUnit.SECONDS.toHours(allSecond);
+        String hours = hourl + "";
+        if (hourl == 0) {
+            hours = "00";
+        } else if (hourl > 0 && hourl < 10) {
+            hours = "0" + hourl;
+        }
+        Long minutel = TimeUnit.SECONDS.toMinutes(allSecond % 3600);
+        String minutes = minutel + "";
+        if (minutel == 0) {
+            minutes = "00";
+        } else if (minutel > 0 && minutel < 10) {
+            minutes = "0" + minutel;
+        }
+
+        return hours + ":" + minutes;
+    }
+
+    /**
      * 获取4个内部循环定义信息(启始段、结束段、次数)
      * @return
      */
@@ -1013,6 +1066,16 @@ public class WebAccessService {
      * 获取最新一条报警信息
      * @return
      */
+    public GuanRAlarm getLastAlarm() {
+        GuanRAlarm rAlarm = guanRAlarmMapper.selectTop1Alarm();
+
+        return rAlarm;
+    }
+
+    /**
+     * 获取最新一条报警信息
+     * @return
+     */
     public JSONArray getDashboardLastAlarm() {
         JSONArray jsonArray = new JSONArray();
         // 先获取报警信息数量
@@ -1049,4 +1112,52 @@ public class WebAccessService {
         return jsonArray;
     }
     //endregion
+
+    //region <<组合获取到的大屏展示数据>>
+
+    /**
+     * 组合获取到的大屏展示数据
+     * @return
+     */
+    public String organizeDashData() {
+
+        log.info(String.format(" 获取设备实时值! 时间:" + DateUtils.getTimestamp()));
+
+        JSONObject jsonObject = new JSONObject();
+
+        // 设备实时值
+        JSONArray tagArray = getDashboardTagNameValues();
+        jsonObject.put("设备实时值", tagArray);
+
+        // 设备历史值
+        JSONArray logArray = getDashboardDataLog();
+        jsonObject.put("设备历史值", logArray);
+
+        // 最新一条报警信息
+        GuanRAlarm rAlarm = getLastAlarm();
+        jsonObject.put("最新一条报警信息", rAlarm);
+
+        // 预制曲线
+        List<String> duans = new ArrayList<>();
+        List<CirculateDTO> yzqxList = getYzcx(duans);
+        jsonObject.put("预制曲线", yzqxList);
+        jsonObject.put("预制曲线线段", duans);
+
+        return jsonObject.toString();
+    }
+    //endregion
+
+    // region <<获取工艺流程图地址>>
+
+    /**
+     * 获取工艺流程图地址
+     * @return
+     */
+    public String getFlowUrl() {
+        String itemValue = getDictItemValue("2D3D页面");
+        String url = getDictItemDesc(itemValue + "D页面", "single");
+
+        return url;
+    }
+    // endregion
 }

+ 11 - 0
module-guan/src/main/java/org/jeecg/modules/webaccess/service/impl/GuanAlarmServiceImpl.java

@@ -0,0 +1,11 @@
+package org.jeecg.modules.webaccess.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.webaccess.entity.GuanAlarm;
+import org.jeecg.modules.webaccess.mapper.GuanAlarmMapper;
+import org.jeecg.modules.webaccess.service.IGuanAlarmService;
+import org.springframework.stereotype.Service;
+
+@Service
+public class GuanAlarmServiceImpl extends ServiceImpl<GuanAlarmMapper, GuanAlarm> implements IGuanAlarmService {
+}

+ 23 - 0
module-guan/src/main/java/org/jeecg/modules/webaccess/service/impl/GuanRAlarmServiceImpl.java

@@ -0,0 +1,23 @@
+package org.jeecg.modules.webaccess.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.webaccess.entity.GuanRAlarm;
+import org.jeecg.modules.webaccess.mapper.GuanRAlarmMapper;
+import org.jeecg.modules.webaccess.service.IGuanRAlarmService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class GuanRAlarmServiceImpl extends ServiceImpl<GuanRAlarmMapper, GuanRAlarm> implements IGuanRAlarmService {
+    @Autowired
+    private GuanRAlarmMapper guanRAlarmMapper;
+
+
+    /**
+     * 获取最新一条报警信息
+     * @return
+     */
+    public GuanRAlarm selectTop1Alarm() {
+        return guanRAlarmMapper.selectTop1Alarm();
+    }
+}