Browse Source

调整转发新增、修改

xusl 1 năm trước cách đây
mục cha
commit
f3e105efa6

+ 2 - 2
backend/src/main/java/com/jiayue/pfr/controller/di/ElectricFieldController.java

@@ -31,7 +31,7 @@ public class ElectricFieldController {
     @PostMapping(value = "/updateElectricField")
     public SaResultRefit updateElectricField(@RequestBody ElectricField electricField) {
         try {
-            this.electricFieldService.saveOrUpdate(electricField);
+            electricFieldService.updateElectricField(electricField);
             return SaResultRefit.ok();
         } catch (Exception e) {
             e.printStackTrace();
@@ -48,7 +48,7 @@ public class ElectricFieldController {
     @GetMapping(value = "/")
     public SaResultRefit getElectricField() {
         try {
-            ElectricField electricField = this.electricFieldService.getOne(null);
+            ElectricField electricField = electricFieldService.queryElectricField();
             return SaResultRefit.data(electricField);
         } catch (Exception e) {
             e.printStackTrace();

+ 71 - 0
backend/src/main/java/com/jiayue/pfr/controller/di/ForecastForSendAttributeController.java

@@ -0,0 +1,71 @@
+package com.jiayue.pfr.controller.di;
+
+
+import com.jiayue.pfr.entity.ForecastForSendAttribute;
+import com.jiayue.pfr.service.di.impl.ForecastForSendAttributeService;
+import com.jiayue.pfr.util.SaResultRefit;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 转发点表的controller
+ *
+ * @author zy
+ * @version 3.0
+ */
+@Slf4j
+@RestController
+@RequestMapping("/dataExchange/ForecastForSendAttribute")
+public class
+ForecastForSendAttributeController {
+  @Autowired
+  ForecastForSendAttributeService forecastForSendAttributeService;
+
+  /**
+   * 根据预测功率的类型和预测节点查询点位
+   *
+   * @param forecastNode 预测功率的类型
+   * @param forcastType1 预测节点
+   * @return ResponseVO 统一返回值
+   */
+  @GetMapping(value = "/{forecastNode}/{forcastType}")
+  public SaResultRefit get(@PathVariable("forecastNode") Integer forecastNode, @PathVariable("forcastType") String forcastType1) {
+    try {
+      ForecastForSendAttribute.ForecastType forcastType = ForecastForSendAttribute.ForecastType.valueOf(forcastType1);
+      List<ForecastForSendAttribute> list = forecastForSendAttributeService.findByForecastNodeAndForecastType(forecastNode, forcastType.name());
+      return SaResultRefit.data(list);
+    } catch (Exception e) {
+      e.printStackTrace();
+      log.error("查询异常");
+      return SaResultRefit.errorTips("");
+    }
+  }
+
+  /**
+   * 被点属性
+   * 根据点位和预测功率类型查询预测属性的id
+   *
+   * @param pointNumber  点位
+   * @param forcastType1 预测节点
+   * @param forecastNode 预测节点
+   * @return ResponseVO 统一返回值
+   */
+  @GetMapping(value = "/getAttributeBypoint/{pointNumber}/{forecastNode}/{forcastType}")
+  public SaResultRefit getAttributeByPoint(@PathVariable("pointNumber") Integer pointNumber, @PathVariable("forecastNode") Integer forecastNode, @PathVariable("forcastType") String forcastType1) {
+    try {
+      ForecastForSendAttribute.ForecastType forcastType = ForecastForSendAttribute.ForecastType.valueOf(forcastType1);
+      List<ForecastForSendAttribute> list = forecastForSendAttributeService.findByPointNumberAndForecastNodeAndForecastType(pointNumber, forecastNode, forcastType.name());
+      return SaResultRefit.data(list);
+    } catch (Exception e) {
+      e.printStackTrace();
+      log.error("查询预测属性id异常");
+      return SaResultRefit.errorTips("");
+    }
+  }
+}

+ 387 - 0
backend/src/main/java/com/jiayue/pfr/controller/di/ProtocolSenderDataPointController.java

@@ -0,0 +1,387 @@
+package com.jiayue.pfr.controller.di;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.io.IoUtil;
+import cn.hutool.poi.excel.ExcelUtil;
+import cn.hutool.poi.excel.ExcelWriter;
+import com.alibaba.fastjson.JSONObject;
+import com.jiayue.pfr.entity.EquipmentAttribute;
+import com.jiayue.pfr.entity.ProtocolGatherDataPoint;
+import com.jiayue.pfr.entity.ProtocolSenderDataPoint;
+import com.jiayue.pfr.service.di.EquipmentAttributeService;
+import com.jiayue.pfr.service.di.impl.ProtocolGatherDataPointService;
+import com.jiayue.pfr.service.di.impl.ProtocolSenderDataPointService;
+import com.jiayue.pfr.util.SaResultRefit;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 转发点表的controller
+ *
+ * @author zy
+ * @version 3.0
+ */
+@Slf4j
+@RestController
+@RequestMapping("/dataExchange/senderProtocolDataPoint")
+//TODO 路径名未符合驼峰
+public class ProtocolSenderDataPointController {
+  @Autowired
+  ProtocolSenderDataPointService protocolSenderDataPointService;
+  @Autowired
+  ProtocolGatherDataPointService protocolGatherDataPointService;
+  @Autowired
+  EquipmentAttributeService equipmentAttributeService;
+
+  /**
+   * 查询所有转发点位
+   *
+   * @return ResponseVO response vo
+   */
+  @GetMapping("/senderDataPoint")
+  public SaResultRefit getSenderDataPoint() {
+    try {
+      return SaResultRefit.data(protocolSenderDataPointService.get());
+    } catch (Exception e) {
+      e.printStackTrace();
+      log.error("查询异常");
+      return SaResultRefit.errorTips("");
+    }
+  }
+
+  @GetMapping("/DataPoint")
+  public SaResultRefit getDataPoint() {
+    try {
+      List list = new ArrayList();
+      List<ProtocolSenderDataPoint> senderDataPoints = protocolSenderDataPointService.get();
+      List<ProtocolGatherDataPoint> gatherDataPoints = protocolGatherDataPointService.getAll();
+      senderDataPoints.sort(Comparator.comparing(ProtocolSenderDataPoint::getTunnelId).thenComparing(ProtocolSenderDataPoint::getProtocolPointNo));
+      List<EquipmentAttribute> equipments = equipmentAttributeService.getAll();
+      for (int i = 0; i < senderDataPoints.size(); i++) {
+        HashMap map = new HashMap();
+        if (senderDataPoints.get(i).getGatherPoint() != null) {
+          for (int j = 0; j < gatherDataPoints.size(); j++) {
+            if (senderDataPoints.get(i).getGatherPoint().intValue()==gatherDataPoints.get(j).getId().intValue()) {
+              int finalJ = j;
+              EquipmentAttribute equipmentAttribute = equipments.stream().filter(s->s.getId().intValue()==gatherDataPoints.get(finalJ).getEquipmentAttributeId().intValue()).collect(Collectors.toList()).get(0);
+              senderDataPoints.get(i).setEquipmentAttribute(equipmentAttribute);
+              map.put("sender", senderDataPoints.get(i));
+              map.put("equipmentId", gatherDataPoints.get(j).getEquipmentId());
+              map.put("equipmentAttributeId", gatherDataPoints.get(j).getEquipmentAttributeId());
+              list.add(map);
+            }
+          }
+        } else {
+          map.put("sender", senderDataPoints.get(i));
+          map.put("equipmentId", null);
+          map.put("equipmentAttributeId", null);
+          list.add(map);
+        }
+      }
+      return SaResultRefit.data(list);
+    } catch (Exception e) {
+      e.printStackTrace();
+      log.error("查询异常");
+      return SaResultRefit.errorTips("");
+    }
+  }
+
+
+//  @GetMapping("/maxProtocolNoInTunnel")
+//  public ResponseVO getMaxProtocolNoInTunnel(String tunnelId) {
+//    return ResponseVO.success(protocolSenderDataPointService.getMaxProtocolNoInTunnel(tunnelId));
+//  }
+
+  /**
+   * 通过通道id查询转发点表
+   *
+   * @param tunnelId 通道id
+   * @return ProtocolSenderDataPoint  protocol data  point
+   */
+  @GetMapping("/findByTunnelId/{tunnelId}")
+  public SaResultRefit findByTunnelId(@PathVariable("tunnelId") String tunnelId) {
+    try {
+      List<Map> list = protocolSenderDataPointService.getPointByTunnelId(Integer.parseInt(tunnelId));
+      return SaResultRefit.data(list);
+    } catch (Exception e) {
+      e.printStackTrace();
+      log.error("根据通道id查询异常");
+      return SaResultRefit.errorTips("");
+    }
+  }
+
+  /**
+   * 通过通道id和采集id查询转发表
+   *
+   * @param tunnelId
+   * @param equipmentId
+   * @param equipmentType
+   * @return ProtocolSenderDataPoint  protocol data  point
+   */
+  @GetMapping("/findByTunnelIdAndGatherPoint/{tunnelId}/{equipmentId}/{equipmentType}")
+  public SaResultRefit findByTunnelIdAndGatherPoint(@PathVariable("tunnelId") String tunnelId, @PathVariable("equipmentId") String equipmentId, @PathVariable("equipmentType") Integer equipmentType) {
+    //TODO 代码不合理  需郑媛修改   方法所放置的类也不对   @CreateBy 修唯
+    try {
+      List list = protocolSenderDataPointService.getPointByTunnelIdAndPointId(Integer.parseInt(tunnelId), equipmentId, equipmentType);
+      return SaResultRefit.data(list);
+    } catch (Exception e) {
+      e.printStackTrace();
+      log.error("根据采集点表查询异常");
+      return SaResultRefit.errorTips("");
+    }
+  }
+
+  /**
+   * 保存转发点位
+   *
+   * @param protocolSenderDataPoint 点位实体
+   * @return ResponseVO response vo
+   */
+  @PostMapping("/saveDataPoint")
+  public SaResultRefit saveSenderDataPoint(@RequestBody ProtocolSenderDataPoint protocolSenderDataPoint) {
+    try {
+      return SaResultRefit.data(protocolSenderDataPointService.save(protocolSenderDataPoint));
+    } catch (Exception e) {
+      e.printStackTrace();
+      log.error("保存转发点表异常");
+      return SaResultRefit.errorTips("");
+    }
+  }
+
+
+  /**
+   * 批量保存转发点位
+   *
+   * @return ResponseVO response vo
+   */
+//  @PostMapping("/batchSaveForecastPoint")
+//  public ResponseVO batchSaveSenderDataPoint(@RequestBody JSONObject param) throws BusinessException {
+//    String tunnelId = param.getString("tunnelId");
+//    String protocolPointType = param.getString("protocolPointType");
+//    String forecastType = param.getString("forecastType");
+//    Integer[] forecastNodes = param.getObject("forecastNodes", Integer[].class);
+//    Integer[] pointNumbers = param.getObject("pointNumbers", Integer[].class);
+//    if (StringUtils.isEmpty(tunnelId) ||
+//      StringUtils.isEmpty(protocolPointType) ||
+//      StringUtils.isEmpty(forecastType) ||
+//      forecastNodes == null ||
+//      forecastNodes.length == 0 ||
+//      pointNumbers == null ||
+//      pointNumbers.length == 0
+//    ) {
+//      throw new BusinessException("查询参数不足");
+//    }
+//    ProtocolSenderDataPoint protocolSenderDataPoint = null;
+//    List<ForecastForSendAttribute> forecastForSendAttributes = null;
+//    Integer maxPointNum = protocolSenderDataPointService.getMaxProtocolNoInTunnel(tunnelId);
+//    if (maxPointNum == null) {
+//      maxPointNum = 0;
+//    }
+//    for (int i : forecastNodes) {
+//      for (int j : pointNumbers) {
+//        //依次批量添加转发点位
+//        protocolSenderDataPoint = new ProtocolSenderDataPoint();
+//        protocolSenderDataPoint.setTunnelId(tunnelId);
+//        protocolSenderDataPoint.setDataSource(DataSourceEnum.FORECAST);
+//        protocolSenderDataPoint.setProtocolPointType(ProtocolDataType.valueOf(protocolPointType));
+//        //根据预测 类型 的天数 和 天数内的点位来找到 数据库里的具体属性
+//        forecastForSendAttributes = forecastForSendAttributeRepository.findByPointNumberAndForecastNodeAndForecastType(j, i, ForecastForSendAttribute.ForecastType.valueOf(forecastType));
+//        if (forecastForSendAttributes.size() == 1) {
+//          protocolSenderDataPoint.setProtocolPointNo(++maxPointNum);
+//          protocolSenderDataPoint.setForecastForSendAttribute(forecastForSendAttributes.get(0));
+//          protocolSenderDataPointService.save(protocolSenderDataPoint);
+//        }
+//      }
+//    }
+//    return ResponseVO.success();
+//  }
+
+  /**
+   * 修改转发点表
+   *
+   * @param protocolSenderDataPoint 点位实体
+   * @return ResponseVO response vo
+   */
+  @PutMapping("/updateDataPoint")
+  public SaResultRefit updateSenderDataPoint(@RequestBody ProtocolSenderDataPoint protocolSenderDataPoint) {
+    try {
+      return SaResultRefit.data(protocolSenderDataPointService.updateById(protocolSenderDataPoint));
+    } catch (Exception e) {
+      e.printStackTrace();
+      log.error("修改转发点表异常");
+      return SaResultRefit.errorTips("");
+    }
+  }
+
+  /**
+   * 删除转发点表
+   *
+   * @param id 点表id
+   * @return ResponseVO response vo
+   */
+  @DeleteMapping("/deleteDataPoint/{id}")
+  public SaResultRefit deleteById(@PathVariable("id") Integer id) {
+    try {
+      protocolSenderDataPointService.deleteById(id);
+      return SaResultRefit.ok();
+    } catch (Exception e) {
+      e.printStackTrace();
+      log.error("删除转发点表异常");
+      return SaResultRefit.errorTips("");
+    }
+  }
+
+//  @DeleteMapping("/batchDeleteSenderDataPoint/{pointIds}")
+//  public ResponseVO batchDeleteGatherDataPoint(@PathVariable Integer[] pointIds) {
+//    try {
+//      for (int i = 0; i < pointIds.length; i++) {
+//        ProtocolSenderDataPoint point = new ProtocolSenderDataPoint();
+//        point.setId(pointIds[i]);
+//        protocolSenderDataPointService.deleteAll(point);
+//      }
+//      return ResponseVO.success(1);
+//    } catch (Exception e) {
+//      e.printStackTrace();
+//      log.error("批量删除异常");
+//      return ResponseVO.fail(e);
+//    }
+//  }
+
+  /**
+   * 手动置数
+   *
+   * @param pointId 点id
+   * @param value   值
+   */
+//  @GetMapping("/setValueByManual/{pointId}/{value}")
+//  public ResponseVO setValueByManual(@PathVariable Integer pointId,@PathVariable Double value) throws DataExchangeException {
+//    ProtocolSenderDataPoint dataPoint=new ProtocolSenderDataPoint();
+//    dataPoint.setId(pointId);
+//    List<ProtocolSenderDataPoint> dataPointList = protocolSenderDataPointService.get(dataPoint);
+//    if(dataPointList!=null && dataPointList.size()==1){
+//      dataPoint=dataPointList.get(0);
+//      DataSenderInterface tunnel = (DataSenderInterface)ProtocolTunnelContainer.getInstance().getTunnel(dataPoint.getTunnelId());
+//      if(tunnel==null){
+//        return ResponseVO.fail(new BusinessException("关联的通道未启用或未关联通道"));
+//      }
+//      tunnel.setValueByManual(dataPoint,value);
+//    }
+//    return ResponseVO.success();
+//  }
+
+  /*
+  *
+  * 导出
+  */
+//  @RequestMapping("/export")
+//  public void export(HttpServletResponse response) {
+//    try{
+//      ExcelWriter writer = ExcelUtil.getWriter();
+//      List<String> row2 = CollUtil
+//        .newArrayList("id", "数据源", "倍率", "通道名", "通道点位", "通道数据类型", "设备名", "设备类型", "设备属性", "预测数据属性", "预测天数(天/时)", "预测数据点位");
+//      List<List<String>> rows1 = CollUtil.newArrayList();
+//      rows1.add(row2);
+//      List<ProtocolSenderDataPoint> senderDataPoints = protocolSenderDataPointService.get();
+//      List<ProtocolGatherDataPoint> gatherDataPoints = protocolGatherDataPointService.getAll();
+//      List<BaseTunnelInfo> baseTunnelInfos = tunnelInfoService.findByTunnelType("Slave");
+//      senderDataPoints.sort(Comparator.comparing(ProtocolSenderDataPoint::getTunnelId).thenComparing(ProtocolSenderDataPoint::getProtocolPointNo));
+//      for (int i = 0; i < senderDataPoints.size(); i++) {
+//        HashMap map = new HashMap();
+//        List<String> row = CollUtil.newArrayList();
+//        String name = "";
+//        for(BaseTunnelInfo baseTunnelInfo : baseTunnelInfos){
+//          if(baseTunnelInfo.getId().equals(senderDataPoints.get(i).getTunnelId())){
+//            name = baseTunnelInfo.getTunnelName();
+//          }
+//        }
+//        if (senderDataPoints.get(i).getDataSource().toString().equals("GATHER")) {
+//          for (int j = 0; j < gatherDataPoints.size(); j++) {
+//            if (senderDataPoints.get(i).getGatherPoint().equals(gatherDataPoints.get(j).getId())) {
+//              List<AbstractEquipmentInfo> abstractEquipmentInfos = equipmentInfoService.findByEqType(gatherDataPoints.get(j).getEquipmentAttribute().getEquipmentType());
+//              String ename = "";
+//              for(AbstractEquipmentInfo abstractEquipmentInfo : abstractEquipmentInfos){
+//                if(abstractEquipmentInfo.getId().equals(gatherDataPoints.get(j).getEquipmentId())){
+//                  ename = abstractEquipmentInfo.getName();
+//                }
+//              }
+//              row.add(senderDataPoints.get(i).getId().toString());
+//              row.add(senderDataPoints.get(i).getDataSource().getMessage());
+//              row.add(senderDataPoints.get(i).getMagnification().toString());
+//              row.add(name);
+//              row.add(senderDataPoints.get(i).getProtocolPointNo().toString());
+//              row.add(senderDataPoints.get(i).getProtocolPointType().getDescribe());
+//              row.add(ename);
+//              row.add(gatherDataPoints.get(j).getEquipmentAttribute().getEquipmentType().getMessage());
+//              row.add(gatherDataPoints.get(j).getEquipmentAttribute().getExplanation());
+//              row.add("");
+//              row.add("");
+//              row.add("");
+//              rows1.add(row);
+//              row = null;
+//            }
+//          }
+//        }else {
+//          String forecastNode = "";
+//          if(senderDataPoints.get(i).getForecastForSendAttribute().getForecastType().toString().equals("ULTRA_SHORT_AVAILABLE") || senderDataPoints.get(i).getForecastForSendAttribute().getForecastType().toString().equals("ULTRA_SHORT_THEORETICAL")){
+//            switch (senderDataPoints.get(i).getForecastForSendAttribute().getForecastNode()){
+//              case 0: forecastNode = "第一小时";
+//                break;
+//              case 1: forecastNode = "第二小时";
+//                break;
+//              case 2: forecastNode = "第三小时";
+//                break;
+//              case 3: forecastNode = "第四小时";
+//                break;
+//            }
+//          } else {
+//            forecastNode = "第" + (senderDataPoints.get(i).getForecastForSendAttribute().getForecastNode()+1) + "天";
+//          }
+//          row.add(senderDataPoints.get(i).getId().toString());
+//          row.add(senderDataPoints.get(i).getDataSource().getMessage());
+//          row.add(senderDataPoints.get(i).getMagnification().toString());
+//          row.add(name);
+//          row.add(senderDataPoints.get(i).getProtocolPointNo().toString());
+//          row.add(senderDataPoints.get(i).getProtocolPointType().getDescribe());
+//          row.add("");
+//          row.add("");
+//          row.add("");
+//          row.add(senderDataPoints.get(i).getForecastForSendAttribute().getForecastType().getDescribe());
+//          //row.add(senderDataPoints.get(i).getForecastForSendAttribute().getForecastNode().toString());
+//          row.add(forecastNode);
+//          row.add("第" + senderDataPoints.get(i).getForecastForSendAttribute().getPointNumber().toString() + "节点");
+//          rows1.add(row);
+//          row = null;
+//        }
+//      }
+//      writer.setColumnWidth(0, 10);
+//        for(int i = 0 ; i<12;i++){
+//        writer.setColumnWidth(i+1, 15);
+//      }
+//      writer.write(rows1,true);
+//      String now = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
+//      String fileName = "转发点表" + now + ".xls";
+//      response.setContentType("application/x-msdownload;charset=utf-8");
+//      response.setHeader("Content-disposition", "attachment; filename=" + URLEncoder.encode(fileName, "UTF-8"));
+//      ServletOutputStream out= null;
+//      out = response.getOutputStream();
+//      writer.flush(out, true);
+//      // 关闭writer,释放内存
+//      writer.close();
+//      //此处记得关闭输出Servlet流
+//      IoUtil.close(out);
+//    }catch (IOException e) {
+//      e.printStackTrace();
+//    }
+//  }
+}

+ 81 - 0
backend/src/main/java/com/jiayue/pfr/entity/ForecastForSendAttribute.java

@@ -0,0 +1,81 @@
+package com.jiayue.pfr.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.Getter;
+
+
+/**
+ * 为转发设定的预测数据转发类型
+ *
+ * @author 修唯xiuwei
+ * @version 3.0
+ */
+@Data
+public class ForecastForSendAttribute {
+
+    /**
+     * Id
+     */
+    @TableId(type = IdType.AUTO)
+    Integer id;
+
+
+    /**
+     * 预测数据的点位顺序
+     */
+    Integer pointNumber;
+
+
+    /**
+     * 该点隶属的预测节点  预测点 所属 天数/小时数
+     * 超短期 未来 0 ,1 ,2 ,3 小时
+     * 短期   未来 0 ,1 ,2 ,3 ,4 , 5, 6, 7,8,9  最长10天的预测
+     */
+    Integer forecastNode;
+
+
+    /**
+     * 预测功率的类型
+     */
+    String forecastType;
+
+
+    /**
+     * 预测数据的类型
+     */
+    @Getter
+    @AllArgsConstructor
+    public enum ForecastType {
+
+        /**
+         * 短期及超短期的可用和理论功率
+         */
+        SHORT_AVAILABLE(0, "短期可用功率"),
+        /**
+         * 短期理论功率
+         */
+        SHORT_THEORETICAL(1, "短期理论功率"),
+        /**
+         * 超短期可用功率
+         */
+        ULTRA_SHORT_AVAILABLE(2, "超短期可用功率"),
+        /**
+         * 超短期理论功率
+         */
+        ULTRA_SHORT_THEORETICAL(3, "超短期理论功率");
+
+        /**
+         * 编号
+         */
+        Integer code;
+
+        /**
+         * 描述
+         */
+        String describe;
+    }
+
+}

+ 3 - 1
backend/src/main/java/com/jiayue/pfr/entity/ProtocolSenderDataPoint.java

@@ -1,6 +1,7 @@
 package com.jiayue.pfr.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.jiayue.pfr.backenum.DataSourceEnum;
@@ -73,5 +74,6 @@ public class ProtocolSenderDataPoint {
      * 场站标识
      */
     private String stationCode;
-
+    @TableField(exist = false)
+    EquipmentAttribute equipmentAttribute;
 }

+ 3 - 1
backend/src/main/java/com/jiayue/pfr/entity/SendLog.java

@@ -2,6 +2,7 @@ package com.jiayue.pfr.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
 
@@ -13,8 +14,9 @@ import lombok.Data;
  * @since 2021/4/21
  */
 @Data
+@TableName("t_send_log")
 public class SendLog extends BaseEntity{
-    @TableId(value = "id", type = IdType.AUTO)
+    @TableId(type = IdType.AUTO)
     private Integer id;
     /*通道名称*/
     private String tunnelName;

+ 5 - 1
backend/src/main/java/com/jiayue/pfr/job/GetFmJob.java

@@ -6,7 +6,9 @@ import com.jiayue.pfr.protocol.frequency.DataBean;
 import com.jiayue.pfr.protocol.frequency.DataBeanPacker;
 import com.jiayue.pfr.service.alg.listener.GetFmEvent;
 import com.jiayue.pfr.service.cmf.SysParameterService;
+import com.jiayue.pfr.service.di.impl.ElectricFieldService;
 import org.apache.commons.lang3.time.DateFormatUtils;
+import org.checkerframework.checker.units.qual.A;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,6 +27,8 @@ public class GetFmJob {
     SysParameterService sysParameterService;
     @Autowired
     ApplicationEventPublisher applicationEventPublisher;
+    @Autowired
+    ElectricFieldService electricFieldService;
 
     private static final Logger fLogger = LoggerFactory.getLogger("FLogger");
 
@@ -44,7 +48,7 @@ public class GetFmJob {
         fmDataBeanDto.setActivePower(CacheConstants.activePower);
         long currentTime = System.currentTimeMillis();
         fmDataBeanDto.setTime(DateFormatUtils.format(currentTime, "yyyy-MM-dd HH:mm:ss.SSS"));
-
+        fmDataBeanDto.setCapacity(electricFieldService.queryElectricField().getCapacity());
 //        CacheConstants.lastFmDataBeanDto = fmDataBeanDto;
 //        fLogger.info("获取频率定时");
         // 调用事件

+ 16 - 0
backend/src/main/java/com/jiayue/pfr/mapper/di/ForecastForSendAttributeMapper.java

@@ -0,0 +1,16 @@
+package com.jiayue.pfr.mapper.di;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jiayue.pfr.entity.ForecastForSendAttribute;
+
+import java.util.List;
+
+/**
+ * 发送预测数据属性操作仓库
+ *
+ * @author 修唯xiuwei
+ * @version 3.0
+ */
+public interface ForecastForSendAttributeMapper extends BaseMapper<ForecastForSendAttribute> {
+}

+ 3 - 5
backend/src/main/java/com/jiayue/pfr/service/alg/listener/SendFmSocketListener.java

@@ -1,8 +1,11 @@
 package com.jiayue.pfr.service.alg.listener;
 
 import cn.hutool.json.JSONUtil;
+import com.jiayue.pfr.entity.ElectricField;
 import com.jiayue.pfr.service.cmf.SysParameterService;
 import com.jiayue.pfr.service.di.WebSocketServer;
+import com.jiayue.pfr.service.di.impl.ElectricFieldService;
+import org.checkerframework.checker.units.qual.A;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -23,15 +26,10 @@ import java.math.BigDecimal;
 public class SendFmSocketListener implements ApplicationListener<GetFmEvent> {
     private static final Logger fLogger = LoggerFactory.getLogger("FLogger");
 
-    @Autowired
-    SysParameterService sysParameterService;
-
     @Async
     @Override
     public void onApplicationEvent(GetFmEvent getFmEvent) {
         try {
-            String capacity = sysParameterService.queryByKey("capacity","300");
-            getFmEvent.getFmDataBeanDto().setCapacity(new BigDecimal(capacity));
             WebSocketServer.sendInfo(JSONUtil.toJsonStr(getFmEvent.getFmDataBeanDto()));
         } catch (IOException e) {
             throw new RuntimeException(e);

+ 23 - 0
backend/src/main/java/com/jiayue/pfr/service/di/impl/ElectricFieldService.java

@@ -5,7 +5,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.jiayue.pfr.entity.ElectricField;
 import com.jiayue.pfr.mapper.di.ElectricFieldMapper;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.cache.annotation.CachePut;
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
 
 /**
  * 场站信息业务层
@@ -17,4 +21,23 @@ import org.springframework.stereotype.Service;
 @Service
 @Slf4j
 public class ElectricFieldService  extends ServiceImpl<ElectricFieldMapper, ElectricField> {
+    /**
+     * 查询场站信息
+     * @return ElectricField
+     */
+    @Cacheable(cacheNames = "pfrcache", key = "'ef'")
+    public ElectricField queryElectricField(){
+        return this.getOne(null);
+    }
+
+    /**
+     * 修改场站信息
+     *
+     * @param electricField 参数实体
+     */
+    @Transactional(propagation = Propagation.SUPPORTS)
+    @CachePut(cacheNames = "pfrcache", key = "'ef'")
+    public void updateElectricField(ElectricField electricField) {
+        this.updateById(electricField);
+    }
 }

+ 47 - 0
backend/src/main/java/com/jiayue/pfr/service/di/impl/ForecastForSendAttributeService.java

@@ -0,0 +1,47 @@
+package com.jiayue.pfr.service.di.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.jiayue.pfr.entity.ForecastForSendAttribute;
+import com.jiayue.pfr.entity.ProtocolGatherDataPoint;
+import com.jiayue.pfr.mapper.di.ForecastForSendAttributeMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+
+/**
+ * 点表表的操作service类
+ *
+ * @author 修唯xiuwei
+ * @version 3.0
+ */
+@Service
+public class ForecastForSendAttributeService {
+
+  @Autowired
+  ForecastForSendAttributeMapper forecastForSendAttributeMapper;
+
+
+  /**
+   * 通过预测节点发现和预测类型
+   * 根据预测功率的类型和预测节点查询点位
+   *
+   * @return ProtocolDataPoint by tunnel id
+   */
+  public List<ForecastForSendAttribute> findByForecastNodeAndForecastType(Integer forecastNode, String forecastType) {
+    QueryWrapper<ForecastForSendAttribute> wrapper = new QueryWrapper<>();
+    wrapper.eq("forecast_node", forecastNode);
+    wrapper.eq("forecast_type", forecastType);
+    return this.forecastForSendAttributeMapper.selectList(wrapper);
+  }
+
+  public List<ForecastForSendAttribute> findByPointNumberAndForecastNodeAndForecastType(Integer pointNumber, Integer forecastNode, String forecastType) {
+    QueryWrapper<ForecastForSendAttribute> wrapper = new QueryWrapper<>();
+    wrapper.eq("point_number", pointNumber);
+    wrapper.eq("forecast_node", forecastNode);
+    wrapper.eq("forecast_type", forecastType);
+    return this.forecastForSendAttributeMapper.selectList(wrapper);
+  }
+
+}

+ 17 - 17
backend/src/main/java/com/jiayue/pfr/service/di/impl/ProtocolGatherDataPointService.java

@@ -133,30 +133,30 @@ public class ProtocolGatherDataPointService {
 //    return this.protocolGatherDataPointRepository.findAll(Example.of(protocolDataPoint));
 //  }
 //
-//
-//  /**
-//   * 查询所有点位信息描述的采集点位
-//   *
-//   * @return ProtocolGatherDataPoint list
-//   */
-//  public List<ProtocolGatherDataPoint> getAll() {
-//    return this.protocolGatherDataPointRepository.findAll();
-//  }
-//
+
+  /**
+   * 查询所有点位信息描述的采集点位
+   *
+   * @return ProtocolGatherDataPoint list
+   */
+  public List<ProtocolGatherDataPoint> getAll() {
+    return this.protocolGatherDataPointMapper.selectList(null);
+  }
+
   /**
    * 根据id删除点位
    *
    * @param id 点位ID
    */
   public void deleteById(Integer id) {
+    List<ProtocolSenderDataPoint> protocolSenderDataPointList = protocolSenderDataPointMapper.selectList(null);
+    List<ProtocolSenderDataPoint> protocolSenderDataPoints = protocolSenderDataPointList.stream().filter(w -> w.getGatherPoint() != null && w.getGatherPoint().intValue()==id.intValue()).collect(Collectors.toList());
     this.protocolGatherDataPointMapper.deleteById(id);
-//    List<ProtocolSenderDataPoint> protocolSenderDataPointList = protocolSenderDataPointMapper.selectList(null);
-//    List<ProtocolSenderDataPoint> protocolSenderDataPoints = protocolSenderDataPointList.stream().filter(w -> w.getGatherPoint() != null && w.getGatherPoint().equals(id)).collect(Collectors.toList());
-//    if (protocolSenderDataPoints.size() > 0) {
-//      for (ProtocolSenderDataPoint protocolSenderDataPoint : protocolSenderDataPoints) {
-//        protocolSenderDataPointMapper.deleteById(protocolSenderDataPoint.getId());
-//      }
-//    }
+    if (protocolSenderDataPoints.size() > 0) {
+      for (ProtocolSenderDataPoint protocolSenderDataPoint : protocolSenderDataPoints) {
+        protocolSenderDataPointMapper.deleteById(protocolSenderDataPoint.getId());
+      }
+    }
   }
 
   /**

+ 141 - 135
backend/src/main/java/com/jiayue/pfr/service/di/impl/ProtocolSenderDataPointService.java

@@ -2,6 +2,7 @@ package com.jiayue.pfr.service.di.impl;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.jiayue.pfr.backenum.EquipmentTypeEnum;
 import com.jiayue.pfr.entity.ProtocolGatherDataPoint;
 import com.jiayue.pfr.entity.ProtocolSenderDataPoint;
 import com.jiayue.pfr.mapper.di.ProtocolSenderDataPointMapper;
@@ -65,14 +66,14 @@ public class ProtocolSenderDataPointService {
 //	}
 //
 //
-//	/**
-//	 * 查询所有转发点位
-//	 *
-//	 * @return ProtocolSenderDataPoint
-//	 */
-//	public List<ProtocolSenderDataPoint> get() {
-//		return this.protocolSenderDataPointRepository.findAll();
-//	}
+	/**
+	 * 查询所有转发点位
+	 *
+	 * @return ProtocolSenderDataPoint
+	 */
+	public List<ProtocolSenderDataPoint> get() {
+		return this.protocolSenderDataPointMapper.selectList(null);
+	}
 //  /**
 //   * 查询所有转发点位
 //   *
@@ -101,39 +102,49 @@ public class ProtocolSenderDataPointService {
 		wrapper.eq("tunnel_id", tunnelId);
 		return this.protocolSenderDataPointMapper.selectList(wrapper);
 	}
-//
-//	/**
-//	 * 通过采集点表查询转发点表
-//	 *
-//	 * @param gatherPoint 采集点表
-//	 * @return ProtocolSenderDataPoint  protocol data  point
-//	 */
-//	public List<ProtocolSenderDataPoint> findByGatherPoint(Integer gatherPoint) {
-//		return this.protocolSenderDataPointRepository.findByGatherPoint(gatherPoint);
-//	}
-//
-//	/**
-//	 * 通过通道id,采集点表查询转发点表
-//	 *
-//	 * @param tunnelId    通道id
-//	 * @param gatherPoint 采集点表
-//	 * @return ProtocolSenderDataPoint  protocol data  point
-//	 */
-//	public List<ProtocolSenderDataPoint> findByTunnelIdAndGatherPoint(String tunnelId, Integer gatherPoint) {
-//		return protocolSenderDataPointRepository.findByTunnelIdAndAndGatherPoint(tunnelId, gatherPoint);
-//	}
-//
-//	/**
-//	 * 保存转发点表
-//	 *
-//	 * @param protocolSenderDataPoint 点位实体
-//	 * @return ProtocolSenderDataPoint Protocol Sender Data Point
-//	 */
-//
-//	public ProtocolSenderDataPoint save(ProtocolSenderDataPoint protocolSenderDataPoint) {
-//		protocolSenderDataPoint.setStationCode(SpringContextHolder.getBean(ElectricFieldService.class).get().getStationCode());
-//		return this.protocolSenderDataPointRepository.save(protocolSenderDataPoint);
-//	}
+
+	/**
+	 * 通过采集点表查询转发点表
+	 *
+	 * @param gatherPoint 采集点表
+	 * @return ProtocolSenderDataPoint  protocol data  point
+	 */
+	public List<ProtocolSenderDataPoint> findByGatherPoint(Integer gatherPoint) {
+		QueryWrapper<ProtocolSenderDataPoint> wrapper = new QueryWrapper<>();
+		wrapper.eq("gather_point", gatherPoint);
+		return this.protocolSenderDataPointMapper.selectList(wrapper);
+	}
+
+	/**
+	 * 通过通道id,采集点表查询转发点表
+	 *
+	 * @param tunnelId    通道id
+	 * @param gatherPoint 采集点表
+	 * @return ProtocolSenderDataPoint  protocol data  point
+	 */
+	public List<ProtocolSenderDataPoint> findByTunnelIdAndGatherPoint(Integer tunnelId, Integer gatherPoint) {
+		QueryWrapper<ProtocolSenderDataPoint> wrapper = new QueryWrapper<>();
+		wrapper.eq("gather_point", gatherPoint);
+		wrapper.eq("tunnel_id", tunnelId);
+		return this.protocolSenderDataPointMapper.selectList(wrapper);
+	}
+
+	/**
+	 * 保存转发点表
+	 *
+	 * @param protocolSenderDataPoint 点位实体
+	 * @return ProtocolSenderDataPoint Protocol Sender Data Point
+	 */
+
+	public ProtocolSenderDataPoint save(ProtocolSenderDataPoint protocolSenderDataPoint) {
+		this.protocolSenderDataPointMapper.insert(protocolSenderDataPoint);
+		return protocolSenderDataPoint;
+	}
+
+	public ProtocolSenderDataPoint updateById(ProtocolSenderDataPoint protocolSenderDataPoint) {
+		this.protocolSenderDataPointMapper.updateById(protocolSenderDataPoint);
+		return protocolSenderDataPoint;
+	}
 //
 //  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
 //  public ProtocolSenderDataPoint saveCloud(ProtocolSenderDataPoint protocolSenderDataPoint) {
@@ -152,103 +163,98 @@ public class ProtocolSenderDataPointService {
 //	}
 //
 //
-//	/**
-//	 * 删除转发点表
-//	 *
-//	 * @param id 点表id
-//	 */
-//	public void deleteById(Integer id) {
-//		try {
-//			this.protocolSenderDataPointRepository.deleteById(id);
-//		} catch (Exception e) {
-//			e.printStackTrace();
-//		}
-//	}
+	/**
+	 * 删除转发点表
+	 *
+	 * @param id 点表id
+	 */
+	public void deleteById(Integer id) {
+		try {
+			this.protocolSenderDataPointMapper.deleteById(id);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
 //
 //	public void deleteAll(ProtocolSenderDataPoint point) {
 //		protocolSenderDataPointRepository.delete(point);
 //	}
 //
-//	/**
-//	 * 通过通道id查询转发点表
-//	 *
-//	 * @param tunnelId 通道id
-//	 * @return ProtocolSenderDataPoint  protocol data  point
-//	 */
-//	public List<Map> getPointByTunnelId(String tunnelId) {
-//		List list = new ArrayList();
-//		List<ProtocolSenderDataPoint> senderDataPoints = protocolSenderDataPointRepository.findByTunnelId(tunnelId);
-//		List<ProtocolGatherDataPoint> gatherDataPoints = protocolGatherDataPointService.getAll();
-//		senderDataPoints.sort(Comparator.comparing(ProtocolSenderDataPoint::getProtocolPointNo));
-//		for (int i = 0; i < senderDataPoints.size(); i++) {
-//			Map<String, Object> map = new HashMap();
-//			if (senderDataPoints.get(i).getGatherPoint() != null) {
-//				for (int j = 0; j < gatherDataPoints.size(); j++) {
-//					if (senderDataPoints.get(i).getGatherPoint().equals(gatherDataPoints.get(j).getId())) {
-//						map.put("sender", senderDataPoints.get(i));
-//						map.put("equipmentId", gatherDataPoints.get(j).getEquipmentId());
-//						map.put("equipmentAttribute", gatherDataPoints.get(j).getEquipmentAttribute());
-//						list.add(map);
-//					}
-//				}
-//			} else {
-//				map.put("sender", senderDataPoints.get(i));
-//				map.put("equipmentId", null);
-//				map.put("equipmentAttribute", null);
-//				list.add(map);
-//			}
-//		}
-//		return list;
-//	}
-//
-//	/**
-//	 * 通过通道id和采集id查询转发表
-//	 *
-//	 * @param tunnelId
-//	 * @param equipmentId
-//	 * @param equipmentType
-//	 * @return list
-//	 */
-//	public List getPointByTunnelIdAndPointId(String tunnelId, String equipmentId, Integer equipmentType) {
-//		List list = new ArrayList();
-//		if (equipmentId.equals("ALL")) {
-//			list = getPointByTunnelId(tunnelId);
-//			return list;
-//		}
-//		ProtocolGatherDataPoint point = new ProtocolGatherDataPoint();
-//		point.setEquipmentId(Integer.valueOf(equipmentId));
-//		EquipmentAttribute attribute1 = new EquipmentAttribute();
-//		attribute1.setEquipmentType(EquipmentTypeEnum.valueOf(equipmentType));
-//		point.setEquipmentAttribute(attribute1);
-//		List<ProtocolGatherDataPoint> points = this.protocolGatherDataPointService.get(point);
-//		for (int i = 0; i < points.size(); i++) {
-//			List<ProtocolSenderDataPoint> senderDataPoints = new ArrayList<>();
-//			if (tunnelId.equals("ALL")) {
-//				senderDataPoints = protocolSenderDataPointRepository.findByGatherPoint(points.get(i).getId());
-//			} else {
-//				senderDataPoints = protocolSenderDataPointRepository.findByTunnelIdAndAndGatherPoint(tunnelId, points.get(i).getId());
-//			}
-//			senderDataPoints.sort(Comparator.comparing(ProtocolSenderDataPoint::getProtocolPointNo));
-//			List<ProtocolGatherDataPoint> gatherDataPoints = protocolGatherDataPointService.getAll();
-//			for (int k = 0; k < senderDataPoints.size(); k++) {
-//				Map<String, Object> map = new HashMap();
-//				if (senderDataPoints.get(k).getGatherPoint() != null) {
-//					for (int r = 0; r < gatherDataPoints.size(); r++) {
-//						if (senderDataPoints.get(k).getGatherPoint().equals(gatherDataPoints.get(r).getId())) {
-//							map.put("sender", senderDataPoints.get(k));
-//							map.put("equipmentId", gatherDataPoints.get(r).getEquipmentId());
-//							map.put("equipmentAttribute", gatherDataPoints.get(r).getEquipmentAttribute());
-//							list.add(map);
-//						}
-//					}
-//				} else {
-//					map.put("sender", senderDataPoints.get(k));
-//					map.put("equipmentId", null);
-//					map.put("equipmentAttribute", null);
-//					list.add(map);
-//				}
-//			}
-//		}
-//		return list;
-//	}
+	/**
+	 * 通过通道id查询转发点表
+	 *
+	 * @param tunnelId 通道id
+	 * @return ProtocolSenderDataPoint  protocol data  point
+	 */
+	public List<Map> getPointByTunnelId(Integer tunnelId) {
+		List list = new ArrayList();
+		List<ProtocolSenderDataPoint> senderDataPoints = this.getByTunnelId(tunnelId);
+		List<ProtocolGatherDataPoint> gatherDataPoints = protocolGatherDataPointService.getAll();
+		senderDataPoints.sort(Comparator.comparing(ProtocolSenderDataPoint::getProtocolPointNo));
+		for (int i = 0; i < senderDataPoints.size(); i++) {
+			Map<String, Object> map = new HashMap();
+			if (senderDataPoints.get(i).getGatherPoint() != null) {
+				for (int j = 0; j < gatherDataPoints.size(); j++) {
+					if (senderDataPoints.get(i).getGatherPoint().equals(gatherDataPoints.get(j).getId())) {
+						map.put("sender", senderDataPoints.get(i));
+						map.put("equipmentId", gatherDataPoints.get(j).getEquipmentId());
+						map.put("equipmentAttribute", gatherDataPoints.get(j).getEquipmentAttribute());
+						list.add(map);
+					}
+				}
+			} else {
+				map.put("sender", senderDataPoints.get(i));
+				map.put("equipmentId", null);
+				map.put("equipmentAttribute", null);
+				list.add(map);
+			}
+		}
+		return list;
+	}
+
+	/**
+	 * 通过通道id和采集id查询转发表
+	 *
+	 * @param tunnelId
+	 * @param equipmentId
+	 * @param equipmentType
+	 * @return list
+	 */
+	public List getPointByTunnelIdAndPointId(Integer tunnelId, String equipmentId, Integer equipmentType) {
+		List list = new ArrayList();
+		if (equipmentId.equals("ALL")) {
+			list = getPointByTunnelId(tunnelId);
+			return list;
+		}
+		List<ProtocolGatherDataPoint> points = this.protocolGatherDataPointService.getByEquipmentId(Integer.parseInt(equipmentId), EquipmentTypeEnum.valueOf(equipmentType).name());
+		for (int i = 0; i < points.size(); i++) {
+			List<ProtocolSenderDataPoint> senderDataPoints = new ArrayList<>();
+			if (tunnelId.equals("ALL")) {
+				senderDataPoints = this.findByGatherPoint(points.get(i).getId());
+			} else {
+				senderDataPoints = this.findByTunnelIdAndGatherPoint(tunnelId, points.get(i).getId());
+			}
+			senderDataPoints.sort(Comparator.comparing(ProtocolSenderDataPoint::getProtocolPointNo));
+			List<ProtocolGatherDataPoint> gatherDataPoints = protocolGatherDataPointService.getAll();
+			for (int k = 0; k < senderDataPoints.size(); k++) {
+				Map<String, Object> map = new HashMap();
+				if (senderDataPoints.get(k).getGatherPoint() != null) {
+					for (int r = 0; r < gatherDataPoints.size(); r++) {
+						if (senderDataPoints.get(k).getGatherPoint().equals(gatherDataPoints.get(r).getId())) {
+							map.put("sender", senderDataPoints.get(k));
+							map.put("equipmentId", gatherDataPoints.get(r).getEquipmentId());
+							map.put("equipmentAttribute", gatherDataPoints.get(r).getEquipmentAttribute());
+							list.add(map);
+						}
+					}
+				} else {
+					map.put("sender", senderDataPoints.get(k));
+					map.put("equipmentId", null);
+					map.put("equipmentAttribute", null);
+					list.add(map);
+				}
+			}
+		}
+		return list;
+	}
 }

+ 8 - 8
ui/src/views/dataexchange/gatherdatapoint/index.vue

@@ -16,14 +16,14 @@
           <vxe-button status="primary" icon="fa fa-files-o" @click="multiAdd=true">批量新增</vxe-button>
           <vxe-button status="primary" icon="fa fa-files-o" @click="batchDeletePoint()">批量删除</vxe-button>
           <vxe-button status="primary" icon="vxe-icon--refresh roll" @click="refushAll()">刷新数据点</vxe-button>
-          <vxe-button status="primary" icon="vxe-icon--download" @click="exportDataEvent()">导出</vxe-button>
-          <vxe-button status="primary" icon="vxe-icon--download" @click="download()">点击下载模板</vxe-button>
-          <vxe-button
-            status="primary"
-            icon="el-icon-upload2"
-            @click="uploadFile"
-          >上传文件
-          </vxe-button>
+<!--          <vxe-button status="primary" icon="vxe-icon&#45;&#45;download" @click="exportDataEvent()">导出</vxe-button>-->
+<!--          <vxe-button status="primary" icon="vxe-icon&#45;&#45;download" @click="download()">点击下载模板</vxe-button>-->
+<!--          <vxe-button-->
+<!--            status="primary"-->
+<!--            icon="el-icon-upload2"-->
+<!--            @click="uploadFile"-->
+<!--          >上传文件-->
+<!--          </vxe-button>-->
         </template>
       </vxe-toolbar>
     </div>

+ 909 - 0
ui/src/views/dataexchange/senderdatapoint/index.vue

@@ -0,0 +1,909 @@
+<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
+  <div style="padding-left: 30px">
+    <span style="font-weight: bold">通道:</span>
+    <vxe-select v-model="tunnelId" placeholder="请选择使用通道" style="width: 12%" clearable>
+      <vxe-option v-for="item in tunnelList" :key="item.id" :value="item.id" :label="item.tunnelName" />
+    </vxe-select>
+    <span style="font-weight: bold">设备:</span>
+    <vxe-select v-model="eqId" placeholder="请选择查询设备" style="width: 12%" clearable>
+      <vxe-option v-for="(item,index) in eqTableData" :key="index" :value="index" :label="item.name" />
+    </vxe-select>
+    <div style="display: inline-block">
+      <vxe-toolbar>
+        <template v-slot:buttons>
+          <vxe-button status="primary" @click="searchPointData()">查询</vxe-button>
+          <vxe-button status="primary" icon="fa fa-plus" @click="insertEvent()">新增</vxe-button>
+          <vxe-button status="primary" icon="fa fa-files-o" @click="multiAdd=true">批量新增</vxe-button>
+          <vxe-button status="primary" icon="fa fa-files-o" @click="batchDeleteSpoint">批量删除</vxe-button>
+<!--          <vxe-button status="primary" icon="vxe-icon&#45;&#45;download" @click="exportDataEvent">导出</vxe-button>-->
+          <vxe-button status="primary" icon="vxe-icon--refresh roll" @click="refreshPoint()">刷新数据点</vxe-button>
+        </template>
+      </vxe-toolbar>
+
+    </div>
+    <vxe-table
+      ref="xTable"
+      border
+      stripe
+      resizable
+      show-overflow
+      keep-source
+      max-height="800"
+      align="center"
+      :loading="loading"
+      :data="tableData.slice((currentPage-1)*pageSize,currentPage*pageSize)"
+    >
+      <vxe-table-column type="checkbox" />
+      <vxe-table-column field="sender.id" title="Id" />
+      <vxe-table-column field="sender.dataSource" title="数据源" :formatter="formatterDataSource" :filters="dataSourceList" :filter-multiple="false" />
+      <vxe-table-column field="sender.magnification" title="倍率" />
+      <vxe-table-column field="sender.tunnelId" title="通道名" :formatter="formateId" />
+      <vxe-table-column field="sender.protocolPointNo" title="通道点位" sortable />
+      <vxe-table-column field="sender.protocolPointType" title="通道数据类型" :formatter="formatterPointType" />
+      <vxe-table-column field="equipmentId" title="设备名" :formatter="formateEqId" />
+      <vxe-table-column field="sender.equipmentAttribute.equipmentType" title="设备类型" :formatter="formateEqTypeList"/>
+      <vxe-table-column field="sender.equipmentAttribute.explanation" title="设备属性" />
+      <vxe-table-column field="sender.forecastForSendAttribute.forecastType" title="预测数据属性" :formatter="forForecastType" />
+      <vxe-table-column field="sender.forecastForSendAttribute.forecastNode" title="预测天数(天/时)" :formatter="formatterForecastNode" sortable />
+      <vxe-table-column field="sender.forecastForSendAttribute.pointNumber" title="预测数据的点位" :formatter="formatterPointNumber" />
+      <vxe-table-column title="手动置数" width="80">
+        <template v-slot="{ row }">
+          <template>
+            <vxe-input v-model="row.value1" clearable @blur="setValueByManual(row)" />
+          </template>
+        </template>
+      </vxe-table-column>
+      <!--<vxe-table-column field="sender.generationRegulation" title="属性规则" />-->
+      <vxe-table-column title="操作" width="150">
+        <template v-slot="{ row }">
+          <template>
+            <vxe-button status="primary" size="mini" @click="editRowEvent(row)">编辑</vxe-button>
+            <vxe-button status="danger" size="mini" @click="removeEvent(row)">删除</vxe-button>
+          </template>
+        </template>
+      </vxe-table-column>
+    </vxe-table>
+    <vxe-pager
+      perfect
+      :current-page.sync="currentPage"
+      :page-size.sync="pageSize"
+      :total="totalResult"
+      :layouts="['PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']"
+    />
+    <!--添加编辑-->
+    <vxe-modal ref="xModal" v-model="showEdit" :title="selectRow ? '编辑&保存' : '新增&保存'" width="800" destroy-on-close min-height="550">
+      <vxe-form :data="formData" :rules="formRules" title-align="center" title-width="100" @submit="submitEvent">
+        <vxe-form-item title="数据源" field="dataSource" span="20" title-width="100">
+          <vxe-select v-model="formData.dataSource" placeholder="请选择点位生成规则" @change="datasChange">
+            <vxe-option v-for="item in enums.senderDataSourceEnum" :key="item.value" :value="item.value" :label="item.label" />
+          </vxe-select>
+        </vxe-form-item>
+        <vxe-form-item title="使用通道" field="tunnelId" span="12">
+          <vxe-select v-model="formData.tunnelId" placeholder="请选择使用通道" @change="sendgetByTunnel">
+            <vxe-option v-for="item in tunnelList" :key="item.id" :value="item.id" :label="item.tunnelName" />
+          </vxe-select>
+        </vxe-form-item>
+        <vxe-form-item title="通道数据类型" field="protocolPointType" span="12" title-width="120">
+          <vxe-select v-model="formData.protocolPointType" placeholder="请选择通道数据类型">
+            <vxe-option v-for="item in protocolDataType" :key="item.value" :value="item.value" :label="item.label" />
+          </vxe-select>
+        </vxe-form-item>
+        <vxe-form-item title="通道点位" field="protocolPointNo" span="12" title-width="100">
+          <vxe-input
+            v-model="formData.protocolPointNo"
+            placeholder="请输入通道点位"
+            clearable
+            type="number"
+            :disabled="noDisable"
+            @change="checkprotocolPointNo"
+          />
+        </vxe-form-item>
+        <vxe-form-item title="倍率" field="magnification" span="12" :item-render="{name: 'input', attrs: {type: 'float'}}" />
+        <!--外部接入-->
+        <vxe-form-item title="设备类型" field="eqType" span="12">
+          <vxe-select v-model="formData.eqType" placeholder="请选择设备类型" :disabled="gatherDisable" @change="changeEqA">
+            <vxe-option v-for="item in equipmentTypeEnum" :key="item.value" :value="item.value" :label="item.label" />
+          </vxe-select>
+        </vxe-form-item>
+        <vxe-form-item title="设备名" field="equipmentId" span="12">
+          <vxe-select v-model="formData.equipmentId" placeholder="请选择设备名" :disabled="gatherDisable" @change="selectEqAtt">
+            <vxe-option v-for="(item,index) in eqData" :key="index" :value="item.id" :label="item.name" />
+          </vxe-select>
+        </vxe-form-item>
+        <vxe-form-item title="设备属性" field="equipmentAttributeId" span="12">
+          <vxe-select v-model="formData.equipmentAttributeId" placeholder="请选择设备属性" :disabled="gatherDisable" @change="getGatherPoint">
+            <vxe-option v-for="(item,index) in eqaTableData" :key="item.equipmentAttribute.id" :value="item.equipmentAttribute.id" :label="item.equipmentAttribute.explanation" />
+          </vxe-select>
+        </vxe-form-item>
+        <!--公式生成 暂不使用-->
+        <!-- <vxe-form-item title="属性规则" field="generationRegulation" span="20">
+          <vxe-input v-model="formData.generationRegulation" placeholder="请输入属性规则" type="textarea" clearable :disabled="generateDisable" />
+        </vxe-form-item>-->
+        <!--预测生成-->
+        <vxe-form-item title="预测数据属性" field="forecastType" span="12" title-width="120">
+          <vxe-select v-model="formData.forecastType" placeholder="请选择预测数据属性" :disabled="forecastDisable" placement="top" @change="forecastDayChange">
+            <vxe-option v-for="item in enums.forecastType" :key="item.value" :value="item.value" :label="item.label" />
+          </vxe-select>
+        </vxe-form-item>
+        <vxe-form-item title="预测天数" span="12" field="forecastNode">
+          <vxe-select v-model="formData.forecastNode" placeholder="请选择预测天数" :disabled="forecastDisable" placement="top" @change="upForecastAttribute">
+            <vxe-option v-for="item in forecastDay" :key="item.value" :value="item.value" :label="item.label" />
+          </vxe-select>
+        </vxe-form-item>
+        <vxe-form-item title="预测点位" span="12" field="pointNumber">
+          <vxe-select v-model="formData.pointNumber" placeholder="请选择预测点位" :disabled="forecastDisable" placement="top" @change="getAttributeBypoint">
+            <vxe-option v-for="item in forecastAttributeList" :key="item.value" :value="item.value" :label="item.label" />
+          </vxe-select>
+        </vxe-form-item>
+        <vxe-form-item align="center" span="24">
+          <vxe-button type="submit" status="primary" :disabled="disButton">保存</vxe-button>
+          <vxe-button v-show="resetShow" @click="resetForm">重置</vxe-button>
+          <vxe-button @click="$refs.xModal.close()">取消</vxe-button>
+        </vxe-form-item>
+      </vxe-form>
+    </vxe-modal>
+    <multi-add :show="multiAdd" @close="changeMultiAdd" />
+  </div>
+</template>
+
+<script>
+import enumerations from '../../enumeration'
+import MultiAdd from './multiAdd'
+
+export default {
+  components: {
+    MultiAdd
+  },
+  data() {
+    // const checkmagnification = ({ cellValue, rule, row, column }) => {
+    //   if (this.formData.magnification < 0) {
+    //     return Promise.reject(new Error('倍率不能小于0'))
+    //   }
+    // }
+    return {
+      loading: false,
+      disButton: false,
+      resetShow: true,
+      multiAdd: false,
+      noDisable: true,
+      // 后台传输数据
+      tableData: [],
+      tableData1: [],
+      elTableData: [],
+      elId: '',
+      eqTableData: [],
+      eqId: '',
+      eqData: [],
+      tempId: '',
+      eqaTableData: [],
+      eqaId: '',
+      tunnelId: '',
+      tunnelTable: [],
+      showEdit: false,
+      showAllEdit: false,
+      selectRow: null,
+      saveFlag: 1,
+      modelId: '',
+      // 预测属性点位id
+      pointId: '',
+      // 分页
+      currentPage: 1,
+      pageSize: 10,
+      totalResult: 0,
+      page: 0,
+      // 判断表示
+      gatherDisable: true,
+      generateDisable: true,
+      forecastDisable: false,
+      needdisable: false,
+      equipmentList: [],
+      form: {
+        forecastNode: [],
+        pointNumber: []
+      },
+      Rules: [],
+      value1: '',
+      formData: {
+        equipmentId: '',
+        // equipmentAttribute: {'id': ''},
+        equipmentAttributeId:'',
+        eqType: '',
+        dataSource: 'FORECAST',
+        tunnelId: '',
+        protocolPointNo: null,
+        protocolPointType: 'ABCD',
+        magnification: 1,
+        generationRegulation: '',
+        forecastType: null,
+        forecastNode: '',
+        pointNumber: '',
+        forecastForSendAttribute: {
+          'id': '',
+          'forecastType': null,
+          'forecastNode': '',
+          'pointNumber': ''
+        }
+      },
+      gatherPointList: [],
+      gpList: [], // 采集点表
+      forecastDay: [],
+      forecastAttributeList: [],
+      // 数据类型
+      code: '',
+      message: '',
+      forecastRules: {
+        dataSource: [{ required: true, message: '请选择数据来源' }],
+        tunnelId: [{ required: true, message: '请选择通道' }],
+        protocolPointType: [{ required: true, message: '请选择通道数据类型' }],
+        magnification: [{ required: true, message: '请输入倍率' }],
+        forecastType: [{ required: true, message: '请选择预测数据类型' }],
+        forecastNode: [{ required: true, message: '请选择预测天数' }],
+        pointNumber: [{ required: true, message: '请选择预测点位' }]
+      },
+      gatherRules: {
+        dataSource: [{ required: true, message: '请选择数据来源' }],
+        tunnelId: [{ required: true, message: '请选择通道' }],
+        protocolPointType: [{ required: true, message: '请选择通道数据类型' }],
+        magnification: [{ required: true, message: '请输入倍率' }],
+        equipmentId: [{ required: true, message: '请选择设备' }],
+        equipmentAttributeId: [{ required: true, message: '请选择设备属性' }],
+        eqType: [{ required: true, message: '请选择设备类型' }]
+      },
+      formRules: {},
+      enums: enumerations,
+      protocolDataType: enumerations.ProtocolDataType,
+      tunnelList: [],
+      temp: [],
+      dataSourceList: [{ label: '预测生成', value: 3 }, { label: '外部接入', value: 1 }],
+      equipmentTypeEnum: [{ value: 'POWERSTATION', label: '发电站', key: 0 },
+        { value: 'WEATHERSTATION', label: '气象站', key: 1 },
+        { value: 'INVERTER', label: '逆变器', key: 2 },
+        { value: 'WINDTOWER', label: '测风塔', key: 3 },
+        { value: 'WINDTURBINE', label: '风机', key: 4 }
+      ]
+    }
+  },
+  mounted() {
+    this.getAll()
+    this.formRules = this.forecastRules
+  },
+
+  methods: {
+    getAll() {
+      Promise.all([this.getEq(), this.getTunnel(), this.getEl()]).then((res) => {
+        this.eqTableData = res[0]
+        this.tunnelList = res[1]
+        this.elTableData.push(res[2])
+        this.getSenderPoint()
+      })
+    },
+    // 场站
+    getEl() {
+      const axios = this.$axios
+      return new Promise(function(resolve, reject) {
+        axios.get('/electricField/').then(res => {
+          resolve(res.data)
+        })
+      })
+    },
+    // 场站设备
+    getEq() {
+      const axios = this.$axios
+      return new Promise(function(resolve, reject) {
+        axios.get('/dataExchange/equipmentInfo/').then(res => {
+          resolve(res.data)
+        })
+      })
+    },
+    // 获取通道
+    getTunnel() {
+      const axios = this.$axios
+      return new Promise(function(resolve, reject) {
+        axios.get('/TunnelInfo/getTunnel/Slave').then(res => {
+          resolve(res.data)
+        })
+      })
+    },
+    changeMultiAdd() {
+      this.multiAdd = false
+    },
+    getSenderPoint() {
+      this.page = this.currentPage
+      this.loading = true
+      this.$axios.get('/dataExchange/senderProtocolDataPoint/DataPoint').then((res) => {
+        this.tableData = res.data
+        this.totalResult = this.tableData.length
+        this.currentPage = this.page
+        this.loading = false
+      })
+    },
+    // 查询采集数据点位
+    getGatherPoint() {
+      var equipmentId = ''
+      equipmentId = this.formData.equipmentId
+      if (this.formData.eqType == 'POWERSTATION') {
+        equipmentId = 0
+      }
+      this.$axios.get('/dataExchange/protocolDataPoint/getProtocolGatherDataPoint/' + equipmentId + '/' + this.formData.equipmentAttributeId).then(res => {
+        this.formData.gatherPoint = res.data[0].id
+      })
+    },
+    selectEqAtt() {
+      this.eqaTableData = []
+      // this.formData.equipmentAttribute = ''
+      const params = {
+        equipmentType: this.formData.eqType,
+        equipmentId: this.formData.equipmentId
+      }
+      if (this.formData.eqType == 'POWERSTATION') {
+        params.equipmentId = null
+      }
+      this.$axios.get('/dataExchange/protocolDataPoint/gatherDataPoint', { params: params }).then(res => {
+        this.eqaTableData = res.data
+      })
+    },
+    // 获取预测点位
+    upForecastAttribute() {
+      if (this.saveFlag === 2) {
+        this.formData.pointNumber = ''
+      }
+      this.forecastAttributeList = []
+      this.$axios.get('/dataExchange/ForecastForSendAttribute/' + this.formData.forecastNode + '/' + this.formData.forecastType).then(res => {
+        var list = []
+        for (var i = 0; i < res.data.length; i++) {
+          list.push({ label: '第' + res.data[i].pointNumber + '节点', value: res.data[i].pointNumber })
+        }
+        this.forecastAttributeList = list
+      })
+    },
+    // 获取预测点位
+    getforecastAttribute() {
+      this.forecastAttributeList = []
+      this.$axios.get('/dataExchange/ForecastForSendAttribute/' + this.formData.forecastNode + '/' + this.formData.forecastType).then(res => {
+        var list = []
+        for (var i = 0; i < res.data.length; i++) {
+          list.push({ label: '第' + res.data[i].pointNumber + '节点', value: res.data[i].pointNumber })
+        }
+        this.forecastAttributeList = list
+      })
+    },
+    // 获取预测属性id
+    getAttributeBypoint() {
+      var pointNumber = this.formData.pointNumber
+      var forecastNode = this.formData.forecastNode
+      var forcastType = this.formData.forecastType
+      this.$axios.get('/dataExchange/ForecastForSendAttribute/getAttributeBypoint/' + pointNumber + '/' + forecastNode + '/' + forcastType).then((res) => {
+        // console.log(res.data)
+        this.pointId = res.data[0].id
+        this.formData.forecastForSendAttribute.id = this.pointId
+      })
+    },
+    // 查询
+    searchPointData() {
+      this.page = this.currentPage
+      // console.log(this.tunnelId)
+      if ((this.tunnelId === '' || this.tunnelId === null) && (this.eqId === '' || this.eqId === null)) {
+        this.getSenderPoint()
+      } else {
+        this.loading = true
+        var tunnelId = ''
+        var equipmentId = ''
+        var equipmentType = ''
+        if (this.tunnelId === '' || this.tunnelId === undefined || this.tunnelId === null) {
+          tunnelId = 'ALL'
+        } else tunnelId = this.tunnelId
+
+        if (this.eqTableData[this.eqId] === [] || this.eqTableData[this.eqId] === undefined) {
+          equipmentId = 'ALL'
+          equipmentType = 0
+        } else {
+          equipmentId = this.eqTableData[this.eqId].id
+          if (equipmentId === this.elTableData[0].stationCode) {
+            equipmentId = 0
+            equipmentType = this.eqTableData[this.eqId].code
+          } else {
+            equipmentType = this.eqTableData[this.eqId].equipmentType.code
+          }
+        }
+        this.$axios.get('/dataExchange/senderProtocolDataPoint/findByTunnelIdAndGatherPoint/' + tunnelId + '/' + equipmentId + '/' + equipmentType).then(res => {
+          this.tableData = res.data
+          this.totalResult = this.tableData.length
+          this.currentPage = this.page
+          // console.log(res.data)
+          this.loading = false
+        })
+      }
+    },
+    // 保存
+    submitEvent() {
+      // console.log(this.formData)
+      this.formData.stationCode = this.elTableData[0].stationCode
+      this.formData.forecastForSendAttribute.forecastType = this.formData.forecastType
+      this.formData.forecastForSendAttribute.forecastNode = this.formData.forecastNode
+      this.formData.forecastForSendAttribute.pointNumber = this.formData.pointNumber
+      this.$delete(this.formData, 'equipmentId')
+      this.$delete(this.formData, 'equipmentAttribute')
+      this.$delete(this.formData, 'eqType')
+      this.$delete(this.formData, 'forecastType')
+      this.$delete(this.formData, 'forecastNode')
+      this.$delete(this.formData, 'pointNumber')
+      if (this.saveFlag === 1) {
+        if (this.formData.dataSource == 3) {
+          this.formData.gatherPoint = null
+          // this.formData.forecastForSendAttribute.id = this.pointId
+        } else {
+          this.formData.forecastForSendAttribute = null
+        }
+        this.$axios.post('/dataExchange/senderProtocolDataPoint/saveDataPoint/', this.formData).then((res) => {
+          // console.log(res.code)
+          if (res.code === 200) {
+            this.searchPointData()
+            this.$message.success('保存转发点表成功')
+            this.resetForm()
+          } else {
+            this.searchPointData()
+            this.$message.error('保存转发点表失败')
+            this.resetForm()
+          }
+        })
+        this.$refs.xModal.close()
+      } else {
+        if (this.formData.dataSource != 3) {
+          this.formData.forecastForSendAttribute = null
+        }
+
+        this.$axios.put('/dataExchange/senderProtocolDataPoint/updateDataPoint/', this.formData).then((res) => {
+          // console.log(res.code)
+          if (res.code === 200) {
+            this.searchPointData()
+            // this.test()
+            this.$message.success('修改转发点表成功')
+          } else {
+            this.searchPointData()
+            this.$message.error('修改转发点表失败')
+          }
+        })
+        this.resetForm()
+        this.$refs.xModal.close()
+      }
+    },
+    // 编辑
+    editRowEvent(row) {
+      this.resetShow = false
+      this.noDisable = false
+      this.saveFlag = 2
+      this.formData.id = row.sender.id
+      this.formData.magnification = row.sender.magnification
+      this.formData.gatherPoint = row.sender.gatherPoint
+      this.formData.tunnelId = parseInt(row.sender.tunnelId)
+      this.formData.protocolPointType = row.sender.protocolPointType
+      this.formData.protocolPointNo = row.sender.protocolPointNo
+      this.formData.dataSource = row.sender.dataSource
+      this.datasChange()
+      if (this.formData.dataSource == 3) {
+        this.formData.equipmentId = ''
+        this.formData.equipmentAttribute = ''
+        this.formData.eqType = null
+      } else {
+          console.log('%%%%%%%%%%%%%%%')
+          console.log(row)
+        // 外部
+        // if (this.formateEq(row.sender.equipmentAttribute.equipmentType)) {
+        this.formData.eqType = row.sender.equipmentAttribute.equipmentType
+          if (this.changeEqA()) {
+            this.formData.equipmentId = row.equipmentId
+            if (this.formData.eqType === 'POWERSTATION') {
+              this.formData.equipmentId = this.elTableData[0].stationCode
+            }
+            // if (this.formatterEqType(row.equipmentAttribute.equipmentType.message)) {
+              this.formData.equipmentAttributeId = row.equipmentAttributeId
+            // }
+
+          }
+        // }
+      }
+      // 公式
+      this.formData.generationRegulation = row.sender.generationRegulation
+      // 预测
+      if (this.formData.dataSource ==3 ) {
+        this.formData = {
+          id: row.sender.id,
+          equipmentId: '',
+          equipmentAttribute: '',
+          eqType: null,
+          gatherPoint: row.sender.gatherPoint,
+          dataSource: row.sender.dataSource,
+          tunnelId: row.sender.tunnelId,
+          protocolPointNo: row.sender.protocolPointNo,
+          protocolPointType: row.sender.protocolPointType,
+          magnification: row.sender.magnification,
+          forecastForSendAttribute: {
+            'id': row.sender.forecastForSendAttribute.id
+          },
+          pointNumber: row.sender.forecastForSendAttribute.pointNumber
+        }
+        // this.formData.forecastForSendAttribute.id = row.sender.forecastForSendAttribute.id
+        this.formData.forecastType = row.sender.forecastForSendAttribute.forecastType
+        this.forecastDayChange()
+        this.formData.forecastNode = row.sender.forecastForSendAttribute.forecastNode
+        this.getforecastAttribute()
+        // this.formData.pointNumber = row.sender.forecastForSendAttribute.pointNumber
+      } else {
+        this.formData.forecastForSendAttribute.id = null
+        this.formData.forecastType = null
+        this.formData.forecastNode = null
+        this.formData.pointNumber = null
+      }
+      this.selectRow = row
+      this.showEdit = true
+    },
+    // 删除
+    removeEvent(row) {
+      // console.log(row)
+      this.$axios.delete('/dataExchange/senderProtocolDataPoint/deleteDataPoint/' + row.sender.id).then((res) => {
+        // console.log(res)
+        if (res.code === 200) {
+          this.getSenderPoint()
+          this.$message.success('删除转发点表成功')
+        } else {
+          this.getSenderPoint()
+          this.$message.error('删除转发点表失败')
+        }
+      })
+    },
+    sendgetByTunnel() {
+      this.$axios.get('/dataExchange/senderProtocolDataPoint/findByTunnelId/' + this.formData.tunnelId).then((res) => {
+        this.tunnelTable = res.data
+        this.tunnelChange()
+        var max = 0
+        if (this.tunnelTable.length === 0) {
+          this.formData.protocolPointNo = 1
+        } else if (this.tunnelTable.length === 1) {
+          this.formData.protocolPointNo = this.tunnelTable[0].sender.protocolPointNo + 1
+        } else {
+          for (var i = 0; i < this.tunnelTable.length; i++) {
+            if (i !== this.tunnelTable.length - 1) {
+              var num1 = this.tunnelTable[i].sender.protocolPointNo
+              var num2 = this.tunnelTable[i + 1].sender.protocolPointNo
+              max = Math.max(num1, num2)
+            }
+          }
+          this.formData.protocolPointNo = max + 1
+        }
+      })
+    },
+    tunnelChange() {
+      this.protocolDataType = []
+      this.formData.protocolPointType = 'ABCD'
+      for (let i = 0; i < this.tunnelList.length; i++) {
+        if (this.formData.tunnelId === this.tunnelList[i].id) {
+          if (this.tunnelList[i].tunnelType.substring(0, 3) === 'IEC' || this.tunnelList[i].tunnelType.substring(0, 3) === 'FIL') {
+            this.protocolDataType = [{ label: '遥信开关量', value: 'A', key: 0 }, { label: 'ABCD', value: 'ABCD', key: 9 }]
+          } else if (this.tunnelList[i].tunnelType.substring(0, 3) === 'CDT') {
+            this.protocolDataType = [{ label: '遥信开关量', value: 'A', key: 0 }, { label: '+AB', value: 'P_AB', key: 1 }]
+            this.formData.protocolPointType = 'P_AB'
+          } else {
+            this.protocolDataType = this.enums.ProtocolDataType
+          }
+        }
+      }
+    },
+    // 设备名改变设备属性下拉框改变
+    changeEqA() {
+      this.formData.equipmentId = ''
+      if (this.formateEqType(this.formData.eqType)) {
+        this.code = this.tempId
+        if (this.tempId === 0) {
+          this.$axios.get('/electricField/').then(res => {
+            this.eqData = []
+            if (res.code == 200) {
+              this.eqData.push({ id: res.data.stationCode, name: res.data.name })
+              this.formData.equipmentId = res.data.stationCode
+            }
+            this.selectEqAtt()
+          })
+        } else {
+          this.$axios.get('/dataExchange/equipmentInfo/' + this.tempId).then(res => {
+            // console.log(res)
+            this.eqData = res.data
+            this.selectEqAtt()
+          })
+        }
+      }
+      return true
+    },
+    // 预测属性改变天数
+    forecastDayChange() {
+      this.formData.forecastNode = ''
+      this.forecastAttributeList = []
+      if (this.formData.forecastType === 'ULTRA_SHORT_AVAILABLE' || this.formData.forecastType === 'ULTRA_SHORT_THEORETICAL') {
+        this.forecastDay = [{ label: '第一小时', value: 0 },
+          { label: '第二小时', value: 1 },
+          { label: '第三小时', value: 2 },
+          { label: '第四小时', value: 3 }]
+      } else {
+        this.forecastDay = [{ label: '第1天', value: 0 }, { label: '第2天', value: 1 }, { label: '第3天', value: 2 }, { label: '第4天', value: 3 }, { label: '第5天', value: 4 },
+          { label: '第6天', value: 5 }, { label: '第7天', value: 6 }, { label: '第8天', value: 7 }, { label: '第9天', value: 8 }, { label: '第10天', value: 9 },{ label: '第11天', value: 10}]
+      }
+    },
+    // 判断点表生成规则
+    datasChange() {
+      this.formRules = {}
+      if (this.formData.dataSource ==1) {
+        this.gatherDisable = false
+        this.forecastDisable = true
+        this.generateDisable = true
+        this.formRules = this.gatherRules
+      } else if (this.formData.dataSource ==3) {
+        this.gatherDisable = true
+        this.forecastDisable = false
+        this.generateDisable = true
+        this.formRules = this.forecastRules
+      } else {
+        this.gatherDisable = true
+        this.forecastDisable = true
+        this.generateDisable = false
+      }
+    },
+    // 重置
+    resetForm() {
+      this.formData = {
+        equipmentId: '',
+        equipmentAttributeId: '',
+        eqType: '',
+        dataSource: 3,
+        tunnelId: '',
+        protocolPointNo: null,
+        protocolPointType: 'ABCD',
+        magnification: 1,
+        generationRegulation: '',
+        forecastForSendAttribute: {
+          'id': '',
+          'forecastType': null,
+          'forecastNode': '',
+          'pointNumber': ''
+        }
+      }
+      this.formRules = {}
+      this.formRules = this.forecastRules
+      this.protocolDataType = this.enums.ProtocolDataType
+      this.disButton = false
+    },
+    // 新增
+    insertEvent() {
+      this.saveFlag = 1
+      this.disButton = true
+      this.resetForm()
+      this.selectRow = null
+      this.showEdit = true
+      this.noDisable = true
+      this.gatherDisable = true
+      this.forecastDisable = false
+      this.formData.equipmentId = ''
+      if (this.tunnelId !== '' && this.tunnelId !== null) {
+        this.formData.tunnelId = this.tunnelId
+        this.sendgetByTunnel()
+      }
+      this.protocolDataType = this.enums.ProtocolDataType
+    },
+    batchDeleteSpoint() {
+      var selectRecords = this.$refs.xTable.getCheckboxRecords()
+      if (selectRecords.length == 0) {
+        this.$message.error('请选择要删除的数据')
+      } else {
+        this.$XModal.confirm('您确定要批量删除数据?').then(type => {
+          if (type === 'confirm') {
+            var ids = []
+            for (var i = 0; i < selectRecords.length; i++) {
+              ids.push(selectRecords[i].sender.id)
+            }
+            this.$axios.delete('/dataExchange/senderProtocolDataPoint/batchDeleteSenderDataPoint/' + ids).then(res => {
+              if (res.data === 1) {
+                this.$message.success('删除批量点表成功')
+              } else {
+                this.$message.error('删除批量点表失败')
+              }
+              this.searchPointData()
+            })
+          }
+        })
+      }
+    },
+    insertAllEvent() {
+      this.showAllEdit = true
+    },
+    checkprotocolPointNo() {
+      this.disButton = false
+      if (this.formData.tunnelId === '' || this.formData.tunnelId === null) {
+        this.$message.error('请先选择通道')
+        this.formData.protocolPointNo = ''
+      } else {
+        if (this.formData.protocolPointNo < 0) {
+          this.formData.protocolPointNo = 0
+          this.$message.error('通道点位不能小于0')
+        }
+        this.$axios.get('/dataExchange/senderProtocolDataPoint/findByTunnelId/' + this.formData.tunnelId).then((res) => {
+          var v6 = res.data
+          var num = this.formData.protocolPointNo
+          console.log(v6)
+          for (let i = 0; i < v6.length; i++) {
+            // 修改
+            if (parseInt(num) === v6[i].sender.protocolPointNo) {
+              this.$message.error('通道号不能重复')
+              this.disButton = true
+            }
+          }
+        })
+      }
+    },
+    setValueByManual(row) {
+      if (row.value1 !== undefined) {
+        var flag = false
+        if (row.sender.protocolPointType === 'A') {
+          var re = /^[0-1]*$/
+          if (!re.test(row.value1)) {
+            this.$message.error('手动置数只能0或1')
+          } else {
+            flag = true
+          }
+        } else {
+          var reg = /|^(\-|\+?)\d+(\.\d+)?$/
+          if (reg.test(row.value1)) {
+            flag = true
+          } else {
+            this.$message.error('手动置数只能数字')
+          }
+        }
+        if (flag) {
+          this.$axios.get('/dataExchange/senderProtocolDataPoint/setValueByManual/' + row.sender.id + '/' + row.value1).then((res) => {
+            this.$message.success('手动置数成功')
+          })
+        }
+      }
+    },
+    // // 导出
+    // exportDataEvent() {
+    //   // this.$refs.xTable.exportData({
+    //   //   filename: `转发点表`,
+    //   //   type: 'csv'
+    //   // })
+    //   this.$axios.post('/dataExchange/senderProtocolDataPoint/export', {}, {
+    //     fileName: '',
+    //     responseType: 'blob'// 用于解决中文乱码
+    //   }).then((response) => {
+    //   })
+    // },
+    // 刷新全部转发通道数据点
+    refreshPoint() {
+      this.$axios.get('/refreshContainer/allSenderTunnelDataPoint').then((res) => {
+        // console.log(res)
+        this.$message.success('刷新成功')
+      })
+    },
+    // 转换类型
+    formateEq(code) {
+      let returnValue = ''
+      if (code === 0) returnValue = 'POWERSTATION'
+      if (code === 1) returnValue = 'WEATHERSTATION'
+      if (code === 2) returnValue = 'INVERTER'
+      if (code === 3) returnValue = 'WINDTOWER'
+      if (code === 4) returnValue = 'WINDTURBINE'
+      if (code === 5) returnValue = 'FORECASTDATA'
+      this.formData.eqType = returnValue
+      return true
+    },
+      // 转换类型
+      formateEqTypeList(str) {
+          let returnValue = ''
+          for (let i=0;i<this.equipmentTypeEnum.length;i++){
+              if (this.equipmentTypeEnum[i].value==str.cellValue){
+                  returnValue = this.equipmentTypeEnum[i].label
+              }
+          }
+          return returnValue
+      },
+    // 转换类型
+    formateEqType(eqType) {
+      this.tempId = ''
+      let returnValue = ''
+      if (eqType === 'POWERSTATION') returnValue = 0
+      if (eqType === 'WEATHERSTATION') returnValue = 1
+      if (eqType === 'INVERTER') returnValue = 2
+      if (eqType === 'WINDTOWER') returnValue = 3
+      if (eqType === 'WINDTURBINE') returnValue = 4
+      if (eqType === 'FORECASTDATA') returnValue = 5
+      this.tempId = returnValue
+      return true
+    },
+    // 设备id转名称
+    formateEqId(row, column) {
+      let belongTo = '未知设备名称'
+      if (row.row.equipmentId === null) {
+        belongTo = ''
+      } else {
+        if (row.row.equipmentAttributeId == 0) {
+          belongTo = this.elTableData[0].name
+        } else {
+          for (let i = 0; i < this.eqTableData.length; i++) {
+            if (row.row.equipmentId == this.eqTableData[i].id && row.row.equipmentAttributeId == this.eqTableData[i].equipmentType.code) {
+              belongTo = this.eqTableData[i].name
+            }
+            else{
+                if (row.row.equipmentId == this.eqTableData[i].code){
+                    belongTo = this.eqTableData[i].name
+                }
+            }
+          }
+        }
+      }
+      return belongTo
+    },
+    // 转换通道类型
+    formatterPointType({ cellValue }) {
+      const item = this.enums.ProtocolDataType.find(item => item.value === cellValue)
+      return item ? item.label : ''
+    },
+    // 转设备类别
+    // formatterEqType(cellValue) {
+    //   /* if(cellValue === )*/
+    //   const item = this.enums.equipmentTypeEnum.find(item => item.label === cellValue)
+    //   this.formData.eqType = item ? item.value : ''
+    //   return true
+    // },
+    // 预测属性
+    forForecastType({ cellValue }) {
+      const item = this.enums.forecastType.find(item => item.value === cellValue)
+      return item ? item.label : ''
+    },
+    formatterForecastNode({ cellValue, row }) {
+      var forecastNode = ''
+      if (cellValue !== undefined) {
+        if (row.sender.forecastForSendAttribute.forecastType === 'ULTRA_SHORT_AVAILABLE' || row.sender.forecastForSendAttribute.forecastType === 'ULTRA_SHORT_THEORETICAL') {
+          switch (cellValue) {
+            case 0: forecastNode = '第一小时'
+              break
+            case 1: forecastNode = '第二小时'
+              break
+            case 2: forecastNode = '第三小时'
+              break
+            case 3: forecastNode = '第四小时'
+              break
+          }
+        } else {
+          forecastNode = '第' + (cellValue + 1) + '天'
+        }
+        return forecastNode
+      }
+    },
+    formatterPointNumber({ cellValue }) {
+      if (cellValue !== undefined) {
+        return '第' + cellValue + '节点'
+      }
+    },
+    formatterDataSource({ cellValue }) {
+      const item = this.enums.senderDataSourceEnum.find(item => item.value === cellValue)
+      return item ? item.label : ''
+    },
+    // 通道id转名称
+    formateId(row, column) {
+      // console.log(row)
+      let belongTo = '未知通道名称'
+      if (row.row.sender.tunnelId === '') {
+        belongTo = ''
+      } else {
+        for (let i = 0; i < this.tunnelList.length; i++) {
+          if (row.row.sender.tunnelId ==  this.tunnelList[i].id) {
+            belongTo = this.tunnelList[i].tunnelName
+          }
+        }
+      }
+      return belongTo
+    }
+  }
+
+}
+
+</script>
+
+<style>
+</style>

+ 471 - 0
ui/src/views/dataexchange/senderdatapoint/multiAdd.vue

@@ -0,0 +1,471 @@
+<template>
+  <vxe-modal
+    ref="multiAdd"
+    v-model="show"
+    :title="'批量添加'"
+    width="900"
+    height="auto"
+    resize
+    destroy-on-close
+    @close="cancelButtonClick"
+  >
+    <p style="color: red;padding-left:20px">批量生成的点位将按序排在通道末尾的点位后</p>
+    <vxe-form
+      ref="form"
+      :data="formData"
+      :rules="formRules"
+      title-align="center"
+      title-width="100"
+    >
+      <vxe-form-item title="数据源" field="dataSource" span="6">
+        <vxe-select v-model="formData.dataSource" placeholder="数据来源" size="big">
+          <vxe-option
+            v-for="item in enums.senderDataSourceEnum"
+            :key="item.value"
+            :value="item.value"
+            :label="item.label"
+          />
+        </vxe-select>
+      </vxe-form-item>
+
+      <vxe-form-item title="使用通道" field="tunnelId" span="8">
+        <vxe-select
+          v-model="formData.tunnelId"
+          placeholder="请选择使用通道"
+          size="medium"
+          @change="tunnelChange"
+        >
+          <vxe-option v-for="item in tunnelList" :key="item.id" :value="item.id" :label="item.tunnelName"/>
+        </vxe-select>
+      </vxe-form-item>
+
+      <vxe-form-item title="通道数据类型" field="protocolPointType" span="9" title-width="150px">
+        <vxe-select v-model="formData.protocolPointType" placeholder="请选择通道数据类型" size="medium">
+          <vxe-option
+            v-for="item in protocolDataType"
+            :key="item.value"
+            :value="item.value"
+            :label="item.label"
+          />
+        </vxe-select>
+      </vxe-form-item>
+      <vxe-form-item v-show="formData.dataSource=='GATHER'" title="设备类型" field="eqType" span="6">
+        <vxe-select v-model="formData.eqType" placeholder="请选择设备类型" size="medium"
+                    @change="flushEqsOfSelectEqType">
+          <vxe-option
+            v-for="item in enums.equipmentTypeEnum"
+            :key="item.value"
+            :value="item.value"
+            :label="item.label"
+          />
+        </vxe-select>
+      </vxe-form-item>
+      <vxe-form-item v-show="formData.dataSource=='GATHER'" title="设备名" field="equipmentId" span="10">
+        <vxe-select v-model="formData.equipmentId" placeholder="请选择设备名" size="medium"
+                    @change="flushAttrsOfSelectEq">
+          <vxe-option v-for="(item,index) in eqsOfSelectEqType" :key="index" :value="item.id" :label="item.name"/>
+        </vxe-select>
+      </vxe-form-item>
+      <vxe-form-item v-show="formData.dataSource=='GATHER'" title="设备属性" field="equipmentAttrs" span="14">
+        <el-select v-model="formData.equipmentAttrs" multiple collapse-tags placeholder="请选择设备属性" size="small">
+          <el-option
+            v-for="item in attrsOfSelectEq"
+            :value="item.id"
+            :label="item.equipmentAttribute.explanation"
+          />
+        </el-select>
+      </vxe-form-item>
+
+      <vxe-form-item
+        v-show="formData.dataSource=='FORECAST'"
+        title="预测数据属性"
+        field="forecastType"
+        span="10"
+        title-width="120"
+      >
+        <vxe-select v-model="formData.forecastType" placeholder="请选择预测数据属性" @change="forecastDayChange">
+          <vxe-option v-for="item in enums.forecastType" :key="item.value" :value="item.value" :label="item.label"/>
+        </vxe-select>
+      </vxe-form-item>
+      <vxe-form-item v-show="formData.dataSource=='FORECAST'" title="预测天数" span="10" field="forecastNode">
+        <el-select
+          v-model="formData.forecastNode"
+          multiple
+          collapse-tags
+          placeholder="请选择预测天数"
+          size="small"
+          @change="forecastNodeChangeEvent"
+        >
+          <el-option v-for="item in forecastDay" :key="item.value" :value="item.value" :label="item.label"/>
+        </el-select>
+      </vxe-form-item>
+      <vxe-form-item v-show="formData.dataSource=='FORECAST'" title="预测点位" span="10" field="forecastPointNumber">
+        <el-select v-model="formData.forecastPointNumber" multiple collapse-tags placeholder="请选择预测点数"
+                   size="small">
+          <el-option v-for="item in forecastAttributeList" :value="item.pointNumber" :label="item.pointNumber"/>
+        </el-select>
+      </vxe-form-item>
+
+      <!--占地方用的-->
+      <div style="height: 300px"/>
+      <vxe-form-item align="center" span="24">
+        <vxe-button type="submit" status="primary" :disabled="saveButDisable" @click="submitForm">保存</vxe-button>
+        <vxe-button @click="cancelButtonClick()">取消</vxe-button>
+      </vxe-form-item>
+    </vxe-form>
+  </vxe-modal>
+</template>
+
+<script>
+import enumerations from '../../enumeration'
+
+export default {
+  name: 'MultiAddVue',
+  props: {
+    show: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data() {
+    return {
+      eqsOfSelectEqType: [],
+      attrsOfSelectEq: [],
+      forecastDay: [],
+      forecastAttributeList: [],
+      saveButDisable: false,
+      formData: {
+        eqType: '',
+        dataSource: 'GATHER',
+        tunnelId: '',
+        protocolPointType: '',
+        equipmentId: '',
+        forecastType: '',
+        forecastNode: [],
+        forecastPointNumber: [],
+        equipmentAttrs: []
+      },
+      tunnelList: [],
+      formRules: {
+        dataSource: [{required: true, message: '请选择数据源'}],
+        tunnelId: [{required: true, message: '请选择通道'}],
+        protocolPointType: [{required: true, message: '请选择数据类型'}]
+      },
+      enums: enumerations,
+      protocolDataType: enumerations.ProtocolDataType
+    }
+  },
+  mounted() {
+    this.buildTunnelSelectData()
+  },
+  methods: {
+    /**
+     * 点击取消或关闭按钮时通知父组件修改值
+     */
+    cancelButtonClick() {
+      this.saveButDisable = false
+      this.resetForm()
+      this.$emit('close')
+    },
+
+    /**
+     * 当所选设备类型发生改变时 刷新设备属性下拉框对应的设备名下拉
+     */
+    flushEqsOfSelectEqType() {
+      this.attrsOfSelectEq = []
+      this.formData.equipmentAttrs = []
+      this.formData.equipmentId = null
+      this.resultHandler(this.getEqsByEqTypeCode(this.formData.eqType)).then(res => {
+        if (res != null) {
+          this.eqsOfSelectEqType = res
+        }
+      })
+    },
+
+    /**
+     * 提交表单
+     */
+    submitForm() {
+      const _this = this
+      _this.saveButDisable = true
+      this.$refs.form.validate().then(async res => {
+        let max = 0
+        max = await this.resultHandler(_this.$axios.get('/dataExchange/senderProtocolDataPoint/maxProtocolNoInTunnel', {params: {tunnelId: _this.formData.tunnelId}})).then(res => {
+          return res == null ? 0 : res
+        })
+        if (this.formData.dataSource == 'GATHER') {
+          if (this.formData.equipmentAttrs.length == 0) {
+            _this.$XModal.message({message: '并未选择需要添加的属性'})
+            return
+          }
+          let str = '将'
+          this.eqsOfSelectEqType.forEach(function (currentValue, index, arr) {
+            if (currentValue.id == _this.formData.equipmentId) {
+              str += currentValue.name + '的-'
+              return false
+            }
+          })
+          const name = new Array()
+          let i = 0
+          this.attrsOfSelectEq.forEach(function (currentValue, index, arr) {
+            i = _this.formData.equipmentAttrs.indexOf(currentValue.id)
+            if (i >= 0) {
+              name[i] = currentValue.equipmentAttribute.explanation
+            }
+          })
+          for (const j in name) {
+            str += '[' + name[j] + ':' + (max * 1 + j * 1 + 1) + ']-'
+          }
+          str += name.length + '个状态点依次添加到'
+          this.tunnelList.forEach(function (currentValue, index, arr) {
+            if (currentValue.id == _this.formData.tunnelId) {
+              str += currentValue.tunnelName
+              return false
+            }
+          })
+          str += '通道的末端(' + (max * 1 + 1) + ')'
+          this.$XModal.confirm(str).then(type => {
+            if (type == 'confirm') {
+              for (const i in _this.formData.equipmentAttrs) {
+                const param = {
+                  dataSource: _this.formData.dataSource,
+                  tunnelId: _this.formData.tunnelId,
+                  protocolPointType: _this.formData.protocolPointType,
+                  magnification: 1
+                }
+                param.gatherPoint = _this.formData.equipmentAttrs[i]
+                param.protocolPointNo = max * 1 + i * 1 + 1
+                _this.$axios.post('/dataExchange/senderProtocolDataPoint/saveDataPoint', param).then(res => {
+                  if (res.code == 0) {
+                    _this.$XModal.message({message: '保存转发点位成功'})
+                    _this.saveButDisable = false
+                  } else {
+                    _this.$XModal.message({message: '保存转发点位失败'})
+                    _this.saveButDisable = false
+                  }
+                })
+              }
+            } else {
+              _this.saveButDisable = false
+            }
+          })
+        } else if (this.formData.dataSource == 'FORECAST') {
+          if (this.formData.forecastPointNumber.length == 0) {
+            _this.$XModal.message({message: '并未选择需要添加的预测属性'})
+            return
+          }
+          let str = '将'
+          this.enums.forecastType.forEach(function (currentValue, index, arr) {
+            if (currentValue.value == _this.formData.forecastType) {
+              str += currentValue.label + '的-'
+              return false
+            }
+          })
+          const days = []
+          this.forecastDay.forEach(function (currentValue, index, arr) {
+            var index = _this.formData.forecastNode.indexOf(currentValue.value)
+            if (index >= 0) {
+              days[index] = currentValue.label
+            }
+          })
+          for (const j in days) {
+            str += '[第' + days[j] + ']-'
+          }
+          str += '每天' + _this.formData.forecastPointNumber.length + '个预测数据依次添加到'
+          this.tunnelList.forEach(function (currentValue, index, arr) {
+            if (currentValue.id == _this.formData.tunnelId) {
+              str += currentValue.tunnelName
+              return false
+            }
+          })
+          str += '通道的末端(' + (max * 1 + 1) + ')'
+          this.$XModal.confirm(str).then(type => {
+            if (type == 'confirm') {
+              const param = {
+                tunnelId: _this.formData.tunnelId,
+                protocolPointType: _this.formData.protocolPointType,
+                forecastType: _this.formData.forecastType,
+                forecastNodes: _this.formData.forecastNode,
+                pointNumbers: _this.formData.forecastPointNumber
+              }
+              _this.$axios.post('/dataExchange/senderProtocolDataPoint/batchSaveForecastPoint', param).then(res => {
+                if (res.code == 0) {
+                  _this.$XModal.message({message: '保存转发点位成功'})
+                  _this.saveButDisable = false
+                } else {
+                  _this.$XModal.message({message: '保存转发点位失败'})
+                  _this.saveButDisable = false
+                }
+              })
+            }
+          })
+        }
+      })
+    },
+
+    /**
+     * 预测天数多选下拉框值发生变化时 补充预测点位下拉框的值
+     */
+    forecastNodeChangeEvent() {
+      if (this.formData.forecastNode.length == 1) {
+        this.formData.forecastPointNumber = []
+        for (const i in this.forecastAttributeList) {
+          this.formData.forecastPointNumber.push(this.forecastAttributeList[i].pointNumber)
+        }
+      } else if (this.formData.forecastNode.length == 0) {
+        this.formData.forecastPointNumber = []
+      }
+    },
+    /**
+     * 当所选设备发生改变时 刷新该设备下对应的点位
+     */
+    flushAttrsOfSelectEq() {
+      this.formData.equipmentAttrs = []
+      const params = {
+        equipmentType: this.formData.eqType,
+        equipmentId: this.formData.equipmentId
+      }
+      if (this.formData.eqType == 'POWERSTATION') {
+        params.equipmentId = null
+      }
+      this.resultHandler(this.$axios.get('/dataExchange/protocolDataPoint/gatherDataPoint', {params: params})).then(res => {
+        this.attrsOfSelectEq = res
+      })
+    },
+
+    /**
+     *根据设备类型获取该类型下的设备属性
+     * 可以传设备类型的ID 或NAME  即 可以传0 或 POWERSTATION
+     * @param code
+     * @returns {*}
+     */
+    getEqsByEqTypeCode(typeCode) {
+      const axios = this.$axios
+      if (typeCode === 0 || typeCode === 'POWERSTATION') {
+        // 当设备类型是电站时对数数据进行处理后返回
+        return new Promise(function (resolve, reject) {
+          axios.get('/electricField/').then(res => {
+            if (res.code == 0) {
+              const eqs = []
+              res.data.id = res.data.stationCode
+              eqs.push(res.data)
+              res.data = eqs
+            }
+            resolve(res)
+          }).catch(error => {
+            reject(error)
+          })
+        })
+      } else {
+        return axios.get('/dataExchange/equipmentInfo/' + typeCode)
+      }
+    },
+
+    /**
+     *针对于后台返回的信息进行二次处理的方法
+     * @param  promise Promise
+     * @returns {Promise}
+     */
+    resultHandler(promise) {
+      const message = this.$message
+      return new Promise(function (resolve, reject) {
+        promise.then(res => {
+          if (res.code == 200) {
+            resolve(res.data)
+          } else {
+            message.error(res.msg)
+            reject(new Error(res.msg))
+          }
+        }).catch(error => {
+          message.error('请求后台时发生异常')
+          reject(error)
+        })
+      })
+    },
+    /**
+     * 查询到所有采集通道
+     * @returns {*}
+     */
+    getAllSenderTunnel() {
+      return this.$axios.get('/TunnelInfo/getTunnel/Slave')
+    },
+
+    /**
+     * 预测属性变化时  天数或者小时数随之变化
+     */
+    forecastDayChange() {
+      this.formData.forecastNode = ''
+      this.forecastAttributeList = []
+      if (this.formData.forecastType === 'ULTRA_SHORT_AVAILABLE' || this.formData.forecastType === 'ULTRA_SHORT_THEORETICAL') {
+        this.forecastDay = [{label: '第1小时', value: 0},
+          {label: '第2小时', value: 1},
+          {label: '第3小时', value: 2},
+          {label: '第4小时', value: 3}]
+      } else {
+        this.forecastDay = [{label: '第1天', value: 0}, {label: '第2天', value: 1}, {
+          label: '第3天',
+          value: 2
+        }, {label: '第4天', value: 3}, {label: '第5天', value: 4},
+          {label: '第6天', value: 5}, {label: '第7天', value: 6}, {label: '第8天', value: 7}, {
+            label: '第9天',
+            value: 8
+          }, {label: '第10天', value: 9}, {label: '第11天', value: 10}]
+      }
+      this.forecastAttributeList = []
+      this.resultHandler(this.$axios.get('/dataExchange/ForecastForSendAttribute/' + 0 + '/' + this.formData.forecastType)).then(res => {
+
+        this.forecastAttributeList = res
+      })
+    },
+
+    /**
+     * 根据所有通道信息构建通道下拉框的 展示数据
+     */
+    buildTunnelSelectData() {
+      this.resultHandler(this.getAllSenderTunnel()).then(res => {
+        if (res !== null) {
+          this.tunnelList = res
+        }
+      })
+    },
+
+    /**
+     *对form表单内的数据进行重置
+     */
+    resetForm() {
+      this.formData = {
+        eqType: '',
+        dataSource: 'GATHER',
+        tunnelId: '',
+        protocolPointType: '',
+        equipmentId: '',
+        forecastType: '',
+        forecastNode: [],
+        forecastPointNumber: [],
+        equipmentAttrs: []
+      }
+      this.protocolDataType = this.enums.ProtocolDataType
+    },
+    tunnelChange() {
+      this.protocolDataType = []
+      this.formData.protocolPointType = ''
+      for (let i = 0; i < this.tunnelList.length; i++) {
+        if (this.formData.tunnelId === this.tunnelList[i].id) {
+          if (this.tunnelList[i].tunnelType.substring(0, 3) === 'IEC' || this.tunnelList[i].tunnelType.substring(0, 3) === 'FIL') {
+            this.protocolDataType = [{label: '遥信开关量', value: 'A', key: 0}, {label: 'ABCD', value: 'ABCD', key: 9}]
+          } else if (this.tunnelList[i].tunnelType.substring(0, 3) === 'CDT') {
+            this.protocolDataType = [{label: '遥信开关量', value: 'A', key: 0}, {label: '+AB', value: 'P_AB', key: 1}]
+          } else {
+            this.protocolDataType = this.enums.ProtocolDataType
+          }
+        }
+      }
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>
+