浏览代码

增加光伏辐照录入定时

wangb@gyee-china.com 1 年之前
父节点
当前提交
49616ba629

+ 30 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/Irradiationinput/IrradiationinputController.java

@@ -0,0 +1,30 @@
+package com.gyee.runeconomy.controller.Irradiationinput;
+
+import com.gyee.runeconomy.dto.AjaxResult;
+import com.gyee.runeconomy.service.Irradiationinput.IrradiationinputService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.annotation.Resource;
+
+@Controller
+@RequestMapping("/Irradiation")
+@Api(value = "驾驶舱", tags = "驾驶舱")
+public class IrradiationinputController {
+
+    @Resource
+    private IrradiationinputService irradiationinputService;
+
+//    @Scheduled(cron = "*/1 * * * * *")
+    @GetMapping("/input")
+    @ResponseBody
+    @ApiOperation(value = "首页", notes = "首页")
+    public AjaxResult getinformation() throws Exception {
+          irradiationinputService.getcockpit();
+            return AjaxResult.success();
+    }
+}

+ 3 - 10
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/PVSystemEfficiencyCalculator/PVSystemEfficiencyCalculatorController.java

@@ -10,6 +10,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -31,24 +32,16 @@ public class PVSystemEfficiencyCalculatorController {
 
     @Resource
     private PrAnalysisService prAnalysisService;
-
+    @Scheduled(cron = "0 0 11 * * ?")
     @GetMapping("/statistics")
     @ResponseBody
     @ApiOperation(value = "光伏系统效率计算", notes = "光伏系统效率计算")
 
     public AjaxResult forecast() throws Exception {
 
-//        Map<String, Object> resultList = new LinkedHashMap<>();
-
-//        qncalculator.planvalue();
         calculator.planvalue();
-//        if (null != resultList) {
-//            return AjaxResult.successData(200, resultList);
-//        } else {
-//            return AjaxResult.error(500, "操作失败");
-//        }
 
-        return AjaxResult.successData(200, null);
+        return AjaxResult.success();
     }
 
 

+ 20 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/ProEconIrradiationInputController.java

@@ -0,0 +1,20 @@
+package com.gyee.runeconomy.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 光伏辐照录入表 前端控制器
+ * </p>
+ *
+ * @author wang
+ * @since 2023-11-01
+ */
+@RestController
+@RequestMapping("//pro-econ-irradiation-input")
+public class ProEconIrradiationInputController {
+
+}

+ 16 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/mapper/auto/ProEconIrradiationInputMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.runeconomy.mapper.auto;
+
+import com.gyee.runeconomy.model.auto.ProEconIrradiationInput;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 光伏辐照录入表 Mapper 接口
+ * </p>
+ *
+ * @author wang
+ * @since 2023-11-01
+ */
+public interface ProEconIrradiationInputMapper extends BaseMapper<ProEconIrradiationInput> {
+
+}

+ 68 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/model/auto/ProEconIrradiationInput.java

@@ -0,0 +1,68 @@
+package com.gyee.runeconomy.model.auto;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 光伏辐照录入表
+ * </p>
+ *
+ * @author wang
+ * @since 2023-11-01
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ProEconIrradiationInput extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    private String id;
+
+    /**
+     * 测点编码
+     */
+    private String nemCode;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 实时库名称
+     */
+    private String aname;
+
+    /**
+     * 单位
+     */
+    private String valueUnit;
+
+    /**
+     * 类型编号
+     */
+    private String typeId;
+
+    /**
+     * 统一编码
+     */
+    private String uniformCode;
+
+    /**
+     * 场站编号
+     */
+    private String windpowerstationId;
+
+    /**
+     * 系数
+     */
+    private BigDecimal coefficient;
+
+
+}

+ 1 - 1
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/Comprehensive/PVSystemEfficiencyCalculator.java

