瀏覽代碼

报警信息

lmstack 3 年之前
父節點
當前提交
700c0d0b4d

+ 47 - 1
src/main/java/com/qx/didi/controller/ShowDataController.java

@@ -33,6 +33,9 @@ public class ShowDataController {
 
     @Autowired
     ResultInfoServiceImpl resultInfoService;
+
+    @Autowired
+    ResultAlarmInfoServiceImpl resultAlarmInfoService;
     @Autowired
     ResultInnershortServiceImpl resultInnershortService;
     @Autowired
@@ -103,12 +106,51 @@ public class ShowDataController {
             response.setMinVolt(Collections.min(voltages));
             response.setMinVoltIndex("单体电芯" + voltages.indexOf(Collections.min(voltages)));
             response.setCellTemp(resultOriginData.getCelltemp());
+
+            // 报警信息
+            List<ResultAlarmInfo> resultAlarmInfo = resultAlarmInfoService.list(new QueryWrapper<ResultAlarmInfo>().eq("sn", param.getSn()));
+            if (resultAlarmInfo != null && resultAlarmInfo.size() > 0) {
+                for (ResultAlarmInfo r : resultAlarmInfo) {
+                    if (r.getType().equals("电压离群报警")) {
+                        response.setVoltAlarmTime(new SimpleDateFormat("yyyy-MM-dd").format(r.getAlarmtime()));
+                        response.setVoltValue(r.getValue());
+                        response.setVoltValueDiff(r.getValuediff());
+                        response.setVoltThreshold(new ArrayList<Object>() {{
+                            add(r.getThresholdDown());
+                            add(r.getThresholdUp());
+
+                        }});
+                        response.setVoltLevel(r.getLevel());
+                    } else if (r.getType().equals("压差离群报警")) {
+                        response.setVoltDiffAlarmTime(new SimpleDateFormat("yyyy-MM-dd").format(r.getAlarmtime()));
+                        response.setVoltDiffValue(r.getValue());
+                        response.setVoltDiffValueDiff(r.getValuediff());
+                        response.setVoltDiffThreshold(new ArrayList<Object>() {{
+                            add(r.getThresholdDown());
+                            add(r.getThresholdUp());
+
+                        }});
+                        response.setVoltDiffLevel(r.getLevel());
+                    } else if (r.getType().equals("内短路报警")) {
+                        response.setInnershortAlarmTime(new SimpleDateFormat("yyyy-MM-dd").format(r.getAlarmtime()));
+                        response.setInnershortValue(r.getValue());
+                        response.setInnershortValueDiff(r.getValuediff());
+                        response.setInnershortThreshold(new ArrayList<Object>() {{
+                            add(r.getThresholdDown());
+                            add(r.getThresholdUp());
+
+                        }});
+                        response.setInnershortLevel(r.getLevel());
+                    }
+                }
+            }
             log.info(param.getSn() + "右侧结果返回");
             return ApiDTO.ok(response);
         } catch (Exception e) {
             throw new ApiRuntimeException(500, e.toString());
         }
     }
+
     @ApiOperation(value = "获取内短路数据")
     @PostMapping("/getInner")
     public ApiDTO getInner(@RequestBody QueryParam param) {
@@ -148,6 +190,7 @@ public class ShowDataController {
             throw new ApiRuntimeException(500, e.toString());
         }
     }
+
     @ApiOperation(value = "获取电压离群数据")
     @PostMapping("/getVolt")
     public ApiDTO getVolt(@RequestBody QueryParam param) {
@@ -185,6 +228,7 @@ public class ShowDataController {
             throw new ApiRuntimeException(500, e.toString());
         }
     }
+
     @ApiOperation(value = "获取压差离群数据")
     @PostMapping("/getVoltdiff")
     public ApiDTO getVoltdiff(@RequestBody QueryParam param) {
@@ -222,6 +266,7 @@ public class ShowDataController {
             throw new ApiRuntimeException(500, e.toString());
         }
     }
+
     @ApiOperation(value = "获取soh数据")
     @PostMapping("/getSoh")
     public ApiDTO getSoh(@RequestBody QueryParam param) {
@@ -248,12 +293,13 @@ public class ShowDataController {
             throw new ApiRuntimeException(500, e.toString());
         }
     }
+
     @ApiOperation(value = "获取sn列表")
     @PostMapping("/getSn")
     public ApiDTO getSn(@RequestBody QueryParam param) {
         List<String> snList = new ArrayList<>();
         List<ResultOriginData> resultOriginData = resultOriginDataService.list(new QueryWrapper<ResultOriginData>().eq("type", param.getTableId()));
-        resultOriginData.forEach(p->snList.add(p.getDeviceId()));
+        resultOriginData.forEach(p -> snList.add(p.getDeviceId()));
         return ApiDTO.ok(snList);
     }
 }

+ 18 - 9
src/main/java/com/qx/didi/dto/Response.java

