Quellcode durchsuchen

计算服务优化

shilin vor 1 Jahr
Ursprung
Commit
4fe199dd6d

+ 4 - 4
realtime/generationXK-service/src/main/java/com/gyee/generation/GenerationMain.java

@@ -97,11 +97,11 @@ public class GenerationMain {
 //
 //
 //            equipmentInfo1Service.calEquipmentInfoDay(begin);
-//            TimeUnit.SECONDS.sleep(30);
+//            TimeUnit.SECONDS.sleep(3);
 //            equipmentInfo2Service.calEquipmentInfoDay(begin);
-//            TimeUnit.SECONDS.sleep(30);
+//            TimeUnit.SECONDS.sleep(3);
 //            equipmentInfo3Service.calEquipmentInfoDay(begin);
-//            TimeUnit.SECONDS.sleep(30);
+//            TimeUnit.SECONDS.sleep(3);
 //
 //
 //            end = new Date();
@@ -187,6 +187,6 @@ public class GenerationMain {
 //
 //
 //        /*************************redis缓存**************************/
-////
+//
     }
 }

+ 3 - 3
realtime/generationXK-service/src/main/java/com/gyee/generation/config/ThreadPoolTaskConfig.java

@@ -14,13 +14,13 @@ public class ThreadPoolTaskConfig {
      */
 
     /** 核心线程数(默认线程数) */
-    private static final int corePoolSize =120;
+    private static final int corePoolSize =12;
     /** 最大线程数 */
-    private static final int maxPoolSize = 360;
+    private static final int maxPoolSize = 30;
     /** 允许线程空闲时间(单位:默认为秒) */
     private static final int keepAliveTime = 30;
     /** 缓冲队列大小 */
-    private static final int queueCapacity = 360;
+    private static final int queueCapacity = 240;
     /** 允许等待最长时间 */
     private static final int awaitTime = 60;
     /** 线程池名前缀 */

+ 89 - 89
realtime/generationXK-service/src/main/java/com/gyee/generation/config/XxlJobConfig.java

@@ -1,91 +1,91 @@
-//package com.gyee.generation.config;
+package com.gyee.generation.config;
+
+
+import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.EnvironmentAware;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.core.env.Environment;
+
+/**
+ * xxl-job config
+ *
+ * @author xuxueli 2017-04-28
+ */
+
+
+@Configuration
+//@PropertySource("classpath:xxl-job-executor.properties")
+//@PropertySource("classpath:xxl-job-executor2.properties")
+@PropertySource("classpath:xxl-job-executor3.properties")
+////@PropertySource("classpath:xxl-job-executor4.properties")
+//@PropertySource("classpath:xxl-job-executor5.properties")
+//@PropertySource("classpath:xxl-job-executorWPLY.properties")
+//@PropertySource("classpath:xxl-job-executorRG.properties")
+//@PropertySource("classpath:xxl-job-executorJN.properties")
 //
-//
-//import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//import org.springframework.context.EnvironmentAware;
-//import org.springframework.context.annotation.Bean;
-//import org.springframework.context.annotation.Configuration;
-//import org.springframework.context.annotation.PropertySource;
-//import org.springframework.core.env.Environment;
-//
-///**
-// * xxl-job config
-// *
-// * @author xuxueli 2017-04-28
-// */
-//
-//
-//@Configuration
-////@PropertySource("classpath:xxl-job-executor.properties")
-////@PropertySource("classpath:xxl-job-executor2.properties")
-////@PropertySource("classpath:xxl-job-executor3.properties")
-//////@PropertySource("classpath:xxl-job-executor4.properties")
-////@PropertySource("classpath:xxl-job-executor5.properties")
-////@PropertySource("classpath:xxl-job-executorWPLY.properties")
-////@PropertySource("classpath:xxl-job-executorRG.properties")
-////@PropertySource("classpath:xxl-job-executorJN.properties")
-////
-////@PropertySource("classpath:xxl-job-accuracy.properties")
-////@PropertySource("classpath:xxl-job-7001.properties")
-////@PropertySource("classpath:xxl-job-7002.properties")
-////@PropertySource("classpath:xxl-job-7003.properties")
-////@PropertySource("classpath:xxl-job-executorGF000.properties")
-////@PropertySource("classpath:xxl-job-executorGF001.properties")
-////@PropertySource("classpath:xxl-job-executorGF002.properties")
-////@PropertySource("classpath:xxl-job-executorGF003.properties")
+//@PropertySource("classpath:xxl-job-accuracy.properties")
+//@PropertySource("classpath:xxl-job-7001.properties")
+//@PropertySource("classpath:xxl-job-7002.properties")
+//@PropertySource("classpath:xxl-job-7003.properties")
+//@PropertySource("classpath:xxl-job-executorGF000.properties")
+//@PropertySource("classpath:xxl-job-executorGF001.properties")
+//@PropertySource("classpath:xxl-job-executorGF002.properties")
+//@PropertySource("classpath:xxl-job-executorGF003.properties")
 //@PropertySource("classpath:xxl-job-executorGF004.properties")
-////@PropertySource("classpath:xxl-job-executorGF005.properties")
-////@PropertySource("classpath:xxl-job-executorGF006.properties")
-////@PropertySource("classpath:xxl-job-executorGF007.properties")
-////@PropertySource("classpath:xxl-job-executorGF008.properties")
-////@PropertySource("classpath:xxl-job-region.properties")
-//public class XxlJobConfig implements EnvironmentAware {
-//
-//    private Environment env;
-//
-//
-//    @Override
-//    public void setEnvironment(Environment environment) {
-//        this.env = environment;
-//    }
-//
-//    private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
-//
-//
-//    @Bean
-//    public XxlJobSpringExecutor xxlJobExecutor() {
-//        logger.info(">>>>>>>>>>> xxl-job config init.");
-//        XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
-//        xxlJobSpringExecutor.setAdminAddresses(env.getProperty("xxl.job.admin.addresses"));
-//        xxlJobSpringExecutor.setAppname(env.getProperty("xxl.job.executor.appname"));
-//        xxlJobSpringExecutor.setAddress(env.getProperty("xxl.job.executor.address"));
-//        xxlJobSpringExecutor.setIp(env.getProperty("xxl.job.executor.ip"));
-//        xxlJobSpringExecutor.setPort(Integer.parseInt(env.getProperty("xxl.job.executor.port")));
-//        xxlJobSpringExecutor.setAccessToken(env.getProperty("xxl.job.accessToken"));
-//        xxlJobSpringExecutor.setLogPath(env.getProperty("xxl.job.executor.logpath"));
-//        xxlJobSpringExecutor.setLogRetentionDays(Integer.parseInt(env.getProperty("xxl.job.executor.logretentiondays")));
-//        return xxlJobSpringExecutor;
-//    }
-//
-//
-//    /**
-//     * 针对多网卡、容器内部署等情况,可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP;
-//     *
-//     *      1、引入依赖:
-//     *          <dependency>
-//     *             <groupId>org.springframework.cloud</groupId>
-//     *             <artifactId>spring-cloud-commons</artifactId>
-//     *             <version>${version}</version>
-//     *         </dependency>
-//     *
-//     *      2、配置文件,或者容器启动变量
-//     *          spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.'
-//     *
-//     *      3、获取IP
-//     *          String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
-//     */
-//
-//
-//}
+//@PropertySource("classpath:xxl-job-executorGF005.properties")
+//@PropertySource("classpath:xxl-job-executorGF006.properties")
+//@PropertySource("classpath:xxl-job-executorGF007.properties")
+//@PropertySource("classpath:xxl-job-executorGF008.properties")
+//@PropertySource("classpath:xxl-job-region.properties")
+public class XxlJobConfig implements EnvironmentAware {
+
+    private Environment env;
+
+
+    @Override
+    public void setEnvironment(Environment environment) {
+        this.env = environment;
+    }
+
+    private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
+
+
+    @Bean
+    public XxlJobSpringExecutor xxlJobExecutor() {
+        logger.info(">>>>>>>>>>> xxl-job config init.");
+        XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
+        xxlJobSpringExecutor.setAdminAddresses(env.getProperty("xxl.job.admin.addresses"));
+        xxlJobSpringExecutor.setAppname(env.getProperty("xxl.job.executor.appname"));
+        xxlJobSpringExecutor.setAddress(env.getProperty("xxl.job.executor.address"));
+        xxlJobSpringExecutor.setIp(env.getProperty("xxl.job.executor.ip"));
+        xxlJobSpringExecutor.setPort(Integer.parseInt(env.getProperty("xxl.job.executor.port")));
+        xxlJobSpringExecutor.setAccessToken(env.getProperty("xxl.job.accessToken"));
+        xxlJobSpringExecutor.setLogPath(env.getProperty("xxl.job.executor.logpath"));
+        xxlJobSpringExecutor.setLogRetentionDays(Integer.parseInt(env.getProperty("xxl.job.executor.logretentiondays")));
+        return xxlJobSpringExecutor;
+    }
+
+
+    /**
+     * 针对多网卡、容器内部署等情况,可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP;
+     *
+     *      1、引入依赖:
+     *          <dependency>
+     *             <groupId>org.springframework.cloud</groupId>
+     *             <artifactId>spring-cloud-commons</artifactId>
+     *             <version>${version}</version>
+     *         </dependency>
+     *
+     *      2、配置文件,或者容器启动变量
+     *          spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.'
+     *
+     *      3、获取IP
+     *          String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
+     */
+
+
+}

+ 27 - 4
realtime/generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/StatusService.java

@@ -546,6 +546,8 @@ public class StatusService {
 
         Map<String, PointData> aivalueMap = new HashMap<>();
 
+        Map<String,Double> gzztMap=new HashMap<>();
+
         for (ProBasicEquipment wt : wtls) {
 
             String aiordi = modelMap.get(wt.getModelId()).getDescription();
@@ -557,6 +559,16 @@ public class StatusService {
                     aipointls.add(windturbinestatusdi.getNemCode());
                 }
 
+                if(wt.getModelId().contains("HW"))
+                {
+                    Optional<ProBasicStatusPoint> gzzt = statusMap.get(wt.getId()).stream().filter(w -> w.getUniformCode().equals(Contant.MX004)).findFirst();
+                    if (gzzt.isPresent()) {
+                        ProBasicStatusPoint windturbinestatusdi = gzzt.get();
+                        PointData po= edosUtil.getRealData(windturbinestatusdi.getNemCode());
+                        gzztMap.put(wt.getId(),po.getPointValueInDouble());
+                    }
+                }
+
                 aiwtls.add(wt.getId());
                 if (aipointls.size() >= 3000) {
                     List<PointData> templs = edosUtil.getRealData(aipointls);
@@ -593,19 +605,19 @@ public class StatusService {
             //状态持续时间,以秒计算
             ProBasicEquipmentPoint ztcxsjPoint = equipmentPointMap.get(ContantXk.ZTCXSJ);
 
-
             pointls.add(zjztPoint.getNemCode());
             pointls.add(gpztPoint.getNemCode());
             pointls.add(mxztPoint.getNemCode());
             pointls.add(ztcxsjPoint.getNemCode());
 
-
             if (pointls.size() >= 3000) {
                 List<PointData> templs = edosUtil.getRealData(pointls);
                 pointDatals.addAll(templs);
                 pointls = new ArrayList<>();
             }
+
         }
+
         if (!pointls.isEmpty()) {
             List<PointData> templs = edosUtil.getRealData(pointls);
             pointDatals.addAll(templs);
@@ -716,7 +728,7 @@ public class StatusService {
                     Calendar c = Calendar.getInstance();
                     c.setTime(currentDate);
 
-                    mxstatus = getMxzt(zjzt, modelMap, aistateMap, statusMap, wt, ssgl, aivalueMap, diresultMaps);
+                    mxstatus = getMxzt(zjzt, modelMap, aistateMap, statusMap, wt, ssgl, aivalueMap, diresultMaps,gzztMap);
 
                 }
 
@@ -1226,7 +1238,7 @@ public class StatusService {
 
     private double getMxzt(double zjzt, Map<String, ProEconEquipmentmodel> modelMap, Map<String, Map<Integer, Integer>> aistateMap,
                            Map<String, List<ProBasicStatusPoint>> statusMap, ProBasicEquipment wt, double ssgl,
-                           Map<String, PointData> aivalueMap, Map<String, Map<String, PointData>> diresultMaps) throws Exception {
+                           Map<String, PointData> aivalueMap, Map<String, Map<String, PointData>> diresultMaps,Map<String,Double> gzztMap) throws Exception {
 
         double mxstatus = 2;
 
@@ -1240,8 +1252,19 @@ public class StatusService {
                 if (stateMap.containsKey(pointValueInDouble)) {
                     mxstatus = (double) stateMap.get(pointValueInDouble);
                 }
+
+                if (gzztMap.containsKey(wt.getId())) {
+                    Double gzzt = gzztMap.get(wt.getId());
+
+                    if(gzzt.doubleValue()==1 && pointValueInDouble==9)
+                    {
+                        mxstatus =6;
+                    }
+                }
             }
 
+
+
             if (wt.getId().contains("_F_")) {
                 if (mxstatus == 2 || (mxstatus == 3)) {
                     if (ssgl <= 10) {

+ 1 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/task/SaticSchedulePgTask.java

@@ -866,10 +866,10 @@ public class SaticSchedulePgTask {
 
     }
 
-
     /**
      * 设备2表
      * 15分钟只执行一次
+
      */
     @XxlJob("equipment_PowerInfo2_PG")
     public void equipment_PowerInfo2_PG() throws Exception {