From f93b6b630aa46ff340b03d1af0fb03125c9fbc4d Mon Sep 17 00:00:00 2001 From: "zhczyx@163.com" Date: Mon, 26 Jan 2026 02:25:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=8F=98=E5=8C=96=E5=8E=86=E5=8F=B2=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data-center-business-controller/buildPush-staging.sh | 10 +++++----- .../resources/db/migration/V68__ba_status_history.sql | 6 ++++++ 2 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 data-center-business-controller/src/main/resources/db/migration/V68__ba_status_history.sql diff --git a/data-center-business-controller/buildPush-staging.sh b/data-center-business-controller/buildPush-staging.sh index 2debe1e..52d28cb 100644 --- a/data-center-business-controller/buildPush-staging.sh +++ b/data-center-business-controller/buildPush-staging.sh @@ -2,10 +2,10 @@ # 注意ThenaQuery中 350行左右的【测试】和【正式】是否正确 # 注意CommonOpt中的S3注释是否开启(测试时注释掉以避免网络问题) -aws configure set aws_access_key_id AKIAQNYBBSGDVT3VF4ON -aws configure set aws_secret_access_key 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 +aws configure set aws_access_key_id AKIAVSKFRQDPNWHJDSHL +aws configure set aws_secret_access_key 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 aws configure set default.region ap-northeast-1 -aws ecr get-login-password --region ap-northeast-1 | docker login --username AWS --password-stdin 029530100103.dkr.ecr.ap-northeast-1.amazonaws.com -docker build -t 029530100103.dkr.ecr.ap-northeast-1.amazonaws.com/aeon/spf-business-stg:latest --build-arg JAR_FILE=target/data-center-business-controller-0.0.1-SNAPSHOT.jar --build-arg LIB_DIR=target/lib --build-arg CONFIG_DIR=target/config . -docker push 029530100103.dkr.ecr.ap-northeast-1.amazonaws.com/aeon/spf-business-stg:latest +aws ecr get-login-password --region ap-northeast-1 | docker login --username AWS --password-stdin 382934810846.dkr.ecr.ap-northeast-1.amazonaws.com +docker build -t 382934810846.dkr.ecr.ap-northeast-1.amazonaws.com/aeon/spf-business-stg:latest --build-arg JAR_FILE=target/data-center-business-controller-0.0.1-SNAPSHOT.jar --build-arg LIB_DIR=target/lib --build-arg CONFIG_DIR=target/config . +docker push 382934810846.dkr.ecr.ap-northeast-1.amazonaws.com/aeon/spf-business-stg:latest diff --git a/data-center-business-controller/src/main/resources/db/migration/V68__ba_status_history.sql b/data-center-business-controller/src/main/resources/db/migration/V68__ba_status_history.sql new file mode 100644 index 0000000..7f47ba6 --- /dev/null +++ b/data-center-business-controller/src/main/resources/db/migration/V68__ba_status_history.sql @@ -0,0 +1,6 @@ +CREATE TABLE `ba_status_history` ( + `id` BIGINT NOT NULL AUTO_INCREMENT, + `device_info_id` INT NOT NULL, + `is_running` INT NULL, + `update_ts` VARCHAR(45) NULL, + PRIMARY KEY (`id`)); From e8f30d5ff0492ac2f55636ce9a5d03b49fba6ed8 Mon Sep 17 00:00:00 2001 From: "zhczyx@163.com" Date: Mon, 26 Jan 2026 02:39:41 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=85=B3=E9=97=AD=E9=99=A4receiver?= =?UTF-8?q?=E5=92=8Csender=E5=9C=A8redis=E4=B8=AD=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=87=8F=E7=BB=9F=E8=AE=A1=E4=BB=A5=E5=A4=96=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E7=9A=84=E7=BB=9F=E8=AE=A1=E6=95=B0=E6=8D=AE=EF=BC=8C?= =?UTF-8?q?=E5=B0=A4=E5=85=B6=E6=98=AFaurora=E7=9B=B8=E5=85=B3=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/SyncTrendsStatsService.java | 126 +++++++++--------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/data-center-business-service/src/main/java/com/techsor/datacenter/business/service/SyncTrendsStatsService.java b/data-center-business-service/src/main/java/com/techsor/datacenter/business/service/SyncTrendsStatsService.java index 4ec667c..ce74c60 100644 --- a/data-center-business-service/src/main/java/com/techsor/datacenter/business/service/SyncTrendsStatsService.java +++ b/data-center-business-service/src/main/java/com/techsor/datacenter/business/service/SyncTrendsStatsService.java @@ -173,10 +173,10 @@ public class SyncTrendsStatsService { log.info("end sync trends stats"); // - log.info("begin to sync aurora trends stats"); - AuroraDeviceTrendStats deviceTrendsStatsAlter = new AuroraDeviceTrendStats(); - handleExternalSync(apikey,now, Long.valueOf(iter),deviceTrendsStatsAlter); - DataSourceContextHolder.clearCurrentDataSourceKey(); +// log.info("begin to sync aurora trends stats"); +// AuroraDeviceTrendStats deviceTrendsStatsAlter = new AuroraDeviceTrendStats(); +// handleExternalSync(apikey,now, Long.valueOf(iter),deviceTrendsStatsAlter); +// DataSourceContextHolder.clearCurrentDataSourceKey(); }); } @@ -264,65 +264,65 @@ public class SyncTrendsStatsService { */ @Scheduled(cron = "${schedule.cron.expression}") public void syncAuroraTrendsData() { - String requestId =UUID.randomUUID().toString(); - MDC.put("requestId", requestId); - ZonedDateTime todayMidnight = getMidnightInTokyo(); - ZonedDateTime yesterdayMidnight = todayMidnight.minusDays(1); - - List companyIdList=new ArrayList<>(); - String sql="\t\tSELECT\n" + - "\t\t\tbcom.id,\n" + - "\t\t\tbcom.company_name companyName\n" + - "\t\tFROM\n" + - "\t\t\tdata_center_aeon_admin.basic_company bcom\n" + - "\t\tWHERE bcom.flag != 1"; - - jdbcTemplate.query(sql,rs->{ - companyIdList.add(rs.getInt("id")); - }); - - companyIdList.stream().forEach(iter->{ - //Get Top company's Apikey, for further query Aurora info use. - Long topCompanyId = dataSourceInterceptor.getTopCompanyId(iter.toString()); - String apikey=basicCompanyMapperExt.getApikeyByCompanyId(topCompanyId).getApikey(); - DeviceTrendsStatsInfoAuroraDTO resultDTO = fetchDataFromAurora(apikey,yesterdayMidnight, todayMidnight, Long.valueOf(iter)); - DataSourceContextHolder.setCurrentDataSourceKey("dataSourceForCompany_" + iter); - - if (resultDTO != null) { - AuroraTrendsStatsTotal auroraTrendsStatsTotal = new AuroraTrendsStatsTotal(); - auroraTrendsStatsTotal.setReceiverDeviceId(0L); - if (resultDTO.getRecieverDeviceIdDelta() != null){ - auroraTrendsStatsTotal.setSenderDeviceId(resultDTO.getSenderDeviceIdDelta()); - }else { - auroraTrendsStatsTotal.setSenderDeviceId(0L); - } - if (resultDTO.getSenderDispatchDelta() != null){ - auroraTrendsStatsTotal.setDispatch(resultDTO.getSenderDispatchDelta()); - }else { - auroraTrendsStatsTotal.setDispatch(0L); - } - if (resultDTO.getSenderAlertDelta() != null){ - auroraTrendsStatsTotal.setAlert(Long.valueOf(resultDTO.getSenderAlertDelta())); - }else { - auroraTrendsStatsTotal.setAlert(0L); - } - if (resultDTO.getSenderAlertCancelDelta() != null){ - auroraTrendsStatsTotal.setAlertCancel(Long.valueOf(resultDTO.getSenderAlertCancelDelta())); - }else{ - auroraTrendsStatsTotal.setAlertCancel(0L); - } - if (resultDTO.getBuildingIdCount() != null){ - auroraTrendsStatsTotal.setSenderBuilding(Long.valueOf(resultDTO.getBuildingIdCount())); - }else{ - auroraTrendsStatsTotal.setSenderBuilding(0L); - } - auroraTrendsStatsTotal.setCreatedDate(Date.from(yesterdayMidnight.toInstant())); - this.auroraTrendsStatsTotalMapper.insert(auroraTrendsStatsTotal); - } - DataSourceContextHolder.clearCurrentDataSourceKey(); - }); - - MDC.clear(); +// String requestId =UUID.randomUUID().toString(); +// MDC.put("requestId", requestId); +// ZonedDateTime todayMidnight = getMidnightInTokyo(); +// ZonedDateTime yesterdayMidnight = todayMidnight.minusDays(1); +// +// List companyIdList=new ArrayList<>(); +// String sql="\t\tSELECT\n" + +// "\t\t\tbcom.id,\n" + +// "\t\t\tbcom.company_name companyName\n" + +// "\t\tFROM\n" + +// "\t\t\tdata_center_aeon_admin.basic_company bcom\n" + +// "\t\tWHERE bcom.flag != 1"; +// +// jdbcTemplate.query(sql,rs->{ +// companyIdList.add(rs.getInt("id")); +// }); +// +// companyIdList.stream().forEach(iter->{ +// //Get Top company's Apikey, for further query Aurora info use. +// Long topCompanyId = dataSourceInterceptor.getTopCompanyId(iter.toString()); +// String apikey=basicCompanyMapperExt.getApikeyByCompanyId(topCompanyId).getApikey(); +// DeviceTrendsStatsInfoAuroraDTO resultDTO = fetchDataFromAurora(apikey,yesterdayMidnight, todayMidnight, Long.valueOf(iter)); +// DataSourceContextHolder.setCurrentDataSourceKey("dataSourceForCompany_" + iter); +// +// if (resultDTO != null) { +// AuroraTrendsStatsTotal auroraTrendsStatsTotal = new AuroraTrendsStatsTotal(); +// auroraTrendsStatsTotal.setReceiverDeviceId(0L); +// if (resultDTO.getRecieverDeviceIdDelta() != null){ +// auroraTrendsStatsTotal.setSenderDeviceId(resultDTO.getSenderDeviceIdDelta()); +// }else { +// auroraTrendsStatsTotal.setSenderDeviceId(0L); +// } +// if (resultDTO.getSenderDispatchDelta() != null){ +// auroraTrendsStatsTotal.setDispatch(resultDTO.getSenderDispatchDelta()); +// }else { +// auroraTrendsStatsTotal.setDispatch(0L); +// } +// if (resultDTO.getSenderAlertDelta() != null){ +// auroraTrendsStatsTotal.setAlert(Long.valueOf(resultDTO.getSenderAlertDelta())); +// }else { +// auroraTrendsStatsTotal.setAlert(0L); +// } +// if (resultDTO.getSenderAlertCancelDelta() != null){ +// auroraTrendsStatsTotal.setAlertCancel(Long.valueOf(resultDTO.getSenderAlertCancelDelta())); +// }else{ +// auroraTrendsStatsTotal.setAlertCancel(0L); +// } +// if (resultDTO.getBuildingIdCount() != null){ +// auroraTrendsStatsTotal.setSenderBuilding(Long.valueOf(resultDTO.getBuildingIdCount())); +// }else{ +// auroraTrendsStatsTotal.setSenderBuilding(0L); +// } +// auroraTrendsStatsTotal.setCreatedDate(Date.from(yesterdayMidnight.toInstant())); +// this.auroraTrendsStatsTotalMapper.insert(auroraTrendsStatsTotal); +// } +// DataSourceContextHolder.clearCurrentDataSourceKey(); +// }); +// +// MDC.clear(); } /**