Browse Source

健康管理功能模块优化与BUG修复

shilin 2 years ago
parent
commit
cebaeecfa0

+ 6 - 17
web/analysis-hb/src/main/java/com/gyee/SpringbootStart.java

@@ -1,8 +1,5 @@
 package com.gyee;
 
-import com.gyee.frame.common.spring.InitialRedis;
-import com.gyee.frame.common.spring.SpringUtils;
-import com.gyee.frame.service.initialpoint.InitialPointEdosService;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@@ -27,19 +24,11 @@ public class SpringbootStart {
 
 
 
-        InitialPointEdosService initialPointEdosService= SpringUtils.getBean("initialPointEdosService");
-
-
-
-        InitialRedis initialRedis=new InitialRedis();
-        System.out.println("初始化开始!");
-        initialRedis.intialWindturbinepowercurvefitting();
-        initialRedis.intialWpScatter();
-        initialRedis.intialPjScatter();
-        initialRedis.intialLnScatter();
-        initialRedis.intialWtScatter();
-        System.out.println("初始化完成!");
-
-
+//        InitialPointEdosService initialPointEdosService= SpringUtils.getBean("initialPointEdosService");
+//
+//
+//        InitialRedis initialRedis=new InitialRedis();
+//
+//        initialRedis.initialRedisAll();
     }
 }

+ 18 - 0
web/analysis-hb/src/main/java/com/gyee/frame/common/quartz/QuartzSchedulerUtil.java

