diff options
| author | wangwei <[email protected]> | 2023-02-17 10:10:11 +0800 |
|---|---|---|
| committer | wangwei <[email protected]> | 2023-02-17 10:10:11 +0800 |
| commit | 12dbafb3c8da5179759fafb550ff7b7178e975d3 (patch) | |
| tree | df93598fdb2724505b87f39b5e78228aab2ee7da | |
| parent | 5cbaa5f52c5881e05de1b780268d15ff6b01997e (diff) | |
更新配置name
| -rw-r--r-- | src/main/java/com/example/nis/Scheduled/Entity.java | 26 | ||||
| -rw-r--r-- | src/main/resources/application.yml | 3 |
2 files changed, 14 insertions, 15 deletions
diff --git a/src/main/java/com/example/nis/Scheduled/Entity.java b/src/main/java/com/example/nis/Scheduled/Entity.java index 4f172d0..31c9252 100644 --- a/src/main/java/com/example/nis/Scheduled/Entity.java +++ b/src/main/java/com/example/nis/Scheduled/Entity.java @@ -39,22 +39,22 @@ public class Entity { @Autowired TsgServiceImpl tsgService; - @Value("${entity.psiphon.ipObjectId}") - private Integer psiphonIpObjectId; - @Value("${entity.psiphon.ipObjectName}") - private String psiphonIpObjectName; - @Value("${entity.psiphon.enable}") - private Boolean psiphonEnable; - @Value("${entity.psiphon.sql}") + @Value("${entity.update.ipObjectId}") + private Integer updateIpObjectId; + @Value("${entity.update.ipObjectName}") + private String updateIpObjectName; + @Value("${entity.update.enable}") + private Boolean updateEnable; + @Value("${entity.update.sql}") private String sql; - @Scheduled(cron = "${entity.psiphon.cron}") + @Scheduled(cron = "${entity.update.cron}") public ResponseData scheduledExecutorOfPsiphon() { - if (BooleanUtil.isFalse(psiphonEnable)) { - log.warn("psiphon schedule disable"); + if (BooleanUtil.isFalse(updateEnable)) { + log.warn("update schedule disable"); return ResponseData.ok(); } - ResponseData responseData = getAllByIpObjectId(psiphonIpObjectId); + ResponseData responseData = getAllByIpObjectId(updateIpObjectId); if (!Code.SUCCESS.getCode().equals(responseData.get("code"))) { String msg = String.valueOf(responseData.get("msg")); log.error("get all itemList error: {}", msg); @@ -131,9 +131,9 @@ public class Entity { try { JSONArray array = new JSONArray(); JSONObject jsonObject = new JSONObject(); - jsonObject.set(Constant.TSG_OBJECT_ID, psiphonIpObjectId); + jsonObject.set(Constant.TSG_OBJECT_ID, updateIpObjectId); jsonObject.set(Constant.TSG_OBJECT_TYPE, Constant.TSG_IP_ADDR_OBJECT); - jsonObject.set(Constant.TSG_OBJECT_NAME, psiphonIpObjectName); + jsonObject.set(Constant.TSG_OBJECT_NAME, updateIpObjectName); jsonObject.set(Constant.TSG_IS_BUILTIN, 0); jsonObject.set(Constant.TSG_IS_EXCLUSION, 0); jsonObject.set(Constant.TSG_IS_VALID, 1); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 5d75b3c..edf83c7 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -28,9 +28,8 @@ tsg: urlObjectName: sg-test fqdnObjectId: 159 fqdnObjectName: sg-test - entity: - psiphon: + update: cron: 0 0/1 * * * ? enable: true #Plan B sql: SELECT common_client_ip as client_ip, count(DISTINCT common_server_ip) as num FROM security_event WHERE common_recv_time > now() - 10 * 60 AND common_recv_time <= now() AND notEmpty(common_client_ip) AND common_policy_id = '97810' GROUP BY client_ip HAVING num >= 10 |
