132 Commits

Author SHA1 Message Date
duandongmei
4b7bde7084 国内部署版本区域运营商换成国内的;
去掉系统中的限速动作
2019-10-21 10:11:15 +08:00
shangguan
b96cde52d8 日志检索-APP协议页面-修改监测动作,列表展示为数字的BUG 2019-10-16 10:42:46 +08:00
duandongmei
3b943be13b IP Spoofing和IP Payload新增隐藏log opation 2019-09-09 11:23:23 +08:00
zhangwenqing
4c2980669d 修正 IpPayload配置下载导入模板时异常
Conflicts:
	src/main/java/com/nis/util/excel/ExportExcel.java
2019-08-26 09:52:33 +08:00
zhangwenqing
2b4a09ea2a 修正FTP配置批量删除功能 2019-08-26 09:50:52 +08:00
shangguan
6855909f00 表结构sql文件中-协议字典表(code_protocol_type_dic)中增加HTTP协议字典数据 2019-08-14 16:24:26 +08:00
shangguan
75b880ede5 表结构sql文件中-表ip_reuse_policy_cfg中src_ip_pattern字段改为ip_pattern,去掉dest_ip_pattern字段 2019-08-14 10:40:12 +08:00
duandongmei
d5ebc0ff04 IPSpoofing调整权限标识 2019-07-12 15:14:31 +08:00
duandongmei
bba21287df 清空定时任务旧数据 2019-07-12 11:28:05 +08:00
duandongmei
0ee38c42d4 去掉APP相关监测动作必须绑定IP的校验 2019-07-12 10:35:20 +08:00
duandongmei
5280741d26 general分支增加其他攻击菜单及其国际化 2019-07-12 09:54:28 +08:00
shangguanyanfei
f3e726e0c1 首页的统计页面和日志检索模块下面的所有页面 去掉地域和运营商的查询条件 2019-07-11 17:58:22 +08:00
shangguanyanfei
66052be81d nis文件中 ceiec 目录都替换为mesasoft 2019-07-10 18:18:52 +08:00
段冬梅
011533528e general分支清理数据sql增加自增id的初始化;
ntc_db初始化app_topic_domain_cfg配置,配置Id从1开始
2019-07-09 13:36:04 +08:00
shangguanyanfei
47b9fdbaae 首页的图表展示 数据源修改 2019-07-09 10:12:21 +08:00
shangguanyanfei
406a5d83cd 流量日志菜单下新增 文件扫描菜单 2019-07-04 18:35:14 +08:00
duandongmei
ca84326442 NTC通用版本提交:修改数据库sql,修改log 2019-07-03 14:28:19 +08:00
段冬梅
fd20c50d1b 通用sql 2019-07-03 12:47:54 +08:00
段冬梅
382c6e48c4 Update README.md 2019-07-03 11:19:14 +08:00
duandongmei
de1eb563a3 时间间隔默认5分钟,日志导出最大条数修改为2万 2019-06-03 17:07:53 +08:00
wangwei
af28efc76d 修复审核通过配置修改成功提示信息bug
Conflicts:
	src/main/java/com/nis/web/controller/configuration/proxy/FileStrategyController.java
2019-05-29 14:01:14 +08:00
wangxin
973f071897 删除无必要的判断 2019-05-28 19:51:46 +08:00
wangxin
e8e948ce7d 修复packet ip address asn切换到ip配置时,没有正确获取到配置属性的bug 2019-05-28 19:51:01 +08:00
wangwei
df9665376f 完善修改配置数据时提示信息问题 2019-05-27 10:17:42 +08:00
wangwei
2858e643ac 修复文件摘要修改功能请求服务接口失败 2019-05-27 10:15:59 +08:00
wangxin
8d2e30b952 Steam三个菜单的form表单当action 为monit的时候ip和账号必选一个 2019-05-23 10:22:24 +08:00
duandongmei
19c8492cc8 热修改功能打开 2019-05-20 15:57:52 +08:00
段冬梅
328f266046 Update README.md 2019-05-20 15:48:57 +08:00
duandongmei
a9a15f4c0a 610上线内容回复UPDATE_ACTION 2019-05-20 15:46:21 +08:00
duandongmei
025873ce76 综合服务修改接口未上线前,修改恢复为INSERT_ACTION动作 2019-05-19 11:23:22 +08:00
duandongmei
28771355cc http client增加错误信息打印 2019-05-17 15:30:18 +08:00
duandongmei
0629e8b1de 修改HTTP client的超时时间为500秒 2019-05-17 15:28:59 +08:00
duandongmei
8d7a6c69b6 流媒体协议修改权限标识 2019-05-17 09:45:22 +08:00
wangxin
fe3f632046 IP范围的起始IP必须小于终止IP验证修复 2019-05-15 11:26:54 +08:00
duandongmei
9527b41592 样例文件界面,当level非空时,也需根据动作来隐藏和打开level属性 2019-05-15 09:46:24 +08:00
李皓宸
6312a65351 修改 导入时源IP/目的IP为默认值时提示语 2019-05-14 19:25:58 +08:00
李皓宸
f6c37c7bda 修改 导入时源IP/目的IP为默认值时的提示语 2019-05-14 18:39:40 +08:00
李皓宸
c81dd92aca 修复 导入时只有源IP或目的IP的配置 不能为0.0.0.0
同时有源IP和目的IP两个IP不能一样,仅有一个可为0.0.0.0
2019-05-14 16:57:13 +08:00
李皓宸
9f4264d878 1.修改 导入时只有源IP或目的IP的配置 不能为0.0.0.0
同时有源IP和目的IP两个IP不能一样,仅有一个可为0.0.0.0
2.修复 新增功能和导入功能的IP校验不一致问题
2019-05-13 19:24:07 +08:00
duandongmei
d4e153533a APP相关模块统一使用appCode作为检索条件 2019-05-13 19:10:21 +08:00
李皓宸
35ca1636ef 导出功能IP Spoofing Spoofing内容显示不一致 2019-05-13 14:50:15 +08:00
duandongmei
44486b98cb APP特征模块增加app非空判断 2019-05-13 10:32:42 +08:00
duandongmei
ea456f83d0 HTTPS重定向,导入增加httpsURL提示;
解决批量删除会删除审核未通过的配置BUG
2019-05-10 18:31:27 +08:00
李皓宸
b4f9eac0d3 删除通过或未通过配置时 删除提示更改为"只能删除未审核的配置与取消审核通过的配置" 2019-05-10 16:47:05 +08:00
李皓宸
54333afe0b 修复新增、导入按钮class属性 2019-05-10 15:57:56 +08:00
李皓宸
48806bd775 解决配置导入时 目的端口未能正确校验 2019-05-10 15:01:31 +08:00
duandongmei
23ae0f08d3 批量增加isValid和isAudit检索条件 2019-05-09 17:31:40 +08:00
duandongmei
21ca3bc804 定时任务daily的过期时间调整 2019-05-09 17:26:13 +08:00
李皓宸
d9110dfa14 业务配置->流 和 日志检索->流内的模块 "阻断"显示更改为"封堵(丢弃)" 2019-05-09 16:36:06 +08:00
duandongmei
fd2d285b92 批量操作条件取反 2019-05-09 11:25:00 +08:00
duandongmei
8a27636007 批量操作增加限制条件 2019-05-09 09:52:54 +08:00
zhangwenqing
89336a3677 未审核与取消的配置可批量删除. 2019-05-08 18:23:34 +08:00
wangxin
144900d6df 拦截策略列表doLog列注释 2019-05-08 15:35:49 +08:00
李皓宸
ba758cab58 修改中文国际化文件中部分英文翻译 2019-05-08 11:27:21 +08:00
wangwei
10fb06f5bf 修改blacklist国际化配置 2019-05-08 10:42:43 +08:00
wangwei
dd37178cfc 修复ip地址监测blacklist显示bug 2019-05-08 10:29:36 +08:00
wangwei
46fff54557 删除多余新增按钮的class属性 2019-05-07 15:26:44 +08:00
李皓宸
f1fc6ee9aa VOIP业务配置审核通过,没有审核人的问题解决 2019-05-07 14:51:30 +08:00
wangwei
dde951fe4a 所有新增、导入按钮分别增加class属性 2019-05-07 14:02:06 +08:00
李皓宸
33fd4df21d 1.菜单中的中文语言下,部分菜单不是中文的问题解决
2.VOIP业务审核通过,没有审核时间的问题解决
2019-05-07 13:52:44 +08:00
zhangwenqing
1882d011cb 清空配置并失效所有定时任务 2019-05-07 10:41:17 +08:00
duandongmei
cd977ed81a 此版本暂时隐藏生效状态可修改的功能 2019-05-07 09:42:59 +08:00
wangxin
e8a5c506e9 修改IPV6错误提示 2019-05-06 18:51:05 +08:00
zhangwenqing
f8e1b8f093 清空配置功能增加调用相应服务接口步骤 2019-05-06 16:28:37 +08:00
wangwei
c30ab53f00 修复网页关键字定时器界面显示不完整BUG 2019-05-06 14:09:35 +08:00
wangwei
ea33bae40f ASN IP配置重置按钮重置不全BUG 2019-05-06 13:55:07 +08:00
wangwei
d1082f539e 修复网页关键字定时器界面显示不完整BUG 2019-05-06 13:52:05 +08:00
duandongmei
c1188539b5 SSL配置取消失败BUG; 2019-05-06 10:13:15 +08:00
wangwei
269f4e0644 更新俄文国际化配置文件 2019-05-05 19:46:39 +08:00
duandongmei
3f6d6a6d60 中文、俄文国际化缺失补充
Conflicts:
	src/main/resources/messages/message_zh_CN.properties
2019-05-05 11:57:41 +08:00
duandongmei
00ffdd863c 恢复之前的定时任务配置取消不走综合服务的问题;
去掉英文国际化的合并记录

Conflicts:
	src/main/resources/messages/message_en.properties
2019-05-05 11:56:04 +08:00
duandongmei
1eaa2e668b 经确认,定时任务配置失效可直接使用配置正常的失效接口。
Conflicts:
	src/main/java/com/nis/util/SchedulerTaskUtil.java
2019-05-05 10:14:17 +08:00
段冬梅
86c2d86565 schedual use startStopService 2019-05-03 15:58:50 +08:00
duandongmei
35e491e20c 代理的拦截和控制策略配置取消增加配置状态判断 2019-05-03 10:27:21 +08:00
duandongmei
ce8c273aa4 代理最新帮助文档sql及帮助文档md文件提交 2019-05-03 10:22:48 +08:00
duandongmei
d00a855666 审核角色自动添加审核菜单;
审核角色禁止修改角色名称
2019-04-30 11:35:13 +08:00
wangwei
2b57e33d12 添加零时表单的移除 2019-04-29 18:18:46 +08:00
wangxin
fa9edae028 优化galaxyMessageFormat中的json解析速度,使用fastjson替换JSONObject 2019-04-29 17:39:55 +08:00
wangxin
d4ee7c7a42 优化导出速度 2019-04-29 10:37:38 +08:00
段冬梅
eac5552be2 IP spoofing pool定时任务修改时只改is_valid状态,is_audit默认为1 2019-04-29 09:51:41 +08:00
wangwei
18c5567f58 修复Anti DDOS修改定时任务选项展示 2019-04-29 08:53:32 +08:00
wangwei
b0a9982d54 修正抗ddos攻击修改时多余提示信息 2019-04-28 15:11:41 +08:00
段冬梅
8e724393e1 恢复ip和代理模块审核方法中二次查询域信息代码,避免同一种域允许新增多个的问题 2019-04-28 12:03:16 +08:00
zhangwenqing
494fb0669a 修正saveAndAudit角色用户新增SSL配置失败bug 2019-04-28 11:44:51 +08:00
duandongmei
36d1fee141 证书验证公私钥不匹配 2019-04-27 19:00:12 +08:00
shangguanyanfei
999406cbd1 定时器公共页面-长期选项,增加开始时间不能小于当前时间加上2分钟的验证 2019-04-26 18:02:22 +08:00
李皓宸
4107e0fb92 修复系统日志中异常日志显示不全的问题 2019-04-26 17:35:40 +08:00
wangwei
efd965f4ca Merge branch 'develop_no_common_group' of git@git.mesalab.cn:K18_NTCS_WEB/NTC.git into develop_no_common_group 2019-04-26 17:20:07 +08:00
wangwei
6eecad82aa 修改配置导出文件名乱码问题 2019-04-26 17:19:45 +08:00
duandongmei
ab8c4448ce IP Spoofing增加定时任务ipPool状态变更BUG更改;
IP Spoofing取消状态的配置修改,ippool状态更改
2019-04-26 16:57:10 +08:00
duandongmei
9ade865187 ddos定时任务修改 2019-04-26 15:50:05 +08:00
shangguanyanfei
2aa3524104 报表统计-事件报表-时间查询条件范围更改为一个月 2019-04-26 14:57:54 +08:00
wangwei
35a1b72fee 修复IP Spoofing失效下发至服务端 2019-04-25 21:30:30 +08:00
shangguanyanfei
724eeef0f5 音频样例配置下发,源文件时长不能超过120s的错误信息提示 2019-04-25 17:29:31 +08:00
duandongmei
65d3f5013f Merge branch 'develop_no_common_group' of https://git.mesalab.cn/K18_NTCS_WEB/NTC.git into develop_no_common_group 2019-04-25 15:18:43 +08:00
shangguanyanfei
b50d324303 监测、统计时间查询条件范围更改为一个月,通联日志为一天 2019-04-25 15:18:09 +08:00
李皓宸
26097409d6 捕捉异常后增加记录异常日志的操作 2019-04-25 14:42:41 +08:00
wangwei
6223c66618 修复 IP Spoofing定时任务配置相关表数据状态不同步 2019-04-25 10:26:44 +08:00
wangwei
0499fb845d 取消视频添加阻默认阻断动作下置信度显示 2019-04-25 10:16:30 +08:00
李皓宸
30007d50d0 1.业务配置 packet和Stream中文国际化翻译为(包、流)
2.业务配置 Stream里的Protocol Identify中文国际化翻译为(基础协议)
3.业务配置 高级功能->APP特征 部分菜单翻译为中文  增加了一个app_ip_correlation(APP关联特征IP配置)国际化代码
2019-04-24 19:02:21 +08:00
李皓宸
1221ce6a18 Merge branch 'develop_no_common_group' of https://git.mesalab.cn/K18_NTCS_WEB/NTC.git into develop_no_common_group 2019-04-24 18:09:19 +08:00
李皓宸
b9246ddeeb 实时报表->流量统计->(协议,App,活跃IP,流量,服务,网站)国际化代码修改 2019-04-24 17:56:57 +08:00
zhangwenqing
eda0103068 修正回调类配置批量取消失败问题 2019-04-24 17:19:23 +08:00
段冬梅
589cf100ee 俄文OK翻译;
定时任务错误信息打印;
恢复白名单被覆盖的logger.error;
2019-04-24 16:01:40 +08:00
wangxin
3b838aa838 (1)修正ConfigConvertUtil中的ipConvert方法
(2)Packet IP Address修正IP,ASN同时隐藏可以提交表单的bug
2019-04-24 14:04:10 +08:00
wangwei
b3abe1f0e5 修正导出逻辑判断关键词 2019-04-24 10:05:02 +08:00
段冬梅
0b1a51aa47 修复加密隧道协议不显示定时任务图标BUG;
修复批量之后无法查询所有状态数据bug
2019-04-24 09:54:50 +08:00
wangwei
40e166510c 修正导出条件逻辑判断 2019-04-23 19:00:07 +08:00
李皓宸
47771e57e7 撤销国际化的修改 2019-04-23 18:31:52 +08:00
李皓宸
94f0bc56b8 1.添加了部分菜单的中英文国际化
2.业务配置的流媒体审核异常已解决
2019-04-23 18:05:00 +08:00
wangwei
0cf19aeab9 修改文件导出改为post传参;修复拦截修复策略必选属性为空不提示问题 2019-04-23 16:45:09 +08:00
wangwei
078b1a0071 删除测试代码 2019-04-22 20:16:20 +08:00
zhangwenqing
728201cfbe 修正(saveAndAudit)角色用户新增配置出现保护名单提示后无法提交bug 2019-04-22 18:47:06 +08:00
wangwei
8719ed0527 修改导出遮罩层显示时间:处理完成时关闭 2019-04-22 18:39:30 +08:00
wangxin
77716a9517 补充修改,sql后加分号 2019-04-22 17:48:25 +08:00
wangxin
5e9400e723 修正port_port_cfg的错误sql 2019-04-22 17:43:37 +08:00
zhangwenqing
541aaf4640 补充提交. 2019-04-22 17:35:24 +08:00
zhangwenqing
f773c95c0b IPSpoofing配置批量审核操作增加欺骗IP池配置处理,修正图片样例批量审核功能 2019-04-22 17:23:03 +08:00
wangxin
77c7649b6a 精简项目配置文件,删除Constants。java中没有再使用的参数 2019-04-22 11:40:59 +08:00
wangxin
e8dd565262 Merge branch 'develop_no_common_group' of https://git.mesalab.cn/K18_NTCS_WEB/NTC.git into develop_no_common_group 2019-04-22 11:13:45 +08:00
wangxin
fe90fd9935 (1)删除调用switchIpType方法的页面相关代码
(2)Stream列表页面展示表单Block,ratelimt有定时任务没有IP时的错位问题
2019-04-22 11:13:26 +08:00
段冬梅
827a43d843 打开配置热修改功能 2019-04-22 10:41:04 +08:00
wangxin
34a6cb5ed4 添加谓语 2019-04-22 10:02:09 +08:00
wangxin
42724b94de 调整定时任务开始时间比当前时间至少早两分钟翻译 2019-04-22 09:41:12 +08:00
duandongmei
97d1a52d3c 修复ddos定时任务界面BUG;
修复基础协议定时任务图标不显示bug;
所有业务增加定时任务逻辑
2019-04-21 19:02:33 +08:00
duandongmei
28f07f00f2 白名单增加定时任务处理;
修复白名单热修改被覆盖jsp
2019-04-21 13:15:29 +08:00
段冬梅
c716cb1fc3 白名单增加各个操作的定时任务处理;
各种批量操作增加定时任务的处理;
2019-04-19 18:35:20 +08:00
段冬梅
1191db5fbe Merge branch 'develop_no_common_group' of https://git.mesalab.cn/K18_NTCS_WEB/NTC.git into develop_no_common_group 2019-04-19 18:33:01 +08:00
段冬梅
5b63b0237e 白名单增加各个操作的定时任务处理
各种批量操作增加定时任务的处理
2019-04-19 18:32:46 +08:00
zhangwenqing
99c3c8c84f 修正保护名单配置回车不提示、重复数据问题 2019-04-19 17:44:12 +08:00
shangguanyanfei
865811b9b2 stream、DDOS和高级功能模块对某些用户的配置不经过审核直接生效及生效中的配置进行修改的功能 2019-04-19 17:20:32 +08:00
wangxin
5a5bdddba4 (1)IP Pattern拆分为源IP Pattern,目的IP Pattern,Port Pattern
拆分为源端口Pattern,目的端口Pattern
(2)show more修改,并移动刀ipRegion.js中
(3)IP复用未作修改
(4)删除部分废弃的导入模板以及废弃的导入方法
2019-04-18 10:15:23 +08:00
400 changed files with 17802 additions and 7084 deletions

View File

@@ -1 +1 @@
在公共分组功能逻辑完善之前此分支为ntc界面系统的全集上线升级分支合并版。
NTC通用分支

View File

@@ -727,6 +727,10 @@
<artifactId>druid</artifactId>
<version>1.1.10</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.57</version>
</dependency>
</dependencies>
</project>

View File

