From 479b759f08218794c2fba1fee4215504634b0583 Mon Sep 17 00:00:00 2001 From: zhanghua <314079846@qq.com> Date: 星期四, 16 十一月 2023 20:33:08 +0800 Subject: [PATCH] 代码优化 --- ycl-smoke/src/main/java/com/ycl/smoke/task/ScheduledTask.java | 20 ++++++++- ycl-platform/src/main/resources/application-online.yml | 88 ++++++++++++++++++++++++++++++++++++++++++++ ycl-platform/src/main/resources/application.yml | 2 3 files changed, 106 insertions(+), 4 deletions(-) diff --git a/ycl-platform/src/main/resources/application-online.yml b/ycl-platform/src/main/resources/application-online.yml new file mode 100644 index 0000000..f86f29e --- /dev/null +++ b/ycl-platform/src/main/resources/application-online.yml @@ -0,0 +1,88 @@ +server: + port: 8084 + tomcat: + uri-encoding: UTF-8 + servlet: + context-path: /sccg + compression: true + +fdfs: + fileUrl: http://140.143.152.226:8410/ + groupName: sczhzf + soTimeout: 1500 + connectTimeout: 600 + trackerList: #TrackerList鍙傛暟,鏀寔澶氫釜 + - 140.143.152.226:22122 + - +cfg: + res: d://resources + media-res: 140.143.152.226/media/ + snow-flake: + datacenterId: 1 + machineId: 1 + +spring: + redis: + database: 0 + host: 127.0.0.1 + port: 6380 + password: Q(yNR2x^%v@HV + jedis: + pool: + max-active: 8 + max-idle: 8 + min-idle: 0 + timeout: 0 + + datasource: + url: jdbc:mysql://10.110.247.252:3306/sccg?characterEncoding=utf-8 + username: toor + password: v6VGHAzXEu$zF7 + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + filters: stat + maxActive: 20 + initialSize: 1 + maxWait: 60000 + minIdle: 1 + timeBetweenEvictionRunsMillis: 60000 + minEvictableIdleTimeMillis: 300000 + validationQuery: select 'x' + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + poolPreparedStatements: true + maxOpenPreparedStatements: 20 + +e-mail: + sendHost: smtp.qq.com + username: 1723292425@qq.com + password: qizcitupatzoeeij + +SMS: + ecName: 娴欐睙绉诲姩淇℃伅绯荤粺闆嗘垚鏈夐檺鍏徃锛堥亗鏄岋級 + apId: sccg + sign: wg2AOpofE + url: https://mas.10086.cn + +videoPoint: + url: http://172.28.194.180:7901 + port: 7901 + userName: suichang + passWord: a12345677 + ip: 10.10.10.10 + +aliyun: + oss: + endpoint: http://oss-cn-zjls-lszwy-d01-a.ops.zjlscloud.com + keyId: Tkf72Q1gdzETsZf6 + keySecret: tRk39S6B1kSGARRdS4DF6jxr5nBYj5 + bucketName: zhzfptoss + +#涓撴湁閽夐拤鍙傛暟 +zzding : + app-key : SC_ZHZF-IC5g2YiRDW8tug1DfAfiui + app-secret : 39RIHFOKd8fUeeW9T7CdBcwEqA6dMKx5d3686B6P + domain-name : openplatform.dg-work.cn + protocal : https + tenant-id : 50645661 \ No newline at end of file diff --git a/ycl-platform/src/main/resources/application.yml b/ycl-platform/src/main/resources/application.yml index b117905..cfb4e39 100644 --- a/ycl-platform/src/main/resources/application.yml +++ b/ycl-platform/src/main/resources/application.yml @@ -1,6 +1,6 @@ spring: profiles: - active: dev + active: online main: allow-circular-references: true allow-bean-definition-overriding: true diff --git a/ycl-smoke/src/main/java/com/ycl/smoke/task/ScheduledTask.java b/ycl-smoke/src/main/java/com/ycl/smoke/task/ScheduledTask.java index 6dab4e5..088f683 100644 --- a/ycl-smoke/src/main/java/com/ycl/smoke/task/ScheduledTask.java +++ b/ycl-smoke/src/main/java/com/ycl/smoke/task/ScheduledTask.java @@ -17,6 +17,7 @@ import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; +import javax.annotation.PostConstruct; import javax.annotation.Resource; import java.text.DateFormat; import java.text.SimpleDateFormat; @@ -112,6 +113,19 @@ public void setLocaleDocumentService(IOdsLocaleDocumentService localeDocumentService) { this.localeDocumentService = localeDocumentService; } + + @PostConstruct + public void start() { + alarmMsgTask(); + queryDataDetectorDaily2Task(); + queryTenMinData(); + listLocale(); + listAlarmRecord(); + listCurAlarm(); + listDataDetectorDailyStats(); + listDetectorDaily(); + } + @Scheduled(cron = "0 0 1 * * ?") // 姣忓ぉ闆剁偣鎵ц // @Scheduled(cron = "0/1 * * * * ?") // 姣忕鎵ц @@ -289,7 +303,7 @@ list.forEach(o -> { try { o.setCustomerString(JSON.toJSONString(o.getCustomer())); - localeService.save(o); + localeService.saveOrUpdate(o); } catch (Exception ex) { System.out.printf(ex.getMessage()); } @@ -354,7 +368,7 @@ list.forEach(o -> { try { o.setAlarmRecordPicsString(JSON.toJSONString(o.getAlarmRecordPics())); - alarmRecordService.save(o); + alarmRecordService.saveOrUpdate(o); } catch (Exception ex) { System.out.printf(ex.getMessage()); } @@ -498,7 +512,7 @@ String listLocaleJson = "{\"Param\":{\"id\":\"" + locale.getId() + "\"}}"; String listLocale = HttpUtil.HttpPostWithJson(host + "/admin/listLocale", listLocaleJson, auth); - String detectorDailyJson = "{\"LocaleId\":\"" + locale.getId() + "\",\"AcquitAtBegin\":" + (dates[1]- 7*86400) + ",\"AcquitAtEnd\":" + dates[1] + "}"; + String detectorDailyJson = "{\"LocaleId\":\"" + locale.getId() + "\",\"AcquitAtBegin\":" + (dates[1] - 7 * 86400) + ",\"AcquitAtEnd\":" + dates[1] + "}"; String detectorDaily = HttpUtil.HttpPostWithJson(host + "/admin/queryDataDetectorDaily", detectorDailyJson, auth); String listIntimeDataJson = "{\"StartAt\":0,\"Size\":20,\"mn\":\"" + locale.getMnLast() + "\",\"typ\":2,\"at\":0}"; -- Gitblit v1.8.0