xusl 1 năm trước cách đây
mục cha
commit
930db63707
20 tập tin đã thay đổi với 599 bổ sung88 xóa
  1. 6 6
      backend/src/main/java/com/jiayue/pfr/config/ProtocolConfig.java
  2. 57 0
      backend/src/main/java/com/jiayue/pfr/controller/di/AGC_AVCInfoController.java
  3. 1 1
      backend/src/main/java/com/jiayue/pfr/entity/AGC_AVCInfo.java
  4. 1 1
      backend/src/main/java/com/jiayue/pfr/entity/AllSkyCameraInfo.java
  5. 1 1
      backend/src/main/java/com/jiayue/pfr/entity/BoosterStationInfo.java
  6. 1 1
      backend/src/main/java/com/jiayue/pfr/entity/CollectingPowerLineInfo.java
  7. 1 1
      backend/src/main/java/com/jiayue/pfr/entity/InverterInfo.java
  8. 2 0
      backend/src/main/java/com/jiayue/pfr/entity/PowerStationStatusData.java
  9. 1 1
      backend/src/main/java/com/jiayue/pfr/entity/SubsidiaryEquipmentInfo.java
  10. 1 1
      backend/src/main/java/com/jiayue/pfr/entity/WeatherStationInfo.java
  11. 1 1
      backend/src/main/java/com/jiayue/pfr/entity/WindTowerInfo.java
  12. 1 1
      backend/src/main/java/com/jiayue/pfr/entity/WindTurbineInfo.java
  13. 1 1
      backend/src/main/java/com/jiayue/pfr/entity/abst/equipmentinfo/AbstractEquipmentInfo.java
  14. 7 30
      backend/src/main/java/com/jiayue/pfr/protocol/agc/Master104ForAgcApplication.java
  15. 34 32
      backend/src/main/java/com/jiayue/pfr/service/alg/listener/AgcLockListener.java
  16. 20 0
      backend/src/main/java/com/jiayue/pfr/service/di/impl/AGC_AVCInfoService.java
  17. 10 9
      backend/src/main/java/com/jiayue/pfr/service/di/impl/ImpactOnContainerOperation.java
  18. 102 0
      backend/src/main/java/com/jiayue/pfr/service/di/impl/RunAfterStarted.java
  19. 343 0
      ui/src/views/dataexchange/agc_avcInfo/index.vue
  20. 8 1
      ui/src/views/dataexchange/gatherdatapoint/index.vue

+ 6 - 6
backend/src/main/java/com/jiayue/pfr/config/ProtocolConfig.java

@@ -23,10 +23,10 @@ public class ProtocolConfig {
         fmRtuMasterBuilder.createByUnBlock();
         fmRtuMasterBuilder.createByUnBlock();
     }
     }
 
 
-    @Bean
-    public Iec104MasterBuilder iec104MasterBuilder() {
-        Iec104MasterBuilder simpleMasterBuilder=new Iec104MasterBuilder("127.0.0.1",2404);
-        simpleMasterBuilder.createByUnBlock();
-        return simpleMasterBuilder;
-    }
+//    @Bean
+//    public Iec104MasterBuilder agc104MasterBuilder() {
+//        Iec104MasterBuilder simpleMasterBuilder=new Iec104MasterBuilder("127.0.0.1",2404);
+//        simpleMasterBuilder.createByUnBlock();
+//        return simpleMasterBuilder;
+//    }
 }
 }

+ 57 - 0
backend/src/main/java/com/jiayue/pfr/controller/di/AGC_AVCInfoController.java

@@ -0,0 +1,57 @@
+package com.jiayue.pfr.controller.di;
+
+import com.jiayue.pfr.entity.AGC_AVCInfo;
+import com.jiayue.pfr.service.di.impl.AGC_AVCInfoService;
+import com.jiayue.pfr.util.SaResultRefit;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * AGC_AVC信息接口
+ *
+ * @author zy
+ * @version 3.0
+ */
+@RestController
+@RequestMapping("agcAvcInfo")
+@Slf4j
+public class AGC_AVCInfoController {
+  @Autowired
+  AGC_AVCInfoService agcAvcInfoService;
+
+  /*
+  * 查询
+  * */
+  @GetMapping
+  public SaResultRefit getALL() {
+    return SaResultRefit.data(agcAvcInfoService.list());
+  }
+
+  /*
+  * 保存
+  * */
+  @PostMapping
+  public SaResultRefit save(@RequestBody AGC_AVCInfo agc_avcInfo){
+    agcAvcInfoService.save(agc_avcInfo);
+    return SaResultRefit.data(1);
+  }
+
+  /*
+  * 更新
+  * */
+  @PutMapping
+  public SaResultRefit update(@RequestBody AGC_AVCInfo agc_avcInfo){
+    agcAvcInfoService.updateById(agc_avcInfo);
+    return SaResultRefit.data(1);
+  }
+
+  /*
+  * 删除
+  * */
+  @DeleteMapping("/{id}")
+  public SaResultRefit delete(@PathVariable String id) {
+    agcAvcInfoService.removeById(id);
+    return SaResultRefit.data(1);
+  }
+}

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

