From ccdbae9ad727af67866cd5a36072d99111c704c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E9=A3=9E=E5=AE=87?= <2684146481@qq.com> Date: Wed, 24 May 2023 11:41:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E7=9A=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/scheduled/ScheduledApplication.java | 2 +- .../hnac/hzims/scheduled/config/XxlJobConfig.java | 118 ++++++++++----------- .../mapper/operation/AbnormalAlarmMapper.xml | 17 --- .../operation/HistoryAbnormalAlarmMapper.xml | 10 -- .../mapper/operation/StAlarmRecordMapper.xml | 19 ---- .../scheduled/mapper/operation/StationMapper.xml | 26 ----- .../scheduled/scheduled/ScheduledCreateTask.java | 10 +- .../src/main/resources/application.yml | 23 +++- .../mapper/operation/AbnormalAlarmMapper.xml | 17 +++ .../mapper/operation/StAlarmRecordMapper.xml | 19 ++++ 10 files changed, 124 insertions(+), 137 deletions(-) delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/AbnormalAlarmMapper.xml delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/HistoryAbnormalAlarmMapper.xml delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StAlarmRecordMapper.xml delete mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/operation/AbnormalAlarmMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StAlarmRecordMapper.xml diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/ScheduledApplication.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/ScheduledApplication.java index d2772ca..63fb110 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/ScheduledApplication.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/ScheduledApplication.java @@ -18,7 +18,7 @@ import javax.annotation.Resource; @EnableBladeFeign @SpringCloudApplication @MapperScan("com.hnac.hzims.scheduled.**.mapper.**") -@ComponentScan(basePackages = {"com.hnac.*","org.springblade.core.*"}) +@ComponentScan(basePackages = {"com.hnac.*","org.springblade.core"}) @Resource public class ScheduledApplication { public static void main(String[] args) { diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/config/XxlJobConfig.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/config/XxlJobConfig.java index b587329..6b473a9 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/config/XxlJobConfig.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/config/XxlJobConfig.java @@ -1,59 +1,59 @@ -package com.hnac.hzims.scheduled.config; - -import com.xxl.job.core.executor.impl.XxlJobSpringExecutor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; - -/** - * @Author WL - * @Version v1.0 - * @Serial 1.0 - * @Date 2022/1/8 10:23 - */ -@Slf4j -@Configuration -//指定任务Handler所在包路径 -public class XxlJobConfig { - - - @Value("${xxl.job.admin.addresses}") - private String adminAddresses; - - @Value("${xxl.job.executor.appname}") - private String appName; - - @Value("${xxl.job.executor.ip}") - private String ip; - - @Value("${xxl.job.executor.port}") - private int port; - - @Value("${xxl.job.accessToken}") - private String accessToken; - - @Value("${xxl.job.executor.logpath}") - private String logPath; - - @Value("${xxl.job.executor.logretentiondays}") - private int logRetentionDays; - - - @Bean(initMethod = "start", destroyMethod = "destroy") - public XxlJobSpringExecutor xxlJobExecutor() { - log.info("====xxl-job config init===="); - XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); - xxlJobSpringExecutor.setAdminAddresses(adminAddresses); - xxlJobSpringExecutor.setAppName(appName); - xxlJobSpringExecutor.setIp(ip); - xxlJobSpringExecutor.setPort(port); - xxlJobSpringExecutor.setAccessToken(accessToken); - xxlJobSpringExecutor.setLogPath(logPath); - xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays); - return xxlJobSpringExecutor; - } - -} - +// package com.hnac.hzims.scheduled.config; +// +// import com.xxl.job.core.executor.impl.XxlJobSpringExecutor; +// import lombok.extern.slf4j.Slf4j; +// import org.springframework.beans.factory.annotation.Value; +// import org.springframework.context.annotation.Bean; +// import org.springframework.context.annotation.ComponentScan; +// import org.springframework.context.annotation.Configuration; +// +// /** +// * @Author WL +// * @Version v1.0 +// * @Serial 1.0 +// * @Date 2022/1/8 10:23 +// */ +// @Slf4j +// @Configuration +// //指定任务Handler所在包路径 +// public class XxlJobConfig { +// +// +// @Value("${xxl.job.admin.addresses}") +// private String adminAddresses; +// +// @Value("${xxl.job.executor.appname}") +// private String appName; +// +// @Value("${xxl.job.executor.ip}") +// private String ip; +// +// @Value("${xxl.job.executor.port}") +// private int port; +// +// @Value("${xxl.job.accessToken}") +// private String accessToken; +// +// @Value("${xxl.job.executor.logpath}") +// private String logPath; +// +// @Value("${xxl.job.executor.logretentiondays}") +// private int logRetentionDays; +// +// +// @Bean(initMethod = "start", destroyMethod = "destroy") +// public XxlJobSpringExecutor xxlJobExecutor() { +// log.info("====xxl-job config init===="); +// XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); +// xxlJobSpringExecutor.setAdminAddresses(adminAddresses); +// xxlJobSpringExecutor.setAppName(appName); +// xxlJobSpringExecutor.setIp(ip); +// xxlJobSpringExecutor.setPort(port); +// xxlJobSpringExecutor.setAccessToken(accessToken); +// xxlJobSpringExecutor.setLogPath(logPath); +// xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays); +// return xxlJobSpringExecutor; +// } +// +// } +// diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/AbnormalAlarmMapper.xml b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/AbnormalAlarmMapper.xml deleted file mode 100644 index 49c1076..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/AbnormalAlarmMapper.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/HistoryAbnormalAlarmMapper.xml b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/HistoryAbnormalAlarmMapper.xml deleted file mode 100644 index fdbd02b..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/HistoryAbnormalAlarmMapper.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StAlarmRecordMapper.xml b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StAlarmRecordMapper.xml deleted file mode 100644 index cfe513d..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StAlarmRecordMapper.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - SELECT LAST_INSERT_ID() AS id - - insert into hy_st_alarm_record (id, station_id, real_id, - status, phone_record, process_desc, - create_time, processor, process_time - ) - values (#{id,jdbcType=BIGINT}, #{stationId,jdbcType=VARCHAR}, #{realId,jdbcType=VARCHAR}, - #{status,jdbcType=TINYINT}, #{phoneRecord,jdbcType=VARCHAR}, #{processDesc,jdbcType=VARCHAR}, - #{createTime,jdbcType=TIMESTAMP}, #{processor,jdbcType=VARCHAR}, #{processTime,jdbcType=TIMESTAMP} - ) - - - \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationMapper.xml b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationMapper.xml deleted file mode 100644 index e5e9daf..0000000 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StationMapper.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ScheduledCreateTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ScheduledCreateTask.java index 280ab7e..81cb979 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ScheduledCreateTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ScheduledCreateTask.java @@ -31,7 +31,6 @@ public class ScheduledCreateTask { * @return ReturnT */ @XxlJob(LOAD_WATER_LEVEL) - //@Scheduled(cron = "0/40 * * * * ? ") public ReturnT loadWaterLevel(String param) throws Exception { if (Func.isBlank(param)) { param = DateUtil.format(new Date(), "yyyy-MM"); @@ -42,5 +41,14 @@ public class ScheduledCreateTask { + /** + * 水利-站点水位数据 + * @return ReturnT + */ + @XxlJob("cheshi") + public ReturnT cheshi(String param) throws Exception { + System.out.println("执行呢方法"); + return new ReturnT<>("SUCCESS"); + } } diff --git a/hzims-service/hzims-scheduled/src/main/resources/application.yml b/hzims-service/hzims-scheduled/src/main/resources/application.yml index 2f8c38f..e738d56 100644 --- a/hzims-service/hzims-scheduled/src/main/resources/application.yml +++ b/hzims-service/hzims-scheduled/src/main/resources/application.yml @@ -36,23 +36,38 @@ spring: # redis访问密码(默认为空) password: 1qaz2WSX@redis +#xxl: +# job: +# accessToken: '' +# admin: +# addresses: http://192.168.1.3:7009/xxl-job-admin +# executor: +# appname: hzims-operational +# ip: 192.168.1.3 +# logpath: /data/applogs/xxl-job/jobhandler +# logretentiondays: -1 +# port: 28501 + xxl: job: accessToken: '' admin: - addresses: http://192.168.1.3:7009/xxl-job-admin + addresses: http://192.168.5.128:9080/xxl-job-admin executor: appname: hzims-operational - ip: 192.168.1.3 + ip: 192.168.18.232 logpath: /data/applogs/xxl-job/jobhandler logretentiondays: -1 port: 28501 + #mybatis-plus配置 mybatis-plus: - mapper-locations: classpath:com/hnac/hzims/**/mapper/*Mapper.xml + mapper-locations: classpath*:/mapper/**/*.xml #实体扫描,多个package用逗号或者分号分隔 - typeAliasesPackage: com.hnac.hzims.**.entity +# typeAliasesPackage: com.hnac.hzims.**.entity + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #swagger扫描路径配置 swagger: diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/AbnormalAlarmMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/AbnormalAlarmMapper.xml new file mode 100644 index 0000000..49c1076 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/AbnormalAlarmMapper.xml @@ -0,0 +1,17 @@ + + + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StAlarmRecordMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StAlarmRecordMapper.xml new file mode 100644 index 0000000..cfe513d --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StAlarmRecordMapper.xml @@ -0,0 +1,19 @@ + + + + + + + SELECT LAST_INSERT_ID() AS id + + insert into hy_st_alarm_record (id, station_id, real_id, + status, phone_record, process_desc, + create_time, processor, process_time + ) + values (#{id,jdbcType=BIGINT}, #{stationId,jdbcType=VARCHAR}, #{realId,jdbcType=VARCHAR}, + #{status,jdbcType=TINYINT}, #{phoneRecord,jdbcType=VARCHAR}, #{processDesc,jdbcType=VARCHAR}, + #{createTime,jdbcType=TIMESTAMP}, #{processor,jdbcType=VARCHAR}, #{processTime,jdbcType=TIMESTAMP} + ) + + + \ No newline at end of file