提交 ce06929c authored 作者: Matrix's avatar Matrix

增加了JWT模块,暂停了所有模块的定时任务(原因是要暂时上一版只提供API的版本),修复了一些小问题。最终这些JWT和API模块是要移除的,只保留采集模块,同时会增加写文件模块。

上级 d6645e73
流水线 #200 已失败 于阶段
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>fp-acq-wz</artifactId>
<groupId>com.zjty.fp</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>acq-jwt</artifactId>
<name>acq-jwt</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.7.0</version>
</dependency>
</dependencies>
</project>
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
<artifactId>fp-acq-wz</artifactId> <artifactId>fp-acq-wz</artifactId>
<groupId>com.zjty.fp</groupId> <groupId>com.zjty.fp</groupId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<relativePath/>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -37,7 +37,7 @@ public class PsspInitialRunner { ...@@ -37,7 +37,7 @@ public class PsspInitialRunner {
return args -> { return args -> {
log.info("[pssp] 正在尝试初始化 pssp 网站Map字段表"); log.info("[pssp] 正在尝试初始化 pssp 网站Map字段表");
//List<Website> -> key : id , value : Website // List<Website> -> key : id , value : Website
Map<Long, Website> websiteMap = websiteService.findDictMap(); Map<Long, Website> websiteMap = websiteService.findDictMap();
DictConst.WEBSITE_MAP = websiteMap; DictConst.WEBSITE_MAP = websiteMap;
...@@ -45,7 +45,7 @@ public class PsspInitialRunner { ...@@ -45,7 +45,7 @@ public class PsspInitialRunner {
log.info("[pssp] 正在尝试初始化 pssp 地区Map字段表"); log.info("[pssp] 正在尝试初始化 pssp 地区Map字段表");
//List<Website> -> key : code , value : Region // List<Website> -> key : code , value : Region
Map<String, Region> regionMap = regionService.findDictMap(); Map<String, Region> regionMap = regionService.findDictMap();
DictConst.REGION_MAP = regionMap; DictConst.REGION_MAP = regionMap;
......
...@@ -51,12 +51,10 @@ public class PsspTestController { ...@@ -51,12 +51,10 @@ public class PsspTestController {
} }
/** /**
* 抓取所有网页数据(当前月) * 抓取所有网页数据
*/ */
@GetMapping("/websites/all") @GetMapping("/websites/all")
public ResponseEntity<String> fetchAllWebsites( public ResponseEntity<String> fetchAllWebsites() {
@RequestParam(value = "startTime") String startTime,
@RequestParam(value = "endTime") String endTime) {
//抓取指定月份的数据 //抓取指定月份的数据
websiteService.fetchAllData(); websiteService.fetchAllData();
return ResponseEntity.ok("fetch websites success"); return ResponseEntity.ok("fetch websites success");
...@@ -72,7 +70,7 @@ public class PsspTestController { ...@@ -72,7 +70,7 @@ public class PsspTestController {
} }
/** /**
* 抓取所有网页数据(当前月) * 抓取所有区域数据
*/ */
@GetMapping("/regions/all") @GetMapping("/regions/all")
public ResponseEntity<String> fetchAllRegions() { public ResponseEntity<String> fetchAllRegions() {
......
...@@ -126,6 +126,12 @@ public class RemoteAlert { ...@@ -126,6 +126,12 @@ public class RemoteAlert {
@Column(name = "tm_confidential") @Column(name = "tm_confidential")
private Date tmConfidential; private Date tmConfidential;
@Column(name = "suspicious_remark")
private String susRemark;
@Column(name = "confidential_remark")
private String conRemark;
/** /**
* 数据是否为压缩类型 * 数据是否为压缩类型
*/ */
......
...@@ -31,6 +31,14 @@ public class RemoteWebsite { ...@@ -31,6 +31,14 @@ public class RemoteWebsite {
private String scope; private String scope;
private String host;
private String domain;
private String contact;
private String phone;
private String unit; private String unit;
private Integer codeOrg; private Integer codeOrg;
...@@ -46,6 +54,12 @@ public class RemoteWebsite { ...@@ -46,6 +54,12 @@ public class RemoteWebsite {
private Integer statusCollect; private Integer statusCollect;
private Integer statusRun;
private Integer statusError;
private Integer idUser;
public Website toDo() { public Website toDo() {
ModelMapper mapper = new ModelMapper(); ModelMapper mapper = new ModelMapper();
mapper.getConfiguration().setAmbiguityIgnored(true); mapper.getConfiguration().setAmbiguityIgnored(true);
......
...@@ -54,18 +54,23 @@ public class AlertServiceImpl implements AlertService { ...@@ -54,18 +54,23 @@ public class AlertServiceImpl implements AlertService {
public void fetchAllData() { public void fetchAllData() {
//遍历一个时间集合,用来抓取历史数据,获取当前月,添加今年一月至当前月的数据 //遍历一个时间集合,用来抓取历史数据,获取当前月,添加今年一月至当前月的数据
List<LocalDate> monthTables = new ArrayList<>(); List<LocalDate> monthTables = new ArrayList<>();
int nowYear = LocalDate.now().getYear();
int nowMonth = LocalDate.now().getMonthValue(); //WZ项目 添加2017年12月 201801 202007 三个月的数据
log.info("[pssp] [历史任务] 确认历史任务的采集月份范围"); monthTables.add(LocalDate.of(2017, 12, 1));
for (int i = 1; i < nowMonth; i++) { monthTables.add(LocalDate.of(2018, 1, 1));
//check month // monthTables.add(LocalDate.of(2020, 7, 1));
try { // int nowYear = LocalDate.now().getYear();
remoteAlertRepo.count(); // int nowMonth = LocalDate.now().getMonthValue();
monthTables.add(LocalDate.of(nowYear, i, 1)); // log.info("[pssp] [历史任务] 确认历史任务的采集月份范围");
} catch (Exception e) { // for (int i = 1; i < nowMonth; i++) {
log.warn("[pssp] [历史任务] 检测源目标数据库没有 {}-{}月表数据", nowYear, i); // //check month
} // try {
} // remoteAlertRepo.count();
// monthTables.add(LocalDate.of(nowYear, i, 1));
// } catch (Exception e) {
// log.warn("[pssp] [历史任务] 检测源目标数据库没有 {}-{}月表数据", nowYear, i);
// }
// }
log.info("[pssp] [历史任务] 正在进行历史任务采集任务... 要采集的月份时间为{}", monthTables log.info("[pssp] [历史任务] 正在进行历史任务采集任务... 要采集的月份时间为{}", monthTables
.stream() .stream()
......
...@@ -76,8 +76,8 @@ public class CollectDataTask { ...@@ -76,8 +76,8 @@ public class CollectDataTask {
/** /**
* This method is for debug * This method is for debug
*/ */
@EnablePsspSchProtect // @EnablePsspSchProtect
@Scheduled(cron = "0 0/1 * * * ?") // @Scheduled(cron = "0 0/1 * * * ?")
public void checkPsspDataCount() { public void checkPsspDataCount() {
long simcCount = remotePsspRep.count(); long simcCount = remotePsspRep.count();
long apiCount = localPsspRep.count(); long apiCount = localPsspRep.count();
...@@ -89,7 +89,7 @@ public class CollectDataTask { ...@@ -89,7 +89,7 @@ public class CollectDataTask {
* 抓取更新的网站的数据,当前为1h/次 * 抓取更新的网站的数据,当前为1h/次
*/ */
@EnablePsspSchProtect @EnablePsspSchProtect
@Scheduled(cron = "0 0 0/1 * * ?") // @Scheduled(cron = "0 0 0/1 * * ?")
public void collectWebsiteData() { public void collectWebsiteData() {
log.info("[pssp] [定时任务]抓取更新的网站数据"); log.info("[pssp] [定时任务]抓取更新的网站数据");
websiteService.fetchUpdatedData(); websiteService.fetchUpdatedData();
...@@ -99,7 +99,7 @@ public class CollectDataTask { ...@@ -99,7 +99,7 @@ public class CollectDataTask {
* 抓取更新的地区的数据,当前为1h/次 * 抓取更新的地区的数据,当前为1h/次
*/ */
@EnablePsspSchProtect @EnablePsspSchProtect
@Scheduled(cron = "0 0 0/1 * * ?") // @Scheduled(cron = "0 0 0/1 * * ?")
public void collectRegionData() { public void collectRegionData() {
log.info("[pssp] [定时任务]抓取更新的区域数据"); log.info("[pssp] [定时任务]抓取更新的区域数据");
regionService.fetchUpdatedData(); regionService.fetchUpdatedData();
...@@ -109,7 +109,7 @@ public class CollectDataTask { ...@@ -109,7 +109,7 @@ public class CollectDataTask {
* 抓取更新的报警数据,当前为1min/次 * 抓取更新的报警数据,当前为1min/次
*/ */
@EnablePsspSchProtect @EnablePsspSchProtect
@Scheduled(cron = "30 0/1 * * * ?") // @Scheduled(cron = "30 0/1 * * * ?")
public void collectAlertData() { public void collectAlertData() {
log.info("[pssp] [定时任务] 抓取更新的报警数据"); log.info("[pssp] [定时任务] 抓取更新的报警数据");
alertService.fetchUpdatedData(); alertService.fetchUpdatedData();
...@@ -120,9 +120,9 @@ public class CollectDataTask { ...@@ -120,9 +120,9 @@ public class CollectDataTask {
* <li>1.关闭其他计划任务</li> * <li>1.关闭其他计划任务</li>
* <li>2.将当前动态处理的表时间更改为上个月时间</li> * <li>2.将当前动态处理的表时间更改为上个月时间</li>
* <li>3.执行数据更新任务</li> * <li>3.执行数据更新任务</li>
* <li4.更正时间,开启其他计划任务></li> * <li>4.更正时间,开启其他计划任务></li>
*/ */
@Scheduled(cron = "0 10 0 1 * ?") // @Scheduled(cron = "0 10 0 1 * ?")
@EnablePsspSchProtect @EnablePsspSchProtect
public void replenishMysqlDataMonthly() { public void replenishMysqlDataMonthly() {
log.info("[pssp] [定时任务] 正在执行月末数据补偿任务,暂停其他计划任务,要补偿的月份数据是 {}", LocalDate.now().minusMonths(1L).toString()); log.info("[pssp] [定时任务] 正在执行月末数据补偿任务,暂停其他计划任务,要补偿的月份数据是 {}", LocalDate.now().minusMonths(1L).toString());
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
<artifactId>fp-acq-wz</artifactId> <artifactId>fp-acq-wz</artifactId>
<groupId>com.zjty.fp</groupId> <groupId>com.zjty.fp</groupId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<relativePath/>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
...@@ -77,6 +76,12 @@ ...@@ -77,6 +76,12 @@
<artifactId>acq-vomp</artifactId> <artifactId>acq-vomp</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.zjty.fp</groupId>
<artifactId>acq-jwt</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
......
...@@ -19,6 +19,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; ...@@ -19,6 +19,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
"com.zjty.fp.acq.pssp", "com.zjty.fp.acq.pssp",
"com.zjty.fp.acq.vomp", "com.zjty.fp.acq.vomp",
"com.zjty.fp.acq.misc", "com.zjty.fp.acq.misc",
"com.zjty.fp.acq.jwt"
}) })
@EnableScheduling @EnableScheduling
public class UnionApplication { public class UnionApplication {
......
...@@ -119,6 +119,7 @@ public class DataSourceConfig { ...@@ -119,6 +119,7 @@ public class DataSourceConfig {
*/ */
private TableRuleConfiguration getAlertTableRuleConfiguration() { private TableRuleConfiguration getAlertTableRuleConfiguration() {
String actualDataNodes = "" + String actualDataNodes = "" +
"ds0.pssp_alert_201712," +
"ds0.pssp_alert_201807," + "ds0.pssp_alert_201807," +
"ds0.pssp_alert_201808," + "ds0.pssp_alert_201808," +
"ds0.pssp_alert_201809," + "ds0.pssp_alert_201809," +
......
# suppress inspection "SpringBootApplicationProperties" for whole file # suppress inspection "SpringBootApplicationProperties" for whole file
spring.application.name=fp-api spring.application.name=fp-acq-wz
# 数据库one相关配置 21.18.29.98:3306/db_secret_alert. # 数据库one相关配置 21.18.29.98:3306/db_secret_alert.
spring.datasource.remote.driver-class-name=com.mysql.jdbc.Driver spring.datasource.remote.driver-class-name=com.mysql.jdbc.Driver
...@@ -30,7 +30,7 @@ spring.datasource.remote.test-while-idle=true ...@@ -30,7 +30,7 @@ spring.datasource.remote.test-while-idle=true
# 数据库two相关配置 # 数据库two相关配置
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.location.driver-class-name=com.mysql.jdbc.Driver spring.datasource.location.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.location.url=jdbc:mysql://localhost:3306/fp_api?useSSL=false&serverTimezone=UTC&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true spring.datasource.location.url=jdbc:mysql://localhost:3306/fp_api_empty?useSSL=false&serverTimezone=UTC&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true
spring.datasource.location.username=fp spring.datasource.location.username=fp
spring.datasource.location.password=fp123456 spring.datasource.location.password=fp123456
## StatFilter ## StatFilter
...@@ -58,6 +58,10 @@ spring.datasource.remote2.driver-class-name=com.mysql.jdbc.Driver ...@@ -58,6 +58,10 @@ spring.datasource.remote2.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.remote2.url=jdbc:mysql://localhost:3306/fp_simc?useSSL=false&serverTimezone=UTC&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true spring.datasource.remote2.url=jdbc:mysql://localhost:3306/fp_simc?useSSL=false&serverTimezone=UTC&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true
spring.datasource.remote2.username=fp spring.datasource.remote2.username=fp
spring.datasource.remote2.password=fp123456 spring.datasource.remote2.password=fp123456
#spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
#spring.datasource.url=jdbc:sqlserver://21.28.120.2:1433;DatabaseName=PowerMonJava;
#spring.datasource.username=ms
#spring.datasource.password=ms123456
# ftp # ftp
ftp.server.ip=192.168.1.159 ftp.server.ip=192.168.1.159
ftp.server.port=2121 ftp.server.port=2121
......
# suppress inspection "SpringBootApplicationProperties" for whole file # suppress inspection "SpringBootApplicationProperties" for whole file
spring.application.name=fp-api spring.application.name=fp-acq-wz
# 数据库one相关配置 21.18.29.98:3306/db_secret_alert. # 数据库one相关配置 21.18.29.98:3306/db_secret_alert.
spring.datasource.remote.driver-class-name=com.mysql.jdbc.Driver spring.datasource.remote.driver-class-name=com.mysql.jdbc.Driver
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
<artifactId>fp-acq-wz</artifactId> <artifactId>fp-acq-wz</artifactId>
<groupId>com.zjty.fp</groupId> <groupId>com.zjty.fp</groupId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<relativePath/>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
...@@ -32,6 +31,12 @@ ...@@ -32,6 +31,12 @@
<artifactId>spring-boot-starter-data-jpa</artifactId> <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
<!--动态查询--> <!--动态查询-->
<dependency> <dependency>
<groupId>com.github.wenhao</groupId> <groupId>com.github.wenhao</groupId>
......
...@@ -47,7 +47,7 @@ public class VompTasks { ...@@ -47,7 +47,7 @@ public class VompTasks {
/** /**
* 60分钟执行一次 读取 * 60分钟执行一次 读取
*/ */
@Scheduled(initialDelay = 4000, fixedRate = 60000 * 60) // @Scheduled(initialDelay = 4000, fixedRate = 60000 * 60)
public void updateData() { public void updateData() {
dataDbUpdater.updateData(); dataDbUpdater.updateData();
mapUpdater.updateData(); mapUpdater.updateData();
...@@ -56,7 +56,7 @@ public class VompTasks { ...@@ -56,7 +56,7 @@ public class VompTasks {
/** /**
* 3分钟执行一次 * 3分钟执行一次
*/ */
@Scheduled(initialDelay = 4000, fixedRate = 60000 * 3) // @Scheduled(initialDelay = 4000, fixedRate = 60000 * 3)
public void updateRedisData() { public void updateRedisData() {
log.info("[vomp] 开始更新缓存数据"); log.info("[vomp] 开始更新缓存数据");
mapUpdater.updateData(); mapUpdater.updateData();
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
<module>acq-vomp</module> <module>acq-vomp</module>
<module>acq-union</module> <module>acq-union</module>
<module>acq-misc</module> <module>acq-misc</module>
<module>acq-jwt</module>
</modules> </modules>
<dependencyManagement> <dependencyManagement>
...@@ -57,6 +58,12 @@ ...@@ -57,6 +58,12 @@
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>com.zjty.fp</groupId>
<artifactId>acq-jwt</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论