@@ -14,6 +14,7 @@ public class ScheduleCfg extends BaseCfg<ScheduleCfg>{
private String cronValid;//生效cron表达式
private String cronInvalid;//失效cron表达式
private String whereStr;//动态where 条件
private int delFlag;
private int type;
public String getName() {
return name;
@@ -45,5 +46,11 @@ public class ScheduleCfg extends BaseCfg<ScheduleCfg>{
public void setType(int type) {
this.type = type;
}
public int getDelFlag() {
return delFlag;
}
public void setDelFlag(int delFlag) {
this.delFlag = delFlag;
}
}

View File

@@ -20,12 +20,14 @@ public class AsnIpCfg extends BaseCfg<AsnIpCfg> {
@ExcelField(title="ip_type",dictType="IP_TYPE",sort=6)
@SerializedName("ipType")
private Integer ipType;
@ExcelField(title="ip_pattern",dictType="IP_PATTERN",sort=8)
private Integer ipPattern;
private Integer srcIpPattern;
@ExcelField(title="dest_ip_pattern",dictType="IP_PATTERN",sort=8)
private Integer destIpPattern;
private String srcIpAddress;
@ExcelField(title="ip",sort=7)
private String destIpAddress;
private Integer portPattern;
private Integer srcPortPattern;
private Integer destPortPattern;
private String srcPort;
private String destPort;
//@ExcelField(title="group",sort=2)
@@ -117,11 +119,30 @@ public class AsnIpCfg extends BaseCfg<AsnIpCfg> {
public void setIpType(Integer ipType) {
this.ipType = ipType;
}
public Integer getIpPattern() {
return ipPattern;
public Integer getSrcIpPattern() {
return srcIpPattern;
}
public void setIpPattern(Integer ipPattern) {
this.ipPattern = ipPattern;
public void setSrcIpPattern(Integer srcIpPattern) {
this.srcIpPattern = srcIpPattern;
}
public Integer getDestIpPattern() {
return destIpPattern;
}
public void setDestIpPattern(Integer destIpPattern) {
this.destIpPattern = destIpPattern;
}
public Integer getSrcPortPattern() {
return srcPortPattern;
}
public void setSrcPortPattern(Integer srcPortPattern) {
this.srcPortPattern = srcPortPattern;
}
public Integer getDestPortPattern() {
return destPortPattern;
}
public void setDestPortPattern(Integer destPortPattern) {
this.destPortPattern = destPortPattern;
}
public String getSrcIpAddress() {
return srcIpAddress;
@@ -135,12 +156,6 @@ public class AsnIpCfg extends BaseCfg<AsnIpCfg> {
public void setDestIpAddress(String destIpAddress) {
this.destIpAddress = destIpAddress;
}
public Integer getPortPattern() {
return portPattern;
}
public void setPortPattern(Integer portPattern) {
this.portPattern = portPattern;
}
public String getSrcPort() {
return srcPort;
}
@@ -176,9 +191,10 @@ public class AsnIpCfg extends BaseCfg<AsnIpCfg> {
}
@Override
public String toString() {
return "AsnIpCfg [regionId=" + regionId + ", ratelimit=" + ratelimit + ", ipType=" + ipType + ", ipPattern="
+ ipPattern + ", srcIpAddress=" + srcIpAddress + ", destIpAddress=" + destIpAddress + ", portPattern="
+ portPattern + ", srcPort=" + srcPort + ", destPort=" + destPort + ", asnIpGroupName=" + asnIpGroupName
return "AsnIpCfg [regionId=" + regionId + ", ratelimit=" + ratelimit + ", ipType=" + ipType + ", srcIpPattern="
+ srcIpPattern + ", destIpPattern="+ destIpPattern+ ", srcIpAddress=" + srcIpAddress + ", destIpAddress="
+ destIpAddress + ", srcPortPattern="+ srcPortPattern+", destPortPattern="+ destPortPattern + ", srcPort="
+ srcPort + ", destPort=" + destPort + ", asnIpGroupName=" + asnIpGroupName
+ ", asnIpGroup=" + asnIpGroup + ", direction=" + direction + ", protocol=" + protocol + ", protocolId="
+ protocolId + ", compileId=" + compileId + ", isValid=" + isValid + ", userRegion1=" + userRegion1
+ ", userRegion2=" + userRegion2 + ", userRegion3=" + userRegion3 + ", userRegion4=" + userRegion4

View File

@@ -1,8 +1,6 @@
package com.nis.domain.configuration;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.nis.util.excel.ExcelField;
@@ -34,11 +32,13 @@ public class AppIpCfg extends BaseCfg<AppIpCfg> {
@ExcelField(title="ip_type",dictType="IP_TYPE",sort=3)
@SerializedName("ipType")
protected Integer ipType;
protected Integer ipPattern;
protected Integer srcIpPattern;
protected Integer destIpPattern;
protected String srcIpAddress;
@ExcelField(title="server_ip",sort=4)
protected String destIpAddress;
protected Integer portPattern;
protected Integer srcPortPattern;
protected Integer destPortPattern;
protected String srcPort;
@ExcelField(title="server_port",sort=5)
protected String destPort;
@@ -121,34 +121,7 @@ public class AppIpCfg extends BaseCfg<AppIpCfg> {
// this.protocolId = protocolId;
// }
/**
* ipPattern
* @return ipPattern
*/
public Integer getIpPattern() {
return ipPattern;
}
/**
* @param ipPattern the ipPattern to set
*/
public void setIpPattern(Integer ipPattern) {
this.ipPattern = ipPattern;
}
/**
* portPattern
* @return portPattern
*/
public Integer getPortPattern() {
return portPattern;
}
/**
* @param portPattern the portPattern to set
*/
public void setPortPattern(Integer portPattern) {
this.portPattern = portPattern;
}
/**
* srcIpAddress
@@ -158,6 +131,30 @@ public class AppIpCfg extends BaseCfg<AppIpCfg> {
public String getSrcIpAddress() {
return srcIpAddress;
}
public Integer getSrcIpPattern() {
return srcIpPattern;
}
public void setSrcIpPattern(Integer srcIpPattern) {
this.srcIpPattern = srcIpPattern;
}
public Integer getDestIpPattern() {
return destIpPattern;
}
public void setDestIpPattern(Integer destIpPattern) {
this.destIpPattern = destIpPattern;
}
public Integer getSrcPortPattern() {
return srcPortPattern;
}
public void setSrcPortPattern(Integer srcPortPattern) {
this.srcPortPattern = srcPortPattern;
}
public Integer getDestPortPattern() {
return destPortPattern;
}
public void setDestPortPattern(Integer destPortPattern) {
this.destPortPattern = destPortPattern;
}
/**
* @param srcIpAddress the srcIpAddress to set
*/
@@ -257,16 +254,10 @@ public class AppIpCfg extends BaseCfg<AppIpCfg> {
public String toString() {
return "AppIpCfg [compileId=" + compileId + ", ratelimit=" + ratelimit + ", appCode=" + appCode + ", behavCode="
+ behavCode + ", specServiceId=" + specServiceId + ", appName=" + appName + ", ipType=" + ipType
+ ", ipPattern=" + ipPattern + ", srcIpAddress=" + srcIpAddress + ", destIpAddress=" + destIpAddress
+ ", portPattern=" + portPattern + ", srcPort=" + srcPort + ", destPort=" + destPort + ", direction="
+ direction + ", protocol=" + protocol + ", userRegion1=" + userRegion1 + ", userRegion2=" + userRegion2
+ ", userRegion3=" + userRegion3 + ", userRegion4=" + userRegion4 + ", userRegion5=" + userRegion5
+ ", cfgId=" + cfgId + ", cfgDesc=" + cfgDesc + ", action=" + action + ", isValid=" + isValid
+ ", isAudit=" + isAudit + ", creatorId=" + creatorId + ", createTime=" + createTime + ", editorId="
+ editorId + ", editTime=" + editTime + ", auditorId=" + auditorId + ", auditTime=" + auditTime
+ ", serviceId=" + serviceId + ", requestId=" + requestId + ", cancelRequestId=" + cancelRequestId
+ ", isAreaEffective=" + isAreaEffective + ", classify=" + classify + ", attribute=" + attribute
+ ", lable=" + lable + ", areaEffectiveIds=" + areaEffectiveIds + ", cfgRegionCode=" + cfgRegionCode
+ ", cfgType=" + cfgType + ", functionId=" + functionId + ", doLog=" + doLog + "]";
+ ", srcIpPattern=" + srcIpPattern + ", destIpPattern=" + destIpPattern + ", srcIpAddress="
+ srcIpAddress + ", destIpAddress=" + destIpAddress + ", srcPortPattern=" + srcPortPattern
+ ", destPortPattern=" + destPortPattern + ", srcPort=" + srcPort + ", destPort=" + destPort
+ ", direction=" + direction + ", protocol=" + protocol + "]";
}
}

View File

@@ -59,7 +59,8 @@ public class AreaIpCfg extends BaseIpCfg {
this.cfgType=Constants.AREA_REGION;
this.cfgRegionCode=1;
this.protocol=0;
this.portPattern=1;
this.srcPortPattern=1;
this.destPortPattern=1;
this.srcPort="0";
this.destPort="0";
this.direction=0;

View File

@@ -63,6 +63,10 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
protected String hColumns;//导出隐藏列
protected String compileIdNew;// 查询 配置ID 范围
//批量操作时记录isAudit和isValid检索条件
protected String batchAuditValue;
protected String batchValidValue;
/**
* 定时任务信息
@@ -1004,6 +1008,17 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
public void setSchedule(ScheduleCfg schedule) {
this.schedule = schedule;
}
public String getBatchAuditValue() {
return batchAuditValue;
}
public String getBatchValidValue() {
return batchValidValue;
}
public void setBatchAuditValue(String batchAuditValue) {
this.batchAuditValue = batchAuditValue;
}
public void setBatchValidValue(String batchValidValue) {
this.batchValidValue = batchValidValue;
}
}

View File

@@ -45,14 +45,18 @@ public class BaseIpCfg extends BaseCfg<BaseIpCfg> {
@SerializedName("ipType")
@ExcelField(title="ip_type",dictType="IP_TYPE",sort=50)
protected Integer ipType;
@ExcelField(title="ip_pattern",dictType="IP_PATTERN",sort=51)
protected Integer ipPattern;
@ExcelField(title="client_ip",sort=53)
@ExcelField(title="src_ip_pattern",dictType="IP_PATTERN",sort=51)
protected Integer srcIpPattern;
@ExcelField(title="client_ip",sort=52)
protected String srcIpAddress;
@ExcelField(title="server_ip",sort=52)
@ExcelField(title="dest_ip_pattern",dictType="IP_PATTERN",sort=53)
protected Integer destIpPattern;
@ExcelField(title="server_ip",sort=54)
protected String destIpAddress;
@ExcelField(title="port_pattern",dictType="PORT_PATTERN",sort=54)
protected Integer portPattern;
@ExcelField(title="src_port_pattern",dictType="PORT_PATTERN",sort=54)
protected Integer srcPortPattern;
@ExcelField(title="dest_port_pattern",dictType="PORT_PATTERN",sort=54)
protected Integer destPortPattern;
@ExcelField(title="client_port",sort=55)
protected String srcPort;
@ExcelField(title="server_port",sort=56)
@@ -269,35 +273,31 @@ public class BaseIpCfg extends BaseCfg<BaseIpCfg> {
this.protocolId = protocolId;
}
/**
* ipPattern
* @return ipPattern
*/
public Integer getIpPattern() {
return ipPattern;
public Integer getSrcIpPattern() {
return srcIpPattern;
}
/**
* @param ipPattern the ipPattern to set
*/
public void setIpPattern(Integer ipPattern) {
this.ipPattern = ipPattern;
public void setSrcIpPattern(Integer srcIpPattern) {
this.srcIpPattern = srcIpPattern;
}
/**
* portPattern
* @return portPattern
*/
public Integer getPortPattern() {
return portPattern;
public Integer getDestIpPattern() {
return destIpPattern;
}
/**
* @param portPattern the portPattern to set
*/
public void setPortPattern(Integer portPattern) {
this.portPattern = portPattern;
public void setDestIpPattern(Integer destIpPattern) {
this.destIpPattern = destIpPattern;
}
public Integer getSrcPortPattern() {
return srcPortPattern;
}
public void setSrcPortPattern(Integer srcPortPattern) {
this.srcPortPattern = srcPortPattern;
}
public Integer getDestPortPattern() {
return destPortPattern;
}
public void setDestPortPattern(Integer destPortPattern) {
this.destPortPattern = destPortPattern;
}
/**
* srcIpAddress
* @return srcIpAddress

View File

@@ -1,31 +0,0 @@
package com.nis.domain.configuration.template;
/**
* wx 将部分字段的标题改变,或者不需要的字段隐藏
* 隐藏方法对于不需要的字段或者方法Override该字段方法但是@ExcelField注解不需要加上了
* @author dell
*
*/
@Deprecated
public class IpAddrTemplate extends IpCfgTemplate {
@Override
public Integer getIrType() {
// TODO Auto-generated method stub
return super.getIrType();
}
@Override
public Integer getDnsStrategyId() {
// TODO Auto-generated method stub
return super.getDnsStrategyId();
}
@Override
public String getRatelimit() {
// TODO Auto-generated method stub
return super.getRatelimit();
}
}

View File

@@ -8,7 +8,6 @@
*/
package com.nis.domain.configuration.template;
import com.google.gson.JsonObject;
import com.nis.util.excel.ExcelField;
/**

View File

@@ -1,310 +0,0 @@
/**
*@Title: BaseStringConfig.java
*@Package com.nis.domain.restful
*@Description TODO
*@author dell
*@date 2018年2月5日 下午5:26:02
*@version 版本号
*/
package com.nis.domain.configuration.template;
import com.nis.util.excel.ExcelField;
/**
* @Description: excel导入IP类配置
*/
@Deprecated
public class IpCfgTemplate {
/**
* @Fields serialVersionUID:TODO用一句话描述这个变量表示什么
*
* @since 1.0.0
*/
private Long cfgId;
private Integer ipType;//1
private Integer ipPattern;//2
private String srcIpAddress; //3
private String destIpAddress; //4
private Integer portPattern; //5
private String srcPort; //6
private String destPort;//7
private Integer protocol;//8
protected Integer direction;//9
private String cfgDesc;//10
private Integer requestId;//11
private String requestName;//12
private Integer isAreaEffective;//13
private String classify;//14
private String attribute;//15
private String lable;//16
private String classifyName;//17
private String attributeName;//18
private String lableName;//19
private String areaEffectiveIds;//20
private String ratelimit;//21
private Integer dnsStrategyId;//22
private Integer irType;//23
private String userRegion1;//77
private String userRegion2;//78
private String userRegion3;//79
private String userRegion4;//80
private String userRegion5;//81
/**
* userRegion1
* @return userRegion1
*/
// @ExcelField(title="userregion1",align=2,sort=77)
public String getUserRegion1() {
return userRegion1;
}
/**
* @param userRegion1 the userRegion1 to set
*/
public void setUserRegion1(String userRegion1) {
this.userRegion1 = userRegion1;
}
/**
* userRegion2
* @return userRegion2
*/
// @ExcelField(title="userregion2",align=2,sort=78)
public String getUserRegion2() {
return userRegion2;
}
/**
* @param userRegion2 the userRegion2 to set
*/
public void setUserRegion2(String userRegion2) {
this.userRegion2 = userRegion2;
}
/**
* userRegion3
* @return userRegion3
*/
// @ExcelField(title="userregion3",align=2,sort=79)
public String getUserRegion3() {
return userRegion3;
}
/**
* @param userRegion3 the userRegion3 to set
*/
public void setUserRegion3(String userRegion3) {
this.userRegion3 = userRegion3;
}
/**
* userRegion4
* @return userRegion4
*/
// @ExcelField(title="userregion4",align=2,sort=80)
public String getUserRegion4() {
return userRegion4;
}
/**
* @param userRegion4 the userRegion4 to set
*/
public void setUserRegion4(String userRegion4) {
this.userRegion4 = userRegion4;
}
/**
* userRegion5
* @return userRegion5
*/
// @ExcelField(title="userregion5",align=2,sort=81)
public String getUserRegion5() {
return userRegion5;
}
/**
* @param userRegion5 the userRegion5 to set
*/
public void setUserRegion5(String userRegion5) {
this.userRegion5 = userRegion5;
}
/**
* ratelimit
* @return ratelimit
*/
@ExcelField(title="ratelimit",align=2,sort=74)
public String getRatelimit() {
return ratelimit;
}
/**
* @param ratelimit the ratelimit to set
*/
public void setRatelimit(String ratelimit) {
this.ratelimit = ratelimit;
}
/**
* irType
* @return irType
*/
@ExcelField(title="ir_type",align=2,sort=76)
public Integer getIrType() {
return irType;
}
/**
* @param irType the irType to set
*/
public void setIrType(Integer irType) {
this.irType = irType;
}
/**
* dnsStrategyId
* @return dnsStrategyId
*/
@ExcelField(title="dns_strategy_id",align=2,sort=75)
public Integer getDnsStrategyId() {
return dnsStrategyId;
}
/**
* @param dnsStrategyId the dnsStrategyId to set
*/
public void setDnsStrategyId(Integer dnsStrategyId) {
this.dnsStrategyId = dnsStrategyId;
}
@ExcelField(title="ip_type",align=2,sort=1)
public Integer getIpType() {
return ipType;
}
public void setIpType(Integer ipType) {
this.ipType = ipType;
}
@ExcelField(title="ip_pattern",align=2,sort=2)
public Integer getIpPattern() {
return ipPattern;
}
public void setIpPattern(Integer ipPattern) {
this.ipPattern = ipPattern;
}
@ExcelField(title="client_ip",align=2,sort=3)
public String getSrcIpAddress() {
return srcIpAddress;
}
public void setSrcIpAddress(String srcIpAddress) {
this.srcIpAddress = srcIpAddress;
}
@ExcelField(title="server_ip",align=2,sort=4)
public String getDestIpAddress() {
return destIpAddress;
}
public void setDestIpAddress(String destIpAddress) {
this.destIpAddress = destIpAddress;
}
@ExcelField(title="port_pattern",align=2,sort=5)
public Integer getPortPattern() {
return portPattern;
}
public void setPortPattern(Integer portPattern) {
this.portPattern = portPattern;
}
@ExcelField(title="client_port",align=2,sort=6)
public String getSrcPort() {
return srcPort;
}
public void setSrcPort(String srcPort) {
this.srcPort = srcPort;
}
@ExcelField(title="server_port",align=2,sort=7)
public String getDestPort() {
return destPort;
}
public void setDestPort(String destPort) {
this.destPort = destPort;
}
public Long getCfgId() {
return cfgId;
}
public void setCfgId(Long cfgId) {
this.cfgId = cfgId;
}
@ExcelField(title="direction",align=2,sort=8)
public Integer getDirection() {
return direction;
}
public void setDirection(Integer direction) {
this.direction = direction;
}
@ExcelField(title="config_describe",align=2,sort=11)
public String getCfgDesc() {
return cfgDesc;
}
public void setCfgDesc(String cfgDesc) {
this.cfgDesc = cfgDesc;
}
@ExcelField(title="letter",align=2,sort=13)
public Integer getRequestId() {
return requestId;
}
public void setRequestId(Integer requestId) {
this.requestId = requestId;
}
public String getRequestName() {
return requestName;
}
public void setRequestName(String requestName) {
this.requestName = requestName;
}
public Integer getIsAreaEffective() {
return isAreaEffective;
}
public void setIsAreaEffective(Integer isAreaEffective) {
this.isAreaEffective = isAreaEffective;
}
@ExcelField(title="classification",align=2,sort=71)
public String getClassify() {
return classify;
}
public void setClassify(String classify) {
this.classify = classify;
}
@ExcelField(title="attribute",align=2,sort=72)
public String getAttribute() {
return attribute;
}
public void setAttribute(String attribute) {
this.attribute = attribute;
}
@ExcelField(title="label",align=2,sort=73)
public String getLable() {
return lable;
}
public void setLable(String lable) {
this.lable = lable;
}
public String getClassifyName() {
return classifyName;
}
public void setClassifyName(String classifyName) {
this.classifyName = classifyName;
}
public String getAttributeName() {
return attributeName;
}
public void setAttributeName(String attributeName) {
this.attributeName = attributeName;
}
public String getLableName() {
return lableName;
}
public void setLableName(String lableName) {
this.lableName = lableName;
}
// @ExcelField(title="area_effective",align=2,sort=70)
public String getAreaEffectiveIds() {
return areaEffectiveIds;
}
public void setAreaEffectiveIds(String areaEffectiveIds) {
this.areaEffectiveIds = areaEffectiveIds;
}
@ExcelField(title="protocol",align=2,sort=9)
public Integer getProtocol() {
return protocol;
}
public void setProtocol(Integer protocol) {
this.protocol = protocol;
}
}

View File

@@ -1,47 +0,0 @@
package com.nis.domain.configuration.template;
import com.nis.util.excel.ExcelField;
/**
* wx 将部分字段的标题改变,或者不需要的字段隐藏
* 隐藏方法对于不需要的字段或者方法Override该字段方法但是@ExcelField注解不需要加上了
* @author dell
*
*/
@Deprecated
public class IpMultiplexPolicyTemplate extends IpCfgTemplate {
@Override
@ExcelField(title="IP",align=2,sort=3)
public String getSrcIpAddress() {
return super.getSrcIpAddress();
}
@ExcelField(title="port",align=2,sort=6)
@Override
public String getSrcPort() {
// TODO Auto-generated method stub
return super.getSrcPort();
}
@Override
@ExcelField(title="group_name",align=2,sort=75)
public Integer getDnsStrategyId() {
// TODO Auto-generated method stub
return super.getDnsStrategyId();
}
@Override
public String getRatelimit() {
// TODO Auto-generated method stub
return super.getRatelimit();
}
@Override
public String getDestPort() {
// TODO Auto-generated method stub
return super.getDestPort();
}
@Override
public String getDestIpAddress() {
// TODO Auto-generated method stub
return super.getDestIpAddress();
}
}

View File

@@ -1,31 +0,0 @@
package com.nis.domain.configuration.template;
/**
* wx 将部分字段的标题改变,或者不需要的字段隐藏
* 隐藏方法对于不需要的字段或者方法Override该字段方法但是@ExcelField注解不需要加上了
* @author dell
*
*/
@Deprecated
public class IpsecTemplate extends IpCfgTemplate {
@Override
public Integer getIrType() {
// TODO Auto-generated method stub
return super.getIrType();
}
@Override
public Integer getDnsStrategyId() {
// TODO Auto-generated method stub
return super.getDnsStrategyId();
}
@Override
public String getRatelimit() {
// TODO Auto-generated method stub
return super.getRatelimit();
}
}

View File

@@ -1,37 +0,0 @@
package com.nis.domain.configuration.template;
/**
* wx 将部分字段的标题改变,或者不需要的字段隐藏
* 隐藏方法对于不需要的字段或者方法Override该字段方法但是@ExcelField注解不需要加上了
* @author dell
*
*/
@Deprecated
public class TunnelIpTemplate extends IpCfgTemplate {
@Override
public Integer getIrType() {
// TODO Auto-generated method stub
return super.getIrType();
}
@Override
public Integer getDnsStrategyId() {
// TODO Auto-generated method stub
return super.getDnsStrategyId();
}
@Override
public String getRatelimit() {
// TODO Auto-generated method stub
return super.getRatelimit();
}
@Override
public Integer getProtocol() {
// TODO Auto-generated method stub
return 0;
}
}

View File

@@ -1,66 +0,0 @@
package com.nis.domain.configuration.template;
/**
* wx 将部分字段的标题改变,或者不需要的字段隐藏
* 隐藏方法对于不需要的字段或者方法Override该字段方法但是@ExcelField注解不需要加上了
* @author dell
*
*/
@Deprecated
public class WhiteListIpTemplate extends IpCfgTemplate {
@Override
public Integer getDirection() {
// TODO Auto-generated method stub
return 0;
}
@Override
public Integer getProtocol() {
// TODO Auto-generated method stub
return 0;
}
@Override
public Integer getIrType() {
// TODO Auto-generated method stub
return super.getIrType();
}
@Override
public Integer getDnsStrategyId() {
// TODO Auto-generated method stub
return super.getDnsStrategyId();
}
@Override
public Integer getRequestId() {
// TODO Auto-generated method stub
return super.getRequestId();
}
@Override
public String getClassify() {
// TODO Auto-generated method stub
return super.getClassify();
}
@Override
public String getAttribute() {
// TODO Auto-generated method stub
return super.getAttribute();
}
@Override
public String getLable() {
// TODO Auto-generated method stub
return super.getLable();
}
@Override
public String getRatelimit() {
// TODO Auto-generated method stub
return super.getRatelimit();
}
}

View File

@@ -0,0 +1,160 @@
package com.nis.domain.log;
import com.nis.util.excel.ExcelField;
/**
*
*文件离线扫描结果 实体类
*
*/
public class NtcHttpObjScanResultLog extends BaseLogEntity<NtcHttpObjScanResultLog> {
private static final long serialVersionUID = -7697668215327123848L;
@ExcelField(title = "URL", sort = 8)
private String url;
@ExcelField(title = "req_hdr_key", sort = 9)
private String reqHdrKey;// 请求头转储文件key
@ExcelField(title = "req_hdr_file", sort = 10)
private String reqHdrFile;
@ExcelField(title = "req_body_key", sort = 11)
private String reqBodyKey;// 请求体转储文件key
@ExcelField(title = "req_body_file", sort = 12)
private String reqBodyFile;
@ExcelField(title = "res_hdr_key", sort = 13)
private String resHdrKey;// 应答头转储文件key
@ExcelField(title = "res_hdr_file", sort = 14)
private String resHdrFile;
@ExcelField(title = "res_body_key", sort = 15)
private String resBodyKey;// 应答体转储文件key
@ExcelField(title = "res_body_file", sort = 16)
private String resBodyFile;
@ExcelField(title = "topic_name", sort = 16)
private String topicName;//原始消息所属的topic
@ExcelField(title = "malware_id", sort = 16)
private Integer malwareId;//恶意文件命中病毒ID
@ExcelField(title = "malware_type", sort = 16)
private String malwareType;//恶意病毒类型
@ExcelField(title = "malware_name", sort = 16)
private String malwareName;//恶意病毒名称
public String getReqHdrFile() {
return reqHdrFile;
}
public void setReqHdrFile(String reqHdrFile) {
this.reqHdrFile = reqHdrFile;
}
public String getReqBodyFile() {
return reqBodyFile;
}
public void setReqBodyFile(String reqBodyFile) {
this.reqBodyFile = reqBodyFile;
}
public String getResHdrFile() {
return resHdrFile;
}
public void setResHdrFile(String resHdrFile) {
this.resHdrFile = resHdrFile;
}
public String getResBodyFile() {
return resBodyFile;
}
public void setResBodyFile(String resBodyFile) {
this.resBodyFile = resBodyFile;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getReqHdrKey() {
return reqHdrKey;
}
public void setReqHdrKey(String reqHdrKey) {
this.reqHdrKey = reqHdrKey;
}
public String getReqBodyKey() {
return reqBodyKey;
}
public void setReqBodyKey(String reqBodyKey) {
this.reqBodyKey = reqBodyKey;
}
public String getResHdrKey() {
return resHdrKey;
}
public void setResHdrKey(String resHdrKey) {
this.resHdrKey = resHdrKey;
}
public String getResBodyKey() {
return resBodyKey;
}
public void setResBodyKey(String resBodyKey) {
this.resBodyKey = resBodyKey;
}
public String getTopicName() {
return topicName;
}
public void setTopicName(String topicName) {
this.topicName = topicName;
}
public Integer getMalwareId() {
return malwareId;
}
public void setMalwareId(Integer malwareId) {
this.malwareId = malwareId;
}
public String getMalwareType() {
return malwareType;
}
public void setMalwareType(String malwareType) {
this.malwareType = malwareType;
}
public String getMalwareName() {
return malwareName;
}
public void setMalwareName(String malwareName) {
this.malwareName = malwareName;
}
}

View File

@@ -30,13 +30,15 @@ public class SpecificServiceHostCfg extends BaseEntity<SpecificServiceHostCfg>{
@Expose
private Integer protocol; //protocol 协议 int N 6表示tcp,17表示udp0表示任意
@Expose
private Integer ipPattern; //ip格式
private Integer srcIpPattern; //ip格式
private Integer destIpPattern; //ip格式
@Expose
private String srcIpAddress; //源客户端IP地址
@Expose
private String destIpAddress; //目的服务器IP地址
@Expose
private Integer portPattern; //端口格式
private Integer srcPortPattern; //端口格式
private Integer destPortPattern; //端口格式
@Expose
private String srcPort; //源(客户端)端口
@Expose
@@ -114,19 +116,33 @@ public class SpecificServiceHostCfg extends BaseEntity<SpecificServiceHostCfg>{
public void setDestPort(String destPort) {
this.destPort = destPort;
}
@ExcelField(title="ip_pattern",align=2,sort=21,fieldType=Integer.class)
public Integer getIpPattern() {
return ipPattern;
@ExcelField(title="src_ip_pattern",align=2,sort=21,fieldType=Integer.class)
public Integer getSrcIpPattern() {
return srcIpPattern;
}
public void setIpPattern(Integer ipPattern) {
this.ipPattern = ipPattern;
public void setSrcIpPattern(Integer srcIpPattern) {
this.srcIpPattern = srcIpPattern;
}
@ExcelField(title="port_pattern",align=2,sort=40,fieldType=Integer.class)
public Integer getPortPattern() {
return portPattern;
@ExcelField(title="dest_ip_pattern",align=2,sort=22,fieldType=Integer.class)
public Integer getDestIpPattern() {
return destIpPattern;
}
public void setPortPattern(Integer portPattern) {
this.portPattern = portPattern;
public void setDestIpPattern(Integer destIpPattern) {
this.destIpPattern = destIpPattern;
}
@ExcelField(title="src_port_pattern",align=2,sort=40,fieldType=Integer.class)
public Integer getSrcPortPattern() {
return srcPortPattern;
}
public void setSrcPortPattern(Integer srcPortPattern) {
this.srcPortPattern = srcPortPattern;
}
@ExcelField(title="dest_port_pattern",align=2,sort=41,fieldType=Integer.class)
public Integer getDestPortPattern() {
return destPortPattern;
}
public void setDestPortPattern(Integer destPortPattern) {
this.destPortPattern = destPortPattern;
}
@ExcelField(title="direction",align=2,sort=110)
public Integer getDirection() {

View File

@@ -82,15 +82,21 @@ public class ScheduleCfgJob implements Job {
SchedulerDao dao = SpringContextHolder.getBean(SchedulerDao.class);
JobDataMap dataMap = context.getJobDetail().getJobDataMap();
long scheduleCfgId = dataMap.get("scheduleCfgId") == null ? 0:dataMap.getLong("scheduleCfgId");
long limit = dataMap.get("limit") == null ? 1000:dataMap.getLong("limit");
long limit = dataMap.get("limit") == null ? Constants.MAAT_JSON_SEND_SIZE:dataMap.getLong("limit");
log.info(String.format("定时配置任务开始执行scheduleCfgId:%s,limit:%s",scheduleCfgId,limit ));
List<ScheduleCfg> newlyCfg = null;
List<ScheduleCfg> allNewlySche = null;
int totalNum = 0;
do {
newlyCfg = dao.findNewlyCfg(scheduleCfgId, limit,1);
if(newlyCfg != null && newlyCfg.size() > 0) {
totalNum += newlyCfg.size();
for(ScheduleCfg cfg : newlyCfg) {//先取消之前的定时配置
allNewlySche = dao.findNewlyCfg(scheduleCfgId, limit,1,1);
if(allNewlySche != null && allNewlySche.size() > 0) {
List<ScheduleCfg> allAddSche = new ArrayList<>();
totalNum += allNewlySche.size();
//先取消之前的定时配置
for(ScheduleCfg cfg : allNewlySche) {
//获取有效的任务
if(cfg.getDelFlag()==1) {
allAddSche.add(cfg);
}
Integer compileId = cfg.getCompileId();
try {
//取消之前所有的 trigger
@@ -106,7 +112,7 @@ public class ScheduleCfgJob implements Job {
log.error(String.format("定时任务取消异常compileId:%s", compileId),e);
}
}
for(ScheduleCfg cfg : newlyCfg) {
for(ScheduleCfg cfg : allAddSche) {
Integer compileId = cfg.getCompileId();
try {
//判断状态,重新添加最新的 trigger
@@ -123,12 +129,12 @@ public class ScheduleCfgJob implements Job {
}
}
//最后 保存此次 最后的id
ScheduleCfg lastCfg = newlyCfg.get(newlyCfg.size() -1);
ScheduleCfg lastCfg = allNewlySche.get(allNewlySche.size() -1);
scheduleCfgId = lastCfg.getId();
dataMap.put("scheduleCfgId", scheduleCfgId);
log.info(String.format("加载定时任务total num :%s", newlyCfg.size()));
log.info(String.format("加载定时任务total num :%s", allNewlySche.size()));
}
} while (newlyCfg != null && newlyCfg.size() > 0);
} while (allNewlySche != null && allNewlySche.size() > 0);
log.info(String.format("定时配置任务结束执行total num:%s",totalNum));
}
@@ -324,7 +330,7 @@ public class ScheduleCfgJob implements Job {
Calendar invalidCal=Calendar.getInstance();
invalidCal.setTime(invalidTime);
invalidCal.add(Calendar.MINUTE, 2);
long invalidTimes=validStartCal.getTime().getTime();
long invalidTimes=invalidCal.getTime().getTime();
long currentTimes=new Date().getTime();
//开始时间设置为今天已过时,则将开始时间加上周期
if((currentTimes-validStartTimes) > 0) {

View File

@@ -66,8 +66,15 @@ public class ScheduleStatusJob implements Job{
log.debug(String.format("任务开始执行compileId:%s,isValid:%s",compileId,isValid ));
//配置下发,并修改 配置表的状态,保存下发记录等
ScheduleService scheduleService = SpringContextHolder.getBean(ScheduleService.class);
scheduleService.issueCompileInfo(cfg, isValid?1:0);
log.debug(String.format("任务开始执行compileId:%s,isValid:%s",compileId,isValid ));
try {
scheduleService.issueCompileInfo(cfg, isValid?1:0);
} catch (Exception e) {
e.printStackTrace();
log.error("定时任务"+cfg.getId()+"执行失败",e);
}finally {
log.debug(String.format("任务执行完成compileId:%s,isValid:%s",compileId,isValid ));
}
}
}

View File

@@ -85,7 +85,7 @@ public class ScheduleSyncCfgJob implements Job {
SchedulerDao dao = SpringContextHolder.getBean(SchedulerDao.class);
JobDataMap dataMap = context.getJobDetail().getJobDataMap();
long scheduleCfgId = dataMap.get("scheduleCfgId") == null ? 0:dataMap.getLong("scheduleCfgId");
long limit = dataMap.get("limit") == null ? 1000:dataMap.getLong("limit");
long limit = dataMap.get("limit") == null ? Constants.MAAT_JSON_SEND_SIZE:dataMap.getLong("limit");
log.info(String.format("Sync定时配置任务开始扫描scheduleCfgId:%s,limit:%s",scheduleCfgId,limit ));
List<ScheduleCfg> newlyCfg = null;
int totalNum = 0;
@@ -94,7 +94,7 @@ public class ScheduleSyncCfgJob implements Job {
String currentStatus = DictUtils.getDictLabel("currrent_sync_status", "status","0");
if(!(currentStatus.equals("0") || currentStatus.equals("1") || currentStatus.equals("2"))) {
do {
newlyCfg = dao.findNewlyCfg(scheduleCfgId, limit,2);
newlyCfg = dao.findNewlyCfg(scheduleCfgId, limit,2,null);
if(newlyCfg != null && newlyCfg.size() > 0) {
totalNum += newlyCfg.size();
for(ScheduleCfg cfg : newlyCfg) {//先取消之前的定时配置

View File

@@ -248,7 +248,7 @@ public class ConfigConvertUtil {
List<Integer> regionIdList = Lists.newArrayList();
T srcCfg = srcList.get(i);
BaseIpCfg baseIpCfg = new BaseIpCfg();
BeanUtils.copyProperties(srcCfg, baseIpCfg);
BeanUtils.copyProperties(srcCfg, baseIpCfg,new String[]{"menuNameCode"});
regionIdList.add(baseIpCfg.getRegionId());
IpCfg cfg = new IpCfg();
BeanUtils.copyProperties(baseIpCfg, cfg);
@@ -325,10 +325,10 @@ public class ConfigConvertUtil {
} else if (cfgType == 4) {
for (int i = 0; i < srcList.size(); i++) {
BaseCfg baseCfg = new BaseCfg();
BeanUtils.copyProperties(srcList.get(i), baseCfg);//拷贝公共属性
BeanUtils.copyProperties(srcList.get(i), baseCfg,new String[]{"menuNameCode"});//拷贝公共属性
// 一条业务配置创建一个分组
com.nis.domain.maat.MaatCfg.NumBoundaryCfg cfg = new com.nis.domain.maat.MaatCfg.NumBoundaryCfg();
BeanUtils.copyProperties(srcList.get(i), cfg);
BeanUtils.copyProperties(srcList.get(i), cfg,new String[]{"menuNameCode"});
GroupCfg group = new GroupCfg();
group.setGroupId(baseCfg.getGroupId());
group.setCompileId(baseCfg.getCompileId());
@@ -344,10 +344,10 @@ public class ConfigConvertUtil {
} else if (cfgType == 5) {
for (int i = 0; i < srcList.size(); i++) {
BaseCfg baseCfg = new BaseCfg();
BeanUtils.copyProperties(srcList.get(i), baseCfg);//拷贝公共属性
BeanUtils.copyProperties(srcList.get(i), baseCfg,new String[]{"menuNameCode"});//拷贝公共属性
// 一条业务配置创建一个分组
com.nis.domain.maat.MaatCfg.DigestCfg cfg = new com.nis.domain.maat.MaatCfg.DigestCfg();
BeanUtils.copyProperties(srcList.get(i), cfg);
BeanUtils.copyProperties(srcList.get(i), cfg,new String[]{"menuNameCode"});
GroupCfg group = new GroupCfg();
group.setGroupId(baseCfg.getGroupId());
group.setCompileId(baseCfg.getCompileId());
@@ -395,31 +395,45 @@ public class ConfigConvertUtil {
*/
public static List<IpCfg> ipConvert(IpCfg dstIp, BaseIpCfg srcIp) {
List<IpCfg> ipConvertList = Lists.newArrayList();
boolean isRange = ((srcIp.getIpPattern() != null && srcIp.getIpPattern() == 2)
|| (srcIp.getSrcIpAddress() != null && srcIp.getSrcIpAddress().indexOf("-") > -1)
|| (srcIp.getDestIpAddress() != null && srcIp.getDestIpAddress().indexOf("-") > -1));
if (isRange) {
List<IpCfg> tempList = Lists.newArrayList();
List<IpCfg> tempList1 = Lists.newArrayList();
if (srcIp.getIpType().intValue() == 4) {
if (srcIp.getSrcIpAddress() != null) {
String startIpPart = srcIp.getSrcIpAddress().split("-")[0];
String endIpPart = srcIp.getSrcIpAddress().split("-")[1];
Integer startNum = Integer.parseInt(startIpPart.split("\\.")[3]);
Integer endNum = Integer.parseInt(endIpPart.split("\\.")[3]);
for (int i = startNum; i <= endNum; i++) {
IpCfg tempIp = new IpCfg();
BeanUtils.copyProperties(dstIp, tempIp);
tempIp.setSrcIp(startIpPart.substring(0, startIpPart.lastIndexOf(".") + 1) + i);
tempIp.setSrcIpMask("255.255.255.255");
tempList.add(tempIp);
List<IpCfg> tempList = Lists.newArrayList();
List<IpCfg> tempList1 = Lists.newArrayList();
if (srcIp.getIpType().equals(4)) {// IP V4
if(srcIp.getSrcIpPattern().equals(2)) {//源IP范围
if (srcIp.getSrcIpAddress() != null) {
String startIpPart = srcIp.getSrcIpAddress().split("-")[0];
String endIpPart = srcIp.getSrcIpAddress().split("-")[1];
Integer startNum = Integer.parseInt(startIpPart.split("\\.")[3]);
Integer endNum = Integer.parseInt(endIpPart.split("\\.")[3]);
for (int i = startNum; i <= endNum; i++) {
IpCfg tempIp = new IpCfg();
BeanUtils.copyProperties(dstIp, tempIp);
tempIp.setSrcIp(startIpPart.substring(0, startIpPart.lastIndexOf(".") + 1) + i);
tempIp.setSrcIpMask("255.255.255.255");
tempList.add(tempIp);
}
}else {
dstIp.setSrcIp("0.0.0.0");
dstIp.setSrcIpMask("255.255.255.255");
tempList.add(dstIp);
}
}else if(srcIp.getSrcIpPattern().equals(1)){
Integer srcMaskNum = Integer.parseInt(srcIp.getSrcIpAddress().split("/")[1]);
if (srcMaskNum == 0) {
dstIp.setSrcIpMask("0.0.0.0");
} else {
dstIp.setSrcIp("0.0.0.0");
dstIp.setSrcIpMask("255.255.255.255");
tempList.add(dstIp);
dstIp.setSrcIpMask(IpUtil.convertMask(srcMaskNum));
}
if (srcIp.getDestIpAddress() != null) {
dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]);
tempList.add(dstIp);
}else if(srcIp.getSrcIpPattern().equals(3)){
dstIp.setSrcIp(srcIp.getSrcIpAddress());
dstIp.setSrcIpMask("255.255.255.255");
tempList.add(dstIp);
}else {
throw new RuntimeException("Unsupported IP Pattern " + srcIp.getSrcIpPattern());
}
if (srcIp.getDestIpAddress() != null) {
if(srcIp.getDestIpPattern().equals(2)) {
String startIpPart = srcIp.getDestIpAddress().split("-")[0];
String endIpPart = srcIp.getDestIpAddress().split("-")[1];
Integer startNum = Integer.parseInt(startIpPart.split("\\.")[3]);
@@ -439,217 +453,93 @@ public class ConfigConvertUtil {
}
}
tempList.clear();
} else {
}else if(srcIp.getDestIpPattern().equals(1)) {
Integer dstMaskNum = Integer.parseInt(srcIp.getDestIpAddress().split("/")[1]);
for (IpCfg _cfg : tempList) {
_cfg.setDstIp("0.0.0.0");
_cfg.setSrcIpMask("255.255.255.255");
convertPortValues(_cfg, srcIp);
IpCfg tempIp = new IpCfg();
BeanUtils.copyProperties(_cfg, tempIp);
if (dstMaskNum == 0) {
tempIp.setDstIpMask("0.0.0.0");
} else {
tempIp.setDstIpMask(IpUtil.convertMask(dstMaskNum));
}
tempIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]);
if (!tempIp.getSrcIp().equals(tempIp.getDstIp())) {
// 处理
convertPortValues(tempIp, srcIp);
tempList1.add(tempIp);
}
}
tempList.clear();
}else {
for (IpCfg _cfg : tempList) {
IpCfg tempIp = new IpCfg();
BeanUtils.copyProperties(_cfg, tempIp);
tempIp.setDstIp(srcIp.getDestIpAddress());
if (!tempIp.getSrcIp().equals(tempIp.getDstIp())) {
tempIp.setDstIpMask("255.255.255.255");
// 处理
convertPortValues(tempIp, srcIp);
tempList1.add(tempIp);
}
}
tempList.clear();
}
if (tempList1.size() > 0) {
ipConvertList.addAll(tempList1);
} else {
ipConvertList.addAll(tempList);
}else {
for (IpCfg _cfg : tempList) {
_cfg.setDstIp("0.0.0.0");
_cfg.setSrcIpMask("255.255.255.255");
convertPortValues(_cfg, srcIp);
}
} else if (srcIp.getIpType().intValue() == 6) {
if (srcIp.getSrcIpAddress() != null) {
}
if (tempList1.size() > 0) {
ipConvertList.addAll(tempList1);
} else {
ipConvertList.addAll(tempList);
}
}else if(srcIp.getIpType().equals(6)){// IP V6
if (srcIp.getSrcIpAddress() != null) {
if(srcIp.getSrcIpPattern().equals(2)) {
IPv6Address address1 = IPv6Address.fromString(srcIp.getSrcIpAddress().split("-")[0]);
IPv6Address address2 = IPv6Address.fromString(srcIp.getSrcIpAddress().split("-")[1]);
IPv6Network network = IPv6Network.fromTwoAddresses(address1, address2);
dstIp.setSrcIp(address1.toString());
dstIp.setSrcIpMask(network.getNetmask().asAddress().toString());
} else {
dstIp.setSrcIp("::");
}else if(srcIp.getSrcIpPattern().equals(1)){// IP/掩码
IPv6Network strangeNetwork = IPv6Network.fromString(srcIp.getSrcIpAddress());
dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]);
dstIp.setSrcIpMask(strangeNetwork.getNetmask().asAddress().toString());
}else {// IP
dstIp.setSrcIp(srcIp.getSrcIpAddress());
dstIp.setSrcIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}
if (srcIp.getDestIpAddress() != null) {
} else {
dstIp.setSrcIp("::");
dstIp.setSrcIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}
if (srcIp.getDestIpAddress() != null) {
if(srcIp.getDestIpPattern().equals(2)) {
IPv6Address address1 = IPv6Address.fromString(srcIp.getDestIpAddress().split("-")[0]);
IPv6Address address2 = IPv6Address.fromString(srcIp.getDestIpAddress().split("-")[1]);
IPv6Network network = IPv6Network.fromTwoAddresses(address1, address2);
dstIp.setDstIp(address1.toString());
dstIp.setDstIpMask(network.getNetmask().asAddress().toString());
} else {
dstIp.setDstIp("::");
dstIp.setDstIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}
ipConvertList.add(dstIp);
} else {
throw new RuntimeException("Unsupported IP type " + srcIp.getIpType());
}
} else {
if (srcIp.getSrcIpAddress() != null) {
if (srcIp.getSrcIpAddress().indexOf("/") != -1) {
if (srcIp.getIpType() == 4 /* || srcIp.getIpType()==46 */) {// 46表示源ip为ipv4目的ip为ipv6
Integer srcMaskNum = Integer.parseInt(srcIp.getSrcIpAddress().split("/")[1]);
if (srcMaskNum == 0) {
dstIp.setSrcIpMask("0.0.0.0");
} else {
dstIp.setSrcIpMask(IpUtil.convertMask(srcMaskNum));
}
dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]);
} else if (srcIp.getIpType() == 6/* || srcIp.getIpType()==64 */) {// 64表示源ip为ipv6目的ip为ipv4
IPv6Network strangeNetwork = IPv6Network.fromString(srcIp.getSrcIpAddress());
dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]);
dstIp.setSrcIpMask(strangeNetwork.getNetmask().asAddress().toString());
} /*
* else { Pattern
* patternV4Subnet=Pattern.compile(Constants.IPV4_IP_SUBNET_REGEXP); Pattern
* patternV6Subnet=Pattern.compile(Constants.IPV6_IP_SUBNET_REGEXP); Matcher
* matchernV4Subnet=patternV4Subnet.matcher(srcIp.getSrcIpAddress()); Matcher
* matcherV6Subnet=patternV6Subnet.matcher(srcIp.getSrcIpAddress());
* if(matchernV4Subnet.matches()) { Integer srcMaskNum =
* Integer.parseInt(srcIp.getSrcIpAddress().split("/")[1]); if(srcMaskNum==0){
* dstIp.setSrcIpMask("0.0.0.0"); }else{
* dstIp.setSrcIpMask(IpUtil.convertMask(srcMaskNum)); }
* dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]); }else
* if(matcherV6Subnet.matches()){ IPv6Network strangeNetwork =
* IPv6Network.fromString(srcIp.getSrcIpAddress());
* dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]);
* dstIp.setSrcIpMask(strangeNetwork.getNetmask().asAddress().toString()); }else
* { throw new RuntimeException("Invalid IP/subnet mask format"); } }
*/
else {
throw new RuntimeException("Unsupported IP type " + srcIp.getIpType());
}
} else {
if (srcIp.getIpType() == 4/* || srcIp.getIpType()==46 */) {// 46表示源ip为ipv4目的ip为ipv6
dstIp.setSrcIp(srcIp.getSrcIpAddress());
dstIp.setSrcIpMask("255.255.255.255");
} else if (srcIp.getIpType() == 6/* || srcIp.getIpType()==64 */) {// 64表示源ip为ipv6目的ip为ipv4
dstIp.setSrcIp(srcIp.getSrcIpAddress());
dstIp.setSrcIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
} /*
* else {//all Pattern patternV4=Pattern.compile(Constants.IPV4_IP_REGEXP);
* Pattern patternV6=Pattern.compile(Constants.IPV6_IP_REGEXP); Matcher
* matcherV4=patternV4.matcher(srcIp.getSrcIpAddress()); Matcher
* matcherV6=patternV6.matcher(srcIp.getSrcIpAddress()); if(matcherV4.matches())
* { dstIp.setSrcIp(srcIp.getSrcIpAddress());
* dstIp.setSrcIpMask("255.255.255.255"); }else if(matcherV6.matches()) {
* dstIp.setSrcIp(srcIp.getSrcIpAddress());
* dstIp.setSrcIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"); }else { throw
* new RuntimeException("Invalid IP format"); } }
*/
else {
throw new RuntimeException("Unsupported IP type " + srcIp.getIpType());
}
}
} else {
if (srcIp.getIpType() == 4/* || srcIp.getIpType()==46 */) {// 46表示源ip为ipv4目的ip为ipv6
dstIp.setSrcIp(srcIp.getSrcIpAddress());
dstIp.setSrcIpMask("255.255.255.255");
} else if (srcIp.getIpType() == 6/* || srcIp.getIpType()==64 */) {// 64表示源ip为ipv6目的ip为ipv4
dstIp.setSrcIp(srcIp.getSrcIpAddress());
dstIp.setSrcIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
} /*
* else {//all dstIp.setSrcIp(srcIp.getSrcIpAddress());
* dstIp.setSrcIpMask("255.255.255.255"); }
*/
else {
throw new RuntimeException("Unsupported IP type " + srcIp.getIpType());
}
}
if (srcIp.getDestIpAddress() != null) {
if (srcIp.getDestIpAddress().indexOf("/") != -1) {
if (srcIp.getIpType() == 4/* || srcIp.getIpType()==64 */) {// 64表示源ip为ipv6目的ip为ipv4
Integer dstMaskNum = Integer.parseInt(srcIp.getDestIpAddress().split("/")[1]);
if (dstMaskNum == 0) {
dstIp.setDstIpMask("0.0.0.0");
} else {
dstIp.setDstIpMask(IpUtil.convertMask(dstMaskNum));
;
}
dstIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]);
} else if (srcIp.getIpType() == 6/* || srcIp.getIpType()==46 */) {// 46表示源ip为ipv4目的ip为ipv6
IPv6Network strangeNetwork = IPv6Network.fromString(srcIp.getDestIpAddress());
dstIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]);
dstIp.setDstIpMask(strangeNetwork.getNetmask().asAddress().toString());
} /*
* else { Pattern
* patternV4Subnet=Pattern.compile(Constants.IPV4_IP_SUBNET_REGEXP); Pattern
* patternV6Subnet=Pattern.compile(Constants.IPV6_IP_SUBNET_REGEXP); Matcher
* matchernV4Subnet=patternV4Subnet.matcher(srcIp.getDestIpAddress()); Matcher
* matcherV6Subnet=patternV6Subnet.matcher(srcIp.getDestIpAddress());
* if(matchernV4Subnet.matches()) { Integer dstMaskNum =
* Integer.parseInt(srcIp.getDestIpAddress().split("/")[1]); if(dstMaskNum==0){
* dstIp.setDstIpMask("0.0.0.0"); }else{
* dstIp.setDstIpMask(IpUtil.convertMask(dstMaskNum));; }
* dstIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]); }else
* if(matcherV6Subnet.matches()){ IPv6Network strangeNetwork =
* IPv6Network.fromString(srcIp.getDestIpAddress());
* dstIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]);
* dstIp.setDstIpMask(strangeNetwork.getNetmask().asAddress().toString()); }else
* { throw new RuntimeException("Invalid IP/subnet mask format"); } }
*/
else {
throw new RuntimeException("Unsupported IP type " + srcIp.getIpType());
}
} else {
if (srcIp.getIpType() == 4/* || srcIp.getIpType()==64 */) {// 64表示源ip为ipv6目的ip为ipv4
dstIp.setDstIp(srcIp.getDestIpAddress());
dstIp.setDstIpMask("255.255.255.255");
} else if (srcIp.getIpType() == 6/* || srcIp.getIpType()==46 */) {// 46表示源ip为ipv4目的ip为ipv6
dstIp.setDstIp(srcIp.getDestIpAddress());
dstIp.setDstIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
} /*
* else {//all Pattern patternV4=Pattern.compile(Constants.IPV4_IP_REGEXP);
* Pattern patternV6=Pattern.compile(Constants.IPV6_IP_REGEXP); Matcher
* matcherV4=patternV4.matcher(srcIp.getDestIpAddress()); Matcher
* matcherV6=patternV6.matcher(srcIp.getDestIpAddress());
* if(matcherV4.matches()) { dstIp.setDstIp(srcIp.getDestIpAddress());
* dstIp.setDstIpMask("255.255.255.255"); }else if(matcherV6.matches()) {
* dstIp.setDstIp(srcIp.getDestIpAddress());
* dstIp.setDstIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"); }else { throw
* new RuntimeException("invalid ip format"); } }
*/
else {
throw new RuntimeException("Unsupported IP type " + srcIp.getIpType());
}
}
} else {
if (srcIp.getIpType() == 4/* || srcIp.getIpType()==64 */) {// 64表示源ip为ipv6目的ip为ipv4
dstIp.setDstIp(srcIp.getDestIpAddress());
dstIp.setDstIpMask("255.255.255.255");
} else if (srcIp.getIpType() == 6/* || srcIp.getIpType()==46 */) {// 46表示源ip为ipv4目的ip为ipv6
}else if(srcIp.getDestIpPattern().equals(1)) {// IP/掩码
IPv6Network strangeNetwork = IPv6Network.fromString(srcIp.getDestIpAddress());
dstIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]);
dstIp.setDstIpMask(strangeNetwork.getNetmask().asAddress().toString());
}else {// IP
dstIp.setDstIp(srcIp.getDestIpAddress());
dstIp.setDstIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
} /*
* else {//all dstIp.setDstIp(srcIp.getDestIpAddress());
* dstIp.setDstIpMask("255.255.255.255"); }
*/
else {
throw new RuntimeException("Unsupported IP type " + srcIp.getIpType());
}
}
if (srcIp.getSrcPort() != null) {
if (srcIp.getSrcPort().indexOf("/") != -1) {
String srcMaskNum = srcIp.getSrcPort().split("/")[1];
dstIp.setSrcPortMask(srcMaskNum);
dstIp.setSrcPort(srcIp.getSrcPort().split("/")[0]);
} else {
dstIp.setSrcPort(srcIp.getSrcPort());
dstIp.setSrcPortMask("65535");
}
} else {
dstIp.setSrcPort("0");
dstIp.setSrcPortMask("65535");
}
if (srcIp.getDestPort() != null) {
if (srcIp.getDestPort().indexOf("/") != -1) {
String dstMaskNum = srcIp.getDestPort().split("/")[1];
dstIp.setDstPortMask(dstMaskNum);
dstIp.setDstPort(srcIp.getDestPort().split("/")[0]);
} else {
dstIp.setDstPort(srcIp.getDestPort());
dstIp.setDstPortMask("65535");
}
} else {
dstIp.setDstPort("0");
dstIp.setDstPortMask("65535");
dstIp.setDstIp("::");
dstIp.setDstIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}
convertPortValues(dstIp, srcIp);
ipConvertList.add(dstIp);
}else {
throw new RuntimeException("Unsupported IP type " + srcIp.getIpType());
}
return ipConvertList;
}

View File

@@ -133,6 +133,7 @@ public class ConfigServiceUtil {
result=response.readEntity(String.class);
}
} catch (Exception e) {
logger.error("request_service_failed",e);
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
if(response != null && response.getStatus() == 200){
@@ -189,6 +190,7 @@ public class ConfigServiceUtil {
result=response.readEntity(String.class);
}
} catch (Exception e) {
e.printStackTrace();
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
if(response != null && response.getStatus() == 200){
@@ -234,6 +236,7 @@ public class ConfigServiceUtil {
result=response.readEntity(String.class);
}
} catch (Exception e) {
e.printStackTrace();
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
if(response != null && response.getStatus() == 200){
@@ -243,6 +246,7 @@ public class ConfigServiceUtil {
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
}
} catch (Exception e) {
e.printStackTrace();
logger.error("postCallbackCfg()",e);
throw e;
}finally {
@@ -278,6 +282,7 @@ public class ConfigServiceUtil {
result=response.readEntity(String.class);
}
} catch (Exception e) {
e.printStackTrace();
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
if(response != null && response.getStatus() == 200){
@@ -325,6 +330,7 @@ public class ConfigServiceUtil {
result=response.readEntity(String.class);
}
} catch (Exception e) {
e.printStackTrace();
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
if(response != null && response.getStatus() == 200){
@@ -374,6 +380,7 @@ public class ConfigServiceUtil {
result=response.readEntity(String.class);
}
} catch (Exception e) {
e.printStackTrace();
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
if(response !=null && response.getStatus() == 200){
@@ -417,6 +424,7 @@ public class ConfigServiceUtil {
// bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
//获取响应结果
} catch (Exception e) {
e.printStackTrace();
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
}
} catch (Exception e) {
@@ -451,6 +459,7 @@ public class ConfigServiceUtil {
result=response.readEntity(String.class);
}
} catch (Exception e) {
e.printStackTrace();
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
if(response !=null && response.getStatus() == 200){

View File

@@ -322,56 +322,18 @@ public final class Constants {
// public static final boolean IS_USE_HIVE_DB =
// Configurations.getBooleanProperty("isUseHiveDb", true);
/**
* 是否获取数据中心查询记录的总条数
*/
public static final boolean IS_GET_HIVECOUNT = Configurations.getBooleanProperty("isGetHiveCount", true);
/**
* 是否获取数据中心[神通]查询记录的总条数
*/
public static final boolean IS_SELECT_CLUSTER = Configurations.getBooleanProperty("isSelectCluster", false);
/**
* 神通数据库A的数据最早时间
*/
public static final Long CLUSTER_A_START_TIME = Configurations.getLongProperty("clusterAStartTime", new Date().getTime());
/**
* 神通数据库B的数据最早时间
*/
public static final Long CLUSTER_B_START_TIME = Configurations.getLongProperty("clusterBStartTime", new Date().getTime());
/**
* 每次获取数据中心多少条数据,咱们在对获取的数据进行分页处理
*/
public static final Long EVERY_GETHIVEDATANUM = Configurations.getLongProperty("everyGetHiveDataNum", 10000);
/**
* 是否开启基础校验
*/
public static final boolean BASE_VALIDATE = Configurations.getBooleanProperty("baseValidate", true);
public static final Long DATACENTER_TIME = Configurations.getLongProperty("dataCenterTime", 48);
/**
* 是否开启业务校验
*/
public static final boolean SERVICE_VALIDATE = Configurations.getBooleanProperty("serviceValidate", true);
/**
* 日志本地存储时间
*/
public static final Long LOG_LOCAL_TIME = Configurations.getLongProperty("logLocalTime", 48);
/**
* 实时统计默认时间
*/
public static final Long REPORT_LOCAL_TIME = Configurations.getLongProperty("reportLocalTime", 1);
/**
* 日志是否从hive中查询
*/
public static final boolean SEL_FROM_HIVE = Configurations.getBooleanProperty("selFromHive", true);
public static final boolean ONLY_SEL_FROM_HIVE = Configurations.getBooleanProperty("onlySelFromHive", true);
/**
@@ -385,12 +347,6 @@ public final class Constants {
*/
public static final String SEARCH_DATEFORMAT = Configurations.getStringProperty("search.dateformat",
"yyyy-MM-dd HH:mm:ss");
public static final String SEARCH_ES_HOSTANDPORT_A = Configurations.getStringProperty("search.eshostandport_A",
null);
public static final String SEARCH_ES_HOSTANDPORT_B = Configurations.getStringProperty("search.eshostandport_B",
null);
public static final String SEARCH_ES_HOSTANDPORT_C = Configurations.getStringProperty("search.eshostandport_C",
null);
/**
* 数据中心A版数据库名称,程序中每次查询时使用的数据库名称 use HIVEADBNAME
*/
@@ -407,6 +363,7 @@ public final class Constants {
public static final String FILE_UPLOAD_CFG = Configurations.getStringProperty("fileUploadCfg","fileUploadSources");
public static final String FILE_DIGEST_CFG=Configurations.getStringProperty("fileDigestCfg","fileDigestSources");
public static final String CONFIG_ID_SOURCES=Configurations.getStringProperty("configIdSources","configPzIdSources");
public static final String DEL_ALL_CFG=Configurations.getStringProperty("delAllCfg","delAllConfig");
//日志查询接口URL
public static final String LOG_BASE_URL = Configurations.getStringProperty("logBaseUrl","");
public static final String NTC_SERVICE_REPORT=Configurations.getStringProperty("ntcServiceReport","ntcServiceReport");
@@ -838,4 +795,9 @@ public final class Constants {
* 管理员用户预警查询服务配置总量接口
*/
public static final String CONFIG_BY_SERVICE = Configurations.getStringProperty("getConfigByService","");
/**
* 文件扫描结果接口
*/
public static final String NTC_HTTP_OBJSCAN_RESULT_LOGS = Configurations.getStringProperty("ntcHttpObjscanResultLogs","");
}

View File

@@ -1,6 +1,7 @@
package com.nis.util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -97,6 +98,18 @@ public class DictUtils {
}
return itemList;
}
public static Map<String,String> getDictMap(String key){
Map dictMap=new HashMap<String,String>();
List<SysDataDictionaryItem> itemList = getDictData().get(key);
if (StringUtil.isEmpty(itemList)) {
return dictMap;
}else {
for(SysDataDictionaryItem item:itemList) {
dictMap.put(item.getItemCode(), item.getItemValue());
}
}
return dictMap;
}
public static String getDictLabels(String dictKey, String itemCodes, String defaultValue){

View File

@@ -19,6 +19,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import com.google.common.collect.Lists;
import com.google.gson.Gson;
import com.nis.domain.basics.AsnIpCfg;
import com.nis.domain.callback.InlineIp;
import com.nis.domain.configuration.AppPolicyCfg;
@@ -76,7 +77,7 @@ public class SchedulerTaskUtil {
* @throws IllegalAccessException
* @throws IllegalArgumentException
*/
public boolean updateConfigByServiceAndCompile(Integer serviceId,Integer compileId,Integer isValid,Integer isIssueContent,ConfigSynchronizationDao configSynchronizationDao) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException{
public void updateConfigByServiceAndCompile(Integer serviceId,Integer compileId,Integer isValid,Integer isIssueContent,ConfigSynchronizationDao configSynchronizationDao)throws Exception{
// SecurityManagerInit();
// Subject subject = login("admin","zdjzsoft");
// System.out.println(subject.getPrincipal());
@@ -328,9 +329,6 @@ public class SchedulerTaskUtil {
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
if(result!=null){
logger.info("定时任务修改NTC/PROXY策略的MAAT配置内容响应信息"+result.getMsg());
return true;
}else{
return false;
}
}else{
/*maatCfg = new MaatCfg();
@@ -387,8 +385,8 @@ public class SchedulerTaskUtil {
}
}
//批量获取regionId,groupId(相同编译下的IP类配置多条ip只获取一个组号分组复用的域配置不需要重新获取regionId,groupId
List<Integer> regionIds = ConfigServiceUtil.getId(3, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size());
List<Integer> groupIds = ConfigServiceUtil.getId(2, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size());
List<Integer> regionIds = ConfigServiceUtil.getId(3, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size()+list.size());
List<Integer> groupIds = ConfigServiceUtil.getId(2, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size()+list.size());
entity.setIsValid(isValid);//将最新的配置状态赋给配置对象
entity.setAuditTime(updateTime);
for(int i=0;i<list.size();i++){
@@ -407,7 +405,8 @@ public class SchedulerTaskUtil {
areaIpRegionList = new ArrayList();
List<DdosIpCfg> list1 = new ArrayList();
String userRegion = "";
//处理自定义域
//处理自定义域【DDOS自定义域组成json结构】
Map ddosUserRegion= new HashMap();
if(userRegionList!=null){
for(Map<String,Object> n:userRegionList){
Object userRegionPosition = n.get("userRegionPosition");
@@ -424,17 +423,23 @@ public class SchedulerTaskUtil {
Field field = aClass.getDeclaredField(regionColumn);
field.setAccessible(true);
value = field.get(cfg);
if(!StringUtil.isEmpty(value)){
if(StringUtil.isEmpty(n.get("regionKey"))){
userRegion = value.toString();
}else{
userRegion += n.get("regionKey")+"="+value+Constants.USER_REGION_SPLIT;
//userRegion += n.get("regionKey")+"="+value+Constants.USER_REGION_SPLIT;
ddosUserRegion.put(n.get("regionKey"), value);
}
}else{
ddosUserRegion.put(n.get("regionKey"), "");
}
}
}
if(userRegion.endsWith(Constants.USER_REGION_SPLIT)){
userRegion = userRegion.substring(0, userRegion.length()-1);
}else if(!StringUtil.isEmpty(ddosUserRegion)){
userRegion = new Gson().toJson(ddosUserRegion);
}
}
list1.add(cfg);
@@ -473,9 +478,6 @@ public class SchedulerTaskUtil {
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
if(result!=null){
logger.info("定时任务修改DDOS配置内容响应信息"+result.getMsg());
return true;
}else{
return false;
}
}else{
/*maatCfg = new MaatCfg();
@@ -614,10 +616,7 @@ public class SchedulerTaskUtil {
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
if(result!=null){
logger.info("定时任务修改文件摘要类配置内容响应信息:"+result.getMsg());
return true;
}else{
return false;
}
}
}else{
/*maatCfg = new MaatCfg();
maatCfg.initDefaultValue();
@@ -776,10 +775,7 @@ public class SchedulerTaskUtil {
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
if(result!=null){
logger.info("定时任务更新APP POLICY配置内容响应信息"+result.getMsg());
return true;
}else{
return false;
}
}
}else{
/*maatCfg = new MaatCfg();
maatCfg.initDefaultValue();
@@ -818,7 +814,7 @@ public class SchedulerTaskUtil {
}else{//只修改配置状态
//下发并修改配置状态的参数类
ToUpdateMaatBeanStatus maatStatusBean = new ToUpdateMaatBeanStatus();
/*ToUpdateMaatBeanStatus maatStatusBean = new ToUpdateMaatBeanStatus();
UpdateMaatCfgStatus updateCfg = new UpdateMaatCfgStatus();
List<UpdateMaatCfgStatus> configCompileStartStopList = new ArrayList();
maatStatusBean.setVersion(Constants.MAAT_VERSION);
@@ -864,13 +860,45 @@ public class SchedulerTaskUtil {
String json=BaseService.gsonToJson(maatStatusBean);
logger.info("MAAT类配置启停状态修改内容"+json);
//调用服务启停接口
String result = ConfigServiceUtil.configStatusUpdate(json);
ToMaatResult result = ConfigServiceUtil.put(json,1);
if(result!=null){
logger.info("MAAT类配置启停状态修改结果"+result);
logger.info("MAAT类配置启停状态修改结果"+result.getMsg());
}else{
return false;
}
/*maatCfg = new MaatCfg();
}*/
//ip spoofing
if(serviceId.equals(518)){
entity.setCompileId(compileId);
List<CfgIndexInfo> list = configSynchronizationDao.getCfgIndexList(entity);
entity.setCompileId(compileId);
for(CfgIndexInfo cfg:list){
if(isValid==0){
PxyObjSpoofingIpPool pool=new PxyObjSpoofingIpPool();
pool.setCfgId(Long.valueOf(cfg.getUserRegion3()));
pool = configSynchronizationDao.getPxyObjSpoofingIpPool(pool.getCfgId());
List<PxyObjSpoofingIpPool> poolList = new ArrayList<PxyObjSpoofingIpPool>();
pool.setIsValid(0);
pool.setCompileId(pool.getCompileId());
pool.setServiceId(pool.getServiceId());
poolList.add(pool);
//调用服务接口取消配置
String json=BaseService.gsonToJson(poolList);
logger.info("欺骗IP池配置配置参数"+json);
//调用服务接口取消配置
try {
ToMaatResult result = ConfigServiceUtil.put(json, 2);
logger.info("欺骗IP池配置响应信息"+result.getMsg());
} catch (Exception e) {
e.printStackTrace();
logger.info("欺骗IP池配置配置失败");
throw e;
}
}
}
}
maatCfg = new MaatCfg();
maatCfg.initDefaultValue();
maatBean = new ToMaatBean();
configCompileList = new ArrayList();
@@ -880,7 +908,7 @@ public class SchedulerTaskUtil {
configCompileList.add(maatCfg);
maatBean.setConfigCompileList(configCompileList);
maatBean.setAuditTime(entity.getAuditTime());
maatBean.setCreatorName(entity.getCurrentUser().getName());
maatBean.setCreatorName("TaskScheduler");
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.UPDATE_ACTION);
//调用服务接口取消配置
@@ -888,7 +916,7 @@ public class SchedulerTaskUtil {
logger.info("定时器修改配置状态:"+json);
//调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.put(json,1);
logger.info("定时器修改配置状态响应时间:"+result.getMsg());*/
logger.info("定时器修改配置状态响应时间:"+result.getMsg());
}
}else if("2".equals(serviceType)){//回调类配置
@@ -948,17 +976,11 @@ public class SchedulerTaskUtil {
//调用服务接口修改回调类配置状态
ToMaatResult result = ConfigServiceUtil.put(json,2);
logger.info("定时器修改回调类配置状态响应信息:"+result);
if(result==null){
return false;
}else{
return true;
}
}
}
}
return true;
}
//定时器非前台业务需要设置shiro的SecurityManager
private void SecurityManagerInit(){

View File

@@ -306,6 +306,13 @@ public class ExcelCsv {
dict="block_drop";
val = msgProp.getProperty(dict,dict);
}
if ("action".equals(ef.title()) && dict.equals("action_reject")
&& (Reflections.invokeGetter(e, "service").toString().equals("35")
|| Reflections.invokeGetter(e, "service").toString().equals("33")
|| Reflections.invokeGetter(e, "service").toString().equals("36"))) {
dict="block_drop";
val = msgProp.getProperty(dict,dict);
}
//ip spoofing redirect动作修改为Spoofing
if(ef.title().equals("block_type")
&& (Reflections.invokeGetter(e, "serviceId").toString().equals("518"))) {

View File

@@ -39,8 +39,10 @@ import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.Assert;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.SysDataDictionaryItem;
@@ -264,6 +266,9 @@ public class ExportExcel {
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//1、非空
commentStr=commentStr+""+msgProp.getProperty("https_url_format_tip")+"\n";
index++;
//1、非空
commentStr=commentStr+""+msgProp.getProperty("required")+"\n";
index++;
}
@@ -290,7 +295,7 @@ public class ExportExcel {
}
}
/*** HTTP(s)替换 搜索区域 ***/
if(("replace_zone".equals(headerStr)) && (region.getFunctionId().equals(209))){
if(("replace_zone".equals(headerStr)) && (region.getFunctionId().equals(209) || "80".equals(region.getAction()+""))){
commentStr="";
List<SysDataDictionaryItem> dict=DictUtils.getDictList("CONTROL_REPLACE_ZONE");
if(dict !=null && dict.size()>0){
@@ -453,6 +458,19 @@ public class ExportExcel {
}
}
if("ip_group".equals(headerStr)) {
commentStr="";
//查询dns fake ip policyGroup列表
List<PolicyGroupInfo> list=policyGroupInfoDao.findPolicyGroupInfosByType(5);
if(!StringUtil.isEmpty(list)){
for (PolicyGroupInfo policyGroupInfo : list) {
commentStr=commentStr+policyGroupInfo.getServiceGroupId()+""+policyGroupInfo.getGroupName()+"\n";
index++;
}
}
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
}
if("isp".equals(headerStr)) {
commentStr="";
List<Integer> itTypeList = new ArrayList<Integer>();
@@ -583,25 +601,28 @@ public class ExportExcel {
commentStr="";
}
}else{
String[] ipPatterns=region.getConfigIpPattern().split(";");
if("client_ip".equals(headerStr)){
Assert.isTrue(ipPatterns.length==2);
String srcIpPattern=ipPatterns[0];
if(((","+region.getConfigIpPortShow()+",").indexOf(",1,") > -1) ){
commentStr="";
if((","+region.getConfigIpType()+",").indexOf(",4,") > -1){
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
if((","+srcIpPattern+",").indexOf(",3,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_VALUE+"IPv4"+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV4_DEFAULT_IP_VALUE;
}
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
if((","+srcIpPattern+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv4_range_tip")+""+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV4_DEFAULT_IP_RANGE_VALUE;
}
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
if((","+srcIpPattern+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv4_subnet_tip")+""+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV4_DEFAULT_IP_SUBNET_VALUE;
@@ -610,21 +631,21 @@ public class ExportExcel {
}
}
if((","+region.getConfigIpType()+",").indexOf(",6,") > -1){
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
if((","+srcIpPattern+",").indexOf(",3,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_VALUE+"IPv6"+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV6_DEFAULT_IP_VALUE;
}
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
if((","+srcIpPattern+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv6_range_tip")+""+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV6_DEFAULT_IP_RANGE_VALUE;
}
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
if((","+srcIpPattern+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv6_subnet_tip")+""+"\n\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV6_DEFAULT_IP_SUBNET_VALUE;
@@ -673,12 +694,12 @@ public class ExportExcel {
,msgProp.getProperty("serverip"))+"\n";
index++;
index++;
commentStr=commentStr+""+String.format(msgProp.getProperty("the_same_ip_type_pattern"))+"\n";
commentStr=commentStr+""+String.format(msgProp.getProperty("the_same_ip_type"))+"\n";
index++;
index++;
}
//4、IP Range 开始IP和结束IP必须在同一网段
if(((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1)){
if(((","+srcIpPattern+",").indexOf(",2,") > -1)){
commentStr=commentStr+""+msgProp.getProperty("ip_range")+","+msgProp.getProperty("ip_range_bit_field")+"\n";
index++;
index++;
@@ -689,7 +710,7 @@ public class ExportExcel {
}
//6、IPv4 Mask 掩码范围16-32
if(((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1)){
if(((","+srcIpPattern+",").indexOf(",1,") > -1)){
if(((","+region.getConfigIpType()+",").indexOf(",4,") > -1)){
commentStr=commentStr+""+msgProp.getProperty("ipv4_subnet_tip")+","+msgProp.getProperty("ipv4_mask_range_tip")+"\n";
index++;
@@ -705,24 +726,25 @@ public class ExportExcel {
}
if("server_ip".equals(headerStr)){
String destIpPattern=ipPatterns[1];
if((","+region.getConfigIpPortShow()+",").indexOf(",3,") > -1){
commentStr="";
if((","+region.getConfigIpType()+",").indexOf(",4,") > -1){
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
if((","+destIpPattern+",").indexOf(",3,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_VALUE+"IPv4"+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV4_DEFAULT_IP_VALUE;
}
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
if((","+destIpPattern+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv4_range_tip")+""+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV4_DEFAULT_IP_RANGE_VALUE;
}
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
if((","+destIpPattern+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv4_subnet_tip")+""+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV4_DEFAULT_IP_SUBNET_VALUE;
@@ -731,21 +753,21 @@ public class ExportExcel {
}
}
if((","+region.getConfigIpType()+",").indexOf(",6,") > -1){
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
if((","+destIpPattern+",").indexOf(",3,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_VALUE+"IPv6"+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV6_DEFAULT_IP_VALUE;
}
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
if((","+destIpPattern+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv6_range_tip")+""+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV6_DEFAULT_IP_RANGE_VALUE;
}
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
if((","+destIpPattern+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv6_subnet_tip")+""+"\n\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV6_DEFAULT_IP_SUBNET_VALUE;
@@ -778,12 +800,12 @@ public class ExportExcel {
,msgProp.getProperty("serverip"))+"\n";
index++;
index++;
commentStr=commentStr+""+String.format(msgProp.getProperty("the_same_ip_type_pattern"))+"\n";
commentStr=commentStr+""+String.format(msgProp.getProperty("the_same_ip_type"))+"\n";
index++;
index++;
}
//4、IP Range 开始IP和结束IP必须在同一网段
if(((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1)){
if(((","+destIpPattern+",").indexOf(",2,") > -1)){
commentStr=commentStr+""+msgProp.getProperty("ip_range")+","+msgProp.getProperty("ip_range_bit_field")+"\n";
index++;
index++;
@@ -794,7 +816,7 @@ public class ExportExcel {
}
//6、IPv4 Mask 掩码范围16-32
if(((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1)){
if(((","+destIpPattern+",").indexOf(",1,") > -1)){
if(((","+region.getConfigIpType()+",").indexOf(",4,") > -1)){
commentStr=commentStr+""+msgProp.getProperty("ipv4_subnet_tip")+","+msgProp.getProperty("ipv4_mask_range_tip")+"\n";
index++;
@@ -820,17 +842,20 @@ public class ExportExcel {
}else{
protocol=region.getConfigProtocol();
}
String[] portPatterns=region.getConfigPortPattern().split(";");
Assert.isTrue(portPatterns.length==2);
if("client_port".equals(headerStr)){
String srcPortPattern=portPatterns[0];
if(((","+region.getConfigIpPortShow()+",").indexOf(",2,") > -1)){
commentStr="";
if((","+region.getConfigPortPattern()+",").indexOf(",1,") > -1){
if((","+srcPortPattern+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.PORT_DEFAULT+"Port"+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.PORT_DEFAULT;
}
index++;
}
if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){
if((","+srcPortPattern+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"Port/"+msgProp.getProperty("port_mask")+""+"\n\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.PORT_MASK_DEFAULT;
@@ -856,11 +881,11 @@ public class ExportExcel {
index++;
}
//2、源端口、目的端口格式必须一致
if(((","+region.getConfigIpPortShow()+",").indexOf(",2,") > -1) && ((","+region.getConfigIpPortShow()+",").indexOf(",4,") > -1)){
commentStr=commentStr+""+msgProp.getProperty("the_same_port_pattern")+"\n";
index++;
index++;
}
// if(((","+region.getConfigIpPortShow()+",").indexOf(",2,") > -1) && ((","+region.getConfigIpPortShow()+",").indexOf(",4,") > -1)){
// commentStr=commentStr+"▶"+msgProp.getProperty("the_same_port_pattern")+"\n";
// index++;
// index++;
// }
//3、端口和端口掩码范围0-65535
commentStr=commentStr+""+msgProp.getProperty("port_mask_comment_tip")+"\n";
index++;
@@ -895,16 +920,17 @@ public class ExportExcel {
}
}
if("server_port".equals(headerStr)){
String destPortPattern=portPatterns[1];
if((","+region.getConfigIpPortShow()+",").indexOf(",4,") > -1){
commentStr="";
if((","+region.getConfigPortPattern()+",").indexOf(",1,") > -1){
if((","+destPortPattern+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.PORT_DEFAULT+"Port"+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.PORT_DEFAULT;
}
index++;
}
if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){
if((","+destPortPattern+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"Port/"+msgProp.getProperty("port_mask")+""+"\n\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.PORT_MASK_DEFAULT;
@@ -930,11 +956,11 @@ public class ExportExcel {
index++;
}
//2、源端口、目的端口格式必须一致
if(((","+region.getConfigIpPortShow()+",").indexOf(",2,") > -1) && ((","+region.getConfigIpPortShow()+",").indexOf(",4,") > -1)){
commentStr=commentStr+""+msgProp.getProperty("the_same_port_pattern")+"\n";
index++;
index++;
}
// if(((","+region.getConfigIpPortShow()+",").indexOf(",2,") > -1) && ((","+region.getConfigIpPortShow()+",").indexOf(",4,") > -1)){
// commentStr=commentStr+"▶"+msgProp.getProperty("the_same_port_pattern")+"\n";
// index++;
// index++;
// }
//3、端口和端口掩码范围0-65535
commentStr=commentStr+""+msgProp.getProperty("port_mask_comment_tip")+"\n";
index++;
@@ -2233,7 +2259,9 @@ public class ExportExcel {
* @return list 数据列表
*/
public <E> ExportExcel setDataList(Properties msgProp, Map<String,List> dataMap, Map<Object,Object> map){
long start=System.currentTimeMillis(),end=System.currentTimeMillis();
Set<String> keyList=dataMap.keySet();
Map<String,Map<String,String>> dictMaps=Maps.newConcurrentMap();
for (String key : keyList) {
List<E> list=dataMap.get(key);
for (E e : list){
@@ -2263,7 +2291,16 @@ public class ExportExcel {
val = getBasicInfo(ef.dictType(),map,valStr);
}else{
//字典数据已做国际化处理
String dict=DictUtils.getDictLabel(ef.dictType(), valStr, valStr);
String dict="";
if(dictMaps.containsKey(ef.dictType())) {
Map<String,String> dictM=dictMaps.get(ef.dictType());
dict=dictM.containsKey(valStr)?dictM.get(valStr):valStr;
}else {
Map<String,String> dictM=DictUtils.getDictMap(ef.dictType());
dictMaps.put(ef.dictType(), dictM);
dict=dictM.containsKey(valStr)?dictM.get(valStr):valStr;
}
//String dict=DictUtils.getDictLabel(ef.dictType(), valStr, valStr);
//如果找不到字典国际化值,把字典本身作为默认值放进去,不然导出就是空了
val = msgProp.getProperty(dict,dict);
//业务配置-stream 阻断类型中 阻断 改为 封堵(丢弃)
@@ -2274,6 +2311,13 @@ public class ExportExcel {
dict="block_drop";
val = msgProp.getProperty(dict,dict);
}
if ("action".equals(ef.title()) && dict.equals("action_reject")
&& (Reflections.invokeGetter(e, "service").toString().equals("35")
|| Reflections.invokeGetter(e, "service").toString().equals("33")
|| Reflections.invokeGetter(e, "service").toString().equals("36"))) {
dict="block_drop";
val = msgProp.getProperty(dict,dict);
}
//ip spoofing redirect动作修改为Spoofing
if(ef.title().equals("block_type")
&& (Reflections.invokeGetter(e, "serviceId").toString().equals("518"))) {
@@ -2332,6 +2376,8 @@ public class ExportExcel {
log.debug("Write success: ["+row.getRowNum()+"] "+sb.toString());
}
}
end=System.currentTimeMillis();
System.err.println("setDataList cost:"+(end-start));
return this;
}
/**
@@ -2464,6 +2510,7 @@ public class ExportExcel {
* @return
*/
public ExportExcel(Properties msgProp,List<String> titleList,Map<String,String> noExportMap,Map<String, Class<?>> clsMap, int type,String titleTime, int... groups){
long start=System.currentTimeMillis(),end=System.currentTimeMillis();
Map<String, List<String>> headerMap=new HashMap<String, List<String>>();
Map<String, List<String>> commentMap=new HashMap<String, List<String>>();
for (String title : titleList) {
@@ -2589,6 +2636,8 @@ public class ExportExcel {
annotationMap.put(title, annotationList);
}
initializeMultiSheet(msgProp,titleList, headerMap,commentMap,titleTime);
end=System.currentTimeMillis();
System.err.println("ExportExcel cost:"+(end-start));
}
/**

View File

@@ -488,11 +488,11 @@ public class ImportBigExcel extends XLSXCovertCSVReader{
if (valType == String.class){
String s = String.valueOf(val.toString().trim());
//0.0.0.0表示任意IP的含义
if(StringUtils.endsWith(s, ".0") && !s.endsWith("0.0.0.0")){
val = StringUtils.substringBefore(s, ".0");
}else{
val=val == null ? "" : StringEscapeUtils.escapeHtml4(val.toString().trim());
}
// if(StringUtils.endsWith(s, ".0") && !s.endsWith("0.0.0.0")){
// val = StringUtils.substringBefore(s, ".0");
// }else{
val=val == null ? "" : StringEscapeUtils.escapeHtml4(val.toString().trim());
// }
}else if (valType == Integer.class){
val = Double.valueOf(val.toString().trim()).intValue();
}else if (valType == Long.class){

View File

@@ -13,6 +13,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.jets3t.service.ServiceException;
import org.springframework.beans.BeanUtils;
import org.springframework.util.Assert;
import com.beust.jcommander.internal.Lists;
import com.nis.domain.FunctionRegionDict;
@@ -27,6 +28,7 @@ import com.nis.domain.configuration.template.IpRateLimitTemplate;
//import com.nis.util.AsnCacheUtils;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.IPUtil;
import com.nis.util.StringUtil;
public class CheckIpFormatThread implements Callable<String>{
@@ -92,14 +94,20 @@ public class CheckIpFormatThread implements Callable<String>{
}
boolean canIPv4 = ipType.indexOf("4") > -1;
boolean canIPv6 = ipType.indexOf("6") > -1;
String ipPattern = regionDict.getConfigIpPattern();
if (StringUtils.isBlank(ipPattern)) {
String[] ipPattern = regionDict.getConfigIpPattern().split(";");
Assert.isTrue(ipPattern!=null&&ipPattern.length==2);
String srcIpPattern = ipPattern[0];
String destIpPattern = ipPattern[1];
if (StringUtils.isBlank(srcIpPattern)||StringUtils.isBlank(destIpPattern)) {
throw new RuntimeException("Found IP region,but ipPattern is Empty");
}
boolean canIPFormat = ipType.indexOf("3") > -1;
boolean canIPSubnetFormat = ipType.indexOf("1") > -1;
boolean canIPRangeFormat = ipType.indexOf("2") > -1;
String portPattern = regionDict.getConfigPortPattern();
String[] portPattern = regionDict.getConfigPortPattern().split(";");
Assert.isTrue(ipPattern!=null&&ipPattern.length==2);
String srcPortPattern=portPattern[0];
String destPortPattern=portPattern[1];
String protocol = regionDict.getConfigProtocol();
String direction = regionDict.getConfigDirection();
StringBuffer errTip = new StringBuffer();
@@ -130,6 +138,7 @@ public class CheckIpFormatThread implements Callable<String>{
// doLog属性检验
this.validDoLog(baseIpCfg,errInfo);
// 特殊字段验证
// packet ip ratelimit
if (serviceDict!=null && serviceDict.getAction().intValue() == 64 && (serviceDict.getFunctionId().intValue() == 5
@@ -586,6 +595,23 @@ public class CheckIpFormatThread implements Callable<String>{
String subfix=baseIpCfg.getSrcIpAddress().split("-")[1];
baseIpCfg.setSrcIpAddress(prefix+"-"+prefix.substring(0, prefix.lastIndexOf(".")+1)+subfix);
}
//Tip:判断业务是否只展示源IP列,如果是,判断源IP是否是默认值,如果是默认值,提示源IP不能是默认值
if (configIpPortShow.indexOf("1") > -1 && configIpPortShow.indexOf("3") == -1) {// 源IP必填
String srcIpAddress = baseIpCfg.getSrcIpAddress();
Pattern ip4 = Constants.IPV4_IP_PATTERN;
Pattern ip6 = Constants.IPV6_IP_PATTERN;
Matcher ip4Matcher = ip4.matcher(srcIpAddress);
Matcher ip6Matcher = ip6.matcher(srcIpAddress);
if (ip4Matcher.matches() && srcIpAddress.startsWith("0.0.0.0")) {
errInfo.append(prop.getProperty("client_ip")+" "
+ String.format(prop.getProperty("can_not_be"), Constants.IPV4_DEFAULT_IP_VALUE)
+ ";");
} else if (ip6Matcher.matches() && srcIpAddress.startsWith("::")) {
errInfo.append(prop.getProperty("client_ip")+" "
+ String.format(prop.getProperty("can_not_be"), Constants.IPV6_DEFAULT_IP_VALUE)
+ ";");
}
}
}
if (StringUtils.isBlank(baseIpCfg.getDestIpAddress())) {
destIpEmpty = true;
@@ -597,6 +623,23 @@ public class CheckIpFormatThread implements Callable<String>{
String subfix=baseIpCfg.getDestIpAddress().split("-")[1];
baseIpCfg.setDestIpAddress(prefix+"-"+prefix.substring(0, prefix.lastIndexOf(".")+1)+subfix);
}
//Tip:判断业务是否只展示目的IP列,如果是,判断目的IP是否是默认值,如果是默认值,提示目的IP不能是默认值
if (configIpPortShow.indexOf("3") > -1 && configIpPortShow.indexOf("1") == -1) {// 目的IP必填
String destIpAddress = baseIpCfg.getDestIpAddress();
Pattern ip4 = Constants.IPV4_IP_PATTERN;
Pattern ip6 = Constants.IPV6_IP_PATTERN;
Matcher ip4Matcher = ip4.matcher(destIpAddress);
Matcher ip6Matcher = ip6.matcher(destIpAddress);
if (ip4Matcher.matches() && destIpAddress.startsWith("0.0.0.0")) {
errInfo.append(prop.getProperty("server_ip")+" "
+ String.format(prop.getProperty("can_not_be"), Constants.IPV4_DEFAULT_IP_VALUE)
+ ";");
} else if (ip6Matcher.matches() && destIpAddress.startsWith("::")) {
errInfo.append(prop.getProperty("server_ip")+" "
+ String.format(prop.getProperty("can_not_be"), Constants.IPV6_DEFAULT_IP_VALUE)
+ ";");
}
}
}
if (StringUtils.isBlank(baseIpCfg.getSrcPort())) {
srcPortEmpty = true;
@@ -621,77 +664,49 @@ public class CheckIpFormatThread implements Callable<String>{
prop.getProperty("server_ip", "Server IP")) + ";");
} else if (configIpPortShow.indexOf("1") > -1) {
String matchType = this.validIPAddress("client_ip", errInfo, baseIpCfg.getSrcIpAddress(),
ipType, ipPattern);
ipType, srcIpPattern);
//设置源IP pattern
if (matchType.endsWith("RANGE")) {
baseIpCfg.setSrcIpPattern(2);
} else if (matchType.endsWith("SUBNET")) {
baseIpCfg.setSrcIpPattern(1);
}else {
baseIpCfg.setSrcIpPattern(3);
}
if (matchType.startsWith("IPV6")) {
if (matchType.endsWith("RANGE")) {
// baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
baseIpCfg.setDestIpAddress(Constants.IPV6_DEFAULT_IP_RANGE_VALUE);
baseIpCfg.setIpPattern(2);
if (baseIpCfg.getSrcIpAddress()
.startsWith(Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0])) {
errInfo.append(prop.getProperty("client_ip")+" "
+ String.format(prop.getProperty("can_not_be"),
Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0])
+ ";");
}
} else if (matchType.endsWith("SUBNET")) {
// baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
baseIpCfg.setDestIpAddress(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE);
baseIpCfg.setIpPattern(1);
if (baseIpCfg.getSrcIpAddress()
.startsWith(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0])) {
errInfo.append(
prop.getProperty("client_ip")+" "
+ String.format(prop.getProperty("can_not_be"),
Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0])
+ ";");
}
} else {
// baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
//设置dest ip值
if(destIpPattern.indexOf("3")>-1) {//优先设置IP类型因为拆分的IP较少
baseIpCfg.setDestIpAddress(Constants.IPV6_DEFAULT_IP_VALUE);
baseIpCfg.setIpPattern(3);
if (baseIpCfg.getSrcIpAddress().equals(Constants.IPV6_DEFAULT_IP_VALUE)) {
errInfo.append(prop.getProperty("client_ip")+" " + String.format(
prop.getProperty("can_not_be"), Constants.IPV6_DEFAULT_IP_VALUE) + ";");
}
baseIpCfg.setDestIpPattern(3);
}else if(destIpPattern.indexOf("1")>-1) {
baseIpCfg.setDestIpAddress(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE);
baseIpCfg.setDestIpPattern(1);
}else {
baseIpCfg.setDestIpAddress(Constants.IPV6_DEFAULT_IP_RANGE_VALUE);
baseIpCfg.setDestIpPattern(2);
}
//设置IP类型
baseIpCfg.setIpType(6);
} else {
if (matchType.endsWith("RANGE")) {
this.validIPv4Range("client_ip", errInfo, baseIpCfg.getSrcIpAddress());
// baseIpCfg.setSrcIpAddress("0.0.0.0-"+baseIpCfg.getSrcIpAddress().split("-")[0].substring(0,baseIpCfg.getSrcIpAddress().indexOf("-")+1)+baseIpCfg.getSrcIpAddress().split("-")[1]);
baseIpCfg.setDestIpAddress(Constants.IPV4_DEFAULT_IP_RANGE_VALUE);
baseIpCfg.setIpPattern(2);
if (baseIpCfg.getSrcIpAddress()
.startsWith(Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0])) {
errInfo.append(prop.getProperty("client_ip")+" "
+ String.format(prop.getProperty("can_not_be"),
Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0])
+ ";");
}
} else if (matchType.endsWith("SUBNET")) {
// baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
baseIpCfg.setDestIpAddress(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE);
baseIpCfg.setIpPattern(1);
if (baseIpCfg.getSrcIpAddress()
.startsWith(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0])) {
errInfo.append(
prop.getProperty("client_ip")+" "
+ String.format(prop.getProperty("can_not_be"),
Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0])
+ ";");
}
} else {
baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
//设置dest ip值
if(destIpPattern.indexOf("3")>-1) {//优先设置IP类型因为拆分的IP较少
baseIpCfg.setDestIpAddress(Constants.IPV4_DEFAULT_IP_VALUE);
baseIpCfg.setIpPattern(3);
if (baseIpCfg.getSrcIpAddress().equals(Constants.IPV4_DEFAULT_IP_VALUE)) {
errInfo.append(prop.getProperty("client_ip")+" " + String.format(
prop.getProperty("can_not_be"), Constants.IPV4_DEFAULT_IP_VALUE) + ";");
}
baseIpCfg.setDestIpPattern(3);
}else if(destIpPattern.indexOf("1")>-1) {
baseIpCfg.setDestIpAddress(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE);
baseIpCfg.setDestIpPattern(1);
}else {
baseIpCfg.setDestIpAddress(Constants.IPV4_DEFAULT_IP_RANGE_VALUE);
baseIpCfg.setDestIpPattern(2);
}
baseIpCfg.setIpType(4);
}
//Tip:增加源IP和目的IP是否相等,如果相等,提示目的IP不能为空
if ((configIpPortShow.indexOf("3") > -1 && configIpPortShow.indexOf("1") > -1)
&& (baseIpCfg.getDestIpAddress().equals(baseIpCfg.getSrcIpAddress()))) {
errInfo.append(String.format(prop.getProperty("can_not_null"),
prop.getProperty("server_ip", "Server IP")) + ";");
}
}
} else if (srcIpEmpty) {// 源IP为空
@@ -700,166 +715,175 @@ public class CheckIpFormatThread implements Callable<String>{
prop.getProperty("client_ip", "Client IP")) + ";");
} else if (configIpPortShow.indexOf("3") > -1) {
String matchType = this.validIPAddress("server_ip", errInfo, baseIpCfg.getDestIpAddress(),
ipType, ipPattern);
ipType, destIpPattern);
if (matchType.endsWith("RANGE")) {
baseIpCfg.setDestIpPattern(2);
} else if (matchType.endsWith("SUBNET")) {
baseIpCfg.setDestIpPattern(1);
}else {
baseIpCfg.setDestIpPattern(3);
}
if (matchType.startsWith("IPV6")) {
if (matchType.endsWith("RANGE")) {
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
baseIpCfg.setSrcIpAddress(Constants.IPV6_DEFAULT_IP_RANGE_VALUE);
baseIpCfg.setIpPattern(2);
if (baseIpCfg.getDestIpAddress()
.startsWith(Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0])) {
errInfo.append(prop.getProperty("server_ip")+" "
+ String.format(prop.getProperty("can_not_be"),
Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0])
+ ";");
}
} else if (matchType.endsWith("SUBNET")) {
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
baseIpCfg.setSrcIpAddress(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE);
baseIpCfg.setIpPattern(1);
if (baseIpCfg.getDestIpAddress()
.startsWith(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0])) {
errInfo.append(
prop.getProperty("server_ip")+" "
+ String.format(prop.getProperty("can_not_be"),
Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0])
+ ";");
}
} else {
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
if(srcIpPattern.indexOf("3")>-1) {
baseIpCfg.setSrcIpAddress(Constants.IPV6_DEFAULT_IP_VALUE);
baseIpCfg.setIpPattern(3);
if (baseIpCfg.getDestIpAddress().equals(Constants.IPV6_DEFAULT_IP_VALUE)) {
errInfo.append(prop.getProperty("server_ip")+" " + String.format(
prop.getProperty("can_not_be"), Constants.IPV6_DEFAULT_IP_VALUE) + ";");
}
baseIpCfg.setSrcIpPattern(3);
}else if(srcIpPattern.indexOf("1")>-1) {
baseIpCfg.setSrcIpAddress(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE);
baseIpCfg.setSrcIpPattern(1);
}else {
baseIpCfg.setSrcIpAddress(Constants.IPV6_DEFAULT_IP_RANGE_VALUE);
baseIpCfg.setSrcIpPattern(2);
}
baseIpCfg.setIpType(6);
} else {
if (matchType.endsWith("RANGE")) {
this.validIPv4Range("server_ip", errInfo, baseIpCfg.getDestIpAddress());
// baseIpCfg.setDestIpAddress("0.0.0.0-"+baseIpCfg.getDestIpAddress().split("-")[0]
// .substring(0,baseIpCfg.getDestIpAddress().indexOf("-")+1)
// +baseIpCfg.getDestIpAddress().split("-")[1]);
baseIpCfg.setSrcIpAddress(Constants.IPV4_DEFAULT_IP_RANGE_VALUE);
baseIpCfg.setIpPattern(2);
if (baseIpCfg.getDestIpAddress()
.startsWith(Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0])) {
errInfo.append(prop.getProperty("server_ip")+" "
+ String.format(prop.getProperty("can_not_be"),
Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0])
+ ";");
}
} else if (matchType.endsWith("SUBNET")) {
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
baseIpCfg.setSrcIpAddress(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE);
baseIpCfg.setIpPattern(1);
if (baseIpCfg.getDestIpAddress()
.startsWith(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0])) {
errInfo.append(
prop.getProperty("server_ip")+" "
+ String.format(prop.getProperty("can_not_be"),
Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0])
+ ";");
}
} else {
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
if(srcIpPattern.indexOf("3")>-1) {
baseIpCfg.setSrcIpAddress(Constants.IPV4_DEFAULT_IP_VALUE);
baseIpCfg.setIpPattern(3);
if (baseIpCfg.getDestIpAddress().equals(Constants.IPV4_DEFAULT_IP_VALUE)) {
errInfo.append(prop.getProperty("server_ip")+" " + String.format(
prop.getProperty("can_not_be"), Constants.IPV4_DEFAULT_IP_VALUE) + ";");
}
baseIpCfg.setSrcIpPattern(3);
}else if(srcIpPattern.indexOf("1")>-1) {
baseIpCfg.setSrcIpAddress(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE);
baseIpCfg.setSrcIpPattern(1);
}else {
baseIpCfg.setSrcIpAddress(Constants.IPV4_DEFAULT_IP_RANGE_VALUE);
baseIpCfg.setSrcIpPattern(2);
}
baseIpCfg.setIpType(4);
}
//Tip:增加源IP和目的IP是否相等,如果相等,提示源的IP不能为空
if ((configIpPortShow.indexOf("3") > -1 && configIpPortShow.indexOf("1") > -1)
&& (baseIpCfg.getSrcIpAddress().equals(baseIpCfg.getDestIpAddress()))) {
errInfo.append(String.format(prop.getProperty("can_not_null"),
prop.getProperty("client_ip", "Client IP")) + ";");
}
}
} else {// 全不为空
String matchType = this.validIPAddress("client_ip", errInfo, baseIpCfg.getSrcIpAddress(), ipType,
ipPattern);
String matchType1 = this.validIPAddress("server_ip", errInfo, baseIpCfg.getDestIpAddress(), ipType,
ipPattern);
if (StringUtils.isNotBlank(matchType) && StringUtils.isNotBlank(matchType1)
&& !matchType.equals(matchType1)) {
errInfo.append(prop.get("the_same_ip_type_pattern") + ";");
String srcMatchType = this.validIPAddress("client_ip", errInfo, baseIpCfg.getSrcIpAddress(), ipType,
srcIpPattern);
String destMatchType = this.validIPAddress("server_ip", errInfo, baseIpCfg.getDestIpAddress(), ipType,
destIpPattern);
if (StringUtils.isNotBlank(srcMatchType) && StringUtils.isNotBlank(destMatchType)
&& ((srcMatchType.startsWith("IPV6")&&destMatchType.startsWith("IPV4"))
||(srcMatchType.startsWith("IPV4")&&destMatchType.startsWith("IPV6")))) {
errInfo.append(prop.get("the_same_ip_type") + ";");
}
// baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
if (matchType.startsWith("IPV6")) {
if (srcMatchType.startsWith("IPV6")) {
baseIpCfg.setIpType(6);
} else {
baseIpCfg.setIpType(4);
}
if (matchType.endsWith("RANGE")) {
if (matchType.startsWith("IPV4")) {
if (srcMatchType.endsWith("RANGE")) {
baseIpCfg.setSrcIpPattern(2);
}else if(srcMatchType.endsWith("SUBNET")) {
baseIpCfg.setSrcIpPattern(1);
}else {
baseIpCfg.setSrcIpPattern(3);
}
if (destMatchType.endsWith("RANGE")) {
baseIpCfg.setDestIpPattern(2);
}else if(destMatchType.endsWith("SUBNET")) {
baseIpCfg.setDestIpPattern(1);
}else {
baseIpCfg.setDestIpPattern(3);
}
if(baseIpCfg.getIpType().equals(4)) {
if (srcMatchType.endsWith("RANGE")) {
this.validIPv4Range("client_ip", errInfo, baseIpCfg.getSrcIpAddress());
}
if (destMatchType.endsWith("RANGE")) {
this.validIPv4Range("server_ip", errInfo, baseIpCfg.getDestIpAddress());
}
if (baseIpCfg.getSrcIpAddress().split("-")[0]
.equals(baseIpCfg.getDestIpAddress().split("-")[0])) {
errInfo.append(String.format(prop.getProperty("are_the_same"),
baseIpCfg.getSrcIpAddress().split("-")[0],
baseIpCfg.getDestIpAddress().split("-")[0]) + ";");
//验证Ip范围
if(StringUtils.isEmpty(errInfo)&&(srcMatchType.endsWith("RANGE")||destMatchType.endsWith("RANGE"))) {
this.ValidateRangeCross(baseIpCfg.getSrcIpAddress(),baseIpCfg.getDestIpAddress(), errInfo);
}
baseIpCfg.setIpPattern(2);
} else if (matchType.endsWith("SUBNET")) {
if (baseIpCfg.getSrcIpAddress().split("/")[0]
.equals(baseIpCfg.getDestIpAddress().split("/")[0])) {
errInfo.append(String.format(prop.getProperty("are_the_same"),
baseIpCfg.getSrcIpAddress().split("/")[0],
baseIpCfg.getDestIpAddress().split("/")[0]) + ";");
}
boolean same=false;
if(baseIpCfg.getSrcIpAddress().indexOf("-")>-1) {
if(baseIpCfg.getDestIpAddress().indexOf("-")>-1) {
if(baseIpCfg.getSrcIpAddress().split("-")[0].equals(baseIpCfg.getDestIpAddress().split("-")[0])) {
same=true;
}
}else if(baseIpCfg.getDestIpAddress().indexOf("/")>-1) {
if(baseIpCfg.getSrcIpAddress().split("-")[0].equals(baseIpCfg.getDestIpAddress().split("/")[0])) {
same=true;
}
}else {
if(baseIpCfg.getSrcIpAddress().split("-")[0].equals(baseIpCfg.getDestIpAddress())) {
same=true;
}
}
baseIpCfg.setIpPattern(1);
} else {
if (baseIpCfg.getSrcIpAddress().equals(baseIpCfg.getDestIpAddress())) {
errInfo.append(String.format(prop.getProperty("are_the_same"),
prop.getProperty("client_ip"), prop.getProperty("server_ip")) + ";");
}else if(baseIpCfg.getSrcIpAddress().indexOf("/")>-1){
if(baseIpCfg.getDestIpAddress().indexOf("-")>-1) {
if(baseIpCfg.getSrcIpAddress().split("/")[0].equals(baseIpCfg.getDestIpAddress().split("-")[0])) {
same=true;
}
}else if(baseIpCfg.getDestIpAddress().indexOf("/")>-1) {
if(baseIpCfg.getSrcIpAddress().split("/")[0].equals(baseIpCfg.getDestIpAddress().split("/")[0])) {
same=true;
}
}else {
if(baseIpCfg.getSrcIpAddress().split("/")[0].equals(baseIpCfg.getDestIpAddress())) {
same=true;
}
}
baseIpCfg.setIpPattern(3);
}else {
if(baseIpCfg.getDestIpAddress().indexOf("-")>-1) {
if(baseIpCfg.getSrcIpAddress().equals(baseIpCfg.getDestIpAddress().split("-")[0])) {
same=true;
}
}else if(baseIpCfg.getDestIpAddress().indexOf("/")>-1) {
if(baseIpCfg.getSrcIpAddress().equals(baseIpCfg.getDestIpAddress().split("/")[0])) {
same=true;
}
}else {
if(baseIpCfg.getSrcIpAddress().equals(baseIpCfg.getDestIpAddress())) {
same=true;
}
}
}
if(same) {
errInfo.append(String.format(prop.getProperty("are_the_same"),
baseIpCfg.getSrcIpAddress().split("-")[0],
baseIpCfg.getDestIpAddress().split("-")[0]) + ";");
}
}
// TODO 判断源IP和目的IP的值
// TODO 判断源IP和目的IP格式
if (destPortEmpty) {
if (srcPortEmpty) {
if (srcPortEmpty) {
if(srcPortPattern.indexOf("1")>-1) {
baseIpCfg.setSrcPort("0");
baseIpCfg.setDestPort("0");
baseIpCfg.setPortPattern(1);
} else {
if (baseIpCfg.getSrcPort().indexOf("/") > -1) {
baseIpCfg.setDestPort("0/0");
baseIpCfg.setPortPattern(2);
} else {
baseIpCfg.setDestPort("0");
baseIpCfg.setPortPattern(1);
}
baseIpCfg.setSrcPort(baseIpCfg.getSrcPort().trim());
baseIpCfg.setSrcPortPattern(1);
}else {
baseIpCfg.setSrcPort("0/0");
baseIpCfg.setSrcPortPattern(2);
}
} else {
if (srcPortEmpty) {
if (baseIpCfg.getDestPort().indexOf("/") > -1) {
baseIpCfg.setSrcPort("0/0");
baseIpCfg.setPortPattern(2);
} else {
baseIpCfg.setSrcPort("0");
baseIpCfg.setPortPattern(1);
}
} else {
if (baseIpCfg.getSrcPort().indexOf("/") > -1) {
baseIpCfg.setPortPattern(2);
} else {
baseIpCfg.setPortPattern(1);
}
baseIpCfg.setSrcPort(baseIpCfg.getSrcPort().trim());
}
baseIpCfg.setDestPort(baseIpCfg.getDestPort().trim());
}else if(baseIpCfg.getSrcPort().indexOf("/")>-1) {
baseIpCfg.setSrcPortPattern(2);
}else {
baseIpCfg.setSrcPortPattern(1);
}
// TODO 判断源端口和目的端口格式
// TODO 判断源和目的端口的值
boolean validPort = this.validPort(errInfo, baseIpCfg.getSrcPort(), baseIpCfg.getDestPort(),
portPattern);
baseIpCfg.setSrcPort(baseIpCfg.getSrcPort().trim());
boolean validSrcPort = this.validPort(errInfo, baseIpCfg.getSrcPort(),
srcPortPattern,"client_port");
if (destPortEmpty) {
if(destPortPattern.indexOf("1")>-1) {
baseIpCfg.setDestPort("0");
baseIpCfg.setDestPortPattern(1);
}else {
baseIpCfg.setDestPort("0/0");
baseIpCfg.setDestPortPattern(2);
}
}else if(baseIpCfg.getDestPort().indexOf("/")>-1) {
baseIpCfg.setDestPortPattern(2);
}else {
baseIpCfg.setDestPortPattern(1);
}
baseIpCfg.setDestPort(baseIpCfg.getDestPort().trim());
boolean validDestPort = this.validPort(errInfo, baseIpCfg.getDestPort(),
srcPortPattern,"server_port");
if (baseIpCfg.getProtocol()==null) {
//packet ip reject
if(regionDict.getFunctionId().equals(5)&&serviceDict!=null&&serviceDict.getServiceId().equals(16)) {
@@ -901,7 +925,7 @@ public class CheckIpFormatThread implements Callable<String>{
}
boolean validProtocol = this.validProtocol(errInfo, baseIpCfg.getProtocol(), protocol);
// 验证protocol与port是否符合逻辑
if (validProtocol && validPort) {
if (validProtocol && validSrcPort&&validDestPort) {
validProtocolAndPort(errInfo, baseIpCfg.getProtocol(), baseIpCfg.getSrcPort(),
baseIpCfg.getDestPort());
}
@@ -924,6 +948,10 @@ public class CheckIpFormatThread implements Callable<String>{
// TODO 判断Direction的值
this.validDirection(errInfo, baseIpCfg.getDirection(), direction);
}
//IP校验
// this.validSrcAndDescIp(baseIpCfg.getSrcIpAddress(), baseIpCfg.getDestIpAddress(), configIpPortShow,errInfo);
if (errInfo.toString().length() > 0) {//
errTip.append(String.format(prop.getProperty("line"), baseIpCfg.getIndex()) + ",");
errTip.append(errInfo);
@@ -1030,153 +1058,85 @@ public class CheckIpFormatThread implements Callable<String>{
* @param portPattern
* @throws ServiceException
*/
public boolean validPort(StringBuffer errInfo, String srcPortStr, String destPortStr, String portPattern)
public boolean validPort(StringBuffer errInfo, String portStr, String portPattern,String portName)
throws ServiceException {
boolean valid = true;
if (portPattern.equals("1")) {
try {
Integer srcPort = Integer.parseInt(srcPortStr);
Integer srcPort = Integer.parseInt(portStr);
if (srcPort < 0 || srcPort > 65535) {
errInfo.append(prop.getProperty("client_port")
errInfo.append(prop.getProperty(portName)
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
} catch (Exception e) {
// TODO: handle exception
errInfo.append(String.format(prop.getProperty("not_number"), prop.getProperty("client_port")) + ";");
valid = false;
}
try {
Integer destPort = Integer.parseInt(destPortStr);
if (destPort < 0 || destPort > 65535) {
errInfo.append(prop.getProperty("server_port")
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
} catch (Exception e) {
// TODO: handle exception
errInfo.append(String.format(prop.getProperty("not_number"), prop.getProperty("server_port")) + ";");
errInfo.append(String.format(prop.getProperty("not_number"), prop.getProperty(portName)) + ";");
valid = false;
}
} else if (portPattern.equals("2")) {
Pattern p = Constants.PORT_MASK_PATTERN;
Matcher m = p.matcher(srcPortStr);
Matcher m = p.matcher(portStr);
if (!m.matches()) {
errInfo.append(
String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty("client_port")) + ";");
String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty(portName)) + ";");
valid = false;
}
m = p.matcher(destPortStr);
if (!m.matches()) {
errInfo.append(
String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty("server_port")) + ";");
valid = false;
}
Integer srcPort = Integer.parseInt(srcPortStr.split("/")[0]);
Integer srcPortMask = Integer.parseInt(srcPortStr.split("/")[1]);
Integer destPort = Integer.parseInt(destPortStr.split("/")[0]);
Integer destPortMask = Integer.parseInt(destPortStr.split("/")[1]);
if (srcPort < 0 || srcPort > 65535) {
errInfo.append(prop.getProperty("client_port")
Integer port = Integer.parseInt(portStr.split("/")[0]);
Integer portMask = Integer.parseInt(portStr.split("/")[1]);
if (port < 0 || port > 65535) {
errInfo.append(prop.getProperty(portName)
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
if (srcPortMask < 0 || srcPortMask > 65535) {
errInfo.append(prop.getProperty("client_port_mask")
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
if (destPort < 0 || destPort > 65535) {
errInfo.append(prop.getProperty("server_port")
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
if (destPortMask < 0 || destPortMask > 65535) {
errInfo.append(prop.getProperty("server_port_mask")
if (portMask < 0 || portMask > 65535) {
errInfo.append(prop.getProperty(portName+"_mask")
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
} else if (portPattern.indexOf("1") > -1 && portPattern.indexOf("2") > -1) {
Pattern p = Constants.PORT_MASK_PATTERN;
Pattern p1 = Constants.PORT_PATTERN;
Matcher m = p.matcher(srcPortStr);// 源端口是端口掩码格式
Matcher m1 = p.matcher(destPortStr);// 目的端口是端口掩码格式
Matcher m2 = p1.matcher(srcPortStr);// 源端口是端口格式
Matcher m3 = p1.matcher(destPortStr);// 目的端口是端口格式
Matcher m = p.matcher(portStr);// 源端口是端口掩码格式
Matcher m2 = p1.matcher(portStr);// 端口是端口格式
if (m.matches()) {
Integer srcPort = Integer.parseInt(srcPortStr.split("/")[0]);
Integer srcPortMask = Integer.parseInt(srcPortStr.split("/")[1]);
Integer srcPort = Integer.parseInt(portStr.split("/")[0]);
Integer srcPortMask = Integer.parseInt(portStr.split("/")[1]);
if (srcPort < 0 || srcPort > 65535) {
errInfo.append(prop.getProperty("client_port")
errInfo.append(prop.getProperty(portName)
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
if (srcPortMask < 0 || srcPortMask > 65535) {
errInfo.append(prop.getProperty("client_port_mask")
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
}
if (m1.matches()) {
Integer destPort = Integer.parseInt(destPortStr.split("/")[0]);
Integer destPortMask = Integer.parseInt(destPortStr.split("/")[1]);
if (destPort < 0 || destPort > 65535) {
errInfo.append(prop.getProperty("server_port")
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
if (destPortMask < 0 || destPortMask > 65535) {
errInfo.append(prop.getProperty("server_port_mask")
errInfo.append(prop.getProperty(portName+"_mask")
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
}
if (m2.matches()) {
try {
Integer srcPort = Integer.parseInt(srcPortStr);
Integer srcPort = Integer.parseInt(portStr);
if (srcPort < 0 || srcPort > 65535) {
errInfo.append(prop.getProperty("client_port")
errInfo.append(prop.getProperty(portName)
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
} catch (Exception e) {
// TODO: handle exception
errInfo.append(
String.format(prop.getProperty("not_number"), prop.getProperty("client_port")) + ";");
String.format(prop.getProperty("not_number"), prop.getProperty(portName)) + ";");
valid = false;
}
}
if (m3.matches()) {
try {
Integer destPort = Integer.parseInt(destPortStr);
if (destPort < 0 || destPort > 65535) {
errInfo.append(prop.getProperty("server_port")
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
} catch (Exception e) {
// TODO: handle exception
errInfo.append(
String.format(prop.getProperty("not_number"), prop.getProperty("server_port")) + ";");
valid = false;
}
}
if ((m.matches() && m3.matches()) || (m2.matches() && m1.matches())) {
errInfo.append(prop.getProperty("the_same_port_pattern") + ";");
valid = false;
}
if (!m.matches() && !m2.matches()) {
errInfo.append(
String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty("client_port")) + ";");
String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty(portName)) + ";");
valid = false;
}
if (!m1.matches() && !m3.matches()) {
errInfo.append(
String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty("server_port")) + ";");
valid = false;
}
}
return valid;
}
@@ -1369,7 +1329,44 @@ public class CheckIpFormatThread implements Callable<String>{
}
return matchType;
}
public void ValidateRangeCross(String srcIp,String destIp,StringBuffer errInfo) {
long srcStart=0l,srcEnd=0,srcNum=0l,destStart=0l,destEnd=0l,destNum=0l;
if(srcIp.indexOf("-")>-1) {
String[] srcArr=srcIp.split("\\-");
srcStart=IPUtil.getIpHostDesimal(srcArr[0]);
srcEnd=IPUtil.getIpHostDesimal(srcArr[1]);
}else if(srcIp.indexOf("/")>-1) {
srcNum=IPUtil.getIpHostDesimal(srcIp.split("/")[0]);
}else {
srcNum=IPUtil.getIpHostDesimal(srcIp);
}
if(destIp.indexOf("-")>-1) {
String[] destArr=destIp.split("\\-");
destStart=IPUtil.getIpHostDesimal(destArr[0]);
destEnd=IPUtil.getIpHostDesimal(destArr[1]);
}else if(destIp.indexOf("/")>-1) {
destNum=IPUtil.getIpHostDesimal(destIp.split("/")[0]);
}else {
destNum=IPUtil.getIpHostDesimal(destIp);
}
if(srcNum==0l) {
if(destNum==0l) {
if(!(destEnd<srcStart||srcEnd<destStart)) {
errInfo.append(prop.getProperty("range_cross")+";");
}
}else {
if(destNum>=srcStart&&destNum<=srcEnd) {
errInfo.append(prop.getProperty("range_cross")+";");
}
}
}else {
if(destNum==0l) {
if(srcNum>=destStart&&srcNum<=destEnd) {
errInfo.append(prop.getProperty("range_cross")+";");
}
}
}
}
public List<Map<Long, AsnGroupInfo>> getAsnNoMaps() {
return asnNoMaps;
}
@@ -1382,5 +1379,4 @@ public class CheckIpFormatThread implements Callable<String>{
public void setAsnGroupInfos(Map<Long, AsnGroupInfo> asnGroupInfos) {
this.asnGroupInfos = asnGroupInfos;
}
}

View File

@@ -23,6 +23,7 @@ import javax.ws.rs.client.Invocation.Builder;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.commons.collections.CollectionUtils;
import org.apache.http.HttpStatus;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.config.RequestConfig;
@@ -37,6 +38,7 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.util.EntityUtils;
import org.apache.log4j.Logger;
import com.alibaba.fastjson.JSON;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.Encodes;
@@ -236,6 +238,7 @@ public class HttpClientUtil {
* @return 查询结果数据json
*/
public static String getMsg(String destUrl, Map<String, Object> params, HttpServletRequest req) throws IOException {
long start=System.currentTimeMillis(), end=System.currentTimeMillis();
// RequestContext requestContext = new RequestContext(req);
// CloseableHttpResponse response = null;
@@ -283,6 +286,7 @@ public class HttpClientUtil {
logger.error("获取消息失败,相应内容如下: " + result);
throw new MaatConvertException(status+"");
}
} catch (Exception e) {
e.printStackTrace();
logger.error("获取消息失败,相应内容如下: " + result);
@@ -292,6 +296,8 @@ public class HttpClientUtil {
if (response != null) {
response.close();
}
end=System.currentTimeMillis();
logger.warn("getMsg cost:"+(end-start)+"ms");
}
return result;
}
@@ -302,12 +308,14 @@ public class HttpClientUtil {
* @return
*/
public static String galaxyMessageFormat(String recv){
JSONObject jobj = JSONObject.fromObject(recv);
long start=System.currentTimeMillis(),end=System.currentTimeMillis();
//JSONObject jobj = JSONObject.fromObject(recv);
com.alibaba.fastjson.JSONObject jobj = JSON.parseObject(recv);
Map<String, Object> parse = (Map<String, Object>)jobj;
Map map = (Map) parse.get("data");
List reslist=new ArrayList();
List<Map<String,Object>> list= (List)map.get("list");
if(list!=null&&list.size()>0){
if(CollectionUtils.isNotEmpty(list)){
for (Map<String,Object> m : list) {
Map recvMap = new HashMap();
Iterator<Entry<String, Object>> iterator = m.entrySet().iterator();
@@ -316,12 +324,12 @@ public class HttpClientUtil {
String key = next.getKey().toString();
Object value = next.getValue();
//处理字段为“null”情况
if(value!=null&&"null".equals(value)){
if("null".equals(value)){
value="";
}
//处理时间字段为“0”情况
if("foundTime".equals(key)||"recvTime".equals(key)){
if(null!=value&&"0".equals(value)){
if("0".equals(value)){
value="";
}
}
@@ -337,6 +345,8 @@ public class HttpClientUtil {
parse.put("data", map);
recv = parse.toString();
}
end=System.currentTimeMillis();
logger.info("galaxyMessageFormat cost:"+(end-start));
return recv;
}

View File

@@ -64,7 +64,6 @@ import com.nis.domain.configuration.BaseCfg;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.ComplexStringCfgTemplate;
import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.domain.configuration.DdosIpCfg;
import com.nis.domain.configuration.DnsIpCfg;
@@ -75,7 +74,6 @@ import com.nis.domain.configuration.PxyObjKeyring;
import com.nis.domain.configuration.PxyObjTrustedCaCert;
import com.nis.domain.configuration.PxyObjTrustedCaCrl;
import com.nis.domain.configuration.RequestInfo;
import com.nis.domain.configuration.StringCfgTemplate;
import com.nis.domain.configuration.template.AppDomainTemplate;
import com.nis.domain.configuration.template.AppPayloadTemplate;
import com.nis.domain.configuration.template.AsnIpTemplate;
@@ -100,7 +98,6 @@ import com.nis.domain.configuration.template.HttpsReplaceIpTemplate;
import com.nis.domain.configuration.template.HttpsReplaceTemplate;
import com.nis.domain.configuration.template.IpAllNotDoLogTemplate;
import com.nis.domain.configuration.template.IpAllTemplate;
import com.nis.domain.configuration.template.IpCfgTemplate;
import com.nis.domain.configuration.template.IpPayloadTemplate;
import com.nis.domain.configuration.template.IpRateLimitTemplate;
import com.nis.domain.configuration.template.IpSpoofingTemplate;
@@ -771,75 +768,6 @@ public class BaseController {
}
return msgProp;
}
@Deprecated
public void importCfgTemplate(HttpServletRequest request, HttpServletResponse response,
RedirectAttributes redirectAttributes, Integer functionId, Integer cfgRegionCode) {
Properties msgProp = getMsgProp();
try {
List<FunctionRegionDict> dictList = DictUtils.getFunctionRegionDictList(functionId);
for (FunctionRegionDict dict : dictList) {
if (dict.getConfigRegionCode() == cfgRegionCode) {
String fileName = dict.getConfigRegionValue() + ".xlsx";
if (dict.getRegionType() == 1) {
List<IpCfgTemplate> list = Lists.newArrayList();
list.add(new IpCfgTemplate());
new ExportExcel(new FunctionServiceDict(), new FunctionRegionDict(), msgProp, null,
IpCfgTemplate.class, 2).setDataList(msgProp, list, null)
.write(request, response, fileName).dispose();
} else if (dict.getRegionType() == 2) {
List<StringCfgTemplate> list = Lists.newArrayList();
list.add(new StringCfgTemplate());
new ExportExcel(new FunctionServiceDict(), new FunctionRegionDict(), msgProp, null,
StringCfgTemplate.class, 2).setDataList(msgProp, list, null)
.write(request, response, fileName).dispose();
} else if (dict.getRegionType() == 3) {
List<ComplexStringCfgTemplate> list = Lists.newArrayList();
list.add(new ComplexStringCfgTemplate());
new ExportExcel(new FunctionServiceDict(), new FunctionRegionDict(), msgProp, null,
ComplexStringCfgTemplate.class, 2).setDataList(msgProp, list, null)
.write(request, response, fileName).dispose();
}
}
}
} catch (Exception e) {
msgProp = null;
e.printStackTrace();
}
}
@Deprecated
public void importCfgTemplate(HttpServletRequest request, HttpServletResponse response,
RedirectAttributes redirectAttributes, Integer functionId, Integer cfgRegionCode, Class clazz) {
Properties msgProp = getMsgProp();
try {
List<FunctionRegionDict> dictList = DictUtils.getFunctionRegionDictList(functionId);
for (FunctionRegionDict dict : dictList) {
if (dict.getConfigRegionCode() == cfgRegionCode) {
String fileName = dict.getConfigRegionValue() + ".xlsx";
if (dict.getRegionType() == 1) {
List<IpCfgTemplate> list = Lists.newArrayList();
list.add((IpCfgTemplate) clazz.newInstance());
new ExportExcel(new FunctionServiceDict(), new FunctionRegionDict(), msgProp, null, clazz, 2)
.setDataList(msgProp, list, null).write(request, response, fileName).dispose();
} else if (dict.getRegionType() == 2) {
List<StringCfgTemplate> list = Lists.newArrayList();
list.add(new StringCfgTemplate());
new ExportExcel(new FunctionServiceDict(), new FunctionRegionDict(), msgProp, null, clazz, 2)
.setDataList(msgProp, list, null).write(request, response, fileName).dispose();
} else if (dict.getRegionType() == 3) {
List<ComplexStringCfgTemplate> list = Lists.newArrayList();
list.add(new ComplexStringCfgTemplate());
new ExportExcel(new FunctionServiceDict(), new FunctionRegionDict(), msgProp, null, clazz, 2)
.setDataList(msgProp, list, null).write(request, response, fileName).dispose();
}
}
}
} catch (Exception e) {
msgProp = null;
e.printStackTrace();
}
}
public void setLogAction(BaseLogEntity log, List<FunctionServiceDict> serviceList) {
if (!StringUtil.isEmpty(serviceList)) {
@@ -2821,45 +2749,6 @@ public class BaseController {
//全部审核通过,只查询当前条件下的所有未审核的配置 -批量审核通过/不通过
if(auditType.equals(1) || auditType.equals(2)) {
searchCfg.setIsValid(0);
searchCfg.setIsAudit(0);
searchAppCfg.setIsValid(0);
searchAppCfg.setIsAudit(0);
searchDigestCfg.setIsValid(0);
searchDigestCfg.setIsAudit(0);
searchFileSampleCfg.setIsValid(0);
searchFileSampleCfg.setIsAudit(0);
searchObjKeyringCfg.setIsValid(0);
searchObjKeyringCfg.setIsAudit(0);
searchTrustedCaCertCfg.setIsValid(0);
searchTrustedCaCertCfg.setIsAudit(0);
searchTrustedCaCrlCfg.setIsValid(0);
searchTrustedCaCrlCfg.setIsAudit(0);
searchDnsResStrategy.setIsValid(0);
searchDnsResStrategy.setIsAudit(0);
searchDnsIpCfg.setIsValid(0);
searchDnsIpCfg.setIsAudit(0);
searchIpPortCfg.setIsValid(0);
searchIpPortCfg.setIsAudit(0);
searchSignSampleCfg.setIsValid(0);
searchSignSampleCfg.setIsAudit(0);
searchDdosIpCfg.setIsValid(0);
searchDdosIpCfg.setIsAudit(0);
searchAppIpCfg.setIsValid(0);
searchAppIpCfg.setIsAudit(0);
searchAppHttpCfg.setIsValid(0);
searchAppHttpCfg.setIsAudit(0);
searchAppDomainCfg.setIsValid(0);
searchAppDomainCfg.setIsAudit(0);
searchAppTopicCfg.setIsValid(0);
searchAppTopicCfg.setIsAudit(0);
searchAppFeatureIndex.setIsValid(0);
searchAppFeatureIndex.setIsAudit(0);
searchAppSslCertCfg.setIsValid(0);
searchAppSslCertCfg.setIsAudit(0);
searchAsnIpCfg.setIsValid(0);
searchAsnIpCfg.setIsAudit(0);
if(auditType.equals(1)) {
auditBatchCfg.setIsAudit(1);
auditBatchCfg.setIsValid(1);
@@ -2870,45 +2759,6 @@ public class BaseController {
auditBatchCfg.setAuditTime(new Date());
auditBatchCfg.setAuditorId(UserUtils.getUser().getId());
}else {
//全部取消通过,只查询当前条件下的所有审核通过的配置
searchCfg.setIsValid(1);
searchCfg.setIsAudit(1);
searchAppCfg.setIsValid(1);
searchAppCfg.setIsAudit(1);
searchDigestCfg.setIsValid(1);
searchDigestCfg.setIsAudit(1);
searchFileSampleCfg.setIsValid(1);
searchFileSampleCfg.setIsAudit(1);
searchObjKeyringCfg.setIsValid(1);
searchObjKeyringCfg.setIsAudit(1);
searchTrustedCaCertCfg.setIsValid(1);
searchTrustedCaCertCfg.setIsAudit(1);
searchTrustedCaCrlCfg.setIsValid(1);
searchTrustedCaCrlCfg.setIsAudit(1);
searchDnsResStrategy.setIsValid(1);
searchDnsResStrategy.setIsAudit(1);
searchDnsIpCfg.setIsValid(1);
searchDnsIpCfg.setIsAudit(1);
searchIpPortCfg.setIsValid(1);
searchIpPortCfg.setIsAudit(1);
searchSignSampleCfg.setIsValid(1);
searchSignSampleCfg.setIsAudit(1);
searchDdosIpCfg.setIsValid(1);
searchDdosIpCfg.setIsAudit(1);
searchAppIpCfg.setIsValid(1);
searchAppIpCfg.setIsAudit(1);
searchAppHttpCfg.setIsValid(1);
searchAppHttpCfg.setIsAudit(1);
searchAppDomainCfg.setIsValid(1);
searchAppDomainCfg.setIsAudit(1);
searchAppTopicCfg.setIsValid(1);
searchAppTopicCfg.setIsAudit(1);
searchAppFeatureIndex.setIsValid(1);
searchAppFeatureIndex.setIsAudit(1);
searchAppSslCertCfg.setIsValid(1);
searchAppSslCertCfg.setIsAudit(1);
searchAsnIpCfg.setIsValid(1);
searchAsnIpCfg.setIsAudit(1);
auditBatchCfg.setIsAudit(3);
auditBatchCfg.setIsValid(0);
@@ -3368,11 +3218,42 @@ public class BaseController {
//批量审核通过时如果没有携带isValid检索条件返回界面需要将isValid置为null
if(!StringUtil.isEmpty(entity)) {
BaseCfg base=(BaseCfg)entity ;
if(!StringUtil.isEmpty(base.getSeltype()) && !base.getSeltype().equals("isValid")) {
base.setIsValid(null);
BeanUtils.copyProperties(base, entity);
base.setBatchAuditValue("");
base.setBatchValidValue("");
//配置目标状态1 1 生效,isAudit条件置为1有selType条件,且不是isValid不改没有sel改为isValid并且为1
if(base.getIsAudit()==1 && base.getIsValid()==1){
base.setIsAudit(1);
if(!StringUtil.isEmpty(base.getSeltype()) && !base.getSeltype().equals("isValid")) {
base.setIsValid(null);
}else{
base.setIsValid(1);
base.setSeltype("isValid");
}
}
//配置目标状态2 0 不通过,isAudit条件置为2有selType条件,且不是isValid不改没有sel改为isValid并且为0
if(base.getIsAudit()==2 && base.getIsValid()==0){
base.setIsAudit(2);
if(!StringUtil.isEmpty(base.getSeltype()) && !base.getSeltype().equals("isValid")) {
base.setIsValid(null);
}else{
base.setIsValid(0);
base.setSeltype("isValid");
}
}
//配置目标状态3 0 取消
if(base.getIsAudit()==3 && base.getIsValid()==0){
base.setIsAudit(3);
if(!StringUtil.isEmpty(base.getSeltype()) && !base.getSeltype().equals("isValid")) {
base.setIsValid(null);
}else{
base.setIsValid(0);
base.setSeltype("isValid");
}
}
BeanUtils.copyProperties(base, entity);
}
long end=System.currentTimeMillis();
logger.warn("配置批量生效/失效耗时:"+(end-start));
}
@@ -3391,7 +3272,6 @@ public class BaseController {
page.setPageNo(1);
page.setLastPage(false);
// 只有未审核的配置可删除
CfgIndexInfo searchCfg = new CfgIndexInfo();
AppPolicyCfg searchAppCfg=new AppPolicyCfg();
FileDigestCfg searchDigestCfg=new FileDigestCfg();
@@ -3414,108 +3294,76 @@ public class BaseController {
// 传递检索条件
if(entity != null && (entity instanceof CfgIndexInfo)) {
BeanUtils.copyProperties(entity, searchCfg);
searchCfg.setIsValid(0);
searchCfg.setIsAudit(0);
searchCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof AppPolicyCfg)) {
BeanUtils.copyProperties(entity, searchAppCfg);
searchAppCfg.setIsValid(0);
searchAppCfg.setIsAudit(0);
searchAppCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof FileDigestCfg)) {
BeanUtils.copyProperties(entity, searchDigestCfg);
searchDigestCfg.setIsValid(0);
searchDigestCfg.setIsAudit(0);
searchDigestCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof AvFileSampleCfg)) {
BeanUtils.copyProperties(entity, searchFileSampleCfg);
searchFileSampleCfg.setIsValid(0);
searchFileSampleCfg.setIsAudit(0);
searchFileSampleCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof DdosIpCfg)) {
BeanUtils.copyProperties(entity, searchDdosIpCfg);
searchDdosIpCfg.setIsValid(0);
searchDdosIpCfg.setIsAudit(0);
searchDdosIpCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof AppHttpCfg)) {
BeanUtils.copyProperties(entity, searchAppHttpCfg);
searchAppHttpCfg.setIsValid(0);
searchAppHttpCfg.setIsAudit(0);
searchAppHttpCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof AppHttpCfg)) {
BeanUtils.copyProperties(entity, searchAppHttpCfg);
searchAppHttpCfg.setIsValid(0);
searchAppHttpCfg.setIsAudit(0);
searchAppHttpCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof AppDomainCfg)) {
BeanUtils.copyProperties(entity, searchAppDomainCfg);
searchAppDomainCfg.setIsValid(0);
searchAppDomainCfg.setIsAudit(0);
searchAppDomainCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof AppTopicDomainCfg)) {
BeanUtils.copyProperties(entity, searchAppTopicCfg);
searchAppTopicCfg.setIsValid(0);
searchAppTopicCfg.setIsAudit(0);
searchAppTopicCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof AppSslCertCfg)) {
BeanUtils.copyProperties(entity, searchAppSslCertCfg);
searchAppSslCertCfg.setIsValid(0);
searchAppSslCertCfg.setIsAudit(0);
searchAppSslCertCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof AppIpCfg)) {
BeanUtils.copyProperties(entity, searchAppIpCfg);
searchAppIpCfg.setIsValid(0);
searchAppIpCfg.setIsAudit(0);
searchAppIpCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof AppFeatureIndex)) {
BeanUtils.copyProperties(entity, searchAppFeatureIndex);
searchAppFeatureIndex.setIsValid(0);
searchAppFeatureIndex.setIsAudit(0);
searchAppFeatureIndex.setFunctionId(functionId);
}
if(entity != null && (entity instanceof DnsResStrategy)) {
BeanUtils.copyProperties(entity, searchDnsResStrategy);
searchDnsResStrategy.setIsValid(0);
searchDnsResStrategy.setIsAudit(0);
searchDnsResStrategy.setFunctionId(functionId);
}
if(entity != null && (entity instanceof DnsIpCfg)) {
BeanUtils.copyProperties(entity, searchDnsIpCfg);
searchDnsIpCfg.setIsValid(0);
searchDnsIpCfg.setIsAudit(0);
searchDnsIpCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof PxyObjKeyring)) {
BeanUtils.copyProperties(entity, searchObjKeyringCfg);
searchObjKeyringCfg.setIsValid(0);
searchObjKeyringCfg.setIsAudit(0);
searchObjKeyringCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof PxyObjTrustedCaCert)) {
BeanUtils.copyProperties(entity, searchTrustedCaCertCfg);
searchTrustedCaCertCfg.setIsValid(0);
searchTrustedCaCertCfg.setIsAudit(0);
searchTrustedCaCertCfg.setFunctionId(functionId);
}
if(entity != null && (entity instanceof AsnIpCfg)) {
BeanUtils.copyProperties(entity, searchAsnIpCfg);
searchAsnIpCfg.setIsValid(0);
searchAsnIpCfg.setIsAudit(0);
searchAsnIpCfg.setFunctionId(functionId);
}
BaseCfg batchCfg = new BaseCfg();
batchCfg.setIsValid(-1);
batchCfg.setIsAudit(0);
batchCfg.setEditTime(new Date());
batchCfg.setEditorId(UserUtils.getUser().getId());
@@ -3869,7 +3717,8 @@ public class BaseController {
maatBean = new ToMaatBean();
configCompileList = new ArrayList();
List list = new ArrayList();
List newList = new ArrayList();
List notAuditList = new ArrayList();
List auditList = new ArrayList();
List ids = new ArrayList();
List<Integer> compileIds = Lists.newArrayList();
if(entity.getServiceId().equals(3)){//ip drop回调类配置用了主表和子表关系
@@ -3882,9 +3731,22 @@ public class BaseController {
List subList = commonPolicyService.getIpDropList("ip_port_cfg", compileIds);
for(int i=0;i<subList.size();i++){
IpPortCfg cfg = (IpPortCfg) subList.get(i);
cfg.setIsValid(entity.getIsValid());
cfg.setAuditTime(entity.getAuditTime());
newList.add(BaseService.convertCallBackIp(cfg,cfg.getGroupId()));
if(cfg.getIsValid()==1) {
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
//auditList.add(BaseService.convertCallBackIp(cfg,cfg.getGroupId())); // 移至下发前处理
auditList.add(cfg);
}else {
//定时任务审核通过,配置已经失效,则
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
//notAuditList.add(BaseService.convertCallBackIp(cfg,cfg.getGroupId())); // 移至下发前处理
notAuditList.add(cfg);
}
}
}
@@ -3893,47 +3755,108 @@ public class BaseController {
list = avCfgService.getAvFileSampleList(page,searchFileSampleCfg).getList();
for(int i=0;i<list.size();i++){
BaseCfg cfg = (BaseCfg) list.get(i);
cfg.setIsValid(entity.getIsValid());
cfg.setAuditTime(entity.getAuditTime());
ids.add(cfg.getCompileId());
newList.add(cfg);
if(cfg.getIsValid()==1) {
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
auditList.add(cfg);
}else {
//定时任务审核通过,配置已经失效,则
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
notAuditList.add(cfg);
}
}
}else if(className.equals("AvSignSampleCfg")){
list = avCfgService.getSignSampleList(searchSignSampleCfg);
for(int i=0;i<list.size();i++){
BaseCfg cfg = (BaseCfg) list.get(i);
cfg.setIsValid(entity.getIsValid());
cfg.setAuditTime(entity.getAuditTime());
ids.add(cfg.getCompileId());
newList.add(cfg);
if(cfg.getIsValid()==1) {
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
auditList.add(cfg);
}else {
//定时任务审核通过,配置已经失效,则
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
notAuditList.add(cfg);
}
}
}else if(className.equals("PxyObjKeyring")){
list = pxyObjKeyringService.findPage(page, searchObjKeyringCfg).getList();
for(int i=0;i<list.size();i++){
PxyObjKeyring cfg = (PxyObjKeyring) list.get(i);
cfg.setIsValid(entity.getIsValid());
cfg.setAuditTime(entity.getAuditTime());
newList.add(BaseService.convertCallBackProxyObjKeyring(cfg));
ids.add(cfg.getCompileId());
/*newList.add(cfg);*/
if(cfg.getIsValid()==1) {
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
//auditList.add(BaseService.convertCallBackProxyObjKeyring(cfg)); // 移至下发前处理
auditList.add(cfg);
}else {
//定时任务审核通过,配置已经失效,则
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
//notAuditList.add(BaseService.convertCallBackProxyObjKeyring(cfg)); // 移至下发前处理
notAuditList.add(cfg);
}
}
}else if(className.equals("PxyObjTrustedCaCert")){
list = pxyObjKeyringService.findTrustedCertPage(page,searchTrustedCaCertCfg).getList();
for(int i=0;i<list.size();i++){
PxyObjTrustedCaCert cfg = (PxyObjTrustedCaCert) list.get(i);
cfg.setIsValid(entity.getIsValid());
cfg.setAuditTime(entity.getAuditTime());
newList.addAll(BaseService.convertCallBackProxyObjTrustedCa(cfg,null));
ids.add(cfg.getCompileId());
if(cfg.getIsValid()==1) {
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
//auditList.addAll(BaseService.convertCallBackProxyObjTrustedCa(cfg,null)); // 移至下发前处理
auditList.add(cfg);
}else {
//定时任务审核通过,配置已经失效,则
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
//notAuditList.addAll(BaseService.convertCallBackProxyObjTrustedCa(cfg,null)); // 移至下发前处理
notAuditList.add(cfg);
}
}
if(!StringUtil.isEmpty(ids)) {
list=new ArrayList<>();
list=commonPolicyService.getPxyObjTrustedCrlCfgListByCertId(ids);
for(int i=0;i<list.size();i++){
PxyObjTrustedCaCrl cfg = (PxyObjTrustedCaCrl) list.get(i);
cfg.setIsValid(entity.getIsValid());
cfg.setAuditTime(entity.getAuditTime());
newList.addAll(BaseService.convertCallBackProxyObjTrustedCa(null,cfg));
if(cfg.getIsValid()==1) {
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
//auditList.addAll(BaseService.convertCallBackProxyObjTrustedCa(null,cfg)); // 移至下发前处理
auditList.add(cfg);
}else {
//定时任务审核通过,配置已经失效,则
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
//notAuditList.addAll(BaseService.convertCallBackProxyObjTrustedCa(null,cfg)); // 移至下发前处理
notAuditList.add(cfg);
}
}
}
}/*//批量下发时不需要单独下发CRL
@@ -3948,28 +3871,65 @@ public class BaseController {
list = dnsResStrategyService.findPage(page,searchDnsResStrategy).getList();
for(int i=0;i<list.size();i++){
DnsResStrategy cfg = (DnsResStrategy) list.get(i);
cfg.setIsValid(entity.getIsValid());
cfg.setAuditTime(entity.getAuditTime());
newList.add(BaseService.convertCallBackDnsResStrategy(cfg));
ids.add(cfg.getCompileId());
if(cfg.getIsValid()==1) {
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
//auditList.add(BaseService.convertCallBackDnsResStrategy(cfg)); // 移至下发前处理
auditList.add(cfg);
}else {
//定时任务审核通过,配置已经失效,则
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
//notAuditList.add(BaseService.convertCallBackDnsResStrategy(cfg)); // 移至下发前处理
notAuditList.add(cfg);
}
}
}else if(className.equals("DnsIpCfg")){
list = dnsIpCfgService.findPage(page,searchDnsIpCfg).getList();
for(int i=0;i<list.size();i++){
DnsIpCfg cfg = (DnsIpCfg) list.get(i);
cfg.setIsValid(entity.getIsValid());
cfg.setAuditTime(entity.getAuditTime());
newList.add(BaseService.convertCallBackIp(cfg,cfg.getDnsStrategyId()));
ids.add(cfg.getCompileId());
if(cfg.getIsValid()==1) {
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
//auditList.add(BaseService.convertCallBackIp(cfg,cfg.getDnsStrategyId())); // 移至下发前处理
auditList.add(cfg);
}else {
//定时任务审核通过,配置已经失效,则
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
//notAuditList.add(BaseService.convertCallBackIp(cfg,cfg.getDnsStrategyId()));
notAuditList.add(cfg);
}
}
}else if(className.equals("IpPortCfg")){
list = commonPolicyService.getIpPortList(searchIpPortCfg);
for(int i=0;i<list.size();i++){
IpPortCfg cfg = (IpPortCfg) list.get(i);
cfg.setIsValid(entity.getIsValid());
cfg.setAuditTime(entity.getAuditTime());
newList.add(BaseService.convertCallBackIp(cfg,cfg.getGroupId()));
ids.add(cfg.getCompileId());
if(cfg.getIsValid()==1) {
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
auditList.add(BaseService.convertCallBackIp(cfg,cfg.getGroupId()));
}else {
//定时任务审核通过,配置已经失效,则
cfg.setIsValid(entity.getIsValid());
cfg.setIsAudit(entity.getIsAudit());
cfg.setAuditTime(entity.getAuditTime());
cfg.setAuditorId(entity.getAuditorId());
notAuditList.add(BaseService.convertCallBackIp(cfg,cfg.getGroupId()));
}
}
}
}
@@ -3978,9 +3938,9 @@ public class BaseController {
hasData = false;
}
if(!StringUtil.isEmpty(newList)) {
if(!StringUtil.isEmpty(auditList) || !StringUtil.isEmpty(notAuditList)) {
//批量修改和下发回调配置
commonPolicyService.auditCallBackData(newList, compileIds, ids, entity);
commonPolicyService.auditCallBackData(auditList,notAuditList, compileIds, ids, entity);
}else {
hasData = false;
}

View File

@@ -29,6 +29,7 @@ import com.google.gson.reflect.TypeToken;
import com.nis.util.Configurations;
import com.nis.util.Constants;
import com.nis.util.CookieUtil;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.util.httpclient.HttpClientUtil;
@@ -87,6 +88,7 @@ public class LoginController extends BaseController {
CookieUtil.addCookie(response, "LOGINED", "false");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
LogUtils.saveLog(request, null, e, null);
}
}
@@ -173,6 +175,7 @@ public class LoginController extends BaseController {
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
LogUtils.saveLog(request, null, e, null);
}
@@ -212,6 +215,7 @@ public class LoginController extends BaseController {
} catch (Exception e) {
e.printStackTrace();
LogUtils.saveLog(request, null, e, null);
}
return "redirect:"+request.getParameter("url");
@@ -230,6 +234,7 @@ public class LoginController extends BaseController {
} catch (Exception e) {
e.printStackTrace();
LogUtils.saveLog(request, null, e, null);
}
return "redirect:"+request.getParameter("url");

View File

@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import com.nis.domain.SysMenu;
import com.nis.domain.configuration.HelpInfo;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.web.security.UserUtils;
@@ -106,6 +107,7 @@ public class SystemController extends BaseController{
}
} catch (Exception e) {
logger.error("help error",e);
LogUtils.saveLog(request, null, e, null);
}
logger.info("menuSize:"+newList.size());
model.addAttribute("menuList",newList);
@@ -139,6 +141,7 @@ public class SystemController extends BaseController{
}
} catch (Exception e) {
logger.error("save helpInfo error",e);
LogUtils.saveLog(request, null, e, null);
}
return false;
}
@@ -167,6 +170,7 @@ public class SystemController extends BaseController{
}
} catch (Exception e) {
logger.error("view helpInfo error",e);
LogUtils.saveLog(request, null, e, null);
}
return null;
}
@@ -195,6 +199,7 @@ public class SystemController extends BaseController{
}
} catch (Exception e) {
logger.error("view helpBakInfo error",e);
LogUtils.saveLog(request, null, e, null);
}
return null;
}
@@ -204,11 +209,10 @@ public class SystemController extends BaseController{
public boolean clearPolicies(HttpServletRequest request, HttpServletResponse response) {
try {
systemService.clearPolicies();
/*ArrayList<Object> list = Lists.newArrayList();
System.out.println(list.get(6));*/
return true;
} catch (Exception e) {
logger.error("Clear Policies Error",e);
LogUtils.saveLog(request, null, e, null);
}
return false;
}

View File

@@ -18,6 +18,7 @@ import com.nis.domain.Page;
import com.nis.domain.basics.AsnGroupInfo;
import com.nis.domain.basics.AsnIpCfg;
import com.nis.domain.specific.ConfigGroupInfo;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
/**
@@ -67,7 +68,7 @@ public class AsnGroupController extends BaseController {
//@RequiresPermissions(value={"basics:classification:add","basics:attribute:add","basics:label:add","basics:classification:edit","basics:attribute:edit","basics:label:edit"},logical=Logical.OR)
@RequestMapping(value = "saveOrUpdate")
public String saveOrUpdate(AsnGroupInfo cfg,Model model,
RedirectAttributes redirectAttributes,String itType) {
RedirectAttributes redirectAttributes,String itType,HttpServletRequest request) {
try {
AsnGroupInfo asnGroup=asnGroupInfoService.getGroupIdByNameAndASNId(cfg.getOrganization().trim(), cfg.getCountry().trim(), cfg.getAsnId());
@@ -80,6 +81,7 @@ public class AsnGroupController extends BaseController {
} catch (Exception e) {
logger.error("新增失败",e);
addMessage(redirectAttributes,"error","save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/basics/asnGroup/asnGroupList";
@@ -94,13 +96,14 @@ public class AsnGroupController extends BaseController {
*/
//@RequiresPermissions(value={"basics:classification:del","basics:attribute:del","basics:label:del"},logical=Logical.OR)
@RequestMapping(value={"delete"})
public String delete(RedirectAttributes redirectAttributes,String ids,String asnIds) {
public String delete(RedirectAttributes redirectAttributes,String ids,String asnIds,HttpServletRequest request) {
try {
asnGroupInfoService.delete(ids,asnIds);
addMessage(redirectAttributes,"success","delete_success");
} catch (Exception e) {
logger.error("删除失败",e);
addMessage(redirectAttributes,"error","delete_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/basics/asnGroup/asnGroupList";
}

View File

@@ -32,6 +32,7 @@ import com.nis.exceptions.MaatConvertException;
//import com.nis.util.AsnCacheUtils;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -79,15 +80,21 @@ public class AsnIpController extends BaseController{
public String save(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")CfgIndexInfo cfg,RedirectAttributes redirectAttributes){
try{
asnIpCfgService.saveAsnIpCfg(cfg);
addMessage(redirectAttributes,"success","save_success");
}catch(Exception e){
logger.error("信息保存失败",e);
e.printStackTrace();
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error",e.getMessage());
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
addMessage(redirectAttributes,"error","save_failed");
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("ASN IP配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("ASN IP配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath +"/basics/asn/list?functionId="+cfg.getFunctionId();
@@ -98,11 +105,21 @@ public class AsnIpController extends BaseController{
try{
asnIpCfgService.update(cfg);
addMessage(redirectAttributes,"success","save_success");
}catch(Exception e){
logger.error("信息保存失败",e);
e.printStackTrace();
addMessage(redirectAttributes,"error","save_failed");
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("ASN IP配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("ASN IP配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath +"/basics/asn/list?functionId="+cfg.getFunctionId();
@@ -148,8 +165,10 @@ public class AsnIpController extends BaseController{
logger.error("配置下发失败:",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -175,8 +194,10 @@ public class AsnIpController extends BaseController{
logger.error("Delete failed",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error",e.getMessage());
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error","delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -265,6 +286,7 @@ public class AsnIpController extends BaseController{
} catch (Exception e) {
logger.error("asnIp export failed",e);
addMessage(redirectAttributes,"error","export_failed");
LogUtils.saveLog(request, null, e, null);
}
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
}

View File

@@ -15,6 +15,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page;
import com.nis.domain.basics.ProtectionListInfo;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
@@ -49,25 +50,27 @@ public class InnerProtectionListController extends BaseController{
@RequestMapping(value = "saveOrUpdate")
public String saveOrUpdate(ProtectionListInfo cfg,Model model,String itType,Integer groupType,
RedirectAttributes redirectAttributes) {
RedirectAttributes redirectAttributes,HttpServletRequest request) {
try {
innerProtectionListService.saveOrUpdate(cfg);
addMessage(redirectAttributes,"success","save_success");
} catch (Exception e) {
logger.error("新增失败",e);
addMessage(redirectAttributes,"error","save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/basics/innerProtectionList/list";
}
@RequestMapping(value={"delete"})
public String delete(RedirectAttributes redirectAttributes,String ids,int isValid) {
public String delete(RedirectAttributes redirectAttributes,String ids,int isValid,HttpServletRequest request) {
try {
innerProtectionListService.deldete(ids,isValid);
addMessage(redirectAttributes,"success","delete_success");
} catch (Exception e) {
logger.error("删除失败",e);
addMessage(redirectAttributes,"error","delete_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/basics/innerProtectionList/list";
}
@@ -77,4 +80,31 @@ public class InnerProtectionListController extends BaseController{
public Map<String,List<String>> ajaxGetAllInfo(HttpServletRequest request, HttpServletResponse response){
return innerProtectionListService.ajaxGetAllInfo();
}
/**
* 校验配置是否已存在
* @param cfg
* @param request
* @param response
* @return
*/
@ResponseBody
@RequestMapping(value = {"/checkKeywordExist"})
public boolean checkKeywordExist(ProtectionListInfo cfg, HttpServletRequest request, HttpServletResponse response){
if(!StringUtil.isEmpty(cfg.getProId())){ // 修改操作
ProtectionListInfo info = innerProtectionListService.getById(cfg.getProId());
if(info != null && info.getKeyword().equals(cfg.getKeyword()) && info.getTargetType().equals(cfg.getTargetType())){
return true;
}
}
Map<String, List<String>> map = innerProtectionListService.ajaxGetAllInfo();
List<String> list = map.get(cfg.getTargetType());
if(list != null) {
if(list.contains(cfg.getKeyword())) {
return false;
}
}
return true;
}
}

View File

@@ -20,6 +20,7 @@ import com.nis.domain.basics.IpReuseIpCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.web.controller.BaseController;
@Controller
@RequestMapping(value = "${adminPath}/basics/vpn")
@@ -75,6 +76,7 @@ public class IpReuseIpCfgController extends BaseController{
logger.error("信息保存失败",e);
e.printStackTrace();
addMessage(redirectAttributes,"error","save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath +"/basics/vpn/list?functionId="+entity.getFunctionId();
}
@@ -91,6 +93,7 @@ public class IpReuseIpCfgController extends BaseController{
logger.error("信息保存失败",e);
e.printStackTrace();
addMessage(redirectAttributes,"error","save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath +"/basics/vpn/list?functionId="+cfg.getFunctionId();
}
@@ -98,7 +101,7 @@ public class IpReuseIpCfgController extends BaseController{
@RequiresPermissions(value={"asn:ip:config"})
public String delete(Integer isValid
,String ids,Integer functionId
,RedirectAttributes redirectAttributes){
,RedirectAttributes redirectAttributes,HttpServletRequest request){
try{
ipReuseIpCfgService.delete(isValid,ids);
addMessage(redirectAttributes,"success","delete_success");
@@ -106,8 +109,10 @@ public class IpReuseIpCfgController extends BaseController{
logger.error("Delete failed",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error",e.getMessage());
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error","delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}

View File

@@ -21,6 +21,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page;
import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.util.Constants;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
/**
@@ -71,7 +72,7 @@ public class PolicyGroupController extends BaseController {
//@RequiresPermissions(value={"basics:classification:add","basics:attribute:add","basics:label:add","basics:classification:edit","basics:attribute:edit","basics:label:edit"},logical=Logical.OR)
@RequestMapping(value = "saveOrUpdate")
public String saveOrUpdate(PolicyGroupInfo cfg,Model model,
RedirectAttributes redirectAttributes,String itType,Integer groupType) {
RedirectAttributes redirectAttributes,String itType,Integer groupType,HttpServletRequest request) {
try {
policyGroupInfoService.saveOrUpdate(cfg);
@@ -79,6 +80,7 @@ public class PolicyGroupController extends BaseController {
} catch (Exception e) {
logger.error("新增失败",e);
addMessage(redirectAttributes,"error","save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/basics/policyGroup/policyGroupList?groupType="+groupType;
@@ -93,13 +95,14 @@ public class PolicyGroupController extends BaseController {
*/
//@RequiresPermissions(value={"basics:classification:del","basics:attribute:del","basics:label:del"},logical=Logical.OR)
@RequestMapping(value={"delete"})
public String delete(RedirectAttributes redirectAttributes, Integer groupType,String ids,int isValid) {
public String delete(RedirectAttributes redirectAttributes, Integer groupType,String ids,int isValid,HttpServletRequest request) {
try {
policyGroupInfoService.deldete(ids,isValid);
addMessage(redirectAttributes,"success","delete_success");
} catch (Exception e) {
logger.error("删除失败",e);
addMessage(redirectAttributes,"error","delete_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/basics/policyGroup/policyGroupList?groupType="+groupType;
}
@@ -194,6 +197,7 @@ public class PolicyGroupController extends BaseController {
} catch (Exception e) {
logger.error("Group export failed",e);
addMessage(redirectAttributes,"error","export_failed");
LogUtils.saveLog(request, null, e, null);
}
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
}

View File

@@ -29,6 +29,7 @@ import com.nis.util.ConfigDictUtils;
import com.nis.util.Configurations;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.web.controller.BaseController;
@@ -52,7 +53,7 @@ public class ServiceDictInfoController extends BaseController {
@ResponseBody
@RequestMapping(value="requestCancleInfoAjax", method = RequestMethod.POST)
public String requestCancleInfoAjax(Integer cancelRequestId,String ids,String indexTable){
public String requestCancleInfoAjax(Integer cancelRequestId,String ids,String indexTable,HttpServletRequest request){
if(!StringUtil.isEmpty(ids)){
String[] idArray = ids.split(",");
for(String id :idArray){
@@ -61,6 +62,7 @@ public class ServiceDictInfoController extends BaseController {
} catch (Exception e) {
e.printStackTrace();
logger.error("审核添加取消来函信息失败",e);
LogUtils.saveLog(request, null, e, null);
return "false";
}
}
@@ -76,7 +78,7 @@ public class ServiceDictInfoController extends BaseController {
*/
@ResponseBody
@RequestMapping(value="requestCancleInfoNumber")
public Map requestCancleInfoNumber(String ids,String indexTable){
public Map requestCancleInfoNumber(String ids,String indexTable,HttpServletRequest request){
List list = new ArrayList();
String requestTitle="";
Map map=new HashMap();
@@ -94,6 +96,7 @@ public class ServiceDictInfoController extends BaseController {
} catch (Exception e) {
e.printStackTrace();
logger.error("查询取消审核来函信息失败",e);
LogUtils.saveLog(request, null, e, null);
return map;
}
// }
@@ -207,7 +210,7 @@ public class ServiceDictInfoController extends BaseController {
*/
@RequiresPermissions(value={"basics:classification:add","basics:attribute:add","basics:label:add","basics:vpn_ip:add","basics:classification:edit","basics:attribute:edit","basics:label:edit","basics:vpn_ip:edit"},logical=Logical.OR)
@RequestMapping(value = "saveOrUpdate")
public String saveOrUpdate(ServiceDictInfo serviceDictInfo,Model model, RedirectAttributes redirectAttributes,String itType) {
public String saveOrUpdate(ServiceDictInfo serviceDictInfo,Model model, RedirectAttributes redirectAttributes,String itType,HttpServletRequest request) {
try {
serviceDictInfoService.saveOrUpdate(serviceDictInfo);
@@ -215,6 +218,7 @@ public class ServiceDictInfoController extends BaseController {
} catch (Exception e) {
e.printStackTrace();
addMessage(redirectAttributes,"error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/basics/serviceDictInfo/list?itType="+itType;
@@ -231,7 +235,7 @@ public class ServiceDictInfoController extends BaseController {
*/
@RequiresPermissions(value={"basics:classification:del","basics:attribute:del","basics:label:del","basics:vpn_ip:del"},logical=Logical.OR)
@RequestMapping(value={"delete"})
public String delete(ServiceDictInfo serviceDictInfo, RedirectAttributes redirectAttributes, String itType, String mulitId) {
public String delete(ServiceDictInfo serviceDictInfo, RedirectAttributes redirectAttributes, String itType, String mulitId,HttpServletRequest request) {
try {
String exIp="";
String id="";
@@ -266,6 +270,7 @@ public class ServiceDictInfoController extends BaseController {
} catch (Exception e) {
e.printStackTrace();
addMessage(redirectAttributes,"error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/basics/serviceDictInfo/list?itType="+itType;
}
@@ -586,6 +591,7 @@ public class ServiceDictInfoController extends BaseController {
} catch (Exception e) {
logger.error("dict white export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}

View File

@@ -25,6 +25,7 @@ import com.nis.domain.basics.ServiceDictInfo;
import com.nis.domain.basics.SysDictInfo;
import com.nis.util.ConfigDictUtils;
import com.nis.util.Configurations;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.web.controller.BaseController;
@@ -151,7 +152,7 @@ public class SysDictInfoController extends BaseController {
*/
@RequiresPermissions(value={"basics:area:add","basics:isp:add","basics:scope:add","basics:area:edit","basics:isp:edit","basics:scope:edit"},logical=Logical.OR)
@RequestMapping(value = "saveOrUpdate")
public String saveOrUpdate(SysDictInfo sysDictInfo,Model model, RedirectAttributes redirectAttributes, String itType) {
public String saveOrUpdate(SysDictInfo sysDictInfo,Model model, RedirectAttributes redirectAttributes, String itType,HttpServletRequest request) {
try {
sysDictInfoService.saveOrUpdate(sysDictInfo);
@@ -159,6 +160,7 @@ public class SysDictInfoController extends BaseController {
} catch (Exception e) {
e.printStackTrace();
addMessage(redirectAttributes,"error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/basics/sysDictInfo/list?itType="+itType;
@@ -172,13 +174,14 @@ public class SysDictInfoController extends BaseController {
*/
@RequiresPermissions(value={"basics:area:del","basics:isp:del","basics:scope:del"},logical=Logical.OR)
@RequestMapping(value={"delete"})
public String delete(SysDictInfo sysDictInfo, RedirectAttributes redirectAttributes, String itType, String mulitId) {
public String delete(SysDictInfo sysDictInfo, RedirectAttributes redirectAttributes, String itType, String mulitId,HttpServletRequest request) {
try {
sysDictInfoService.deleteDict(mulitId);
addMessage(redirectAttributes,"success", "delete_success");
} catch (Exception e) {
e.printStackTrace();
addMessage(redirectAttributes,"error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/basics/sysDictInfo/list?itType="+itType;
}

View File

@@ -24,6 +24,7 @@ import com.nis.domain.configuration.RequestInfo;
import com.nis.domain.configuration.TaskInfo;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.excel.ExcelField;
import com.nis.web.controller.BaseController;
@@ -90,6 +91,7 @@ public class TaskInfoController extends BaseController{
logger.error(e.getMessage());
e.printStackTrace();
addMessage(redirectAttributes,"error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/basics/taskInfo/list?functionId="+taskInfo.getFunctionId()+"&repage";
}
@@ -233,6 +235,7 @@ public class TaskInfoController extends BaseController{
} catch (Exception e) {
logger.error("ip addr export failed",e);
addMessage(redirectAttributes,"error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
}

View File

@@ -58,6 +58,7 @@ import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.FileUtils;
import com.nis.util.JsonMapper;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -86,8 +87,22 @@ public class AppFeatureCfgController extends BaseController {
Page<AppFeatureIndex> searchPage = new Page<AppFeatureIndex>(request, response, "r");
Page<AppFeatureIndex> page = appMultiFeatureCfgService.findAppFeatureIndexList(searchPage, cfg);
for (AppFeatureIndex entity : page.getList()) {
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
entity.setAppName(app.getSpecServiceName());
// 查找社交应用的所有有效一级特定服务
SpecificServiceCfg appSpec = new SpecificServiceCfg();
for (SysDataDictionaryItem dict : DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) {
if (Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equals(dict.getItemValue())) {
appSpec.setCfgType(Integer.parseInt(dict.getItemCode()));
break;
}
}
appSpec.setIsValid(Constants.VALID_YES);
appSpec.setIsLeaf(0);
appSpec.setSpecServiceCode(entity.getAppCode());
List<SpecificServiceCfg> appList = specificServiceCfgService.findAllSpecificServiceCfg(appSpec, null);
if (!StringUtil.isEmpty(appList)) {
SpecificServiceCfg app = appList.get(0);
entity.setAppName(app.getSpecServiceName());
}
}
model.addAttribute("page", page);
initPageCondition(model, cfg);
@@ -114,6 +129,24 @@ public class AppFeatureCfgController extends BaseController {
entity.getFunctionId(), null));
entity.setNumCfgList(
appMultiFeatureCfgService.getAppTcpCfg(entity.getCompileId(), entity.getFunctionId(), null));
// 查找社交应用的所有有效一级特定服务
SpecificServiceCfg appSpec = new SpecificServiceCfg();
for (SysDataDictionaryItem dict : DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) {
if (Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equals(dict.getItemValue())) {
appSpec.setCfgType(Integer.parseInt(dict.getItemCode()));
break;
}
}
appSpec.setIsValid(Constants.VALID_YES);
appSpec.setIsLeaf(0);
appSpec.setSpecServiceCode(entity.getAppCode());
List<SpecificServiceCfg> appList = specificServiceCfgService.findAllSpecificServiceCfg(appSpec, null);
if (!StringUtil.isEmpty(appList)) {
SpecificServiceCfg app = appList.get(0);
entity.setSpecServiceId(app.getSpecServiceId());
}
initUpdateFormCondition(model, entity);
} else {
initFormCondition(model, entity);
@@ -142,14 +175,21 @@ public class AppFeatureCfgController extends BaseController {
entity.setAppCode(specificService.getSpecServiceCode());
}
appMultiFeatureCfgService.saveOrUpdateAppFeatureCfg(entity);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
e.printStackTrace();
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("APP 特征配置下发失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("APP 特征配置保存失败:",e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/app/feature/multiFeatureCfgList?functionId=" + entity.getFunctionId();
@@ -176,20 +216,20 @@ public class AppFeatureCfgController extends BaseController {
entity = appMultiFeatureCfgService.getAppFeatureIndex(Long.parseLong(id));
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
appMultiFeatureCfgService.auditAppFeatureCfg(entity, isAudit);
appMultiFeatureCfgService.auditAppFeatureCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (MaatConvertException e) {
e.printStackTrace();
logger.error("app 特征配置下发失败:" + e.getMessage());
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
e.printStackTrace();
logger.error("app 特征配置下发失败:" + e.getMessage());
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
} else {
@@ -204,8 +244,10 @@ public class AppFeatureCfgController extends BaseController {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -240,8 +282,10 @@ public class AppFeatureCfgController extends BaseController {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -339,8 +383,22 @@ public class AppFeatureCfgController extends BaseController {
}
for (AppFeatureIndex feature : ipLists) {
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(feature.getSpecServiceId());
feature.setAppName(app.getSpecServiceName());
// 查找社交应用的所有有效一级特定服务
SpecificServiceCfg appSpec = new SpecificServiceCfg();
for (SysDataDictionaryItem dict : DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) {
if (Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equals(dict.getItemValue())) {
appSpec.setCfgType(Integer.parseInt(dict.getItemCode()));
break;
}
}
appSpec.setIsValid(Constants.VALID_YES);
appSpec.setIsLeaf(0);
appSpec.setSpecServiceCode(feature.getAppCode());
List<SpecificServiceCfg> appList = specificServiceCfgService.findAllSpecificServiceCfg(appSpec, null);
if (!StringUtil.isEmpty(appList)) {
SpecificServiceCfg app = appList.get(0);
feature.setAppName(app.getSpecServiceName());
}
}
String cfgIndexInfoNoExport = ",letter,whether_area_block,classification,attribute,label,do_log,block_type,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
String appComplexNoExport = ",do_log,block_type,config_describe,valid_identifier,is_audit,creator,creator"
@@ -350,7 +408,7 @@ public class AppFeatureCfgController extends BaseController {
String ipPortInfoNoExport = ",do_log,block_type,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time"
+ ",letter,whether_area_block,classification,attribute,label"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,client_ip,src_ip_pattern,client_port,src_port_pattern,";
// 时间过滤
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
@@ -433,6 +491,7 @@ public class AppFeatureCfgController extends BaseController {
} catch (Exception e) {
logger.error("Appfeature export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();

View File

@@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page;
import com.nis.domain.SysDataDictionaryItem;
import com.nis.domain.configuration.AppPolicyCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
@@ -36,6 +37,8 @@ import com.nis.exceptions.CallExternalProceduresException;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -129,6 +132,25 @@ public class BasicProtocolController extends BaseController {
public String policyCfgForm(Model model, String ids, AppPolicyCfg entity) {
if (StringUtils.isNotBlank(ids)) {
entity = appCfgService.getAppPolicyCfg(Long.parseLong(ids), null);
// 查找社交应用的所有有效一级特定服务
SpecificServiceCfg appSpec = new SpecificServiceCfg();
for (SysDataDictionaryItem dict : DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) {
if (Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL.equals(dict.getItemValue())) {
appSpec.setCfgType(Integer.parseInt(dict.getItemCode()));
break;
}
}
appSpec.setIsValid(Constants.VALID_YES);
appSpec.setIsLeaf(0);
appSpec.setSpecServiceCode(entity.getAppCode());
List<SpecificServiceCfg> appList = specificServiceCfgService.findAllSpecificServiceCfg(appSpec, null);
if (!StringUtil.isEmpty(appList)) {
SpecificServiceCfg app = appList.get(0);
entity.setSpecServiceId(app.getSpecServiceId());
}
initUpdateFormCondition(model, entity);
} else {
initFormCondition(model, entity);
@@ -158,18 +180,25 @@ public class BasicProtocolController extends BaseController {
entity.setAppCode(specificService.getSpecServiceCode());
}
appCfgService.saveOrUpdateAppPolicyCfg(entity);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
e.printStackTrace();
logger.error("基础协议信息保存失败", e);
if (e instanceof MaatConvertException) {
// addMessage(redirectAttributes,e.getMessage());
addMessage(redirectAttributes, "error", "request_service_failed");
} else if (e instanceof CallExternalProceduresException) {
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("基础协议配置下发失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (CallExternalProceduresException e) {
logger.error("调用外部程序出错:",e);
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("基础协议配置保存失败:",e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/basicprotocol/list?functionId=" + entity.getFunctionId();
@@ -197,12 +226,10 @@ public class BasicProtocolController extends BaseController {
entity = appCfgService.getAppPolicyCfg(Long.parseLong(id), null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL);
try {
appCfgService.auditAppPolicyCfg(entity, isAudit);
appCfgService.auditAppPolicyCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
if (e instanceof MaatConvertException) {
@@ -210,10 +237,12 @@ public class BasicProtocolController extends BaseController {
logger.info("app策略配置下发失败" + e.getMessage());
;
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
e.printStackTrace();
logger.error("app策略配置下发失败", e);
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -230,8 +259,10 @@ public class BasicProtocolController extends BaseController {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -267,8 +298,10 @@ public class BasicProtocolController extends BaseController {
addMessage(redirectAttributes, "error", "request_service_failed");
} else if (e instanceof CallExternalProceduresException) {
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath + "/basicprotocol/list?functionId=" + functionId;
@@ -311,8 +344,20 @@ public class BasicProtocolController extends BaseController {
logTotal.put("sum",0L);
logTotals.add(logTotal);
}
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(policy.getSpecServiceId());
if (app != null) {
// 查找社交应用的所有有效一级特定服务 TODO
SpecificServiceCfg appSpec = new SpecificServiceCfg();
for (SysDataDictionaryItem dict : DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) {
if (Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL.equals(dict.getItemValue())) {
appSpec.setCfgType(Integer.parseInt(dict.getItemCode()));
break;
}
}
appSpec.setIsValid(Constants.VALID_YES);
appSpec.setIsLeaf(0);
appSpec.setSpecServiceCode(policy.getAppCode());
List<SpecificServiceCfg> appList = specificServiceCfgService.findAllSpecificServiceCfg(appSpec, null);
if (!StringUtil.isEmpty(appList)) {
SpecificServiceCfg app = appList.get(0);
policy.setAppName(app.getSpecServiceName());
}
@@ -395,6 +440,7 @@ public class BasicProtocolController extends BaseController {
} catch (Exception e) {
logger.error("ip addr export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();

View File

@@ -8,10 +8,8 @@
*/
package com.nis.web.controller.configuration;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -19,38 +17,22 @@ import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.axis2.databinding.types.soapencoding.Array;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.ui.Model;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.basics.ServiceDictInfo;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.HttpBodyCfg;
import com.nis.domain.configuration.HttpReqHeadCfg;
import com.nis.domain.configuration.HttpResHeadCfg;
import com.nis.domain.configuration.HttpUrlCfg;
import com.nis.domain.configuration.template.IpAllTemplate;
import com.nis.domain.configuration.template.IpCfgTemplate;
import com.nis.domain.specific.ConfigGroupInfo;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.NtcSubscribeIdCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.util.DictUtils;
import com.nis.util.StringUtil;
import com.nis.util.excel.ExportExcel;
import com.nis.util.excel.ImportExcel;
import com.nis.web.controller.BaseController;
import com.nis.web.dao.configuration.IpCfgDao;
import com.nis.web.security.UserUtils;
/**
* @ClassName: CommonController.java
@@ -288,15 +270,7 @@ public class CommonController extends BaseController {
e.printStackTrace();
}
}*/
public void _importFileTemplate(HttpServletRequest request,HttpServletResponse response,
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode) {
this.importCfgTemplate(request, response, redirectAttributes, functionId, cfgRegionCode);
}
@Deprecated
public void _importFileTemplate(HttpServletRequest request,HttpServletResponse response,
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode,Class clazz) {
this.importCfgTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,clazz);
}
//ip配置导出
public void _exportIp(String columns,Model model,HttpServletRequest request,HttpServletResponse response,
IpPortCfg entity,String ids,RedirectAttributes redirectAttributes){

View File

@@ -29,6 +29,7 @@ import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.service.BaseService;
@@ -78,6 +79,7 @@ public class ConfigSynchronizationController extends BaseController {
Thread.sleep(60000);
} catch (InterruptedException e) {
e.printStackTrace();
LogUtils.saveLog(request, null, e, null);
}
}
}
@@ -101,19 +103,26 @@ public class ConfigSynchronizationController extends BaseController {
status = 1;
} catch (NoSuchFieldException e) {
e.printStackTrace();
LogUtils.saveLog(request, null, e, null);
} catch (SecurityException e) {
e.printStackTrace();
LogUtils.saveLog(request, null, e, null);
} catch (IllegalArgumentException e) {
e.printStackTrace();
LogUtils.saveLog(request, null, e, null);
} catch (IllegalAccessException e) {
e.printStackTrace();
LogUtils.saveLog(request, null, e, null);
} catch (ClassNotFoundException e) {
e.printStackTrace();
LogUtils.saveLog(request, null, e, null);
}catch(MaatConvertException e){
e.printStackTrace();
LogUtils.saveLog(request, null, e, null);
status = -1;
}catch (Exception e) {
e.printStackTrace();
LogUtils.saveLog(request, null, e, null);
}finally{
if(status!=1){
SysDataDictionaryName sysDictName = new SysDataDictionaryName();
@@ -172,6 +181,7 @@ public class ConfigSynchronizationController extends BaseController {
Thread.sleep(60000);
} catch (InterruptedException e) {
e.printStackTrace();
LogUtils.saveLog(request, null, e, null);
}
}

View File

@@ -11,6 +11,7 @@ import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
@@ -34,6 +35,7 @@ import com.nis.exceptions.CallExternalProceduresException;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -112,7 +114,7 @@ public class EncryptedTunnelBehaviorController extends BaseController {
public String ajaxSslSubList(Model model, Long cfgId, Integer index, Integer compileId) {
AppPolicyCfg cfg = appCfgService.getAppPolicyCfg(cfgId, compileId);
List<String[]> tabList = new ArrayList();
if (cfg.getIpPortList() != null) {
if (CollectionUtils.isNotEmpty(cfg.getIpPortList())) {
String cfgType = null;
for (IpPortCfg ip : cfg.getIpPortList()) {
if (!ip.getCfgType().equals(cfgType)) {
@@ -121,7 +123,7 @@ public class EncryptedTunnelBehaviorController extends BaseController {
}
}
}
if (cfg.getNtcSubscribeIdCfgList() != null) {
if (CollectionUtils.isNotEmpty(cfg.getNtcSubscribeIdCfgList())) {
String cfgType = null;
for (NtcSubscribeIdCfg ntc : cfg.getNtcSubscribeIdCfgList()) {
if (!ntc.getCfgType().equals(cfgType)) {
@@ -149,6 +151,24 @@ public class EncryptedTunnelBehaviorController extends BaseController {
public String policyCfgForm(Model model, String ids, AppPolicyCfg entity) {
if (StringUtils.isNotBlank(ids)) {
entity = appCfgService.getAppPolicyCfg(Long.parseLong(ids), null);
// 查找社交应用的所有有效一级特定服务
SpecificServiceCfg appSpec = new SpecificServiceCfg();
for (SysDataDictionaryItem dict : DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) {
if (Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equals(dict.getItemValue())) {
appSpec.setCfgType(Integer.parseInt(dict.getItemCode()));
break;
}
}
appSpec.setIsValid(Constants.VALID_YES);
appSpec.setIsLeaf(0);
appSpec.setSpecServiceCode(entity.getAppCode());
List<SpecificServiceCfg> appList = specificServiceCfgService.findAllSpecificServiceCfg(appSpec, null);
if (!StringUtil.isEmpty(appList)) {
SpecificServiceCfg app = appList.get(0);
entity.setSpecServiceId(app.getSpecServiceId());
}
initUpdateFormCondition(model, entity);
} else {
initFormCondition(model, entity);
@@ -178,17 +198,25 @@ public class EncryptedTunnelBehaviorController extends BaseController {
entity.setAppCode(specificService.getSpecServiceCode());
}
appCfgService.saveOrUpdateAppPolicyCfg(entity);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
e.printStackTrace();
logger.error("加密隧道信息保存失败", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else if (e instanceof CallExternalProceduresException) {
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("加密隧道行为配置下发失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (CallExternalProceduresException e) {
logger.error("调用外部程序出错:",e);
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("加密隧道行为配置保存失败:",e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/encryptedtunnelbehav/list?functionId=" + entity.getFunctionId();
@@ -221,7 +249,7 @@ public class EncryptedTunnelBehaviorController extends BaseController {
entity.setFunctionId(functionId);
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR);
try {
appCfgService.auditAppPolicyCfg(entity, isAudit);
appCfgService.auditAppPolicyCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
if (e instanceof MaatConvertException) {
@@ -229,10 +257,12 @@ public class EncryptedTunnelBehaviorController extends BaseController {
logger.info("加密隧道配置下发失败:" + e.getMessage());
;
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
e.printStackTrace();
logger.error("加密隧道配置下发失败", e);
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}
@@ -249,8 +279,10 @@ public class EncryptedTunnelBehaviorController extends BaseController {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -286,10 +318,13 @@ public class EncryptedTunnelBehaviorController extends BaseController {
logger.error("加密隧道协议保存失败", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else if (e instanceof CallExternalProceduresException) {
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath + "/encryptedtunnelbehav/list?functionId=" + functionId;
@@ -330,8 +365,20 @@ public class EncryptedTunnelBehaviorController extends BaseController {
logTotal.put("sum",0L);
logTotals.add(logTotal);
}
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(policy.getSpecServiceId());
if (app != null) {
// 查找社交应用的所有有效一级特定服务 TODO
SpecificServiceCfg appSpec = new SpecificServiceCfg();
for (SysDataDictionaryItem dict : DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) {
if (Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equals(dict.getItemValue())) {
appSpec.setCfgType(Integer.parseInt(dict.getItemCode()));
break;
}
}
appSpec.setIsValid(Constants.VALID_YES);
appSpec.setIsLeaf(0);
appSpec.setSpecServiceCode(policy.getAppCode());
List<SpecificServiceCfg> appList = specificServiceCfgService.findAllSpecificServiceCfg(appSpec, null);
if (!StringUtil.isEmpty(appList)) {
SpecificServiceCfg app = appList.get(0);
policy.setBehaviorName(app.getSpecServiceName());
}
}
@@ -437,6 +484,7 @@ public class EncryptedTunnelBehaviorController extends BaseController {
} catch (Exception e) {
logger.error("TunnelBehavior export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();

View File

@@ -2,6 +2,7 @@ package com.nis.web.controller.configuration;
import java.util.List;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -16,6 +17,7 @@ import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.domain.configuration.GroupAreaInfo;
import com.nis.exceptions.CallExternalProceduresException;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.service.configuration.GroupAreaService;
@@ -65,7 +67,7 @@ public class GroupAreaController extends BaseController {
}
@RequestMapping(value = "saveOrUpdate")
public String saveOrUpdate(GroupAreaInfo cfg,Model model,RedirectAttributes redirectAttributes) {
public String saveOrUpdate(GroupAreaInfo cfg,Model model,RedirectAttributes redirectAttributes,HttpServletRequest request) {
try {
groupAreaService.saveOrUpdate(cfg);
addMessage(redirectAttributes,"success","save_success");
@@ -73,23 +75,27 @@ public class GroupAreaController extends BaseController {
logger.error("新增失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
LogUtils.saveLog(request, null, e, null);
}else if(e instanceof CallExternalProceduresException) {
addMessage(redirectAttributes,"error","call_external_procedures_failed");
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error","save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath + "/cfg/groupArea/groupAreaList";
}
@RequestMapping(value={"delete"})
public String delete(RedirectAttributes redirectAttributes, String ids,int isValid) {
public String delete(RedirectAttributes redirectAttributes, String ids,int isValid,HttpServletRequest request) {
try {
groupAreaService.deldete(ids,isValid);
addMessage(redirectAttributes,"success","delete_success");
} catch (Exception e) {
logger.error("删除失败",e);
addMessage(redirectAttributes,"error","delete_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/cfg/groupArea/groupAreaList";
}

View File

@@ -23,6 +23,7 @@ import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.log.BaseLogEntity;
import com.nis.util.Constants;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
@@ -73,7 +74,7 @@ public class LogSearchController extends BaseController{
@RequestMapping(value="actionLogTrend")
@ResponseBody
public List actionTrans(String cfgId,String beginDate,String endDate,String serviceId){
public List actionTrans(String cfgId,String beginDate,String endDate,String serviceId,HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List resultList = new ArrayList();
String url = Constants.LOG_BASE_URL+Constants.NTC_PZ_REPORT;
@@ -96,6 +97,7 @@ public class LogSearchController extends BaseController{
} catch (Exception e) {
e.printStackTrace();
resultList.add(Maps.newHashMap("error","request_service_failed"));
LogUtils.saveLog(request, null, e, null);
}
return resultList;
}

View File

@@ -26,6 +26,7 @@ import com.nis.domain.configuration.TaskInfo;
import com.nis.domain.log.BaseLogEntity;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.excel.ExcelField;
import com.nis.web.controller.BaseController;
@@ -124,6 +125,7 @@ public class RequestInfoController extends BaseController{
logger.error(e.getMessage());
e.printStackTrace();
addMessage(model,"error","save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/cfg/request/list?functionId="+requestInfo.getFunctionId()+"&repage";
}
@@ -286,6 +288,7 @@ public class RequestInfoController extends BaseController{
} catch (Exception e) {
logger.error("ip addr export failed",e);
addMessage(redirectAttributes,"error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
}

View File

@@ -24,6 +24,7 @@ import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.domain.configuration.DnsIpCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
@@ -69,7 +70,7 @@ public class DnsIpCfgController extends BaseController {
*/
@ResponseBody
@RequestMapping(value = { "initSpoofingIp" })
public String initSpoofingIp() {
public String initSpoofingIp(HttpServletRequest request) {
Properties msg = getMsgProp();
try {
DnsIpCfg entity = new DnsIpCfg();
@@ -84,8 +85,10 @@ public class DnsIpCfgController extends BaseController {
logger.error("初始化Spoofing ip失败", e);
e.printStackTrace();
if (e instanceof MaatConvertException) {
LogUtils.saveLog(request, null, e, null);
return msg.getProperty("request_service_failed");
} else {
LogUtils.saveLog(request, null, e, null);
return msg.getProperty("save_failed");
}
}
@@ -98,15 +101,21 @@ public class DnsIpCfgController extends BaseController {
@ModelAttribute("cfg") DnsIpCfg cfg, RedirectAttributes redirectAttributes) {
try {
dnsIpCfgService.saveOrUpdate(cfg);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
logger.error("信息保存失败", e);
e.printStackTrace();
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("DNS欺骗ip配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("DNS欺骗ip配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/cfg/dnsIp/list?functionId=" + cfg.getFunctionId();
@@ -129,8 +138,10 @@ public class DnsIpCfgController extends BaseController {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -153,10 +164,12 @@ public class DnsIpCfgController extends BaseController {
e.printStackTrace();
logger.info("dns fake ip配置下发失败" + e.getMessage());
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
e.printStackTrace();
logger.info("dns fake ip配置下发失败" + e.getMessage());
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -173,8 +186,10 @@ public class DnsIpCfgController extends BaseController {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -235,7 +250,7 @@ public class DnsIpCfgController extends BaseController {
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), DnsIpCfg.class);
String cfgIndexInfoNoExport = ",log_total,whether_area_block,client_ip,port_pattern,client_port,server_port,ir_type,direction,protocol,do_log,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
String cfgIndexInfoNoExport = ",log_total,whether_area_block,client_ip,src_ip_pattern,src_port_pattern,dest_port_pattern,client_port,server_port,ir_type,direction,protocol,do_log,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
// 时间过滤
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
@@ -267,8 +282,10 @@ public class DnsIpCfgController extends BaseController {
logger.error("DnsIp export failed", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
// return "redirect:" + adminPath

View File

@@ -28,6 +28,7 @@ import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.specific.SpecificServiceCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
@@ -80,11 +81,21 @@ public class DnsResStrategyController extends BaseController {
dnsResStrategyService.saveOrUpdate(cfg);
addMessage(redirectAttributes, "success", "save_success");
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("DNS响应策略配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("DNS响应策略配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/maintenance/dnsResStrategy/list?functionId=" + cfg.getFunctionId();
@@ -118,8 +129,10 @@ public class DnsResStrategyController extends BaseController {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -140,8 +153,10 @@ public class DnsResStrategyController extends BaseController {
addMessage(redirectAttributes, "success", "audit_success");
} catch (MaatConvertException e) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -157,8 +172,10 @@ public class DnsResStrategyController extends BaseController {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -242,8 +259,10 @@ public class DnsResStrategyController extends BaseController {
logger.error("Dns export failed", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
// return "redirect:" + adminPath

View File

@@ -24,6 +24,7 @@ import com.nis.domain.configuration.IpAddrPoolCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.web.controller.BaseController;
@@ -81,8 +82,10 @@ public class IpAddrPoolController extends BaseController{
e.printStackTrace();
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -91,7 +94,7 @@ public class IpAddrPoolController extends BaseController{
@RequestMapping(value = {"/snatAudit"})
@RequiresPermissions(value={"ip:mulitiplex:pool:confirm"})
public String snataudit(Integer isAudit,Integer isValid,String ids,Integer functionId,RedirectAttributes redirectAttributes) {
public String snataudit(Integer isAudit,Integer isValid,String ids,Integer functionId,RedirectAttributes redirectAttributes,HttpServletRequest request) {
if(!StringUtil.isEmpty(ids)){
String[] idArray = ids.split(",");
Date auditTime=new Date();
@@ -104,8 +107,10 @@ public class IpAddrPoolController extends BaseController{
logger.error("SNAT地址池配置下发失败"+e.getMessage());
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}
@@ -138,6 +143,7 @@ public class IpAddrPoolController extends BaseController{
}catch(Exception e){
logger.error(e);
addMessage(redirectAttributes,"error","delete_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath +"/maintenance/ipMultiplexPoolCfg/snatlist?functionId="+functionId;
}
@@ -282,6 +288,7 @@ public class IpAddrPoolController extends BaseController{
} catch (Exception e) {
logger.error("ip white export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}

View File

@@ -24,6 +24,7 @@ import com.nis.domain.configuration.IpMultiplexPoolCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.service.basics.SysDictInfoService;
@@ -72,8 +73,10 @@ public class IpMultiplexPoolCfgController extends BaseController {
e.printStackTrace();
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -103,6 +106,7 @@ public class IpMultiplexPoolCfgController extends BaseController {
} catch (Exception e) {
logger.error(e);
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/maintenance/ipMultiplexPoolCfg/list?functionId=" + functionId;
}
@@ -110,7 +114,7 @@ public class IpMultiplexPoolCfgController extends BaseController {
@RequestMapping(value = { "/audit" })
@RequiresPermissions(value = { "ip:mulitiplex:pool:confirm" })
public String audit(Integer isAudit, Integer isValid, String ids, Integer functionId,
RedirectAttributes redirectAttributes) {
RedirectAttributes redirectAttributes,HttpServletRequest request) {
if (!StringUtil.isEmpty(ids)) {
String[] idArray = ids.split(",");
Date auditTime = new Date();
@@ -126,6 +130,7 @@ public class IpMultiplexPoolCfgController extends BaseController {
e.printStackTrace();
logger.info("IP复用地址池配置下发失败" + e.getMessage());
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -309,6 +314,7 @@ public class IpMultiplexPoolCfgController extends BaseController {
} catch (Exception e) {
logger.error("snat export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
@@ -370,6 +376,7 @@ public class IpMultiplexPoolCfgController extends BaseController {
} catch (Exception e) {
logger.error("dnat export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();

View File

@@ -30,6 +30,7 @@ import com.nis.domain.configuration.UserManage;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.web.controller.BaseController;
@@ -110,10 +111,12 @@ public class UserManageController extends BaseController{
} catch (MaatConvertException e) {
message=msgProp.getProperty("user")+" "+user.getUserName()+" "+ip+" "+msgProp.getProperty("cgi_failed")+" "+msgProp.getProperty("delete_failed");
logger.error("用户vpn新增失败",e);
LogUtils.saveLog(request, null, e, null);
throw e;
}catch (Exception e) {
message=msgProp.getProperty("user")+" "+user.getUserName()+" "+ip+" "+msgProp.getProperty("cgi_failed")+" "+msgProp.getProperty("delete_failed");
logger.error("用户vpn新增失败",e);
LogUtils.saveLog(request, null, e, null);
throw e;
}
}
@@ -134,8 +137,10 @@ public class UserManageController extends BaseController{
}
if(!StringUtil.isEmpty(e.getMessage())) {
addMessage(redirectAttributes,"error",e.getMessage());
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error",message);
LogUtils.saveLog(request, null, e, null);
}
}
@@ -181,10 +186,12 @@ public class UserManageController extends BaseController{
} catch (MaatConvertException e) {
message=msgProp.getProperty("user")+" "+entity.getUserName()+" "+ip+" "+msgProp.getProperty("cgi_failed")+" "+msgProp.getProperty("save_failed");
logger.error("用户vpn新增失败",e);
LogUtils.saveLog(request, null, e, null);
throw e;
}catch (Exception e) {
message=msgProp.getProperty("user")+" "+entity.getUserName()+" "+ip+" "+msgProp.getProperty("cgi_failed")+" "+msgProp.getProperty("save_failed");
logger.error("用户vpn新增失败",e);
LogUtils.saveLog(request, null, e, null);
throw e;
}
}
@@ -208,10 +215,12 @@ public class UserManageController extends BaseController{
} catch (MaatConvertException e) {
message=msgProp.getProperty("user")+" "+entity.getUserName()+msgProp.getProperty("password")+" "+msgProp.getProperty("cgi_failed")+" "+msgProp.getProperty("update_failed");
logger.error("用户vpn密码修改失败",e);
LogUtils.saveLog(request, null, e, null);
throw e;
}catch (Exception e) {
message=msgProp.getProperty("user")+" "+entity.getUserName()+msgProp.getProperty("password")+" "+msgProp.getProperty("cgi_failed")+" "+msgProp.getProperty("update_failed");
logger.error("用户vpn密码修改失败",e);
LogUtils.saveLog(request, null, e, null);
throw e;
}
}
@@ -243,10 +252,12 @@ public class UserManageController extends BaseController{
} catch (MaatConvertException e) {
message=msgProp.getProperty("user")+" "+entity.getUserName()+" "+ip+" "+msgProp.getProperty("cgi_failed")+" "+msgProp.getProperty("save_failed");
logger.error("用户vpn新增失败",e);
LogUtils.saveLog(request, null, e, null);
throw e;
}catch (Exception e) {
message=msgProp.getProperty("user")+" "+entity.getUserName()+" "+ip+" "+msgProp.getProperty("cgi_failed")+" "+msgProp.getProperty("save_failed");
logger.error("用户vpn新增失败",e);
LogUtils.saveLog(request, null, e, null);
throw e;
}
}
@@ -263,10 +274,12 @@ public class UserManageController extends BaseController{
} catch (MaatConvertException e) {
message=msgProp.getProperty("user")+" "+entity.getUserName()+" "+ip+" "+msgProp.getProperty("cgi_failed")+" "+msgProp.getProperty("save_failed");
logger.error("用户vpn删除失败",e);
LogUtils.saveLog(request, null, e, null);
throw e;
}catch (Exception e) {
message=msgProp.getProperty("user")+" "+entity.getUserName()+" "+ip+" "+msgProp.getProperty("cgi_failed")+" "+msgProp.getProperty("save_failed");
logger.error("用户vpn删除失败",e);
LogUtils.saveLog(request, null, e, null);
throw e;
}
}
@@ -277,15 +290,19 @@ public class UserManageController extends BaseController{
} catch (MaatConvertException e) {
if(!StringUtil.isEmpty(e.getMessage())) {
addMessage(redirectAttributes,"error",e.getMessage());
LogUtils.saveLog(request, null, e, null);
}else{
addMessage(redirectAttributes,"error",message);
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath +"/maintenance/userManage/list";
} catch (Exception e) {
if(!StringUtil.isEmpty(e.getMessage())) {
addMessage(redirectAttributes,"error",e.getMessage());
LogUtils.saveLog(request, null, e, null);
}else{
addMessage(redirectAttributes,"error",message);
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath +"/maintenance/userManage/list";
}
@@ -375,6 +392,7 @@ public class UserManageController extends BaseController{
message+=","+ip;
}
logger.error("查询失败", e);
LogUtils.saveLog(request, null, e, null);
}
}
mess.put("message", message);
@@ -450,6 +468,7 @@ public class UserManageController extends BaseController{
} catch (Exception e) {
logger.error("user export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();

View File

@@ -34,6 +34,7 @@ import com.nis.domain.configuration.DdosIpCfg;
import com.nis.domain.configuration.RequestInfo;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -57,6 +58,12 @@ public class DdosCfgController extends BaseController {
@ModelAttribute("cfg") DdosIpCfg cfg) {
if (!StringUtil.isEmpty(ids)) {
cfg = ddosCfgService.getDdosIpCfg(Long.parseLong(ids), null);
if(cfg.getBpsThreadshold()==0){
cfg.setBpsThreadshold(null);
};
if(cfg.getPpsThreadshold()==0){
cfg.setPpsThreadshold(null);
};
initUpdateFormCondition(model, cfg);
} else {
initFormCondition(model, cfg);
@@ -71,15 +78,21 @@ public class DdosCfgController extends BaseController {
@ModelAttribute("cfg") DdosIpCfg cfg, RedirectAttributes redirectAttributes) {
try {
ddosCfgService.saveOrUpdate(cfg);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
logger.error("信息保存失败", e);
e.printStackTrace();
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("DDOS配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("DDOS配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/manipulation/ddos/list?functionId=" + cfg.getFunctionId();
@@ -102,8 +115,10 @@ public class DdosCfgController extends BaseController {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -120,16 +135,18 @@ public class DdosCfgController extends BaseController {
Date auditTime = new Date();
for (String id : idArray) {
try {
ddosCfgService.audit(isAudit, isValid, functionId, id, auditTime);
ddosCfgService.audit(isAudit, isValid, functionId, id, auditTime,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (MaatConvertException e) {
e.printStackTrace();
logger.info("dns fake ip配置下发失败" + e.getMessage());
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
e.printStackTrace();
logger.info("dns fake ip配置下发失败" + e.getMessage());
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -145,8 +162,10 @@ public class DdosCfgController extends BaseController {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -258,6 +277,7 @@ public class DdosCfgController extends BaseController {
} catch (Exception e) {
logger.error("ddos export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();

View File

@@ -40,11 +40,11 @@ import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.IpReuseDnatPolicyCfg;
import com.nis.domain.configuration.IpReusePolicyCfg;
import com.nis.domain.configuration.UserManage;
import com.nis.domain.configuration.template.IpMultiplexPolicyTemplate;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.configuration.CommonController;
import com.nis.web.service.configuration.IpMultiplexService;
@@ -120,26 +120,6 @@ public class IpMultiplexController extends CommonController {
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/list?functionId=" + cfg.getFunctionId();
}
// ip配置导入
/*
* @RequestMapping(value = "/import", method=RequestMethod.POST) public
* String importIp(String cfgName,RedirectAttributes redirectAttributes,
*
* @RequestParam("file") MultipartFile file,IpPortCfg cfg) {
* this._importIp(cfgName,redirectAttributes,
* file,cfg,IpMultiplexPolicyTemplate.class);
* redirectAttributes.addAttribute("urlPrefix","/manipulation/ipmulitiplex")
* ; redirectAttributes.addAttribute("requiresPermissionPrefix",
* "ip:mulitiplex"); return "redirect:" + adminPath
* +"/manipulation/ipmulitiplex/list?functionId="+cfg.getFunctionId(); }
*/
// ip模板下载
@RequestMapping(value = "import/template")
public void importFileTemplate(HttpServletRequest request, HttpServletResponse response,
RedirectAttributes redirectAttributes, Integer functionId, Integer cfgRegionCode) {
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,
IpMultiplexPolicyTemplate.class);
}
// ip配置导出
@RequestMapping(value = "export")
@@ -202,8 +182,10 @@ public class IpMultiplexController extends CommonController {
e.printStackTrace();
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -223,6 +205,7 @@ public class IpMultiplexController extends CommonController {
} catch (Exception e) {
logger.error(e);
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/snatPolicyList?functionId=" + functionId;
@@ -231,7 +214,7 @@ public class IpMultiplexController extends CommonController {
@RequestMapping(value = { "/auditSnat" })
@RequiresPermissions("snat_policy:confirm")
public String auditSnat(String ids, Integer isAudit, Integer isValid, Integer functionId,
RedirectAttributes redirectAttributes) {
RedirectAttributes redirectAttributes,HttpServletRequest request) {
if (!StringUtil.isEmpty(ids)) {
String[] idArray = ids.split(",");
@@ -245,8 +228,10 @@ public class IpMultiplexController extends CommonController {
logger.error("SNAT策略配置下发失败" + e.getMessage());
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}
@@ -388,8 +373,10 @@ public class IpMultiplexController extends CommonController {
e.printStackTrace();
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/dnatPolicyList?functionId=" + cfg.getFunctionId();
@@ -397,7 +384,7 @@ public class IpMultiplexController extends CommonController {
@RequestMapping(value = { "/dnatDelete" })
@RequiresPermissions("dnat_policy:config")
public String dnatDelete(String ids, Integer isValid, Integer functionId, RedirectAttributes redirectAttributes) {
public String dnatDelete(String ids, Integer isValid, Integer functionId, RedirectAttributes redirectAttributes,HttpServletRequest request) {
// this._deleteIp(cfgName,ids, compileIds, functionId, model);
try {
@@ -408,6 +395,7 @@ public class IpMultiplexController extends CommonController {
} catch (Exception e) {
logger.error(e);
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/dnatPolicyList?functionId=" + functionId;
@@ -416,7 +404,7 @@ public class IpMultiplexController extends CommonController {
@RequestMapping(value = { "/auditDnat" })
@RequiresPermissions("dnat_policy:confirm")
public String auditDnat(String ids, Integer isAudit, Integer isValid, Integer functionId,
RedirectAttributes redirectAttributes) {
RedirectAttributes redirectAttributes,HttpServletRequest request) {
// this._auditIp(cfgName,ids, cfg, redirectAttributes);
if (!StringUtil.isEmpty(ids)) {
@@ -431,8 +419,10 @@ public class IpMultiplexController extends CommonController {
logger.error("DNAT策略配置下发失败" + e.getMessage());
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}
@@ -551,6 +541,7 @@ public class IpMultiplexController extends CommonController {
} catch (Exception e) {
logger.error("snat export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
@@ -657,6 +648,7 @@ public class IpMultiplexController extends CommonController {
} catch (Exception e) {
logger.error("dnat export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();

View File

@@ -112,20 +112,7 @@ public class RatelimitController extends CommonController {
redirectAttributes.addAttribute("requiresPermissionPrefix","domain:ratelimit");
return "redirect:" + adminPath +"/manipulation/ratelimit/domain/list?functionId="+cfg.getFunctionId();
}
//ip配置导入
/*@RequestMapping(value = "/ip/import", method=RequestMethod.POST)
public String importIp(String cfgName,RedirectAttributes redirectAttributes,
@RequestParam("file") MultipartFile file,IpPortCfg cfg) {
this._importIp(cfgName,redirectAttributes, file,cfg,IpRateLimitTemplate.class);
redirectAttributes.addAttribute("urlPrefix","/manipulation/ratelimit/ip");
redirectAttributes.addAttribute("requiresPermissionPrefix","ip:ratelimit");
return "redirect:" + adminPath +"/manipulation/ratelimit/ip/list?functionId="+cfg.getFunctionId();
}*/
@RequestMapping(value = "/ip/import/template")
public void importFileTemplate(HttpServletRequest request,HttpServletResponse response,
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode) {
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,IpRateLimitTemplate.class);
}
//ip配置导出
@RequestMapping(value = "/ip/export")
public void exportIp(String columns,Model model,HttpServletRequest request,HttpServletResponse response,

View File

@@ -17,6 +17,7 @@ import com.nis.domain.Page;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.specific.ConfigGroupInfo;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
@@ -61,8 +62,10 @@ public class AsnPolicyCfgController extends BaseController {
e.printStackTrace();
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}

View File

@@ -38,6 +38,7 @@ import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.excel.ExportExcel;
import com.nis.web.controller.BaseController;
@@ -103,10 +104,12 @@ public class AvContentController extends BaseController {
e.printStackTrace();
logger.error("voip 信息保存失败", e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
e.printStackTrace();
logger.error("voip 信息保存失败", e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath + "/ntc/av/voipList?functionId=" + cfg.getFunctionId();
@@ -174,9 +177,11 @@ public class AvContentController extends BaseController {
if (e instanceof MaatConvertException) {
logger.error("voip 信息审核失败", e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
logger.error("voip 信息审核失败", e);
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath + "/ntc/av/voipList?functionId=" + functionId;
@@ -226,10 +231,12 @@ public class AvContentController extends BaseController {
logger.error("VOIP配置下发失败" + e.getMessage());
;
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
e.printStackTrace();
logger.error("VOIP配置下发失败", e);
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -247,8 +254,10 @@ public class AvContentController extends BaseController {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -398,8 +407,10 @@ public class AvContentController extends BaseController {
e.printStackTrace();
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -419,7 +430,7 @@ public class AvContentController extends BaseController {
@RequestMapping(value = { "/auditAvContIp" })
@RequiresPermissions(value = { "avContIp:confirm" })
public String auditContIp(Integer isAudit, Integer isValid, String ids, String compileIds, Integer functionId,
RedirectAttributes redirectAttributes) {
RedirectAttributes redirectAttributes,HttpServletRequest request) {
if (!StringUtil.isEmpty(compileIds)) {
String[] idArray = compileIds.split(",");
Date auditTime = new Date();
@@ -430,9 +441,11 @@ public class AvContentController extends BaseController {
} catch (MaatConvertException e) {
logger.error("Cont Ip配置下发失败", e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("Cont Ip配置下发失败", e);
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -507,8 +520,10 @@ public class AvContentController extends BaseController {
e.printStackTrace();
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -525,10 +540,19 @@ public class AvContentController extends BaseController {
}
// 修改CONTIP配置审核
/**
* @param isAudit
* @param isValid
* @param ids
* @param compileIds
* @param functionId
* @param redirectAttributes
* @return
*/
@RequestMapping(value = { "/auditPicIp" })
@RequiresPermissions(value = { "avPicIp:confirm" })
public String auditPicIp(Integer isAudit, Integer isValid, String ids, String compileIds, Integer functionId,
RedirectAttributes redirectAttributes) {
RedirectAttributes redirectAttributes,HttpServletRequest request) {
if (!StringUtil.isEmpty(compileIds)) {
String[] idArray = compileIds.split(",");
Date auditTime = new Date();
@@ -540,10 +564,12 @@ public class AvContentController extends BaseController {
e.printStackTrace();
logger.error("Pic Ip配置下发失败", e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
e.printStackTrace();
logger.error("Pic Ip配置下发失败", e);
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -640,10 +666,12 @@ public class AvContentController extends BaseController {
e.printStackTrace();
logger.error("Stream Media 信息保存失败", e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
e.printStackTrace();
logger.error("Stream Media 信息保存失败", e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath + "/ntc/av/contUrlList?functionId=" + cfg.getFunctionId();
@@ -667,8 +695,10 @@ public class AvContentController extends BaseController {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -700,8 +730,10 @@ public class AvContentController extends BaseController {
logger.info("Cont Url配置下发失败", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}
@@ -718,8 +750,10 @@ public class AvContentController extends BaseController {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -813,8 +847,10 @@ public class AvContentController extends BaseController {
logger.error("信息保存失败", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -834,7 +870,7 @@ public class AvContentController extends BaseController {
@RequestMapping(value = { "/auditAvPicUrl" })
@RequiresPermissions(value = { "avPicUrl:confirm" })
public String auditPicUrl(Integer isAudit, Integer isValid, String ids, String compileIds, Integer functionId,
RedirectAttributes redirectAttributes) {
RedirectAttributes redirectAttributes,HttpServletRequest request) {
if (!StringUtil.isEmpty(compileIds)) {
String[] idArray = compileIds.split(",");
Date auditTime = new Date();
@@ -847,8 +883,10 @@ public class AvContentController extends BaseController {
logger.info("Pic Url配置下发失败", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}
@@ -957,6 +995,7 @@ public class AvContentController extends BaseController {
} catch (Exception e) {
e.printStackTrace();
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/ntc/av/picUrlList?functionId=" + entity.getFunctionId();
@@ -1089,6 +1128,7 @@ public class AvContentController extends BaseController {
} catch (Exception e) {
logger.error("stream export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
@@ -1222,6 +1262,7 @@ public class AvContentController extends BaseController {
} catch (Exception e) {
logger.error("voip export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();

View File

@@ -59,6 +59,7 @@ import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.FileUtils;
import com.nis.util.JsonMapper;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.web.controller.BaseController;
@@ -301,7 +302,8 @@ public class AvController extends BaseController {
addMessage(redirectAttributes, "error", "exceeds_duration_limit");
logger.error("The duration of uploaded files exceeds the limit(" + Constants.AV_DURATION_LIMIT
+ "s).");
throw new MultiPartNewException(this.getMsgProp().getProperty("exceeds_duration_limit"));
throw new MultiPartNewException(this.getMsgProp().getProperty("exceeds_duration_limit")+"("+ Constants.AV_DURATION_LIMIT
+ "s)");
}
}
@@ -309,18 +311,28 @@ public class AvController extends BaseController {
}
avCfgService.saveOrUpdateAvFileSample(entity, srcFile);
addMessage(redirectAttributes, "success", "save_success");
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (Exception e) {
logger.error("文件上传失败", e);
e.printStackTrace();
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else if (e instanceof CallExternalProceduresException) {
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
LogUtils.saveLog(request, null, e, null);
} else if (e instanceof MultiPartNewException) {
addMessage(redirectAttributes, "error", e.getMessage());
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -333,16 +345,25 @@ public class AvController extends BaseController {
RedirectAttributes redirectAttributes, String ids, AvSignSampleCfg entity) {
try {
avCfgService.saveOrUpdateAvSignSample(entity);
addMessage(redirectAttributes, "success", "save_success");
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (Exception e) {
logger.error("saveAudioSignSample failed", e);
e.printStackTrace();
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else if (e instanceof CallExternalProceduresException) {
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath + "/ntc/av/sample/audioSignSampleList?functionId=" + entity.getFunctionId();
@@ -365,8 +386,10 @@ public class AvController extends BaseController {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -453,9 +476,11 @@ public class AvController extends BaseController {
if (e instanceof MaatConvertException) {
logger.info("音视频文件样例配置下发失败:" + e.getMessage());
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
logger.error("auditAvFileSample failed", e);
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}
@@ -471,8 +496,10 @@ public class AvController extends BaseController {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -501,7 +528,7 @@ public class AvController extends BaseController {
*/
@RequestMapping(value = { "/sample/auditAvAudioSignSample" })
public String auditAvAudioSignSample(Integer isAudit, Integer isValid, String ids, Integer functionId,
RedirectAttributes redirectAttributes) {
RedirectAttributes redirectAttributes,HttpServletRequest request) {
// avCfgService.auditAvSignSample(isAudit,isValid,ids);
AvSignSampleCfg entity = new AvSignSampleCfg();
String[] idArray = ids.split(",");
@@ -518,9 +545,11 @@ public class AvController extends BaseController {
if (e instanceof MaatConvertException) {
logger.error("音视频标识样例配置下发失败:" + e.getMessage());
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
logger.error("auditAvAudioSignSample failed", e);
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}
@@ -539,7 +568,7 @@ public class AvController extends BaseController {
*/
@RequestMapping(value = { "/sample/auditAvSignSample" })
public String auditAvSignSample(Integer preset, AvSignSampleCfgModel cfg, Integer functionId,
RedirectAttributes redirectAttributes) {
RedirectAttributes redirectAttributes,HttpServletRequest request) {
// 预置配置
try {
if (preset != null && 1 == preset) {// 预置信息需要在数据库中插入一条记录
@@ -553,9 +582,11 @@ public class AvController extends BaseController {
if (e1 instanceof MaatConvertException) {
logger.error("预置失败", e1);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e1, null);
} else {
logger.error("auditAvSignSample failed", e1);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e1, null);
}
}
// 修改下发配置
@@ -572,15 +603,23 @@ public class AvController extends BaseController {
// if(!avSignSampleCfg.getAction().equals(avSignSampleCfg.getActionOld())||!avSignSampleCfg.getIsValid().equals(avSignSampleCfg.getIsValidOld())){
try {
avCfgService.auditAvSignSample(avSignSampleCfg);
addMessage(redirectAttributes, "success", "save_success");
//配置仅保存
if(StringUtil.isEmpty(avSignSampleCfg.getIsValid()) || avSignSampleCfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (Exception e) {
e.printStackTrace();
if (e instanceof MaatConvertException) {
logger.error("下发失败", e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
logger.error("auditAvSignSample failed", e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}
@@ -686,6 +725,7 @@ public class AvController extends BaseController {
} catch (Exception e) {
logger.error("ysp export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
@@ -725,7 +765,7 @@ public class AvController extends BaseController {
*/
@ResponseBody
@RequestMapping(value = { "/sample/videoToPicture" })
public Map videoToPicture(Model model, @RequestParam("srcFile") CommonsMultipartFile srcFile) {
public Map videoToPicture(Model model, @RequestParam("srcFile") CommonsMultipartFile srcFile,HttpServletRequest request) {
String sep = System.getProperty("file.separator");
String random = UUID.randomUUID() + "";
@@ -796,14 +836,17 @@ public class AvController extends BaseController {
e.printStackTrace();
map.put("status", 0);
map.put("msg", e.getMessage());
LogUtils.saveLog(request, null, e, null);
} catch (InputFormatException e) {
e.printStackTrace();
map.put("status", 0);
map.put("msg", e.getMessage());
LogUtils.saveLog(request, null, e, null);
} catch (EncoderException e) {
e.printStackTrace();
map.put("status", 0);
map.put("msg", e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return map;
}
@@ -819,7 +862,7 @@ public class AvController extends BaseController {
@ResponseBody
@RequestMapping(value = { "/sample/faceToPicture" })
public Map faceToPicture(Model model, @RequestParam("srcFile") CommonsMultipartFile[] srcFile,
@RequestParam("faceFilePath") String faceFilePath) {
@RequestParam("faceFilePath") String faceFilePath,HttpServletRequest request) {
String sep = System.getProperty("file.separator");
String random = UUID.randomUUID() + "";
// String srcFilePath =
@@ -842,6 +885,7 @@ public class AvController extends BaseController {
} catch (IOException e) {
logger.error(e);
e.printStackTrace();
LogUtils.saveLog(request, null, e, null);
}
}

View File

@@ -29,6 +29,7 @@ import com.nis.domain.configuration.NtcBgpAsCfg;
import com.nis.domain.configuration.NtcSubscribeIdCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.web.controller.BaseController;
@@ -84,9 +85,11 @@ public class BgpCfgController extends BaseController {
} catch (MaatConvertException e) {
logger.error("ip白名单配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("ip白名单配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/ntc/other/bgpList?functionId=" + entity.getFunctionId();
}
@@ -152,8 +155,10 @@ public class BgpCfgController extends BaseController {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -182,10 +187,12 @@ public class BgpCfgController extends BaseController {
e.printStackTrace();
logger.error("bgp配置下发失败", e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
e.printStackTrace();
logger.error("bgp配置下发失败", e);
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
} else {
@@ -200,8 +207,10 @@ public class BgpCfgController extends BaseController {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -340,6 +349,7 @@ public class BgpCfgController extends BaseController {
} catch (Exception e) {
logger.error("bgp export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();

View File

@@ -44,6 +44,7 @@ import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.FileUtils;
import com.nis.util.JsonMapper;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -99,10 +100,12 @@ public class FileTransferCfgController extends BaseController {
e.printStackTrace();
logger.error("ftp信息保存失败", e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
e.printStackTrace();
logger.error("ftp信息保存失败", e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath + "/ntc/fileTransfer/ftpList?functionId=" + entity.getFunctionId();
@@ -171,9 +174,11 @@ public class FileTransferCfgController extends BaseController {
if (e instanceof MaatConvertException) {
logger.error("ftp配置删除失败" + e.getMessage());
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
logger.error("ftp配置删除失败", e);
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath + "/ntc/fileTransfer/ftpList?functionId=" + functionId;
@@ -203,10 +208,12 @@ public class FileTransferCfgController extends BaseController {
logger.error("ftp配置下发失败" + e.getMessage());
;
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
e.printStackTrace();
logger.error("ftp配置下发失败", e);
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}
@@ -222,8 +229,10 @@ public class FileTransferCfgController extends BaseController {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -302,9 +311,11 @@ public class FileTransferCfgController extends BaseController {
} catch (MaatConvertException e) {
logger.error("文件摘要配置下发失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("文件摘要配置保存失败:",e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/ntc/fileTransfer/fileDigestList?functionId=" + entity.getFunctionId();
}
@@ -326,9 +337,11 @@ public class FileTransferCfgController extends BaseController {
if (e instanceof MaatConvertException) {
logger.error("文件摘要配置删除失败:" + e.getMessage());
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
logger.error("文件摘要配置删除失败", e);
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -350,11 +363,14 @@ public class FileTransferCfgController extends BaseController {
logger.error("File Digest配置下发失败", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else if (e instanceof CallExternalProceduresException) {
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -372,8 +388,10 @@ public class FileTransferCfgController extends BaseController {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -503,10 +521,12 @@ public class FileTransferCfgController extends BaseController {
e.printStackTrace();
logger.error("P2P信息保存失败", e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
e.printStackTrace();
logger.error("P2P信息保存失败", e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath + "/ntc/fileTransfer/p2pList?functionId=" + entity.getFunctionId();
@@ -529,9 +549,11 @@ public class FileTransferCfgController extends BaseController {
if (e instanceof MaatConvertException) {
logger.error("P2P配置删除失败" + e.getMessage());
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
logger.error("P2P配置删除失败", e);
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath + "/ntc/fileTransfer/p2pList?functionId=" + functionId;
@@ -606,11 +628,14 @@ public class FileTransferCfgController extends BaseController {
logger.info("p2p配置下发失败" + e.getMessage());
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else if (e instanceof CallExternalProceduresException) {
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}
@@ -626,8 +651,10 @@ public class FileTransferCfgController extends BaseController {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -771,6 +798,7 @@ public class FileTransferCfgController extends BaseController {
} catch (Exception e) {
logger.error("ftp export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
@@ -915,6 +943,7 @@ public class FileTransferCfgController extends BaseController {
} catch (Exception e) {
logger.error("p2p export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
@@ -1014,6 +1043,7 @@ public class FileTransferCfgController extends BaseController {
} catch (Exception e) {
logger.error("file export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();

View File

@@ -27,7 +27,6 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.configuration.AppPolicyCfg;
import com.nis.domain.configuration.AsnKeywordCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.IpPortCfg;
@@ -66,10 +65,10 @@ import com.nis.domain.configuration.template.SnatTemplate;
import com.nis.domain.configuration.template.StringAllNotDoLogTemplate;
import com.nis.domain.configuration.template.StringAllTemplate;
import com.nis.domain.configuration.template.TopicWebsiteTemplate;
import com.nis.domain.specific.SpecificServiceCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.excel.ExportExcel;
import com.nis.web.controller.BaseController;
@@ -120,9 +119,11 @@ public class IpController extends BaseController{
} catch (MaatConvertException e) {
logger.error("ip地址配置下发失败",e);
addMessage(model, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("ip地址配置保存失败",e);
addMessage(model, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
}
@@ -181,8 +182,10 @@ public class IpController extends BaseController{
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -235,8 +238,10 @@ public class IpController extends BaseController{
logger.info("ip配置下发失败"+e.getMessage());
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -253,8 +258,10 @@ public class IpController extends BaseController{
logger.error("配置下发失败:",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -339,6 +346,7 @@ public class IpController extends BaseController{
} catch (Exception e) {
logger.error("export_failed", e);
addMessage(redirectAttributes,"error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -717,6 +725,7 @@ public class IpController extends BaseController{
} catch (Exception e) {
logger.error("ip addr export failed",e);
addMessage(redirectAttributes,"error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
}

View File

@@ -40,6 +40,7 @@ import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.FileUtils;
import com.nis.util.JsonMapper;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -116,11 +117,14 @@ public class MailCfgController extends BaseController {
} catch (Exception e) {
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else if (e instanceof CallExternalProceduresException) {
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -190,8 +194,10 @@ public class MailCfgController extends BaseController {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -221,11 +227,14 @@ public class MailCfgController extends BaseController {
logger.error("mail配置下发失败" + e.getMessage());
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else if (e instanceof CallExternalProceduresException) {
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}
@@ -241,8 +250,10 @@ public class MailCfgController extends BaseController {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -396,6 +407,7 @@ public class MailCfgController extends BaseController {
} catch (Exception e) {
logger.error("mail export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();

View File

@@ -14,15 +14,11 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.taglibs.standard.functions.Functions;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.FunctionRegionDict;
@@ -31,10 +27,6 @@ import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.domain.configuration.DnsResStrategy;
import com.nis.domain.configuration.ComplexStringCfgTemplate;
import com.nis.domain.configuration.template.IpCfgTemplate;
import com.nis.domain.specific.ConfigGroupInfo;
import com.nis.domain.configuration.StringCfgTemplate;
import com.nis.domain.configuration.HttpBodyCfg;
import com.nis.domain.configuration.HttpReqHeadCfg;
import com.nis.domain.configuration.HttpResHeadCfg;
@@ -45,8 +37,8 @@ import com.nis.exceptions.CallExternalProceduresException;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.excel.ImportExcel;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -207,9 +199,11 @@ public class WebsiteController extends BaseController {
} catch (MaatConvertException e) {
logger.error("ip白名单配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("ip白名单配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/ntc/website/httpList?functionId=" + entity.getFunctionId();
}
@@ -239,8 +233,10 @@ public class WebsiteController extends BaseController {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -268,9 +264,11 @@ public class WebsiteController extends BaseController {
} catch (MaatConvertException e) {
logger.error("http配置下发失败" + e.getMessage());
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("http配置下发失败" + e.getMessage());
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
} else {// 条件下所有配置审核
@@ -285,8 +283,10 @@ public class WebsiteController extends BaseController {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -336,9 +336,11 @@ public class WebsiteController extends BaseController {
} catch (MaatConvertException e) {
logger.error("ip白名单配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("ip白名单配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/ntc/website/sslList?functionId=" + entity.getFunctionId();
}
@@ -402,8 +404,10 @@ public class WebsiteController extends BaseController {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -433,11 +437,14 @@ public class WebsiteController extends BaseController {
logger.error("ssl配置下发失败" + e.getMessage());
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else if (e instanceof CallExternalProceduresException) {
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}
@@ -453,8 +460,10 @@ public class WebsiteController extends BaseController {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -496,9 +505,11 @@ public class WebsiteController extends BaseController {
} catch (MaatConvertException e) {
logger.error("ip白名单配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("ip白名单配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/ntc/website/dnsList?functionId=" + entity.getFunctionId();
}
@@ -557,8 +568,10 @@ public class WebsiteController extends BaseController {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -587,10 +600,12 @@ public class WebsiteController extends BaseController {
e.printStackTrace();
logger.info("dns配置下发失败" + e.getMessage());
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
e.printStackTrace();
logger.info("dns配置下发失败" + e.getMessage());
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
} else {// 条件下所有配置审核
@@ -605,8 +620,10 @@ public class WebsiteController extends BaseController {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -616,13 +633,6 @@ public class WebsiteController extends BaseController {
return "redirect:" + adminPath + "/ntc/website/dnsList?functionId=" + functionId;
}
@Deprecated
// 下载导入模板
@RequestMapping(value = "import/template")
public void importFileTemplate(HttpServletRequest request, HttpServletResponse response,
RedirectAttributes redirectAttributes, Integer functionId, Integer cfgRegionCode) {
this.importCfgTemplate(request, response, redirectAttributes, functionId, cfgRegionCode);
}
// http配置导入
/*
* @RequestMapping(value = "importHttp", method=RequestMethod.POST) public
@@ -883,6 +893,7 @@ public class WebsiteController extends BaseController {
} catch (Exception e) {
logger.error("http export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/website/httpList?functionId="+entity.getFunctionId();
@@ -1031,6 +1042,7 @@ public class WebsiteController extends BaseController {
} catch (Exception e) {
logger.error("dns export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
@@ -1177,6 +1189,7 @@ public class WebsiteController extends BaseController {
} catch (Exception e) {
logger.error("http export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/website/httpList?functionId="+entity.getFunctionId();

View File

@@ -1,7 +1,6 @@
package com.nis.web.controller.configuration.ntc;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -26,12 +25,11 @@ import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.HttpUrlCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.NtcSubscribeIdCfg;
import com.nis.domain.configuration.template.WhiteListIpTemplate;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.configuration.CommonController;
import com.nis.web.security.UserUtils;
/**
* 白名单
@@ -111,9 +109,11 @@ public class WhiteListController extends CommonController {
} catch (MaatConvertException e) {
logger.error("ip白名单配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("ip白名单配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/ntc/whitelist/ip/list?functionId=" + entity.getFunctionId();
}
@@ -135,11 +135,13 @@ public class WhiteListController extends CommonController {
ipCfgService.auditIpCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (MaatConvertException e) {
logger.info("ip配置下发失败" + e.getMessage());
logger.error("ip配置下发失败" + e.getMessage());
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.info("ip配置下发失败" + e.getMessage());
logger.error("ip配置下发失败" + e.getMessage());
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
} else {
@@ -154,8 +156,10 @@ public class WhiteListController extends CommonController {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -183,8 +187,10 @@ public class WhiteListController extends CommonController {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -262,9 +268,11 @@ public class WhiteListController extends CommonController {
} catch (MaatConvertException e) {
logger.error("ip白名单配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("ip白名单配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/ntc/whitelist/domain/list?functionId=" + entity.getFunctionId();
}
@@ -314,8 +322,10 @@ public class WhiteListController extends CommonController {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -324,13 +334,14 @@ public class WhiteListController extends CommonController {
@RequestMapping(value = { "domain/delete" })
@RequiresPermissions("whitelist:domain:config")
public String deleteDomain(String ids, Integer functionId, RedirectAttributes model) {
public String deleteDomain(String ids, Integer functionId, RedirectAttributes model,HttpServletRequest request) {
try {
domainService.deleteWhiteDomain(ids);
addMessage(model, "success", "delete_success");
} catch (Exception e) {
logger.error("删除失败", e);
addMessage(model, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/ntc/whitelist/domain/list?functionId=" + functionId;
}
@@ -357,10 +368,12 @@ public class WhiteListController extends CommonController {
e.printStackTrace();
logger.error("domain配置下发失败" + e.getMessage());
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
e.printStackTrace();
logger.error("domain配置下发失败" + e.getMessage());
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
} else {// 条件下所有配置审核
@@ -375,8 +388,10 @@ public class WhiteListController extends CommonController {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -386,24 +401,6 @@ public class WhiteListController extends CommonController {
return "redirect:" + adminPath + "/ntc/whitelist/domain/list?functionId=" + functionId;
}
// ip配置导入
/*
* @RequestMapping(value = "ip/import", method=RequestMethod.POST) public
* String importIp(String cfgName,RedirectAttributes redirectAttributes,
*
* @RequestParam("file") MultipartFile file,IpPortCfg cfg) {
* this._importIp(cfgName,redirectAttributes,
* file,cfg,WhiteListIpTemplate.class); return "redirect:" + adminPath
* +"/ntc/whitelist/ip/list?functionId="+cfg.getFunctionId(); }
*/
// ip模板下载
@RequestMapping(value = "ip/import/template")
public void importFileTemplate(HttpServletRequest request, HttpServletResponse response,
RedirectAttributes redirectAttributes, Integer functionId, Integer cfgRegionCode) {
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,
WhiteListIpTemplate.class);
}
// ip配置导出
@RequestMapping(value = "ip/export")
public void exportIp(String columns, Model model, HttpServletRequest request, HttpServletResponse response,
@@ -518,6 +515,7 @@ public class WhiteListController extends CommonController {
} catch (Exception e) {
logger.error("ip white export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
@@ -628,6 +626,7 @@ public class WhiteListController extends CommonController {
} catch (Exception e) {
logger.error("ip white export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();

View File

@@ -29,6 +29,7 @@ import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.NtcSubscribeIdCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.LogUtils;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -72,7 +73,7 @@ public class XmppController extends BaseController {
}
@RequestMapping(value = {"auditXmppCfg"})
@RequiresPermissions(value={"other:xmpp:confirm"})
public String auditXmppCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
public String auditXmppCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes,HttpServletRequest request) {
CfgIndexInfo entity = new CfgIndexInfo();
String[] idArray = ids.split(",");
for(String id :idArray){
@@ -90,8 +91,10 @@ public class XmppController extends BaseController {
logger.info("http配置下发失败"+e.getMessage());
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error","audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}

View File

@@ -27,6 +27,7 @@ import com.nis.domain.configuration.IpPortCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -117,8 +118,10 @@ public class CachePolicyController extends BaseController{
logger.error("信息保存失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error","save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -177,8 +180,10 @@ public class CachePolicyController extends BaseController{
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -213,8 +218,10 @@ public class CachePolicyController extends BaseController{
logger.info("代理缓存策略下发失败:"+e.getMessage());
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error","audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}
@@ -230,8 +237,10 @@ public class CachePolicyController extends BaseController{
logger.error("配置下发失败:",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -327,6 +336,7 @@ public class CachePolicyController extends BaseController{
} catch (Exception e) {
logger.error("ip white export failed",e);
addMessage(redirectAttributes,"error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}

View File

@@ -120,11 +120,6 @@ public class ControlController extends CommonController {
redirectAttributes.addAttribute("requiresPermissionPrefix","control:ip");
return "redirect:" + adminPath +"/proxy/control/ip/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = "/ip/import/template")
public void importFileTemplate(HttpServletRequest request,HttpServletResponse response,
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode) {
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode);
}
//ip配置导出
@RequestMapping(value = "/ip/export")
public void exportIp(String columns,Model model,HttpServletRequest request,HttpServletResponse response,

View File

@@ -3,6 +3,7 @@ package com.nis.web.controller.configuration.proxy;
import java.util.Date;
import java.util.List;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -24,6 +25,7 @@ import com.nis.domain.configuration.HttpUrlCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
@@ -79,9 +81,11 @@ public class ControlPolicyController extends BaseController{
} catch (MaatConvertException e) {
logger.error("HTTPS配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("HTTPS配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath +"/proxy/control/httpReqReplace/list?functionId="+cfg.getFunctionId();
@@ -97,7 +101,7 @@ public class ControlPolicyController extends BaseController{
}
@RequestMapping(value = {"httpReqReplace/audit"})
public String reqAudit(Integer isAudit,Integer isValid,String ids
,Integer functionId, RedirectAttributes redirectAttributes) {
,Integer functionId, RedirectAttributes redirectAttributes,HttpServletRequest request) {
if(!StringUtil.isEmpty(ids)){
String[] idArray = ids.split(",");
Date auditTime=new Date();
@@ -109,8 +113,10 @@ public class ControlPolicyController extends BaseController{
logger.error("配置下发失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error","audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}
@@ -151,13 +157,21 @@ public class ControlPolicyController extends BaseController{
,RedirectAttributes redirectAttributes){
try{
controlPolicyService.saveOrUpdate(cfg,areaCfgIds);
addMessage(redirectAttributes,"success","save_success");
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
}catch(Exception e){
logger.error("信息保存失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error","save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -174,7 +188,7 @@ public class ControlPolicyController extends BaseController{
}
@RequestMapping(value = {"httpResReplace/audit"})
public String resAudit(Integer isAudit,Integer isValid,String ids
,Integer functionId, RedirectAttributes redirectAttributes) {
,Integer functionId, RedirectAttributes redirectAttributes,HttpServletRequest request) {
if(!StringUtil.isEmpty(ids)){
String[] idArray = ids.split(",");
Date auditTime=new Date();
@@ -187,8 +201,10 @@ public class ControlPolicyController extends BaseController{
logger.error("配置下发失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error","audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}

View File

@@ -32,6 +32,7 @@ import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.FileUtils;
import com.nis.util.JsonMapper;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.configuration.CommonController;
@@ -117,13 +118,21 @@ public class FileStrategyController extends CommonController {
cfg.setContentLength(file.length());//文件长度
}
proxyFileStrategyService.saveOrUpdate(cfg);
addMessage(redirectAttributes,"success","save_success");
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
}catch(Exception e){
logger.error("信息保存失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error","save_failed");
LogUtils.saveLog(request, null, e, null);
}
}finally {
if(file != null) {

View File

@@ -38,6 +38,7 @@ import com.nis.domain.configuration.NtcSubscribeIdCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -200,8 +201,10 @@ public class HttpRedirectPolicyController extends BaseController {
logger.error("save_failed", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -236,8 +239,10 @@ public class HttpRedirectPolicyController extends BaseController {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -269,8 +274,10 @@ public class HttpRedirectPolicyController extends BaseController {
logger.info("http重定向配置下发失败" + e.getMessage());
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}
@@ -286,8 +293,10 @@ public class HttpRedirectPolicyController extends BaseController {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -517,6 +526,7 @@ public class HttpRedirectPolicyController extends BaseController {
} catch (Exception e) {
logger.error("http export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
/*
* return "redirect:" + adminPath

View File

@@ -32,6 +32,7 @@ import com.nis.domain.configuration.PxyObjSpoofingIpPool;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.configuration.CommonController;
import com.nis.web.security.UserUtils;
@@ -122,8 +123,10 @@ public class InterceptController extends CommonController {
logger.error("save_failed", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath + "/proxy/intercept/ip/list?functionId=" + entity.getFunctionId();
@@ -188,8 +191,10 @@ public class InterceptController extends CommonController {
logger.error("intercept ip audit failed", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}
@@ -204,8 +209,10 @@ public class InterceptController extends CommonController {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -229,6 +236,7 @@ public class InterceptController extends CommonController {
} catch (Exception e) {
logger.error("intercept ip delete failed", e);
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/proxy/intercept/ip/list?functionId=" + functionId;
}
@@ -391,6 +399,15 @@ public class InterceptController extends CommonController {
}
}
}
if (214==entity.getFunctionId()) {
for (CfgIndexInfo cfg : ipLists) {
if (!StringUtil.isBlank(cfg.getUserRegion1())) {
cfg.setUserRegion1(DictUtils.getDictLabels("SPOOFING_IP_TYPE", cfg.getUserRegion1(),cfg.getUserRegion1()));
}
}
}
pktBinList = BaseStringCfg.replaceBaseKeyList(pktBinList);
httpUrlList = BaseStringCfg.baseHexList(httpUrlList);
dataMap.put(entity.getMenuNameCode(), ipLists);
@@ -449,6 +466,7 @@ public class InterceptController extends CommonController {
} catch (Exception e) {
logger.error("ip addr export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();

View File

@@ -57,6 +57,7 @@ import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.FileUtils;
import com.nis.util.JsonMapper;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
@@ -101,8 +102,8 @@ public class PxyObjKeyringController extends BaseController {
boolean validFlag = true;
try {
Properties msgProp = this.getMsgProp();
boolean publicKeyFileflag = validCertFileContent(publicKeyFileI, "-incert");
boolean privateKeyFileflag = validCertFileContent(privateKeyFileI, "-inkey");
boolean publicKeyFileflag = validCertFileContent(publicKeyFileI,null, "-incert");
boolean privateKeyFileflag = validCertFileContent(privateKeyFileI,null, "-inkey");
if (!publicKeyFileflag && !privateKeyFileflag) {
addMessage(redirectAttributes, "error", "save_failed");
logger.error(publicKeyFileI.getOriginalFilename() + " and " + privateKeyFileI.getOriginalFilename()
@@ -117,15 +118,28 @@ public class PxyObjKeyringController extends BaseController {
logger.error(privateKeyFileI.getOriginalFilename() + " file non private key file format ");
throw new MultiPartNewException(msgProp.getProperty("private_file_error"));
}
//证书对校验
if(publicKeyFileflag && privateKeyFileflag){
boolean keyRingFileflag = validCertFileContent(publicKeyFileI,privateKeyFileI, "-incheck");
if (!keyRingFileflag) {
addMessage(redirectAttributes, "error", "save_failed");
logger.error(" 公私钥不匹配 ");
throw new MultiPartNewException(msgProp.getProperty("public_private_file_error"));
}
}
} catch (Exception e) {
validFlag = false;
logger.error("证书文件校验失败", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else if (e instanceof MultiPartNewException) {
addMessage(redirectAttributes, "error", e.getMessage());
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -181,10 +195,13 @@ public class PxyObjKeyringController extends BaseController {
logger.error("证书文件校验失败", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else if (e instanceof MultiPartNewException) {
addMessage(redirectAttributes, "error", e.getMessage());
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
try {
@@ -238,20 +255,29 @@ public class PxyObjKeyringController extends BaseController {
}
}
pxyObjKeyringService.saveOrUpdate(cfg);
addMessage(redirectAttributes, "success", "save_success");
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
}
} catch (MultiPartNewException e) {
logger.error("证书文件上传失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (MaatConvertException e) {
logger.error("拦截策略配置下发失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("证书上传失败", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else if (e instanceof MultiPartNewException) {
addMessage(redirectAttributes, "error", e.getMessage());
} else {
addMessage(redirectAttributes, "error", "save_failed");
}
logger.error("拦截策略配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/proxy/intercept/strateagy/list?functionId=" + cfg.getFunctionId();
}
@@ -265,7 +291,7 @@ public class PxyObjKeyringController extends BaseController {
* @return
* @throws Exception
*/
public boolean validCertFileContent(MultipartFile file, String validateType) throws Exception {
public boolean validCertFileContent(MultipartFile file,MultipartFile privateFile, String validateType) throws Exception {
String os = System.getProperty("os.name").toLowerCase();
if (!os.contains("windows") && file != null) {
// 证书文件临时保存路径
@@ -273,8 +299,16 @@ public class PxyObjKeyringController extends BaseController {
FileUtils.createDirectory(certFilePath);
String filePath = certFilePath + File.separator + UUID.randomUUID()
+ FileUtils.getSuffix(file.getOriginalFilename(), true);
String privateFilePath="";
File uploadFile = new File(filePath);
FileCopyUtils.copy(file.getBytes(), uploadFile);
if(!StringUtil.isEmpty(privateFile)){
privateFilePath=certFilePath + File.separator + UUID.randomUUID()
+ FileUtils.getSuffix(privateFile.getOriginalFilename(), true);
File privateUploadFile = new File(privateFilePath);
FileCopyUtils.copy(privateFile.getBytes(), privateUploadFile);
}
// 加载x509脚本
String x509Shell = Thread.currentThread().getContextClassLoader()
.getResource(File.separator + "shell" + File.separator + Constants.CERT_VALIDATE_FILE).getPath();
@@ -283,8 +317,8 @@ public class PxyObjKeyringController extends BaseController {
logger.info("x509 chmod +x :" + resultMap1.get("out").toString());
logger.info("x509脚本分配可执行权限:" + "chmod" + " " + "+x" + " " + x509Shell);
// 验证文件
logger.info(x509Shell + " " + validateType + " " + filePath);
Map<String, Object> resultMap = this.execShell(x509Shell, validateType, filePath);
logger.info(x509Shell + " " + validateType + " " + filePath+ " " + privateFilePath);
Map<String, Object> resultMap = this.execShell(x509Shell, validateType, filePath, privateFilePath);
if (resultMap == null || StringUtil.isEmpty(resultMap.get("out"))) {
// 临时文件删除
@@ -343,8 +377,10 @@ public class PxyObjKeyringController extends BaseController {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -367,9 +403,11 @@ public class PxyObjKeyringController extends BaseController {
} catch (MaatConvertException e) {
logger.error(e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error(e);
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -385,8 +423,10 @@ public class PxyObjKeyringController extends BaseController {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -468,6 +508,7 @@ public class PxyObjKeyringController extends BaseController {
} catch (Exception e) {
logger.error("pxyObjKeyring export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
@@ -533,6 +574,7 @@ public class PxyObjKeyringController extends BaseController {
} catch (Exception e) {
logger.error("pxyObjKeyring export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
@@ -576,7 +618,7 @@ public class PxyObjKeyringController extends BaseController {
File file = null;
boolean validFlag = true;
try {
boolean certFileflag = validCertFileContent(certFileI, "-incert");
boolean certFileflag = validCertFileContent(certFileI,null, "-incert");
if (!certFileflag) {
addMessage(redirectAttributes, "error", "save_failed");
logger.error(certFileI.getOriginalFilename() + " file non Certificate file format ");
@@ -587,10 +629,13 @@ public class PxyObjKeyringController extends BaseController {
logger.error("证书文件校验失败", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", e.getMessage());
LogUtils.saveLog(request, null, e, null);
} else if (e instanceof MultiPartNewException) {
addMessage(redirectAttributes, "error", e.getMessage());
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -613,6 +658,7 @@ public class PxyObjKeyringController extends BaseController {
validFlag = false;
logger.error("证书信息获取失败", e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
try {
if (validFlag) {
@@ -641,18 +687,27 @@ public class PxyObjKeyringController extends BaseController {
}
}
pxyObjKeyringService.trustedCertsaveOrUpdate(cfg);
addMessage(redirectAttributes, "success", "save_success");
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
}
} catch (MultiPartNewException e) {
logger.error("可信证书上传失败:",e);
addMessage(redirectAttributes, "error", e.getMessage());
LogUtils.saveLog(request, null, e, null);
} catch (MaatConvertException e) {
logger.error("可信证书单配置下发失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("证书上传失败", e);
if (e instanceof MultiPartNewException) {
addMessage(redirectAttributes, "error", e.getMessage());
} else if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
}
logger.error("可信证书配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/proxy/intercept/strateagy/trustedCertList?functionId=" + cfg.getFunctionId();
@@ -670,7 +725,7 @@ public class PxyObjKeyringController extends BaseController {
boolean validFlag = true;
try {
if (crlFileI != null) {
boolean certFileflag = validCertFileContent(crlFileI, "-incrl");
boolean certFileflag = validCertFileContent(crlFileI,null, "-incrl");
if (!certFileflag) {
addMessage(redirectAttributes, "error", "save_failed");
logger.error(crlFileI.getOriginalFilename() + " file non crl file format ");
@@ -682,10 +737,13 @@ public class PxyObjKeyringController extends BaseController {
logger.error("证书文件校验失败", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else if (e instanceof MultiPartNewException) {
addMessage(redirectAttributes, "error", e.getMessage());
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -717,8 +775,10 @@ public class PxyObjKeyringController extends BaseController {
logger.error("crl issuer比对失败", e);
if (e instanceof MultiPartNewException) {
addMessage(redirectAttributes, "error", e.getMessage());
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
try {
@@ -755,10 +815,13 @@ public class PxyObjKeyringController extends BaseController {
logger.error("crl上传失败", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else if (e instanceof MultiPartNewException) {
addMessage(redirectAttributes, "error", e.getMessage());
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -891,8 +954,10 @@ public class PxyObjKeyringController extends BaseController {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -914,10 +979,12 @@ public class PxyObjKeyringController extends BaseController {
e.printStackTrace();
logger.error(e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
e.printStackTrace();
logger.error(e);
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -933,8 +1000,10 @@ public class PxyObjKeyringController extends BaseController {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}

View File

@@ -56,6 +56,7 @@ import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.FileUtils;
import com.nis.util.JsonMapper;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
@@ -119,8 +120,10 @@ public class PxyObjSpoofingIpPoolController extends BaseController {
e.printStackTrace();
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error","save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -171,9 +174,11 @@ public class PxyObjSpoofingIpPoolController extends BaseController {
} catch (MaatConvertException e) {
logger.error(e);
addMessage(redirectAttributes,"error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
}catch (Exception e) {
logger.error(e);
addMessage(redirectAttributes,"error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@@ -255,6 +260,7 @@ public class PxyObjSpoofingIpPoolController extends BaseController {
} catch (Exception e) {
logger.error("ip white export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "redirect:" + adminPath
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();

View File

@@ -45,6 +45,7 @@ import com.nis.util.CodeDicUtils;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.excel.ExportExcel;
import com.nis.util.httpclient.HttpClientUtil;
@@ -80,7 +81,7 @@ public class DashboardController extends BaseController{
*/
@RequestMapping(value="portActive")
@ResponseBody
public List portActive(){
public List portActive(HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List list = new ArrayList();
try {
@@ -94,6 +95,7 @@ public class DashboardController extends BaseController{
e.printStackTrace();
logger.error("活跃端口数据错误"+e);
list.add(Maps.newHashMap("error","request_service_failed"));
LogUtils.saveLog(request, null, e, null);
}
return list;
}
@@ -103,7 +105,7 @@ public class DashboardController extends BaseController{
*/
@RequestMapping(value="portActiveChart")
@ResponseBody
public List portActiveChart(String beginDate,String endDate){
public List portActiveChart(String beginDate,String endDate,HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List list = new ArrayList();
try {
@@ -120,6 +122,7 @@ public class DashboardController extends BaseController{
// TODO Auto-generated catch block
e.printStackTrace();
logger.error("活跃端口详情界面数据获取错误"+e);
LogUtils.saveLog(request, null, e, null);
}
return list;
}
@@ -145,7 +148,7 @@ public class DashboardController extends BaseController{
*/
@RequestMapping(value="ipActive")
@ResponseBody
public List ipActive(String beginDate,String endDate){
public List ipActive(String beginDate,String endDate,HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List list = new ArrayList();
try {
@@ -161,6 +164,7 @@ public class DashboardController extends BaseController{
e.printStackTrace();
logger.error("活跃IP错误"+e);
list.add(Maps.newHashMap("error","request_service_failed"));
LogUtils.saveLog(request, null, e, null);
}
return list;
}
@@ -169,7 +173,7 @@ public class DashboardController extends BaseController{
*/
@RequestMapping(value="ipActiveMinuteList")
@ResponseBody
public List ipActiveMinuteList(String beginDate,String endDate,Integer entranceId){
public List ipActiveMinuteList(String beginDate,String endDate,Integer entranceId,HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List list = new ArrayList();
try {
@@ -188,6 +192,7 @@ public class DashboardController extends BaseController{
e.printStackTrace();
logger.error("活跃IP数据获取错误"+e);
list.add(Maps.newHashMap("error","request_service_failed"));
LogUtils.saveLog(request, null, e, null);
}
return list;
}
@@ -238,6 +243,7 @@ public class DashboardController extends BaseController{
e.printStackTrace();
logger.error("活跃IP统计错误"+e);
addMessage(redirectAttributes,"error","request_service_failed");
LogUtils.saveLog(request, null, e, null);
}
return "/dashboard/trafficIpActiveList";
@@ -247,7 +253,7 @@ public class DashboardController extends BaseController{
*/
@RequestMapping(value="ajaxIpActiveList")
@ResponseBody
public List ajaxIpActiveList(String beginDate,String endDate,Integer entranceId){
public List ajaxIpActiveList(String beginDate,String endDate,Integer entranceId,HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List<TrafficIpActiveStatistic> list = new ArrayList<TrafficIpActiveStatistic>();
try {
@@ -294,6 +300,7 @@ public class DashboardController extends BaseController{
} catch (Exception e) {
e.printStackTrace();
logger.error("活跃IP数据获取错误"+e);
LogUtils.saveLog(request, null, e, null);
//list.add(Maps.newHashMap("error","request_service_failed"));
}
return list;
@@ -341,6 +348,7 @@ public class DashboardController extends BaseController{
e.printStackTrace();
logger.error("IPActive export failed",e);
addMessage(redirectAttributes,"error","export_failed");
LogUtils.saveLog(request, null, e, null);
}
// return "/dashboard/trafficIpActiveList";
}
@@ -349,7 +357,7 @@ public class DashboardController extends BaseController{
*/
@RequestMapping(value="protocol")
@ResponseBody
public List protocolChart(){
public List protocolChart(HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List<Map> list = new ArrayList<Map>();
List<Map> resultList = new ArrayList<Map>();
@@ -389,6 +397,7 @@ public class DashboardController extends BaseController{
e.printStackTrace();
logger.error("协议统计错误"+e);
resultList.add(Maps.newHashMap("error","request_service_failed"));
LogUtils.saveLog(request, null, e, null);
}
return resultList;
}
@@ -397,7 +406,7 @@ public class DashboardController extends BaseController{
*/
@RequestMapping(value="app")
@ResponseBody
public List appChart(){
public List appChart(HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List<Map> list = new ArrayList<Map>();
List<Map> resultList = new ArrayList<Map>();
@@ -428,6 +437,7 @@ public class DashboardController extends BaseController{
e.printStackTrace();
logger.error("app流量分析错误"+e);
resultList.add(Maps.newHashMap("error","request_service_failed"));
LogUtils.saveLog(request, null, e, null);
}
return resultList;
}
@@ -436,7 +446,7 @@ public class DashboardController extends BaseController{
*/
@RequestMapping(value="osList")
@ResponseBody
public List osList(){
public List osList(HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List<Map> list = new ArrayList<Map>();
List<Map> resultList = new ArrayList<Map>();
@@ -467,6 +477,7 @@ public class DashboardController extends BaseController{
e.printStackTrace();
logger.error("终端用户-获取操作系统列表错误"+e);
resultList.add(Maps.newHashMap("error","request_service_failed"));
LogUtils.saveLog(request, null, e, null);
}
return resultList;
}
@@ -475,7 +486,7 @@ public class DashboardController extends BaseController{
*/
@RequestMapping(value="browserChart")
@ResponseBody
public List browserChart(@RequestParam("osType") String osType){
public List browserChart(@RequestParam("osType") String osType,HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List<Map> list = new ArrayList<Map>();
List<Map> resultList = new ArrayList<Map>();
@@ -524,6 +535,7 @@ public class DashboardController extends BaseController{
e.printStackTrace();
logger.error("终端用户-获取操作系统下浏览器类型错误"+e);
resultList.add(Maps.newHashMap("error","request_service_failed"));
LogUtils.saveLog(request, null, e, null);
}
return resultList;
}
@@ -532,7 +544,7 @@ public class DashboardController extends BaseController{
*/
@RequestMapping(value="bsList")
@ResponseBody
public List bsList(){
public List bsList(HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List<Map> list = new ArrayList<Map>();
List<Map> resultList = new ArrayList<Map>();
@@ -563,6 +575,7 @@ public class DashboardController extends BaseController{
e.printStackTrace();
logger.error("终端用户-获取浏览器列表错误"+e);
resultList.add(Maps.newHashMap("error","request_service_failed"));
LogUtils.saveLog(request, null, e, null);
}
return resultList;
}
@@ -571,7 +584,7 @@ public class DashboardController extends BaseController{
*/
@RequestMapping(value="systemChart")
@ResponseBody
public List systemChart(@RequestParam("bsType") String bsType){
public List systemChart(@RequestParam("bsType") String bsType,HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List<Map> list = new ArrayList<Map>();
List<Map> resultList = new ArrayList<Map>();
@@ -620,6 +633,7 @@ public class DashboardController extends BaseController{
e.printStackTrace();
logger.error("终端用户-获取浏览器下操作系统类型错误"+e);
resultList.add(Maps.newHashMap("error","request_service_failed"));
LogUtils.saveLog(request, null, e, null);
}
return resultList;
}
@@ -628,7 +642,7 @@ public class DashboardController extends BaseController{
*/
@RequestMapping(value="websiteList")
@ResponseBody
public List websiteList(){
public List websiteList(HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List<Map> list = new ArrayList<Map>();
List<Map> resultList = new ArrayList<Map>();
@@ -665,6 +679,7 @@ public class DashboardController extends BaseController{
e.printStackTrace();
logger.error("http网站流量分析数据错误"+e);
resultList.add(Maps.newHashMap("error","request_service_failed"));
LogUtils.saveLog(request, null, e, null);
}
return resultList;
}
@@ -673,7 +688,7 @@ public class DashboardController extends BaseController{
*/
@RequestMapping(value="webTypeChart")
@ResponseBody
public List webTypeChart(@RequestParam("websiteServiceId") String websiteServiceId){
public List webTypeChart(@RequestParam("websiteServiceId") String websiteServiceId,HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List<Map> list = new ArrayList<Map>();
List<Map> resultList = new ArrayList<Map>();
@@ -715,6 +730,7 @@ public class DashboardController extends BaseController{
e.printStackTrace();
logger.error("http某个网站子域名流量统计错误"+e);
resultList.add(Maps.newHashMap("error","request_service_failed"));
LogUtils.saveLog(request, null, e, null);
}
return resultList;
}
@@ -724,7 +740,7 @@ public class DashboardController extends BaseController{
*/
@RequestMapping(value="topicAndDomainList")
@ResponseBody
public List topicAndDomainList(){
public List topicAndDomainList(HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List<Map> list = new ArrayList<Map>();
List<Map> resultList = new ArrayList<Map>();
@@ -782,6 +798,7 @@ public class DashboardController extends BaseController{
e.printStackTrace();
logger.error("http网站主题流量分析数据错误"+e);
resultList.add(Maps.newHashMap("error","request_service_failed"));
LogUtils.saveLog(request, null, e, null);
}
return resultList;
}

View File

@@ -46,6 +46,7 @@ import com.nis.util.Constants;
import com.nis.util.DateUtil;
import com.nis.util.DateUtils;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.util.httpclient.HttpClientUtil;
@@ -64,7 +65,7 @@ public class TrafficStatisticsInfoController extends BaseController {
*/
@RequestMapping(value="info")
@ResponseBody
public Map ipActive(){
public Map ipActive(HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
HashMap<String, Object> m = new HashMap<String, Object>();
List list = new ArrayList();
@@ -114,6 +115,7 @@ public class TrafficStatisticsInfoController extends BaseController {
} catch (Exception e) {
e.printStackTrace();
logger.error("统计流量信息数据错误"+e);
LogUtils.saveLog(request, null, e, null);
}
return m;
}
@@ -149,7 +151,7 @@ public class TrafficStatisticsInfoController extends BaseController {
*/
@RequestMapping(value="actionEntranceTrans")
@ResponseBody
public List actionTrans(String beginDate,String endDate,@RequestParam("searchAction")String searchAction){
public List actionTrans(String beginDate,String endDate,@RequestParam("searchAction")String searchAction,HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List resultList = new ArrayList();
String url = Constants.DASHBOARD_URL+Constants.NTC_ACTION_ENTRANCE_REPORT;
@@ -165,6 +167,7 @@ public class TrafficStatisticsInfoController extends BaseController {
e.printStackTrace();
logger.error(searchAction+"动作详情数据获取错误"+e);
resultList.add(Maps.newHashMap("error","request_service_failed"));
LogUtils.saveLog(request, null, e, null);
}
return resultList;
}
@@ -196,7 +199,7 @@ public class TrafficStatisticsInfoController extends BaseController {
*/
@RequestMapping(value="bandwidthTrans")
@ResponseBody
public Map bandwidthTrans(String beginDate,String endDate,@RequestParam("addrType")String addrType,@RequestParam("transType")Integer transType){
public Map bandwidthTrans(String beginDate,String endDate,@RequestParam("addrType")String addrType,@RequestParam("transType")Integer transType,HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
Map map = new HashMap();
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_BANDWIDTH_TRANS;
@@ -221,6 +224,7 @@ public class TrafficStatisticsInfoController extends BaseController {
} catch (Exception e) {
e.printStackTrace();
logger.error("带宽详情数据获取错误"+e);
LogUtils.saveLog(request, null, e, null);
}
return map;
}
@@ -229,7 +233,7 @@ public class TrafficStatisticsInfoController extends BaseController {
*/
@RequestMapping(value="bandwidthTransTwo")
@ResponseBody
public Map bandwidthTransTwo(String beginDate,String endDate,@RequestParam("addrType")String addrType,@RequestParam("transType")Integer transType){
public Map bandwidthTransTwo(String beginDate,String endDate,@RequestParam("addrType")String addrType,@RequestParam("transType")Integer transType,HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
Map map = new HashMap();
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_BANDWIDTH_TRANS_TWO;
@@ -254,6 +258,7 @@ public class TrafficStatisticsInfoController extends BaseController {
} catch (Exception e) {
e.printStackTrace();
logger.error("带宽详情数据获取错误"+e);
LogUtils.saveLog(request, null, e, null);
}
return map;
}
@@ -262,7 +267,7 @@ public class TrafficStatisticsInfoController extends BaseController {
*/
@RequestMapping(value="bandwidthTransThree")
@ResponseBody
public Map bandwidthTransThree(String beginDate,String endDate,String searchQuotaType,String searchDirection,Model model){
public Map bandwidthTransThree(String beginDate,String endDate,String searchQuotaType,String searchDirection,Model model,HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
Map map = new HashMap();
//String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_BANDWIDTH_TRANS_TWO;
@@ -285,6 +290,7 @@ public class TrafficStatisticsInfoController extends BaseController {
} catch (Exception e) {
e.printStackTrace();
logger.error("带宽详情数据获取错误"+e);
LogUtils.saveLog(request, null, e, null);
}
return map;
}
@@ -307,7 +313,7 @@ public class TrafficStatisticsInfoController extends BaseController {
*/
@RequestMapping(value="protocolList")
@ResponseBody
public List protocolList(Model model,Integer entranceId,Integer[] protoType,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate,@RequestParam(required=false)String searchDirection){
public List protocolList(Model model,Integer entranceId,Integer[] protoType,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate,@RequestParam(required=false)String searchDirection,HttpServletRequest request){
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List list = new ArrayList();
@@ -377,6 +383,7 @@ public class TrafficStatisticsInfoController extends BaseController {
e.printStackTrace();
logger.error("协议详情数据获取错误"+e);
list.add(Maps.newHashMap("error","request_service_failed"));
LogUtils.saveLog(request, null, e, null);
}
return list;
}
@@ -399,7 +406,7 @@ public class TrafficStatisticsInfoController extends BaseController {
*/
@RequestMapping(value="appList")
@ResponseBody
public List appList(Integer entranceId,@RequestParam(value="appType",required=false)Integer[] appType,@RequestParam(value="beginDate",required=false)String beginDate,@RequestParam(value="endDate",required=false)String endDate){
public List appList(Integer entranceId,@RequestParam(value="appType",required=false)Integer[] appType,@RequestParam(value="beginDate",required=false)String beginDate,@RequestParam(value="endDate",required=false)String endDate,HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List list = new ArrayList();
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_APP_LIST;
@@ -457,6 +464,7 @@ public class TrafficStatisticsInfoController extends BaseController {
e.printStackTrace();
logger.error("app详情数据获取错误"+e);
list.add(Maps.newHashMap("error","request_service_failed"));
LogUtils.saveLog(request, null, e, null);
}
return list;
}
@@ -495,7 +503,7 @@ public class TrafficStatisticsInfoController extends BaseController {
}
@RequestMapping("ajaxAppTrend")
@ResponseBody
public Map ajaxAppTrend(String beginDate,String endDate,Integer appType,Integer entranceId,String searchQuotaType,Integer[] searchIspCode,Model model){
public Map ajaxAppTrend(String beginDate,String endDate,Integer appType,Integer entranceId,String searchQuotaType,Integer[] searchIspCode,Model model,HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
Map list = new HashMap();
try {
@@ -533,12 +541,13 @@ public class TrafficStatisticsInfoController extends BaseController {
e.printStackTrace();
logger.error("app趋势图数据获取错误"+e);
list.put("error","request_service_failed");
LogUtils.saveLog(request, null, e, null);
}
return list;
}
@RequestMapping("ajaxAppTopList")
@ResponseBody
public List ajaxAppTopList(String beginDate,String endDate,Integer appType,Integer entranceId,Integer searchQuota,Integer[] searchIspCode,Model model){
public List ajaxAppTopList(String beginDate,String endDate,Integer appType,Integer entranceId,Integer searchQuota,Integer[] searchIspCode,Model model,HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List<Map> list = new ArrayList<Map>();
try {
@@ -584,6 +593,7 @@ public class TrafficStatisticsInfoController extends BaseController {
e.printStackTrace();
logger.error("app列表Top100"+e);
list.add(Maps.newHashMap("error","request_service_failed"));
LogUtils.saveLog(request, null, e, null);
}
return list;
}
@@ -616,7 +626,7 @@ public class TrafficStatisticsInfoController extends BaseController {
}
@RequestMapping("ajaxDomainTrans")
@ResponseBody
public List ajaxDomainTrans(String beginDate,String endDate,Integer domain,Integer entranceId,Model model){
public List ajaxDomainTrans(String beginDate,String endDate,Integer domain,Integer entranceId,Model model,HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List list = new ArrayList();
try {
@@ -638,6 +648,7 @@ public class TrafficStatisticsInfoController extends BaseController {
e.printStackTrace();
logger.error("活跃域名数据获取错误"+e);
list.add(Maps.newHashMap("error","request_service_failed"));
LogUtils.saveLog(request, null, e, null);
}
return list;
}
@@ -646,7 +657,7 @@ public class TrafficStatisticsInfoController extends BaseController {
*/
@RequestMapping(value="websiteList")
@ResponseBody
public List websiteList(Integer entranceId,Integer[] domain,Model model,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate){
public List websiteList(Integer entranceId,Integer[] domain,Model model,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate,HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List list = new ArrayList();
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_WEBSITELIST_NOTIME;
@@ -742,6 +753,7 @@ public class TrafficStatisticsInfoController extends BaseController {
e.printStackTrace();
logger.error("网站域名数据获取错误"+e);
list.add(Maps.newHashMap("error","request_service_failed"));
LogUtils.saveLog(request, null, e, null);
}
return list;
}
@@ -751,7 +763,7 @@ public class TrafficStatisticsInfoController extends BaseController {
*/
@RequestMapping(value="statisticList")
@ResponseBody
public List statisticList(Model model,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate){
public List statisticList(Model model,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate,HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
List list = new ArrayList();
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_TOPICLIST;
@@ -816,6 +828,7 @@ public class TrafficStatisticsInfoController extends BaseController {
e.printStackTrace();
logger.error("协议详情数据获取错误"+e);
list.add(Maps.newHashMap("error","request_service_failed"));
LogUtils.saveLog(request, null, e, null);
}
return list;
}
@@ -836,7 +849,7 @@ public class TrafficStatisticsInfoController extends BaseController {
}
@RequestMapping("ajaxNtcTotalReportDetail")
@ResponseBody
public Map ajaxNtcTotalReportDetail(String beginDate,String endDate,Model model,String searchAction){
public Map ajaxNtcTotalReportDetail(String beginDate,String endDate,Model model,String searchAction,HttpServletRequest request){
Map<String, Object> fromJsonList = new HashMap<String, Object>();
Map map = new HashMap();
try {
@@ -882,6 +895,7 @@ public class TrafficStatisticsInfoController extends BaseController {
} catch (Exception e) {
e.printStackTrace();
logger.error("动作详情统计一小时数据获取错误"+e);
LogUtils.saveLog(request, null, e, null);
}
return map;
}

View File

@@ -30,6 +30,7 @@ import com.nis.domain.dashboard.PageDashboard;
import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
@@ -203,6 +204,7 @@ public class TrafficStatisticsReportController extends BaseController {
} catch (Exception e) {
e.printStackTrace();
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
}
return "/dashboard/trafficUserBehavior";
}
@@ -283,6 +285,7 @@ public class TrafficStatisticsReportController extends BaseController {
} catch (Exception e) {
e.printStackTrace();
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
}
return null;
}
@@ -503,6 +506,7 @@ public class TrafficStatisticsReportController extends BaseController {
} catch (Exception e) {
e.printStackTrace();
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
}
}

View File

@@ -31,6 +31,7 @@ import com.nis.domain.maat.LogRecvData;
import com.nis.util.CodeDicUtils;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
@@ -107,6 +108,7 @@ public class DkBehaviorLogController extends BaseController{
} catch (Exception e) {
logger.error("查询行为识别日志失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/manipulation/dkBehaviorList";
}
@@ -208,6 +210,7 @@ public class DkBehaviorLogController extends BaseController{
} catch (Exception e) {
logger.error(name +" export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}

View File

@@ -27,6 +27,7 @@ import com.nis.domain.maat.LogRecvData;
import com.nis.util.CodeDicUtils;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.dao.dashboard.codedic.CodeResult;
@@ -90,6 +91,7 @@ public class AppLogController extends BaseController{
} catch (Exception e) {
logger.error("查询App日志失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/ntc/appList";
}

View File

@@ -29,6 +29,7 @@ import com.nis.domain.log.NtcCollectRadiusLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -76,6 +77,7 @@ public class BgpLogController extends BaseController {
} catch (Exception e) {
logger.error("查询失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/ntc/bgpList";
@@ -146,6 +148,7 @@ public class BgpLogController extends BaseController {
} catch (Exception e) {
logger.error("bgp_control export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}

View File

@@ -43,6 +43,7 @@ import com.nis.util.CodeDicUtils;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.dao.dashboard.codedic.CodeResult;
@@ -168,6 +169,7 @@ public class CollectVoipLogController extends BaseController {
} catch (Exception e) {
logger.error("查询VoIP泛收日志失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/ntc/collectVoipList";
}
@@ -293,6 +295,7 @@ public class CollectVoipLogController extends BaseController {
} catch (Exception e) {
logger.error("collect_voip export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}

View File

@@ -34,6 +34,7 @@ import com.nis.domain.log.NtcDdosLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtils;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
@@ -108,6 +109,7 @@ public class DdosLogController extends BaseController{
} catch (Exception e) {
logger.error("查询Ddos日志失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/ntc/ddosList";
}
@@ -187,6 +189,7 @@ public class DdosLogController extends BaseController{
} catch (Exception e) {
logger.error("DDOS export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}

View File

@@ -29,6 +29,7 @@ import com.nis.domain.log.NtcDnsLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -75,6 +76,7 @@ public class DnsLogController extends BaseController {
} catch (Exception e) {
logger.error("查询失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/ntc/dnsList";
@@ -146,6 +148,7 @@ public class DnsLogController extends BaseController {
} catch (Exception e) {
logger.error("DNS export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}

View File

@@ -32,6 +32,7 @@ import com.nis.domain.log.NtcOpenVpnLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -93,6 +94,7 @@ public class FtpLogController extends BaseController {
} catch (Exception e) {
logger.error("查询Ftp日志失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/ntc/ftpList";
}
@@ -162,6 +164,7 @@ public class FtpLogController extends BaseController {
} catch (Exception e) {
logger.error("ftp_control export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}

View File

@@ -31,6 +31,7 @@ import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.Encodes;
import com.nis.util.LogUtils;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -83,6 +84,7 @@ public class HttpKeyLogController extends BaseController {
} catch (Exception e) {
logger.error("查询失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/ntc/httpKeyList";
@@ -160,6 +162,7 @@ public class HttpKeyLogController extends BaseController {
} catch (Exception e) {
logger.error("http_keyword export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}

View File

@@ -28,6 +28,7 @@ import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.Encodes;
import com.nis.util.LogUtils;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -80,6 +81,7 @@ public class HttpLogController extends BaseController {
} catch (Exception e) {
logger.error("查询失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/ntc/httpList";
@@ -156,6 +158,7 @@ public class HttpLogController extends BaseController {
} catch (Exception e) {
logger.error("HTTP export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}

View File

@@ -0,0 +1,175 @@
package com.nis.web.controller.log.ntc;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.PageLog;
import com.nis.domain.SysUser;
import com.nis.domain.log.NtcHttpObjScanResultLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@Controller
@RequestMapping("${adminPath}/log/ntc/httpObjScanResult")
public class HttpObjScanResultLogController extends BaseController {
@RequestMapping(value = { "list", "" })
public String list(@ModelAttribute("log") NtcHttpObjScanResultLog log, Model model, HttpServletRequest request,
HttpServletResponse response) {
try {
PageLog<NtcHttpObjScanResultLog> page = new PageLog<NtcHttpObjScanResultLog>(request, response);
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());
if (StringUtils.isNotBlank(log.getUrl())) {
String httpurl = StringEscapeUtils.unescapeHtml(log.getUrl());
params.put("searchUrl", httpurl);
}
initLogSearchValue(log, params);
if (StringUtils.isNotBlank(log.getdPort())) {
params.put("searchDPort", log.getdPort());
}
if (StringUtils.isNotBlank(log.getsPort())) {
params.put("searchSPort", log.getsPort());
}
if (null != log.getDeviceId()) {
params.put("searchDeviceId", log.getDeviceId());
}
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
model.addAttribute("serviceList", serviceList);
String url = Constants.LOG_BASE_URL + Constants.NTC_HTTP_OBJSCAN_RESULT_LOGS;
String recv = HttpClientUtil.getMsg(url, params, request);
Gson gson = new GsonBuilder().create();
LogRecvData<NtcHttpObjScanResultLog> fromJson = gson.fromJson(recv,
new TypeToken<LogRecvData<NtcHttpObjScanResultLog>>() {
}.getType());
if (fromJson.getStatus().intValue() == 200) {
Page<NtcHttpObjScanResultLog> data = fromJson.getData();
page.setCount(data.getCount());
page.setLast(data.getLast());
page.setList(data.getList());
List<NtcHttpObjScanResultLog> list = page.getList();
for (NtcHttpObjScanResultLog l : list) {
l.setFunctionId(log.getFunctionId());
setLogAction(l, serviceList);
}
model.addAttribute("page", page);
}
} catch (Exception e) {
logger.error("查询失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/ntc/httpObjScanResultList";
}
// 文件离线扫描结果 导出
@RequestMapping(value = "exportHttpObjScanResult")
public void exportHttpObjScanResult(@ModelAttribute("log") NtcHttpObjScanResultLog log, Model model, String hColumns, String type,
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
try {
// export data info
List<String> titleList = new ArrayList<String>();
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
Map<String, List> dataMap = new HashMap<String, List>();
Map<String, String> noExportMap = new HashMap<String, String>();
// ---------------------------
PageLog<NtcHttpObjScanResultLog> page = new PageLog<NtcHttpObjScanResultLog>(request, response);
page.setPageNo(1);
page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE);
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());
if (StringUtils.isNotBlank(log.getUrl())) {
String httpurl = StringEscapeUtils.unescapeHtml(log.getUrl());
params.put("searchUrl", httpurl);
}
initLogSearchValue(log, params);
if (StringUtils.isNotBlank(log.getdPort())) {
params.put("searchDport", log.getdPort());
}
if (StringUtils.isNotBlank(log.getsPort())) {
params.put("searchSport", log.getsPort());
}
if (null != log.getDeviceId()) {
params.put("searchDeviceId", log.getDeviceId());
}
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
model.addAttribute("serviceList", serviceList);
String url = Constants.LOG_BASE_URL + Constants.NTC_HTTP_OBJSCAN_RESULT_LOGS;
String recv = HttpClientUtil.getMsg(url, params, request);
List<NtcHttpObjScanResultLog> list = new ArrayList<NtcHttpObjScanResultLog>();
if (StringUtils.isNotBlank(recv)) {
Gson gson = new GsonBuilder().create();
LogRecvData<NtcHttpObjScanResultLog> fromJson = gson.fromJson(recv,
new TypeToken<LogRecvData<NtcHttpObjScanResultLog>>() {
}.getType());
if (fromJson.getStatus().intValue() == 200) {
Page<NtcHttpObjScanResultLog> data = fromJson.getData();
list = data.getList();
}
}
for (NtcHttpObjScanResultLog l : list) {
l.setFunctionId(log.getFunctionId());
setLogAction(l, serviceList);
}
titleList.add("http_obj_scan_result");
classMap.put("http_obj_scan_result", NtcHttpObjScanResultLog.class);
SysUser user = UserUtils.getUser();
if (!user.isAdmin()) {
hColumns += ",scene_file,";
} else {
hColumns += ",";
}
String cfgIndexInfoNoExport = ",action,cfg_id,"
+ hColumns;
noExportMap.put("http_obj_scan_result", cfgIndexInfoNoExport);
dataMap.put("http_obj_scan_result", list);
String timeRange = initLogMap(log, "http_obj_scan_result");
noExportMap.put("timeRange", timeRange);
if ("csv".equals(type)) {
this._exportCsv(model, request, response, redirectAttributes, "http_obj_scan_result", titleList, classMap,
dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, "http_obj_scan_result", titleList, classMap, dataMap,
noExportMap);
}
} catch (Exception e) {
logger.error("http_obj_scan_result export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}

View File

@@ -29,6 +29,7 @@ import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.Encodes;
import com.nis.util.LogUtils;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -91,6 +92,7 @@ public class HttpRecordLogController extends BaseController {
} catch (Exception e) {
logger.error("查询失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/ntc/httpRecordList";
@@ -178,6 +180,7 @@ public class HttpRecordLogController extends BaseController {
} catch (Exception e) {
logger.error("http_record export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}

View File

@@ -24,6 +24,7 @@ import com.nis.domain.log.NtcIpLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
@@ -73,6 +74,7 @@ public class IpLogController extends BaseController {
} catch (Exception e) {
logger.error("查询失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/ntc/ipList";
@@ -110,6 +112,7 @@ public class IpLogController extends BaseController {
} catch (Exception e) {
logger.error("查询失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/ntc/ipList";
@@ -181,6 +184,7 @@ public class IpLogController extends BaseController {
} catch (Exception e) {
logger.error("Ip" + " export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}

View File

@@ -24,6 +24,7 @@ import com.nis.domain.log.NtcIpLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
@@ -77,6 +78,7 @@ public class IpWhiteLogController extends BaseController {
} catch (Exception e) {
logger.error("查询失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/ntc/ipWhiteList";
@@ -152,6 +154,7 @@ public class IpWhiteLogController extends BaseController {
} catch (Exception e) {
logger.error("Ip" + " export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}

View File

@@ -27,6 +27,7 @@ import com.nis.domain.log.NtcIpsecLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
@@ -82,6 +83,7 @@ public class IpsecLogController extends BaseController{
} catch (Exception e) {
logger.error("查询Ipsec日志失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/ntc/ipsecList";
}

View File

@@ -26,6 +26,7 @@ import com.nis.domain.log.IrDnatLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -68,6 +69,7 @@ public class IrDnatLogController extends BaseController {
} catch (Exception e) {
logger.error("查询失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/ntc/irDnatLogList";
@@ -135,6 +137,7 @@ public class IrDnatLogController extends BaseController {
} catch (Exception e) {
logger.error("dnat_multiplex export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}

View File

@@ -26,6 +26,7 @@ import com.nis.domain.log.IrSnatLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -69,6 +70,7 @@ public class IrSnatLogController extends BaseController {
} catch (Exception e) {
logger.error("查询失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/ntc/irSnatLogList";
@@ -136,6 +138,7 @@ public class IrSnatLogController extends BaseController {
} catch (Exception e) {
logger.error("snat_multiplex export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}

View File

@@ -25,6 +25,7 @@ import com.nis.domain.log.NtcL2tpLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
@@ -67,6 +68,7 @@ public class L2tpLogController extends BaseController {
} catch (Exception e) {
logger.error("L2TP日志查询失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/ntc/l2tpLogList";

View File

@@ -30,6 +30,7 @@ import com.nis.domain.log.NtcMailLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
@@ -105,6 +106,7 @@ public class MailLogController extends BaseController {
} catch (Exception e) {
logger.error("查询失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/ntc/mailList";
@@ -203,6 +205,7 @@ public class MailLogController extends BaseController {
} catch (Exception e) {
logger.error("mail_control export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}

View File

@@ -30,6 +30,7 @@ import com.nis.domain.log.NtcMailLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -86,6 +87,7 @@ public class MailRecordLogController extends BaseController {
} catch (Exception e) {
logger.error("查询失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/ntc/mailRecordList";
@@ -95,7 +97,7 @@ public class MailRecordLogController extends BaseController {
@RequestMapping(value = "exportMail")
public void exportMail(@ModelAttribute("log") NtcMailLog log, Model model, String hColumns, String type,
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
System.out.println("进来了Mail泛收");
// System.out.println("进来了Mail泛收");
try {
// export data info
List<String> titleList = new ArrayList<String>();
@@ -166,6 +168,7 @@ public class MailRecordLogController extends BaseController {
} catch (Exception e) {
logger.error("mail_record export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}

View File

@@ -26,6 +26,7 @@ import com.nis.domain.log.NtcMailLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
@@ -82,6 +83,7 @@ public class MmAvIpLogController extends BaseController{
} catch (Exception e) {
logger.error("查询音视频IP日志失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/ntc/mmAvIpList";
}

View File

@@ -31,6 +31,7 @@ import com.nis.domain.log.NtcStreamMediaLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -94,6 +95,7 @@ public class MmAvUrlLogController extends BaseController {
} catch (Exception e) {
logger.error("查询音视频url日志失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/ntc/ntcStreamMedia";
}
@@ -164,6 +166,7 @@ public class MmAvUrlLogController extends BaseController {
} catch (Exception e) {
logger.error("streaming_media export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}

Some files were not shown because too many files have changed in this diff Show More