@@ -19,6 +19,6 @@ import lombok.EqualsAndHashCode;
 @TableName("t_agc_avcinfo")
 @TableName("t_agc_avcinfo")
 public class AGC_AVCInfo extends AbstractEquipmentInfo {
 public class AGC_AVCInfo extends AbstractEquipmentInfo {
 	public AGC_AVCInfo() {
 	public AGC_AVCInfo() {
-		super.setEquipmentType(EquipmentTypeEnum.AGC_AVC);
+		super.setEquipmentType(EquipmentTypeEnum.AGC_AVC.name());
 	}
 	}
 }
 }

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

@@ -21,7 +21,7 @@ import java.math.BigDecimal;
 @TableName("t_all_sky_camera_info")
 @TableName("t_all_sky_camera_info")
 public class AllSkyCameraInfo extends AbstractEquipmentInfo {
 public class AllSkyCameraInfo extends AbstractEquipmentInfo {
     public AllSkyCameraInfo() {
     public AllSkyCameraInfo() {
-        super.setEquipmentType(EquipmentTypeEnum.ALL_SKY_CAMERA);
+        super.setEquipmentType(EquipmentTypeEnum.ALL_SKY_CAMERA.name());
     }
     }
 
 
     /**
     /**

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

@@ -19,6 +19,6 @@ import lombok.EqualsAndHashCode;
 @TableName(value = "t_booster_station_info")
 @TableName(value = "t_booster_station_info")
 public class BoosterStationInfo extends AbstractEquipmentInfo {
 public class BoosterStationInfo extends AbstractEquipmentInfo {
 	public BoosterStationInfo() {
 	public BoosterStationInfo() {
-		super.setEquipmentType(EquipmentTypeEnum.BOOSTERSTATION);
+		super.setEquipmentType(EquipmentTypeEnum.BOOSTERSTATION.name());
 	}
 	}
 }
 }

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

@@ -25,6 +25,6 @@ public class CollectingPowerLineInfo extends AbstractEquipmentInfo {
 	private String code;
 	private String code;
 
 
 	public CollectingPowerLineInfo() {
 	public CollectingPowerLineInfo() {
-		super.setEquipmentType(EquipmentTypeEnum.JDX);
+		super.setEquipmentType(EquipmentTypeEnum.JDX.name());
 	}
 	}
 }
 }

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

@@ -22,7 +22,7 @@ import java.math.BigDecimal;
 public class InverterInfo extends AbstractEquipmentInfo {
 public class InverterInfo extends AbstractEquipmentInfo {
 
 
     public InverterInfo() {
     public InverterInfo() {
-        super.setEquipmentType(EquipmentTypeEnum.INVERTER);
+        super.setEquipmentType(EquipmentTypeEnum.INVERTER.name());
     }
     }
     /**
     /**
      * 备用字段A 应用于样板机编号
      * 备用字段A 应用于样板机编号

+ 2 - 0
backend/src/main/java/com/jiayue/pfr/entity/PowerStationStatusData.java

@@ -1,5 +1,6 @@
 package com.jiayue.pfr.entity;
 package com.jiayue.pfr.entity;
 
 
+import com.baomidou.mybatisplus.annotation.TableName;
 import com.jiayue.pfr.entity.abst.equipmentstatus.AbstractEquipmentStatusData;
 import com.jiayue.pfr.entity.abst.equipmentstatus.AbstractEquipmentStatusData;
 import lombok.Data;
 import lombok.Data;
 
 
@@ -14,6 +15,7 @@ import java.math.BigDecimal;
  * @since 2019/8/2 9:34
  * @since 2019/8/2 9:34
  */
  */
 @Data
 @Data
+@TableName("t_power_station_status_data")
 public class PowerStationStatusData extends AbstractEquipmentStatusData {
 public class PowerStationStatusData extends AbstractEquipmentStatusData {
 
 
 	private static final long serialVersionUID = 1L;
 	private static final long serialVersionUID = 1L;

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

@@ -27,7 +27,7 @@ public class SubsidiaryEquipmentInfo extends AbstractEquipmentInfo {
     /**
     /**
      * 设备类型
      * 设备类型
      */
      */
-    protected EquipmentTypeEnum equipmentType;
+    protected String equipmentType;
 
 
 
 
 }
 }

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

@@ -22,7 +22,7 @@ import lombok.EqualsAndHashCode;
 @TableName("t_weather_station_info")
 @TableName("t_weather_station_info")
 public class WeatherStationInfo extends AbstractEquipmentInfo {
 public class WeatherStationInfo extends AbstractEquipmentInfo {
 	public WeatherStationInfo() {
 	public WeatherStationInfo() {
-		super.setEquipmentType(EquipmentTypeEnum.WEATHERSTATION);
+		super.setEquipmentType(EquipmentTypeEnum.WEATHERSTATION.name());
 	}
 	}
 
 
 	/**
 	/**

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

@@ -19,7 +19,7 @@ import lombok.EqualsAndHashCode;
 public class WindTowerInfo extends AbstractEquipmentInfo {
 public class WindTowerInfo extends AbstractEquipmentInfo {
 
 
     public WindTowerInfo() {
     public WindTowerInfo() {
-        super.setEquipmentType(EquipmentTypeEnum.WINDTOWER);
+        super.setEquipmentType(EquipmentTypeEnum.WINDTOWER.name());
     }
     }
 
 
     /**
     /**

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

@@ -20,7 +20,7 @@ import javax.validation.constraints.Digits;
 @TableName("t_wind_turbine_info")
 @TableName("t_wind_turbine_info")
 public class WindTurbineInfo extends AbstractEquipmentInfo {
 public class WindTurbineInfo extends AbstractEquipmentInfo {
     public WindTurbineInfo() {
     public WindTurbineInfo() {
-        super.setEquipmentType(EquipmentTypeEnum.WINDTURBINE);
+        super.setEquipmentType(EquipmentTypeEnum.WINDTURBINE.name());
     }
     }
     /**
     /**
      * 备用字段A 应用于样板机编号
      * 备用字段A 应用于样板机编号

+ 1 - 1
backend/src/main/java/com/jiayue/pfr/entity/abst/equipmentinfo/AbstractEquipmentInfo.java

@@ -23,7 +23,7 @@ public class AbstractEquipmentInfo {
     /**
     /**
      * 设备类型
      * 设备类型
      */
      */
-    protected EquipmentTypeEnum equipmentType;
+    protected String equipmentType;
 
 
     /**
     /**
      * 名称
      * 名称

+ 7 - 30
backend/src/main/java/com/jiayue/pfr/protocol/agc/Master104ForAgcApplication.java

@@ -1,5 +1,7 @@
 package com.jiayue.pfr.protocol.agc;
 package com.jiayue.pfr.protocol.agc;
 
 
+import com.jiayue.pfr.config.ProtocolConfig;
+import com.jiayue.pfr.container.ProtocolTunnelContainer;
 import org.checkerframework.checker.units.qual.A;
 import org.checkerframework.checker.units.qual.A;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
@@ -21,11 +23,11 @@ import wei.yigulu.iec104.util.SendCommandHelper;
  */
  */
 @Service
 @Service
 public class Master104ForAgcApplication {
 public class Master104ForAgcApplication {
-//    @Autowired
-//    Iec104MasterBuilder iec104MasterBuilder;
+    @Autowired
+    Iec104MasterBuilder agc104MasterBuilder;
 
 
     public void Master104ForAgcApplication(){
     public void Master104ForAgcApplication(){
-
+    // 间隔10分钟左右在发一次
 
 
         //创建总召唤类型I帧
         //创建总召唤类型I帧
         TotalSummonType totalSummonType=new TotalSummonType();
         TotalSummonType totalSummonType=new TotalSummonType();
@@ -37,35 +39,10 @@ public class Master104ForAgcApplication {
         asdu.setCommonAddress(1);
         asdu.setCommonAddress(1);
         Apdu apdu=new Apdu().setAsdu(asdu);
         Apdu apdu=new Apdu().setAsdu(asdu);
         try {
         try {
-//            iec104MasterBuilder.sendFrameToOpposite(apdu.encode());
+            ProtocolTunnelContainer.getInstance().getTunnel(3).get
+            agc104MasterBuilder.sendFrameToOpposite(apdu.encode());
         } catch (Exception e) {
         } catch (Exception e) {
             throw new RuntimeException(e);
             throw new RuntimeException(e);
         }
         }
-
-
-
-//        ShortFloatCommand command = new ShortFloatCommand(dataAddress, value);
-//        Apdu apdu = new Apdu();
-//        Asdu asdu = command.generateBack();
-//        asdu.setCommonAddress(commonAddress);
-//        asdu.setOriginatorAddress(sourceAddress);
-//        asdu.getCot().setNot(6);
-//        apdu.setAsdu(asdu);
-//        SendAndReceiveNumUtil.sendIFrame(apdu, masterBuilder.getFuture().channel(), masterBuilder.getLog());
-//        CommandWaiter commandWaiter = new CommandWaiter(masterBuilder.getFuture().channel().id(), apdu, dataAddress);
-//        commandWaiters.add(commandWaiter);
-//
-//        IecDataInterface data;
-//        try {
-//            data = commandWaiter.get();
-//        } catch (Exception var14) {
-//            throw var14;
-//        } finally {
-//            commandWaiters.remove(commandWaiter);
-//        }
-
-
-
-
     }
     }
 }
 }

+ 34 - 32
backend/src/main/java/com/jiayue/pfr/service/alg/listener/AgcLockListener.java

@@ -34,7 +34,7 @@ public class AgcLockListener implements ApplicationListener<AgcEvent> {
     @Autowired
     @Autowired
     BizYaoDataService bizYaoDataService;
     BizYaoDataService bizYaoDataService;
     @Autowired
     @Autowired
-    Iec104MasterBuilder iec104MasterBuilder;
+    Iec104MasterBuilder agc104MasterBuilder;
 
 
     @Async
     @Async
     @Override
     @Override
@@ -43,40 +43,42 @@ public class AgcLockListener implements ApplicationListener<AgcEvent> {
         BizYaoData bizYaoData = agcEvent.getBizYaoData();
         BizYaoData bizYaoData = agcEvent.getBizYaoData();
         if (obj.toString().equals(ActionResetEnum.ACTION.getCode())){
         if (obj.toString().equals(ActionResetEnum.ACTION.getCode())){
             // 动作
             // 动作
-            fLogger.info("给AGC闭锁开始");
+            fLogger.info("AGC闭锁开始");
+            boolean bsBoolean = false;
+            try {
+                bsBoolean = SendCommandHelper.sendBooleanCommand(agc104MasterBuilder, 0, 1, 25089, true);
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
 
 
-//            SingleBooleanCommand command = new SingleBooleanCommand();
-//            Apdu apdu = new Apdu();
-//            Asdu asdu = command.generateBack();
-//            asdu.setCommonAddress(1);
-//            asdu.getCot().setNot(6);
-//            asdu.getVsq().setSq(0);
-//            asdu.getVsq().setNum(1);
-//            asdu.setOriginatorAddress(0);
-//            command.setAddresses(new InformationBodyAddress(25089));
-//            command.setVal(new IeSingleBooleanCommand(true));
-//
-//            apdu.setAsdu(asdu);
-
-            SendCommandHelper.sendBooleanCommand(iec104MasterBuilder.getIec104Master(), 0,1, 25089, true);
-//                    (apdu, iec104MasterBuilder.iec104MasterBuilder());
-
-
-
-
-
-
-            bizYaoData.setAgcLock("0");
-            bizYaoData.setAction("0");
-            bizYaoDataService.update(bizYaoData);
-            fLogger.info("给AGC闭锁结束");
+            if (bsBoolean){
+                bizYaoData.setAgcLock("0");
+                bizYaoData.setAction("0");
+                bizYaoDataService.update(bizYaoData);
+                fLogger.info("AGC闭锁成功");
+            }
+            else {
+                fLogger.info("AGC闭锁失败");
+            }
         }
         }
         else if (obj.toString().equals(ActionResetEnum.RESET.getCode())){
         else if (obj.toString().equals(ActionResetEnum.RESET.getCode())){
-            // 复归
-            bizYaoData.setAgcLock("1");
-            bizYaoData.setAction("1");
-            bizYaoDataService.update(bizYaoData);
-            fLogger.info("AGC解锁");
+            boolean bsBoolean = false;
+            try {
+                bsBoolean = SendCommandHelper.sendBooleanCommand(agc104MasterBuilder, 0, 1, 25089, false);
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+
+            if (bsBoolean){
+                // 复归
+                bizYaoData.setAgcLock("1");
+                bizYaoData.setAction("1");
+                bizYaoDataService.update(bizYaoData);
+                fLogger.info("AGC解锁成功");
+            }
+            else {
+                fLogger.info("AGC解锁失败");
+            }
         }
         }
     }
     }
 }
 }

+ 20 - 0
backend/src/main/java/com/jiayue/pfr/service/di/impl/AGC_AVCInfoService.java

@@ -0,0 +1,20 @@
+package com.jiayue.pfr.service.di.impl;
+
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jiayue.pfr.entity.AGC_AVCInfo;
+import com.jiayue.pfr.mapper.di.AGC_AVCInfoMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * AGC_AVC信息service类
+ *
+ * @author zy
+ * @version 3.0
+ */
+@Service
+@Slf4j
+public class AGC_AVCInfoService extends ServiceImpl<AGC_AVCInfoMapper, AGC_AVCInfo> {
+}

+ 10 - 9
backend/src/main/java/com/jiayue/pfr/service/di/impl/ImpactOnContainerOperation.java

@@ -1,6 +1,7 @@
 package com.jiayue.pfr.service.di.impl;
 package com.jiayue.pfr.service.di.impl;
 
 
 
 
+import com.jiayue.pfr.backenum.EquipmentTypeEnum;
 import com.jiayue.pfr.backenum.TunnelType;
 import com.jiayue.pfr.backenum.TunnelType;
 import com.jiayue.pfr.container.DataPackerContainer;
 import com.jiayue.pfr.container.DataPackerContainer;
 import com.jiayue.pfr.container.ProtocolDataContainer;
 import com.jiayue.pfr.container.ProtocolDataContainer;
@@ -206,24 +207,24 @@ public class ImpactOnContainerOperation {
    */
    */
   public void equipmentDataPackerReparseDataPoint(AbstractEquipmentInfo equipmentInfo) {
   public void equipmentDataPackerReparseDataPoint(AbstractEquipmentInfo equipmentInfo) {
     log.info("开始创建{}的数据包装类", equipmentInfo.getName());
     log.info("开始创建{}的数据包装类", equipmentInfo.getName());
-    AbstractDataPacker equipmentDataPacker = DataPackerContainer.getInstance().getPacker(equipmentInfo.getEquipmentType().getMessage() + "-" + equipmentInfo.getId());
-    List<ProtocolGatherDataPoint> dataPoints = protocolGatherDataPointService.getByEquipmentId(equipmentInfo.getId(), equipmentInfo.getEquipmentType().name());
+    AbstractDataPacker equipmentDataPacker = DataPackerContainer.getInstance().getPacker(EquipmentTypeEnum.valueOf(equipmentInfo.getEquipmentType()).getMessage() + "-" + equipmentInfo.getId());
+    List<ProtocolGatherDataPoint> dataPoints = protocolGatherDataPointService.getByEquipmentId(equipmentInfo.getId(), EquipmentTypeEnum.valueOf(equipmentInfo.getEquipmentType()).name());
     if (equipmentDataPacker == null && dataPoints.size()>0) {
     if (equipmentDataPacker == null && dataPoints.size()>0) {
       EquipmentDataPacker dataPacker = null;
       EquipmentDataPacker dataPacker = null;
-      switch (equipmentInfo.getEquipmentType()) {
-        case INVERTER:
+      switch (EquipmentTypeEnum.valueOf(equipmentInfo.getEquipmentType()).name()) {
+        case "INVERTER":
           dataPacker = new EquipmentDataPacker(new InverterStatusData(), dataPoints);
           dataPacker = new EquipmentDataPacker(new InverterStatusData(), dataPoints);
           break;
           break;
-        case WINDTOWER:
+        case "WINDTOWER":
           dataPacker = new EquipmentDataPacker(new WindTowerStatusData(), dataPoints);
           dataPacker = new EquipmentDataPacker(new WindTowerStatusData(), dataPoints);
           break;
           break;
-        case WINDTURBINE:
+        case "WINDTURBINE":
           dataPacker = new EquipmentDataPacker(new WindTurbineStatusData(), dataPoints);
           dataPacker = new EquipmentDataPacker(new WindTurbineStatusData(), dataPoints);
           break;
           break;
-        case WEATHERSTATION:
+        case "WEATHERSTATION":
           dataPacker = new EquipmentDataPacker(new WeatherStationStatusData(), dataPoints);
           dataPacker = new EquipmentDataPacker(new WeatherStationStatusData(), dataPoints);
           break;
           break;
-        case AGC_AVC:
+        case "AGC_AVC":
           dataPacker = new EquipmentDataPacker(new AGC_AVCStatusData(), dataPoints);
           dataPacker = new EquipmentDataPacker(new AGC_AVCStatusData(), dataPoints);
           break;
           break;
         default:
         default:
@@ -232,7 +233,7 @@ public class ImpactOnContainerOperation {
       if (dataPacker != null && equipmentInfo.getCinterval() != null && equipmentInfo.getCinterval() > 2) {
       if (dataPacker != null && equipmentInfo.getCinterval() != null && equipmentInfo.getCinterval() > 2) {
         dataPacker.setInterval(equipmentInfo.getCinterval());
         dataPacker.setInterval(equipmentInfo.getCinterval());
       }
       }
-      DataPackerContainer.getInstance().addPacker(equipmentInfo.getEquipmentType().getMessage() + "-" + equipmentInfo.getId(), dataPacker);
+      DataPackerContainer.getInstance().addPacker(EquipmentTypeEnum.valueOf(equipmentInfo.getEquipmentType()).getMessage() + "-" + equipmentInfo.getId(), dataPacker);
     } else {
     } else {
       if (dataPoints.size() > 0) {
       if (dataPoints.size() > 0) {
         ((EquipmentDataPacker) equipmentDataPacker).parseGatherDataPoint(dataPoints);
         ((EquipmentDataPacker) equipmentDataPacker).parseGatherDataPoint(dataPoints);

+ 102 - 0
backend/src/main/java/com/jiayue/pfr/service/di/impl/RunAfterStarted.java

@@ -0,0 +1,102 @@
+package com.jiayue.pfr.service.di.impl;
+
+import com.jiayue.pfr.backenum.DataSourceEnum;
+import com.jiayue.pfr.backenum.EquipmentTypeEnum;
+import com.jiayue.pfr.backenum.TunnelType;
+import com.jiayue.pfr.container.DataPackerContainer;
+import com.jiayue.pfr.container.ProtocolDataContainer;
+import com.jiayue.pfr.dataprocesser.datapacker.iml.EquipmentDataPacker;
+import com.jiayue.pfr.dataprocesser.datapacker.iml.PowerStationDataPacker;
+import com.jiayue.pfr.entity.AGC_AVCStatusData;
+import com.jiayue.pfr.entity.BaseTunnelInfo;
+import com.jiayue.pfr.entity.ProtocolGatherDataPoint;
+import com.jiayue.pfr.entity.abst.equipmentinfo.AbstractEquipmentInfo;
+import com.jiayue.pfr.tunnelworker.workassist.TunnelBuilder;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.boot.ApplicationArguments;
+import org.springframework.boot.ApplicationRunner;
+import org.springframework.stereotype.Component;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.List;
+
+/**
+ * 启动成功后自动运行
+ *
+ * @author 修唯xiuwei
+ * @version 3.0
+ */
+@Component
+@Slf4j
+public class RunAfterStarted implements ApplicationRunner {
+
+
+  private final
+  TunnelInfoService tunnelInfoService;
+
+  private final
+  ProtocolGatherDataPointService protocolDataPointService;
+
+  private final EquipmentInfoService equipmentInfoService;
+
+  private final ElectricFieldService electricFieldService;
+//
+//  private final SysParameterService sysParameterService;
+//  private final WeatherStationStatusDataFilter weatherStationStatusDataFilter;
+//
+  private final PowerStationDataPacker powerStationDataPacker;
+//
+//  private final FileParseTunnelService fileParseTunnelService;
+//
+//  private final EquipmentStatisticalDataCalculatorService equipmentStatisticalDataCalculatorService;
+
+  /**
+   * 在 spring 启动后执行
+   */
+  public RunAfterStarted(TunnelInfoService tunnelInfoService, ProtocolGatherDataPointService protocolDataPointService, EquipmentInfoService equipmentInfoService, ElectricFieldService electricFieldService, FileParseTunnelService fileParseTunnelService, PowerStationDataPacker powerStationDataPacker) {
+    this.tunnelInfoService = tunnelInfoService;
+    this.protocolDataPointService = protocolDataPointService;
+    this.equipmentInfoService = equipmentInfoService;
+    this.electricFieldService = electricFieldService;
+//    this.sysParameterService = sysParameterService;
+//    this.weatherStationStatusDataFilter = weatherStationStatusDataFilter;
+//    this.powerStationDataPacker = powerStationDataPacker;
+//    this.fileParseTunnelService = fileParseTunnelService;
+//    this.equipmentStatisticalDataCalculatorService = equipmentStatisticalDataCalculatorService;
+    this.powerStationDataPacker = powerStationDataPacker;
+  }
+
+  /**
+   * 查询出数据库内所有通道以及它们负责采集的点位
+   * 查询出所有设备的所需的点位  构建他们专属的DataPacker
+   * 构建出定时任务
+   **/
+  @Override
+  public void run(ApplicationArguments args) throws Exception {
+    //获取所有的通道信息并创建通道
+    buildAllTunnel();
+  }
+
+  /**
+   * 创建所有的通道
+   */
+  private void buildAllTunnel() {
+    log.info("开始创建协议通道");
+    List<BaseTunnelInfo> tunnels = tunnelInfoService.getAllTunnel();
+    for (BaseTunnelInfo tunnel : tunnels) {
+      if (tunnel.getIsEnable() && !TunnelType.FILEPARSE.equals(tunnel.getTunnelType())) {
+        try {
+          TunnelBuilder.buildTunnel(tunnel).startTunnel();
+          Thread.sleep(3000L);
+        } catch (Exception e) {
+          log.error("创建通道{}时发生异常", tunnel.getTunnelName(), e);
+        }
+      }
+    }
+  }
+
+
+
+}

+ 343 - 0
ui/src/views/dataexchange/agc_avcInfo/index.vue

@@ -0,0 +1,343 @@
+<template>
+  <div class="app-container">
+    <div>
+      <el-card>
+        <div slot="header" class="clearfix">
+          <b><span>AGC_AVC信息</span></b>
+          <el-button
+            :loading="loadButton"
+            style="float: right;padding:3px 10px 3px 3px;"
+            type="text"
+            @click="exportDataEvent"
+          >导出数据
+          </el-button>
+        </div>
+        <el-button type="primary" size="small" style="round-clip: 10px" :loading="loadButton" @click="insertEvent">添加</el-button>
+        <div style="padding-top: 10px">
+          <vxe-table
+            v-show="showTable"
+            ref="xTable"
+            export-config
+            :keep-source="true"
+            align="center"
+            :loading="loading"
+            highlight-current-row
+            auto-resize
+            border
+            resizable
+            max-height="600px"
+            :edit-rules="rules"
+            :data="tableData"
+            :edit-config="{trigger: 'manual', mode: 'row',autoClear: false,icon:'none'}"
+          >
+            <vxe-table-column title="AGC_AVC信息" align="center">
+              <vxe-table-column
+                field="name"
+                title="名称"
+                width="8%"
+                align="center"
+                :edit-render="{name: '$input', attrs: {type: 'text'}}"
+              />
+              <vxe-table-column
+                field="modelNumber"
+                title="型号"
+                width="8%"
+                align="center"
+                :edit-render="{name: '$input', attrs: {type: 'text'}}"
+              />
+              <vxe-table-column
+                field="manufacturer"
+                title="生产商"
+                width="8%"
+                align="center"
+                :edit-render="{name: '$input', attrs: {type: 'text'}}"
+              />
+              <vxe-table-column
+                width="150px"
+                field="installationTime"
+                title="安装时间"
+                align="center"
+                :edit-render="{props: {type: 'default'}}"
+              >
+                <template v-slot:edit="{ row }">
+                  <el-date-picker
+                    v-model="row.installationTime"
+                    size="mini"
+                    style="width: 100%"
+                    type="date"
+                    placeholder="选择日期:"
+                  />
+                </template>
+                <template v-slot="{ row }">{{ timestampToTime(row.installationTime) }}</template>
+              </vxe-table-column>
+              <vxe-table-column
+                field="report"
+                title="是否上报"
+                width="8%"
+                align="center"
+                :edit-render="{name: '$select', options: trueOrFalse}"
+              />
+              <vxe-table-column
+                field="cinterval"
+                title="入库间隔(单位s)"
+                width="8%"
+                align="center"
+                :edit-render="{name: '$select', options: intervals}"
+              />
+              <vxe-table-column title="操作" fixed="right" width="10%" align="center">
+                <template v-slot="{ row }">
+                  <template v-if="$refs.xTable.isActiveByRow(row)">
+                    <el-button
+                      type="success"
+                      style="padding: 3px 4px 3px 4px;margin: 2px;"
+                      size="medium"
+                      icon="el-icon-edit"
+                      @click="editSave(row)"
+                    >保存
+                    </el-button>
+                    <el-button
+                      class="cancel-btn"
+                      icon="el-icon-refresh"
+                      type="warning"
+                      style="padding: 3px 4px 3px 4px;margin: 2px;"
+                      size="medium"
+                      @click="cancelRowEvent(row)"
+                    >取消
+                    </el-button>
+                  </template>
+                  <template v-else>
+                    <el-button
+                      :loading="loadButton"
+                      type="primary"
+                      style="padding: 3px 4px 3px 4px;margin: 2px;"
+                      size="medium "
+                      icon="el-icon-edit"
+                      @click="editRowEvent(row)"
+                    >编辑
+                    </el-button>
+                    <el-button
+                      :loading="loadButton"
+                      type="danger"
+                      style="padding: 3px 4px 3px 4px;margin: 2px;"
+                      size="medium "
+                      icon="el-icon-delete"
+                      @click="deleteRowEvent(row)"
+                    >删除
+                    </el-button>
+                  </template>
+                </template>
+              </vxe-table-column>
+
+            </vxe-table-column>
+          </vxe-table>
+          <vxe-pager
+            v-show="!loadButton&&showTable"
+            perfect
+            :current-page.sync="currentPage"
+            :page-size.sync="pageSize"
+            :total="total"
+            :page-sizes="[10,50,100]"
+            :layouts="['PrevJump', 'PrevPage','JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']"
+          />
+        </div>
+      </el-card>
+    </div>
+    <!-- 删除提示框 -->
+    <el-dialog :visible.sync="delVisible" title="提示" width="300px" center>
+      <div class="del-dialog-cnt">删除不可恢复,是否确定删除?</div>
+      <span slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="deleteCancel()">取 消</el-button>
+        <el-button type="primary" @click="deleteInfo()">确 定</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'Index',
+  data() {
+    const checkName = (rule, value, callback) => {
+      var s6 = this.tableData
+      if (value == null || value === '') {
+        callback(new Error('请填写逆变器名称'))
+      }
+      for (let i = 0; i < s6.length; i++) {
+        if (this.mid == '' || this.mid == undefined) {
+          // 新增
+          if ((value == s6[i].name)) {
+            callback(new Error('名称不能重复'))
+          }
+        } else {
+          // 修改
+          if (this.mid != s6[i].id) {
+            if ((value == s6[i].name)) {
+              callback(new Error('名称不能重复'))
+            }
+          }
+        }
+      }
+      callback()
+    }
+    return {
+      mid: '',
+      rowId: '',
+      loadButton: false,
+      loading: false,
+      showTable: true,
+      delVisible: false,
+      currentPage: 1,
+      pageSize: 10,
+      total: 0,
+      tableData: [],
+      trueOrFalse: [{ label: '是', value: true }, { label: '否', value: false }],
+      intervals: [{ key: 0, value: 0, label: '不入库' },{ key: 60, value: 60, label: '一分钟' }, { key: 900, value: 900, label: '十五分钟' }],
+      // 是否为编辑
+      isEdit: false,
+      // 表单验证规则
+      rules: {
+        name: [
+          { required: true, validator: checkName }
+        ],
+        modelNumber: [
+          { required: true, message: 'AGC_AVC型号不能为空', trigger: 'blur' }
+        ],
+        manufacturer: [
+          { required: true, message: '制造商名称不能为空' }
+        ],
+        installationTime: [
+          { required: true, message: '请选择日期' }
+        ],
+        report: [
+          { required: true, message: '是否上报不能为空', trigger: 'change' }
+        ]
+      }
+    }
+  },
+  mounted() {
+    this.getInfo()
+  },
+  methods: {
+    getInfo() {
+      this.$axios.get('/agcAvcInfo').then(res => {
+        console.log(res.data)
+        this.tableData = res.data
+        this.total = res.data.length
+        this.loading = false
+      }).catch((error) => {
+        this.$message.error('获取AGC_AVC信息出错' + error)
+      })
+    },
+    editSave(row) {
+      this.$refs.xTable.validate(this.$refs.xTable.getCurrentRecord(),valid => {
+        if (valid) {
+          this.$refs.xTable.clearActived().then(() => {
+            if (this.isEdit) {
+              console.log(row)
+              row.equipmentType = 'AGC_AVC'
+              // 编辑保存
+              this.$axios.put('/agcAvcInfo/', row).then(res => {
+                this.$message({
+                  message: '修改成功',
+                  type: 'success'
+                })
+                this.loadButton = false
+                this.getInfo()
+              }).catch((error) => {
+                this.$refs.xTable.setActiveRow(row)
+                this.$message.error('修改AGC_AVC出错' + error)
+              })
+            } else {
+              // 新增保存
+              this.$axios.post('/agcAvcInfo/', row).then(res => {
+                this.$message({
+                  message: '保存成功',
+                  type: 'success'
+                })
+                this.loadButton = false
+                this.getInfo()
+              }).catch((error) => {
+                this.$refs.xTable.setActiveRow(row)
+                this.$message.error('保存AGC_AVC出错' + error)
+              })
+            }
+          })
+        } else {
+          this.$XModal.message({status: 'error', message: '校验不通过!'})
+        }
+      })
+    },
+    editRowEvent(row) {
+      this.mid = row.id
+      this.isEdit = true
+      this.loadButton = true
+      this.$refs.xTable.setActiveRow(row)
+    },
+    insertEvent(row) {
+      this.mid = ''
+      this.showTable = true
+      this.piadd = false
+      this.isEdit = false
+      this.loadButton = true
+      this.$refs.xTable.insert({ interval: 60 }).then(({ row }) => this.$refs.xTable.setActiveRow(row))
+    },
+    exportDataEvent() {
+      this.$axios.get('/agcAvcInfo/').then(res => {
+        const data = res.data
+        this.$refs.xTable.exportData({
+          filename: 'AGC_AVC信息',
+          type: 'csv',
+          isHeader: true,
+          isFooter: true,
+          data
+        })
+      })
+    },
+    cancelRowEvent(row) {
+      const xTable = this.$refs.xTable
+      xTable.clearActived().then(() => {
+        // 还原行数据
+        if (this.isEdit) {
+          //编辑
+          xTable.revertData(row)
+        } else {
+          //新增
+          xTable.remove(row)
+        }
+        this.loadButton = false;
+      })
+    },
+    // 删除场站信息
+    deleteRowEvent(row) {
+      this.rowId = row.id
+      this.delVisible = true
+    },
+    deleteCancel() {
+      this.delVisible = false
+    },
+    deleteInfo() {
+      this.$axios.delete('/agcAvcInfo/' + this.rowId).then(res => {
+        this.$message({
+          message: '删除成功',
+          type: 'success'
+        })
+        this.delVisible = false
+        this.getInfo()
+      }).catch((error) => {
+        this.$message.error('删除AGC_AVC信息出错' + error)
+      })
+    },
+    timestampToTime(time) {
+      const date = new Date(time) // 时间戳为10位需*1000,时间戳为13位的话不需乘1000
+      const Y = date.getFullYear() + '-'
+      const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
+      const D = date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()
+      return Y + M + D
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

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

@@ -1124,7 +1124,14 @@
         belongTo = this.elTableData[0].name
         belongTo = this.elTableData[0].name
       } else {
       } else {
         for (let i = 0; i < this.eqTableData.length; i++) {
         for (let i = 0; i < this.eqTableData.length; i++) {
-          if (row.row.equipmentId === this.eqTableData[i].id && row.row.equipmentAttribute.equipmentType === this.eqTableData[i].equipmentType) {
+          // console.log(row.row.equipmentId)
+          // console.log(this.eqTableData[i].id)
+          // console.log(row.row.equipmentAttribute.equipmentType)
+          // console.log(this.eqTableData[i].equipmentType)
+          if (row.row.equipmentId == this.eqTableData[i].id) {
+            belongTo = this.eqTableData[i].name
+          }
+          if (row.row.equipmentId == this.eqTableData[i].id && row.row.equipmentAttribute.equipmentType == this.eqTableData[i].equipmentType) {
             belongTo = this.eqTableData[i].name
             belongTo = this.eqTableData[i].name
           }
           }
         }
         }