035378aa 张雷

奥体项目累计流量

1 个父辈 3ab28ffb
...@@ -3,10 +3,7 @@ package com.skua.modules.business.controller; ...@@ -3,10 +3,7 @@ package com.skua.modules.business.controller;
3 import com.skua.core.api.vo.Result; 3 import com.skua.core.api.vo.Result;
4 import com.skua.modules.business.service.IOlympicCenterService; 4 import com.skua.modules.business.service.IOlympicCenterService;
5 import com.skua.modules.business.service.ISynthesizeService; 5 import com.skua.modules.business.service.ISynthesizeService;
6 import com.skua.modules.business.vo.AlarmParams; 6 import com.skua.modules.business.vo.*;
7 import com.skua.modules.business.vo.EchartResult;
8 import com.skua.modules.business.vo.InputQueryParams;
9 import com.skua.modules.business.vo.ReportParams;
10 import io.swagger.annotations.Api; 7 import io.swagger.annotations.Api;
11 import io.swagger.annotations.ApiOperation; 8 import io.swagger.annotations.ApiOperation;
12 import lombok.extern.slf4j.Slf4j; 9 import lombok.extern.slf4j.Slf4j;
...@@ -249,4 +246,19 @@ public class OlympicCenterController { ...@@ -249,4 +246,19 @@ public class OlympicCenterController {
249 return result; 246 return result;
250 } 247 }
251 248
249 @ApiOperation(value="获取累计流量同比环比数据", notes="获取累计流量同比环比数据")
250 @GetMapping(value = "/getSumFlowData")
251 public Result<Map<String,Object>> getSumFlowData(SumFlowParams sumFlowParams){
252 Result<Map<String,Object>> result = new Result<Map<String,Object>>();
253 Map<String,Object> map = new HashMap<>();
254 if("".equals(sumFlowParams.getStart())||sumFlowParams.getStart()==null
255 ||"".equals(sumFlowParams.getEnd())||sumFlowParams.getEnd()==null){
256 map = olympicCenterService.getSumFlowData(sumFlowParams);
257 }else{
258 map = new HashMap<>();
259 }
260 result.setResult(map);
261 result.setSuccess(true);
262 return result;
263 }
252 } 264 }
......
1 package com.skua.modules.business.service; 1 package com.skua.modules.business.service;
2 2
3 import com.skua.modules.business.vo.AlarmParams; 3 import com.skua.modules.business.vo.*;
4 import com.skua.modules.business.vo.EchartResult;
5 import com.skua.modules.business.vo.InputQueryParams;
6 import com.skua.modules.business.vo.ReportParams;
7 4
8 import java.util.List; 5 import java.util.List;
9 import java.util.Map; 6 import java.util.Map;
...@@ -51,4 +48,5 @@ public interface IOlympicCenterService { ...@@ -51,4 +48,5 @@ public interface IOlympicCenterService {
51 48
52 List<Map<String, Object>> getAlarmList(AlarmParams alarmParams); 49 List<Map<String, Object>> getAlarmList(AlarmParams alarmParams);
53 50
51 Map<String, Object> getSumFlowData(SumFlowParams sumFlowParams);
54 } 52 }
......
1 package com.skua.modules.business.vo;
2
3 import lombok.Data;
4
5 /**
6 * 请求参数
7 */
8 @Data
9 public class SumFlowParams {
10
11 /**聚合类型 日:day, 月:month,年:year*/
12 private String sumType;
13 /**开始时间 yyyy-MM-DD*/
14 private String start;
15 /**结束时间 yyyy-MM-DD*/
16 private String end;
17
18 }
...@@ -25,4 +25,6 @@ public interface IFmPgQueryService { ...@@ -25,4 +25,6 @@ public interface IFmPgQueryService {
25 25
26 public List<Map<String, Object>> queryReportData(String departId,String fields,String startTime,String endTime,String reportType); 26 public List<Map<String, Object>> queryReportData(String departId,String fields,String startTime,String endTime,String reportType);
27 27
28 public List<Map<String, Object>> queryAotiCurveData(String fields,String startTime,String endTime,String sumType,int strCount);
29
28 } 30 }
......
...@@ -12,6 +12,9 @@ import com.skua.modules.monitor.service.IFmPgQueryService; ...@@ -12,6 +12,9 @@ import com.skua.modules.monitor.service.IFmPgQueryService;
12 12
13 import java.text.ParseException; 13 import java.text.ParseException;
14 import java.text.SimpleDateFormat; 14 import java.text.SimpleDateFormat;
15 import java.time.LocalDate;
16 import java.time.YearMonth;
17 import java.time.format.DateTimeFormatter;
15 import java.util.*; 18 import java.util.*;
16 19
17 /** 20 /**
...@@ -78,12 +81,6 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService { ...@@ -78,12 +81,6 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService {
78 return result; 81 return result;
79 } 82 }
80 83
81 public static void main(String[] args) {
82 Date d=new Date();//获取时间
83 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
84 System.out.println(gettimeStemp(sdf.format(d)+" 00:00:00","yyyy-MM-dd"));
85 }
86
87 public static long gettimeStemp(String time, String format) { 84 public static long gettimeStemp(String time, String format) {
88 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 85 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
89 if (!"".equals(format)) { 86 if (!"".equals(format)) {
...@@ -362,4 +359,38 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService { ...@@ -362,4 +359,38 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService {
362 } 359 }
363 return resultList; 360 return resultList;
364 } 361 }
362
363 @Override
364 public List<Map<String, Object>> queryAotiCurveData( String fields, String startTime, String endTime, String sumType, int strCount) {
365 List<Map<String, Object>> dataList = new ArrayList<>();
366 //获取数据采集pg数据库,实时数据获取统一从数据采集pg库获取
367 JdbcTemplate pgDB = (JdbcTemplate)SpringContextUtils.getBean("pg-db");
368 String countTableName = "a01a21a03_count";
369 //获取要查询的指标
370 String fieldSqlPart = "";
371 String[] fieldsArr = fields.split(",");
372 for (int i = 0; i < fieldsArr.length; ++i){
373 fieldSqlPart = fieldSqlPart + (",'"+fieldsArr[i]+"'");
374 }
375 if(!StringUtils.isEmpty(fieldSqlPart)) {
376 fieldSqlPart = fieldSqlPart.substring(1);
377 }
378 try{
379 String tsStartTime = String.valueOf(DateUtils.getMillis(DateUtils.parseDate(startTime, "yyyy-MM-dd HH:mm:ss"))/1000);
380 String tsEndTime = String.valueOf(DateUtils.getMillis(DateUtils.parseDate(endTime, "yyyy-MM-dd HH:mm:ss"))/1000);
381 String sql = "SELECT nm, " +
382 " LEFT(TO_CHAR(TO_TIMESTAMP(CAST(ts AS INTEGER)), 'YYYY-MM-DD HH24:MI:SS'), "+strCount+") AS time, " +
383 " SUM(v::numeric) AS value " +
384 " FROM " + countTableName +
385 " WHERE nm in ("+fieldSqlPart+")" +
386 " AND type = 'def'" +
387 " AND ts >= ? AND ts < ? " +
388 " GROUP BY nm, time " +
389 " ORDER BY time";
390 dataList = pgDB.queryForList(sql,tsStartTime,tsEndTime);
391 }catch (Exception e){
392 e.printStackTrace();
393 }
394 return dataList;
395 }
365 } 396 }
......
1 server:
2 port: 8803
3 servlet:
4 context-path: /fmboot
5 compression:
6 enabled: true
7 mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
8
9 management:
10 endpoints:
11 web:
12 exposure:
13 include: metrics,httptrace
14
15 spring:
16 servlet:
17 multipart:
18 max-file-size: 10MB
19 max-request-size: 10MB
20 mail:
21 host: smtp.163.com
22 username: zhanglei891008@163.com
23 password: ??
24 properties:
25 mail:
26 smtp:
27 auth: true
28 starttls:
29 enable: true
30 required: true
31 ## quartz定时任务,采用数据库方式
32 quartz:
33 job-store-type: jdbc
34 #json 时间戳统一转换
35 jackson:
36 date-format: yyyy-MM-dd HH:mm:ss
37 time-zone: GMT+8
38 aop:
39 proxy-target-class: true
40 #配置freemarker
41 freemarker:
42 # 设置模板后缀名
43 suffix: .ftl
44 # 设置文档类型
45 content-type: text/html
46 # 设置页面编码格式
47 charset: UTF-8
48 # 设置页面缓存
49 cache: false
50 prefer-file-system-access: false
51 # 设置ftl文件路径
52 template-loader-path:
53 - classpath:/templates
54 # 设置静态文件路径,js,css等
55 mvc:
56 static-path-pattern: /**
57 resource:
58 static-locations: classpath:/static/,classpath:/public/
59 autoconfigure:
60 exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
61 datasource:
62 druid:
63 stat-view-servlet:
64 enabled: true
65 loginUsername: admin
66 loginPassword: 123456
67 web-stat-filter:
68 enabled: true
69 dynamic:
70 druid: # 全局druid参数,绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
71 # 连接池的配置信息
72 # 初始化大小,最小,最大
73 initial-size: 5
74 min-idle: 5
75 maxActive: 20
76 # 配置获取连接等待超时的时间
77 maxWait: 60000
78 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
79 timeBetweenEvictionRunsMillis: 60000
80 # 配置一个连接在池中最小生存的时间,单位是毫秒
81 minEvictableIdleTimeMillis: 300000
82 validationQuery: SELECT 1
83 testWhileIdle: true
84 testOnBorrow: false
85 testOnReturn: false
86 # 打开PSCache,并且指定每个连接上PSCache的大小
87 poolPreparedStatements: true
88 maxPoolPreparedStatementPerConnectionSize: 20
89 # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
90 filters: stat,wall,slf4j
91 # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
92 connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
93 datasource:
94 master:
95 url: jdbc:mysql://10.68.182.67:3306/zhsw_modules?characterEncoding=UTF-8&useUnicode=true&useSSL=false
96 username: root
97 password: Winps6eH3wB2dNHqh5
98 driver-class-name: com.mysql.jdbc.Driver
99 #redis 配置
100 redis:
101 database: 0
102 host: 10.68.182.67
103 lettuce:
104 pool:
105 max-active: 8 #最大连接数据库连接数,设 0 为没有限制
106 max-idle: 8 #最大等待连接中的数量,设 0 为没有限制
107 max-wait: -1ms #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
108 min-idle: 0 #最小等待连接中的数量,设 0 为没有限制
109 shutdown-timeout: 100ms
110 password: 4BM9tVs9KW2qGSEEVz
111 port: 6379
112 #mybatis plus 设置
113 mybatis-plus:
114 mapper-locations: classpath*:com/skua/**/xml/*Mapper.xml
115 global-config:
116 db-config:
117 #主键类型 0:"数据库ID自增",1:"该类型为未设置主键类型", 2:"用户输入ID",
118 #3:"全局唯一ID (数字类型唯一ID)", 4:"全局唯一ID UUID",
119 #5:"字符串全局唯一ID (idWorker 的字符串表示)";
120 id-type: 4
121 # 默认数据库表下划线命名
122 table-underline: true
123 configuration:
124 call-setters-on-nulls: true
125 # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
126 #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
127 #数矿专用配置
128 skua :
129 path :
130 #文件上传根目录 设置
131 upload: /mnt/app/uploadfile
132 #webapp文件路径
133 webapp: /mnt/app/uploadfile
134 # 断点续传路径
135 chunk: /app/skboot/zujianhua/voice
136 #短信秘钥
137 sms:
138 #应用地址
139 accessKeyUrl: http://smssh1.253.com/msg/send/json
140 #账户
141 accessKeyId: f344035
142 #密码
143 accessKeySecret: r38oABz
144 factoryId: d60401ac4a9943b1943c6b8edbe4df27
145 iosUpdateUrl: https://itunes.apple.com/cn/lookup?id=1486744187
146 viewPath: http://127.0.0.1:8081/fmboot/sys/common/view/
147 #展示运行报表id
148 reportShowParentId: 6958c2d7f6d391a86b2c58059dbcddc3
149 #数据采集服务频率,单位秒,注意如果调整了数据采集频率,请记得同步修改此配置
150 collectionFrequency: 10
151 #视频对接相关配置
152 video:
153 ip: 127.0.0.1
154 port: 8667
155 username: admin
156 password: xrjkauto@123
157 #海康威视需要填写密钥
158 appkey: 22650577
159 secretkey: 6958c2d7f6d391a86b
160 streamMediaIp: 127.0.0.1
161 #消息推送
162 push:
163 #是否开启流程消息推送
164 process-enable: false
165 #极光推送
166 jg:
167 masterSecret: bb892f7773279e1ae6a
168 appKey: cb69e9fb44b487ec3b5
169 #洪城内网推送地址
170 deviceHostName: http://189.200.0.223/device
171 pushHostName: http://189.200.0.223/api
172 mob:
173 appSecret: 1dc50510bb62e65add34dab122f4536f
174 appKey: 347052887a080
175 pushHostName: http://api.push.mob.com/v3/push/createPush
176 iosProduction: 1
177 packageName: com.kingtrol.flutter
178 #后面更换推送服务向下扩展添加
179 #cas单点登录
180 cas:
181 prefixUrl: http://cas.example.org:8443/cas
182
183 #微信相关
184 wx:
185 # 公众号
186 app-id: wxbdc5610c
187 app-secret: xxxxxxxxxxxxxxxxxxxxxxx
188 redirect-url: https://passport.yhd.com
...@@ -96,17 +96,17 @@ spring: ...@@ -96,17 +96,17 @@ spring:
96 username: jk_test 96 username: jk_test
97 password: Jk_test1211rw 97 password: Jk_test1211rw
98 driver-class-name: com.mysql.jdbc.Driver 98 driver-class-name: com.mysql.jdbc.Driver
99 mysql-alarm: 99 # mysql-alarm:
100 url: jdbc:mysql://47.104.99.86:3306/intelligent-devices?characterEncoding=UTF-8&useUnicode=true&useSSL=false 100 # url: jdbc:mysql://47.104.99.86:3306/intelligent-devices?characterEncoding=UTF-8&useUnicode=true&useSSL=false
101 username: id_rw 101 # username: id_rw
102 password: s2eCvUEPO2Vk3U1w 102 # password: s2eCvUEPO2Vk3U1w
103 driver-class-name: com.mysql.jdbc.Driver 103 # driver-class-name: com.mysql.jdbc.Driver
104 # 多数据源配置 104 # # 多数据源配置
105 pg-db: 105 # pg-db:
106 url: jdbc:postgresql://47.104.99.86:10086/postgres?useUnicode=true&characterEncoding=UTF8 106 # url: jdbc:postgresql://47.104.99.86:10086/postgres?useUnicode=true&characterEncoding=UTF8
107 username: postgres 107 # username: postgres
108 password: JKjnf9713xt 108 # password: JKjnf9713xt
109 driver-class-name: org.postgresql.Driver 109 # driver-class-name: org.postgresql.Driver
110 #redis 配置 110 #redis 配置
111 redis: 111 redis:
112 database: 0 112 database: 0
......
...@@ -97,7 +97,7 @@ spring: ...@@ -97,7 +97,7 @@ spring:
97 password: jkauto@123wh 97 password: jkauto@123wh
98 driver-class-name: com.mysql.jdbc.Driver 98 driver-class-name: com.mysql.jdbc.Driver
99 mysql-alarm: 99 mysql-alarm:
100 url: jdbc:mysql://192.168.21.6:13306/zhsw_modules?characterEncoding=UTF-8&useUnicode=true&useSSL=false 100 url: jdbc:mysql://192.168.21.6:13306/intelligent-devices?characterEncoding=UTF-8&useUnicode=true&useSSL=false
101 username: root 101 username: root
102 password: jkauto@123wh 102 password: jkauto@123wh
103 driver-class-name: com.mysql.jdbc.Driver 103 driver-class-name: com.mysql.jdbc.Driver
......
1 spring: 1 spring:
2 profiles: 2 profiles:
3 active: prod 3 active: dev
4 # 信息安全 4 # 信息安全
5 security: 5 security:
6 csrf: 6 csrf:
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!