@@ -41,6 +41,24 @@ public class QuartzSchedulerUtil {
     public void init() throws SchedulerException {
     	
     	List<SysQuartzJob> quartzJobs=sysQuartzJobService.selectByExample(new SysQuartzJobExample());
+
+
+        SysQuartzJob job1=new SysQuartzJob();
+        job1.setId(StringUtils.getUUID());
+        job1.setJobName("initialRedis");
+        job1.setJobGroup("SYSTEM");
+        job1.setInvokeTarget("initialredis.initialRedisAll()");
+        job1.setStatus(0);
+        job1.setMisfirePolicy("2");
+        job1.setCronExpression("0 37 9 * * ?");
+
+        //防止因为数据问题重复创建
+        if(checkJobExists(job1))
+        {
+            deleteJob(job1);
+        }
+        createSchedule(job1);
+
     	for (SysQuartzJob job : quartzJobs) {
     		try {
     		    if(job.getId().indexOf("/topic/")!=-1)

+ 14 - 1
web/analysis-hb/src/main/java/com/gyee/frame/common/spring/InitialRedis.java

@@ -10,11 +10,12 @@ import com.gyee.frame.service.WindturbinepowercurvefittingService;
 import com.gyee.frame.util.DateUtils;
 import com.gyee.frame.util.IRealTimeDataBaseUtil;
 import com.gyee.frame.util.RealTimeDataBaseFactory;
+import org.springframework.stereotype.Service;
 
 import java.text.DecimalFormat;
 import java.util.*;
 
-
+@Service
 public  class InitialRedis {
 
     public static Map<String, Map<Double, Windturbinepowercurvefitting>> wpcmap = new HashMap<String, Map<Double, Windturbinepowercurvefitting>>();
@@ -22,6 +23,18 @@ public  class InitialRedis {
 
     IRealTimeDataBaseUtil realApiUtil = RealTimeDataBaseFactory.createRealTimeDataBase();
 
+
+    public  void initialRedisAll() throws Exception {
+
+        System.out.println("初始化开始!");
+        intialWpScatter();
+        intialPjScatter();
+        intialLnScatter();
+        intialWtScatter();
+        System.out.println("初始化完成!");
+
+    }
+
     public  void intialWindturbinepowercurvefitting() throws Exception {
 
 

+ 40 - 0
web/analysis-hb/src/main/java/com/gyee/frame/service/websocket/task/InitialRedisTask.java

@@ -0,0 +1,40 @@
+package com.gyee.frame.service.websocket.task;
+
+import com.gyee.frame.common.spring.InitialRedis;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+
+/**
+ *测试类
+ * @CLASSNAME   V2Task
+ * @Description 定时调度具体工作类
+ * @Auther Jan  橙寂
+ * @DATE 2019/9/2 0002 15:33
+ */
+@Component("initialredis")
+public class InitialRedisTask {
+	@Resource
+	private InitialRedis initialRedis;
+    /**
+     * 无参的任务
+     */
+    public void initialRedisAll() throws Exception {
+
+        initialRedis.initialRedisAll();
+//        System.out.println("正在执行定时任务,无参方法");
+    }
+
+    /**
+     * 有参任务
+     * 目前仅执行常见的数据类型  Integer Long  带L  string  带 ''  bool Double 带 d
+     * @param a
+     * @param b
+     */
+    public void runTask2(Integer a,Long b,String c,Boolean d,Double e)
+    {
+//    	List<TsysUser> list=  tsysUserMapper.selectByExample(new TsysUserExample());
+//    	System.err.println("用户查询num:"+list.size());
+//        System.out.println("正在执行定时任务,带多个参数的方法"+a+"   "+b+" "+c+"  "+d+" "+e+"执行时间:"+DateUtil.now());
+    }
+}

+ 210 - 0
web/analysis-hb/src/main/resources/application-hbn.yml

@@ -0,0 +1,210 @@
+# 项目相关配置
+gyee:
+  #名称
+  name: v2
+  #版本
+  version: 3.9
+  #版权年份
+  copyrightYear: 2020
+  #文件上传路径
+  defaultBaseDir: D:/v2file/
+  #地址是否放入项目static目录,如果未Y 放入项目得static。 profile配置失效。  为N存放在D:/v2file/ 前端读取相同,不受影响
+  isstatic: Y
+  #开启存放静态文件夹后目录
+  isroot_dir: static/file_upload/
+  #邮件功能
+  #邮箱发送smtp
+  email_smtp: smtp.sina.com
+  #邮箱发送端口
+  email_port: 465
+  #发送邮箱登录账号
+  email_account: gyee@163.com
+  #发送邮箱登录密码
+  email_password: 1
+  #实例演示开关 启动该模式删除增加修改会弹出演示模式提示框
+  demoEnabled: false
+  #漂亮得拖动验证码 默认false普通验证码、true滚动验证码
+  rollVerification: true
+  #实时数据库Url
+  baseurl: http://10.83.68.96:8011/ts
+  healthurl: http://10.83.68.96:8012/ts
+  #API访问ip
+  #swaggerip: 49.4.50.80:8082
+  swaggerip: 10.83.68.96:8082
+  #默认小数位数
+  digit: 2
+  realtimedataBase: golden #数据查询模式 golden、hwy
+  weatherurl: http://10.83.68.96:7011
+  weatherqygs: hb_qygs
+  hbmaps: {CL_FDC_KEY: 2003,KB_FDC_KEY: 1460,DX_FDC_KEY: 2186,SY_FDC_KEY: 1366}
+  initialcode: INITIAL
+#tomcat config
+server :
+  port : 8173
+  session:
+    timeout: 7200
+  ##项目名字配置
+  #servlet :
+  #  context-path : /demo
+  tomcat :
+    maxHttpHeaderSize : 8192
+    max-threads : 128
+    min-spare-threads : 5
+    uri-encoding : UTF-8
+    #shiro 报错修改的地方
+    max-connections: 200000
+    max-http-form-post-size: 9000000
+#dev环境  mysql7.0
+spring :
+  application:
+#    name: monitor-hb-provider
+#    cloud:
+#      nacos:
+#        discovery:
+#          server-addr: 10.83.68.96:8848
+#          #指定yaml格式的配置
+#          file-extension: yaml
+#          cluster-name: master
+#        username: nacos
+#        password: nacos
+    #引入其他配置文件,例如ftpHX 未配置文件application-ftpHX.yml
+    #include: ftpHX,ftpCloud
+  servlet:
+    multipart:
+      #设置总上传的数据大小
+      max-request-size: 100MB
+      #单个文件大小
+      maxFileSize : 30MB
+      #shiro 报错修改的地方
+    max-connections: 200000
+    max-http-post-size: 9000000
+  #热部署模块
+  devtools:
+    restart:
+      #热部署开关
+      enabled: true
+      #指定热部署的目录
+      additional-paths: src/main/java
+      #指定目录不更新
+      exclude: test/**
+
+  redis:
+    database: 19
+    host: 10.83.68.94
+    password:
+    pool:
+      maxTotal: 20
+      maxIdle: 20
+      maxwait: 600000
+      minIdle: 10
+    port: 6379
+    timeout: 600000
+  datasource:
+    #type: com.alibaba.druid.pool.DruidDataSource
+    type: com.alibaba.druid.pool.DruidDataSource
+    #    driverClassName: com.mysql.jdbc.Driver
+    #druid连接池配置
+    druid:
+      #主库数据源
+      master:
+        url: jdbc:oracle:thin:@10.83.68.165:1521:gdsj
+        username: gdprod
+        password: gd123
+        driver-class-name: oracle.jdbc.driver.OracleDriver
+      #备数据源 #关闭
+      slave:
+        enabled: false
+        url: jdbc:mysql://localhost:3306/springbootv3?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&serverTimezone=UTC
+        username: root
+        password: root
+        #两票数据源
+      ticket:
+        url: jdbc:sqlserver://10.83.68.98:1434;DatabaseName=fdeamnew
+
+        username: sa
+        password: ibs
+        driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
+        #配置初始化连接数大小
+      initial-size: 10
+      # 最大连接数
+      max-active: 50
+      #最小连接数
+      min-idle: 10
+      #获取连接等待超时时间
+      max-wait: 5000
+      pool-prepared-statements: true #是否缓存preparedStatement,也就是PSCache。PSCache对支持游标的数据库性能提升巨大,比如说oracle。在mysql下建议关闭。
+      max-pool-prepared-statement-per-connection-size: 20
+      validation-query: SELECT 1 FROM DUAL
+      validation-query-timeout: 20000
+      test-on-borrow: false #申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
+      test-on-return: false #归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
+      test-while-idle: true #建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。
+      time-between-eviction-runs-millis: 60000 #配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+      min-evictable-idle-time-millis: 300000  #一个连接在池中最小生存的时间,单位是毫秒
+      #StatViewServlet配置。(因为暴露的监控信息比较敏感,支持密码加密和访问ip限定)
+      stat-view-servlet:
+        enabled: true
+        url-pattern: /druid/*
+        #可以增加访问账号密码【去掉注释就可以】
+        #login-username: admin
+        #login-password: admin
+      filter:
+        stat:
+          log-slow-sql: true
+          slow-sql-millis: 1000
+          merge-sql: false
+        wall:
+          config:
+            multi-statement-allow: true
+
+#mysql 8.0
+
+#spring:
+#  datasource:
+#    type: com.alibaba.druid.pool.DruidDataSource
+#    driverClassName: com.mysql.cj.jdbc.Driver
+#    #druid连接池配置
+#    druid:
+#     # 主库数据源
+#     master:
+#        url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT&autoReconnect=true&useSSL=false
+#        username: root
+#        password: root
+#        #树熊数据源
+#     slave:
+#        enabled : false
+#        url: jdbc:mysql://localhost:3306/test2?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT&autoReconnect=true&useSSL=false
+#        username: root
+#        password: root
+#        #配置初始化连接数大小
+#     initial-size: 10
+#     # 最大连接数
+#     max-active: 50
+#     #最小连接数
+#     min-idle: 10
+#     #获取连接等待超时时间
+#     max-wait: 5000
+#     pool-prepared-statements: true #是否缓存preparedStatement,也就是PSCache。PSCache对支持游标的数据库性能提升巨大,比如说oracle。在mysql下建议关闭。
+#     max-pool-prepared-statement-per-connection-size: 20
+#     validation-query: SELECT 1 FROM DUAL
+#     validation-query-timeout: 20000
+#     test-on-borrow: false #申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
+#     test-on-return: false #归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
+#     test-while-idle: true #建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。
+#     time-between-eviction-runs-millis: 60000 #配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+#     min-evictable-idle-time-millis: 300000  #一个连接在池中最小生存的时间,单位是毫秒
+#     #StatViewServlet配置。(因为暴露的监控信息比较敏感,支持密码加密和访问ip限定)
+#     stat-view-servlet:
+#      enabled: true
+#      url-pattern: /druid/*
+#      #可以增加访问账号密码【去掉注释就可以】
+#      #login-username: admin
+#      #login-password: admin
+#     filter:
+#      stat:
+#        log-slow-sql: true
+#        slow-sql-millis: 1000
+#        merge-sql: true
+#      wall:
+#        config:
+#          multi-statement-allow: true