@@ -84,7 +84,7 @@ public class PVSystemEfficiencyCalculator {
         List<ProBasicEquipment> wtlsG = CacheContext.wtls.stream().filter(p -> p.getSpare1().equals("IN")).collect(Collectors.toList());
 
 
-        //计算场站级别
+//        计算场站级别
         for (ProBasicPowerstation wp : wplsG) {
 
             for (int i = 0; i < currentMonth; i++) {

+ 54 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/Irradiationinput/IrradiationinputService.java

@@ -0,0 +1,54 @@
+package com.gyee.runeconomy.service.Irradiationinput;
+
+import com.gyee.common.contant.ContantXk;
+import com.gyee.common.model.PointData;
+import com.gyee.common.util.DateUtils;
+import com.gyee.runeconomy.init.CacheContext;
+import com.gyee.runeconomy.model.auto.ProBasicPowerstationPoint;
+import com.gyee.runeconomy.model.auto.ProEconIrradiationInput;
+import com.gyee.runeconomy.service.auto.IProEconIrradiationInputService;
+import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class IrradiationinputService {
+
+    @Resource
+    private IProEconIrradiationInputService inputService;
+
+    @Resource
+    private IEdosUtil edosUtil;
+    public void getcockpit() throws Exception {
+
+        List<ProEconIrradiationInput> qwtList = inputService.list();
+        Date currentDate = DateUtils.getCurrentDate();
+        List<String> wpPoints = new ArrayList<>();
+        List<PointData> thls = new ArrayList<>();
+
+        if (!qwtList.isEmpty() || qwtList.size()>1) {
+            for (ProEconIrradiationInput lr : qwtList) {
+                Map<String, Map<String, ProBasicPowerstationPoint>> wppointmap = CacheContext.wppointmap;
+                Map<String, ProBasicPowerstationPoint> pointMap = wppointmap.get(lr.getWindpowerstationId()); //添加场站为需要被录入值的场站
+
+                if (pointMap.size() > 1 || !pointMap.isEmpty()) {
+
+                    wpPoints.add(pointMap.get(ContantXk.GZYC).getNemCode());
+                    List<PointData> realData = edosUtil.getHistMatrix(wpPoints, currentDate.getTime() / 1000);
+
+                    for (PointData data : realData){
+                        data.setEdnaId(lr.getNemCode()); //替换测点为被录入的测点
+                        thls.add(data); //将测点及值放入list
+                    }
+
+                }
+            }
+            edosUtil.sendMultiPoint(thls);
+        }
+    }
+}

+ 16 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IProEconIrradiationInputService.java

@@ -0,0 +1,16 @@
+package com.gyee.runeconomy.service.auto;
+
+import com.gyee.runeconomy.model.auto.ProEconIrradiationInput;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 光伏辐照录入表 服务类
+ * </p>
+ *
+ * @author wang
+ * @since 2023-11-01
+ */
+public interface IProEconIrradiationInputService extends IService<ProEconIrradiationInput> {
+
+}

+ 20 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconIrradiationInputServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.runeconomy.service.auto.impl;
+
+import com.gyee.runeconomy.model.auto.ProEconIrradiationInput;
+import com.gyee.runeconomy.mapper.auto.ProEconIrradiationInputMapper;
+import com.gyee.runeconomy.service.auto.IProEconIrradiationInputService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 光伏辐照录入表 服务实现类
+ * </p>
+ *
+ * @author wang
+ * @since 2023-11-01
+ */
+@Service
+public class ProEconIrradiationInputServiceImpl extends ServiceImpl<ProEconIrradiationInputMapper, ProEconIrradiationInput> implements IProEconIrradiationInputService {
+
+}

+ 6 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/util/realtimesource/EdosUtil.java

@@ -1554,7 +1554,13 @@ public class EdosUtil implements IEdosUtil {
     @Override
     public void sendMultiPoint(List<PointData> pointls) throws Exception {
 
+//        String url = baseURL + "/latest/batch";
+
         String url = baseURL + "/latest/batch";
+        if (pointls.get(0).getEdnaId().startsWith("GF-")) {
+            url = baseURL2 + "/latest/batch";
+        }
+
         List<JSONObject> writeList = new ArrayList<>();
 
         for (PointData entity : pointls) {