@@ -110,38 +110,47 @@ public class Response {
     protected String  voltAlarmTime ;
 
     @ApiModelProperty(value = "电压离群值", name = "voltValue", accessMode = AccessMode.READ_ONLY)
-    protected String  voltValue ;
+    protected Float  voltValue ;
 
     @ApiModelProperty(value = "电压离群值与阈值插值", name = "voltValueDiff", accessMode = AccessMode.READ_ONLY)
-    protected String  voltValueDiff ;
+    protected Float  voltValueDiff ;
 
     @ApiModelProperty(value = "电压离群阈值", name = "voltThreshold", accessMode = AccessMode.READ_ONLY)
-    protected List<Integer>  voltThreshold ;
+    protected List<Object>  voltThreshold ;
+
+    @ApiModelProperty(value = "电压离群等级", name = "voltThreshold", accessMode = AccessMode.READ_ONLY)
+    protected String  voltLevel ;
 
     @ApiModelProperty(value = "电压压差离群报警时间", name = "voltDiffAlarmTime", accessMode = AccessMode.READ_ONLY)
     protected String  voltDiffAlarmTime ;
 
     @ApiModelProperty(value = "电压压差离群阈值", name = "voltDiffThreshold", accessMode = AccessMode.READ_ONLY)
-    protected List<Integer>  voltDiffThreshold ;
+    protected List<Object>  voltDiffThreshold ;
 
     @ApiModelProperty(value = "电压压差离群值", name = "voltDiffValue", accessMode = AccessMode.READ_ONLY)
-    protected String  voltDiffValue ;
+    protected Float  voltDiffValue ;
 
     @ApiModelProperty(value = "电压压差离群值与阈值插值", name = "voltDiffValueDiff", accessMode = AccessMode.READ_ONLY)
-    protected String  voltDiffValueDiff ;
+    protected Float  voltDiffValueDiff ;
+
+    @ApiModelProperty(value = "压差离群等级", name = "voltThreshold", accessMode = AccessMode.READ_ONLY)
+    protected String  voltDiffLevel ;
 
     @ApiModelProperty(value = "内短路离群报警时间", name = "innershortAlarmTime", accessMode = AccessMode.READ_ONLY)
     protected String  innershortAlarmTime ;
 
     @ApiModelProperty(value = "内短路离群阈值", name = "innershortThreshold", accessMode = AccessMode.READ_ONLY)
-    protected List<Integer>  innershortThreshold ;
+    protected List<Object>  innershortThreshold ;
 
 
     @ApiModelProperty(value = "内短路离群值", name = "innershortValue", accessMode = AccessMode.READ_ONLY)
-    protected String  innershortValue ;
+    protected Float  innershortValue ;
 
     @ApiModelProperty(value = "内短路离群值与阈值插值", name = "innershortValueDiff", accessMode = AccessMode.READ_ONLY)
-    protected String  innershortValueDiff ;
+    protected Float  innershortValueDiff ;
+
+    @ApiModelProperty(value = "内短路等级", name = "voltThreshold", accessMode = AccessMode.READ_ONLY)
+    protected String  innershortLevel ;
 
 
 }

+ 51 - 0
src/main/java/com/qx/didi/entity/ResultAlarmInfo.java

@@ -0,0 +1,51 @@
+package com.qx.didi.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author jek
+ * @since 2021-11-09
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@ApiModel(value="ResultAlarmInfo对象", description="")
+public class ResultAlarmInfo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    private String sn;
+
+    private Float value;
+
+    private Float thresholdUp;
+
+    private Float thresholdDown;
+
+    private Float valuediff;
+
+    @TableField("alarmTime")
+    private Date alarmtime;
+
+    private Integer cellnum;
+
+    private String type;
+
+    private String level;
+
+
+}

+ 16 - 0
src/main/java/com/qx/didi/mapper/ResultAlarmInfoMapper.java

@@ -0,0 +1,16 @@
+package com.qx.didi.mapper;
+
+import com.qx.didi.entity.ResultAlarmInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author jek
+ * @since 2021-11-09
+ */
+public interface ResultAlarmInfoMapper extends BaseMapper<ResultAlarmInfo> {
+
+}

+ 16 - 0
src/main/java/com/qx/didi/service/IResultAlarmInfoService.java

@@ -0,0 +1,16 @@
+package com.qx.didi.service;
+
+import com.qx.didi.entity.ResultAlarmInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author jek
+ * @since 2021-11-09
+ */
+public interface IResultAlarmInfoService extends IService<ResultAlarmInfo> {
+
+}

+ 20 - 0
src/main/java/com/qx/didi/service/impl/ResultAlarmInfoServiceImpl.java

@@ -0,0 +1,20 @@
+package com.qx.didi.service.impl;
+
+import com.qx.didi.entity.ResultAlarmInfo;
+import com.qx.didi.mapper.ResultAlarmInfoMapper;
+import com.qx.didi.service.IResultAlarmInfoService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author jek
+ * @since 2021-11-09
+ */
+@Service
+public class ResultAlarmInfoServiceImpl extends ServiceImpl<ResultAlarmInfoMapper, ResultAlarmInfo> implements IResultAlarmInfoService {
+
+}

+ 5 - 0
src/main/resources/mapper/ResultAlarmInfoMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.qx.didi.didi.mapper.ResultAlarmInfoMapper">
+
+</mapper>