252 Commits

Author SHA1 Message Date
段冬梅
fa1e2fab5f 20190630线上升级sql内容,以及0508-0610的升级sql记录 2019-07-03 15:07:20 +08:00
wangxin
155bd134fc 修复请至少选择一个组中文国际化错误 2019-07-02 17:43:48 +08:00
段冬梅
3384f7e604 Update README.md 2019-07-01 17:35:20 +08:00
wangxin
2155998f13 加入参数控制json超过一定长度不打印 2019-06-28 16:01:44 +08:00
zhangwenqing
0edcf7162f 修改ObjectList导入,减少遍历次数 2019-06-28 15:40:14 +08:00
zhangwenqing
7080e65671 清空配置增加策略分组处理 2019-06-27 16:27:56 +08:00
wangxin
06221477a5 修复计算ip region数量时destIpAddress写成srcIpAddress 2019-06-27 14:41:23 +08:00
shangguanyanfei
6e646d83e5 流量统计-统计页面错误提示信息修改 2019-06-27 10:33:17 +08:00
wangwei
fe24ba0fc6 Merge branch 'develop_no_common_group' of git@git.mesalab.cn:K18_NTCS_WEB/NTC.git into develop_no_common_group 2019-06-27 09:05:06 +08:00
wangxin
1c8ff7cb08 针对IP region range情况做出特殊优化,一次获取region ID 2019-06-26 18:34:10 +08:00
zhangwenqing
3ddd809066 修正ObjectList管理域配置批量删除时 错误取消策略配置bug 2019-06-26 17:40:47 +08:00
wangxin
c0f424579b 修正勾选审核提示compile id 2019-06-26 17:27:01 +08:00
shangguanyanfei
881372118e 流量统计-统计页面 修改服务接口异常时提示的错误信息 2019-06-26 16:56:45 +08:00
wangwei
e746cb413e 替换内置拦截白名单策略 2019-06-26 16:42:19 +08:00
shangguanyanfei
d1335db3a3 流量统计-统计页面 阻断监测查询条件修改 2019-06-26 15:19:40 +08:00
wangwei
c6e315e1bc Merge branch 'develop_no_common_group' of git.mesalab.cn:K18_NTCS_WEB/NTC into develop_no_common_group 2019-06-26 15:12:38 +08:00
wangwei
51a833f9fb 添加内置拦截白名单策略
不能修改不能删除不能无效
2019-06-26 15:11:58 +08:00
wangwei
714ac134f8 添加内置拦截白名单策略
不能修改不能删除不能无效
2019-06-26 15:01:17 +08:00
wangwei
a1f0f432e7 批量审核取消添加条件判断避免执行无用代码 2019-06-26 13:10:59 +08:00
shangguanyanfei
2ed5ae2727 流量统计-统计页面的配置ID统计二级页面添加serviceId的查询条件 2019-06-26 11:37:39 +08:00
wangwei
9d47a56130 ProxyPolicyObject菜单:配置批量取消审核过滤被引用策略 2019-06-26 10:57:14 +08:00
zhangwenqing
11a5d1a65f 删掉重复国际化代码 2019-06-26 09:52:24 +08:00
wangwei
8db3eca2e0 修正interceptPolicy默认值:MirrorClientVersions 2019-06-26 09:05:24 +08:00
zhangwenqing
8fb4f6e5b5 Object List批量删除增加提示信息 2019-06-25 17:47:47 +08:00
wangxin
ca17b49bf8 intercept列表展示与导出替换为国际化code 2019-06-25 15:13:41 +08:00
wangxin
e82e69edbc Merge remote-tracking branch 'origin/develop_no_common_group' into develop_no_common_group 2019-06-25 14:34:36 +08:00
wangxin
28c9d6d107 group添加默认空的选项,列表与导出添加协议 2019-06-25 14:34:10 +08:00
duandongmei
090ab473c2 DDoS菜单sql更改 2019-06-25 13:51:18 +08:00
wangwei
98477b8e08 去除多余代码 2019-06-25 11:38:48 +08:00
wangwei
d12973f2bf 可新证书页面去除文件格式校验 2019-06-25 09:36:29 +08:00
wangwei
c9f99cb592 修复data-original-title鼠标聚焦时提示信息不提示bug 2019-06-25 09:27:54 +08:00
wangwei
15aee31e5d Trusted Certificate新增时添加文件格式提示信息 2019-06-25 09:26:27 +08:00
wangwei
d2787f6080 打开可信证书文件检验 2019-06-24 19:37:56 +08:00
zhangwenqing
e9a06cabaf 修正ObjectList模块导入功能 2019-06-24 17:10:35 +08:00
wangxin
e23b638907 调整批量审核错误提示,既保持查询条件也能提示错误 2019-06-24 16:43:06 +08:00
wangxin
240b10a05d Policy Group加入IP下发逻辑 2019-06-24 16:18:32 +08:00
wangwei
05599738d9 切换文件格式提示错误但能提交bug 2019-06-24 13:44:39 +08:00
wangwei
a97c2b51c0 修复ResponsePage导出筛选无效bug、国际化字段更新 2019-06-24 13:26:24 +08:00
wangxin
7ad3d9a80b 修复选择导出异常 2019-06-24 11:14:56 +08:00
wangxin
7dfe52590b 修复Policy Group导出列顺序,action与界面不一致,url组中出现null 2019-06-24 11:08:27 +08:00
zhangwenqing
1eaf3fb4c6 1.修复HTTP(s) Monitor/Block配置导出无请求内容、响应头域BUG
2.增加分组域管理Excel导入GroupName必填校验
2019-06-24 10:36:36 +08:00
wangwei
a0ecce4678 修复TrustedCertificate导出多出Crl文件列 2019-06-24 10:24:16 +08:00
wangwei
5f63be0c72 keyring再次颁发有效期(天)可填写小数的bug 2019-06-24 10:22:45 +08:00
wangwei
92c34a108c 修复keyring导出缺少 CRL列、再次颁发有效期(天)可填写小数的bug 2019-06-24 10:05:42 +08:00
wangwei
c812bebb2d ResponsePage增加导出功能 2019-06-23 18:19:06 +08:00
wangwei
30ec0dc379 修复表单未选择文件时 会出现文件格式错误提示 2019-06-23 17:42:19 +08:00
wangwei
d7fc2a1d81 修复InsertScripts、TrafficMirror导出列名不一致bug 2019-06-23 17:11:10 +08:00
wangwei
540d669073 TrafficMirror:添加AddressList属性值大小限制 2019-06-23 16:55:38 +08:00
duandongmei
8910c864ef cacert文件夹创建 2019-06-22 18:18:57 +08:00
wangwei
24ff189f8d 修复非系统内置证书无法编辑,仍提示禁止操作bug 2019-06-22 18:09:31 +08:00
wangwei
30b8d63f21 修正劫持、注入脚本、访问阻断页面文件校验及阻断页面文件描述字符长度校验 2019-06-22 16:32:57 +08:00
wangxin
32e35b4bc3 group多选改为单选 2019-06-22 10:42:19 +08:00
wangxin
891d1a9cbb 修改service字典,monit时Block的action doLog disable值0去掉,页面doLog在非拦截时交由service字典控制 2019-06-21 17:51:50 +08:00
wangwei
fd3b6f8fca 修复interceptPolicy导出不一致bug 2019-06-21 17:35:20 +08:00
wangwei
d67a25335f interceptPolicy界面去除限速的判断 2019-06-21 17:34:28 +08:00
wangwei
4a3e865c75 interceptPolicy去掉限速action、IP和域名都不填bug 2019-06-21 16:35:52 +08:00
zhangwenqing
84579c8f3f 1.修改分组域配置批量删除逻辑
2.修正分组域配置删除提示信息
3.补漏表单GroupName必填
2019-06-21 15:59:18 +08:00
wangxin
d6f8927499 ojb-list-group 策略用户自定义域默认返回0 2019-06-21 14:56:07 +08:00
wangxin
399396815f form表单注释HTTPS跟Intercept,恢复之前被注释的取消配置代码 2019-06-21 10:35:55 +08:00
wangxin
eab1a85554 修复数值域无协议ID的时候仍然下发的bug 2019-06-20 18:47:26 +08:00
wangwei
b5e49c5dba Merge branch 'develop_no_common_group' of git.mesalab.cn:K18_NTCS_WEB/NTC into develop_no_common_group 2019-06-20 18:34:54 +08:00
wangwei
38f63b8175 更新国际化 2019-06-20 18:33:42 +08:00
zhangwenqing
b4c06301b0 1.IP分组域配置修改增加修改人/时间
2.修复携带查询条件无法导出数据bug
3.优化分组域配置导入
2019-06-20 18:06:38 +08:00
wangwei
8217770d6d InterceptPolicy:添加protocol errors参数、且修正默认参数 2019-06-20 17:59:50 +08:00
wangwei
cf6d462feb 修改keyring可信证书和不可信证书名称 2019-06-20 17:50:51 +08:00
wangxin
620f26fa2f (1)加入HTTP协议的Object-Group Policy
(2)修复增域删域的逻辑错误
(3)调整拦截自定义域
2019-06-20 16:53:23 +08:00
wangwei
0a695b3a51 理相关的应答头的district的值set-cookie修改为Set-Cookie 2019-06-19 18:10:58 +08:00
shangguanyanfei
6eafd88642 流量统计-统计菜单页面查询条件样式调整 2019-06-19 17:03:32 +08:00
wangxin
fc339cae7e 初始表单当非选中拦截的时候隐藏域名组 2019-06-19 16:40:32 +08:00
zhangwenqing
bb13d8bbec 1.增加列表缺少字段导出相应修改 2.增加分组域配置批量删除功能 3.修复分组域配置导入不下发bug 2019-06-19 16:15:21 +08:00
wangxin
5f7eb1ec43 清空所有域以后引用组的定时任务删除 2019-06-19 11:13:41 +08:00
zhangwenqing
46fd30e443 修正菜单sql 2019-06-19 09:36:34 +08:00
shangguanyanfei
ce75edd0d2 流量统计-统计菜单配置统计查询列表点击方法修改 2019-06-18 14:15:41 +08:00
wangxin
01655fcc4c sublist修正 2019-06-18 12:25:24 +08:00
wangxin
629a92a2ce 恢复ssl version min与max的值,obj-list-group界面去除 日志总量一列的展示 2019-06-18 10:20:42 +08:00
wangwei
f03cba22dd 拦截策略Pinning提示信息 2019-06-18 09:19:19 +08:00
wangxin
a1a2324304 Merge remote-tracking branch 'origin/develop_no_common_group' into develop_no_common_group 2019-06-17 19:01:25 +08:00
wangxin
e622288234 (1)Obj-list-group sub页面增加定时任务展示
(2)修复form表单当默认monitor动作时Intercept无法展示的bug
(3)调整拦截动作下发userregion
2019-06-17 19:00:51 +08:00
wangwei
eb3616f6ff 更新国际化文件 2019-06-17 18:58:21 +08:00
shangguanyanfei
323920263d 流量统计-统计页面初始化默认时间修改 2019-06-17 17:21:10 +08:00
wangwei
25a5cc802e 修正intercept Policy菜单keyring默认值为1 2019-06-17 16:46:50 +08:00
duandongmei
889d58ca11 去掉proxy_file_strategy_cfg的修改 2019-06-17 16:38:42 +08:00
shangguanyanfei
e08ee12192 删除统计-国家代理的菜单,统计页面-阻断和监测页面去掉图表的百分比显示和饼图的展示 2019-06-17 15:43:01 +08:00
段冬梅
9bcf405945 删除新的统计菜单更改sql,object-list-group国际化更改 2019-06-17 15:12:02 +08:00
zhangwenqing
a403a82922 修改公共组管理表sql 2019-06-17 14:36:28 +08:00
wangwei
0cdbbe4201 操控 动作字段的CSV导出国际化修改 2019-06-17 14:26:25 +08:00
段冬梅
bc2b862e39 object-list-group菜单sql及国际化整理 2019-06-17 13:56:11 +08:00
wangwei
f41d43b843 修复intercept Policy内置配置修改失败bug 2019-06-17 13:14:23 +08:00
wangwei
48a294fac3 修复intercept Policy新增bug 2019-06-17 10:40:42 +08:00
wangwei
a4e5b0f78d 修复intercept Policy新增bug 2019-06-17 09:04:39 +08:00
wangxin
55e2272333 组长度超过20省略号展示,导出doLog调整 2019-06-15 18:20:24 +08:00
wangxin
1d0835a563 当组为空的时候不审核,修复排序报错 2019-06-15 16:53:43 +08:00
wangxin
10d153c40f obj-group-list隐藏doBlackList,拦截行为的doLog值设置为2 2019-06-15 11:50:13 +08:00
wangxin
ef16dddf34 obj-group-list批量操作打开 2019-06-14 19:21:01 +08:00
wangxin
1d64a1bc0f (1)审核修正userregion,定时userregion修正
(2)form表单monit修正,list group为空报错修复
(3)删除组下的域配置相关逻辑修正
2019-06-14 18:47:31 +08:00
wangwei
0f06c49b48 统一国际化配置 2019-06-14 18:07:04 +08:00
zhangwenqing
d245ef7dc4 分组配置管理GroupName改为可手动输入 2019-06-14 17:12:41 +08:00
wangwei
3aebe7d905 修复keyring可信证书不可取消审核和导入内置判断:1or0 2019-06-14 16:43:58 +08:00
zhangwenqing
2190ee447d 修改分组配置管理菜单sql 2019-06-14 14:04:00 +08:00
wangxin
3cf97daa6a obj-group-list列表sql权限修正 2019-06-14 11:40:47 +08:00
wangxin
f232a5b90a 域清空时取消obj-group-list maat配置 2019-06-14 11:29:03 +08:00
段冬梅
1c4308e536 拦截内置配置:允许修改、不允许删除。
keyring内置配置:允许修改,不允许删除。
可信证书内置配置:不允许修改,允许删除(未被引用)。
2019-06-14 11:16:54 +08:00
段冬梅
7ce70a10f8 keyring内置证书 2019-06-14 10:24:10 +08:00
段冬梅
b280c23021 keyring内置证书导入功能 2019-06-14 10:20:13 +08:00
段冬梅
1031b0a118 Merge branch 'develop_no_common_group' of https://git.mesalab.cn/K18_NTCS_WEB/NTC.git into develop_no_common_group 2019-06-14 10:17:57 +08:00
段冬梅
6a9c2db32a keyring内置证书功能导入 2019-06-14 10:17:46 +08:00
wangxin
1441b6697b obj-group-list修正ip range下发 2019-06-14 09:13:37 +08:00
wangxin
98f1722bdd obj-group-list列表界面注释子配置展开三角;form表单注释http选项 2019-06-13 21:05:14 +08:00
wangxin
7501eb4317 对象组提交 2019-06-13 20:57:29 +08:00
shangguanyanfei
446c802ece 流量统计-统计页面 增加查询失败界面的提示信息 2019-06-13 18:41:26 +08:00
段冬梅
a12b74b1d3 增加内置拦截策略的提示信息 2019-06-13 15:29:27 +08:00
段冬梅
c58bac38d1 拦截内置compile_id=0配置;
拦截内置配置不允许删除、不允许取消。只允许修日志参数,拦截动作,以及动作参数等信息,其他信息策略编辑界面置灰,不能修改。
2019-06-13 15:25:04 +08:00
shangguanyanfei
aaf64fc527 流量统计-统计页面样式调整 2019-06-13 15:08:42 +08:00
shangguanyanfei
afafed1804 实时报表-流量统计-统计菜单 url修改sql 2019-06-13 11:15:35 +08:00
shangguanyanfei
6f3647694e 实时统计-流量统计下的统计页面 图形 查询条件等样式的修改 2019-06-12 19:33:59 +08:00
wangwei
c8467db46b 恢复文件上传方式并修正带后缀 2019-06-12 12:42:03 +08:00
zhangwenqing
193bb8c1c3 Merge branch 'develop_no_common_group' of https://git.mesalab.cn/K18_NTCS_WEB/NTC.git into develop_no_common_group 2019-06-11 17:25:26 +08:00
zhangwenqing
bbda5e233f 分组配置管理删除分组下最后一条域配置时增加提示信息 2019-06-11 17:25:10 +08:00
wangwei
fdb38ce727 替换文件上传方式 带后缀 2019-06-11 17:23:30 +08:00
wangwei
2b23095c9d 修复http monitor、whiteList导入直接下发自定义域的设置 2019-06-11 13:10:20 +08:00
wangwei
9e276d1f0a 调整拦截策略、控制策略菜查看域信息框的宽度 2019-06-10 20:20:56 +08:00
zhangwenqing
4d4d1d9153 Merge branch 'develop_no_common_group' of https://git.mesalab.cn/K18_NTCS_WEB/NTC.git into develop_no_common_group 2019-06-10 18:32:17 +08:00
zhangwenqing
bf03ca1cc0 1、增加SubscribeId分组配置功能 2、增加公共分组相关国际化代码及相关sql文件修改 2019-06-10 18:31:52 +08:00
wangwei
7dc9e4ac43 修复可信证书Buil-In字段的导出 2019-06-10 18:25:17 +08:00
shangguanyanfei
66b3673bce 实时报表-流量统计-统计页面中的二级页面显示滚动条 2019-06-10 18:08:39 +08:00
wangwei
24c7d0b3ad Merge branch 'develop_no_common_group' of git@git.mesalab.cn:K18_NTCS_WEB/NTC.git into develop_no_common_group 2019-06-10 16:23:35 +08:00
wangwei
8d44987c6f 修改国际化:劫持、阻断页面、镜像、注入脚本 2019-06-10 16:23:05 +08:00
shangguanyanfei
21cd6c06be HTTP(S)操控日志app_id,app_protocol,protocol_id直接取值,去掉字典转换
实时报表-国家代理统计菜单及它下面的子菜单都置为失效
2019-06-10 16:22:03 +08:00
wangwei
194bf20558 跟新代理相关菜单 isAudit字段现实顺序、去除拦截策略日志总量 2019-06-10 16:02:40 +08:00
段冬梅
3fbe796217 导入内置证书国际化更改,是否内置证书国际化更改 2019-06-10 15:37:23 +08:00
wangwei
238c342339 Merge branch 'develop_no_common_group' of git@git.mesalab.cn:K18_NTCS_WEB/NTC.git into develop_no_common_group 2019-06-10 15:32:13 +08:00
wangwei
c7bd7dcba1 补提http操控日志跳转 2019-06-10 15:28:05 +08:00
wangxin
2f74cd03cc 更新组状态方法修改 2019-06-10 14:10:00 +08:00
wangwei
b22cfec67f 修正拦截策略profileId为数值类型 2019-06-10 13:26:48 +08:00
wangwei
723da765a0 Merge branch 'develop_no_common_group' of git@git.mesalab.cn:K18_NTCS_WEB/NTC.git into develop_no_common_group 2019-06-10 11:48:44 +08:00
wangwei
dace2ab798 去除http monit 日志总量列、修复http 操控阻断日志跳转 2019-06-10 11:48:21 +08:00
shangguanyanfei
3b57a384b6 菜单修改的sql文件 修改 2019-06-10 11:06:50 +08:00
shangguanyanfei
ee513ccdae HTTP(S)阻断 修改 2019-06-10 10:43:39 +08:00
shangguanyanfei
4f85cf1beb HTTP(S)监测 修改为 查询 操控日志的接口 2019-06-10 10:22:24 +08:00
wangwei
3247d6fc9e 修正拦截策略ssl版本校验 2019-06-08 22:14:14 +08:00
wangwei
a821ca4364 修正拦截策略allow http2开关 2019-06-08 17:28:09 +08:00
段冬梅
2bee7a7f68 可信证书内置证书功能添加 2019-06-08 16:51:28 +08:00
wangwei
5f8a9b43fc 修正拦截策略allow http2开关 2019-06-08 16:07:20 +08:00
wangwei
df690cffd3 http(s) 监测、白名单自定义域下发置"{}",http(s) 阻断、操控去除日志总量 2019-06-08 15:36:06 +08:00
duandongmei
744a6eae55 内置可信证书上传minio,入库,并下发 2019-06-07 21:48:26 +08:00
段冬梅
56f08a1bfa 内置可信证书入库代码提交 2019-06-06 18:54:25 +08:00
段冬梅
d0554f0f2b 内置可信证书解析脚本 2019-06-06 18:36:03 +08:00
段冬梅
897125210d 增加可信证书内置证书快捷按钮 2019-06-06 18:35:07 +08:00
shangguanyanfei
27b0cfa560 Radius日志code字段 国际化修改 2019-06-06 17:53:37 +08:00
shangguanyanfei
4ae632b3ab 实时报表-流量统计-统计页面中的二级页面改为默认折线图 2019-06-06 17:15:24 +08:00
段冬梅
9754bd757d Merge branch 'develop_no_common_group' of https://git.mesalab.cn/K18_NTCS_WEB/NTC.git into develop_no_common_group 2019-06-06 13:58:04 +08:00
段冬梅
d76e44d06f x509程序更新 2019-06-06 13:57:50 +08:00
wangwei
2f04b583ea http(s) Manipulate重定向时必填一条URL域 2019-06-06 11:27:22 +08:00
shangguanyanfei
3e1500cf38 http block菜单修改 改为查询操控日志 2019-06-05 18:50:15 +08:00
zhangwenqing
d0499163b3 修改公共组管理删除校验 2019-06-05 18:33:30 +08:00
段冬梅
94e764f97e 去掉失败方法的一个字典;
去掉拦截限速业务
拦截内置配置的userRegion为{}
2019-06-05 18:05:20 +08:00
zhangwenqing
f9768ab910 分组配置增加以ud_flag字段标识状态 2019-06-05 17:49:39 +08:00
wangwei
ad04b41d7a 修复allow_http2的状态更新 2019-06-05 16:52:22 +08:00
wangwei
d7bcd91b8a 修复intercept 自定义域 2019-06-05 16:42:51 +08:00
wangwei
77059b8d2c 修复Intercept Policy自定义域{} 2019-06-05 15:23:03 +08:00
wangwei
452e295d8a 修正allow_http2的显示、bypass的自定义域改成null的json 2019-06-05 14:37:04 +08:00
shangguanyanfei
db7049c041 1.统计-带宽两个图的合并2.HTTP(S)操控日志页面增加查询条件及Custom列表展示列选择页面增加滚动条 2019-06-05 14:14:40 +08:00
zhangwenqing
c83472c508 去掉分组管理无用代码 2019-06-05 10:40:36 +08:00
段冬梅
2e2249ce15 allow HTTP/2国际化更改 2019-06-05 10:27:50 +08:00
段冬梅
3bbc700ed3 keyring内置文件 2019-06-05 09:39:35 +08:00
duandongmei
70312e4d5d 攻击嵌入菜单俄文国际化更改 2019-06-04 15:30:40 +08:00
段冬梅
7b1fd6074d 代理内置0号配置 2019-06-04 15:18:49 +08:00
shangguanyanfei
4494bbd5c4 HTTP(S)操控
1.从配置到日志页面的跳转 2.列表的排序 3.配置ID查询条件的更改 4.八个新增字段的添加和展示
2019-06-04 14:19:24 +08:00
wangwei
30e04c19f6 修正阻断页面template格式文件后缀为.htmp校验 2019-06-04 14:04:42 +08:00
段冬梅
f074c1432a 策略被引用:逻辑修改为非-1策略引用均不允许配置取消和删除 2019-06-04 13:57:50 +08:00
wangwei
7bc04a2df3 修正阻断页面 Content Type为 Format 2019-06-04 12:56:31 +08:00
wangwei
5036f89db5 修复http manipulate 导出action 字段为 Manipulate 2019-06-04 09:41:47 +08:00
wangwei
0406998c42 修复http block导出response content字段不统一、http manipulate导出少域问题 2019-06-04 08:52:41 +08:00
duandongmei
87dc47cbf3 日志时间间隔默认为5分钟;
日志导出最大为2万
2019-06-03 17:09:25 +08:00
duandongmei
2ad805617b 恢复左侧边距设置 2019-06-03 16:25:21 +08:00
duandongmei
1cc1ed42ec 清理profile相关表数据sql提至前面 2019-06-03 16:00:19 +08:00
shangguanyanfei
775230f99b HTTP(S)操控日志的字段的国际化 2019-06-03 15:53:04 +08:00
zhangwenqing
576e446292 URL公共组配置部分功能及相应sql提交 2019-06-03 15:50:00 +08:00
duandongmei
fd714e30f4 修改攻击菜单国际化;
操控日志菜单分配给admin用户
2019-06-03 15:17:24 +08:00
zhangwenqing
8c766e90a8 IP公共组配置部分功能提交 2019-06-03 14:53:39 +08:00
shangguanyanfei
28da266944 HTTP(S)操控新增字典修改 2019-06-03 11:28:12 +08:00
shangguanyanfei
9441ed77a1 Merge branch 'develop_no_common_group' of https://git.mesalab.cn/K18_NTCS_WEB/NTC.git into develop_no_common_group 2019-06-03 10:06:35 +08:00
shangguanyanfei
b7e2a89f09 HTTP(S)操控日志页面的菜单sql和字典sql 2019-06-03 10:03:03 +08:00
duandongmei
e9a91921d4 拦截策略的字典sql修正;
cookie信息使用window.name传递
2019-06-03 10:02:29 +08:00
wangwei
3641e2c64e 更新国际化、去除阻断页面.template校验 2019-06-02 18:18:05 +08:00
wangwei
3e206c8ad1 劫持、注入、阻断页面、镜像清表sql、更新劫持字典表sql 2019-06-02 17:24:39 +08:00
段冬梅
a6260ee1ef 攻击菜单国际化更改,菜单增加流量统计菜单权限分配 2019-06-02 16:41:35 +08:00
wangwei
692d00050c 劫持、注入、镜像、阻断页面、拦截证书内容引用时的处理 2019-06-02 16:33:49 +08:00
wangwei
5355c9ab9c 清除hijack类型字典表 2019-05-31 16:22:00 +08:00
shangguanyanfei
468054b5a4 HTPP(S)操控日志 2019-05-31 14:40:26 +08:00
wangwei
eb9ad8941e 恢复nis.properties 2019-05-31 14:16:13 +08:00
wangwei
ae5f827155 更新劫持文件字典表 2019-05-31 13:31:00 +08:00
wangwei
65c06777ed 修复HTTP(S) 阻断 引入阻断页面文件的查询 2019-05-31 13:08:31 +08:00
wangwei
f917c7678a 拦截策略新增时记录引用文件信息 2019-05-31 13:06:39 +08:00
wangwei
1b2f115ee5 修复文件劫持、注入、阻断页面、镜像若干bug 2019-05-31 13:04:57 +08:00
wangwei
33590ee8f4 修复HTTP(S) Manipulate 导出profile info字段不统一 2019-05-31 12:56:58 +08:00
shangguanyanfei
91aaf716c8 实时报表-流量统计菜单-统计中的配置统计模块
1.时间粒度最大范围调整 5分钟(一个月) 小时(一个月) 天(一年)
2.查询配置ID的规则名称时,取消is_valid=1的查询条件
2019-05-30 18:07:38 +08:00
shangguanyanfei
5dc3136724 实时报表-流量统计菜单下新增统计菜单,调用的接口 2019-05-30 14:59:52 +08:00
shangguanyanfei
a4f341cf74 实时报表-流量统计菜单下新增统计菜单,对多个业务内容进行统计及业务之间的切换,以图表和列表的方式展示 2019-05-30 11:06:16 +08:00
zhangwenqing
b1bf4d1185 修正保护名单管理未选中数据删除不校验问题 2019-05-30 10:36:44 +08:00
段冬梅
95dc4a7e5f Merge branch 'develop_no_common_group' of https://git.mesalab.cn/K18_NTCS_WEB/NTC.git into develop_no_common_group 2019-05-29 13:27:39 +08:00
段冬梅
93b3729bbe 未变更 2019-05-29 13:27:32 +08:00
wangwei
1ef6002c57 更新国际化配置 2019-05-29 11:30:03 +08:00
李皓宸
c0461322fa 区分是否为外部URL时加入了正则校验 2019-05-29 11:05:28 +08:00
李皓宸
8770f98ea1 界面嵌入外部URL cookie传递 (test) 2019-05-28 20:07:50 +08:00
wangwei
613ef99e67 阻断页面中增加id属性 2019-05-28 18:31:18 +08:00
zhangwenqing
935f70fa4f 修改Proxy阻断配置定时任务和批量下发的userRegion 2019-05-28 18:19:26 +08:00
wangwei
231a3ca1d5 添加文件类型校验(劫持、注入、阻断页面、文件策略) 2019-05-28 18:04:38 +08:00
段冬梅
baf3035eda ddos新增菜单,并为ddos新增的菜单分配角色;
操控业务sql增加,并为操控菜单分配admin角色
2019-05-28 17:21:34 +08:00
段冬梅
411639fe16 去掉批量下发的json打印 2019-05-28 17:07:59 +08:00
段冬梅
b453c1f178 Merge branch 'develop_no_common_group' of https://git.mesalab.cn/K18_NTCS_WEB/NTC.git into develop_no_common_group 2019-05-28 17:04:56 +08:00
段冬梅
2b7973c962 DDOS国际化修改为DDoS 2019-05-28 17:04:44 +08:00
wangxin
f5961fd68a 删除无必要的判断 2019-05-28 17:03:17 +08:00
wangxin
d4ea223b99 修复packet ip address asn切换到ip配置时,没有正确获取到配置属性的bug 2019-05-28 17:00:02 +08:00
wangwei
e9bb74d9fd 拦截策略新增allow_http2 2019-05-28 13:36:36 +08:00
zhangwenqing
84c10eac7d 1.操控配置去除Block Method 2.修改Block配置下发userRegion 2019-05-27 18:17:40 +08:00
李皓宸
dd31466774 判断菜单URL是否是外部链接进行区别操作 2019-05-27 17:36:31 +08:00
wangwei
ab25fbc8f0 修复审核通过配置修改成功提示信息bug 2019-05-27 16:52:19 +08:00
wangwei
72fee91228 修复镜像菜单addrList下发格式 2019-05-27 16:19:44 +08:00
wangwei
733cd55636 修复文件摘要请求服务接口失败bug 2019-05-27 13:53:31 +08:00
zhangwenqing
90678068c9 修正操控配置下发特殊字符重复转义 2019-05-27 11:27:14 +08:00
zhangwenqing
5ad397d752 完善操控配置功能,修改配置更新界面属性位置 2019-05-27 09:47:20 +08:00
wangwei
8472c6efcf 修复代理(劫持、镜像、阻断、注入)菜单的bug 2019-05-26 16:09:19 +08:00
wangwei
f2d29374da 完善修改配置数据时提示信息问题 2019-05-24 19:12:37 +08:00
wangwei
2786ee2fe8 修复文件摘要修改功能请求服务接口失败 2019-05-24 19:09:40 +08:00
wangwei
8b2a692aeb 打开下发配置交互代码 2019-05-24 11:23:07 +08:00
段冬梅
062161826e 操控增加为admin添加权限sql,清理旧的字典和菜单sql。
去掉批量中的json打印
2019-05-24 10:15:28 +08:00
wangxin
db9d2a41fd 修改字典sql将插入数据id改为insert into select的格式 2019-05-24 09:35:13 +08:00
wangxin
8261647a35 (1)调整拦截action 为2
(2)修复导出bug
2019-05-23 19:12:37 +08:00
zhangwenqing
672d76b046 修复配置导入校验时空指针异常 2019-05-23 18:28:04 +08:00
wangwei
00b3ea807f 更新流量转发目的地址下发配置参数格式 2019-05-23 18:18:55 +08:00
zhangwenqing
99f002d0c6 操控增加国际化代码,修改列表action检索 2019-05-23 17:22:43 +08:00
wangwei
39cbf62517 完善字典表数据插入sql语句 2019-05-23 15:17:27 +08:00
段冬梅
25c2bb790e 整理新增的几个文件策略表sql,以及admin角色添加菜单权限 2019-05-23 14:45:36 +08:00
zhangwenqing
cf29b7ec04 补充操控配置导出缺少的action、response code列. 2019-05-23 11:54:06 +08:00
zhangwenqing
4a810d918a 修正操控配置action切换后无域配置可提交问题. 2019-05-23 10:02:57 +08:00
wangwei
5c00167d76 新增访问阻断页面菜单;完善劫持、策略、注入脚本、镜像文件菜单相关功能 2019-05-22 19:57:28 +08:00
wangxin
a68c454559 Merge branch 'develop_no_common_group' of https://git.mesalab.cn/K18_NTCS_WEB/NTC into develop_no_common_group 2019-05-22 19:41:20 +08:00
wangxin
6abfd25a1d Steam三个菜单的form表单当action 为monit的时候ip和账号必选一个 2019-05-22 19:38:47 +08:00
zhangwenqing
5b5b6d8584 代理操控业务配置批量操作、定时任务相关修改提交. 2019-05-22 18:49:00 +08:00
wangxin
c0d85d20bb 修复代理拦截页面切换action时的大片空白 2019-05-22 17:58:31 +08:00
wangxin
8788c65357 修复Fail Method字典key值 2019-05-22 17:51:07 +08:00
zhangwenqing
a2c5ba8f7a 修正操控业务配置sql 2019-05-22 17:13:56 +08:00
wangxin
8c9706fb0e Lists.newArrayList()修改为new ArrayList() 2019-05-22 12:42:29 +08:00
duandongmei
b2aac3e567 去掉操控功能误导入的包 2019-05-22 11:03:08 +08:00
wangxin
182a6a8ddc 代理拦截修改提交 2019-05-21 19:50:54 +08:00
zhangwenqing
ac52747686 代理操控业务部分功能提交配置、导入、导出 2019-05-21 19:15:54 +08:00
duandongmei
8657cfa142 增加为admin角色分配新菜单的sql 2019-05-21 15:41:27 +08:00
wangwei
952ea78b66 更新菜单劫持、拦截、镜像sql表 2019-05-21 11:54:56 +08:00
wangwei
f30acfdbbd 新增劫持文件、注入脚本文件、流量转发目的地菜单,完善文件劫持菜单。 2019-05-21 09:51:19 +08:00
duandongmei
c44ddb9ffc 热修改功能打开 2019-05-20 15:54:21 +08:00
duandongmei
a9a15f4c0a 610上线内容回复UPDATE_ACTION 2019-05-20 15:46:21 +08:00
274 changed files with 59352 additions and 5285 deletions

View File

@@ -1 +1,7 @@
在公共分组功能逻辑完善之前此分支为ntc界面系统的全集上线升级分支合并版。 630上线内容版本
1、统计整合为一个模块儿
2、object-list-group HTTP和代理
3、代理新功能

View File

@@ -0,0 +1,74 @@
package com.nis.domain.basics;
import java.io.Serializable;
import java.util.Date;
import com.nis.domain.configuration.BaseCfg;
import com.nis.util.excel.ExcelField;
/**
* 公共分组实体
*/
public class CommonGroupInfo extends BaseCfg<CommonGroupInfo> implements Serializable{
/**
*
*/
private static final long serialVersionUID = 7931466570918016654L;
private Integer groupId;
@ExcelField(title="group_name",sort=1)
private String groupName;
@ExcelField(title="group_type",dictType="GROUP_TYPE",sort=2)
private Integer groupType;
private Integer serviceGroupId;
@ExcelField(title="desc",sort=4)
private String description;
public Integer getServiceGroupId() {
return serviceGroupId;
}
public void setServiceGroupId(Integer serviceGroupId) {
this.serviceGroupId = serviceGroupId;
}
public Integer getGroupId() {
return groupId;
}
public void setGroupId(Integer groupId) {
this.groupId = groupId;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getEditTime() {
return editTime;
}
public void setEditTime(Date editTime) {
this.editTime = editTime;
}
public Integer getGroupType() {
return groupType;
}
public void setGroupType(Integer groupType) {
this.groupType = groupType;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}

View File

@@ -0,0 +1,67 @@
package com.nis.domain.basics;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.util.excel.ExcelField;
public class DomainCommCfg extends BaseStringCfg<DomainCommCfg>{
private static final long serialVersionUID = 5117517145731135023L;
private static final String tableName="domain_comm_cfg";
@ExcelField(title="key_word",sort=3)
protected String cfgKeywords;
protected Integer isHexbin;
protected String ratelimit;
@ExcelField(title="group_name",sort=2)
protected String groupName;//公共组名称
@ExcelField(title="expression_type",dictType="EXPRESSION_TYPE",sort=18)
protected Integer exprType;
@ExcelField(title="match_method",dictType="MATCH_METHOD",sort=20)
protected Integer matchMethod;
public String getCfgKeywords() {
return cfgKeywords;
}
public void setCfgKeywords(String cfgKeywords) {
this.cfgKeywords = cfgKeywords;
}
public Integer getIsHexbin() {
return isHexbin;
}
public void setIsHexbin(Integer isHexbin) {
this.isHexbin = isHexbin;
}
public String getRatelimit() {
return ratelimit;
}
public void setRatelimit(String ratelimit) {
this.ratelimit = ratelimit;
}
public static String getTablename() {
return tableName;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public Integer getMatchMethod() {
return matchMethod;
}
public void setMatchMethod(Integer matchMethod) {
this.matchMethod = matchMethod;
}
public Integer getExprType() {
return exprType;
}
public void setExprType(Integer exprType) {
this.exprType = exprType;
}
}

View File

@@ -0,0 +1,312 @@
package com.nis.domain.basics;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.nis.domain.configuration.BaseCfg;
import com.nis.util.excel.ExcelField;
public class IpCommCfg extends BaseCfg<IpCommCfg> {
/**
*
*/
private static final long serialVersionUID = 4218856118489784060L;
/**
* 创建一个新的实例 BaseIpCfg.
*
*/
public IpCommCfg() {
super();
// TODO Auto-generated constructor stub
}
private static final String indexTable="ip_comm_cfg";
/**
* ip类型
*/
@Expose
@SerializedName("ipType")
@ExcelField(title="ip_type",dictType="IP_TYPE",sort=50)
protected Integer ipType;
@ExcelField(title="src_ip_pattern",dictType="IP_PATTERN",sort=51)
protected Integer srcIpPattern;
@ExcelField(title="client_ip",sort=52)
protected String srcIpAddress;
@ExcelField(title="dest_ip_pattern",dictType="IP_PATTERN",sort=53)
protected Integer destIpPattern;
@ExcelField(title="server_ip",sort=54)
protected String destIpAddress;
@ExcelField(title="src_port_pattern",dictType="PORT_PATTERN",sort=54)
protected Integer srcPortPattern;
@ExcelField(title="dest_port_pattern",dictType="PORT_PATTERN",sort=56)
protected Integer destPortPattern;
@ExcelField(title="client_port",sort=55)
protected String srcPort;
@ExcelField(title="server_port",sort=57)
protected String destPort;
protected Integer dnsStrategyId;
@ExcelField(title="ir_type",dictType="IR_TYPE",sort=58)
protected Integer irType;
@ExcelField(title="group_name",sort=45)
protected String groupName;
// @ExcelField(title="log_total",sort=42)
private Long totalLogs;
private Integer regionId;
private Integer groupId;
public Integer getRegionId() {
return regionId;
}
public void setRegionId(Integer regionId) {
this.regionId = regionId;
}
public Integer getGroupId() {
return groupId;
}
public void setGroupId(Integer groupId) {
this.groupId = groupId;
}
public Long getTotalLogs() {
return totalLogs;
}
public void setTotalLogs(Long totalLogs) {
this.totalLogs = totalLogs;
}
/**
* irType
* @return irType
*/
public Integer getIrType() {
return irType;
}
/**
* @param irType the irType to set
*/
public void setIrType(Integer irType) {
this.irType = irType;
}
/**
* groupName
* @return groupName
*/
public String getGroupName() {
return groupName;
}
/**
* @param groupName the groupName to set
*/
public void setGroupName(String groupName) {
this.groupName = groupName;
}
/**
* 方向
*/
@Expose
@SerializedName("direction")
@ExcelField(title="direction",dictType="DIRECTION",sort=58)
protected Integer direction ;
/**
* 协议
*/
@Expose
@SerializedName("protocol")
@ExcelField(title="protocol",dictType="PROTOCOL",sort=59)
protected Integer protocol ;
/**
* 协议ID
*/
@Expose
@SerializedName("protocolId")
protected Integer protocolId ;
/**
* 限速比例
*/
protected String ratelimit ;
/**
* ratelimit
* @return ratelimit
*/
public String getRatelimit() {
return ratelimit;
}
/**
* @param ratelimit the ratelimit to set
*/
public void setRatelimit(String ratelimit) {
this.ratelimit = ratelimit;
}
/**
* ipType
* @return ipType
*/
public Integer getIpType() {
return ipType;
}
/**
* @param ipType the ipType to set
*/
public void setIpType(Integer ipType) {
this.ipType = ipType;
}
/**
* direction
* @return direction
*/
public Integer getDirection() {
return direction;
}
/**
* @param direction the direction to set
*/
public void setDirection(Integer direction) {
this.direction = direction;
}
/**
* protocol
* @return protocol
*/
public Integer getProtocol() {
return protocol;
}
/**
* @param protocol the protocol to set
*/
public void setProtocol(Integer protocol) {
this.protocol = protocol;
}
/**
* protocolId
* @return protocolId
*/
public Integer getProtocolId() {
return protocolId;
}
/**
* @param protocolId the protocolId to set
*/
public void setProtocolId(Integer protocolId) {
this.protocolId = protocolId;
}
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;
}
/**
* srcIpAddress
* @return srcIpAddress
*/
public String getSrcIpAddress() {
return srcIpAddress;
}
/**
* @param srcIpAddress the srcIpAddress to set
*/
public void setSrcIpAddress(String srcIpAddress) {
this.srcIpAddress = srcIpAddress;
}
/**
* destIpAddress
* @return destIpAddress
*/
public String getDestIpAddress() {
return destIpAddress;
}
/**
* @param destIpAddress the destIpAddress to set
*/
public void setDestIpAddress(String destIpAddress) {
this.destIpAddress = destIpAddress;
}
/**
* srcPort
* @return srcPort
*/
public String getSrcPort() {
return srcPort;
}
/**
* @param srcPort the srcPort to set
*/
public void setSrcPort(String srcPort) {
this.srcPort = srcPort;
}
/**
* destPort
* @return destPort
*/
public String getDestPort() {
return destPort;
}
/**
* @param destPort the destPort to set
*/
public void setDestPort(String destPort) {
this.destPort = destPort;
}
/**
* dnsStrategyId
* @return dnsStrategyId
*/
public Integer getDnsStrategyId() {
return dnsStrategyId;
}
/**
* @param dnsStrategyId the dnsStrategyId to set
*/
public void setDnsStrategyId(Integer dnsStrategyId) {
this.dnsStrategyId = dnsStrategyId;
}
@Override
public void initDefaultValue(){
super.initDefaultValue();
this.direction = 0;
}
public static String getIndexTable() {
return indexTable;
}
public Integer getIndex() {
return index;
}
public void setIndex(Integer index) {
this.index = index;
}
}

View File

@@ -0,0 +1,67 @@
package com.nis.domain.basics;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.util.excel.ExcelField;
public class ScriberIdCommCfg extends BaseStringCfg<ScriberIdCommCfg>{
private static final long serialVersionUID = 5117517145731135023L;
private static final String tableName="scriberid_comm_cfg";
@ExcelField(title="key_word",sort=3)
protected String cfgKeywords;
protected Integer isHexbin;
protected String ratelimit;
@ExcelField(title="group_name",sort=2)
protected String groupName;//公共组名称
@ExcelField(title="expression_type",dictType="EXPRESSION_TYPE",sort=18)
protected Integer exprType;
@ExcelField(title="match_method",dictType="MATCH_METHOD",sort=20)
protected Integer matchMethod;
public String getCfgKeywords() {
return cfgKeywords;
}
public void setCfgKeywords(String cfgKeywords) {
this.cfgKeywords = cfgKeywords;
}
public Integer getIsHexbin() {
return isHexbin;
}
public void setIsHexbin(Integer isHexbin) {
this.isHexbin = isHexbin;
}
public String getRatelimit() {
return ratelimit;
}
public void setRatelimit(String ratelimit) {
this.ratelimit = ratelimit;
}
public static String getTablename() {
return tableName;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public Integer getMatchMethod() {
return matchMethod;
}
public void setMatchMethod(Integer matchMethod) {
this.matchMethod = matchMethod;
}
public Integer getExprType() {
return exprType;
}
public void setExprType(Integer exprType) {
this.exprType = exprType;
}
}

View File

@@ -0,0 +1,66 @@
package com.nis.domain.basics;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.util.excel.ExcelField;
public class UrlCommCfg extends BaseStringCfg<UrlCommCfg>{
private static final long serialVersionUID = 398247881810945300L;
private static final String tableName="url_comm_cfg";
@ExcelField(title="key_word",sort=3)
protected String cfgKeywords;//url关键字配置
protected Integer isHexbin;//是否大小写敏感
protected String ratelimit;//限速比例,0到1之间
@ExcelField(title="group_name",sort=2)
protected String groupName;//公共组名称
@ExcelField(title="expression_type",dictType="EXPRESSION_TYPE",sort=18)
protected Integer exprType;
@ExcelField(title="match_method",dictType="MATCH_METHOD",sort=20)
protected Integer matchMethod;
public String getCfgKeywords() {
return cfgKeywords;
}
public void setCfgKeywords(String cfgKeywords) {
this.cfgKeywords = cfgKeywords;
}
public Integer getIsHexbin() {
return isHexbin;
}
public void setIsHexbin(Integer isHexbin) {
this.isHexbin = isHexbin;
}
public String getRatelimit() {
return ratelimit;
}
public void setRatelimit(String ratelimit) {
this.ratelimit = ratelimit;
}
public static String getTablename() {
return tableName;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public Integer getMatchMethod() {
return matchMethod;
}
public void setMatchMethod(Integer matchMethod) {
this.matchMethod = matchMethod;
}
public Integer getExprType() {
return exprType;
}
public void setExprType(Integer exprType) {
this.exprType = exprType;
}
}

View File

@@ -0,0 +1,54 @@
package com.nis.domain.callback;
import com.nis.domain.configuration.BaseCfg;
import com.nis.util.excel.ExcelField;
/**
* http代理劫持文件
* @author lenovo
*
*/
public class ProxyFileHijackCfg extends BaseCfg<ProxyFileHijackCfg>{
private static final long serialVersionUID = -4600604393808056286L;
public String indexTable = "pxy_profile_hijack_files";//对应表名
@ExcelField(title="profile_name",sort=1)
private String profileName;//名称,辅助记忆
@ExcelField(title="content_type",sort=3)
private String contentType;//填充HTTP content-type如“video/mp4” exe、apk
@ExcelField(title="hijack_file_strategy",sort=2)
private String path;//储存路径
@ExcelField(title="content_name",sort=4)
private String contentName;//内容格式
public String getContentName() {
return contentName;
}
public void setContentName(String contentName) {
this.contentName = contentName;
}
public String getIndexTable() {
return indexTable;
}
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
public String getProfileName() {
return profileName;
}
public void setProfileName(String profileName) {
this.profileName = profileName;
}
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
}

View File

@@ -0,0 +1,114 @@
package com.nis.domain.callback;
import java.util.Date;
import com.google.gson.annotations.Expose;
public class ProxyFileHijackCfgAudit {
@Expose
private Long id; //compileId
@Expose
private Integer cfgId; //compileId
@Expose
private Integer profileId;//compileId
@Expose
private Integer action;
@Expose
private Integer service;
@Expose
private Integer isValid;
@Expose
private Date opTime;
@Expose
private String profileName;
@Expose
private String contentType;
@Expose
private String path;
@Expose
private String contentName;
@Expose
private Long opUser;
public Long getOpUser() {
return opUser;
}
public void setOpUser(Long opUser) {
this.opUser = opUser;
}
public String getContentName() {
return contentName;
}
public void setContentName(String contentName) {
this.contentName = contentName;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public Long getId() {
return id;
}
public Integer getProfileId() {
return profileId;
}
public void setProfileId(Integer profileId) {
this.profileId = profileId;
}
public void setId(Long id) {
this.id = id;
}
public Integer getCfgId() {
return cfgId;
}
public void setCfgId(Integer cfgId) {
this.cfgId = cfgId;
}
public Integer getAction() {
return action;
}
public void setAction(Integer action) {
this.action = action;
}
public Integer getService() {
return service;
}
public void setService(Integer service) {
this.service = service;
}
public Integer getIsValid() {
return isValid;
}
public void setIsValid(Integer isValid) {
this.isValid = isValid;
}
public Date getOpTime() {
return opTime;
}
public void setOpTime(Date opTime) {
this.opTime = opTime;
}
public String getProfileName() {
return profileName;
}
public void setProfileName(String profileName) {
this.profileName = profileName;
}
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
}

View File

@@ -0,0 +1,40 @@
package com.nis.domain.callback;
import com.nis.domain.configuration.BaseCfg;
import com.nis.util.excel.ExcelField;
public class ProxyFileInsertScriptCfg extends BaseCfg<ProxyFileInsertScriptCfg>{
private static final long serialVersionUID = 4705202662940705064L;
public String indexTable = "pxy_profile_insert_scripts";//对应表名
@ExcelField(title="script_name",sort=1)
private String cfgDesc;//名称,辅助记忆
@ExcelField(title="script_format",sort=3)
private String format;//css/js
@ExcelField(title="script_file",sort=2)
private String path;//储存路径
public String getIndexTable() {
return indexTable;
}
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
public String getCfgDesc() {
return cfgDesc;
}
public void setCfgDesc(String cfgDesc) {
this.cfgDesc = cfgDesc;
}
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
}

View File

@@ -0,0 +1,99 @@
package com.nis.domain.callback;
import java.util.Date;
import com.google.gson.annotations.Expose;
public class ProxyFileInsertScriptCfgAudit {
@Expose
private Long id; //compileId
@Expose
private Integer cfgId; //compileId
@Expose
private Integer profileId;//compileId
@Expose
private Integer action;
@Expose
private Integer service;
@Expose
private Integer isValid;
@Expose
private Date opTime;
@Expose
private String profileName;
@Expose
private String format;
@Expose
private String path;
@Expose
private Long opUser;
public Long getOpUser() {
return opUser;
}
public void setOpUser(Long opUser) {
this.opUser = opUser;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getCfgId() {
return cfgId;
}
public void setCfgId(Integer cfgId) {
this.cfgId = cfgId;
}
public Integer getProfileId() {
return profileId;
}
public void setProfileId(Integer profileId) {
this.profileId = profileId;
}
public Integer getAction() {
return action;
}
public void setAction(Integer action) {
this.action = action;
}
public Integer getService() {
return service;
}
public void setService(Integer service) {
this.service = service;
}
public Integer getIsValid() {
return isValid;
}
public void setIsValid(Integer isValid) {
this.isValid = isValid;
}
public Date getOpTime() {
return opTime;
}
public void setOpTime(Date opTime) {
this.opTime = opTime;
}
public String getProfileName() {
return profileName;
}
public void setProfileName(String profileName) {
this.profileName = profileName;
}
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
}

View File

@@ -0,0 +1,67 @@
package com.nis.domain.callback;
import com.nis.domain.configuration.BaseCfg;
import com.nis.util.excel.ExcelField;
/**
* http代理文件策略
* @author nanfang
*
*/
public class ProxyFileResponsePageCfg extends BaseCfg<ProxyFileResponsePageCfg> {
private static final long serialVersionUID = -1989406217948847813L;
public final static String TABLE_NAME = "pxy_profile_response_pages";//对应表名
private String indexTable = "pxy_profile_response_pages";
@ExcelField(title="file_desc",sort=1)
private String fileDesc;//文件描述
@ExcelField(title="response_file",sort=2)
private String url;//文件保存的url
@ExcelField(title="format",sort=3)
private String contentType;//内容类型如text/html取字典表contentType
private String md5;//文件md5值
private Long contentLength;//文件长度
public String getIndexTable() {
return indexTable;
}
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
public ProxyFileResponsePageCfg() {
super();
}
public String getFileDesc() {
return fileDesc;
}
public void setFileDesc(String fileDesc) {
this.fileDesc = fileDesc;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public Long getContentLength() {
return contentLength;
}
public void setContentLength(Long contentLength) {
this.contentLength = contentLength;
}
public String getMd5() {
return md5;
}
public void setMd5(String md5) {
this.md5 = md5;
}
}

View File

@@ -0,0 +1,106 @@
package com.nis.domain.callback;
import java.util.Date;
import com.google.gson.annotations.Expose;
public class ProxyFileResponsePageCfgAudit {
@Expose
private Long id; //compileId
@Expose
private Integer cfgId; //compileId
@Expose
private Integer action;
@Expose
private Integer service;
@Expose
private Integer isValid;
@Expose
private Date opTime;
@Expose
private String format;
@Expose
private Long contentLength;
@Expose
private String path;
@Expose
private Long profileId;
@Expose
private String profileName;
@Expose
private Long opUser;
public Long getOpUser() {
return opUser;
}
public void setOpUser(Long opUser) {
this.opUser = opUser;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getCfgId() {
return cfgId;
}
public void setCfgId(Integer cfgId) {
this.cfgId = cfgId;
}
public Integer getAction() {
return action;
}
public void setAction(Integer action) {
this.action = action;
}
public Integer getService() {
return service;
}
public void setService(Integer service) {
this.service = service;
}
public Integer getIsValid() {
return isValid;
}
public void setIsValid(Integer isValid) {
this.isValid = isValid;
}
public Date getOpTime() {
return opTime;
}
public void setOpTime(Date opTime) {
this.opTime = opTime;
}
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
public Long getContentLength() {
return contentLength;
}
public void setContentLength(Long contentLength) {
this.contentLength = contentLength;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public Long getProfileId() {
return profileId;
}
public void setProfileId(Long profileId) {
this.profileId = profileId;
}
public String getProfileName() {
return profileName;
}
public void setProfileName(String profileName) {
this.profileName = profileName;
}
}

View File

@@ -9,12 +9,21 @@ import com.nis.domain.configuration.BaseCfg;
public class ProxyFileStrategyCfg extends BaseCfg<ProxyFileStrategyCfg> { public class ProxyFileStrategyCfg extends BaseCfg<ProxyFileStrategyCfg> {
private static final long serialVersionUID = 4283944377949702481L; private static final long serialVersionUID = 4283944377949702481L;
public final static String TABLE_NAME = "PROXY_FILE_STRATEGY_CFG";//对应表名 public final static String TABLE_NAME = "PROXY_FILE_STRATEGY_CFG";//对应表名
private String indexTable = "proxy_file_strategy_cfg";
private String fileDesc;//文件描述 private String fileDesc;//文件描述
private String url;//文件保存的url private String url;//文件保存的url
private String contentType;//内容类型如text/html取字典表contentType private String contentType;//内容类型如text/html取字典表contentType
private String md5;//文件md5值 private String md5;//文件md5值
private Long contentLength;//文件长度 private Long contentLength;//文件长度
public String getIndexTable() {
return indexTable;
}
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
public ProxyFileStrategyCfg() { public ProxyFileStrategyCfg() {
super(); super();
} }

View File

@@ -0,0 +1,106 @@
package com.nis.domain.callback;
import java.util.Date;
import com.google.gson.annotations.Expose;
public class ProxyFileStrategyCfgAudit {
@Expose
private Long id; //compileId
@Expose
private Integer cfgId; //compileId
@Expose
private Integer action;
@Expose
private Integer service;
@Expose
private Integer isValid;
@Expose
private Date opTime;
@Expose
private String contentType;
@Expose
private Long contentLength;
@Expose
private String filePath;
@Expose
private Long fileId;
@Expose
private String fileDesc;
@Expose
private Long opUser;
public Long getOpUser() {
return opUser;
}
public void setOpUser(Long opUser) {
this.opUser = opUser;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getCfgId() {
return cfgId;
}
public void setCfgId(Integer cfgId) {
this.cfgId = cfgId;
}
public Integer getAction() {
return action;
}
public void setAction(Integer action) {
this.action = action;
}
public Integer getService() {
return service;
}
public void setService(Integer service) {
this.service = service;
}
public Integer getIsValid() {
return isValid;
}
public void setIsValid(Integer isValid) {
this.isValid = isValid;
}
public Date getOpTime() {
return opTime;
}
public void setOpTime(Date opTime) {
this.opTime = opTime;
}
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public Long getContentLength() {
return contentLength;
}
public void setContentLength(Long contentLength) {
this.contentLength = contentLength;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public Long getFileId() {
return fileId;
}
public void setFileId(Long fileId) {
this.fileId = fileId;
}
public String getFileDesc() {
return fileDesc;
}
public void setFileDesc(String fileDesc) {
this.fileDesc = fileDesc;
}
}

View File

@@ -0,0 +1,45 @@
package com.nis.domain.callback;
import java.util.Arrays;
import com.nis.domain.configuration.BaseCfg;
import com.nis.util.excel.ExcelField;
import antlr.collections.List;
public class ProxyFileTrafficMirrorCfg extends BaseCfg<ProxyFileTrafficMirrorCfg>{
private static final long serialVersionUID = -5895958073449509268L;
public String indexTable = "pxy_profile_traffic_mirror";//对应表名
@ExcelField(title="address_name",sort=1)
private String cfgDesc;//名称,辅助记忆
@ExcelField(title="mirror_addr_list",sort=3)
private String addrList;//目标表示列表
@ExcelField(title="mirror_addr_type",sort=2)
private String addrType;//目标表示类型
public String getIndexTable() {
return indexTable;
}
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
public String getCfgDesc() {
return cfgDesc;
}
public void setCfgDesc(String cfgDesc) {
this.cfgDesc = cfgDesc;
}
public String getAddrList() {
return addrList;
}
public void setAddrList(String addrList) {
this.addrList = addrList;
}
public String getAddrType() {
return addrType;
}
public void setAddrType(String addrType) {
this.addrType = addrType;
}
}

View File

@@ -0,0 +1,106 @@
package com.nis.domain.callback;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.google.gson.annotations.Expose;
public class ProxyFileTrafficMirrorCfgAudit {
@Expose
private Long id; //compileId
@Expose
private Integer cfgId; //compileId
@Expose
private Integer profileId;//compileId
@Expose
private Integer action;
@Expose
private Integer service;
@Expose
private Integer isValid;
@Expose
private Date opTime;
@Expose
private String profileName;
@Expose
private String addrList;
@Expose
private String addrContent;
@Expose
private String addrType;
@Expose
private Long opUser;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getCfgId() {
return cfgId;
}
public void setCfgId(Integer cfgId) {
this.cfgId = cfgId;
}
public Integer getProfileId() {
return profileId;
}
public void setProfileId(Integer profileId) {
this.profileId = profileId;
}
public Integer getAction() {
return action;
}
public void setAction(Integer action) {
this.action = action;
}
public Integer getService() {
return service;
}
public void setService(Integer service) {
this.service = service;
}
public Integer getIsValid() {
return isValid;
}
public void setIsValid(Integer isValid) {
this.isValid = isValid;
}
public Date getOpTime() {
return opTime;
}
public void setOpTime(Date opTime) {
this.opTime = opTime;
}
public String getProfileName() {
return profileName;
}
public void setProfileName(String profileName) {
this.profileName = profileName;
}
public String getAddrList() {
return addrList;
}
public void setAddrList(String addrList) {
this.addrList = addrList;
}
public String getAddrContent() {
return addrContent;
}
public void setAddrContent(String addrContent) {
this.addrContent = addrContent;
}
public String getAddrType() {
return addrType;
}
public void setAddrType(String addrType) {
this.addrType = addrType;
}
public Long getOpUser() {
return opUser;
}
public void setOpUser(Long opUser) {
this.opUser = opUser;
}
}

View File

@@ -76,17 +76,29 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
* 定时任务信息2019年1月18日18:54:53 修改 * 定时任务信息2019年1月18日18:54:53 修改
*/ */
protected ScheduleCfg schedule; protected ScheduleCfg schedule;
protected String commonGroupIds; //公共组织id(考虑一个compile存在多个asn组织的情况)
protected Integer groupType; //url组以及dns组相关功能使用
protected Integer udFlag; //url组以及dns组相关功能使用 过滤数据库数据标记
private String commonGroupIds; //公共组织id(考虑一个compile存在多个asn组织的情况)
public String getCommonGroupIds() { public String getCommonGroupIds() {
return commonGroupIds; return commonGroupIds;
} }
public void setCommonGroupIds(String commonGroupIds) { public void setCommonGroupIds(String commonGroupIds) {
this.commonGroupIds = commonGroupIds; this.commonGroupIds = commonGroupIds;
} }
public Integer getGroupType() {
return groupType;
}
public void setGroupType(Integer groupType) {
this.groupType = groupType;
}
public Integer getUdFlag() {
return udFlag;
}
public void setUdFlag(Integer udFlag) {
this.udFlag = udFlag;
}
public String getExType() { public String getExType() {
return exType; return exType;

View File

@@ -9,6 +9,7 @@
package com.nis.domain.configuration; package com.nis.domain.configuration;
import java.util.List; import java.util.List;
import java.util.Map;
import com.google.gson.annotations.Expose; import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
@@ -399,4 +400,125 @@ public class BaseIpCfg extends BaseCfg<BaseIpCfg> {
public void setIndex(Integer index) { public void setIndex(Integer index) {
this.index = index; this.index = index;
} }
protected Integer keyring;
protected Integer evCert;
protected Integer certTransparency;
protected Integer clientCertReq;
protected Integer pinning;
protected Integer protocolErrors;
protected Integer cn;
protected Integer issuer;
protected Integer selfSigned;
protected Integer expiration;
protected String failMethod;
protected String min;
protected String max;
protected Integer mirrorClient;
protected Integer allowHttp2;
protected Integer enable;
protected Integer mirrorProfile;
public Integer getKeyring() {
return keyring;
}
public void setKeyring(Integer keyring) {
this.keyring = keyring;
}
public Integer getEvCert() {
return evCert;
}
public void setEvCert(Integer evCert) {
this.evCert = evCert;
}
public Integer getCertTransparency() {
return certTransparency;
}
public void setCertTransparency(Integer certTransparency) {
this.certTransparency = certTransparency;
}
public Integer getClientCertReq() {
return clientCertReq;
}
public void setClientCertReq(Integer clientCertReq) {
this.clientCertReq = clientCertReq;
}
public Integer getPinning() {
return pinning;
}
public void setPinning(Integer pinning) {
this.pinning = pinning;
}
public Integer getProtocolErrors() {
return protocolErrors;
}
public void setProtocolErrors(Integer protocolErrors) {
this.protocolErrors = protocolErrors;
}
public Integer getCn() {
return cn;
}
public void setCn(Integer cn) {
this.cn = cn;
}
public Integer getIssuer() {
return issuer;
}
public void setIssuer(Integer issuer) {
this.issuer = issuer;
}
public Integer getSelfSigned() {
return selfSigned;
}
public void setSelfSigned(Integer selfSigned) {
this.selfSigned = selfSigned;
}
public Integer getExpiration() {
return expiration;
}
public void setExpiration(Integer expiration) {
this.expiration = expiration;
}
public String getFailMethod() {
return failMethod;
}
public void setFailMethod(String failMethod) {
this.failMethod = failMethod;
}
public String getMin() {
return min;
}
public void setMin(String min) {
this.min = min;
}
public String getMax() {
return max;
}
public void setMax(String max) {
this.max = max;
}
public Integer getMirrorClient() {
return mirrorClient;
}
public void setMirrorClient(Integer mirrorClient) {
this.mirrorClient = mirrorClient;
}
public Integer getAllowHttp2() {
return allowHttp2;
}
public void setAllowHttp2(Integer allowHttp2) {
this.allowHttp2 = allowHttp2;
}
public Integer getEnable() {
return enable;
}
public void setEnable(Integer enable) {
this.enable = enable;
}
public Integer getMirrorProfile() {
return mirrorProfile;
}
public void setMirrorProfile(Integer mirrorProfile) {
this.mirrorProfile = mirrorProfile;
}
} }

View File

@@ -45,7 +45,14 @@ public class BaseStringCfg<T> extends BaseCfg<T> {
protected Integer specServiceId;//仅用于copy属性使用 protected Integer specServiceId;//仅用于copy属性使用
protected String domain;//仅用于copy属性使用 protected String domain;//仅用于copy属性使用
protected Integer dnsStrategyId;//仅用作复制属性使用 protected Integer dnsStrategyId;//仅用作复制属性使用
protected String groupName;
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public Integer getDnsStrategyId() { public Integer getDnsStrategyId() {
return dnsStrategyId; return dnsStrategyId;
} }
@@ -282,5 +289,124 @@ public class BaseStringCfg<T> extends BaseCfg<T> {
public void setRegionId(Integer regionId) { public void setRegionId(Integer regionId) {
this.regionId = regionId; this.regionId = regionId;
} }
protected Integer keyring;
protected Integer evCert;
protected Integer certTransparency;
protected Integer clientCertReq;
protected Integer pinning;
protected Integer protocolErrors;
protected Integer cn;
protected Integer issuer;
protected Integer selfSigned;
protected Integer expiration;
protected String failMethod;
protected String min;
protected String max;
protected Integer mirrorClient;
protected Integer allowHttp2;
protected Integer enable;
protected Integer mirrorProfile;
public Integer getKeyring() {
return keyring;
}
public void setKeyring(Integer keyring) {
this.keyring = keyring;
}
public Integer getEvCert() {
return evCert;
}
public void setEvCert(Integer evCert) {
this.evCert = evCert;
}
public Integer getCertTransparency() {
return certTransparency;
}
public void setCertTransparency(Integer certTransparency) {
this.certTransparency = certTransparency;
}
public Integer getClientCertReq() {
return clientCertReq;
}
public void setClientCertReq(Integer clientCertReq) {
this.clientCertReq = clientCertReq;
}
public Integer getPinning() {
return pinning;
}
public void setPinning(Integer pinning) {
this.pinning = pinning;
}
public Integer getProtocolErrors() {
return protocolErrors;
}
public void setProtocolErrors(Integer protocolErrors) {
this.protocolErrors = protocolErrors;
}
public Integer getCn() {
return cn;
}
public void setCn(Integer cn) {
this.cn = cn;
}
public Integer getIssuer() {
return issuer;
}
public void setIssuer(Integer issuer) {
this.issuer = issuer;
}
public Integer getSelfSigned() {
return selfSigned;
}
public void setSelfSigned(Integer selfSigned) {
this.selfSigned = selfSigned;
}
public Integer getExpiration() {
return expiration;
}
public void setExpiration(Integer expiration) {
this.expiration = expiration;
}
public String getFailMethod() {
return failMethod;
}
public void setFailMethod(String failMethod) {
this.failMethod = failMethod;
}
public String getMin() {
return min;
}
public void setMin(String min) {
this.min = min;
}
public String getMax() {
return max;
}
public void setMax(String max) {
this.max = max;
}
public Integer getMirrorClient() {
return mirrorClient;
}
public void setMirrorClient(Integer mirrorClient) {
this.mirrorClient = mirrorClient;
}
public Integer getAllowHttp2() {
return allowHttp2;
}
public void setAllowHttp2(Integer allowHttp2) {
this.allowHttp2 = allowHttp2;
}
public Integer getEnable() {
return enable;
}
public void setEnable(Integer enable) {
this.enable = enable;
}
public Integer getMirrorProfile() {
return mirrorProfile;
}
public void setMirrorProfile(Integer mirrorProfile) {
this.mirrorProfile = mirrorProfile;
}
} }

View File

@@ -14,7 +14,11 @@ import java.util.Map;
import com.google.gson.annotations.Expose; import com.google.gson.annotations.Expose;
import com.nis.domain.basics.AsnGroupInfo; import com.nis.domain.basics.AsnGroupInfo;
import com.nis.domain.basics.AsnIpCfg; import com.nis.domain.basics.AsnIpCfg;
import com.nis.domain.basics.DomainCommCfg;
import com.nis.domain.basics.IpCommCfg;
import com.nis.domain.basics.IpReuseIpCfg; import com.nis.domain.basics.IpReuseIpCfg;
import com.nis.domain.basics.ScriberIdCommCfg;
import com.nis.domain.basics.UrlCommCfg;
import com.nis.util.Constants; import com.nis.util.Constants;
import com.nis.util.excel.ExcelField; import com.nis.util.excel.ExcelField;
@@ -88,8 +92,12 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
private List<AsnKeywordCfg> asnKeywords; private List<AsnKeywordCfg> asnKeywords;
@ExcelField(title="log_total",sort=42) @ExcelField(title="log_total",sort=42)
private Long totalLogs; private Long totalLogs;
private List<UrlCommCfg> urlCommGroupList;
private List<IpCommCfg> ipCommGroupCfgList;
private List<DomainCommCfg> domainCommGroupList;
private List<ScriberIdCommCfg> scriberIdCommGroupList;
private String groupName;
/*private CachePolicyUserRegion cachePolicyUserRegion;//缓存策略用户自定义域参数 /*private CachePolicyUserRegion cachePolicyUserRegion;//缓存策略用户自定义域参数
public static class CachePolicyUserRegion{ public static class CachePolicyUserRegion{
@@ -101,6 +109,18 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
public String getOrganization() { public String getOrganization() {
return organization; return organization;
} }
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public List<IpCommCfg> getIpCommGroupCfgList() {
return ipCommGroupCfgList;
}
public void setIpCommGroupCfgList(List<IpCommCfg> ipCommGroupCfgList) {
this.ipCommGroupCfgList = ipCommGroupCfgList;
}
public List<AsnKeywordCfg> getAsnKeywords() { public List<AsnKeywordCfg> getAsnKeywords() {
return asnKeywords; return asnKeywords;
} }
@@ -411,4 +431,26 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
public void setTotalLogs(Long totalLogs) { public void setTotalLogs(Long totalLogs) {
this.totalLogs = totalLogs; this.totalLogs = totalLogs;
} }
public List<UrlCommCfg> getUrlCommGroupList() {
return urlCommGroupList;
}
public void setUrlCommGroupList(List<UrlCommCfg> urlCommGroupList) {
this.urlCommGroupList = urlCommGroupList;
}
public List<DomainCommCfg> getDomainCommGroupList() {
return domainCommGroupList;
}
public void setDomainCommGroupList(List<DomainCommCfg> domainCommGroupList) {
this.domainCommGroupList = domainCommGroupList;
}
public List<ScriberIdCommCfg> getScriberIdCommGroupList() {
return scriberIdCommGroupList;
}
public void setScriberIdCommGroupList(List<ScriberIdCommCfg> scriberIdCommGroupList) {
this.scriberIdCommGroupList = scriberIdCommGroupList;
}
} }

View File

@@ -0,0 +1,58 @@
package com.nis.domain.configuration;
import com.nis.util.excel.ExcelField;
public class ManipulatCfgExport extends CfgIndexInfo {
/**
*
*/
private static final long serialVersionUID = -842585769617969577L;
@ExcelField(title="block_type",dictType="SERVICE_ACTION",sort=2)
private String actionExport;
@ExcelField(title="method_export",dictType="SERVICE_ACTION",sort=3)
private String methodExport;
@ExcelField(title="response_code",sort=3)
private String responseCode;
@ExcelField(title="profile_info",sort=10)
private String profileInfo;
private Integer action;
public String getResponseCode() {
return responseCode;
}
public void setResponseCode(String responseCode) {
this.responseCode = responseCode;
}
public String getMethodExport() {
return methodExport;
}
public void setMethodExport(String methodExport) {
this.methodExport = methodExport;
}
public String getProfileInfo() {
return profileInfo;
}
public void setProfileInfo(String profileInfo) {
this.profileInfo = profileInfo;
}
public String getActionExport() {
return actionExport;
}
public void setActionExport(String actionExport) {
this.actionExport = actionExport;
}
public Integer getAction() {
return action;
}
public void setAction(Integer action) {
this.action = action;
}
}

View File

@@ -0,0 +1,60 @@
package com.nis.domain.configuration;
import com.nis.util.excel.ExcelField;
public class ObjGroupCfg extends BaseCfg<ObjGroupCfg> {
@ExcelField(title="ip_group",sort=33)
private String ipGroup;
@ExcelField(title="url_group",sort=35)
private String urlGroup;
@ExcelField(title="subscribe_id_group",sort=34)
private String subscribeIdGroup;
@ExcelField(title="domain_group",sort=36)
private String domainGroup;
@ExcelField(title="block_type",sort=2)//这里没有使用公共方法处理直接将字典值set进去了不用使用dictType
protected String actionCode;
@ExcelField(title="protocol",sort=3)
protected String userRegion1;
public String getActionCode() {
return actionCode;
}
public void setActionCode(String actionCode) {
this.actionCode = actionCode;
}
public String getIpGroup() {
return ipGroup;
}
public void setIpGroup(String ipGroup) {
this.ipGroup = ipGroup;
}
public String getUrlGroup() {
return urlGroup;
}
public void setUrlGroup(String urlGroup) {
this.urlGroup = urlGroup;
}
public String getSubscribeIdGroup() {
return subscribeIdGroup;
}
public void setSubscribeIdGroup(String subscribeIdGroup) {
this.subscribeIdGroup = subscribeIdGroup;
}
public String getDomainGroup() {
return domainGroup;
}
public void setDomainGroup(String domainGroup) {
this.domainGroup = domainGroup;
}
protected Integer action;//覆盖默认的action上的注解
}

View File

@@ -0,0 +1,153 @@
package com.nis.domain.configuration;
import com.nis.util.excel.ExcelField;
public class PxyInterceptCfg extends CfgIndexInfo {
/**
*
*/
private static final long serialVersionUID = 994229066993318362L;
@ExcelField(title="pxy_intercept_monit_keyring",sort=8)
private String keyring;
@ExcelField(title="exclusions_ev_cert",dictType="SYS_YES_NO",sort=9)
private String evCert;
@ExcelField(title="exclusions_cert_transparency",dictType="SYS_YES_NO",sort=10)
private String certTransparency;
@ExcelField(title="exclusions_client_cert_req",dictType="SYS_YES_NO",sort=11)
private String clientCertReq;
@ExcelField(title="exclusions_pinning",dictType="SYS_YES_NO",sort=12)
private String pinning;
@ExcelField(title="exclusions_protocol_errors",dictType="SYS_YES_NO",sort=13)
private String protocolErrors;
@ExcelField(title="cert_verify_approach_cn",dictType="SYS_YES_NO",sort=14)
private String cn;
@ExcelField(title="cert_verify_approach_issuer",dictType="SYS_YES_NO",sort=15)
private String issuer;
@ExcelField(title="cert_verify_approach_self_signed",dictType="SYS_YES_NO",sort=16)
private String selfSigned;
@ExcelField(title="cert_verify_approach_expiration",dictType="SYS_YES_NO",sort=17)
private String expiration;
@ExcelField(title="cert_verify_fail_method",dictType="FAIL_METHOD",sort=18)
private String failMethod;
@ExcelField(title="ssl_ver_min",dictType="SSL_VERSION",sort=19)
private String min;
@ExcelField(title="ssl_ver_max",dictType="SSL_VERSION",sort=20)
private String max;
@ExcelField(title="ssl_ver_mirror_client",dictType="SYS_YES_NO",sort=21)
private String mirrorClient;
@ExcelField(title="ssl_ver_allow_http2",dictType="SYS_YES_NO",sort=22)
private String allowHttp2;
@ExcelField(title="decrypt_mirror_enable",dictType="SYS_YES_NO",sort=23)
private String enable;
@ExcelField(title="decrypt_mirror_mirror_profile",sort=24)
private String mirrorProfile;
private String userRegion1;
private String userRegion2;
private String userRegion3;
private String userRegion4;
// private String userRegion5;
public String getKeyring() {
return keyring;
}
public void setKeyring(String keyring) {
this.keyring = keyring;
}
public String getEvCert() {
return evCert;
}
public void setEvCert(String evCert) {
this.evCert = evCert;
}
public String getCertTransparency() {
return certTransparency;
}
public void setCertTransparency(String certTransparency) {
this.certTransparency = certTransparency;
}
public String getClientCertReq() {
return clientCertReq;
}
public void setClientCertReq(String clientCertReq) {
this.clientCertReq = clientCertReq;
}
public String getPinning() {
return pinning;
}
public void setPinning(String pinning) {
this.pinning = pinning;
}
public String getProtocolErrors() {
return protocolErrors;
}
public void setProtocolErrors(String protocolErrors) {
this.protocolErrors = protocolErrors;
}
public String getCn() {
return cn;
}
public void setCn(String cn) {
this.cn = cn;
}
public String getIssuer() {
return issuer;
}
public void setIssuer(String issuer) {
this.issuer = issuer;
}
public String getSelfSigned() {
return selfSigned;
}
public void setSelfSigned(String selfSigned) {
this.selfSigned = selfSigned;
}
public String getExpiration() {
return expiration;
}
public void setExpiration(String expiration) {
this.expiration = expiration;
}
public String getFailMethod() {
return failMethod;
}
public void setFailMethod(String failMethod) {
this.failMethod = failMethod;
}
public String getMin() {
return min;
}
public void setMin(String min) {
this.min = min;
}
public String getMax() {
return max;
}
public void setMax(String max) {
this.max = max;
}
public String getMirrorClient() {
return mirrorClient;
}
public void setMirrorClient(String mirrorClient) {
this.mirrorClient = mirrorClient;
}
public String getAllowHttp2() {
return allowHttp2;
}
public void setAllowHttp2(String allowHttp2) {
this.allowHttp2 = allowHttp2;
}
public String getEnable() {
return enable;
}
public void setEnable(String enable) {
this.enable = enable;
}
public String getMirrorProfile() {
return mirrorProfile;
}
public void setMirrorProfile(String mirrorProfile) {
this.mirrorProfile = mirrorProfile;
}
}

View File

@@ -25,6 +25,7 @@ public class PxyObjKeyring extends BaseCfg<PxyObjKeyring> {
@ExcelField(title="expire_after",sort=5) @ExcelField(title="expire_after",sort=5)
private Integer expireAfter; private Integer expireAfter;
private String publicKeyAlgo; private String publicKeyAlgo;
@ExcelField(title="CRL",sort=5)
private String crl; private String crl;
@ExcelField(title="issuer",sort=6) @ExcelField(title="issuer",sort=6)
private String issuer; private String issuer;

View File

@@ -18,9 +18,18 @@ public class PxyObjTrustedCaCert extends BaseCfg<PxyObjTrustedCaCert> {
private String issuer; //颁发者 private String issuer; //颁发者
@ExcelField(title="certificate_file",sort=2) @ExcelField(title="certificate_file",sort=2)
private String certFile; private String certFile;
@ExcelField(title="crl_file",sort=4) //@ExcelField(title="crl_file",sort=4)
private String crlFile; private String crlFile;
private Integer builtIn;//是否内置证书
@ExcelField(title="built_in",sort=5)//是否内置证书(导出用)
private String builtInExp;
public String getBuiltInExp() {
return builtInExp;
}
public void setBuiltInExp(String builtInExp) {
this.builtInExp = builtInExp;
}
public String getCrlFile() { public String getCrlFile() {
return crlFile; return crlFile;
} }
@@ -47,6 +56,11 @@ public class PxyObjTrustedCaCert extends BaseCfg<PxyObjTrustedCaCert> {
public void setIndexTable(String indexTable) { public void setIndexTable(String indexTable) {
this.indexTable = indexTable; this.indexTable = indexTable;
} }
public Integer getBuiltIn() {
return builtIn;
}
public void setBuiltIn(Integer builtIn) {
this.builtIn = builtIn;
}
} }

View File

@@ -0,0 +1,23 @@
package com.nis.domain.configuration.template;
import com.nis.util.excel.ExcelField;
/**
* 域名公共组配置 导入模板
* @author dell
*
*/
public class DomainCommCfgTemplate extends StringAllNotDoLogTemplate{
@ExcelField(title="group_name",align=2,sort=10)
private String groupName;
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
}

View File

@@ -0,0 +1,160 @@
package com.nis.domain.configuration.template;
import com.nis.util.excel.ExcelField;
public class InterceptDomainTemplate extends StringAllNotDoLogTemplate {
private Integer keyring;
private Integer evCert;
private Integer certTransparency;
private Integer clientCertReq;
private Integer pinning;
private Integer protocolErrors;
private Integer cn;
private Integer issuer;
private Integer selfSigned;
private Integer expiration;
private String failMethod;
private String min;
private String max;
private Integer mirrorClient;
private Integer allowHttp2;
private Integer enable;
private Integer mirrorProfile;
@ExcelField(title="pxy_intercept_monit_keyring",align=2,sort=17)
public Integer getKeyring() {
return keyring;
}
public void setKeyring(Integer keyring) {
this.keyring = keyring;
}
@ExcelField(title="exclusions_ev_cert",align=2,sort=18)
public Integer getEvCert() {
return evCert;
}
public void setEvCert(Integer evCert) {
this.evCert = evCert;
}
@ExcelField(title="exclusions_cert_transparency",align=2,sort=19)
public Integer getCertTransparency() {
return certTransparency;
}
public void setCertTransparency(Integer certTransparency) {
this.certTransparency = certTransparency;
}
@ExcelField(title="exclusions_client_cert_req",align=2,sort=20)
public Integer getClientCertReq() {
return clientCertReq;
}
public void setClientCertReq(Integer clientCertReq) {
this.clientCertReq = clientCertReq;
}
@ExcelField(title="exclusions_pinning",align=2,sort=21)
public Integer getPinning() {
return pinning;
}
public void setPinning(Integer pinning) {
this.pinning = pinning;
}
@ExcelField(title="protocol_errors",align=2,sort=22)
public Integer getProtocolErrors() {
return protocolErrors;
}
public void setProtocolErrors(Integer protocolErrors) {
this.protocolErrors = protocolErrors;
}
@ExcelField(title="cert_verify_approach_cn",align=2,sort=23)
public Integer getCn() {
return cn;
}
public void setCn(Integer cn) {
this.cn = cn;
}
@ExcelField(title="cert_verify_approach_issuer",align=2,sort=24)
public Integer getIssuer() {
return issuer;
}
public void setIssuer(Integer issuer) {
this.issuer = issuer;
}
@ExcelField(title="cert_verify_approach_self_signed",align=2,sort=25)
public Integer getSelfSigned() {
return selfSigned;
}
public void setSelfSigned(Integer selfSigned) {
this.selfSigned = selfSigned;
}
@ExcelField(title="cert_verify_approach_expiration",align=2,sort=26)
public Integer getExpiration() {
return expiration;
}
public void setExpiration(Integer expiration) {
this.expiration = expiration;
}
@ExcelField(title="cert_verify_fail_method",dictType="FAIL_METHOD",align=2,sort=27)
public String getFailMethod() {
return failMethod;
}
public void setFailMethod(String failMethod) {
this.failMethod = failMethod;
}
@ExcelField(title="ssl_ver_min",dictType="SSL_VERSION",align=2,sort=28)
public String getMin() {
return min;
}
public void setMin(String min) {
this.min = min;
}
@ExcelField(title="ssl_ver_max",dictType="SSL_VERSION",align=2,sort=29)
public String getMax() {
return max;
}
public void setMax(String max) {
this.max = max;
}
@ExcelField(title="ssl_ver_mirror_client",align=2,sort=30)
public Integer getMirrorClient() {
return mirrorClient;
}
public void setMirrorClient(Integer mirrorClient) {
this.mirrorClient = mirrorClient;
}
@ExcelField(title="ssl_ver_allow_http2",align=2,sort=31)
public Integer getAllowHttp2() {
return allowHttp2;
}
public void setAllowHttp2(Integer allowHttp2) {
this.allowHttp2 = allowHttp2;
}
@ExcelField(title="decrypt_mirror_enable",align=2,sort=32)
public Integer getEnable() {
return enable;
}
public void setEnable(Integer enable) {
this.enable = enable;
}
@ExcelField(title="decrypt_mirror_mirror_profile",align=2,sort=33)
public Integer getMirrorProfile() {
return mirrorProfile;
}
public void setMirrorProfile(Integer mirrorProfile) {
this.mirrorProfile = mirrorProfile;
}
}

View File

@@ -0,0 +1,161 @@
package com.nis.domain.configuration.template;
import com.nis.util.excel.ExcelField;
public class InterceptIpTemplate extends IpAllNotDoLogTemplate {
private Integer keyring;
private Integer evCert;
private Integer certTransparency;
private Integer clientCertReq;
private Integer pinning;
private Integer protocolErrors;
private Integer cn;
private Integer issuer;
private Integer selfSigned;
private Integer expiration;
private String failMethod;
private String min;
private String max;
private Integer mirrorClient;
private Integer allowHttp2;
private Integer enable;
private Integer mirrorProfile;
@ExcelField(title="pxy_intercept_monit_keyring",align=2,sort=17)
public Integer getKeyring() {
return keyring;
}
public void setKeyring(Integer keyring) {
this.keyring = keyring;
}
@ExcelField(title="exclusions_ev_cert",align=2,sort=18)
public Integer getEvCert() {
return evCert;
}
public void setEvCert(Integer evCert) {
this.evCert = evCert;
}
@ExcelField(title="exclusions_cert_transparency",align=2,sort=19)
public Integer getCertTransparency() {
return certTransparency;
}
public void setCertTransparency(Integer certTransparency) {
this.certTransparency = certTransparency;
}
@ExcelField(title="exclusions_client_cert_req",align=2,sort=20)
public Integer getClientCertReq() {
return clientCertReq;
}
public void setClientCertReq(Integer clientCertReq) {
this.clientCertReq = clientCertReq;
}
@ExcelField(title="exclusions_pinning",align=2,sort=21)
public Integer getPinning() {
return pinning;
}
public void setPinning(Integer pinning) {
this.pinning = pinning;
}
@ExcelField(title="exclusions_protocol_errors",align=2,sort=22)
public Integer getProtocolErrors() {
return protocolErrors;
}
public void setProtocolErrors(Integer protocolErrors) {
this.protocolErrors = protocolErrors;
}
@ExcelField(title="cert_verify_approach_cn",align=2,sort=23)
public Integer getCn() {
return cn;
}
public void setCn(Integer cn) {
this.cn = cn;
}
@ExcelField(title="cert_verify_approach_issuer",align=2,sort=24)
public Integer getIssuer() {
return issuer;
}
public void setIssuer(Integer issuer) {
this.issuer = issuer;
}
@ExcelField(title="cert_verify_approach_self_signed",align=2,sort=25)
public Integer getSelfSigned() {
return selfSigned;
}
public void setSelfSigned(Integer selfSigned) {
this.selfSigned = selfSigned;
}
@ExcelField(title="cert_verify_approach_expiration",align=2,sort=26)
public Integer getExpiration() {
return expiration;
}
public void setExpiration(Integer expiration) {
this.expiration = expiration;
}
@ExcelField(title="cert_verify_fail_method",dictType="FAIL_METHOD",align=2,sort=27)
public String getFailMethod() {
return failMethod;
}
public void setFailMethod(String failMethod) {
this.failMethod = failMethod;
}
@ExcelField(title="ssl_ver_min",dictType="SSL_VERSION",align=2,sort=28)
public String getMin() {
return min;
}
public void setMin(String min) {
this.min = min;
}
@ExcelField(title="ssl_ver_max",dictType="SSL_VERSION",align=2,sort=29)
public String getMax() {
return max;
}
public void setMax(String max) {
this.max = max;
}
@ExcelField(title="ssl_ver_mirror_client",align=2,sort=30)
public Integer getMirrorClient() {
return mirrorClient;
}
public void setMirrorClient(Integer mirrorClient) {
this.mirrorClient = mirrorClient;
}
@ExcelField(title="ssl_ver_allow_http2",align=2,sort=31)
public Integer getAllowHttp2() {
return allowHttp2;
}
public void setAllowHttp2(Integer allowHttp2) {
this.allowHttp2 = allowHttp2;
}
@ExcelField(title="decrypt_mirror_enable",align=2,sort=32)
public Integer getEnable() {
return enable;
}
public void setEnable(Integer enable) {
this.enable = enable;
}
@ExcelField(title="decrypt_mirror_mirror_profile",align=2,sort=33)
public Integer getMirrorProfile() {
return mirrorProfile;
}
public void setMirrorProfile(Integer mirrorProfile) {
this.mirrorProfile = mirrorProfile;
}
}

View File

@@ -15,13 +15,13 @@ public class IpAllNotDoLogTemplate extends BasicTemplate{
private String cfgDesc; protected String cfgDesc;
private String srcIpAddress; protected String srcIpAddress;
private String destIpAddress; protected String destIpAddress;
private String srcPort; protected String srcPort;
private String destPort; protected String destPort;
private Integer protocol; protected Integer protocol;
private Integer direction; protected Integer direction;
@ExcelField(title="config_describe",align=2,sort=1) @ExcelField(title="config_describe",align=2,sort=1)
public String getCfgDesc() { public String getCfgDesc() {

View File

@@ -0,0 +1,20 @@
package com.nis.domain.configuration.template;
import com.nis.util.excel.ExcelField;
public class IpCommCfgTemplate extends IpAllNotDoLogTemplate{
@ExcelField(title="group_name",align=2,sort=10)
private String groupName;
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
}

View File

@@ -0,0 +1,23 @@
package com.nis.domain.configuration.template;
import com.nis.util.excel.ExcelField;
/**
* 域名公共组配置 导入模板
* @author dell
*
*/
public class ScriberIdCommCfgTemplate extends StringAllNotDoLogTemplate{
@ExcelField(title="group_name",align=2,sort=10)
private String groupName;
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
}

View File

@@ -0,0 +1,23 @@
package com.nis.domain.configuration.template;
import com.nis.util.excel.ExcelField;
/**
* URL公共组配置 导入模板
* @author dell
*
*/
public class UrlCommCfgTemplate extends StringAllNotDoLogTemplate{
@ExcelField(title="group_name",align=2,sort=10)
private String groupName;
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
}

View File

@@ -0,0 +1,116 @@
package com.nis.domain.dashboard;
import com.nis.domain.report.BaseReport;
import com.nis.util.excel.ExcelField;
public class ConfigStatistic extends BaseReport<ConfigStatistic>{
private static final long serialVersionUID = 8905927100915123026L;
@ExcelField(title="cfg_id",sort=1)
private String cfgId;
@ExcelField(title="config_describe",sort=2)
private String cfgDesc;
private String serviceId;
private String tableName;//表名
private String beginDate;
private String endDate;
private String area;//区域
private String operator;//运营商
private String chartType;//图表类型
public String getBeginDate() {
return beginDate;
}
public void setBeginDate(String beginDate) {
this.beginDate = beginDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getCfgId() {
return cfgId;
}
public void setCfgId(String cfgId) {
this.cfgId = cfgId;
}
public String getCfgDesc() {
return cfgDesc;
}
public void setCfgDesc(String cfgDesc) {
this.cfgDesc = cfgDesc;
}
public String getServiceId() {
return serviceId;
}
public void setServiceId(String serviceId) {
this.serviceId = serviceId;
}
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public Long getSum() {
return sum;
}
public void setSum(Long sum) {
this.sum = sum;
}
public Integer getService() {
return service;
}
public void setService(Integer service) {
this.service = service;
}
public String getArea() {
return area;
}
public void setArea(String area) {
this.area = area;
}
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
public String getChartType() {
return chartType;
}
public void setChartType(String chartType) {
this.chartType = chartType;
}
}

View File

@@ -0,0 +1,94 @@
package com.nis.domain.dashboard.codedic;
import java.io.Serializable;
import java.util.Date;
public class CodeDomainDic implements Serializable{
/**
*
*/
private static final long serialVersionUID = 8878203808371459079L;
private Integer id;
private String websiteServiceId;
private String domain;
private String topicId;
private Date createTime;
private String creatorId;
private Integer isValid;
private String ican;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getWebsiteServiceId() {
return websiteServiceId;
}
public void setWebsiteServiceId(String websiteServiceId) {
this.websiteServiceId = websiteServiceId;
}
public String getDomain() {
return domain;
}
public void setDomain(String domain) {
this.domain = domain;
}
public String getTopicId() {
return topicId;
}
public void setTopicId(String topicId) {
this.topicId = topicId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getCreatorId() {
return creatorId;
}
public void setCreatorId(String creatorId) {
this.creatorId = creatorId;
}
public Integer getIsValid() {
return isValid;
}
public void setIsValid(Integer isValid) {
this.isValid = isValid;
}
public String getIcan() {
return ican;
}
public void setIcan(String ican) {
this.ican = ican;
}
}

View File

@@ -6,7 +6,7 @@ public class NtcCollectRadiusLog extends BaseLogEntity<NtcCollectRadiusLog> {
private static final long serialVersionUID = -4947912502754359817L; private static final long serialVersionUID = -4947912502754359817L;
@ExcelField(title="message_type",dictType="MESSAGE_TYPE",sort=10) @ExcelField(title="code",dictType="MESSAGE_TYPE",sort=10)
protected Integer code; protected Integer code;
@ExcelField(title="nas_ip",sort=15) @ExcelField(title="nas_ip",sort=15)
protected String nasIp; protected String nasIp;

View File

@@ -0,0 +1,736 @@
package com.nis.domain.log;
import com.google.gson.annotations.Expose;
import com.nis.domain.BaseEntity;
import com.nis.util.excel.ExcelField;
/**
* (日志 代理HTTP 操控 实体类
*
*/
public class PxyHttpManipulationLog extends BaseEntity<PxyHttpManipulationLog>{
private static final long serialVersionUID = -3046458130302949428L;
@ExcelField(title="found_time",sort=5)
protected String foundTime; //发现时间timestamp
@ExcelField(title="recv_time",sort=6)
protected String recvTime; //接收时间timestamp
@ExcelField(title="transport_layer_protocol",dictType="LOG_PROTOCOL",sort=30)
protected String transProto; //协议类型从字典LOG_PROTOCOL取值
@ExcelField(title="addr_type",dictType="IP_TYPE",sort=35)
protected Integer addrType; //ip地址类型从字典IP_TYPE取值
@ExcelField(title="URL",sort=8)
private String url;
@ExcelField(title="host",sort=8)
private String host;//主机地址
@ExcelField(title="domain_name",sort=8)
private String domain;//域名
@ExcelField(title="category",sort=8)
private String category;//域名分类
@ExcelField(title="req_line",sort=9)
private String reqLine;
@ExcelField(title="res_line",sort=10)
private String resLine;
@ExcelField(title="PXY_CACHE_HTTP_COOKIE",sort=11)
private String cookie;
@ExcelField(title="referer",sort=12)
private String referer;
@ExcelField(title="user_agent",sort=13)
private String userAgent;
@ExcelField(title="content_len",sort=14)
private String contentLen;
@ExcelField(title="content_type",sort=15)
private String contentType;
@ExcelField(title="set_cookie",sort=16)
private String setCookie;
@ExcelField(title="req_header",sort=17)
private String reqHeader;
@ExcelField(title="resp_header",sort=18)
private String respHeader;
@ExcelField(title="req_body",sort=78)
private String reqBody;
@ExcelField(title="resp_body",sort=79)
private String respBody;
// @ExcelField(title="website",sort=8)
// private String website;
@ExcelField(title="cfg_id",sort=1)
private Integer policyId;//
@ExcelField(title="app_proto",sort=31)
private String appProto;//应用协议类型
@ExcelField(title="startTime",sort=5)
private String startTime;//会话创建时间
@ExcelField(title="endTime",sort=5)
private String endTime;//会话结束时间
@Expose
@ExcelField(title="server_ip",sort=40)
protected String serverIp; //服务端ip地址
@Expose
@ExcelField(title="client_ip",sort=41)
protected String clientIp; //客户端ip地址
@Expose
@ExcelField(title="server_port",sort=42)
protected String serverPort; //服务端ip端口
@Expose
@ExcelField(title="client_port",sort=43)
protected String clientPort; //客户端ip端口
@ExcelField(title="entrance_id",dictType="ENTRANCE",sort=7)
protected Integer entranceId; //出入口编号
@ExcelField(title="deviceid",dictType="DEVICE",sort=50)
protected Integer deviceId; //串联设备编号
@ExcelField(title="direction",dictType="LOG_DIRECTION",sort=55)
protected Integer direction; //传输方向 0域内->域外1域外->域内从字典LOG_DIRECTION取值
@ExcelField(title="stream_type",dictType="LOG_STREAM_TYPE",sort=65)
protected Integer streamDir; //流类型 0c2s1s2c2double从字典LOG_STREAMTYPE取值
@ExcelField(title="clj_ip",sort=27)
protected String capIp; //处理机IP
@ExcelField(title="nest_addr_list",sort=66)
protected String addrList; //嵌套地址列表
@ExcelField(title="server_locate",sort=67)
protected String serverLocation;// 服务端地址定位信息
@ExcelField(title="client_locate",sort=68)
protected String clientLocation;// 客户端地址定位信息
@ExcelField(title="s_asn",sort=70)
protected String clientAsn;//客户端ASN
@ExcelField(title="d_asn",sort=71)
protected String serverAsn;//服务端ASN
@ExcelField(title="s_subscribe_id",sort=73)
protected String subscribeId;//客户端用户名
@ExcelField(title="scene_file",sort=77)
protected String sceneFile;//现场日志文件地址
@ExcelField(title="isp",sort=80)
protected String isp;//运营商
protected Integer service; //配置表的serviceId
protected Integer functionId;
@ExcelField(title="action",dictType="SERVICE_ACTION",sort=2)
protected Integer action;
//新增字段
@ExcelField(title="encap_type",dictType="ENCAP_TYPE",sort=52)
protected Integer encapType;//原始二层封装格式
@ExcelField(title="link_id",dictType="LINK",sort=51)
protected Integer linkId;//串联设备链路号
@ExcelField(title="inner_smac",sort=58)
protected String innerSmac;//MAC_IN_MAC的内层源MAC
@ExcelField(title="inner_dmac",sort=59)
protected String innerDmac;//MAC_IN_MAC的内层目标MAC
//自定义字段
protected String date;//配置界面日志总量查询时间
protected String seltype;//选中类型,页面搜索用
protected String searchFoundStartTime;//开始时间格式为yyyy-mm-dd hh24:mi:ss
protected String searchFoundEndTime;//结束时间,格式同上
protected String isLogTotalSearch;//由配置界面跳转日志查询标识
protected String orderBy;//排序参数
protected Integer cfgId;
protected String fields;
protected Integer compileId;//
protected String startRecvTime;//开始时间
protected String endRecvTime; //结束时间
@ExcelField(title="con_duration_ms",sort=81)
protected Integer conDurationMs;//通信时长
protected String reqBodyKey;//请求体转储文件KEY
protected String resBodyKey;//应答体转储文件KEY
@ExcelField(title="version",sort=82)
protected String version;//版本
@ExcelField(title="sni",sort=83)
protected String sni;//
@ExcelField(title="san",sort=84)
protected String san;
@ExcelField(title="cn",sort=85)
protected String cn;
@ExcelField(title="social_app",sort=86)
protected String appId;//app
// @ExcelField(title="social_app",sort=86)
protected String appName;//app
@ExcelField(title="protocol",sort=87)
protected String protocolId;//协议
// @ExcelField(title="protocol",sort=87)
protected String protocolName;//协议
@ExcelField(title="con_latency_ms",sort=88)
protected Integer conLatencyMs;//握手延迟
@ExcelField(title="pinning",dictType="PINNING",sort=89)
protected Integer pinningst;//pinning状态
@ExcelField(title="intercept_state",dictType="INTERCEPT_STATE",sort=90)
protected Integer interceptState;//拦截状态
@ExcelField(title="ssl_server_side_latency",sort=91)
protected Integer sslServerSideLatency;//服务器侧ssl建立延迟
@ExcelField(title="ssl_client_side_latency",sort=92)
protected Integer sslClientSideLatency;//客户端侧ssl建立延迟
@ExcelField(title="ssl_server_side_version",dictType="SSL_VERSION",sort=93)
protected String sslServerSideVersion;//服务端侧ssl版本
@ExcelField(title="ssl_client_side_version",dictType="SSL_VERSION",sort=94)
protected String sslClientSideVersion;//客户端侧ssl版本
@ExcelField(title="ssl_cert_verify",dictType="SSL_CERT_VERIFY",sort=95)
protected Integer sslCertVerify;//证书校验结果
@ExcelField(title="stream_trace_id",sort=96)
protected String streamTraceId;//流的追踪ID
@ExcelField(title="ssl_error",sort=97)
protected String sslError;//ssl错误信息
@ExcelField(title="c2s_pkt_num",sort=98)
protected Integer c2sPktNum;//c2s包数
@ExcelField(title="s2c_pkt_num",sort=99)
protected Integer s2cPktNum;//s2c包数
@ExcelField(title="c2s_byte_num",sort=100)
protected Integer c2sByteNum;//c2s字节数
@ExcelField(title="s2c_byte_num",sort=101)
protected Integer s2cByteNum;//s2c字节数
@ExcelField(title="nas_ip",sort=102)
protected String nasIp;//ISN接入的IP
@ExcelField(title="framed_ip",sort=103)
protected String framedIp;//用户IP地址
@ExcelField(title="account",sort=104)
protected String account;//用户名
@ExcelField(title="packet_type",dictType="MESSAGE_TYPE",sort=105)
protected Integer packetType;//报文类型
protected String dIp;
protected String sIp;
public String getProtocolName() {
return protocolName;
}
public void setProtocolName(String protocolName) {
this.protocolName = protocolName;
}
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public String getdIp() {
return dIp;
}
public void setdIp(String dIp) {
this.dIp = dIp;
}
public String getsIp() {
return sIp;
}
public void setsIp(String sIp) {
this.sIp = sIp;
}
public String getAppProto() {
return appProto;
}
public void setAppProto(String appProto) {
this.appProto = appProto;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getReqLine() {
return reqLine;
}
public void setReqLine(String reqLine) {
this.reqLine = reqLine;
}
public String getResLine() {
return resLine;
}
public void setResLine(String resLine) {
this.resLine = resLine;
}
public String getCookie() {
return cookie;
}
public void setCookie(String cookie) {
this.cookie = cookie;
}
public String getReferer() {
return referer;
}
public void setReferer(String referer) {
this.referer = referer;
}
public String getUserAgent() {
return userAgent;
}
public void setUserAgent(String userAgent) {
this.userAgent = userAgent;
}
public String getContentLen() {
return contentLen;
}
public void setContentLen(String contentLen) {
this.contentLen = contentLen;
}
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public String getSetCookie() {
return setCookie;
}
public void setSetCookie(String setCookie) {
this.setCookie = setCookie;
}
public String getReqHeader() {
return reqHeader;
}
public void setReqHeader(String reqHeader) {
this.reqHeader = reqHeader;
}
public String getRespHeader() {
return respHeader;
}
public void setRespHeader(String respHeader) {
this.respHeader = respHeader;
}
public String getReqBody() {
return reqBody;
}
public void setReqBody(String reqBody) {
this.reqBody = reqBody;
}
public String getRespBody() {
return respBody;
}
public void setRespBody(String respBody) {
this.respBody = respBody;
}
// public String getWebsite() {
// return website;
// }
// public void setWebsite(String website) {
// this.website = website;
// }
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public String getDomain() {
return domain;
}
public void setDomain(String domain) {
this.domain = domain;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getIsp() {
return isp;
}
public void setIsp(String isp) {
this.isp = isp;
}
public Integer getPolicyId() {
return policyId;
}
public void setPolicyId(Integer policyId) {
this.policyId = policyId;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public String getServerIp() {
return serverIp;
}
public void setServerIp(String serverIp) {
this.serverIp = serverIp;
}
public String getClientIp() {
return clientIp;
}
public void setClientIp(String clientIp) {
this.clientIp = clientIp;
}
public String getServerPort() {
return serverPort;
}
public void setServerPort(String serverPort) {
this.serverPort = serverPort;
}
public String getClientPort() {
return clientPort;
}
public void setClientPort(String clientPort) {
this.clientPort = clientPort;
}
public String getServerLocation() {
return serverLocation;
}
public void setServerLocation(String serverLocation) {
this.serverLocation = serverLocation;
}
public String getClientLocation() {
return clientLocation;
}
public void setClientLocation(String clientLocation) {
this.clientLocation = clientLocation;
}
public String getClientAsn() {
return clientAsn;
}
public void setClientAsn(String clientAsn) {
this.clientAsn = clientAsn;
}
public String getServerAsn() {
return serverAsn;
}
public void setServerAsn(String serverAsn) {
this.serverAsn = serverAsn;
}
public String getSubscribeId() {
return subscribeId;
}
public void setSubscribeId(String subscribeId) {
this.subscribeId = subscribeId;
}
public Integer getConDurationMs() {
return conDurationMs;
}
public void setConDurationMs(Integer conDurationMs) {
this.conDurationMs = conDurationMs;
}
public String getReqBodyKey() {
return reqBodyKey;
}
public void setReqBodyKey(String reqBodyKey) {
this.reqBodyKey = reqBodyKey;
}
public String getResBodyKey() {
return resBodyKey;
}
public void setResBodyKey(String resBodyKey) {
this.resBodyKey = resBodyKey;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getSni() {
return sni;
}
public void setSni(String sni) {
this.sni = sni;
}
public String getSan() {
return san;
}
public void setSan(String san) {
this.san = san;
}
public String getCn() {
return cn;
}
public void setCn(String cn) {
this.cn = cn;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getProtocolId() {
return protocolId;
}
public void setProtocolId(String protocolId) {
this.protocolId = protocolId;
}
public Integer getConLatencyMs() {
return conLatencyMs;
}
public void setConLatencyMs(Integer conLatencyMs) {
this.conLatencyMs = conLatencyMs;
}
public Integer getPinningst() {
return pinningst;
}
public void setPinningst(Integer pinningst) {
this.pinningst = pinningst;
}
public Integer getC2sPktNum() {
return c2sPktNum;
}
public void setC2sPktNum(Integer c2sPktNum) {
this.c2sPktNum = c2sPktNum;
}
public Integer getS2cPktNum() {
return s2cPktNum;
}
public void setS2cPktNum(Integer s2cPktNum) {
this.s2cPktNum = s2cPktNum;
}
public Integer getC2sByteNum() {
return c2sByteNum;
}
public void setC2sByteNum(Integer c2sByteNum) {
this.c2sByteNum = c2sByteNum;
}
public Integer getS2cByteNum() {
return s2cByteNum;
}
public void setS2cByteNum(Integer s2cByteNum) {
this.s2cByteNum = s2cByteNum;
}
public String getNasIp() {
return nasIp;
}
public void setNasIp(String nasIp) {
this.nasIp = nasIp;
}
public String getFramedIp() {
return framedIp;
}
public void setFramedIp(String framedIp) {
this.framedIp = framedIp;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public Integer getPacketType() {
return packetType;
}
public void setPacketType(Integer packetType) {
this.packetType = packetType;
}
public Integer getCompileId() {
return compileId;
}
public void setCompileId(Integer compileId) {
this.compileId = compileId;
}
public String getStartRecvTime() {
return startRecvTime;
}
public void setStartRecvTime(String startRecvTime) {
this.startRecvTime = startRecvTime;
}
public String getEndRecvTime() {
return endRecvTime;
}
public void setEndRecvTime(String endRecvTime) {
this.endRecvTime = endRecvTime;
}
public String getFoundTime() {
return foundTime;
}
public void setFoundTime(String foundTime) {
this.foundTime = foundTime;
}
public String getRecvTime() {
return recvTime;
}
public void setRecvTime(String recvTime) {
this.recvTime = recvTime;
}
public String getTransProto() {
return transProto;
}
public void setTransProto(String transProto) {
this.transProto = transProto;
}
public Integer getAddrType() {
return addrType;
}
public void setAddrType(Integer addrType) {
this.addrType = addrType;
}
public Integer getEntranceId() {
return entranceId;
}
public void setEntranceId(Integer entranceId) {
this.entranceId = entranceId;
}
public Integer getDeviceId() {
return deviceId;
}
public void setDeviceId(Integer deviceId) {
this.deviceId = deviceId;
}
public Integer getDirection() {
return direction;
}
public void setDirection(Integer direction) {
this.direction = direction;
}
public Integer getStreamDir() {
return streamDir;
}
public void setStreamDir(Integer streamDir) {
this.streamDir = streamDir;
}
public String getCapIp() {
return capIp;
}
public void setCapIp(String capIp) {
this.capIp = capIp;
}
public String getAddrList() {
return addrList;
}
public void setAddrList(String addrList) {
this.addrList = addrList;
}
public String getSceneFile() {
return sceneFile;
}
public void setSceneFile(String sceneFile) {
this.sceneFile = sceneFile;
}
public Integer getService() {
return service;
}
public void setService(Integer service) {
this.service = service;
}
public Integer getFunctionId() {
return functionId;
}
public void setFunctionId(Integer functionId) {
this.functionId = functionId;
}
public Integer getAction() {
return action;
}
public void setAction(Integer action) {
this.action = action;
}
public Integer getEncapType() {
return encapType;
}
public void setEncapType(Integer encapType) {
this.encapType = encapType;
}
public Integer getLinkId() {
return linkId;
}
public void setLinkId(Integer linkId) {
this.linkId = linkId;
}
public String getInnerSmac() {
return innerSmac;
}
public void setInnerSmac(String innerSmac) {
this.innerSmac = innerSmac;
}
public String getInnerDmac() {
return innerDmac;
}
public void setInnerDmac(String innerDmac) {
this.innerDmac = innerDmac;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getSeltype() {
return seltype;
}
public void setSeltype(String seltype) {
this.seltype = seltype;
}
public String getSearchFoundStartTime() {
return searchFoundStartTime;
}
public void setSearchFoundStartTime(String searchFoundStartTime) {
this.searchFoundStartTime = searchFoundStartTime;
}
public String getSearchFoundEndTime() {
return searchFoundEndTime;
}
public void setSearchFoundEndTime(String searchFoundEndTime) {
this.searchFoundEndTime = searchFoundEndTime;
}
public String getIsLogTotalSearch() {
return isLogTotalSearch;
}
public void setIsLogTotalSearch(String isLogTotalSearch) {
this.isLogTotalSearch = isLogTotalSearch;
}
public String getOrderBy() {
return orderBy;
}
public void setOrderBy(String orderBy) {
this.orderBy = orderBy;
}
public Integer getInterceptState() {
return interceptState;
}
public void setInterceptState(Integer interceptState) {
this.interceptState = interceptState;
}
public Integer getSslServerSideLatency() {
return sslServerSideLatency;
}
public void setSslServerSideLatency(Integer sslServerSideLatency) {
this.sslServerSideLatency = sslServerSideLatency;
}
public Integer getSslClientSideLatency() {
return sslClientSideLatency;
}
public void setSslClientSideLatency(Integer sslClientSideLatency) {
this.sslClientSideLatency = sslClientSideLatency;
}
public String getSslServerSideVersion() {
return sslServerSideVersion;
}
public void setSslServerSideVersion(String sslServerSideVersion) {
this.sslServerSideVersion = sslServerSideVersion;
}
public String getSslClientSideVersion() {
return sslClientSideVersion;
}
public void setSslClientSideVersion(String sslClientSideVersion) {
this.sslClientSideVersion = sslClientSideVersion;
}
public Integer getSslCertVerify() {
return sslCertVerify;
}
public void setSslCertVerify(Integer sslCertVerify) {
this.sslCertVerify = sslCertVerify;
}
public String getStreamTraceId() {
return streamTraceId;
}
public void setStreamTraceId(String streamTraceId) {
this.streamTraceId = streamTraceId;
}
public String getSslError() {
return sslError;
}
public void setSslError(String sslError) {
this.sslError = sslError;
}
public Integer getCfgId() {
return cfgId;
}
public void setCfgId(Integer cfgId) {
this.cfgId = cfgId;
}
public String getFields() {
return fields;
}
public void setFields(String fields) {
this.fields = fields;
}
}

View File

@@ -0,0 +1,140 @@
package com.nis.domain.maat;
import java.io.Serializable;
import java.util.List;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
/**
* 管控策略动作参数
*/
public class ManipulatActionParam implements Serializable{
private static final long serialVersionUID = 7282481538239386968L;
@Expose
private String method;
@Expose
private Integer code;
@Expose
private String to;
@Expose
private String message;
@Expose
private Integer html_profile;
@Expose
private List<ReplaceCfg> rules;
public static class ReplaceCfg{
@Expose
private String search_in;
@Expose
private String find;
@Expose
private String replace_with;
public String getSearch_in() {
return search_in;
}
public void setSearch_in(String search_in) {
this.search_in = search_in;
}
public String getFind() {
return find;
}
public void setFind(String find) {
this.find = find;
}
public String getReplace_with() {
return replace_with;
}
public void setReplace_with(String replace_with) {
this.replace_with = replace_with;
}
}
@Expose
private Integer hijack_profile;
@Expose
private Integer insert_profile;
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getTo() {
return to;
}
public void setTo(String to) {
this.to = to;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Integer getHtml_profile() {
return html_profile;
}
public void setHtml_profile(Integer html_profile) {
this.html_profile = html_profile;
}
public List<ReplaceCfg> getRules() {
return rules;
}
public void setRules(List<ReplaceCfg> rules) {
this.rules = rules;
}
public Integer getHijack_profile() {
return hijack_profile;
}
public void setHijack_profile(Integer hijack_profile) {
this.hijack_profile = hijack_profile;
}
public Integer getInsert_profile() {
return insert_profile;
}
public void setInsert_profile(Integer insert_profile) {
this.insert_profile = insert_profile;
}
}

View File

@@ -9,6 +9,7 @@
package com.nis.domain.report; package com.nis.domain.report;
import com.nis.domain.BaseEntity; import com.nis.domain.BaseEntity;
import com.nis.util.excel.ExcelField;
/** /**
* @ClassName: BaseReportLog.java * @ClassName: BaseReportLog.java
@@ -25,6 +26,7 @@ public class BaseReport<T> extends BaseEntity<T>{
*/ */
private static final long serialVersionUID = -6190203013788730697L; private static final long serialVersionUID = -6190203013788730697L;
@ExcelField(title="config_log_total",sort=3)
protected Long sum; protected Long sum;
protected Integer service; protected Integer service;
protected String reportTime; protected String reportTime;

View File

@@ -7,6 +7,7 @@ import com.nis.domain.dashboard.SysIspInfo;
import com.nis.domain.dashboard.codedic.CodeAppDic; import com.nis.domain.dashboard.codedic.CodeAppDic;
import com.nis.domain.dashboard.codedic.CodeBehaviorTypeDic; import com.nis.domain.dashboard.codedic.CodeBehaviorTypeDic;
import com.nis.domain.dashboard.codedic.CodeBrowserTypeDic; import com.nis.domain.dashboard.codedic.CodeBrowserTypeDic;
import com.nis.domain.dashboard.codedic.CodeDomainDic;
import com.nis.domain.dashboard.codedic.CodeOsTypeDic; import com.nis.domain.dashboard.codedic.CodeOsTypeDic;
import com.nis.domain.dashboard.codedic.CodeProtocolTypeDic; import com.nis.domain.dashboard.codedic.CodeProtocolTypeDic;
import com.nis.domain.dashboard.codedic.CodeServiceTypeDic; import com.nis.domain.dashboard.codedic.CodeServiceTypeDic;
@@ -14,6 +15,7 @@ import com.nis.domain.dashboard.codedic.CodeWebServiceDic;
import com.nis.web.dao.dashboard.codedic.CodeAppDicDao; import com.nis.web.dao.dashboard.codedic.CodeAppDicDao;
import com.nis.web.dao.dashboard.codedic.CodeBehaviorTypeDicDao; import com.nis.web.dao.dashboard.codedic.CodeBehaviorTypeDicDao;
import com.nis.web.dao.dashboard.codedic.CodeBrowserTypeDicDao; import com.nis.web.dao.dashboard.codedic.CodeBrowserTypeDicDao;
import com.nis.web.dao.dashboard.codedic.CodeDomainDicDao;
import com.nis.web.dao.dashboard.codedic.CodeOsTypeDicDao; import com.nis.web.dao.dashboard.codedic.CodeOsTypeDicDao;
import com.nis.web.dao.dashboard.codedic.CodeProtocolTypeDicDao; import com.nis.web.dao.dashboard.codedic.CodeProtocolTypeDicDao;
import com.nis.web.dao.dashboard.codedic.CodeResult; import com.nis.web.dao.dashboard.codedic.CodeResult;
@@ -31,6 +33,7 @@ public class CodeDicUtils {
private final static CodeServiceTypeDicDao codeServiceTypeDicDao = SpringContextHolder.getBean(CodeServiceTypeDicDao.class); private final static CodeServiceTypeDicDao codeServiceTypeDicDao = SpringContextHolder.getBean(CodeServiceTypeDicDao.class);
private final static CodeWebServiceDicDao codeWebServiceDicDao = SpringContextHolder.getBean(CodeWebServiceDicDao.class); private final static CodeWebServiceDicDao codeWebServiceDicDao = SpringContextHolder.getBean(CodeWebServiceDicDao.class);
private final static CodeSysIspInfoDicDao codeSysIspInfoDicDao = SpringContextHolder.getBean(CodeSysIspInfoDicDao.class); private final static CodeSysIspInfoDicDao codeSysIspInfoDicDao = SpringContextHolder.getBean(CodeSysIspInfoDicDao.class);
private final static CodeDomainDicDao codeDomainDicDao = SpringContextHolder.getBean(CodeDomainDicDao.class);
private static final String APP_CODE="appCode"; private static final String APP_CODE="appCode";
@@ -42,6 +45,7 @@ public class CodeDicUtils {
private static final String WEB_CODE="webCode"; private static final String WEB_CODE="webCode";
private static final String ISP_CODE="ispCode"; private static final String ISP_CODE="ispCode";
private static final String DOMAIN_CODE="domainCode";
/** /**
* 适用于大屏图表标签显示 * 适用于大屏图表标签显示
*/ */
@@ -178,6 +182,23 @@ public class CodeDicUtils {
} }
} }
return result; return result;
}else if (name.equals(DOMAIN_CODE)) {
// List<CodeWebServiceDic> codeDicList = (List<CodeWebServiceDic>) CacheUtils.get(WEB_CODE);
// if(StringUtil.isEmpty(codeDicList)){
// codeDicList = codeWebServiceDicDao.getCodeDicList();
// CacheUtils.put(WEB_CODE, codeDicList);
// }
List<CodeDomainDic> codeDicList = codeDomainDicDao.getCodeDicList();
if(codeDicList!=null&&codeDicList.size()>0){
for (int i = 0; i < codeDicList.size(); i++) {
CodeResult codeResult = new CodeResult();
codeResult.setItem(codeDicList.get(i).getDomain());
codeResult.setCode(String.valueOf(codeDicList.get(i).getId()));
result.add(codeResult);
}
}
return result;
} }
return result; return result;
} }

View File

@@ -1,11 +1,17 @@
package com.nis.util; package com.nis.util;
import java.util.ArrayList; import java.lang.reflect.Field;
import java.util.Date; import java.lang.reflect.Type;
import java.util.HashMap; import java.text.SimpleDateFormat;
import java.util.List; import java.util.*;
import java.util.Map;
import com.google.gson.*;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.configuration.*;
import com.nis.web.service.BaseService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringEscapeUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -15,13 +21,6 @@ import com.google.common.collect.Lists;
import com.googlecode.ipv6.IPv6Address; import com.googlecode.ipv6.IPv6Address;
import com.googlecode.ipv6.IPv6Network; import com.googlecode.ipv6.IPv6Network;
import com.nis.domain.basics.AsnIpCfg; import com.nis.domain.basics.AsnIpCfg;
import com.nis.domain.configuration.AppIpCfg;
import com.nis.domain.configuration.BaseCfg;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.domain.configuration.FileDigestCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.maat.MaatCfg.DigestCfg; import com.nis.domain.maat.MaatCfg.DigestCfg;
import com.nis.domain.maat.MaatCfg.GroupCfg; import com.nis.domain.maat.MaatCfg.GroupCfg;
import com.nis.domain.maat.MaatCfg.IpCfg; import com.nis.domain.maat.MaatCfg.IpCfg;
@@ -233,7 +232,6 @@ public class ConfigConvertUtil {
* @param dstList * @param dstList
* @param srcList * @param srcList
* @param cfgType1为IP类型2为字符串类型3为增强字符串4数值类型5摘要类,6回调类[但字符串类域配置和增强字符串域配置在接口参数中同属于strRegionList] * @param cfgType1为IP类型2为字符串类型3为增强字符串4数值类型5摘要类,6回调类[但字符串类域配置和增强字符串域配置在接口参数中同属于strRegionList]
* @param baseCfg配置基本信息
* @param groupRelationList * @param groupRelationList
* 配置分组列表 * 配置分组列表
* @return * @return
@@ -577,4 +575,411 @@ public class ConfigConvertUtil {
dstIp.setDstPortMask("65535"); dstIp.setDstPortMask("65535");
} }
} }
/**
*Obj 组maat配置转换
* @param <T>
* @param <T>
* @param dstList
* @param srcList
* @param cfgType1为IP类型2为字符串类型3为增强字符串4数值类型5摘要类,6回调类[但字符串类域配置和增强字符串域配置在接口参数中同属于strRegionList]
* @param baseCfg配置基本信息
* @param groupRelationList
* 配置分组列表
* @return
*/
public static <T> Map<String, List> objGroupCfgConvert(Map<Integer,FunctionServiceDict> dictMap,List dstList, List<T> srcList, Integer cfgType, BaseCfg baseCfg,
List groupRelationList, Map<String,Object> maatTableMap, Set<Integer> groupIdSet) {
long start=System.currentTimeMillis(),end=0l;
Map<String, List> map = new HashMap();
if (cfgType == 1) {
List numRegionList = new ArrayList();
int pos=0;
Set<Integer> numGroupVals = new HashSet<>();
List<Integer> regionIdList = calRangeIps(srcList);//ConfigServiceUtil.getId(3, srcList.size());
for (int i = 0; i < srcList.size(); i++) {
T srcCfg = srcList.get(i);
BaseIpCfg baseIpCfg = new BaseIpCfg();
BeanUtils.copyProperties(srcCfg, baseIpCfg);
IpCfg cfg = new IpCfg();
BeanUtils.copyProperties(baseIpCfg, cfg);
// 区域IP配置多条IP配置属于同一个分组其他业务配置IP一条配置一个分组
// if(groupId==0 || !cfg.getCfgType().equals(Constants.AREA_REGION)){
if (!groupIdSet.contains(baseIpCfg.getGroupId())) {
GroupCfg group = new GroupCfg();
//groupId = ConfigServiceUtil.getId(2, 1).get(0);
group.setGroupId(baseIpCfg.getGroupId());
group.setCompileId(baseCfg.getCompileId());
group.setAuditTime(baseCfg.getAuditTime());
group.setIsValid(baseCfg.getIsValid());
groupRelationList.add(group);
groupIdSet.add(baseIpCfg.getGroupId());
}
cfg.setGroupId(baseIpCfg.getGroupId());
cfg.setAuditTime(baseCfg.getAuditTime());
cfg.setIsValid(baseCfg.getIsValid());
if(maatTableMap.containsKey("ipMaatTable")){
Map<String,String> ipMaatTable=(Map<String,String>)maatTableMap.get("ipMaatTable");
cfg.setCfgType(ipMaatTable.get(baseIpCfg.getGroupId().toString()));
}
List<IpCfg> cfgs = ipConvert(cfg, baseIpCfg);
if (cfgs.size() > 1) {
List<Integer> ids =regionIdList.subList(pos,pos+cfgs.size());
//支持range????
for (int j = 1; j < cfgs.size(); j++) {
cfgs.get(j).setRegionId(ids.get(j-1));
}
pos+=cfgs.size();
}
dstList.addAll(cfgs);
// 如果protocolId非空非零需要构造数值型域配置多条相同协议的IP只需要一条数值域配置目前没有不同协议IP&情况)
//分组复用每个IP组还需要不同的数值域组么 answer:一个就行了
if (baseCfg!=null&&baseCfg.getServiceId()!=null&&baseCfg.getServiceId()>0&&dictMap.containsKey(baseCfg.getServiceId())) {
FunctionServiceDict dict=dictMap.get(baseCfg.getServiceId());
Integer protocolId=dict.getProtocolId();
if (protocolId>0&&!numGroupVals.contains(protocolId)) {
GroupCfg group1 = new GroupCfg();
group1.setGroupId(ConfigServiceUtil.getId(2, 1).get(0));
group1.setCompileId(baseCfg.getCompileId());
group1.setAuditTime(baseCfg.getAuditTime());
group1.setIsValid(baseCfg.getIsValid());
groupRelationList.add(group1);
NumBoundaryCfg numCfg = new NumBoundaryCfg();
numCfg.initDefaultValue();
numCfg.setLowBoundary(protocolId);
numCfg.setUpBoundary(protocolId);
numCfg.setRegionId(ConfigServiceUtil.getId(3, 1).get(0));
numCfg.setAuditTime(baseCfg.getAuditTime());
numCfg.setGroupId(group1.getGroupId());
numCfg.setIsValid(baseCfg.getIsValid());
if(maatTableMap.containsKey("protocolMaatTable")){
numCfg.setCfgType(maatTableMap.get("protocolMaatTable").toString());
}
numRegionList.add(numCfg);
map.put("numRegionList", numRegionList);
numGroupVals.add(protocolId);
}
}
}
regionIdList.clear();
} else if (cfgType == 2 || cfgType == 3) {
//List<Integer> groupIdList = ConfigServiceUtil.getId(2, srcList.size());
//List<Integer> regionIdList = ConfigServiceUtil.getId(3, srcList.size());
for (int i = 0; i < srcList.size(); i++) {
BaseStringCfg baserStringCfg=new BaseStringCfg();
BeanUtils.copyProperties(srcList.get(i),baserStringCfg);
if(!groupIdSet.contains(baserStringCfg.getGroupId())){
GroupCfg group = new GroupCfg();
group.setGroupId(baserStringCfg.getGroupId());
group.setCompileId(baseCfg.getCompileId());
group.setAuditTime(baseCfg.getAuditTime());
group.setIsValid(baseCfg.getIsValid());
groupRelationList.add(group);
groupIdSet.add(baserStringCfg.getGroupId());
}
StringCfg cfg = new StringCfg();
BeanUtils.copyProperties(srcList.get(i), cfg);
cfg.setGroupId(baserStringCfg.getGroupId());
cfg.setRegionId(baserStringCfg.getRegionId());
cfg.setAuditTime(baseCfg.getAuditTime());
cfg.setIsValid(baseCfg.getIsValid());
// 处理配置关键字转译
cfg.setCfgKeywords(keywordsEscape(cfg.getCfgKeywords()));
// 增强字符串转换
cfg.setDistrict(keywordsEscape(cfg.getDistrict()));
if(maatTableMap.containsKey("stringMaatTable")){
Map<String,String> stringMaatTable=(Map<String,String>)maatTableMap.get("stringMaatTable");
cfg.setCfgType(stringMaatTable.get(baserStringCfg.getGroupId().toString()));
}
dstList.add(cfg);
}
} else if (cfgType == 4) {
// List<Integer> groupIdList = ConfigServiceUtil.getId(2, srcList.size());
// List<Integer> regionIdList = ConfigServiceUtil.getId(3, srcList.size());
for (int i = 0; i < srcList.size(); i++) {
// 一条业务配置创建一个分组
NumBoundaryCfg cfg = new NumBoundaryCfg();
BeanUtils.copyProperties(srcList.get(i), cfg);
if(!groupIdSet.contains(cfg.getGroupId())){
GroupCfg group = new GroupCfg();
group.setGroupId(cfg.getGroupId());
group.setCompileId(baseCfg.getCompileId());
group.setAuditTime(baseCfg.getAuditTime());
group.setIsValid(baseCfg.getIsValid());
groupRelationList.add(group);
groupIdSet.add(cfg.getGroupId());
}
cfg.setGroupId(cfg.getGroupId());
cfg.setRegionId(cfg.getRegionId());
cfg.setAuditTime(baseCfg.getAuditTime());
cfg.setIsValid(baseCfg.getIsValid());
dstList.add(cfg);
}
} else if (cfgType == 5) {
//List<Integer> groupIdList = ConfigServiceUtil.getId(2, srcList.size());
//List<Integer> regionIdList = ConfigServiceUtil.getId(3, srcList.size());
for (int i = 0; i < srcList.size(); i++) {
// 一条业务配置创建一个分组
com.nis.domain.maat.MaatCfg.DigestCfg cfg = new com.nis.domain.maat.MaatCfg.DigestCfg();
BeanUtils.copyProperties(srcList.get(i), cfg);
if(!groupIdSet.contains(cfg.getGroupId())){
GroupCfg group = new GroupCfg();
group.setGroupId(cfg.getGroupId());
group.setCompileId(baseCfg.getCompileId());
group.setAuditTime(baseCfg.getAuditTime());
group.setIsValid(baseCfg.getIsValid());
groupRelationList.add(group);
groupIdSet.add(cfg.getGroupId());
}
cfg.setGroupId(cfg.getGroupId());
cfg.setRegionId(cfg.getRegionId());
cfg.setAuditTime(baseCfg.getAuditTime());
cfg.setIsValid(baseCfg.getIsValid());
dstList.add(cfg);
}
} else {
dstList.addAll(srcList);
}
map.put("groupList", groupRelationList);
map.put("dstList", dstList);
end=System.currentTimeMillis();
logger.info("objGroupCfgConvert cost:"+(end-start));
return map;
}
/**
* 转换成字符串
*
* @param obj
* @return
*/
public static <T> String gsonToJson(T obj) {
Gson gson = new GsonBuilder().disableHtmlEscaping().excludeFieldsWithoutExposeAnnotation()
.registerTypeAdapter(Date.class, new JsonSerializer<Date>() {
@Override
public JsonElement serialize(Date src, Type type, JsonSerializationContext context) {
String format = "yyyy-MM-dd HH:mm:ss";
long time = ((Date) src).getTime();
SimpleDateFormat sdf = new SimpleDateFormat(format);
return new JsonPrimitive(sdf.format(time));
}
}).create();
return gson.toJson(obj);
}
/**
* 字符串转成对象
*
* @param jsonString
* @param cls
* @return
*/
public static <T> T gsonFromJson(String jsonString, Class<T> cls) {
Gson gson = new GsonBuilder().registerTypeAdapter(new TypeToken<Map>() {
}.getType(), new BaseService.MapTypeAdapter()).registerTypeAdapter(new TypeToken<List>() {
}.getType(), new BaseService.MapTypeAdapter()).create();
return gson.fromJson(jsonString, cls);
}
/**
* 公共分组生成默认自定义域
* @param userRegionMap
* @param serviceId
* @return
*/
public static String generateCommonGroupDefaultUserRegion(Map<String,Object> userRegionMap,Integer serviceId){
if(userRegionMap==null){
userRegionMap=new HashMap<>();
}
if(serviceId.equals(576)){
userRegionMap.put("method","block");
userRegionMap.put("code",404);
userRegionMap.put("message","");
userRegionMap.put("html_profile",0);
return gsonToJson(userRegionMap);
}else if(serviceId.equals(512)){
if(userRegionMap.isEmpty()){
//keyring
userRegionMap.put("keyring", 1);
Map<String,Object> map = new HashMap();
//exclusions
map.put("ev_cert", 0);
map.put("cert_transparency", 0);
map.put("pinning", 1);
map.put("client_cert_req", 1);
map.put("protocol_errors", 1);
userRegionMap.put("exclusions", map);
//cert_verify
Map<String,Object> map1=new HashMap<>();
map=new HashMap<>();
map.put("cn",1);
map.put("issuer",1);
map.put("self-signed",1);
map.put("expiration",1);
map1.put("approach", map);
userRegionMap.put("cert_verify", map1);
//ssl_ver
map=new HashMap<>();
map.put("mirror_client", 1);
map.put("allow_http2", 1);
// map.put("min", "ssl3");
// map.put("max", "tls13");
userRegionMap.put("ssl_ver", map);
//decrypt_mirror
map=new HashMap<>();
map.put("enable", 0);
userRegionMap.put("decrypt_mirror", map);
}
return gsonToJson(userRegionMap);
}else if(serviceId.equals(592)){
return "{}";
}else{
return "0";
}
}
public static Map<String,Object> convertCommonGroupMaatTable(CfgIndexInfo cfgIndexInfo, List<Map<String, Object>> cfgList){
Map<String,Object> maatTableMap=new HashMap<>();
Map<String,Object> commonGroupIds= MapUtils.isEmpty(cfgIndexInfo.getUserRegion())?(Map<String,Object>)gsonFromJson(cfgIndexInfo.getCommonGroupIds(),Map.class):cfgIndexInfo.getUserRegion();
for (Map<String, Object> map : cfgList) {
String cfgType = map.get("cfgType").toString();
if (cfgType.equals("1")) {
if(commonGroupIds.containsKey("ipGroup")&&map.containsKey("maatTable")){
Map<String,String> ipMaatMap=new HashMap<>();
for(String group:commonGroupIds.get("ipGroup").toString().split(",")){
if(StringUtils.isNotBlank(group)){
ipMaatMap.put(group,map.get("maatTable").toString());
}
}
maatTableMap.put("ipMaatTable",ipMaatMap);
}
if(map.containsKey("protocolMaatTable")){
maatTableMap.put("protocolMaatTable",map.get("protocolMaatTable").toString());
}
} else if (cfgType.equals("2")) {
String _maatTable = map.containsKey("maatTable")?map.get("maatTable").toString():null;
Map<String,String> stringMaatMap=new HashMap<>();
if(StringUtils.isNotBlank(_maatTable)){
if(commonGroupIds.containsKey("urlGroup")&&_maatTable.toUpperCase().contains("URL")){
for(String group:commonGroupIds.get("urlGroup").toString().split(",")){
if(StringUtils.isNotBlank(group)){
stringMaatMap.put(group,_maatTable);
}
}
}
if(commonGroupIds.containsKey("domainGroup")&&_maatTable.toUpperCase().contains("DOMAIN")){
for(String group:commonGroupIds.get("domainGroup").toString().split(",")){
if(StringUtils.isNotBlank(group)){
stringMaatMap.put(group,_maatTable);
}
}
}
if(commonGroupIds.containsKey("subscribeIdGroup")&&_maatTable.toUpperCase().contains("SUBSCRIBE_ID")){
for(String group:commonGroupIds.get("subscribeIdGroup").toString().split(",")){
if(StringUtils.isNotBlank(group)){
stringMaatMap.put(group,_maatTable);
}
}
}
}
if(maatTableMap.containsKey("stringMaatTable")){
((Map<String,String>)maatTableMap.get("stringMaatTable")).putAll(stringMaatMap);
}else{
maatTableMap.put("stringMaatTable",stringMaatMap);
}
}
}
return maatTableMap;
}
/**
* 获取obj-list-group业务的function_service_dict
* @param functionId
* @return
*/
public static Map<Integer,FunctionServiceDict> objGetServiceDict(Integer functionId){
Map<Integer,FunctionServiceDict> dictMap=new HashMap<>();
ServiceConfigTemplateUtil util=new ServiceConfigTemplateUtil();
List<Map<String,Object>> list=util.getServiceListByFunctionId(functionId);
for(Map<String,Object> map:list){
if(map.containsKey("serviceIds")){
String serviceIds=map.get("serviceIds").toString();
for(String serviceId:serviceIds.split(",")){
List<Map<String,Object>> _mapList=util.getServiceListByServiceId(Integer.parseInt(serviceId));
for(Map<String,Object> _map:_mapList){
if(_map.containsKey("functionId")){
List<FunctionServiceDict> dictList=DictUtils.getFunctionServiceDictList(Integer.parseInt(_map.get("functionId").toString()));
for(FunctionServiceDict dict:dictList){
dictMap.put(dict.getServiceId(),dict);
}
}
}
}
}else{
if(map.containsKey("functionId")){
List<FunctionServiceDict> dictList=DictUtils.getFunctionServiceDictList(Integer.parseInt(map.get("functionId").toString()));
for(FunctionServiceDict dict:dictList){
dictMap.put(dict.getServiceId(),dict);
}
}
}
}
return dictMap;
}
public static <T>List<Integer> calRangeIps(List<T> srcList ){
List<Integer> regionIdsList=new ArrayList<>();
int total=0;
//通过反射获取IP的src ip地址目的IP地址
Class clazz=null;
Field srcIpAddressField=null,destIpAddressField=null,ipTypeFild=null;
for(T instance:srcList){
if(clazz==null&&srcIpAddressField==null&&destIpAddressField==null){
try {
clazz=instance.getClass();
srcIpAddressField=clazz.getDeclaredField("srcIpAddress");
srcIpAddressField.setAccessible(true);
destIpAddressField=clazz.getDeclaredField("destIpAddress");
destIpAddressField.setAccessible(true);
ipTypeFild=clazz.getDeclaredField("ipType");
ipTypeFild.setAccessible(true);
} catch (NoSuchFieldException e) {
return regionIdsList;
}
}
try {
String srcIpAddressValue=(String)srcIpAddressField.get(instance);
String destIpAddressValue=(String)destIpAddressField.get(instance);
Integer ipType=(Integer)ipTypeFild.get(instance);
if(ipType.equals(4)){
long left=1,right=1;
if(srcIpAddressValue.indexOf("-")>-1){
String[] srcIpAddressValueArray=srcIpAddressValue.split("-");
int startPos=0,endPos=0;
startPos=Integer.parseInt(srcIpAddressValueArray[0].split("\\.")[3]);
endPos=Integer.parseInt(srcIpAddressValueArray[1].split("\\.")[3]);
left=endPos-startPos+1;
}
if(destIpAddressValue.indexOf("-")>-1){
String[] destIpAddressValueArray=destIpAddressValue.split("-");
int startPos=0,endPos=0;
startPos=Integer.parseInt(destIpAddressValueArray[0].split("\\.")[3]);
endPos=Integer.parseInt(destIpAddressValueArray[1].split("\\.")[3]);
right=endPos-startPos+1;
}
total+=left*right;
}else{
continue;
}
} catch (IllegalAccessException e) {
e.printStackTrace();
return regionIdsList;
}
}
if(total>0){
regionIdsList=ConfigServiceUtil.getId(3,total);
}
return regionIdsList;
}
} }

View File

@@ -968,6 +968,7 @@ public class ConfigServiceUtil {
return result; return result;
} }
public static void main(String[] args) { public static void main(String[] args) {
try { try {
// getId(1,1); // getId(1,1);

View File

@@ -8,6 +8,17 @@ import java.util.regex.Pattern;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
public final class Constants { public final class Constants {
/**
* json打印长度
*/
public static Integer JSON_PRINT_LENTH=Configurations.getIntProperty("json_print_length", 100000);
/**
* obj group list group type
*/
public static Integer IP_OBJ_GROUP_TYPE=Configurations.getIntProperty("ip_obj_group_type", 5);
public static Integer URL_OBJ_GROUP_TYPE=Configurations.getIntProperty("url_obj_group_type", 7);
public static Integer SUBID_OBJ_GROUP_TYPE=Configurations.getIntProperty("subid_obj_group_type", 9);
public static Integer DOMAIN_OBJ_GROUP_TYPE=Configurations.getIntProperty("domain_obj_group_type", 8);
/** /**
* 导入条数限制 * 导入条数限制
*/ */
@@ -185,6 +196,22 @@ public final class Constants {
* DNS 策略组KEY * DNS 策略组KEY
*/ */
public static final String CACHE_DNSGROUP_DICT = "dnsGroupDict"; public static final String CACHE_DNSGROUP_DICT = "dnsGroupDict";
/**
* IP公共组缓存KEY
*/
public static final String CACHE_IPGROUP_DICT = "ipComGroupDict";
/**
* URL公共组缓存KEY
*/
public static final String CACHE_URLGROUP_DICT = "urlComGroupDict";
/**
* Domain公共组缓存KEY
*/
public static final String CACHE_DOMAINGROUP_DICT = "domainComGroupDict";
/**
* ScriberId公共组缓存KEY
*/
public static final String CACHE_SCRIBERGROUP_DICT = "scriberComGroupDict";
/** /**
* 词典数据分类 * 词典数据分类
*/ */
@@ -697,8 +724,14 @@ public final class Constants {
public static final String CERT_FILE_PATH=Configurations.getStringProperty("cert_file_path", ""); public static final String CERT_FILE_PATH=Configurations.getStringProperty("cert_file_path", "");
//证书校验文件 //证书校验文件
public static final String CERT_VALIDATE_FILE=Configurations.getStringProperty("cert_validate_file", "x509"); public static final String CERT_VALIDATE_FILE=Configurations.getStringProperty("cert_validate_file", "x509");
public static final String CA_CERT_FILE=Configurations.getStringProperty("ca_cert_file", "cacert.sh");
public static final String CA_CERT_DIR=Configurations.getStringProperty("ca_cert_dir", "/home/cacert/");
//证书校验成功关键字 //证书校验成功关键字
public static final String CERT_VALIDATE_SUCCESS_INFO=Configurations.getStringProperty("cert_validate_success_info", "x509"); public static final String CERT_VALIDATE_SUCCESS_INFO=Configurations.getStringProperty("cert_validate_success_info", "x509");
//内置证书的isser
public static final String KEYRING_BUILT_IN_ISSER=Configurations.getStringProperty("keyring_built_in_isser", "||CN=Tango Secure Gateway CA, O=Maserati Solution||CN=Tango Secure Gateway CA UNTRUST, O=Maserati Solution||");
//内置证书的指纹
public static final String KEYRING_BUILT_IN_FINGERPRINT=Configurations.getStringProperty("keyring_built_in_fingerprint", "||ee23abb40085901c12f574d610153c008d49e6a0||3475833f1a9525b4ad7fbee06dfa3e4a8de0c1e0||");
/** /**
* 一些正则的pattern预先编译,避免多次编译 * 一些正则的pattern预先编译,避免多次编译
*/ */
@@ -795,4 +828,46 @@ public final class Constants {
* 管理员用户预警查询服务配置总量接口 * 管理员用户预警查询服务配置总量接口
*/ */
public static final String CONFIG_BY_SERVICE = Configurations.getStringProperty("getConfigByService",""); public static final String CONFIG_BY_SERVICE = Configurations.getStringProperty("getConfigByService","");
/**
* 获取配置统计页面列表的配置总量接口
*/
public static final String NTC_PZ_COUNT_REPORT = Configurations.getStringProperty("ntcPzCountReport","");
/**
* 查询的是流量统计菜单-配置统计中BandWidth统计的数据接口
*/
public static final String TRAFFIC_BANDWIDTH_TRANS_THREE_NEW=Configurations.getStringProperty("trafficBandwidthTransThreeNew","trafficBandwidthTransThreeNew");
/**
* 查询的是流量统计菜单-配置统计中RulesType统计的数据接口
*/
public static final String NTC_ACTION_ENTRANCE_REPORT_NEW=Configurations.getStringProperty("ntcActionEntranceReportNew","ntcActionEntranceReportNew");
/**
* 查询的是流量统计菜单-配置统计中Protocol统计的数据接口
*/
public static final String TRAFFIC_PROTOCOL_STATISTIC_NEW=Configurations.getStringProperty("trafficProtocolStatisticNew","trafficProtocolStatisticNew");
/**
* 查询的是流量统计菜单-配置统计中APP统计的数据接口
*/
public static final String TRAFFIC_APP_STATISTIC_NEW=Configurations.getStringProperty("trafficAppStatisticNew","trafficAppStatisticNew");
/**
* 查询的是流量统计菜单-配置统计中Domains统计的数据接口
*/
public static final String TRAFFIC_DOMAIN_STATISTIC_NEW=Configurations.getStringProperty("trafficDomainStatisticNew","trafficDomainStatisticNew");
/**
* 查询的是流量统计菜单-配置统计中ClientIP统计的数据接口
*/
public static final String TRAFFIC_SOURCE_IP_STATISTIC_NEW=Configurations.getStringProperty("trafficSourceIPStatisticNew","trafficSourceIPStatisticNew");
/**
* 查询的是流量统计菜单-配置统计中ServerIP统计的数据接口
*/
public static final String TRAFFIC_DEST_IP_STATISTIC_NEW=Configurations.getStringProperty("trafficDestIPStatisticNew","trafficDestIPStatisticNew");
/**
* 查询的是流量统计菜单-配置统计中SubscriberID统计的数据接口
*/
public static final String TRAFFIC_SUBSCRIBER_ID_STATISTIC_NEW=Configurations.getStringProperty("trafficSubscriberIDStatisticNew","trafficSubscriberIDStatisticNew");
/**
* HTTP(S)操控日志接口
*/
public static final String POLICY_EVENT=Configurations.getStringProperty("policyevent","policyevent");
} }

View File

@@ -14,12 +14,14 @@ import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict; import com.nis.domain.FunctionServiceDict;
import com.nis.domain.SysDataDictionaryItem; import com.nis.domain.SysDataDictionaryItem;
import com.nis.domain.SysDataDictionaryName; import com.nis.domain.SysDataDictionaryName;
import com.nis.domain.basics.CommonGroupInfo;
import com.nis.domain.basics.PolicyGroupInfo; import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.domain.basics.SysDictInfo; import com.nis.domain.basics.SysDictInfo;
import com.nis.domain.configuration.DnsResStrategy; import com.nis.domain.configuration.DnsResStrategy;
import com.nis.web.dao.FunctionRegionDictDao; import com.nis.web.dao.FunctionRegionDictDao;
import com.nis.web.dao.FunctionServiceDictDao; import com.nis.web.dao.FunctionServiceDictDao;
import com.nis.web.dao.SysDictDao; import com.nis.web.dao.SysDictDao;
import com.nis.web.dao.basics.CommonGroupManageDao;
import com.nis.web.dao.basics.PolicyGroupInfoDao; import com.nis.web.dao.basics.PolicyGroupInfoDao;
import com.nis.web.dao.basics.SysDictInfoDao; import com.nis.web.dao.basics.SysDictInfoDao;
import com.nis.web.dao.configuration.DnsResStrategyDao; import com.nis.web.dao.configuration.DnsResStrategyDao;
@@ -42,6 +44,7 @@ public class DictUtils {
private final static FunctionServiceDictDao functionServiceDictDao = SpringContextHolder.getBean(FunctionServiceDictDao.class); private final static FunctionServiceDictDao functionServiceDictDao = SpringContextHolder.getBean(FunctionServiceDictDao.class);
private final static DnsResStrategyDao dnsResStrategyDao = SpringContextHolder.getBean(DnsResStrategyDao.class); private final static DnsResStrategyDao dnsResStrategyDao = SpringContextHolder.getBean(DnsResStrategyDao.class);
private final static PolicyGroupInfoDao policyGroupInfoDao = SpringContextHolder.getBean(PolicyGroupInfoDao.class); private final static PolicyGroupInfoDao policyGroupInfoDao = SpringContextHolder.getBean(PolicyGroupInfoDao.class);
private final static CommonGroupManageDao commonGroupManageDao = SpringContextHolder.getBean(CommonGroupManageDao.class);
public static Map<String, List<SysDataDictionaryItem>> getDictData() { public static Map<String, List<SysDataDictionaryItem>> getDictData() {
@@ -401,4 +404,38 @@ public class DictUtils {
} }
return null; return null;
} }
/**
* 获取公共组字典缓存
*/
/*public static List<CommonGroupInfo> getCommonGroups(Integer groupType){
String dictKey = Constants.CACHE_IPGROUP_DICT;
if(groupType.equals(7)) {
dictKey = Constants.CACHE_URLGROUP_DICT;
}else if(groupType.equals(8)) {
dictKey = Constants.CACHE_DOMAINGROUP_DICT;
}else if(groupType.equals(9)) {
dictKey = Constants.CACHE_SCRIBERGROUP_DICT;
}
List<CommonGroupInfo> allDictList = (List<CommonGroupInfo>)CacheUtils.get(dictKey);
if(StringUtil.isEmpty(allDictList)){
allDictList = commonGroupManageDao.findCommonGroupInfosByType(groupType);
CacheUtils.put(dictKey, allDictList);
}
return allDictList;
}
public static CommonGroupInfo getCommonGroups(Integer groupId, Integer groupType){
List<CommonGroupInfo> allDictList = getCommonGroups(groupType);
if(StringUtil.isEmpty(allDictList)){
}else {
for(CommonGroupInfo group:allDictList) {
if(group.getServiceGroupId().equals(groupId)) {
return group;
}
}
}
return null;
}*/
} }

View File

@@ -1,13 +1,17 @@
package com.nis.util; package com.nis.util;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList; import java.lang.reflect.Type;
import java.util.Arrays; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.gson.*;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.basics.*;
import com.nis.domain.configuration.*;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.config.IniSecurityManagerFactory; import org.apache.shiro.config.IniSecurityManagerFactory;
@@ -19,26 +23,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import com.google.common.collect.Lists; 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.callback.InlineIp;
import com.nis.domain.configuration.AppPolicyCfg;
import com.nis.domain.configuration.AvFileSampleCfg;
import com.nis.domain.configuration.AvSignSampleCfg;
import com.nis.domain.configuration.BaseCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.domain.configuration.DdosIpCfg;
import com.nis.domain.configuration.DnsIpCfg;
import com.nis.domain.configuration.DnsResStrategy;
import com.nis.domain.configuration.FileDigestCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.PxyObjKeyring;
import com.nis.domain.configuration.PxyObjSpoofingIpPool;
import com.nis.domain.configuration.PxyObjTrustedCaCert;
import com.nis.domain.configuration.PxyObjTrustedCaCrl;
import com.nis.domain.maat.MaatCfg; import com.nis.domain.maat.MaatCfg;
import com.nis.domain.maat.ManipulatActionParam;
import com.nis.domain.maat.ToMaatBean; import com.nis.domain.maat.ToMaatBean;
import com.nis.domain.maat.ToMaatResult; import com.nis.domain.maat.ToMaatResult;
import com.nis.domain.maat.ToUpdateMaatBeanStatus; import com.nis.domain.maat.ToUpdateMaatBeanStatus;
@@ -91,6 +78,7 @@ public class SchedulerTaskUtil {
String tableName = service.get("tableName").toString(); String tableName = service.get("tableName").toString();
String serviceType = service.get("serviceType").toString(); String serviceType = service.get("serviceType").toString();
String className = service.get("className").toString(); String className = service.get("className").toString();
String functionId= service.get("functionId").toString();
BaseCfg entity = new BaseCfg(); BaseCfg entity = new BaseCfg();
entity.setServiceId(serviceId); entity.setServiceId(serviceId);
entity.setTableName(tableName); entity.setTableName(tableName);
@@ -120,6 +108,14 @@ public class SchedulerTaskUtil {
List<BaseStringCfg> strList = new ArrayList(); List<BaseStringCfg> strList = new ArrayList();
List<ComplexkeywordCfg> complexStrList = new ArrayList(); List<ComplexkeywordCfg> complexStrList = new ArrayList();
List<com.nis.domain.configuration.NumBoundaryCfg> numList = new ArrayList(); List<com.nis.domain.configuration.NumBoundaryCfg> numList = new ArrayList();
//公共分组
boolean isCommonGroup=false;
List<IpCommCfg> ipCommCfgList=new ArrayList<>();
List<UrlCommCfg> urlCommCfgList=new ArrayList<>();
List<ScriberIdCommCfg> scriberIdCommCfgList=new ArrayList<>();
List<DomainCommCfg> domainCommCfgList=new ArrayList<>();
Map<String,Object> commGroupMap=new HashMap<>();
Set<Integer> groupIdSet=new HashSet<>();
List<FileDigestCfg> fileList = new ArrayList(); List<FileDigestCfg> fileList = new ArrayList();
maatBean = new ToMaatBean(); maatBean = new ToMaatBean();
configCompileList = new ArrayList(); configCompileList = new ArrayList();
@@ -131,39 +127,71 @@ public class SchedulerTaskUtil {
List<Map<String,Object>> userRegionList = (List<Map<String, Object>>) service.get("userRegionList"); List<Map<String,Object>> userRegionList = (List<Map<String, Object>>) service.get("userRegionList");
entity.setCompileId(compileId); entity.setCompileId(compileId);
compileIds.add(compileId); compileIds.add(compileId);
Map<Integer, FunctionServiceDict> serviceDictMap=ConfigConvertUtil.objGetServiceDict(Integer.parseInt(functionId));
//查询配置 //查询配置
if("cfg_index_info".equals(tableName)){ if("cfg_index_info".equals(tableName)){
List<CfgIndexInfo> list = configSynchronizationDao.getCfgIndexList(entity); List<CfgIndexInfo> list = configSynchronizationDao.getCfgIndexList(entity);
if(CollectionUtils.isNotEmpty(list)&&StringUtils.isNotBlank(list.get(0).getCommonGroupIds())){
isCommonGroup=true;
}
if(isIssueContent.equals(1)){ if(isIssueContent.equals(1)){
//用于存储自定义域为关键字的业务key=compileIdvalue=keyword. //用于存储自定义域为关键字的业务key=compileIdvalue=keyword.
Map<Integer, BaseStringCfg> keywordMap=new HashMap<>(); Map<Integer, BaseStringCfg> keywordMap=new HashMap<>();
//查询子域配置详情 //查询子域配置详情
if(cfgList!=null){ if(cfgList!=null){
for(Map<String,Object> m:cfgList){ if(isCommonGroup){
String regionTable = m.get("tableName").toString(); groupIdSet=new HashSet<>();
if("1".equals(m.get("cfgType"))){ commGroupMap=ConfigConvertUtil.gsonFromJson(list.get(0).getCommonGroupIds(),Map.class);
ipList.addAll(configSynchronizationDao.getIpPortList(regionTable, compileIds)); //将组中的域设置到cfg_index_info中
}else if("2".equals(m.get("cfgType"))){ covertCommongroupIdsMap(commGroupMap,"ipGroup",list.get(0),configSynchronizationDao,IpCommCfg.class);
strList.addAll(configSynchronizationDao.getStrList(regionTable,compileIds)); if(CollectionUtils.isNotEmpty(list.get(0).getIpCommGroupCfgList())){
//512/521/514/1026业务的用户自定义域取DOMAIN_STR取自Keyword ipCommCfgList.addAll(list.get(0).getIpCommGroupCfgList());
if(entity.getServiceId()==512 }
||entity.getServiceId()==521 covertCommongroupIdsMap(commGroupMap,"urlGroup",list.get(0),configSynchronizationDao,UrlCommCfg.class);
||entity.getServiceId()==514 if(CollectionUtils.isNotEmpty(list.get(0).getUrlCommGroupList())){
||entity.getServiceId()==1026) { urlCommCfgList.addAll(list.get(0).getUrlCommGroupList());
keywordMap=configSynchronizationDao.getCompileIdWithKeyword(regionTable, compileIds); }
covertCommongroupIdsMap(commGroupMap,"subscribeIdGroup",list.get(0),configSynchronizationDao,ScriberIdCommCfg.class);
if(CollectionUtils.isNotEmpty(list.get(0).getScriberIdCommGroupList())){
scriberIdCommCfgList.addAll(list.get(0).getScriberIdCommGroupList());
}
covertCommongroupIdsMap(commGroupMap,"domainGroup",list.get(0),configSynchronizationDao,DomainCommCfg.class);
if(CollectionUtils.isNotEmpty(list.get(0).getDomainCommGroupList())){
domainCommCfgList.addAll(list.get(0).getDomainCommGroupList());
}
}else{
for(Map<String,Object> m:cfgList){
String regionTable = m.get("tableName").toString();
if("1".equals(m.get("cfgType"))){
ipList.addAll(configSynchronizationDao.getIpPortList(regionTable, compileIds));
}else if("2".equals(m.get("cfgType"))){
strList.addAll(configSynchronizationDao.getStrList(regionTable,compileIds));
//512/521/514/1026业务的用户自定义域取DOMAIN_STR取自Keyword
if(/*entity.getServiceId()==512
||*/entity.getServiceId()==521
||entity.getServiceId()==514
||entity.getServiceId()==1026) {
keywordMap=configSynchronizationDao.getCompileIdWithKeyword(regionTable, compileIds);
}
}else if("3".equals(m.get("cfgType"))){
complexStrList.addAll(configSynchronizationDao.getComplexStrList(regionTable,compileIds));
}else if("4".equals(m.get("cfgType"))){
}else if("5".equals(m.get("cfgType"))){
fileList.addAll(configSynchronizationDao.getFileDigestList(regionTable, compileIds));
} }
}else if("3".equals(m.get("cfgType"))){
complexStrList.addAll(configSynchronizationDao.getComplexStrList(regionTable,compileIds));
}else if("4".equals(m.get("cfgType"))){
}else if("5".equals(m.get("cfgType"))){
fileList.addAll(configSynchronizationDao.getFileDigestList(regionTable, compileIds));
} }
} }
} }
//批量获取regionId,groupId(相同编译下的IP类配置多条ip只获取一个组号分组复用的域配置不需要重新获取regionId,groupId //批量获取regionId,groupId(相同编译下的IP类配置多条ip只获取一个组号分组复用的域配置不需要重新获取regionId,groupId
List<Integer> regionIds = ConfigServiceUtil.getId(3, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size()); List<Integer> regionIds=new ArrayList<>(),groupIds=new ArrayList<>();
List<Integer> groupIds = ConfigServiceUtil.getId(2, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size()); if(!isCommonGroup){
regionIds = ConfigServiceUtil.getId(3, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size());
groupIds = ConfigServiceUtil.getId(2, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size());
}
entity.setIsValid(isValid);//将最新的配置状态赋给配置对象 entity.setIsValid(isValid);//将最新的配置状态赋给配置对象
entity.setAuditTime(updateTime); entity.setAuditTime(updateTime);
for(CfgIndexInfo cfg:list){ for(CfgIndexInfo cfg:list){
@@ -173,150 +201,236 @@ public class SchedulerTaskUtil {
numRegionList = new ArrayList(); numRegionList = new ArrayList();
digestRegionList = new ArrayList(); digestRegionList = new ArrayList();
areaIpRegionList = new ArrayList(); areaIpRegionList = new ArrayList();
List list1 = new ArrayList(); if(StringUtils.isNotBlank(cfg.getCommonGroupIds())){//公共分组
List<BaseStringCfg> list2 = new ArrayList(); //处理自定义域
List<ComplexkeywordCfg> list3 = new ArrayList(); StringBuffer userRegion = new StringBuffer();
List<com.nis.domain.configuration.NumBoundaryCfg> list4 = new ArrayList(); userRegion.append(ConfigConvertUtil.generateCommonGroupDefaultUserRegion(null,cfg.getServiceId()));
List<FileDigestCfg> list5 = new ArrayList(); //子配置
String userRegion = ""; Map<String,Object> maatTableMap=ConfigConvertUtil.convertCommonGroupMaatTable(cfg,cfgList);
//处理自定义域 //IP公共分组
if(userRegionList!=null){ if(CollectionUtils.isNotEmpty(cfg.getIpCommGroupCfgList())){
for(Map<String,Object> n:userRegionList){ IpPortCfg _cfg = new IpPortCfg();
Object userRegionPosition = n.get("userRegionPosition"); BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId","menuNameCode"});
if(userRegionPosition!=null && (userRegionPosition.toString().equals("1")||userRegionPosition.toString().equals("0"))){ Map<String,List> map = ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,ipRegionList,cfg.getIpCommGroupCfgList(),1,_cfg,groupRelationList,maatTableMap,groupIdSet);
//通过反射机制获取自定义域字段值 groupRelationList=map.get("groupList");
String regionColumn = n.get("regionColumn").toString(); ipRegionList=map.get("dstList");
String regionKey = n.get("regionKey").toString(); if(map.get("numRegionList")!=null){
Object value = ""; numRegionList.addAll(map.get("numRegionList"));
Class aClass = null; }
if(userRegionPosition.toString().equals(("0"))){
aClass = BaseCfg.class; }
}else{ //URL公共分组
aClass = CfgIndexInfo.class; if(CollectionUtils.isNotEmpty(cfg.getUrlCommGroupList())){
} CommonStringCfg _cfg = new CommonStringCfg();
if(entity.getServiceId().equals(517)||entity.getServiceId().equals(560)){//代理替换策略 BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId","menuNameCode"});
String[] regionArray = regionColumn.split(","); Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfg.getUrlCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
for(int r=0;r<regionArray.length;r++){ groupRelationList=map.get("groupList");
Field field = aClass.getDeclaredField(regionArray[r]); strRegionList=map.get("dstList");
field.setAccessible(true); }
if(n.get("regionKey").equals("substitute")){ //账号公共分组
value += "/"+BaseService.replaceContentEscape(field.get(cfg)==null?"":field.get(cfg).toString());//自定义域以/分割时的处理 if(CollectionUtils.isNotEmpty(cfg.getScriberIdCommGroupList())){
}else{ CommonStringCfg _cfg = new CommonStringCfg();
value += BaseService.replaceContentEscape(field.get(cfg)==null?"":field.get(cfg).toString()); BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId","menuNameCode"});
}
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfg.getScriberIdCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
groupRelationList=map.get("groupList");
strRegionList=map.get("dstList");
}
//域名公共分组
if(CollectionUtils.isNotEmpty(cfg.getDomainCommGroupList())){
CommonStringCfg _cfg = new CommonStringCfg();
BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId","menuNameCode"});
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfg.getDomainCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
groupRelationList=map.get("groupList");
strRegionList=map.get("dstList");
}
BeanUtils.copyProperties(cfg, maatCfg);
if(cfg.getServiceId().equals(512)){
maatCfg.setAction(2);
}else{
maatCfg.setAction(cfg.getAction());
}
maatCfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
maatCfg.setIpRegionList(ipRegionList);
maatCfg.setStrRegionList(strRegionList);
maatCfg.setNumRegionList(numRegionList);
maatCfg.setDigestRegionList(digestRegionList);
maatCfg.setGroupRelationList(groupRelationList);
maatCfg.setGroupNum(groupRelationList.size());
maatCfg.setAreaIpRegionList(areaIpRegionList);
maatCfg.setIsValid(entity.getIsValid());
if(!StringUtil.isEmpty(userRegion.toString())){
maatCfg.setUserRegion(userRegion.toString());
}
configCompileList.add(maatCfg);
}else{//非公共分组
List list1 = new ArrayList();
List<BaseStringCfg> list2 = new ArrayList();
List<ComplexkeywordCfg> list3 = new ArrayList();
List<com.nis.domain.configuration.NumBoundaryCfg> list4 = new ArrayList();
List<FileDigestCfg> list5 = new ArrayList();
String userRegion = "";
//处理自定义域
if(userRegionList!=null){
for(Map<String,Object> n:userRegionList){
Object userRegionPosition = n.get("userRegionPosition");
if(userRegionPosition!=null && (userRegionPosition.toString().equals("1")||userRegionPosition.toString().equals("0"))){
//通过反射机制获取自定义域字段值
String regionColumn = n.get("regionColumn").toString();
String regionKey = n.get("regionKey").toString();
Object value = "";
Class aClass = null;
if(userRegionPosition.toString().equals(("0"))){
aClass = BaseCfg.class;
}else{
aClass = CfgIndexInfo.class;
} }
userRegion += n.get("regionKey")+"="+value+Constants.USER_REGION_SPLIT; if(entity.getServiceId().equals(517)||entity.getServiceId().equals(560)){//代理替换策略
}else{ String[] regionArray = regionColumn.split(",");
if(regionKey.equals("keyring_id") && StringUtil.isEmpty(value)){ for(int r=0;r<regionArray.length;r++){
Field field = aClass.getDeclaredField(regionArray[r]);
field.setAccessible(true);
if(n.get("regionKey").equals("substitute")){
value += "/"+BaseService.replaceContentEscape(field.get(cfg)==null?"":field.get(cfg).toString());//自定义域以/分割时的处理
}else{
value += BaseService.replaceContentEscape(field.get(cfg)==null?"":field.get(cfg).toString());
}
}
userRegion += n.get("regionKey")+"="+value+Constants.USER_REGION_SPLIT;
}else{
/*if(regionKey.equals("keyring_id") && StringUtil.isEmpty(value)){
value = "0"; value = "0";
}else if(regionKey.equals("DOMAIN_STR")) { }else*/ if(regionKey.equals("DOMAIN_STR")) {
if(!StringUtil.isEmpty(keywordMap) && !StringUtil.isEmpty(keywordMap.get(cfg.getCompileId()))) { if(!StringUtil.isEmpty(keywordMap) && !StringUtil.isEmpty(keywordMap.get(cfg.getCompileId()))) {
value = keywordMap.get(cfg.getCompileId()).getCfgKeywords(); value = keywordMap.get(cfg.getCompileId()).getCfgKeywords();
}
}else if(regionKey.equals("DOMAIN_ID")) {
if(!StringUtil.isEmpty(keywordMap) && !StringUtil.isEmpty(keywordMap.get(cfg.getCompileId()))) {
value = cfg.getCompileId();
}
}else {
Field field = aClass.getDeclaredField(regionColumn);
field.setAccessible(true);
value = field.get(cfg);
} }
}else if(regionKey.equals("DOMAIN_ID")) { if(!StringUtil.isEmpty(value)){
if(!StringUtil.isEmpty(keywordMap) && !StringUtil.isEmpty(keywordMap.get(cfg.getCompileId()))) { if(StringUtil.isEmpty(n.get("regionKey"))){
value = cfg.getCompileId(); userRegion = value.toString();
} }else{
userRegion += n.get("regionKey")+"="+value+Constants.USER_REGION_SPLIT;
}else { }
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;
} }
} }
} }
} }
if(userRegion.endsWith(Constants.USER_REGION_SPLIT)){
userRegion = userRegion.substring(0, userRegion.length()-1);
}
} }
if(userRegion.endsWith(Constants.USER_REGION_SPLIT)){ // Proxy Block --xml无法描述的user_region
userRegion = userRegion.substring(0, userRegion.length()-1); if(entity.getServiceId().equals(576)) {
ManipulatActionParam actionParam = new ManipulatActionParam();
actionParam.setMethod("block");
actionParam.setCode(Integer.valueOf(cfg.getUserRegion1()));
actionParam.setMessage(!StringUtil.isBlank(cfg.getUserRegion2()) ? cfg.getUserRegion2():"");
actionParam.setHtml_profile(Integer.valueOf(!StringUtil.isBlank(cfg.getUserRegion3()) ? cfg.getUserRegion3():"0"));
userRegion = StringEscapeUtils.unescapeJson(BaseService.gsonToJson(actionParam));
} }
}
for(AsnIpCfg ip:asnIpList){//asn不需要再次获取regionId,groupId // Proxy Manipulate
if(ip.getAsnIpGroup().toString().equals(cfg.getUserRegion4())){//根据组号对应 if(entity.getServiceId().equals(656)) {
ip.setIsValid(entity.getIsValid()); userRegion = BaseService.setUserRegionOfMantipulateCfg(cfg, userRegion);
ip.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
list1.add(ip);
} }
} //Intercept Policy、http(s) 监测 、http(s) 白名单
//ip spoofing else if(entity.getServiceId().equals(521) || entity.getServiceId().equals(592)
if(cfg.getServiceId().equals(518)){ || entity.getServiceId().equals(750)) {
//IP仿冒策略 userRegion="{}";
//仿冒IP池配置匹配下发或者取消 }
PxyObjSpoofingIpPool pool=new PxyObjSpoofingIpPool(); for(AsnIpCfg ip:asnIpList){//asn不需要再次获取regionId,groupId
pool.setCfgId(Long.valueOf(cfg.getUserRegion3())); if(ip.getAsnIpGroup().toString().equals(cfg.getUserRegion4())){//根据组号对应
ip.setIsValid(entity.getIsValid());
ip.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
list1.add(ip);
}
}
//ip spoofing
if(cfg.getServiceId().equals(518)){
//IP仿冒策略
//仿冒IP池配置匹配下发或者取消
PxyObjSpoofingIpPool pool=new PxyObjSpoofingIpPool();
pool.setCfgId(Long.valueOf(cfg.getUserRegion3()));
// pxyObjSpoofingIpPoolDao.update(pool); // pxyObjSpoofingIpPoolDao.update(pool);
pool = configSynchronizationDao.getPxyObjSpoofingIpPool(pool.getCfgId()); pool = configSynchronizationDao.getPxyObjSpoofingIpPool(pool.getCfgId());
pool.setIsValid(entity.getIsValid()); pool.setIsValid(entity.getIsValid());
pool.setIsAudit(entity.getIsAudit()); pool.setIsAudit(entity.getIsAudit());
pool.setAuditorId(entity.getAuditorId()); pool.setAuditorId(entity.getAuditorId());
pool.setAuditTime(entity.getAuditTime()); pool.setAuditTime(entity.getAuditTime());
List<PxyObjSpoofingIpPool> poolList = new ArrayList<PxyObjSpoofingIpPool>(); List<PxyObjSpoofingIpPool> poolList = new ArrayList<PxyObjSpoofingIpPool>();
String json=""; String json="";
String areaEffectiveIds="0"; String areaEffectiveIds="0";
if(isValid==1){ if(isValid==1){
pool.setAreaEffectiveIds(areaEffectiveIds); pool.setAreaEffectiveIds(areaEffectiveIds);
pool.setGroupId(pool.getCfgId().intValue());//界面端的配置ID作为策略分组ID pool.setGroupId(pool.getCfgId().intValue());//界面端的配置ID作为策略分组ID
poolList.add(pool); poolList.add(pool);
//调用服务接口下发配置数据 //调用服务接口下发配置数据
json=BaseService.gsonToJson(poolList); json=BaseService.gsonToJson(poolList);
logger.info("欺骗IP池配置下发配置参数"+json); logger.info("欺骗IP池配置下发配置参数"+json);
//调用服务接口下发配置 //调用服务接口下发配置
try { try {
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json); ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
if(result!=null){ if(result!=null){
logger.info("欺骗IP池配置下发响应信息"+result.getMsg()); logger.info("欺骗IP池配置下发响应信息"+result.getMsg());
}
} catch (Exception e) {
logger.error("欺骗IP池配置配置下发失败",e);
throw e;
} }
} catch (Exception e) {
logger.error("欺骗IP池配置配置下发失败",e);
throw e;
} }
} }
if(list1.size()>0){
GroupCfg groupCfg=new GroupCfg();
groupCfg.setCompileId(cfg.getCompileId());
groupCfg.setGroupId(Integer.parseInt(cfg.getUserRegion4()));
groupCfg.setIsValid(entity.getIsValid());
groupCfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
groupRelationList.add(groupCfg);
ipRegionList.addAll(ConfigConvertUtil.groupReuseCfgAddRemoveConvert(list1,Constants.VALID_YES,null));
}else if(!StringUtil.isEmpty(asnGroupIds)) {
GroupCfg groupCfg=new GroupCfg();
groupCfg.setCompileId(cfg.getCompileId());
groupCfg.setGroupId(Integer.parseInt(cfg.getUserRegion4()));
groupCfg.setIsValid(entity.getIsValid());
groupCfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
groupRelationList.add(groupCfg);
ipRegionList.addAll(ipRegionList);
}
//配置域转换
userRegion = ConfigConvertUtil.configCovert(ipList,strList,complexStrList,
numList,fileList,regionIds,groupIds,entity,cfg.getCompileId(),
StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime(),
groupRelationList,ipRegionList,strRegionList,numRegionList,digestRegionList,areaIpRegionList,userRegion);
BeanUtils.copyProperties(cfg, maatCfg);
maatCfg.setAction(cfg.getAction());
maatCfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
maatCfg.setIpRegionList(ipRegionList);
maatCfg.setStrRegionList(strRegionList);
maatCfg.setNumRegionList(numRegionList);
maatCfg.setDigestRegionList(digestRegionList);
maatCfg.setGroupRelationList(groupRelationList);
maatCfg.setGroupNum(groupRelationList.size());
maatCfg.setAreaIpRegionList(areaIpRegionList);
maatCfg.setIsValid(entity.getIsValid());
if(!StringUtil.isEmpty(userRegion)){
maatCfg.setUserRegion(userRegion);
}
configCompileList.add(maatCfg);
} }
if(list1.size()>0){
GroupCfg groupCfg=new GroupCfg();
groupCfg.setCompileId(cfg.getCompileId());
groupCfg.setGroupId(Integer.parseInt(cfg.getUserRegion4()));
groupCfg.setIsValid(entity.getIsValid());
groupCfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
groupRelationList.add(groupCfg);
ipRegionList.addAll(ConfigConvertUtil.groupReuseCfgAddRemoveConvert(list1,Constants.VALID_YES,null));
}else if(!StringUtil.isEmpty(asnGroupIds)) {
GroupCfg groupCfg=new GroupCfg();
groupCfg.setCompileId(cfg.getCompileId());
groupCfg.setGroupId(Integer.parseInt(cfg.getUserRegion4()));
groupCfg.setIsValid(entity.getIsValid());
groupCfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
groupRelationList.add(groupCfg);
ipRegionList.addAll(ipRegionList);
}
//配置域转换
userRegion = ConfigConvertUtil.configCovert(ipList,strList,complexStrList,
numList,fileList,regionIds,groupIds,entity,cfg.getCompileId(),
StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime(),
groupRelationList,ipRegionList,strRegionList,numRegionList,digestRegionList,areaIpRegionList,userRegion);
BeanUtils.copyProperties(cfg, maatCfg);
maatCfg.setAction(cfg.getAction());
maatCfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
maatCfg.setIpRegionList(ipRegionList);
maatCfg.setStrRegionList(strRegionList);
maatCfg.setNumRegionList(numRegionList);
maatCfg.setDigestRegionList(digestRegionList);
maatCfg.setGroupRelationList(groupRelationList);
maatCfg.setGroupNum(groupRelationList.size());
maatCfg.setAreaIpRegionList(areaIpRegionList);
maatCfg.setIsValid(entity.getIsValid());
if(!StringUtil.isEmpty(userRegion)){
maatCfg.setUserRegion(userRegion);
}
configCompileList.add(maatCfg);
} }
maatBean.setConfigCompileList(configCompileList); maatBean.setConfigCompileList(configCompileList);
maatBean.setAuditTime(new Date()); maatBean.setAuditTime(new Date());
@@ -324,7 +438,11 @@ public class SchedulerTaskUtil {
maatBean.setVersion(Constants.MAAT_VERSION); maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.INSERT_ACTION); maatBean.setOpAction(Constants.INSERT_ACTION);
String json=BaseService.gsonToJson(maatBean); String json=BaseService.gsonToJson(maatBean);
logger.info("定时任务修改NTC/PROXY策略的MAAT配置内容"+json); if(json.length()<Constants.JSON_PRINT_LENTH){
logger.info("定时任务修改NTC/PROXY策略的MAAT配置内容"+json);
}else{
logger.info("定时任务修改NTC/PROXY策略的MAAT配置内容超过"+Constants.JSON_PRINT_LENTH+",不打印");
}
//调用服务接口修改配置内容与状态 //调用服务接口修改配置内容与状态
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
if(result!=null){ if(result!=null){
@@ -998,5 +1116,28 @@ public class SchedulerTaskUtil {
} }
public static void main(String[] args) { public static void main(String[] args) {
}
private void covertCommongroupIdsMap(Map commGroupMap,String key,CfgIndexInfo cfg,ConfigSynchronizationDao configSynchronizationDao,Class clazz){
if(commGroupMap.containsKey(key)){
String groups=commGroupMap.get(key).toString();
List<Integer> _groupIds=new ArrayList<>();
for(String group:groups.split(",")){
if(StringUtils.isNotBlank(group)){
_groupIds.add(Integer.parseInt(group));
}
}
if(_groupIds.size()>0){
if("IpCommCfg".equals(clazz.getSimpleName())){
cfg.setIpCommGroupCfgList(configSynchronizationDao.getIpCommCfgPortList(_groupIds));
}else if("UrlCommCfg".equals(clazz.getSimpleName())){
cfg.setUrlCommGroupList(configSynchronizationDao.getUrlCommCfgPortList(_groupIds));
}else if("ScriberIdCommCfg".equals(clazz.getSimpleName())){
cfg.setScriberIdCommGroupList(configSynchronizationDao.getSubscribeIdCommCfgPortList(_groupIds));
}else if("DomainCommCfg".equals(clazz.getSimpleName())){
cfg.setDomainCommGroupList(configSynchronizationDao.getDomainCommCfgPortList(_groupIds));
}
}
}
} }
} }

View File

@@ -319,6 +319,18 @@ public class ExcelCsv {
dict="action_spoofing"; dict="action_spoofing";
val = msgProp.getProperty(dict,dict); val = msgProp.getProperty(dict,dict);
} }
//http(s) manipulate 导出action修改为Manipulate
if(ef.title().equals("block_type")
&& dict.equals("action_redirect")
&& (Reflections.invokeGetter(e, "serviceId").toString().equals("656"))) {
dict="action_manipulate";
val = msgProp.getProperty(dict,dict);
}
if(ef.title().equals("action")
&& dict.equals("action_redirect")) {
dict="action_manipulate";
val = msgProp.getProperty(dict,dict);
}
} }
} }

View File

@@ -23,6 +23,7 @@ import java.util.Set;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.CellStyle;
@@ -49,7 +50,9 @@ import com.nis.domain.SysDataDictionaryItem;
import com.nis.domain.basics.PolicyGroupInfo; import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.domain.basics.ServiceDictInfo; import com.nis.domain.basics.ServiceDictInfo;
import com.nis.domain.basics.SysDictInfo; import com.nis.domain.basics.SysDictInfo;
import com.nis.domain.callback.ProxyFileTrafficMirrorCfg;
import com.nis.domain.configuration.DnsResStrategy; import com.nis.domain.configuration.DnsResStrategy;
import com.nis.domain.configuration.PxyObjKeyring;
import com.nis.util.Constants; import com.nis.util.Constants;
import com.nis.util.DictUtils; import com.nis.util.DictUtils;
import com.nis.util.Encodes; import com.nis.util.Encodes;
@@ -58,6 +61,8 @@ import com.nis.util.StringUtil;
import com.nis.web.dao.basics.PolicyGroupInfoDao; import com.nis.web.dao.basics.PolicyGroupInfoDao;
import com.nis.web.dao.basics.SysDictInfoDao; import com.nis.web.dao.basics.SysDictInfoDao;
import com.nis.web.dao.configuration.DnsResStrategyDao; import com.nis.web.dao.configuration.DnsResStrategyDao;
import com.nis.web.dao.configuration.ProxyFileTrafficMirrorDao;
import com.nis.web.dao.configuration.PxyObjKeyringDao;
import com.nis.web.service.SpringContextHolder; import com.nis.web.service.SpringContextHolder;
/** /**
@@ -72,6 +77,8 @@ public class ExportExcel {
private static DnsResStrategyDao dnsResStrategyDao = SpringContextHolder.getBean(DnsResStrategyDao.class); private static DnsResStrategyDao dnsResStrategyDao = SpringContextHolder.getBean(DnsResStrategyDao.class);
private static PolicyGroupInfoDao policyGroupInfoDao = SpringContextHolder.getBean(PolicyGroupInfoDao.class); private static PolicyGroupInfoDao policyGroupInfoDao = SpringContextHolder.getBean(PolicyGroupInfoDao.class);
private static SysDictInfoDao sysDictInfoDao = SpringContextHolder.getBean(SysDictInfoDao.class); private static SysDictInfoDao sysDictInfoDao = SpringContextHolder.getBean(SysDictInfoDao.class);
private static PxyObjKeyringDao pxyObjKeyringDao = SpringContextHolder.getBean(PxyObjKeyringDao.class);
private static ProxyFileTrafficMirrorDao proxyFileDao = SpringContextHolder.getBean(ProxyFileTrafficMirrorDao.class);
/** /**
* 工作薄对象 * 工作薄对象
@@ -295,7 +302,7 @@ public class ExportExcel {
} }
} }
/*** HTTP(s)替换 搜索区域 ***/ /*** HTTP(s)替换 搜索区域 ***/
if(("replace_zone".equals(headerStr)) && (region.getFunctionId().equals(209))){ if(("replace_zone".equals(headerStr)) && (region.getFunctionId().equals(209) || region.getAction().equals(80))){
commentStr=""; commentStr="";
List<SysDataDictionaryItem> dict=DictUtils.getDictList("CONTROL_REPLACE_ZONE"); List<SysDataDictionaryItem> dict=DictUtils.getDictList("CONTROL_REPLACE_ZONE");
if(dict !=null && dict.size()>0){ if(dict !=null && dict.size()>0){
@@ -458,18 +465,27 @@ public class ExportExcel {
} }
} }
if("ip_group".equals(headerStr)) { // IP、URL、Domain和ScriberId公共组
if("group_name".equals(headerStr)) {
commentStr=""; commentStr="";
//查询dns fake ip policyGroup列表 List<PolicyGroupInfo> list = null;
List<PolicyGroupInfo> list=policyGroupInfoDao.findPolicyGroupInfosByType(5); if(region.getFunctionId().equals(605)) {
if(!StringUtil.isEmpty(list)){ list=policyGroupInfoDao.findPolicyGroupInfosByType(Constants.IP_OBJ_GROUP_TYPE);
for (PolicyGroupInfo policyGroupInfo : list) { }else if(region.getFunctionId().equals(606)) {
commentStr=commentStr+policyGroupInfo.getServiceGroupId()+""+policyGroupInfo.getGroupName()+"\n"; list=policyGroupInfoDao.findPolicyGroupInfosByType(Constants.URL_OBJ_GROUP_TYPE);
index++; }else if(region.getFunctionId().equals(607)) {
} list=policyGroupInfoDao.findPolicyGroupInfosByType(Constants.DOMAIN_OBJ_GROUP_TYPE);
}else if(region.getFunctionId().equals(608)) {
list=policyGroupInfoDao.findPolicyGroupInfosByType(Constants.SUBID_OBJ_GROUP_TYPE);
}
if(!StringUtil.isEmpty(list)){
for (PolicyGroupInfo policyGroupInfo : list) {
commentStr=commentStr+policyGroupInfo.getGroupName()+"\n";
index++;
} }
commentStr=msgProp.getProperty("select")+":\n"+commentStr; }
index++; commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
} }
if("isp".equals(headerStr)) { if("isp".equals(headerStr)) {
commentStr=""; commentStr="";
@@ -587,7 +603,393 @@ public class ExportExcel {
commentStr=commentStr+""+msgProp.getProperty("ip_check")+"(IPv4)\n"; commentStr=commentStr+""+msgProp.getProperty("ip_check")+"(IPv4)\n";
index++; index++;
} }
/**********************************************************************pxy intercept************************************************************************************************************/
//pxy intercept
if("pxy_intercept_monit_keyring".equals(headerStr)) {
commentStr="";
List<PxyObjKeyring> certificateList=pxyObjKeyringDao.findList(null,1,1,"ip");
if(CollectionUtils.isNotEmpty(certificateList)) {
for (PxyObjKeyring certificate : certificateList) {
commentStr=commentStr+certificate.getCompileId()+""+certificate.getCfgDesc()+"\n";
index++;
}
}
if(StringUtil.isEmpty(headerStr)){
headerStr="";
commentStr="";
}else{
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
index++;
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
/*//2、默认值说明
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":0\n";
index++;*/
index++;
}
}
//ev_cert
if("exclusions_ev_cert".equals(headerStr)) {
commentStr="";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
if(StringUtil.isEmpty(headerStr)){
headerStr="";
commentStr="";
}else{
index++;
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//2、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":0\n";
index++;
index++;
}
}
//cert_transparency
if("exclusions_cert_transparency".equals(headerStr)) {
commentStr="";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
if(StringUtil.isEmpty(headerStr)){
headerStr="";
commentStr="";
}else{
index++;
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//2、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":0\n";
index++;
index++;
}
}
//client_cert_req
if("exclusions_client_cert_req".equals(headerStr)) {
commentStr="";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
if(StringUtil.isEmpty(headerStr)){
headerStr="";
commentStr="";
}else{
index++;
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//2、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":1\n";
index++;
index++;
}
}
//pinning
if("exclusions_pinning".equals(headerStr)) {
commentStr="";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
if(StringUtil.isEmpty(headerStr)){
headerStr="";
commentStr="";
}else{
index++;
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//2、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":1\n";
index++;
index++;
}
}
//pinning
if("exclusions_protocol_errors".equals(headerStr)) {
commentStr="";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
if(StringUtil.isEmpty(headerStr)){
headerStr="";
commentStr="";
}else{
index++;
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//2、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":1\n";
index++;
index++;
}
}
//cn
if("cert_verify_approach_cn".equals(headerStr)) {
commentStr="";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
if(StringUtil.isEmpty(headerStr)){
headerStr="";
commentStr="";
}else{
index++;
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//2、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":1\n";
index++;
index++;
}
}
//issuer
if("cert_verify_approach_issuer".equals(headerStr)) {
commentStr="";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
if(StringUtil.isEmpty(headerStr)){
headerStr="";
commentStr="";
}else{
index++;
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//2、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":1\n";
index++;
index++;
}
}
//self-signed
if("cert_verify_approach_self_signed".equals(headerStr)) {
commentStr="";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
if(StringUtil.isEmpty(headerStr)){
headerStr="";
commentStr="";
}else{
index++;
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//2、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":1\n";
index++;
index++;
}
}
//expiration
if("cert_verify_approach_expiration".equals(headerStr)) {
commentStr="";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
if(StringUtil.isEmpty(headerStr)){
headerStr="";
commentStr="";
}else{
index++;
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//2、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":1\n";
index++;
index++;
}
}
//fail_method
if("cert_verify_fail_method".equals(headerStr)) {
commentStr="";
defaultValue="pass-through";
List<SysDataDictionaryItem> failMethods=DictUtils.getDictList("FAIL_METHOD");
if(CollectionUtils.isNotEmpty(failMethods)){
for (SysDataDictionaryItem failMethod : failMethods) {
commentStr=commentStr+failMethod.getItemCode()+""+msgProp.getProperty(failMethod.getItemValue(),failMethod.getItemValue())+""+"\n";
index++;
}
if(StringUtil.isEmpty(commentStr)){
headerStr="";
commentStr="";
}
if(StringUtil.isEmpty(defaultValue)){
defaultValue = region.getConfigDirection().split(",")[0];
}
}
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//1、默认值说明
if(!StringUtil.isEmpty(defaultValue)){
commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++;
}
}
//fail_method
if("ssl_ver_mirror_client".equals(headerStr)) {
commentStr="";
defaultValue="1";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//1、默认值说明
if(!StringUtil.isEmpty(defaultValue)){
commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++;
}
commentStr=commentStr+""+msgProp.getProperty("ssl_ver_mirror_client_on","if the mirror client option value is '1', the min SSL version and the max SSL version will be ignored")+"\n";
index++;
}
//min
if("ssl_ver_min".equals(headerStr)) {
commentStr="";
defaultValue="ssl3";
List<SysDataDictionaryItem> sslversions=DictUtils.getDictList("SSL_VERSION");
if(CollectionUtils.isNotEmpty(sslversions)){
for (SysDataDictionaryItem sslversion : sslversions) {
commentStr=commentStr+sslversion.getItemCode()+""+msgProp.getProperty(sslversion.getItemValue(),sslversion.getItemValue())+""+"\n";
index++;
}
if(StringUtil.isEmpty(commentStr)){
headerStr="";
commentStr="";
}
}
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//1、默认值说明
if(!StringUtil.isEmpty(defaultValue)){
commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++;
}
}
//max
if("ssl_ver_max".equals(headerStr)) {
commentStr="";
defaultValue="tls13";
List<SysDataDictionaryItem> sslversions=DictUtils.getDictList("SSL_VERSION");
if(CollectionUtils.isNotEmpty(sslversions)){
for (SysDataDictionaryItem sslversion : sslversions) {
commentStr=commentStr+sslversion.getItemCode()+""+msgProp.getProperty(sslversion.getItemValue(),sslversion.getItemValue())+""+"\n";
index++;
}
if(StringUtil.isEmpty(commentStr)){
headerStr="";
commentStr="";
}
}
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//1、默认值说明
if(!StringUtil.isEmpty(defaultValue)){
commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++;
}
}
//allow_http2
if("ssl_ver_allow_http2".equals(headerStr)) {
commentStr="";
defaultValue="1";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//1、默认值说明
if(!StringUtil.isEmpty(defaultValue)){
commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++;
}
index++;
}
if("decrypt_mirror_enable".equals(headerStr)) {
commentStr="";
defaultValue="0";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//1、默认值说明
if(!StringUtil.isEmpty(defaultValue)){
commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++;
}
commentStr=commentStr+""+msgProp.getProperty("decrypt_mirror_enable_on","if the enable option value is '1', the Mirror profile is needed")+"\n";
index++;
}
if("decrypt_mirror_mirror_profile".equals(headerStr)) {
commentStr="";
List<ProxyFileTrafficMirrorCfg> mirrorProfileList=proxyFileDao.findMirrorList(null,1,1);
if(CollectionUtils.isNotEmpty(mirrorProfileList)) {
for (ProxyFileTrafficMirrorCfg mirrorProfile : mirrorProfileList) {
commentStr=commentStr+mirrorProfile.getCompileId()+""+mirrorProfile.getCfgDesc()+"\n";
index++;
}
}
if(StringUtil.isEmpty(headerStr)){
headerStr="";
commentStr="";
}else{
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
index++;
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
/*//2、默认值说明
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":0\n";
index++;*/
index++;
}
}
/**********************************************************************pxy intercept************************************************************************************************************/
if(region.getRegionType().equals(1)){//IP配置 if(region.getRegionType().equals(1)){//IP配置
//ip配置需要导入的信息srcIp srcPort destIp destPort Protocol Direction //ip配置需要导入的信息srcIp srcPort destIp destPort Protocol Direction
//确定需要导入的srcIp srcPort destIp destPort信息 //确定需要导入的srcIp srcPort destIp destPort信息
@@ -1170,11 +1572,17 @@ public class ExportExcel {
headerStr=""; headerStr="";
commentStr=""; commentStr="";
}else{ }else{
for (String districtStr : region.getConfigDistrict().split(",")) { if((region.getAction()!=null) && (region.getAction()==85 || region.getAction()==90)) {
commentStr=commentStr+districtStr+"\n"; commentStr=commentStr+"Content-Type"+"\n";
index++; index++;
defaultValue="Content-Type";
}else {
for (String districtStr : region.getConfigDistrict().split(",")) {
commentStr=commentStr+districtStr+"\n";
index++;
}
defaultValue=region.getConfigDistrict().split(",")[0];
} }
defaultValue=region.getConfigDistrict().split(",")[0];
} }
if(StringUtil.isEmpty(commentStr)){ if(StringUtil.isEmpty(commentStr)){
headerStr=""; headerStr="";
@@ -1430,7 +1838,7 @@ public class ExportExcel {
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n"; commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++; index++;
//2、默认值说明 //2、默认值说明
if(region.getFunctionId().equals(200)) { if(region.getFunctionId().equals(200) || region.getFunctionId().equals(607)) {
commentStr=commentStr+""+msgProp.getProperty("default_value")+":1\n"; commentStr=commentStr+""+msgProp.getProperty("default_value")+":1\n";
}else { }else {
commentStr=commentStr+""+msgProp.getProperty("default_value")+":0\n"; commentStr=commentStr+""+msgProp.getProperty("default_value")+":0\n";
@@ -2324,9 +2732,25 @@ public class ExportExcel {
dict="action_spoofing"; dict="action_spoofing";
val = msgProp.getProperty(dict,dict); val = msgProp.getProperty(dict,dict);
} }
//http(s) manipulate 导出action修改为Manipulate
if(ef.title().equals("block_type")
&& dict.equals("action_redirect")
&& (Reflections.invokeGetter(e, "serviceId").toString().equals("656"))) {
dict="action_manipulate";
val = msgProp.getProperty(dict,dict);
}
if(ef.title().equals("action")
&& dict.equals("action_redirect")) {
dict="action_manipulate";
val = msgProp.getProperty(dict,dict);
}
} }
} }
if(ef.title().equals("do_log")
&& (Reflections.invokeGetter(e, "serviceId").toString().equals("512"))) {
val = "";
}
if(ef.title().equals("whether_area_block")&&!StringUtil.isEmpty(val)){ if(ef.title().equals("whether_area_block")&&!StringUtil.isEmpty(val)){
Integer whetherAreaBlock=Integer.parseInt(valStr); Integer whetherAreaBlock=Integer.parseInt(valStr);
if(whetherAreaBlock.equals(0)){ if(whetherAreaBlock.equals(0)){
@@ -2503,8 +2927,8 @@ public class ExportExcel {
/** /**
* 构造函数 * 构造函数
* @param msgProp 国际化配置 * @param msgProp 国际化配置
* @param title sheet名称 * @param titleList sheet名称
* @param cls 实体对象通过annotation.ExportField获取标题 * @param clsMap 实体对象通过annotation.ExportField获取标题
* @param type 导出类型1:导出数据2导出模板 * @param type 导出类型1:导出数据2导出模板
* @param groups 导入分组 * @param groups 导入分组
* @return * @return

View File

@@ -91,6 +91,10 @@ public class CheckComplexStringFormatThread implements Callable<String>{
throw new RuntimeException("Found String region,but mulityKeywords is Empty"); throw new RuntimeException("Found String region,but mulityKeywords is Empty");
} }
String dirtrictP = regionDict.getConfigDistrict(); String dirtrictP = regionDict.getConfigDistrict();
// 代理-操控业务hijack、insert
if("85".equals(regionDict.getAction()+"") || "90".equals(regionDict.getAction()+"")) {
dirtrictP = "Content-Type";
}
StringBuffer errTip = new StringBuffer(); StringBuffer errTip = new StringBuffer();
Pattern pattern = Pattern.compile("\t|\r|\n|\b|\f"); Pattern pattern = Pattern.compile("\t|\r|\n|\b|\f");
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
@@ -127,7 +131,7 @@ public class CheckComplexStringFormatThread implements Callable<String>{
} }
} }
// 代理HTTP(s)阻断 // 代理HTTP(s)阻断
if (regionDict.getFunctionId().equals(207)) { if (regionDict.getFunctionId().equals(207) || "16".equals(regionDict.getAction()+"")) {
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) { if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
baseStringCfg.setUserRegion1("404"); baseStringCfg.setUserRegion1("404");
} }
@@ -153,7 +157,7 @@ public class CheckComplexStringFormatThread implements Callable<String>{
} }
// 代理 HTTP(s)重定向 // 代理 HTTP(s)重定向
if (regionDict.getFunctionId().equals(208)) { if (regionDict.getFunctionId().equals(208) || "48".equals(regionDict.getAction()+"")) {
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) { if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
baseStringCfg.setUserRegion1("302"); baseStringCfg.setUserRegion1("302");
} }
@@ -188,7 +192,7 @@ public class CheckComplexStringFormatThread implements Callable<String>{
} }
} }
// 代理HTTP(s)替换 // 代理HTTP(s)替换
if (regionDict.getFunctionId().equals(209)) { if (regionDict.getFunctionId().equals(209) || "80".equals(regionDict.getAction()+"")) {
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) { if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
baseStringCfg.setUserRegion1("http_resp_body"); baseStringCfg.setUserRegion1("http_resp_body");
} }

View File

@@ -1,6 +1,7 @@
package com.nis.util.excel.thread; package com.nis.util.excel.thread;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
@@ -20,16 +21,24 @@ import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict; import com.nis.domain.FunctionServiceDict;
import com.nis.domain.SysDataDictionaryItem; import com.nis.domain.SysDataDictionaryItem;
import com.nis.domain.basics.AsnGroupInfo; import com.nis.domain.basics.AsnGroupInfo;
import com.nis.domain.basics.CommonGroupInfo;
import com.nis.domain.basics.PolicyGroupInfo; import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.domain.callback.ProxyFileTrafficMirrorCfg;
import com.nis.domain.configuration.BaseIpCfg; import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.DnsResStrategy; import com.nis.domain.configuration.DnsResStrategy;
import com.nis.domain.configuration.IpPortCfg; import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.PxyObjKeyring;
import com.nis.domain.configuration.template.IpRateLimitTemplate; import com.nis.domain.configuration.template.IpRateLimitTemplate;
//import com.nis.util.AsnCacheUtils; //import com.nis.util.AsnCacheUtils;
import com.nis.util.Constants; import com.nis.util.Constants;
import com.nis.util.DictUtils; import com.nis.util.DictUtils;
import com.nis.util.IPUtil; import com.nis.util.IPUtil;
import com.nis.util.StringUtil; import com.nis.util.StringUtil;
import com.nis.web.dao.basics.PolicyGroupInfoDao;
import com.nis.web.dao.configuration.ProxyFileTrafficMirrorDao;
import com.nis.web.dao.configuration.PxyObjKeyringDao;
import com.nis.web.service.BaseService;
import com.nis.web.service.SpringContextHolder;
public class CheckIpFormatThread implements Callable<String>{ public class CheckIpFormatThread implements Callable<String>{
private Logger logger=Logger.getLogger(CheckIpFormatThread.class); private Logger logger=Logger.getLogger(CheckIpFormatThread.class);
@@ -41,6 +50,10 @@ public class CheckIpFormatThread implements Callable<String>{
private FunctionRegionDict regionDict; private FunctionRegionDict regionDict;
private List<Map<Long,AsnGroupInfo>> asnNoMaps; private List<Map<Long,AsnGroupInfo>> asnNoMaps;
private Map<Long,AsnGroupInfo> asnGroupInfos; private Map<Long,AsnGroupInfo> asnGroupInfos;
private static PxyObjKeyringDao pxyObjKeyringDao = SpringContextHolder.getBean(PxyObjKeyringDao.class);
private static ProxyFileTrafficMirrorDao proxyFileDao = SpringContextHolder.getBean(ProxyFileTrafficMirrorDao.class);
private static PolicyGroupInfoDao policyGroupInfoDao = SpringContextHolder.getBean(PolicyGroupInfoDao.class);
// private DnsResStrategyDao dnsResStrategyDao; // private DnsResStrategyDao dnsResStrategyDao;
public CheckIpFormatThread(FunctionServiceDict serviceDict,FunctionRegionDict regionDict,Properties prop,BlockingQueue<? extends Object> srcQueue,BlockingQueue<BaseIpCfg> destQueue) { public CheckIpFormatThread(FunctionServiceDict serviceDict,FunctionRegionDict regionDict,Properties prop,BlockingQueue<? extends Object> srcQueue,BlockingQueue<BaseIpCfg> destQueue) {
this.serviceDict=serviceDict; this.serviceDict=serviceDict;
@@ -112,9 +125,19 @@ public class CheckIpFormatThread implements Callable<String>{
String direction = regionDict.getConfigDirection(); String direction = regionDict.getConfigDirection();
StringBuffer errTip = new StringBuffer(); StringBuffer errTip = new StringBuffer();
// 因IP拦截 监测 // 因IP拦截 监测
if(regionDict.getFunctionId().equals(200) && serviceDict.getAction().equals(1)){ if(regionDict.getFunctionId().equals(200) && serviceDict.getAction().equals(2)){
protocol="6"; protocol="6";
} }
List<SysDataDictionaryItem> sslversions = new ArrayList<>();
List<SysDataDictionaryItem> failmethods = new ArrayList<>();
List<PxyObjKeyring> certificateList=new ArrayList<>();
List<ProxyFileTrafficMirrorCfg> mirrorProfileList=new ArrayList<>();
if(serviceDict!=null&&serviceDict.getServiceId().equals(512)) {
certificateList=pxyObjKeyringDao.findList(null,1,1,"ip");
sslversions=DictUtils.getDictList("SSL_VERSION");
failmethods=DictUtils.getDictList("FAIL_METHOD");
mirrorProfileList=proxyFileDao.findMirrorList(null, 1, 1);
}
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
StringBuffer errInfo = new StringBuffer(); StringBuffer errInfo = new StringBuffer();
IpPortCfg baseIpCfg = new IpPortCfg(); IpPortCfg baseIpCfg = new IpPortCfg();
@@ -129,9 +152,15 @@ public class CheckIpFormatThread implements Callable<String>{
errInfo.append(prop.getProperty("config_describe")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":128") + ";"); errInfo.append(prop.getProperty("config_describe")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":128") + ";");
} }
} }
if(regionDict.getFunctionId().equals(605)) {
if(StringUtils.isBlank(baseIpCfg.getGroupName())) {
errInfo.append(
String.format(prop.getProperty("can_not_null"), prop.getProperty("group_name")) + ";");
}
}
if(regionDict.getFunctionId().equals(200)) { if(regionDict.getFunctionId().equals(200)) {
if(!serviceDict.getAction().equals(1)) { if(!serviceDict.getAction().equals(2)) {
baseIpCfg.setDoLog(0); baseIpCfg.setDoLog(0);
} }
} }
@@ -426,7 +455,7 @@ public class CheckIpFormatThread implements Callable<String>{
} }
} }
// 代理HTTP(s)阻断 // 代理HTTP(s)阻断
if (regionDict.getFunctionId().equals(207)) { if (regionDict.getFunctionId().equals(207) || "16".equals(regionDict.getAction()+"")) {
if(StringUtils.isBlank(baseIpCfg.getUserRegion1())) { if(StringUtils.isBlank(baseIpCfg.getUserRegion1())) {
baseIpCfg.setUserRegion1("404"); baseIpCfg.setUserRegion1("404");
} }
@@ -452,7 +481,7 @@ public class CheckIpFormatThread implements Callable<String>{
} }
// 代理 HTTP(s)重定向 // 代理 HTTP(s)重定向
if (regionDict.getFunctionId().equals(208)) { if (regionDict.getFunctionId().equals(208) || "48".equals(regionDict.getAction()+"")) {
if(StringUtils.isBlank(baseIpCfg.getUserRegion1())) { if(StringUtils.isBlank(baseIpCfg.getUserRegion1())) {
baseIpCfg.setUserRegion1("302"); baseIpCfg.setUserRegion1("302");
} }
@@ -487,7 +516,7 @@ public class CheckIpFormatThread implements Callable<String>{
} }
} }
// 代理HTTP(s)替换 // 代理HTTP(s)替换
if (regionDict.getFunctionId().equals(209)) { if (regionDict.getFunctionId().equals(209) || "80".equals(regionDict.getAction()+"")) {
if(StringUtils.isBlank(baseIpCfg.getUserRegion1())) { if(StringUtils.isBlank(baseIpCfg.getUserRegion1())) {
baseIpCfg.setUserRegion1("http_resp_body"); baseIpCfg.setUserRegion1("http_resp_body");
} }
@@ -546,7 +575,252 @@ public class CheckIpFormatThread implements Callable<String>{
} }
} }
} }
if(serviceDict!=null&&serviceDict.getServiceId().equals(512)) {
Integer kering=baseIpCfg.getKeyring();
Integer evCet=baseIpCfg.getEvCert();
Integer certTransparency=baseIpCfg.getCertTransparency();
Integer clientCertReq=baseIpCfg.getClientCertReq();
Integer pinning=baseIpCfg.getPinning();
Integer protocolErrors=baseIpCfg.getProtocolErrors();
Integer cn=baseIpCfg.getCn();
Integer issuer=baseIpCfg.getIssuer();
Integer selfSigned=baseIpCfg.getSelfSigned();
Integer expiration=baseIpCfg.getExpiration();
String failMethod=baseIpCfg.getFailMethod();
String min=baseIpCfg.getMin();
String max=baseIpCfg.getMax();
Integer mirrorClient=baseIpCfg.getMirrorClient();
Integer allowHttp2=baseIpCfg.getAllowHttp2();
Integer enable=baseIpCfg.getEnable();
Integer mirrorProfile=baseIpCfg.getMirrorProfile();
Map<String,Object> userRegionMap=new HashMap<>();
Map<String,Object> map=new HashMap<>();
if(kering!=null) {
boolean has=false;
for(PxyObjKeyring keyring:certificateList) {
if(keyring.getCompileId().toString().equals(kering.toString())) {
has=true;
break;
}
}
if(has) {
userRegionMap.put("keyring", kering);
}else {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("pxy_intercept_monit_keyring") + " ") + ";");
}
}else {
userRegionMap.put("keyring", 1);
}
if(evCet!=null) {
if(evCet!=0&&evCet!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("exclusions_ev_cert","exclusions ev cert") + " ") + ";");
}else {
map.put("ev_cert", evCet);
}
}else {
map.put("ev_cert", 0);
}
if(certTransparency!=null) {
if(certTransparency!=0&&certTransparency!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("exclusions_cert_transparency","exclusions cert transparency") + " ") + ";");
}else {
map.put("cert_transparency", certTransparency);
}
}else {
map.put("cert_transparency", 0);
}
if(clientCertReq!=null) {
if(clientCertReq!=0&&clientCertReq!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("exclusions_client_cert_req","exclusions client cert req") + " ") + ";");
}else {
map.put("client_cert_req", clientCertReq);
}
}else {
map.put("client_cert_req", 1);
}
if(pinning!=null) {
if(pinning!=0&&pinning!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("exclusions_pinning","exclusions pinning") + " ") + ";");
}else {
map.put("pinning", pinning);
}
}else {
map.put("pinning", 1);
}
if(protocolErrors!=null) {
if(protocolErrors!=0&&protocolErrors!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("exclusions_protocol_errors","exclusions protocol errors") + " ") + ";");
}else {
map.put("protocol_errors", protocolErrors);
}
}else {
map.put("protocol_errors", 1);
}
userRegionMap.put("exclusions", map);
map=new HashMap<>();
Map<String,Object> map1=new HashMap<>();
if(cn!=null) {
if(cn!=0&&cn!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("cert_verify_approach_cn","cert verify approach cn") + " ") + ";");
}else {
map1.put("cn", cn);
}
}else {
map1.put("cn", 1);
}
if(issuer!=null) {
if(issuer!=0&&issuer!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("cert_verify_approach_issuer","cert verify approach issuer") + " ") + ";");
}else {
map1.put("issuer", issuer);
}
}else {
map1.put("issuer", 1);
}
if(selfSigned!=null) {
if(selfSigned!=0&&selfSigned!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("cert_verify_approach_self_signed","cert verify approach self signed") + " ") + ";");
}else {
map1.put("self-signed", selfSigned);
}
}else {
map1.put("self-signed", 1);
}
if(expiration!=null) {
if(expiration!=0&&expiration!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("cert_verify_approach_expiration","cert verify approach expiration") + " ") + ";");
}else {
map1.put("expiration", expiration);
}
}else {
map1.put("expiration", 1);
}
map.put("approach", map1);
if(StringUtils.isBlank(failMethod)) {
map.put("fail_method", "pass-through");
}else {
boolean has=false;
for(SysDataDictionaryItem fail: failmethods) {
if(fail.getItemCode().equals(failMethod)) {
has=true;
break;
}
}
if(!has) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("cert_verify_fail_method","cert verify fail method") + " ") + ";");
}
map.put("fail_method", failMethod);
}
userRegionMap.put("cert_verify", map);
map=new HashMap<>();
if(mirrorClient==null) {
mirrorClient=1;
map.put("mirror_client", 1);
}else {
if(mirrorClient!=0&&mirrorClient!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("ssl_ver_mirror_client","SSL version mirror client") + " ") + ";");
}else {
map.put("mirror_client", mirrorClient);
}
}
if(allowHttp2==null) {
allowHttp2=1;
map.put("allow_http2", allowHttp2);
}else {
if(allowHttp2!=0&&allowHttp2!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("ssl_ver_allow_http2","SSL version allow http2") + " ") + ";");
}else {
map.put("allow_http2", allowHttp2);
}
}
if(mirrorClient==0) {
int minSort=0,maxSort=0;
if(StringUtils.isBlank(min)) {
min="ssl3";
}
if(StringUtils.isBlank(max)) {
max="tls13";
}
for(SysDataDictionaryItem sslversion: sslversions) {
if(sslversion.getItemCode().equals(min)) {
minSort=sslversion.getItemSort();
}
if(sslversion.getItemCode().equals(max)) {
maxSort=sslversion.getItemSort();
}
}
if(minSort==0) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("ssl_ver_min","min SSL version") + " ") + ";");
}
if(maxSort==0) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("ssl_ver_max","max SSL version") + " ") + ";");
}
if(minSort>maxSort) {
errInfo.append(prop.getProperty("min_should_less_than_max","the min SSL version should less than the max SSL version") + ";");
}
map.put("min", min);
map.put("max", max);
}
userRegionMap.put("ssl_ver", map);
map=new HashMap<>();
if(enable==null) {
enable=0;
map.put("enable", 0);
}else {
if(enable!=0&&enable!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("decrypt_mirror_enable","decrypt mirror enable") + " ") + ";");
}else {
map.put("enable", enable);
}
}
//enable==1的时候才设置mirror_profile
if(enable==1) {
if(mirrorProfile==null) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("decrypt_mirror_mirror_profile") + " ") + ";");
}else {
boolean has=false;
for(ProxyFileTrafficMirrorCfg _mirrorProfile:mirrorProfileList) {
if(_mirrorProfile.getCompileId().toString().equals(mirrorProfile.toString())) {
has=true;
break;
}
}
if(has) {
map.put("mirror_profile", mirrorProfile);
}else {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("decrypt_mirror_mirror_profile") + " ") + ";");
}
map.put("mirror_profile", mirrorProfile);
}
}
userRegionMap.put("decrypt_mirror", map);
baseIpCfg.setUserRegion1(BaseService.gsonToJson(userRegionMap));
}
// IpSpoofing // IpSpoofing
if (regionDict.getFunctionId().equals(214)) { if (regionDict.getFunctionId().equals(214)) {
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("SPOOFING_IP_TYPE"); List<SysDataDictionaryItem> dicts = DictUtils.getDictList("SPOOFING_IP_TYPE");
@@ -578,7 +852,7 @@ public class CheckIpFormatThread implements Callable<String>{
} }
} }
} }
if (regionDict.getRegionType().equals(1)) { if (regionDict.getRegionType().equals(1)) {
boolean srcIpEmpty = false; boolean srcIpEmpty = false;
boolean destIpEmpty = false; boolean destIpEmpty = false;

View File

@@ -1,7 +1,9 @@
package com.nis.util.excel.thread; package com.nis.util.excel.thread;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
@@ -19,10 +21,17 @@ import com.beust.jcommander.internal.Sets;
import com.nis.domain.FunctionRegionDict; import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict; import com.nis.domain.FunctionServiceDict;
import com.nis.domain.SysDataDictionaryItem; import com.nis.domain.SysDataDictionaryItem;
import com.nis.domain.basics.CommonGroupInfo;
import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.domain.callback.ProxyFileTrafficMirrorCfg;
import com.nis.domain.configuration.BaseStringCfg; import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.IpPortCfg; import com.nis.domain.configuration.PxyObjKeyring;
import com.nis.util.Constants; import com.nis.util.Constants;
import com.nis.util.DictUtils; import com.nis.util.DictUtils;
import com.nis.web.dao.configuration.ProxyFileTrafficMirrorDao;
import com.nis.web.dao.configuration.PxyObjKeyringDao;
import com.nis.web.service.BaseService;
import com.nis.web.service.SpringContextHolder;
public class CheckStringFormatThread implements Callable<String>{ public class CheckStringFormatThread implements Callable<String>{
private Logger logger=Logger.getLogger(CheckStringFormatThread.class); private Logger logger=Logger.getLogger(CheckStringFormatThread.class);
@@ -32,6 +41,8 @@ public class CheckStringFormatThread implements Callable<String>{
// private DnsResStrategyDao dnsResStrategyDao; // private DnsResStrategyDao dnsResStrategyDao;
private FunctionServiceDict serviceDict; private FunctionServiceDict serviceDict;
private FunctionRegionDict regionDict; private FunctionRegionDict regionDict;
private static PxyObjKeyringDao pxyObjKeyringDao = SpringContextHolder.getBean(PxyObjKeyringDao.class);
private static ProxyFileTrafficMirrorDao proxyFileDao = SpringContextHolder.getBean(ProxyFileTrafficMirrorDao.class);
public CheckStringFormatThread(FunctionServiceDict serviceDict,FunctionRegionDict regionDict,Properties prop,BlockingQueue<? extends Object> srcQueue,BlockingQueue<BaseStringCfg<?>> destQueue) { public CheckStringFormatThread(FunctionServiceDict serviceDict,FunctionRegionDict regionDict,Properties prop,BlockingQueue<? extends Object> srcQueue,BlockingQueue<BaseStringCfg<?>> destQueue) {
this.serviceDict=serviceDict; this.serviceDict=serviceDict;
this.regionDict=regionDict; this.regionDict=regionDict;
@@ -91,6 +102,16 @@ public class CheckStringFormatThread implements Callable<String>{
StringBuffer errTip = new StringBuffer(); StringBuffer errTip = new StringBuffer();
Pattern pattern = Pattern.compile("\t|\r|\n|\b|\f"); Pattern pattern = Pattern.compile("\t|\r|\n|\b|\f");
Pattern domainPattern = Pattern.compile("^[a-zA-Z0-9.-]*$"); Pattern domainPattern = Pattern.compile("^[a-zA-Z0-9.-]*$");
List<SysDataDictionaryItem> sslversions = new ArrayList<>();
List<SysDataDictionaryItem> failmethods = new ArrayList<>();
List<PxyObjKeyring> certificateList=new ArrayList<>();
List<ProxyFileTrafficMirrorCfg> mirrorProfileList=new ArrayList<>();
if(serviceDict!=null&&serviceDict.getServiceId().equals(512)) {
certificateList=pxyObjKeyringDao.findList(null,1,1,"ip");
sslversions=DictUtils.getDictList("SSL_VERSION");
failmethods=DictUtils.getDictList("FAIL_METHOD");
mirrorProfileList=proxyFileDao.findMirrorList(null, 1, 1);
}
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
StringBuffer errInfo = new StringBuffer(); StringBuffer errInfo = new StringBuffer();
BaseStringCfg baseStringCfg = new BaseStringCfg(); BaseStringCfg baseStringCfg = new BaseStringCfg();
@@ -104,14 +125,20 @@ public class CheckStringFormatThread implements Callable<String>{
errInfo.append(prop.getProperty("config_describe")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":128") + ";"); errInfo.append(prop.getProperty("config_describe")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":128") + ";");
} }
if(regionDict.getFunctionId().equals(606) || regionDict.getFunctionId().equals(607) || regionDict.getFunctionId().equals(608)) {
if(StringUtils.isBlank(baseStringCfg.getGroupName())) {
errInfo.append(
String.format(prop.getProperty("can_not_null"), prop.getProperty("group_name")) + ";");
}
}
if(regionDict.getFunctionId().equals(200)) { if(regionDict.getFunctionId().equals(200)) {
if(!serviceDict.getAction().equals(1)) { if(!serviceDict.getAction().equals(2)) {
baseStringCfg.setDoLog(0); baseStringCfg.setDoLog(0);
} }
} }
// doLog属性检验 // doLog属性检验
this.validDoLog(baseStringCfg,errInfo); this.validDoLog(baseStringCfg,errInfo);
if (regionDict.getRegionType().equals(2)) { if (regionDict.getRegionType().equals(2)) {
if (regionDict.getFunctionId().equals(510) && "p2p_hash".equals(regionDict.getConfigServiceType())) { if (regionDict.getFunctionId().equals(510) && "p2p_hash".equals(regionDict.getConfigServiceType())) {
String userRegion1 = baseStringCfg.getUserRegion1(); String userRegion1 = baseStringCfg.getUserRegion1();
@@ -132,7 +159,7 @@ public class CheckStringFormatThread implements Callable<String>{
} }
// 代理-域名拦截 // 代理-域名拦截
if (regionDict.getFunctionId().equals(200) && "intercept_domain".equals(regionDict.getConfigServiceType())) { if (regionDict.getFunctionId().equals(200) && "intercept_domain".equals(regionDict.getConfigServiceType())) {
if(serviceDict.getAction().equals(1)) { /*if(serviceDict.getAction().equals(1)) {
if(StringUtils.isBlank(baseStringCfg.getUserRegion5())) { if(StringUtils.isBlank(baseStringCfg.getUserRegion5())) {
baseStringCfg.setUserRegion5("1"); baseStringCfg.setUserRegion5("1");
} }
@@ -152,7 +179,7 @@ public class CheckStringFormatThread implements Callable<String>{
} }
} }
}else if(serviceDict.getAction().equals(64)) { }else*/ if(serviceDict.getAction().equals(64)) {
baseStringCfg.setUserRegion1("0");// limit_rate_type限速方式默认值 baseStringCfg.setUserRegion1("0");// limit_rate_type限速方式默认值
if(StringUtils.isBlank(baseStringCfg.getUserRegion2())) { if(StringUtils.isBlank(baseStringCfg.getUserRegion2())) {
baseStringCfg.setUserRegion2("0.1"); baseStringCfg.setUserRegion2("0.1");
@@ -177,7 +204,7 @@ public class CheckStringFormatThread implements Callable<String>{
} }
// 代理HTTP(s)阻断 // 代理HTTP(s)阻断
if (regionDict.getFunctionId().equals(207)) { if (regionDict.getFunctionId().equals(207) || "16".equals(regionDict.getAction()+"")) {
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) { if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
baseStringCfg.setUserRegion1("404"); baseStringCfg.setUserRegion1("404");
} }
@@ -203,7 +230,7 @@ public class CheckStringFormatThread implements Callable<String>{
} }
// 代理 HTTP(s)重定向 // 代理 HTTP(s)重定向
if (regionDict.getFunctionId().equals(208)) { if (regionDict.getFunctionId().equals(208) || "48".equals(regionDict.getAction()+"")) {
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) { if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
baseStringCfg.setUserRegion1("302"); baseStringCfg.setUserRegion1("302");
} }
@@ -238,7 +265,7 @@ public class CheckStringFormatThread implements Callable<String>{
} }
} }
// 代理HTTP(s)替换 // 代理HTTP(s)替换
if (regionDict.getFunctionId().equals(209)) { if (regionDict.getFunctionId().equals(209) || "80".equals(regionDict.getAction()+"")) {
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) { if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
baseStringCfg.setUserRegion1("http_resp_body"); baseStringCfg.setUserRegion1("http_resp_body");
} }
@@ -277,7 +304,7 @@ public class CheckStringFormatThread implements Callable<String>{
} }
String keyword = baseStringCfg.getCfgKeywords(); String keyword = baseStringCfg.getCfgKeywords();
if (!regionDict.getFunctionId().equals(403) && !regionDict.getFunctionId().equals(200)) {// 201域名拦截 if (!regionDict.getFunctionId().equals(403) && !regionDict.getFunctionId().equals(200) && !regionDict.getFunctionId().equals(607)) {// 201域名拦截
if (StringUtils.isBlank(keyword)) { if (StringUtils.isBlank(keyword)) {
errInfo.append( errInfo.append(
String.format(prop.getProperty("can_not_null"), prop.getProperty("key_word") + " ") + ";"); String.format(prop.getProperty("can_not_null"), prop.getProperty("key_word") + " ") + ";");
@@ -494,6 +521,252 @@ public class CheckStringFormatThread implements Callable<String>{
} }
} }
if(serviceDict!=null&&serviceDict.getServiceId().equals(512)) {
Integer kering=baseStringCfg.getKeyring();
Integer evCet=baseStringCfg.getEvCert();
Integer certTransparency=baseStringCfg.getCertTransparency();
Integer clientCertReq=baseStringCfg.getClientCertReq();
Integer pinning=baseStringCfg.getPinning();
Integer protocolErrors=baseStringCfg.getProtocolErrors();
Integer cn=baseStringCfg.getCn();
Integer issuer=baseStringCfg.getIssuer();
Integer selfSigned=baseStringCfg.getSelfSigned();
Integer expiration=baseStringCfg.getExpiration();
String failMethod=baseStringCfg.getFailMethod();
String min=baseStringCfg.getMin();
String max=baseStringCfg.getMax();
Integer mirrorClient=baseStringCfg.getMirrorClient();
Integer allowHttp2=baseStringCfg.getAllowHttp2();
Integer enable=baseStringCfg.getEnable();
Integer mirrorProfile=baseStringCfg.getMirrorProfile();
Map<String,Object> userRegionMap=new HashMap<>();
Map<String,Object> map=new HashMap<>();
if(kering!=null) {
boolean has=false;
for(PxyObjKeyring keyring:certificateList) {
if(keyring.getCompileId().toString().equals(kering.toString())) {
has=true;
break;
}
}
if(has) {
userRegionMap.put("keyring", kering);
}else {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("pxy_intercept_monit_keyring") + " ") + ";");
}
}else {
userRegionMap.put("keyring", 1);
}
if(evCet!=null) {
if(evCet!=0&&evCet!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("exclusions_ev_cert","exclusions ev cert") + " ") + ";");
}else {
map.put("ev_cert", evCet);
}
}else {
map.put("ev_cert", 0);
}
if(certTransparency!=null) {
if(certTransparency!=0&&certTransparency!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("exclusions_cert_transparency","exclusions cert transparency") + " ") + ";");
}else {
map.put("cert_transparency", certTransparency);
}
}else {
map.put("cert_transparency", 0);
}
if(clientCertReq!=null) {
if(clientCertReq!=0&&clientCertReq!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("exclusions_client_cert_req","exclusions client cert req") + " ") + ";");
}else {
map.put("client_cert_req", clientCertReq);
}
}else {
map.put("client_cert_req", 1);
}
if(pinning!=null) {
if(pinning!=0&&pinning!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("exclusions_pinning","exclusions pinning") + " ") + ";");
}else {
map.put("pinning", pinning);
}
}else {
map.put("pinning", 1);
}
if(protocolErrors!=null) {
if(protocolErrors!=0&&protocolErrors!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("exclusions_protocol_errors","exclusions protocol errors") + " ") + ";");
}else {
map.put("protocol_errors", protocolErrors);
}
}else {
map.put("protocol_errors", 1);
}
userRegionMap.put("exclusions", map);
map=new HashMap<>();
Map<String,Object> map1=new HashMap<>();
if(cn!=null) {
if(cn!=0&&cn!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("cert_verify_approach_cn","cert verify approach cn") + " ") + ";");
}else {
map1.put("cn", cn);
}
}else {
map1.put("cn", 1);
}
if(issuer!=null) {
if(issuer!=0&&issuer!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("cert_verify_approach_issuer","cert verify approach issuer") + " ") + ";");
}else {
map1.put("issuer", issuer);
}
}else {
map1.put("issuer", 1);
}
if(selfSigned!=null) {
if(selfSigned!=0&&selfSigned!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("cert_verify_approach_self_signed","cert verify approach self signed") + " ") + ";");
}else {
map1.put("self-signed", selfSigned);
}
}else {
map1.put("self-signed", 1);
}
if(expiration!=null) {
if(expiration!=0&&expiration!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("cert_verify_approach_expiration","cert verify approach expiration") + " ") + ";");
}else {
map1.put("expiration", expiration);
}
}else {
map1.put("expiration", 1);
}
map.put("approach", map1);
if(StringUtils.isBlank(failMethod)) {
map.put("fail_method", "pass-through");
}else {
boolean has=false;
for(SysDataDictionaryItem fail: failmethods) {
if(fail.getItemCode().equals(failMethod)) {
has=true;
break;
}
}
if(!has) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("cert_verify_fail_method","cert verify fail method") + " ") + ";");
}
map.put("fail_method", failMethod);
}
userRegionMap.put("cert_verify", map);
map=new HashMap<>();
if(mirrorClient==null) {
mirrorClient=1;
map.put("mirror_client", 1);
}else {
if(mirrorClient!=0&&mirrorClient!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("ssl_ver_mirror_client","SSL version mirror client") + " ") + ";");
}else {
map.put("mirror_client", mirrorClient);
}
}
if(allowHttp2==null) {
allowHttp2=1;
map.put("allow_http2", allowHttp2);
}else {
if(allowHttp2!=0&&allowHttp2!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("ssl_ver_allow_http2","SSL version allow http2") + " ") + ";");
}else {
map.put("allow_http2", allowHttp2);
}
}
if(mirrorClient==0) {
int minSort=0,maxSort=0;
if(StringUtils.isBlank(min)) {
min="ssl3";
}
if(StringUtils.isBlank(max)) {
max="tls13";
}
for(SysDataDictionaryItem sslversion: sslversions) {
if(sslversion.getItemCode().equals(min)) {
minSort=sslversion.getItemSort();
}
if(sslversion.getItemCode().equals(max)) {
maxSort=sslversion.getItemSort();
}
}
if(minSort==0) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("ssl_ver_min","min SSL version") + " ") + ";");
}
if(maxSort==0) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("ssl_ver_max","max SSL version") + " ") + ";");
}
if(minSort>maxSort) {
errInfo.append(prop.getProperty("min_should_less_than_max","the min SSL version should less than the max SSL version") + ";");
}
map.put("min", min);
map.put("max", max);
}
userRegionMap.put("ssl_ver", map);
map=new HashMap<>();
if(enable==null) {
enable=0;
map.put("enable", 0);
}else {
if(enable!=0&&enable!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("decrypt_mirror_enable","decrypt mirror enable") + " ") + ";");
}else {
map.put("enable", enable);
}
}
//enable==1的时候才设置mirror_profile
if(enable==1) {
if(mirrorProfile==null) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("decrypt_mirror_mirror_profile") + " ") + ";");
}else {
boolean has=false;
for(ProxyFileTrafficMirrorCfg _mirrorProfile:mirrorProfileList) {
if(_mirrorProfile.getCompileId().toString().equals(mirrorProfile.toString())) {
has=true;
break;
}
}
if(has) {
map.put("mirror_profile", mirrorProfile);
}else {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("decrypt_mirror_mirror_profile") + " ") + ";");
}
map.put("mirror_profile", mirrorProfile);
}
}
userRegionMap.put("decrypt_mirror", map);
baseStringCfg.setUserRegion1(BaseService.gsonToJson(userRegionMap));
}
if (errInfo.toString().length() > 0) {// if (errInfo.toString().length() > 0) {//
errTip.append(String.format(prop.getProperty("line"), baseStringCfg.getIndex()) + ","); errTip.append(String.format(prop.getProperty("line"), baseStringCfg.getIndex()) + ",");
errTip.append(errInfo); errTip.append(errInfo);

View File

@@ -86,7 +86,10 @@ public class HttpClientUtil {
throw new ConnectException("流量统计服务接口连接错误"+response); throw new ConnectException("流量统计服务接口连接错误"+response);
} }
} catch (Exception e) { } catch (Exception e) {
throw e; // e.printStackTrace();
logger.error("获取消息失败,相应内容如下: " + response);
logger.error("获取消息失败 ", e);
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:");
}finally { }finally {
if (response != null) { if (response != null) {
try { try {

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,158 @@
package com.nis.web.controller.basics;
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.springframework.beans.factory.annotation.Autowired;
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.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page;
import com.nis.domain.basics.CommonGroupInfo;
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.CommonGroupManageService;
/**
* 公共组管理
*/
@Controller
@RequestMapping(value = "${adminPath}/basics/commonGroup")
public class CommonGroupManageController extends BaseController {
@Autowired
private CommonGroupManageService commonGroupManageService;
@RequestMapping(value = {"list"})
public String policyGroupList(CommonGroupInfo cfg, Model model, HttpServletRequest request, HttpServletResponse response) {
if(cfg == null)cfg=new CommonGroupInfo();
Page<CommonGroupInfo> pageCondition = new Page<CommonGroupInfo>(request, response,"r");
Page page = commonGroupManageService.findCommonGroupInfoList(pageCondition,cfg);
model.addAttribute("cfg", cfg);
model.addAttribute("page", page);
return "/basics/commonGroupList";
}
@RequestMapping(value={"/form"})
public String form(Integer groupType,String ids,Model model,String doAction,RedirectAttributes redirectAttributes) {
CommonGroupInfo groupInfo = new CommonGroupInfo();
if(!StringUtil.isEmpty(ids)){
groupInfo = commonGroupManageService.getById(Integer.parseInt(ids));
}
//groupInfo.setGroupType(groupType);
model.addAttribute("_cfg", groupInfo);
return "/basics/commonGroupForm";
}
@RequestMapping(value = "saveOrUpdate")
public String saveOrUpdate(CommonGroupInfo cfg, Model model, RedirectAttributes redirectAttributes,
String itType,Integer groupType,HttpServletRequest request) {
try {
commonGroupManageService.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/commonGroup/list";
}
@RequestMapping(value={"delete"})
public String delete(RedirectAttributes redirectAttributes, String groupTypes, String ids, int isValid,HttpServletRequest request) {
try {
commonGroupManageService.deldete(ids, isValid, groupTypes);
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/commonGroup/list";
}
@ResponseBody
@RequestMapping(value="ajaxCheckIsLastOneCfg",method=RequestMethod.POST)
public List<Integer> ajaxCheckIsLastOneCfg(Model model, String grouIdAndCfgId, Integer groupType){
return commonGroupManageService.ajaxCheckIsLastOneCfg(grouIdAndCfgId, groupType);
}
@ResponseBody
@RequestMapping(value="ajaxGetGroupInfoByType",method=RequestMethod.GET)
public List<CommonGroupInfo> ajaxGetGroupInfoByType(Integer groupType){
return commonGroupManageService.findCommonGroupInfosByType(groupType);
}
// 数据导出
@RequestMapping(value = "exportGroup")
public void exportGroup(Model model,@ModelAttribute("cfg")CommonGroupInfo entity,String ids,RedirectAttributes redirectAttributes,
HttpServletRequest request,HttpServletResponse response){
try {
entity.setMenuNameCode("common_group_manage");
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>();
List<CommonGroupInfo> list = new ArrayList<CommonGroupInfo>();
if (!StringUtil.isEmpty(ids)) {
list = commonGroupManageService.findGroupInfoList(ids);
} else {
Page<CommonGroupInfo> pageInfo=new Page<CommonGroupInfo>(request, response,"r");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page page = commonGroupManageService.findCommonGroupInfoList(pageInfo,entity);
list=page.getList();
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), CommonGroupInfo.class);
String cfgIndexInfoNoExport=",config_describe,cfg_id,block_type,do_log,action,valid_identifier,is_audit"
+ ",auditor,audit_time,letter,whether_area_block,classification,attribute,label"
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,";
// 时间过滤
if (entity.getSearch_create_time_start() == null ) {
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_edit_time_start() == null) {
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
}
if (!StringUtil.isEmpty(entity.gethColumns())) {
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
}
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
dataMap.put(entity.getMenuNameCode(), list);
String timeRange = initTimeMap(entity);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(entity.getExType())) {
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
}
} catch (Exception e) {
logger.error("Group export failed",e);
addMessage(redirectAttributes,"error","export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}

View File

@@ -0,0 +1,318 @@
package com.nis.web.controller.basics;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jets3t.service.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
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.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.beust.jcommander.internal.Lists;
import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.basics.CommonGroupInfo;
import com.nis.domain.basics.DomainCommCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.template.DomainCommCfgTemplate;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.StringUtil;
import com.nis.util.excel.ImportBigExcel;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
import com.nis.web.service.basics.DomainCommGroupService;
@Controller
@RequestMapping(value = "${adminPath}/basics/domain")
public class DomainCommGroupController extends BaseController{
@Autowired
private DomainCommGroupService domainCommGroupService;
@RequestMapping(value = {"/list"})
public String list(Model model, @ModelAttribute("cfg")DomainCommCfg entity, HttpServletRequest request,HttpServletResponse response){
Page<DomainCommCfg> page = domainCommGroupService.findPage(new Page<DomainCommCfg>(request, response,"r"), entity);
List<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId());
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entity.getFunctionId());
List<CommonGroupInfo> groupInfos = commonGroupManageService.findCommonGroupInfosByType(Constants.DOMAIN_OBJ_GROUP_TYPE);
model.addAttribute("page", page);
model.addAttribute("regionList", regionList);
model.addAttribute("serviceList", serviceList);
model.addAttribute("policyGroupInfos", groupInfos);
return "/basics/domainCommGroupList";
}
@RequestMapping(value = {"/addForm"})
public String addForm(Model model, @ModelAttribute("cfg")CfgIndexInfo cfg, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response){
initFormCondition(model,cfg);
/* List<CommonGroupInfo> groupInfos=commonGroupManageService.findCommonGroupInfosByType(Constants.DOMAIN_OBJ_GROUP_TYPE);
model.addAttribute("policyGroupInfos", groupInfos);*/
model.addAttribute("_cfg", cfg);
return "/basics/domainCommGroupFormAdd";
}
@RequestMapping(value = {"/save"})
public String save(Model model, @ModelAttribute("cfg")CfgIndexInfo cfg,RedirectAttributes redirectAttributes,
HttpServletRequest request,HttpServletResponse response){
try{
domainCommGroupService.saveCommGroupCfg(cfg);
addMessage(redirectAttributes,"success","save_success");
}catch(Exception e){
logger.error("信息保存失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error",e.getMessage());
}else {
addMessage(redirectAttributes,"error","save_failed");
}
}
return "redirect:" + adminPath +"/basics/domain/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"/updateForm"})
public String updateForm(Model model,HttpServletRequest request
,HttpServletResponse response,String ids,@ModelAttribute("cfg")DomainCommCfg cfg
,RedirectAttributes redirectAttributes){
cfg = domainCommGroupService.get(Long.parseLong(ids));
initUpdateFormCondition(model,cfg);
List<CommonGroupInfo> groupInfos=commonGroupManageService.findCommonGroupInfosByType(Constants.DOMAIN_OBJ_GROUP_TYPE);
model.addAttribute("policyGroupInfos", groupInfos);
model.addAttribute("_cfg", cfg);
return "/basics/domainCommGroupFormUpdate";
}
@RequestMapping(value = {"/update"})
public String update(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")DomainCommCfg cfg,RedirectAttributes redirectAttributes){
try{
domainCommGroupService.update(cfg);
addMessage(redirectAttributes,"success","save_success");
}catch(Exception e){
logger.error("信息保存失败",e);
addMessage(redirectAttributes,"error","save_failed");
}
return "redirect:" + adminPath +"/basics/domain/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"/delete"})
public String delete(String groupIds, String ids, Integer functionId, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")DomainCommCfg cfg){
try{
domainCommGroupService.delete(ids, groupIds, cfg, request, response);
addMessage(redirectAttributes,"success","delete_success");
}catch(Exception e){
logger.error("Delete failed",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error",e.getMessage());
}else {
addMessage(redirectAttributes,"error","delete_failed");
}
}
return "redirect:" + adminPath +"/basics/domain/list?functionId="+functionId;
}
// 批量删除前获取提示信息
@ResponseBody
@RequestMapping(value="ajaxCheckIsLastOneCfgBatch",method=RequestMethod.POST)
public List<Integer> ajaxCheckIsLastOneCfgBatch(Model model, DomainCommCfg searchCfg){
return domainCommGroupService.ajaxCheckIsLastOneCfgBatch(searchCfg);
}
// 数据导入
@RequestMapping(value = "import", method=RequestMethod.POST)
public String importIp(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
@RequestParam("files") MultipartFile[] files, Integer serviceDictId ,Integer requestId ,String attribute ,String classify
,String regionDictIds ,String importPath) {
logger.warn("import start...");
long start=System.currentTimeMillis();
ImportBigExcel ei=null;
try {
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
StringBuffer errTip=new StringBuffer();
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
for (int i = 0; i < files.length; i++) {
MultipartFile file = files[i];
ei = new ImportBigExcel(file, 0, 1);
FunctionRegionDict regionDict = DictUtils.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
//加载模板
loadTemplate(ei,regionDict, serviceDict);
//------------------------------------check format start----------------------------
if (regionDict.getRegionType().equals(2)) {
BlockingQueue<DomainCommCfgTemplate> list = ei.getDataList(DomainCommCfgTemplate.class );
stringCfgs = this.checkStringCfgMulity(errTip, serviceDict, regionDict, list);
}
//删除文件
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
ei.getUploadFile().delete();
}
//------------------------------------check format end----------------------------
Date date = new Date();
//String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
if (regionDict.getRegionType().equals(2)) {
List<BaseStringCfg<?>> _stringCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
while(!stringCfgs.isEmpty()) {
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
List<Integer> regionIds = Lists.newArrayList(_stringCfgs.size());
try {
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
} catch (Exception e) {
logger.error("获取域ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
}
int index = 0;
Set<String> countSet = new HashSet<String>();
for (BaseStringCfg<?> cfg : _stringCfgs) {
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
cfg.setCfgType(regionDict.getConfigRegionValue());
cfg.setCreateTime(date);
cfg.setCreatorId(UserUtils.getUser().getId());
//cfg.setDoLog(2);
cfg.setCompileId(0);
cfg.setFunctionId(regionDict.getFunctionId());
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
cfg.setIsValid(Constants.VALID_NO);
cfg.setIsAreaEffective(0);
cfg.setLable("0");
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
cfg.setAttribute(attribute);
cfg.setClassify(classify);
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
cfg.setTableName("domain_comm_cfg");
cfg.setRegionId(regionIds.get(index));
cfg.setGroupName(cfg.getGroupName().toUpperCase());
countSet.add(cfg.getGroupName());
index++;
}
List<CommonGroupInfo> insertGroupList = new ArrayList<CommonGroupInfo>();
Map<String, Integer> groupIdMap = commonGroupManageService.getCountByGroupName(countSet, insertGroupList, Constants.DOMAIN_OBJ_GROUP_TYPE); // 调用服务接口获取GroupId
domainCommGroupService.saveAndSend(regionDict, serviceDict, _stringCfgs, groupIdMap, insertGroupList);
_stringCfgs.clear();
}
}
}
if(errTip.toString().length()>0) {
addMessage(redirectAttributes,"error", errTip.toString());
}
} catch (Exception e) {
if(ei!=null) {
if(ei.getUploadFile().exists()) {
ei.getUploadFile().delete();
}
}
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
}else if(e instanceof ServiceException) {
addMessage(redirectAttributes,"error", e.getMessage());
}else if(e instanceof IndexOutOfBoundsException){
addMessage(redirectAttributes,"error", "template_error");
}else {
addMessage(redirectAttributes,"error", "import_failed");
}
logger.error("import failed", e);
}
long end=System.currentTimeMillis();
logger.warn("import finish,cost:"+(end-start));
return "redirect:" + adminPath+ importPath;
}
// 数据导出
@RequestMapping(value = "/exportGroupInfo")
public void exportGroupInfo(Model model,HttpServletRequest request,HttpServletResponse response,
@ModelAttribute("cfg")DomainCommCfg entity,String ids,RedirectAttributes redirectAttributes){
try {
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>();
List<DomainCommCfg> list = new ArrayList<DomainCommCfg>();
if (!StringUtil.isEmpty(ids)) {
list = domainCommGroupService.findByPage(ids);
} else {
Page<DomainCommCfg> pageInfo=new Page<DomainCommCfg>(request, response,"r");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page<DomainCommCfg> page = domainCommGroupService.findPage(pageInfo, entity);
list=page.getList();
}
CommonGroupInfo groupInfo = new CommonGroupInfo();
for (DomainCommCfg cfg : list) {
groupInfo.setServiceGroupId(cfg.getGroupId());
CommonGroupInfo commonGroupInfo = commonGroupManageService.getGroupInfo(groupInfo);
cfg.setGroupName(commonGroupInfo.getGroupName());
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), DomainCommCfg.class);
String cfgIndexInfoNoExport=",block_type,do_log,action,letter,whether_area_block,classification,attribute,label"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,asn_no,"
+ "is_hex,is_case_insenstive,cfg_id,is_audit,auditor,valid_identifier,";
// 时间过滤
if (entity.getSearch_create_time_start() == null ) {
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_edit_time_start() == null) {
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_audit_time_start() == null) {
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
}
if (!StringUtil.isEmpty(entity.gethColumns())) {
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
}
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
dataMap.put(entity.getMenuNameCode(), list);
String timeRange = initTimeMap(entity);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(entity.getExType())) {
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
}
} catch (Exception e) {
logger.error("domainGroupConfig export failed",e);
addMessage(redirectAttributes,"error","export_failed");
}
}
}

View File

@@ -0,0 +1,326 @@
package com.nis.web.controller.basics;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jets3t.service.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
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.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.beust.jcommander.internal.Lists;
import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.basics.CommonGroupInfo;
import com.nis.domain.basics.IpCommCfg;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.template.IpCommCfgTemplate;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.StringUtil;
import com.nis.util.excel.ImportBigExcel;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
import com.nis.web.service.basics.IpCommGroupCfgService;
@Controller
@RequestMapping(value = "${adminPath}/basics/ip")
public class IpCommGroupController extends BaseController {
@Autowired
private IpCommGroupCfgService ipCommGroupCfgService;
@RequestMapping(value = { "/list" })
public String list(Model model, @ModelAttribute("cfg") IpCommCfg entity, HttpServletRequest request, HttpServletResponse response) {
Page<IpCommCfg> page = ipCommGroupCfgService.findPage(new Page<IpCommCfg>(request, response, "r"),entity);
List<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId());
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entity.getFunctionId());
List<CommonGroupInfo> policyGroupInfos=commonGroupManageService.findCommonGroupInfosByType(Constants.IP_OBJ_GROUP_TYPE);
model.addAttribute("page", page);
model.addAttribute("regionList", regionList);
model.addAttribute("serviceList", serviceList);
model.addAttribute("policyGroupInfos", policyGroupInfos);
return "/basics/ipCommonGroupCfgList";
}
@RequestMapping(value = { "/addForm" })
public String addForm(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response) {
cfg.setGroupType(5);
initFormCondition(model, cfg);
/*List<CommonGroupInfo> groupInfos=commonGroupManageService.findCommonGroupInfosByType(5);
model.addAttribute("policyGroupInfos", groupInfos);*/
model.addAttribute("_cfg", cfg);
return "/basics/ipCommGroupFormAdd";
}
@RequestMapping(value = { "/save" })
@RequiresPermissions(value = { "ip:common:config" })
public String save(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response) {
try {
ipCommGroupCfgService.saveIpCommGroupCfg(cfg);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
logger.error("信息保存失败", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", e.getMessage());
} else {
addMessage(redirectAttributes, "error", "save_failed");
}
}
return "redirect:" + adminPath + "/basics/ip/list?functionId=" + cfg.getFunctionId();
}
@RequestMapping(value = { "/updateForm" })
public String updateForm(Model model, @ModelAttribute("cfg") IpCommCfg cfg, RedirectAttributes redirectAttributes, String ids,
HttpServletRequest request, HttpServletResponse response) {
cfg = ipCommGroupCfgService.get(Long.parseLong(ids));
cfg.setGroupType(5);
initUpdateFormCondition(model, cfg);
List<CommonGroupInfo> groupInfos = commonGroupManageService.findCommonGroupInfosByType(Constants.IP_OBJ_GROUP_TYPE);
model.addAttribute("policyGroupInfos", groupInfos);
model.addAttribute("_cfg", cfg);
return "/basics/ipCommGroupFormUpdate";
}
@RequestMapping(value = { "/update" })
@RequiresPermissions(value = { "ip:common:config" })
public String update(Model model, @ModelAttribute("cfg") IpCommCfg cfg, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response) {
try {
ipCommGroupCfgService.update(cfg);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
logger.error("信息保存失败", e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/basics/ip/list?functionId=" + cfg.getFunctionId();
}
@RequestMapping(value = { "/delete" })
@RequiresPermissions(value = { "ip:common:config" })
public String delete(String groupIds, String ids, Integer functionId, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")IpCommCfg cfg) {
try {
ipCommGroupCfgService.delete(ids, groupIds, cfg, request, response);
addMessage(redirectAttributes, "success", "delete_success");
} catch (Exception e) {
logger.error("Delete failed", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", e.getMessage());
} else {
addMessage(redirectAttributes, "error", "delete_failed");
}
}
return "redirect:" + adminPath + "/basics/ip/list?functionId=" + functionId;
}
// 批量删除前获取提示信息
@ResponseBody
@RequestMapping(value="ajaxCheckIsLastOneCfgBatch",method=RequestMethod.POST)
public List<Integer> ajaxCheckIsLastOneCfgBatch(Model model, IpCommCfg searchCfg){
return ipCommGroupCfgService.ajaxCheckIsLastOneCfgBatch(searchCfg);
}
// 数据导出
@RequestMapping(value = "/exportIpComm")
public void exportIpCommonCfg(Model model, @ModelAttribute("cfg") IpCommCfg entity, String ids, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response) {
try {
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>();
List<IpCommCfg> list = new ArrayList<IpCommCfg>();
if (!StringUtil.isEmpty(ids)) {
list = ipCommGroupCfgService.findByPage(ids);
} else {
Page<IpCommCfg> pageInfo = new Page<IpCommCfg>(request, response, "r");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page<IpCommCfg> page = ipCommGroupCfgService.findPage(pageInfo, entity);
list = page.getList();
}
CommonGroupInfo groupInfo = new CommonGroupInfo();
for (IpCommCfg cfg : list) {
groupInfo.setServiceGroupId(cfg.getGroupId());
CommonGroupInfo commonGroupInfo = commonGroupManageService.getGroupInfo(groupInfo);
cfg.setGroupName(commonGroupInfo.getGroupName());
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), IpCommCfg.class);
String cfgIndexInfoNoExport = ",block_type,do_log,action"
+ ",letter,whether_area_block,classification,attribute,label,userregion1,userregion2,userregion3,userregion4,userregion5"
+ ",cfg_id,is_audit,auditor,valid_identifier,ir_type,";
// 时间过滤
if (entity.getSearch_create_time_start() == null) {
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_edit_time_start() == null) {
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_audit_time_start() == null) {
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
}
if (!StringUtil.isEmpty(entity.gethColumns())) {
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
}
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
dataMap.put(entity.getMenuNameCode(), list);
String timeRange = initTimeMap(entity);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(entity.getExType())) {
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
}
} catch (Exception e) {
logger.error("IpCommGroupCfg export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
}
}
// 数据导入
@RequestMapping(value = "import", method=RequestMethod.POST)
public String importIp(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
@RequestParam("files") MultipartFile[] files, Integer serviceDictId ,Integer requestId ,String attribute ,String classify
,String regionDictIds ,String importPath) {
logger.warn("import start...");
long start=System.currentTimeMillis();
ImportBigExcel ei=null;
try {
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
StringBuffer errTip=new StringBuffer();
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
for (int i = 0; i < files.length; i++) {
MultipartFile file = files[i];
ei = new ImportBigExcel(file, 0, 1);
FunctionRegionDict regionDict = DictUtils.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
//加载模板
loadTemplate(ei,regionDict, serviceDict);
//------------------------------------check format start----------------------------
if (regionDict.getRegionType().equals(1)) {// IP
BlockingQueue<IpCommCfgTemplate> list = ei.getDataList(IpCommCfgTemplate.class );
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
}
//删除文件
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
ei.getUploadFile().delete();
}
//------------------------------------check format end----------------------------
Date date = new Date();
//String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
if (regionDict.getRegionType().equals(1)) {// IP
List<BaseIpCfg> _ipPortCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
while(!ipPortCfgs.isEmpty()) {
ipPortCfgs.drainTo(_ipPortCfgs, Constants.MAAT_JSON_SEND_SIZE);
List<Integer> regionIds = Lists.newArrayList(_ipPortCfgs.size());
try {
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
} catch (Exception e) {
logger.error("获取域ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
}
int index = 0;
Set<String> countSet = new HashSet<String>();
for (BaseIpCfg cfg : _ipPortCfgs) {
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
cfg.setCfgType(regionDict.getConfigRegionValue());
cfg.setCreateTime(date);
cfg.setCreatorId(UserUtils.getUser().getId());
//cfg.setDoLog(2);
cfg.setCompileId(0);
cfg.setFunctionId(regionDict.getFunctionId());
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
cfg.setIsValid(Constants.VALID_NO);
cfg.setIsAreaEffective(0);
cfg.setLable("0");
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
cfg.setAttribute(attribute);
cfg.setClassify(classify);
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
cfg.setTableName("ip_comm_cfg");
cfg.setRegionId(regionIds.get(index));
cfg.setGroupName(cfg.getGroupName().toUpperCase());
countSet.add(cfg.getGroupName());
index++;
}
List<CommonGroupInfo> insertGroupList = new ArrayList<CommonGroupInfo>();
Map<String, Integer> groupIdMap = commonGroupManageService.getCountByGroupName(countSet, insertGroupList, Constants.IP_OBJ_GROUP_TYPE); // 调用服务接口获取GroupId
ipCommGroupCfgService.saveAndSend(regionDict, serviceDict, _ipPortCfgs, groupIdMap, insertGroupList);
_ipPortCfgs.clear();
}
}
}
if(errTip.toString().length()>0) {
addMessage(redirectAttributes,"error", errTip.toString());
}
} catch (Exception e) {
if(ei!=null) {
if(ei.getUploadFile().exists()) {
ei.getUploadFile().delete();
}
}
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
}else if(e instanceof ServiceException) {
addMessage(redirectAttributes,"error", e.getMessage());
}else if(e instanceof IndexOutOfBoundsException){
addMessage(redirectAttributes,"error", "template_error");
}else {
addMessage(redirectAttributes,"error", "import_failed");
}
logger.error("import failed", e);
}
long end=System.currentTimeMillis();
logger.warn("import finish,cost:"+(end-start));
return "redirect:" + adminPath+ importPath;
}
}

View File

@@ -0,0 +1,318 @@
package com.nis.web.controller.basics;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jets3t.service.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
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.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.beust.jcommander.internal.Lists;
import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.basics.CommonGroupInfo;
import com.nis.domain.basics.ScriberIdCommCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.template.ScriberIdCommCfgTemplate;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.StringUtil;
import com.nis.util.excel.ImportBigExcel;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
import com.nis.web.service.basics.ScriberIdCommGroupService;
@Controller
@RequestMapping(value = "${adminPath}/basics/scriberId")
public class ScriberIdCommGroupController extends BaseController{
@Autowired
private ScriberIdCommGroupService scriberIdCommGroupService;
@RequestMapping(value = {"/list"})
public String list(Model model, @ModelAttribute("cfg")ScriberIdCommCfg entity, HttpServletRequest request,HttpServletResponse response){
Page<ScriberIdCommCfg> page = scriberIdCommGroupService.findPage(new Page<ScriberIdCommCfg>(request, response,"r"), entity);
List<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId());
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entity.getFunctionId());
List<CommonGroupInfo> groupInfos = commonGroupManageService.findCommonGroupInfosByType(Constants.SUBID_OBJ_GROUP_TYPE);
model.addAttribute("page", page);
model.addAttribute("regionList", regionList);
model.addAttribute("serviceList", serviceList);
model.addAttribute("policyGroupInfos", groupInfos);
return "/basics/scriberidCommGroupList";
}
@RequestMapping(value = {"/addForm"})
public String addForm(Model model, @ModelAttribute("cfg")CfgIndexInfo cfg, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response){
initFormCondition(model,cfg);
/*List<CommonGroupInfo> groupInfos=commonGroupManageService.findCommonGroupInfosByType(Constants.SUBID_OBJ_GROUP_TYPE);
model.addAttribute("policyGroupInfos", groupInfos);*/
model.addAttribute("_cfg", cfg);
return "/basics/scriberidCommGroupFormAdd";
}
@RequestMapping(value = {"/save"})
public String save(Model model, @ModelAttribute("cfg")CfgIndexInfo cfg,RedirectAttributes redirectAttributes,
HttpServletRequest request,HttpServletResponse response){
try{
scriberIdCommGroupService.saveCommGroupCfg(cfg);
addMessage(redirectAttributes,"success","save_success");
}catch(Exception e){
logger.error("信息保存失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error",e.getMessage());
}else {
addMessage(redirectAttributes,"error","save_failed");
}
}
return "redirect:" + adminPath +"/basics/scriberId/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"/updateForm"})
public String updateForm(Model model,HttpServletRequest request
,HttpServletResponse response,String ids,@ModelAttribute("cfg")ScriberIdCommCfg cfg
,RedirectAttributes redirectAttributes){
cfg = scriberIdCommGroupService.get(Long.parseLong(ids));
initUpdateFormCondition(model,cfg);
List<CommonGroupInfo> groupInfos=commonGroupManageService.findCommonGroupInfosByType(Constants.SUBID_OBJ_GROUP_TYPE);
model.addAttribute("policyGroupInfos", groupInfos);
model.addAttribute("_cfg", cfg);
return "/basics/scriberidCommGroupFormUpdate";
}
@RequestMapping(value = {"/update"})
public String update(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")ScriberIdCommCfg cfg,RedirectAttributes redirectAttributes){
try{
scriberIdCommGroupService.update(cfg);
addMessage(redirectAttributes,"success","save_success");
}catch(Exception e){
logger.error("信息保存失败",e);
addMessage(redirectAttributes,"error","save_failed");
}
return "redirect:" + adminPath +"/basics/scriberId/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"/delete"})
public String delete(String groupIds, String ids, Integer functionId, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")ScriberIdCommCfg cfg){
try{
scriberIdCommGroupService.delete(ids, groupIds, cfg, request, response);
addMessage(redirectAttributes,"success","delete_success");
}catch(Exception e){
logger.error("Delete failed",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error",e.getMessage());
}else {
addMessage(redirectAttributes,"error","delete_failed");
}
}
return "redirect:" + adminPath +"/basics/scriberId/list?functionId="+functionId;
}
// 批量删除前获取提示信息
@ResponseBody
@RequestMapping(value="ajaxCheckIsLastOneCfgBatch",method=RequestMethod.POST)
public List<Integer> ajaxCheckIsLastOneCfgBatch(Model model, ScriberIdCommCfg searchCfg){
return scriberIdCommGroupService.ajaxCheckIsLastOneCfgBatch(searchCfg);
}
// 数据导入
@RequestMapping(value = "import", method=RequestMethod.POST)
public String importIp(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
@RequestParam("files") MultipartFile[] files, Integer serviceDictId ,Integer requestId ,String attribute ,String classify
,String regionDictIds ,String importPath) {
logger.warn("import start...");
long start=System.currentTimeMillis();
ImportBigExcel ei=null;
try {
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
StringBuffer errTip=new StringBuffer();
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
for (int i = 0; i < files.length; i++) {
MultipartFile file = files[i];
ei = new ImportBigExcel(file, 0, 1);
FunctionRegionDict regionDict = DictUtils.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
//加载模板
loadTemplate(ei,regionDict, serviceDict);
//------------------------------------check format start----------------------------
if (regionDict.getRegionType().equals(2)) {
BlockingQueue<ScriberIdCommCfgTemplate> list = ei.getDataList(ScriberIdCommCfgTemplate.class );
stringCfgs = this.checkStringCfgMulity(errTip, serviceDict, regionDict, list);
}
//删除文件
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
ei.getUploadFile().delete();
}
//------------------------------------check format end----------------------------
Date date = new Date();
//String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
if (regionDict.getRegionType().equals(2)) {
List<BaseStringCfg<?>> _stringCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
while(!stringCfgs.isEmpty()) {
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
List<Integer> regionIds = Lists.newArrayList(_stringCfgs.size());
try {
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
} catch (Exception e) {
logger.error("获取域ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
}
int index = 0;
Set<String> countSet = new HashSet<String>();
for (BaseStringCfg<?> cfg : _stringCfgs) {
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
cfg.setCfgType(regionDict.getConfigRegionValue());
cfg.setCreateTime(date);
cfg.setCreatorId(UserUtils.getUser().getId());
//cfg.setDoLog(2);
cfg.setCompileId(0);
cfg.setFunctionId(regionDict.getFunctionId());
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
cfg.setIsValid(Constants.VALID_NO);
cfg.setIsAreaEffective(0);
cfg.setLable("0");
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
cfg.setAttribute(attribute);
cfg.setClassify(classify);
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
cfg.setTableName("scriberid_comm_cfg");
cfg.setRegionId(regionIds.get(index));
cfg.setGroupName(cfg.getGroupName().toUpperCase());
countSet.add(cfg.getGroupName());
index++;
}
List<CommonGroupInfo> insertGroupList = new ArrayList<CommonGroupInfo>();
Map<String, Integer> groupIdMap = commonGroupManageService.getCountByGroupName(countSet, insertGroupList, Constants.SUBID_OBJ_GROUP_TYPE); // 调用服务接口获取GroupId
scriberIdCommGroupService.saveAndSend(regionDict, serviceDict, _stringCfgs, groupIdMap, insertGroupList);
_stringCfgs.clear();
}
}
}
if(errTip.toString().length()>0) {
addMessage(redirectAttributes,"error", errTip.toString());
}
} catch (Exception e) {
if(ei!=null) {
if(ei.getUploadFile().exists()) {
ei.getUploadFile().delete();
}
}
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
}else if(e instanceof ServiceException) {
addMessage(redirectAttributes,"error", e.getMessage());
}else if(e instanceof IndexOutOfBoundsException){
addMessage(redirectAttributes,"error", "template_error");
}else {
addMessage(redirectAttributes,"error", "import_failed");
}
logger.error("import failed", e);
}
long end=System.currentTimeMillis();
logger.warn("import finish,cost:"+(end-start));
return "redirect:" + adminPath+ importPath;
}
// 数据导出
@RequestMapping(value = "/exportGroupInfo")
public void exportGroupInfo(Model model,HttpServletRequest request,HttpServletResponse response,
@ModelAttribute("cfg")ScriberIdCommCfg entity,String ids,RedirectAttributes redirectAttributes){
try {
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>();
List<ScriberIdCommCfg> list = new ArrayList<ScriberIdCommCfg>();
if (!StringUtil.isEmpty(ids)) {
list = scriberIdCommGroupService.findByPage(ids);
} else {
Page<ScriberIdCommCfg> pageInfo=new Page<ScriberIdCommCfg>(request, response,"r");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page<ScriberIdCommCfg> page = scriberIdCommGroupService.findPage(pageInfo, entity);
list=page.getList();
}
CommonGroupInfo groupInfo = new CommonGroupInfo();
for (ScriberIdCommCfg cfg : list) {
groupInfo.setServiceGroupId(cfg.getGroupId());
CommonGroupInfo commonGroupInfo = commonGroupManageService.getGroupInfo(groupInfo);
cfg.setGroupName(commonGroupInfo.getGroupName());
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), ScriberIdCommCfg.class);
String cfgIndexInfoNoExport=",block_type,do_log,action,letter,whether_area_block,classification,attribute,label"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,asn_no,"
+ "is_hex,is_case_insenstive,cfg_id,is_audit,auditor,valid_identifier,";
// 时间过滤
if (entity.getSearch_create_time_start() == null ) {
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_edit_time_start() == null) {
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_audit_time_start() == null) {
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
}
if (!StringUtil.isEmpty(entity.gethColumns())) {
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
}
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
dataMap.put(entity.getMenuNameCode(), list);
String timeRange = initTimeMap(entity);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(entity.getExType())) {
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
}
} catch (Exception e) {
logger.error("scriberidGroupConfig export failed",e);
addMessage(redirectAttributes,"error","export_failed");
}
}
}

View File

@@ -0,0 +1,318 @@
package com.nis.web.controller.basics;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jets3t.service.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
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.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.beust.jcommander.internal.Lists;
import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.basics.CommonGroupInfo;
import com.nis.domain.basics.UrlCommCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.template.UrlCommCfgTemplate;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.StringUtil;
import com.nis.util.excel.ImportBigExcel;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
import com.nis.web.service.basics.UrlCommGroupService;
@Controller
@RequestMapping(value = "${adminPath}/basics/url")
public class UrlCommGroupController extends BaseController{
@Autowired
private UrlCommGroupService urlCommGroupService;
@RequestMapping(value = {"/list"})
public String list(Model model, @ModelAttribute("cfg")UrlCommCfg entity, HttpServletRequest request,HttpServletResponse response){
Page<UrlCommCfg> page = urlCommGroupService.findPage(new Page<UrlCommCfg>(request, response,"r"), entity);
List<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId());
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entity.getFunctionId());
List<CommonGroupInfo> groupInfos = commonGroupManageService.findCommonGroupInfosByType(Constants.URL_OBJ_GROUP_TYPE);
model.addAttribute("page", page);
model.addAttribute("regionList", regionList);
model.addAttribute("serviceList", serviceList);
model.addAttribute("policyGroupInfos", groupInfos);
return "/basics/urlCommGroupList";
}
@RequestMapping(value = {"/addForm"})
public String addForm(Model model, @ModelAttribute("cfg")CfgIndexInfo cfg, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response){
initFormCondition(model,cfg);
/*List<CommonGroupInfo> groupInfos=commonGroupManageService.findCommonGroupInfosByType(Constants.URL_OBJ_GROUP_TYPE);
model.addAttribute("policyGroupInfos", groupInfos);*/
model.addAttribute("_cfg", cfg);
return "/basics/urlCommGroupFormAdd";
}
@RequestMapping(value = {"/save"})
public String save(Model model, @ModelAttribute("cfg")CfgIndexInfo cfg,RedirectAttributes redirectAttributes,
HttpServletRequest request,HttpServletResponse response){
try{
urlCommGroupService.saveUrlCommGroupCfg(cfg);
addMessage(redirectAttributes,"success","save_success");
}catch(Exception e){
logger.error("信息保存失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error",e.getMessage());
}else {
addMessage(redirectAttributes,"error","save_failed");
}
}
return "redirect:" + adminPath +"/basics/url/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"/updateForm"})
public String updateForm(Model model,HttpServletRequest request
,HttpServletResponse response,String ids,@ModelAttribute("cfg")UrlCommCfg cfg
,RedirectAttributes redirectAttributes){
cfg = urlCommGroupService.get(Long.parseLong(ids));
initUpdateFormCondition(model,cfg);
List<CommonGroupInfo> groupInfos=commonGroupManageService.findCommonGroupInfosByType(Constants.URL_OBJ_GROUP_TYPE);
model.addAttribute("policyGroupInfos", groupInfos);
model.addAttribute("_cfg", cfg);
return "/basics/urlCommGroupFormUpdate";
}
@RequestMapping(value = {"/update"})
public String update(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")UrlCommCfg cfg,RedirectAttributes redirectAttributes){
try{
urlCommGroupService.update(cfg);
addMessage(redirectAttributes,"success","save_success");
}catch(Exception e){
logger.error("信息保存失败",e);
addMessage(redirectAttributes,"error","save_failed");
}
return "redirect:" + adminPath +"/basics/url/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"/delete"})
public String delete(String groupIds, String ids, Integer functionId, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")UrlCommCfg cfg){
try{
urlCommGroupService.delete(ids, groupIds, cfg, request, response);
addMessage(redirectAttributes,"success","delete_success");
}catch(Exception e){
logger.error("Delete failed",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error",e.getMessage());
}else {
addMessage(redirectAttributes,"error","delete_failed");
}
}
return "redirect:" + adminPath +"/basics/url/list?functionId="+functionId;
}
// 批量删除前获取提示信息
@ResponseBody
@RequestMapping(value="ajaxCheckIsLastOneCfgBatch",method=RequestMethod.POST)
public List<Integer> ajaxCheckIsLastOneCfgBatch(Model model, UrlCommCfg searchCfg){
return urlCommGroupService.ajaxCheckIsLastOneCfgBatch(searchCfg);
}
// 数据导入
@RequestMapping(value = "import", method=RequestMethod.POST)
public String importIp(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
@RequestParam("files") MultipartFile[] files, Integer serviceDictId ,Integer requestId ,String attribute ,String classify
,String regionDictIds ,String importPath) {
logger.warn("import start...");
long start=System.currentTimeMillis();
ImportBigExcel ei=null;
try {
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
StringBuffer errTip=new StringBuffer();
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
for (int i = 0; i < files.length; i++) {
MultipartFile file = files[i];
ei = new ImportBigExcel(file, 0, 1);
FunctionRegionDict regionDict = DictUtils.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
//加载模板
loadTemplate(ei,regionDict, serviceDict);
//------------------------------------check format start----------------------------
if (regionDict.getRegionType().equals(2)) {
BlockingQueue<UrlCommCfgTemplate> list = ei.getDataList(UrlCommCfgTemplate.class );
stringCfgs = this.checkStringCfgMulity(errTip, serviceDict, regionDict, list);
}
//删除文件
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
ei.getUploadFile().delete();
}
//------------------------------------check format end----------------------------
Date date = new Date();
//String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
if (regionDict.getRegionType().equals(2)) {
List<BaseStringCfg<?>> _stringCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
while(!stringCfgs.isEmpty()) {
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
List<Integer> regionIds = Lists.newArrayList(_stringCfgs.size());
try {
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
} catch (Exception e) {
logger.error("获取域ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
}
int index = 0;
Set<String> countSet = new HashSet<String>();
for (BaseStringCfg<?> cfg : _stringCfgs) {
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
cfg.setCfgType(regionDict.getConfigRegionValue());
cfg.setCreateTime(date);
cfg.setCreatorId(UserUtils.getUser().getId());
//cfg.setDoLog(2);
cfg.setCompileId(0);
cfg.setFunctionId(regionDict.getFunctionId());
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
cfg.setIsValid(Constants.VALID_NO);
cfg.setIsAreaEffective(0);
cfg.setLable("0");
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
cfg.setAttribute(attribute);
cfg.setClassify(classify);
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
cfg.setTableName("url_comm_cfg");
cfg.setRegionId(regionIds.get(index));
cfg.setGroupName(cfg.getGroupName().toUpperCase());
countSet.add(cfg.getGroupName());
index++;
}
List<CommonGroupInfo> insertGroupList = new ArrayList<CommonGroupInfo>();
Map<String, Integer> groupIdMap = commonGroupManageService.getCountByGroupName(countSet, insertGroupList, Constants.URL_OBJ_GROUP_TYPE); // 调用服务接口获取GroupId
urlCommGroupService.saveAndSend(regionDict, serviceDict, _stringCfgs, groupIdMap, insertGroupList);
_stringCfgs.clear();
}
}
}
if(errTip.toString().length()>0) {
addMessage(redirectAttributes,"error", errTip.toString());
}
} catch (Exception e) {
if(ei!=null) {
if(ei.getUploadFile().exists()) {
ei.getUploadFile().delete();
}
}
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
}else if(e instanceof ServiceException) {
addMessage(redirectAttributes,"error", e.getMessage());
}else if(e instanceof IndexOutOfBoundsException){
addMessage(redirectAttributes,"error", "template_error");
}else {
addMessage(redirectAttributes,"error", "import_failed");
}
logger.error("import failed", e);
}
long end=System.currentTimeMillis();
logger.warn("import finish,cost:"+(end-start));
return "redirect:" + adminPath+ importPath;
}
// 数据导出
@RequestMapping(value = "/exportUrlComm")
public void exportUrlComm(Model model,HttpServletRequest request,HttpServletResponse response,
@ModelAttribute("cfg")UrlCommCfg entity,String ids,RedirectAttributes redirectAttributes){
try {
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>();
List<UrlCommCfg> list = new ArrayList<UrlCommCfg>();
if (!StringUtil.isEmpty(ids)) {
list = urlCommGroupService.findByPage(ids);
} else {
Page<UrlCommCfg> pageInfo=new Page<UrlCommCfg>(request, response,"r");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page<UrlCommCfg> page = urlCommGroupService.findPage(pageInfo, entity);
list=page.getList();
}
CommonGroupInfo groupInfo = new CommonGroupInfo();
for (UrlCommCfg cfg : list) {
groupInfo.setServiceGroupId(cfg.getGroupId());
CommonGroupInfo commonGroupInfo = commonGroupManageService.getGroupInfo(groupInfo);
cfg.setGroupName(commonGroupInfo.getGroupName());
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), UrlCommCfg.class);
String cfgIndexInfoNoExport=",block_type,do_log,action,letter,whether_area_block,classification,attribute,label"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,asn_no,"
+ "is_hex,is_case_insenstive,cfg_id,is_audit,auditor,valid_identifier,";
// 时间过滤
if (entity.getSearch_create_time_start() == null ) {
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_edit_time_start() == null) {
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_audit_time_start() == null) {
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
}
if (!StringUtil.isEmpty(entity.gethColumns())) {
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
}
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
dataMap.put(entity.getMenuNameCode(), list);
String timeRange = initTimeMap(entity);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(entity.getExType())) {
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
}
} catch (Exception e) {
logger.error("urlGroupConfig export failed",e);
addMessage(redirectAttributes,"error","export_failed");
}
}
}

View File

@@ -1262,7 +1262,13 @@ public class AppCfgController extends BaseController {
entity.setAppCode(specificService.getSpecServiceCode()); entity.setAppCode(specificService.getSpecServiceCode());
} }
appCfgService.saveOrUpdateAppSslCfg(entity); appCfgService.saveOrUpdateAppSslCfg(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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
logger.error("saveAppSslCfg failed", e); logger.error("saveAppSslCfg failed", e);

View File

@@ -56,7 +56,7 @@ public class ConfigSynchronizationController extends BaseController {
Map<String,Integer> map = new HashMap(); Map<String,Integer> map = new HashMap();
map.put("syncStatus", cmd); map.put("syncStatus", cmd);
JSONObject result = ConfigServiceUtil.configSyncCmd(BaseService.gsonToJson(map)); JSONObject result = ConfigServiceUtil.configSyncCmd(BaseService.gsonToJson(map));
//JSONObject result=JSONObject.fromObject("{\"status\": 201,\"businessCode\": 2001000,\"reason\":\"数据获取操作成功\",\"msg\": \"根据配置id获取对应的编译,组,域等信息成功\",\"fromuri\": \"/galaxy-service/service/cfg/v1/getAllKVByCompileId\",\"traceCode\": \"2019031211285044813363\",\"data\": [{\"service\":\"ntc\",\"status\":0,\"opTime\":\"2016-11-22 08:31:27\"}]}"); // JSONObject result=JSONObject.fromObject("{\"status\": 201,\"businessCode\": 2001000,\"reason\":\"数据获取操作成功\",\"msg\": \"根据配置id获取对应的编译,组,域等信息成功\",\"fromuri\": \"/galaxy-service/service/cfg/v1/getAllKVByCompileId\",\"traceCode\": \"2019031211285044813363\",\"data\": [{\"service\":\"ntc\",\"status\":0,\"opTime\":\"2016-11-22 08:31:27\"}]}");
if(result.get("status").equals(201)){//响应成功 if(result.get("status").equals(201)){//响应成功
if(cmd.equals(1)){//同步 if(cmd.equals(1)){//同步
SysDataDictionaryName sysDictName = new SysDataDictionaryName(); SysDataDictionaryName sysDictName = new SysDataDictionaryName();

View File

@@ -0,0 +1,617 @@
package com.nis.web.controller.configuration;
import com.nis.domain.Page;
import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.domain.configuration.BaseCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.ObjGroupCfg;
import com.nis.exceptions.CallExternalProceduresException;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.*;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
@Controller
@RequestMapping("${adminPath}/objgroup")
public class ObjectGroupController extends BaseController {
@RequestMapping(value = { "/list" })
public String list(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, HttpServletRequest request,
HttpServletResponse response,String tip){
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
Page<CfgIndexInfo> page = objectGroupService.getPolicyListList(searchPage, cfg);
model.addAttribute("page", page);
if(StringUtils.isNotBlank(tip)){
addMessage("error",model,tip);
}
initPageCondition(model,cfg);
return "/cfg/objgroup/list";
}
@RequestMapping(value = { "/form" })
@RequiresPermissions(value = { "objgroup:config" })
public String form(Model model, String ids, CfgIndexInfo entity) {
List<PolicyGroupInfo> ipGroups=new ArrayList<>();
List<PolicyGroupInfo> urlGroups=new ArrayList<>();
List<PolicyGroupInfo> subscribeIdGroups=new ArrayList<>();
List<PolicyGroupInfo> domainGroups=new ArrayList<>();
//查询所有可选择没有被其他配置引用并且组下有域配置的组ud_flag=1
ipGroups=policyGroupInfoService.findPolicyGroupInfosByTypeforUD(Constants.IP_OBJ_GROUP_TYPE,1);
urlGroups=policyGroupInfoService.findPolicyGroupInfosByTypeforUD(Constants.URL_OBJ_GROUP_TYPE,1);
subscribeIdGroups=policyGroupInfoService.findPolicyGroupInfosByTypeforUD(Constants.SUBID_OBJ_GROUP_TYPE,1);
domainGroups=policyGroupInfoService.findPolicyGroupInfosByTypeforUD(Constants.DOMAIN_OBJ_GROUP_TYPE,1);
if (StringUtils.isNotBlank(ids)) {
entity = objectGroupService.getObjectGroupCfg(Long.parseLong(ids), null);
initUpdateFormCondition(model, entity);
//查询配置引用到的分组,加到对应的组下(维持选中选项)
if(MapUtils.isNotEmpty(entity.getUserRegion())){
for(Map.Entry<String,Object> e:entity.getUserRegion().entrySet()){
if(e.getKey().equals("ipGroup")&&StringUtils.isNotBlank(e.getValue().toString())){
List<PolicyGroupInfo> _ipGrpups=policyGroupInfoService.findPolicyByServiceGroupInfoList(e.getValue().toString());
if(CollectionUtils.isNotEmpty(_ipGrpups)){
ipGroups.addAll(_ipGrpups);
}
}else if(e.getKey().equals("urlGroup")&&StringUtils.isNotBlank(e.getValue().toString())){
List<PolicyGroupInfo> _urlGrpups=policyGroupInfoService.findPolicyByServiceGroupInfoList(e.getValue().toString());
if(CollectionUtils.isNotEmpty(_urlGrpups)){
urlGroups.addAll(_urlGrpups);
}
}else if(e.getKey().equals("subscribeIdGroup")&&StringUtils.isNotBlank(e.getValue().toString())){
List<PolicyGroupInfo> _subscribeIdGroups=policyGroupInfoService.findPolicyByServiceGroupInfoList(e.getValue().toString());
if(CollectionUtils.isNotEmpty(_subscribeIdGroups)){
subscribeIdGroups.addAll(_subscribeIdGroups);
}
}else if(e.getKey().equals("domainGroup")&&StringUtils.isNotBlank(e.getValue().toString())){
List<PolicyGroupInfo> _domainGroups=policyGroupInfoService.findPolicyByServiceGroupInfoList(e.getValue().toString());
if(CollectionUtils.isNotEmpty(_domainGroups)){
domainGroups.addAll(_domainGroups);
}
}
}
}
} else {
initFormCondition(model, entity);
}
model.addAttribute("ipGroups", ipGroups);
model.addAttribute("urlGroups", urlGroups);
model.addAttribute("subscribeIdGroups", subscribeIdGroups);
model.addAttribute("domainGroups", domainGroups);
model.addAttribute("_cfg", entity);
return "/cfg/objgroup/form";
}
@RequestMapping(value = {"saveOrUpdate"})
@RequiresPermissions(value={"objgroup:config"})
public String saveOrUpdate(Model model, HttpServletRequest request, HttpServletResponse response,
@ModelAttribute("cfg")CfgIndexInfo cfg, RedirectAttributes redirectAttributes){
try{
String ipGroup=formatMultSelect(request.getParameterValues("ipGroup")),
subscribeIdGroup=formatMultSelect(request.getParameterValues("subscribeIdGroup")),
domainGroup=formatMultSelect(request.getParameterValues("domainGroup")),
urlGroup=formatMultSelect(request.getParameterValues("urlGroup"));
Map<String,Object> map = new HashMap();
if(StringUtils.isNotBlank(ipGroup)&&StringUtils.isNotBlank(ipGroup.replaceAll(",",""))){
map.put("ipGroup", ipGroup);
}
if(StringUtils.isNotBlank(subscribeIdGroup)&&StringUtils.isNotBlank(subscribeIdGroup.replaceAll(",",""))){
map.put("subscribeIdGroup", subscribeIdGroup);
}
if(StringUtils.isNotBlank(domainGroup)&&StringUtils.isNotBlank(domainGroup.replaceAll(",",""))){
map.put("domainGroup", domainGroup);
}
if(StringUtils.isNotBlank(urlGroup)&&StringUtils.isNotBlank(urlGroup.replaceAll(",",""))){
map.put("urlGroup", urlGroup);
}
cfg.setUserRegion(map);
objectGroupService.saveOrUpdate(cfg);
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.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 +"/objgroup/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"updateValid"})
@RequiresPermissions(value={"objgroup:config"})
public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg){
try {
if (!StringUtil.isEmpty(ids)) {
objectGroupService.updatePolicyValid(isValid,ids,functionId);
}else {
// 批量删除
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
addMessage(redirectAttributes, "success", "delete_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", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath +"/objgroup/list?functionId="+functionId;
}
/**
* 界面批量删除当前检索条件下的配置
* @param page
* @param functionId
* @param entity
* @throws Exception
*/
public void deleteAll(Page page,Integer functionId, Object entity)throws Exception {
long start=System.currentTimeMillis();
page.setOrderBy("");
page.setPageSize(Constants.MAAT_JSON_SEND_SIZE);
page.setPageNo(1);
page.setLastPage(false);
CfgIndexInfo searchCfg = new CfgIndexInfo();
// 传递检索条件
if(entity != null && (entity instanceof CfgIndexInfo)) {
BeanUtils.copyProperties(entity, searchCfg);
searchCfg.setFunctionId(functionId);
}
BaseCfg batchCfg = new BaseCfg();
batchCfg.setTableName(CfgIndexInfo.getTablename());
batchCfg.setIsValid(-1);
batchCfg.setIsAudit(0);
batchCfg.setEditTime(new Date());
batchCfg.setEditorId(UserUtils.getUser().getId());
//cfg_index_info表中存有servicdId
boolean hasData = true;
while(hasData){
page.setPageNo(1);
page.setLastPage(false);
List<CfgIndexInfo> list = getDataList(page,searchCfg); //获取主配置表数据
if(CollectionUtils.isNotEmpty(list)){
StringBuffer serviceGroupIds=new StringBuffer();
List<BaseCfg> baseCfgList=new ArrayList<>();
for (CfgIndexInfo cfg : list) {
if(cfg.getUserRegion()!=null){
for (Object val:cfg.getUserRegion().values()) {
if(StringUtils.isNotBlank(val.toString())){
if(val.toString().startsWith(",")){
serviceGroupIds.append(val.toString().substring(1));
}else{
serviceGroupIds.append(val.toString());
}
}
}
}
BaseCfg baseCfg=new BaseCfg();
BeanUtils.copyProperties(cfg, baseCfg);
baseCfgList.add(baseCfg);
}
if(StringUtils.isNotBlank(serviceGroupIds)&&serviceGroupIds.lastIndexOf(",")==(serviceGroupIds.toString().length()-1)){
serviceGroupIds.deleteCharAt(serviceGroupIds.toString().length()-1);
}
hasData = objectGroupService.batchDeleteMaatData(page, batchCfg, baseCfgList, hasData,serviceGroupIds.toString());
}else{
hasData = false;
}
}
long end=System.currentTimeMillis();
logger.warn("配置批量删除耗时:"+(end-start));
}
public List getDataList(Page searchPage
,CfgIndexInfo searchCfg
){
BaseCfg baseCfg=new BaseCfg<>();
if(!StringUtil.isEmpty(searchCfg)) {
BeanUtils.copyProperties(searchCfg, baseCfg);
}
Page pageResult=new Page();
pageResult=objectGroupService.getPolicyListList(searchPage,searchCfg);
return pageResult.getList();
}
@RequestMapping(value = {"audit"})
@RequiresPermissions(value={"objgroup:confirm"})
public String audit(Model model,@ModelAttribute("cfg") CfgIndexInfo cfg,
Integer isValid,
Integer isAudit,
String ids,
Integer functionId,
RedirectAttributes redirectAttributes,
HttpServletResponse response,
HttpServletRequest request) {
Properties props=this.getMsgProp();
if(!StringUtil.isEmpty(ids)){
CfgIndexInfo entity = new CfgIndexInfo();
String[] idArray = ids.split(",");
StringBuffer tip=new StringBuffer();
for(String id :idArray){
entity = objectGroupService.getObjectGroupCfg(Long.parseLong(id),null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
if(StringUtils.isBlank(entity.getCommonGroupIds())){
tip.append(String.format(props.getProperty("no_common_group","The configuration ID of %s does not have an group;"),entity.getCompileId()));
tip.append("<br/>");
}else{
objectGroupService.auditPolicy(entity,isAudit,Constants.INSERT_ACTION);
}
if(tip.toString().length()>0){
addMessage(redirectAttributes,"error", tip.toString());
}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","audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}
}else {
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"r");
Page<CfgIndexInfo> auditPage=new Page<CfgIndexInfo>(request,response,"r");
String tip=null;
try {
BeanUtils.copyProperties(searchPage, auditPage);
tip= auditAll(auditPage,isValid , cfg,props);
if(tip.toString().length()>0){
addMessage(redirectAttributes,"error", tip.toString());
}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", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
//无法保存状态
return list(model, cfg, request, response,tip);
}
return "redirect:" + adminPath +"/objgroup/list?functionId="+functionId;
}
private String formatMultSelect(Object requestParameter){
if(StringUtil.isEmpty(requestParameter)){
return null;
}else if(requestParameter.getClass().isArray()){
String[] array=(String[])requestParameter;
StringBuffer buf=new StringBuffer(",");
for(String param:array){
buf.append(param).append(",");
}
return buf.toString().length()==1?null:buf.toString();
}else{
return ","+requestParameter.toString()+",";
}
}
@RequestMapping(value = { "/ajaxGetNames" })
@ResponseBody
public Map<String,Map<String,String>> ajaxGetNames(Model model, @RequestParam(required=true,value="groupIds")String group) {
String _group=group.replaceAll("\\|",",");
Map<String,Map<String,String>> datas=new HashMap<>();
datas.put("ipGroup",new HashMap<String,String>());
datas.put("urlGroup",new HashMap<String,String>());
datas.put("subscribeIdGroup",new HashMap<String,String>());
datas.put("domainGroup",new HashMap<String,String>());
if(StringUtils.isNotBlank(group)){
List<PolicyGroupInfo> infos=policyGroupInfoService.findPolicyByServiceGroupInfoList(_group);
for(PolicyGroupInfo info:infos){
for(String g:group.split("\\|")){
if(objectGroupService.indexOfContains(g,",",info.getServiceGroupId().toString())){
Map<String,String> map=null;
if(info.getGroupType().equals(Constants.IP_OBJ_GROUP_TYPE)){
map=datas.get("ipGroup");
}else if(info.getGroupType().equals(Constants.URL_OBJ_GROUP_TYPE)){
map=datas.get("urlGroup");
}else if(info.getGroupType().equals(Constants.SUBID_OBJ_GROUP_TYPE)){
map=datas.get("subscribeIdGroup");
}else if(info.getGroupType().equals(Constants.DOMAIN_OBJ_GROUP_TYPE)){
map=datas.get("domainGroup");
}
map.put(g,map.containsKey(g)?map.get(g)+info.getGroupName()+",":info.getGroupName()+",");
}
}
}
}
//删除最后的逗号
for(Map<String,String> m:datas.values()){
for(Map.Entry<String,String> e:m.entrySet()){
if(e.getValue().endsWith(",")){
m.put(e.getKey(),e.getValue().substring(0,e.getValue().length()-1));
}
}
}
return datas;
}
//http配置导出
@RequestMapping(value = "exportObjGroup")
public void exportdomain(Model model, HttpServletRequest request, HttpServletResponse response,
@ModelAttribute("cfg") ObjGroupCfg entity, String ids, 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>();
List<ObjGroupCfg> lists = new ArrayList<ObjGroupCfg>();
Properties msgProp = getMsgProp();
// 导出选中记录
if (!StringUtil.isEmpty(ids)) {
lists = objectGroupService.getObjGroupList(ids,msgProp,entity.getFunctionId());
} else {
Page<ObjGroupCfg> pageInfo=new Page<ObjGroupCfg>(request, response,"a");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page<ObjGroupCfg> page = objectGroupService.getObjGroup(pageInfo, entity,msgProp);
lists = page.getList();
}
for(ObjGroupCfg c:lists){
if(StringUtils.isNotBlank(c.getIpGroup())&&c.getIpGroup().startsWith(",")){
c.setIpGroup(c.getIpGroup().substring(1));
}
if(StringUtils.isNotBlank(c.getUrlGroup())&&c.getUrlGroup().startsWith(",")){
c.setUrlGroup(c.getUrlGroup().substring(1));
}
if(StringUtils.isNotBlank(c.getSubscribeIdGroup())&&c.getSubscribeIdGroup().startsWith(",")){
c.setSubscribeIdGroup(c.getSubscribeIdGroup().substring(1));
}
if(StringUtils.isNotBlank(c.getDomainGroup())&&c.getDomainGroup().startsWith(",")){
c.setDomainGroup(c.getDomainGroup().substring(1));
}
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), ObjGroupCfg.class);
String cfgIndexInfoNoExport=",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
// 时间过滤
if (entity.getSearch_create_time_start() == null) {
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_edit_time_start() == null) {
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_audit_time_start() == null) {
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
}
if (!StringUtil.isEmpty(entity.gethColumns())) {
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
}
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
dataMap.put(entity.getMenuNameCode(), lists);
String timeRange = initTimeMap(entity);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(entity.getExType())) {
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
}
} catch (Exception e) {
logger.error("Obj group export failed",e);
addMessage(redirectAttributes,"error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
/**
* 批量审核
* @param page
* @param auditType
* @param entity
* @return
*/
public String auditAll(Page page,Integer auditType,CfgIndexInfo entity,Properties props)throws Exception {
StringBuffer tip=new StringBuffer();
long start=System.currentTimeMillis();
page.setOrderBy("");
page.setPageSize(Constants.MAAT_JSON_SEND_SIZE);
page.setPageNo(1);
page.setLastPage(false);
//携带审核状态信息的BaseCfg
BaseCfg auditBatchCfg=new BaseCfg();
//携带审核条件的BaseCfg
CfgIndexInfo searchCfg=new CfgIndexInfo();
if(entity != null && (entity instanceof CfgIndexInfo)) {
BeanUtils.copyProperties(entity, auditBatchCfg);
BeanUtils.copyProperties(entity, searchCfg);
}
auditType = (Integer)Reflections.invokeGetter(entity, "isAudit");
//全部审核通过,只查询当前条件下的所有未审核的配置 -批量审核通过/不通过
if(auditType.equals(1) || auditType.equals(2)) {
if(auditType.equals(1)) {
auditBatchCfg.setIsAudit(1);
auditBatchCfg.setIsValid(1);
}else {
auditBatchCfg.setIsAudit(2);
auditBatchCfg.setIsValid(0);
}
auditBatchCfg.setAuditTime(new Date());
auditBatchCfg.setAuditorId(UserUtils.getUser().getId());
}else {
auditBatchCfg.setIsAudit(3);
auditBatchCfg.setIsValid(0);
auditBatchCfg.setAuditTime(new Date());
auditBatchCfg.setAuditorId(UserUtils.getUser().getId());
}
ServiceConfigTemplateUtil serviceTemplate = new ServiceConfigTemplateUtil();
Integer functionId=0;
if(auditBatchCfg != null && !StringUtil.isEmpty(auditBatchCfg.getFunctionId())) {
functionId=auditBatchCfg.getFunctionId();
}
List<Map<String,Object>> serviceList = serviceTemplate.getServiceListByFunctionId(functionId);
for(Map<String,Object> service:serviceList){
String tableNameXml = service.get("tableName").toString(); // 获取业务主配置表
String serviceTypeXml = service.get("serviceType").toString(); // 业务类型 1maat 2callback
String classNameXml = service.get("className").toString(); // 主配置Java类
String serviceIdXml = service.get("id").toString(); // service字典表 service_id字段
String serviceIds=service.get("serviceIds").toString();
auditBatchCfg.setServiceId(Integer.valueOf(serviceIdXml));
auditBatchCfg.setTableName(tableNameXml);
//searchCfg.setServiceId(Integer.valueOf(serviceIdXml));
searchCfg.setTableName(tableNameXml);
if("1".equals(serviceTypeXml)){//maat类配置
if(StringUtils.isNotBlank(serviceIds)) {//公共分组
// 存放域配置类型 及 对应表名
Map<Integer,List<Map<String,Object>>> childrenCfgMap=new HashMap<>();
Map<Integer,List<Map<String,Object>>> childrenUserRegionMap=new HashMap<>();
for(String _serviceId:serviceIds.split(",")){
if(StringUtils.isNotBlank(_serviceId)){
Map<String,Object> subService=serviceTemplate.getServiceListByServiceId(Integer.parseInt(_serviceId)).get(0);
childrenCfgMap.put(Integer.parseInt(_serviceId),(List<Map<String,Object>>)subService.get("cfgList"));
}
}
if(childrenCfgMap.size()>0){
for(Map.Entry e:childrenCfgMap.entrySet()){
boolean hasData = true;
while(hasData){
page.setPageNo(1);
page.setLastPage(false);
searchCfg.setServiceId(Integer.parseInt(e.getKey().toString()));
auditBatchCfg.setServiceId(Integer.parseInt(e.getKey().toString()));
List<CfgIndexInfo> list = getDataList(page,searchCfg,null,null,null); // 通过ServiceId获取cfg_index_info主配置表数据
for(CfgIndexInfo info:list){
if(StringUtils.isBlank(info.getCommonGroupIds())){
tip.append(String.format(props.getProperty("no_common_group","The configuration ID of %s does not have an group;"),info.getCompileId()));
tip.append("<br/>");
}
}
if(!StringUtil.isEmpty(list)){
//配置生效处理 复用全量下发
if(auditBatchCfg.getIsAudit().equals(1)) {
hasData = configSynchronizationService.auditObjGroupListMaatData(childrenCfgMap,childrenUserRegionMap,page,auditBatchCfg,list,hasData,true);
}else {
List<BaseCfg> BaseCfgList=new ArrayList<>();
if(!StringUtil.isEmpty(list)) {
for (CfgIndexInfo cfg : list) {
BaseCfg baseCfg=new BaseCfg();
BeanUtils.copyProperties(cfg, baseCfg);
BaseCfgList.add(baseCfg);
}
}
if(auditBatchCfg.getIsAudit().equals(2)) {// 配置批量审核不通过
hasData = commonPolicyService.batchUnApproveObjGroupListatData(page, auditBatchCfg, BaseCfgList, hasData);
}else {// 配置失效处理 批量处理
hasData = commonPolicyService.auditObjGroupListMaatData(tableNameXml, page, auditBatchCfg, BaseCfgList, hasData);
}
}
}else{
hasData = false;
}
}
}
}
}
}
}
//批量审核通过时如果没有携带isValid检索条件返回界面需要将isValid置为null
if(!StringUtil.isEmpty(entity)) {
BaseCfg base=(BaseCfg)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));
return tip.toString();
}
@RequestMapping(value = { "ajaxSubList"})
public String ajaxSubList(Model model, Long cfgId, Integer index, Integer compileId) {
CfgIndexInfo cfg = objectGroupService.getObjectGroupCfg(cfgId, null);
List<String[]> tabList = new ArrayList();
model.addAttribute("_cfg", cfg);
model.addAttribute("index", index);
model.addAttribute("tabList", tabList);
return "/cfg/objgroup/subList";
}
}

View File

@@ -311,7 +311,13 @@ public class AvController extends BaseController {
} }
avCfgService.saveOrUpdateAvFileSample(entity, srcFile); 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) { } catch (Exception e) {
logger.error("文件上传失败", e); logger.error("文件上传失败", e);
e.printStackTrace(); e.printStackTrace();
@@ -339,7 +345,13 @@ public class AvController extends BaseController {
RedirectAttributes redirectAttributes, String ids, AvSignSampleCfg entity) { RedirectAttributes redirectAttributes, String ids, AvSignSampleCfg entity) {
try { try {
avCfgService.saveOrUpdateAvSignSample(entity); 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) { } catch (Exception e) {
logger.error("saveAudioSignSample failed", e); logger.error("saveAudioSignSample failed", e);
e.printStackTrace(); e.printStackTrace();
@@ -591,7 +603,13 @@ public class AvController extends BaseController {
// if(!avSignSampleCfg.getAction().equals(avSignSampleCfg.getActionOld())||!avSignSampleCfg.getIsValid().equals(avSignSampleCfg.getIsValidOld())){ // if(!avSignSampleCfg.getAction().equals(avSignSampleCfg.getActionOld())||!avSignSampleCfg.getIsValid().equals(avSignSampleCfg.getIsValidOld())){
try { try {
avCfgService.auditAvSignSample(avSignSampleCfg); 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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
if (e instanceof MaatConvertException) { if (e instanceof MaatConvertException) {

View File

@@ -307,7 +307,13 @@ public class FileTransferCfgController extends BaseController {
logger.info("获取文件摘要响应信息:" + result); logger.info("获取文件摘要响应信息:" + result);
} }
fileTransferCfgService.saveOrUpdateFileDigestCfg(entity, result, areaCfgIds); fileTransferCfgService.saveOrUpdateFileDigestCfg(entity, result, areaCfgIds);
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 (MaatConvertException e) { } catch (MaatConvertException e) {
logger.error("文件摘要配置下发失败:",e); logger.error("文件摘要配置下发失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed"); addMessage(redirectAttributes, "error", "request_service_failed");

View File

@@ -41,6 +41,7 @@ import com.nis.domain.configuration.template.DnsComplexStringTemplate;
import com.nis.domain.configuration.template.DnsFakeIpTemplate; import com.nis.domain.configuration.template.DnsFakeIpTemplate;
import com.nis.domain.configuration.template.DnsIpTemplate; import com.nis.domain.configuration.template.DnsIpTemplate;
import com.nis.domain.configuration.template.DnsResStrategyTemplate; import com.nis.domain.configuration.template.DnsResStrategyTemplate;
import com.nis.domain.configuration.template.DomainCommCfgTemplate;
import com.nis.domain.configuration.template.DomainInterceptMonitTemplate; import com.nis.domain.configuration.template.DomainInterceptMonitTemplate;
import com.nis.domain.configuration.template.DomainInterceptRateLimitTemplate; import com.nis.domain.configuration.template.DomainInterceptRateLimitTemplate;
import com.nis.domain.configuration.template.DomainInterceptTemplate; import com.nis.domain.configuration.template.DomainInterceptTemplate;
@@ -53,18 +54,23 @@ import com.nis.domain.configuration.template.HttpsRejectTemplate;
import com.nis.domain.configuration.template.HttpsReplaceComplexTemplate; import com.nis.domain.configuration.template.HttpsReplaceComplexTemplate;
import com.nis.domain.configuration.template.HttpsReplaceIpTemplate; import com.nis.domain.configuration.template.HttpsReplaceIpTemplate;
import com.nis.domain.configuration.template.HttpsReplaceTemplate; import com.nis.domain.configuration.template.HttpsReplaceTemplate;
import com.nis.domain.configuration.template.InterceptDomainTemplate;
import com.nis.domain.configuration.template.InterceptIpTemplate;
import com.nis.domain.configuration.template.IpAllNotDoLogTemplate; import com.nis.domain.configuration.template.IpAllNotDoLogTemplate;
import com.nis.domain.configuration.template.IpAllTemplate; import com.nis.domain.configuration.template.IpAllTemplate;
import com.nis.domain.configuration.template.IpCommCfgTemplate;
import com.nis.domain.configuration.template.IpPayloadTemplate; import com.nis.domain.configuration.template.IpPayloadTemplate;
import com.nis.domain.configuration.template.IpRateLimitTemplate; import com.nis.domain.configuration.template.IpRateLimitTemplate;
import com.nis.domain.configuration.template.IpSpoofingTemplate; import com.nis.domain.configuration.template.IpSpoofingTemplate;
import com.nis.domain.configuration.template.IpWhitelistTemplate; import com.nis.domain.configuration.template.IpWhitelistTemplate;
import com.nis.domain.configuration.template.P2pHashStringTemplate; import com.nis.domain.configuration.template.P2pHashStringTemplate;
import com.nis.domain.configuration.template.P2pIpTemplate; import com.nis.domain.configuration.template.P2pIpTemplate;
import com.nis.domain.configuration.template.ScriberIdCommCfgTemplate;
import com.nis.domain.configuration.template.SnatTemplate; import com.nis.domain.configuration.template.SnatTemplate;
import com.nis.domain.configuration.template.StringAllNotDoLogTemplate; import com.nis.domain.configuration.template.StringAllNotDoLogTemplate;
import com.nis.domain.configuration.template.StringAllTemplate; import com.nis.domain.configuration.template.StringAllTemplate;
import com.nis.domain.configuration.template.TopicWebsiteTemplate; import com.nis.domain.configuration.template.TopicWebsiteTemplate;
import com.nis.domain.configuration.template.UrlCommCfgTemplate;
import com.nis.exceptions.MaatConvertException; import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants; import com.nis.util.Constants;
import com.nis.util.DictUtils; import com.nis.util.DictUtils;
@@ -196,8 +202,7 @@ public class IpController extends BaseController{
* *
* @param model * @param model
* @param cfg * @param cfg
* @param auditType 审核类型 批量审核时使用1批量生效0批量失效 * @param isAudit 审核类型 批量审核时使用1批量生效0批量失效
* @param isAudit
* @param isValid * @param isValid
* @param ids * @param ids
* @param functionId * @param functionId
@@ -338,10 +343,12 @@ public class IpController extends BaseController{
,Integer serviceDictId ,Integer serviceDictId
,Integer regionDictId ,Integer regionDictId
,Integer requestId ,Integer requestId
,Integer manipulatType
) { ) {
try { try {
FunctionRegionDict regionDict=DictUtils.getFunctionRegionDict(regionDictId); FunctionRegionDict regionDict=DictUtils.getFunctionRegionDict(regionDictId);
FunctionServiceDict serviceDict=DictUtils.getFunctionServiceDict(serviceDictId); FunctionServiceDict serviceDict=DictUtils.getFunctionServiceDict(serviceDictId);
regionDict.setAction(manipulatType);
exportTemplate(request,response,redirectAttributes,regionDict,serviceDict,requestId); exportTemplate(request,response,redirectAttributes,regionDict,serviceDict,requestId);
} catch (Exception e) { } catch (Exception e) {
logger.error("export_failed", e); logger.error("export_failed", e);
@@ -443,6 +450,29 @@ public class IpController extends BaseController{
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceIpTemplate.class, 2); ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceIpTemplate.class, 2);
excel.setDataList(pro,classList,null). excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose(); write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(215)){// HTTP(s)操控(阻断+重定向+替换)
if(regionDict.getAction() == 16) {
List<HttpsRejectIpTemplate> classList=new ArrayList<HttpsRejectIpTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRejectIpTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getAction() == 48) {
List<HttpsRedirectIpTemplate> classList=new ArrayList<HttpsRedirectIpTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRedirectIpTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getAction() == 80) {
List<HttpsReplaceIpTemplate> classList=new ArrayList<HttpsReplaceIpTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceIpTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else {
List<IpAllTemplate> classList=new ArrayList<IpAllTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpAllTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}
}else if(regionDict.getFunctionId().equals(211)){// HTTP(s)白名单 }else if(regionDict.getFunctionId().equals(211)){// HTTP(s)白名单
List<IpAllNotDoLogTemplate> classList=new ArrayList<IpAllNotDoLogTemplate>(); List<IpAllNotDoLogTemplate> classList=new ArrayList<IpAllNotDoLogTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, IpAllNotDoLogTemplate.class, 2); ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, IpAllNotDoLogTemplate.class, 2);
@@ -454,7 +484,12 @@ public class IpController extends BaseController{
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpRateLimitTemplate.class, 2); ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpRateLimitTemplate.class, 2);
excel.setDataList(pro,classList,null). excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose(); write(request,response, fileName).dispose();
}else { }else if(serviceDict.getAction().equals(2)){//forward
List<InterceptIpTemplate> classList=new ArrayList<InterceptIpTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, InterceptIpTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else{
List<IpAllNotDoLogTemplate> classList=new ArrayList<IpAllNotDoLogTemplate>(); List<IpAllNotDoLogTemplate> classList=new ArrayList<IpAllNotDoLogTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpAllNotDoLogTemplate.class, 2); ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpAllNotDoLogTemplate.class, 2);
excel.setDataList(pro,classList,null). excel.setDataList(pro,classList,null).
@@ -476,6 +511,11 @@ public class IpController extends BaseController{
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpRateLimitTemplate.class, 2); ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpRateLimitTemplate.class, 2);
excel.setDataList(pro,classList,null). excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose(); write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(605)){// IP Common Group
List<IpCommCfgTemplate> classList=new ArrayList<IpCommCfgTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, IpCommCfgTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else{ }else{
List<IpAllTemplate> classList=new ArrayList<IpAllTemplate>(); List<IpAllTemplate> classList=new ArrayList<IpAllTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpAllTemplate.class, 2); ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpAllTemplate.class, 2);
@@ -496,9 +536,9 @@ public class IpController extends BaseController{
excel.setDataList(pro,classList,null). excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose(); write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(200)){// 拦截策略(域名) }else if(regionDict.getFunctionId().equals(200)){// 拦截策略(域名)
if(serviceDict.getAction().equals(1)){// 监测 if(serviceDict.getAction().equals(2)){// forward
List<DomainInterceptMonitTemplate> classList=new ArrayList<DomainInterceptMonitTemplate>(); List<InterceptDomainTemplate> classList=new ArrayList<InterceptDomainTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, DomainInterceptMonitTemplate.class, 2); ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, InterceptDomainTemplate.class, 2);
excel.setDataList(pro,classList,null). excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose(); write(request,response, fileName).dispose();
}else if(serviceDict.getAction().equals(64)){// 限速 }else if(serviceDict.getAction().equals(64)){// 限速
@@ -527,6 +567,29 @@ public class IpController extends BaseController{
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceTemplate.class, 2); ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceTemplate.class, 2);
excel.setDataList(pro,classList,null). excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose(); write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(215)){// HTTP(s)操控
if(regionDict.getAction() == 16) {
List<HttpsRejectTemplate> classList=new ArrayList<HttpsRejectTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRejectTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getAction() == 48) {
List<HttpsRedirectTemplate> classList=new ArrayList<HttpsRedirectTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRedirectTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getAction() == 80) {
List<HttpsReplaceTemplate> classList=new ArrayList<HttpsReplaceTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else {
List<StringAllTemplate> classList=new ArrayList<StringAllTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, StringAllTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}
}else if(regionDict.getFunctionId().equals(211)){// HTTP(s)白名单 }else if(regionDict.getFunctionId().equals(211)){// HTTP(s)白名单
List<StringAllNotDoLogTemplate> classList=new ArrayList<StringAllNotDoLogTemplate>(); List<StringAllNotDoLogTemplate> classList=new ArrayList<StringAllNotDoLogTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, StringAllNotDoLogTemplate.class, 2); ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, StringAllNotDoLogTemplate.class, 2);
@@ -537,6 +600,21 @@ public class IpController extends BaseController{
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, TopicWebsiteTemplate.class, 2); ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, TopicWebsiteTemplate.class, 2);
excel.setDataList(pro,classList,null). excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose(); write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(606)) {// URL Common Group
List<UrlCommCfgTemplate> classList=new ArrayList<UrlCommCfgTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, UrlCommCfgTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(607)) {// Domain Common Group
List<DomainCommCfgTemplate> classList=new ArrayList<DomainCommCfgTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, DomainCommCfgTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(608)) {// ScriberId Common Group
List<ScriberIdCommCfgTemplate> classList=new ArrayList<ScriberIdCommCfgTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, ScriberIdCommCfgTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else{ }else{
List<StringAllTemplate> classList=new ArrayList<StringAllTemplate>(); List<StringAllTemplate> classList=new ArrayList<StringAllTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, StringAllTemplate.class, 2); ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, StringAllTemplate.class, 2);
@@ -567,6 +645,29 @@ public class IpController extends BaseController{
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceComplexTemplate.class, 2); ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceComplexTemplate.class, 2);
excel.setDataList(pro,classList,null). excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose(); write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(215)){// HTTP(s)操控
if(regionDict.getAction() == 16) {
List<HttpsRejectComplexTemplate> classList=new ArrayList<HttpsRejectComplexTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRejectComplexTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getAction() == 48) {
List<HttpsRedirectComplexTemplate> classList=new ArrayList<HttpsRedirectComplexTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRedirectComplexTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getAction() == 80) {
List<HttpsReplaceComplexTemplate> classList=new ArrayList<HttpsReplaceComplexTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceComplexTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else {
List<ComplexStringAllTemplate> classList=new ArrayList<ComplexStringAllTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, ComplexStringAllTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}
}else if(regionDict.getFunctionId().equals(211)){// HTTP(s)白名单 }else if(regionDict.getFunctionId().equals(211)){// HTTP(s)白名单
List<ComplexStringAllNotDoLogTemplate> classList=new ArrayList<ComplexStringAllNotDoLogTemplate>(); List<ComplexStringAllNotDoLogTemplate> classList=new ArrayList<ComplexStringAllNotDoLogTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, ComplexStringAllNotDoLogTemplate.class, 2); ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, ComplexStringAllNotDoLogTemplate.class, 2);
@@ -608,9 +709,12 @@ public class IpController extends BaseController{
,String attribute ,String attribute
,String classify ,String classify
,String regionDictIds ,String regionDictIds
,String importPath) { ,String importPath
this._import(request,response,redirectAttributes, files,serviceDictId,regionDictIds,requestId,attribute,classify); ,Integer manipulatType
return "redirect:" + adminPath+ importPath; ,Integer profileId) {
this._import(request,response,redirectAttributes, files,serviceDictId,regionDictIds,requestId,attribute,classify,manipulatType,profileId);
return "redirect:" + adminPath+ importPath;
} }
//ip配置导出 //ip配置导出
@RequestMapping(value = "exportIpAddr") @RequestMapping(value = "exportIpAddr")

View File

@@ -157,7 +157,13 @@ public class ControlPolicyController extends BaseController{
,RedirectAttributes redirectAttributes){ ,RedirectAttributes redirectAttributes){
try{ try{
controlPolicyService.saveOrUpdate(cfg,areaCfgIds); 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){ }catch(Exception e){
logger.error("信息保存失败",e); logger.error("信息保存失败",e);
if(e instanceof MaatConvertException) { if(e instanceof MaatConvertException) {

View File

@@ -0,0 +1,255 @@
package com.nis.web.controller.configuration.proxy;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
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.beanutils.BeanUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.google.common.collect.Maps;
import com.nis.domain.Page;
import com.nis.domain.callback.ProxyFileHijackCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.maat.ToMaatResult;
import com.nis.domain.maat.ToMaatResult.ResponseData;
import com.nis.exceptions.MaatConvertException;
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.configuration.CommonController;
@Controller
@RequestMapping("${adminPath}/proxy/fileHijack")
public class FileHijackController extends CommonController{
@RequestMapping(value = {"list"})
public String fileHijackList(ProxyFileHijackCfg cfg,Model model,HttpServletRequest request,HttpServletResponse response) {
Page<ProxyFileHijackCfg> page = proxyFileHijackService.findPage(new Page<ProxyFileHijackCfg>(request, response,"a"), cfg);
model.addAttribute("page", page);
model.addAttribute("cfg", cfg);
initPageCondition(model);
return "/cfg/proxy/fileHijack/list";
}
@RequestMapping(value = {"form"})
@RequiresPermissions(value={"proxy:fileHijack:config"})
public String fileform(Model model,HttpServletRequest request
,HttpServletResponse response
,@ModelAttribute("cfg")ProxyFileHijackCfg cfg
,String ids
,RedirectAttributes redirectAttributes) {
if(!StringUtil.isEmpty(ids)){
cfg = proxyFileHijackService.getCfgById(Long.valueOf(ids));
}
//初始化各字典
initFormCondition(model, cfg);
model.addAttribute("_cfg", cfg);
return "/cfg/proxy/fileHijack/form";
}
@RequiresPermissions(value={"proxy:fileHijack:config"})
@RequestMapping(value = {"saveOrUpdate"})
public String saveOrUpdate(Model model,HttpServletRequest request
,HttpServletResponse response,MultipartFile cfgFile,
@ModelAttribute("cfg")ProxyFileHijackCfg cfg,
RedirectAttributes redirectAttributes){
File file = null;
try{
if(cfgFile != null) {
String filename = cfgFile.getOriginalFilename();
String prefix = FileUtils.getPrefix(filename, false);
String suffix = FileUtils.getSuffix(filename, false);
file = File.createTempFile("file_" + prefix, FileUtils.getSuffix(filename, true));
cfgFile.transferTo(file);// 复制文件
String md5 = FileUtils.getFileMD5(file);
Map<String, Object> srcMap = Maps.newHashMap();
srcMap.put("filetype", suffix);
srcMap.put("datatype", "dbSystem");// 源文件存入数据中心
srcMap.put("createTime", new Date());
srcMap.put("key", prefix);
srcMap.put("fileName", filename);
srcMap.put("checksum", md5);
ToMaatResult result = ConfigServiceUtil.postFileCfg(null, file, JsonMapper.toJsonString(srcMap));
logger.info("proxy 劫持文件 上传响应信息:" + JsonMapper.toJsonString(result));
String path = null;
if (!StringUtil.isEmpty(result)) {
ResponseData data = result.getData();
path = data.getAccessUrl();
cfg.setPath(path);
}
}
proxyFileHijackService.saveOrUpdate(cfg);
//配置仅保存
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) {
file.delete();//删除临时文件
}
}
return "redirect:" + adminPath +"/proxy/fileHijack/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"delete"})
@RequiresPermissions(value={"proxy:fileHijack:config"})
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, @ModelAttribute("cfg")ProxyFileHijackCfg cfg,
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
try {
if (!StringUtil.isEmpty(ids)) {
proxyFileHijackService.update(isAudit, isValid, ids, functionId);
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<ProxyFileHijackCfg> searchPage = new Page<ProxyFileHijackCfg>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
} 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", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath +"/proxy/fileHijack/list?functionId="+functionId;
}
@RequestMapping(value = {"audit"})
@RequiresPermissions(value={"proxy:fileHijack:confirm"})
public String audit(Model model, @ModelAttribute("cfg") ProxyFileHijackCfg cfg, Integer isValid, Integer isAudit,
String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
HttpServletRequest request) {
if (!StringUtil.isEmpty(ids)) {
String[] idArray = ids.split(",");
for (String id : idArray) {
try {
proxyFileHijackService.audit(isAudit, isValid, functionId, id);
addMessage(redirectAttributes, "success", "audit_success");
} 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);
}
}
} else {
Page<ProxyFileHijackCfg> searchPage = new Page<ProxyFileHijackCfg>(request, response, "a");
Page<ProxyFileHijackCfg> auditPage = new Page<ProxyFileHijackCfg>(request, response, "a");
try {
BeanUtils.copyProperties(searchPage, auditPage);
auditAll(auditPage, isValid, cfg);
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", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return fileHijackList(cfg, model, request, response);
}
return "redirect:" + adminPath +"/proxy/fileHijack/list?functionId="+functionId;
}
@RequestMapping(value = "exportFileHijack")
public void exportPxy(Model model, HttpServletRequest request, HttpServletResponse response,
@ModelAttribute("cfg") ProxyFileHijackCfg entity, String ids, 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>();
List<ProxyFileHijackCfg> ipLists = new ArrayList<ProxyFileHijackCfg>();
// 导出选中记录
if (!StringUtil.isEmpty(ids)) {
ipLists = proxyFileHijackService.findByList(ids);
} else {
entity.setTableName(IpPortCfg.getTablename());
Page<ProxyFileHijackCfg> pageInfo = new Page<ProxyFileHijackCfg>(request, response, "a");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page<ProxyFileHijackCfg> page = proxyFileHijackService.findPage(pageInfo, entity);
ipLists = page.getList();
}
for (int i = 0; i < ipLists.size(); i++) {
ipLists.get(i).setProfileName(ipLists.get(i).getCfgDesc());
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), ProxyFileHijackCfg.class);
String cfgIndexInfoNoExport = ",config_describe,whether_area_block,block_type,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) {
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
}
if (!StringUtil.isEmpty(entity.gethColumns())) {
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
}
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
dataMap.put(entity.getMenuNameCode(), ipLists);
String timeRange = initTimeMap(entity);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(entity.getExType())) {
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
}
} catch (Exception e) {
logger.error("proxyFileHijack export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}

View File

@@ -0,0 +1,251 @@
package com.nis.web.controller.configuration.proxy;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
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.beanutils.BeanUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.google.common.collect.Maps;
import com.nis.domain.Page;
import com.nis.domain.callback.ProxyFileHijackCfg;
import com.nis.domain.callback.ProxyFileInsertScriptCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.maat.ToMaatResult;
import com.nis.domain.maat.ToMaatResult.ResponseData;
import com.nis.exceptions.MaatConvertException;
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.configuration.CommonController;
@Controller
@RequestMapping("${adminPath}/proxy/fileInsertScript")
public class FileInsertScriptController extends CommonController{
@RequestMapping(value = {"list"})
public String fileInsertScriptList(ProxyFileInsertScriptCfg cfg,Model model,HttpServletRequest request,HttpServletResponse response) {
Page<ProxyFileInsertScriptCfg> page = proxyFileInsertScriptService.findPage(new Page<ProxyFileInsertScriptCfg>(request, response,"a"), cfg);
model.addAttribute("page", page);
model.addAttribute("cfg", cfg);
initPageCondition(model);
return "/cfg/proxy/fileInsertScript/list";
}
@RequestMapping(value = {"form"})
@RequiresPermissions(value={"proxy:fileInsertScript:config"})
public String fileform(Model model,HttpServletRequest request
,HttpServletResponse response
,@ModelAttribute("cfg")ProxyFileInsertScriptCfg cfg
,String ids
,RedirectAttributes redirectAttributes) {
if(!StringUtil.isEmpty(ids)){
cfg = proxyFileInsertScriptService.getCfgById(Long.valueOf(ids));
}
initFormCondition(model, cfg);
model.addAttribute("_cfg", cfg);
return "/cfg/proxy/fileInsertScript/form";
}
@RequiresPermissions(value={"proxy:fileInsertScript:config"})
@RequestMapping(value = {"saveOrUpdate"})
public String saveOrUpdate(Model model,HttpServletRequest request
,HttpServletResponse response,MultipartFile cfgFile,
@ModelAttribute("cfg")ProxyFileInsertScriptCfg cfg,
RedirectAttributes redirectAttributes){
File file = null;
try{
if(cfgFile != null) {
String filename = cfgFile.getOriginalFilename();
String prefix = FileUtils.getPrefix(filename, false);
String suffix = FileUtils.getSuffix(filename, false);
file = File.createTempFile("file_"+ prefix, FileUtils.getSuffix(filename, true));
cfgFile.transferTo(file);//复制文件
String md5 = FileUtils.getFileMD5(file);
Map<String,Object> srcMap = Maps.newHashMap();
srcMap.put("filetype", suffix);
srcMap.put("datatype", "dbSystem");//源文件存入数据中心
srcMap.put("createTime",new Date());
srcMap.put("key",prefix);
srcMap.put("fileName", filename);
srcMap.put("checksum", md5);
ToMaatResult result = ConfigServiceUtil.postFileCfg(null, file, JsonMapper.toJsonString(srcMap));
logger.info("注入脚本文件上传响应信息:"+JsonMapper.toJsonString(result));
String srcAccessUrl = null;
if(!StringUtil.isEmpty(result)){
ResponseData data = result.getData();
srcAccessUrl=data.getAccessUrl();
cfg.setPath(srcAccessUrl);
}
}
proxyFileInsertScriptService.saveOrUpdate(cfg);
//配置仅保存
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) {
file.delete();//删除临时文件
}
}
return "redirect:" + adminPath +"/proxy/fileInsertScript/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"audit"})
@RequiresPermissions(value={"proxy:fileInsertScript:confirm"})
public String audit(Model model, @ModelAttribute("cfg") ProxyFileInsertScriptCfg cfg, Integer isValid, Integer isAudit,
String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
HttpServletRequest request) {
if (!StringUtil.isEmpty(ids)) {
String[] idArray = ids.split(",");
for (String id : idArray) {
try {
proxyFileInsertScriptService.audit(isAudit, isValid, functionId, id);
addMessage(redirectAttributes, "success", "audit_success");
} 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);
}
}
} else {
Page<ProxyFileInsertScriptCfg> searchPage = new Page<ProxyFileInsertScriptCfg>(request, response, "a");
Page<ProxyFileInsertScriptCfg> auditPage = new Page<ProxyFileInsertScriptCfg>(request, response, "a");
try {
BeanUtils.copyProperties(searchPage, auditPage);
auditAll(auditPage, isValid, cfg);
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", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return fileInsertScriptList(cfg, model, request, response);
}
return "redirect:" + adminPath +"/proxy/fileInsertScript/list?functionId="+functionId;
}
@RequestMapping(value = {"delete"})
@RequiresPermissions(value={"proxy:fileInsertScript:config"})
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, @ModelAttribute("cfg")ProxyFileInsertScriptCfg cfg,
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
try {
if (!StringUtil.isEmpty(ids)) {
proxyFileInsertScriptService.delete(isAudit, isValid, ids, functionId);
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<ProxyFileInsertScriptCfg> searchPage = new Page<ProxyFileInsertScriptCfg>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
} 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", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath +"/proxy/fileInsertScript/list?functionId="+functionId;
}
@RequestMapping(value = "exportFileInsertScript")
public void exportFileHijack(Model model, HttpServletRequest request, HttpServletResponse response,
@ModelAttribute("cfg") ProxyFileInsertScriptCfg entity, String ids, 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>();
List<ProxyFileInsertScriptCfg> ipLists = new ArrayList<ProxyFileInsertScriptCfg>();
// 导出选中记录
if (!StringUtil.isEmpty(ids)) {
ipLists = proxyFileInsertScriptService.findByList(ids);
} else {
entity.setTableName(IpPortCfg.getTablename());
Page<ProxyFileInsertScriptCfg> pageInfo = new Page<ProxyFileInsertScriptCfg>(request, response, "a");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page<ProxyFileInsertScriptCfg> page = proxyFileInsertScriptService.findPage(pageInfo, entity);
ipLists = page.getList();
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), ProxyFileInsertScriptCfg.class);
String cfgIndexInfoNoExport = ",config_describe,whether_area_block,block_type,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) {
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
}
if (!StringUtil.isEmpty(entity.gethColumns())) {
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
}
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
dataMap.put(entity.getMenuNameCode(), ipLists);
String timeRange = initTimeMap(entity);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(entity.getExType())) {
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
}
} catch (Exception e) {
logger.error("proxyFileInsertScript export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}

View File

@@ -0,0 +1,286 @@
/**
*@Title: ControlController.java
*@Package com.nis.web.controller.configuration.proxy
*@Description TODO
*@author dell
*@date 2018年6月22日 下午4:35:42
*@version 版本号
*/
package com.nis.web.controller.configuration.proxy;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
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.beanutils.BeanUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.google.common.collect.Maps;
import com.nis.domain.Page;
import com.nis.domain.callback.ProxyFileHijackCfg;
import com.nis.domain.callback.ProxyFileResponsePageCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.maat.ToMaatResult;
import com.nis.domain.maat.ToMaatResult.ResponseData;
import com.nis.exceptions.MaatConvertException;
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.configuration.CommonController;
/**
* @ClassName: ControlController.java
* @Description: TODO
* @author (dell)
* @date 2018年6月22日 下午4:35:42
* @version V1.0
*/
@Controller
@RequestMapping("${adminPath}/proxy/fileResponsePage")
public class FileResponsePageController extends CommonController {
@RequestMapping(value = {"list"})
public String fileResponsePageList(ProxyFileResponsePageCfg cfg,Model model,HttpServletRequest request,HttpServletResponse response) {
Page<ProxyFileResponsePageCfg> page = proxyFileResponsePageService.findPage(new Page<ProxyFileResponsePageCfg>(request, response,"a"), cfg);
model.addAttribute("page", page);
model.addAttribute("cfg", cfg);
initPageCondition(model);
return "/cfg/proxy/fileResponsePage/list";
}
@RequestMapping(value = {"form"})
@RequiresPermissions(value={"proxy:fileResponsePage:config"})
public String fileform(Model model,HttpServletRequest request
,HttpServletResponse response
,@ModelAttribute("cfg")ProxyFileResponsePageCfg cfg
,String ids
,RedirectAttributes redirectAttributes) {
if(!StringUtil.isEmpty(ids)){
cfg = proxyFileResponsePageService.getCfgById(Long.valueOf(ids));
}
// initFormCondition(model);
initFormCondition(model, cfg);
model.addAttribute("_cfg", cfg);
return "/cfg/proxy/fileResponsePage/form";
}
/**
* 保存 文件
* 1、将文件上传到 service 接口
* 2、将文件信息及 1返回的结果 保存到数据库
* @param model
* @param request
* @param response
* @param cfgFile
* @param cfg
* @param redirectAttributes
* @return
*/
@RequiresPermissions(value={"proxy:fileResponsePage:config"})
@RequestMapping(value = {"saveOrUpdate"})
public String saveOrUpdate(Model model,HttpServletRequest request
,HttpServletResponse response,MultipartFile cfgFile,
@ModelAttribute("cfg")ProxyFileResponsePageCfg cfg,
RedirectAttributes redirectAttributes){
File file = null;
try{
if(cfgFile != null) {
String filename = cfgFile.getOriginalFilename();
String prefix = FileUtils.getPrefix(filename, false);
String suffix = FileUtils.getSuffix(filename, false);
file = File.createTempFile("file_"+ prefix, FileUtils.getSuffix(filename, true));
cfgFile.transferTo(file);//复制文件
String md5 = FileUtils.getFileMD5(file);
Map<String,Object> srcMap = Maps.newHashMap();
srcMap.put("filetype", suffix);
srcMap.put("datatype", "dbSystem");//源文件存入数据中心
srcMap.put("createTime",new Date());
srcMap.put("key",prefix);
srcMap.put("fileName", filename);
srcMap.put("checksum", md5);
ToMaatResult result = ConfigServiceUtil.postFileCfg(null, file, JsonMapper.toJsonString(srcMap));
logger.info("http 重定向阻断文件上传响应信息:"+JsonMapper.toJsonString(result));
String srcAccessUrl = null;
if(!StringUtil.isEmpty(result)){
ResponseData data = result.getData();
srcAccessUrl=data.getAccessUrl();
cfg.setUrl(srcAccessUrl);;
}
cfg.setMd5(md5);//文件md5值
cfg.setContentLength(file.length());//文件长度
}
proxyFileResponsePageService.saveOrUpdate(cfg);
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
addMessage(redirectAttributes,"success","save_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) {
file.delete();//删除临时文件
}
}
return "redirect:" + adminPath +"/proxy/fileResponsePage/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"delete"})
@RequiresPermissions(value={"proxy:fileResponsePage:config"})
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, @ModelAttribute("cfg")ProxyFileResponsePageCfg cfg,
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
try {
if (!StringUtil.isEmpty(ids)) {
proxyFileResponsePageService.update(isAudit, isValid, ids, functionId);
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<ProxyFileResponsePageCfg> searchPage = new Page<ProxyFileResponsePageCfg>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
} 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", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath +"/proxy/fileResponsePage/list?functionId="+functionId;
}
@RequestMapping(value = {"audit"})
@RequiresPermissions(value={"proxy:fileResponsePage:confirm"})
public String audit(Model model, @ModelAttribute("cfg") ProxyFileResponsePageCfg cfg, Integer isValid, Integer isAudit,
String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
HttpServletRequest request) {
if (!StringUtil.isEmpty(ids)) {
String[] idArray = ids.split(",");
for (String id : idArray) {
try {
proxyFileResponsePageService.audit(isAudit, isValid, functionId, id);
addMessage(redirectAttributes, "success", "audit_success");
} 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);
}
}
} else {
Page<ProxyFileResponsePageCfg> searchPage = new Page<ProxyFileResponsePageCfg>(request, response, "a");
Page<ProxyFileResponsePageCfg> auditPage = new Page<ProxyFileResponsePageCfg>(request, response, "a");
try {
BeanUtils.copyProperties(searchPage, auditPage);
auditAll(auditPage, isValid, cfg);
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", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return fileResponsePageList(cfg, model, request, response);
}
return "redirect:" + adminPath +"/proxy/fileResponsePage/list?functionId="+functionId;
}
@RequestMapping(value = "exportFileResponsePage")
public void exportPxy(Model model, HttpServletRequest request, HttpServletResponse response,
@ModelAttribute("cfg") ProxyFileResponsePageCfg entity, String ids, 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>();
List<ProxyFileResponsePageCfg> ipLists = new ArrayList<ProxyFileResponsePageCfg>();
// 导出选中记录
if (!StringUtil.isEmpty(ids)) {
ipLists = proxyFileResponsePageService.findByList(ids);
} else {
entity.setTableName(IpPortCfg.getTablename());
Page<ProxyFileResponsePageCfg> pageInfo = new Page<ProxyFileResponsePageCfg>(request, response, "a");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page<ProxyFileResponsePageCfg> page = proxyFileResponsePageService.findPage(pageInfo, entity);
ipLists = page.getList();
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), ProxyFileResponsePageCfg.class);
String cfgIndexInfoNoExport = ",config_describe,whether_area_block,block_type,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) {
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
}
if (!StringUtil.isEmpty(entity.gethColumns())) {
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
}
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
dataMap.put(entity.getMenuNameCode(), ipLists);
String timeRange = initTimeMap(entity);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(entity.getExType())) {
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
}
} catch (Exception e) {
logger.error("proxyFileHijack export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}

View File

@@ -15,6 +15,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
@@ -25,6 +26,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.nis.domain.Page; import com.nis.domain.Page;
import com.nis.domain.callback.ProxyFileHijackCfg;
import com.nis.domain.callback.ProxyFileStrategyCfg; import com.nis.domain.callback.ProxyFileStrategyCfg;
import com.nis.domain.maat.ToMaatResult; import com.nis.domain.maat.ToMaatResult;
import com.nis.domain.maat.ToMaatResult.ResponseData; import com.nis.domain.maat.ToMaatResult.ResponseData;
@@ -118,7 +120,13 @@ public class FileStrategyController extends CommonController {
cfg.setContentLength(file.length());//文件长度 cfg.setContentLength(file.length());//文件长度
} }
proxyFileStrategyService.saveOrUpdate(cfg); 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){ }catch(Exception e){
logger.error("信息保存失败",e); logger.error("信息保存失败",e);
if(e instanceof MaatConvertException) { if(e instanceof MaatConvertException) {
@@ -133,27 +141,81 @@ public class FileStrategyController extends CommonController {
file.delete();//删除临时文件 file.delete();//删除临时文件
} }
} }
return "redirect:" + adminPath +"/proxy/fileStrategy/list?functionId="+cfg.getFunctionId(); return "redirect:" + adminPath +"/proxy/fileStrategy/list?functionId="+cfg.getFunctionId();
} }
@RequestMapping(value = {"delete"}) @RequestMapping(value = {"delete"})
@RequiresPermissions(value={"proxy:fileStrategy:config"}) @RequiresPermissions(value={"proxy:fileStrategy:config"})
public String delete(Integer isAudit,Integer isValid, public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, @ModelAttribute("cfg")ProxyFileStrategyCfg cfg,
String ids, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
Integer functionId, try {
RedirectAttributes redirectAttributes){ if (!StringUtil.isEmpty(ids)) {
proxyFileStrategyService.update(isAudit,isValid,ids,functionId); proxyFileStrategyService.update(isAudit, isValid, ids, functionId);
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<ProxyFileStrategyCfg> searchPage = new Page<ProxyFileStrategyCfg>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
} 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", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath +"/proxy/fileStrategy/list?functionId="+functionId; return "redirect:" + adminPath +"/proxy/fileStrategy/list?functionId="+functionId;
} }
@RequestMapping(value = {"audit"}) @RequestMapping(value = {"audit"})
@RequiresPermissions(value={"proxy:fileStrategy:confirm"}) @RequiresPermissions(value={"proxy:fileStrategy:confirm"})
public String audit(Integer isAudit,Integer isValid,String ids public String audit(Model model, @ModelAttribute("cfg") ProxyFileStrategyCfg cfg, Integer isValid, Integer isAudit,
,Integer functionId, RedirectAttributes redirectAttributes) { String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
if(!StringUtil.isEmpty(ids)){ HttpServletRequest request) {
proxyFileStrategyService.audit(isAudit, isValid, functionId, ids); if (!StringUtil.isEmpty(ids)) {
addMessage(redirectAttributes,"success", "audit_success"); String[] idArray = ids.split(",");
for (String id : idArray) {
try {
proxyFileStrategyService.audit(isAudit, isValid, functionId, id);
addMessage(redirectAttributes, "success", "audit_success");
} 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);
}
}
} else {
Page<ProxyFileStrategyCfg> searchPage = new Page<ProxyFileStrategyCfg>(request, response, "a");
Page<ProxyFileStrategyCfg> auditPage = new Page<ProxyFileStrategyCfg>(request, response, "a");
try {
BeanUtils.copyProperties(searchPage, auditPage);
auditAll(auditPage, isValid, cfg);
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", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return fileStrategyList(cfg, model, request, response);
} }
return "redirect:" + adminPath +"/proxy/fileStrategy/list?functionId="+functionId; return "redirect:" + adminPath +"/proxy/fileStrategy/list?functionId="+functionId;
} }

View File

@@ -0,0 +1,246 @@
package com.nis.web.controller.configuration.proxy;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
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.beanutils.BeanUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.google.common.collect.Maps;
import com.nis.domain.Page;
import com.nis.domain.callback.ProxyFileTrafficMirrorCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.maat.ToMaatResult;
import com.nis.exceptions.MaatConvertException;
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.configuration.CommonController;
@Controller
@RequestMapping("${adminPath}/proxy/fileTrafficMirror")
public class FileTrafficMirrorController extends CommonController {
@RequestMapping(value = {"list"})
public String fileTrafficMirrorList(ProxyFileTrafficMirrorCfg cfg,Model model,HttpServletRequest request,HttpServletResponse response) {
Page<ProxyFileTrafficMirrorCfg> page = proxyFileTrafficMirrorService.findPage(new Page<ProxyFileTrafficMirrorCfg>(request, response,"a"), cfg);
model.addAttribute("page", page);
model.addAttribute("cfg", cfg);
initPageCondition(model);
return "/cfg/proxy/fileTrafficMirror/list";
}
@RequestMapping(value = {"form"})
@RequiresPermissions(value={"proxy:fileTrafficMirror:config"})
public String fileform(Model model,HttpServletRequest request
,HttpServletResponse response
,@ModelAttribute("cfg")ProxyFileTrafficMirrorCfg cfg
,String ids
,RedirectAttributes redirectAttributes) {
if(!StringUtil.isEmpty(ids)){
cfg = proxyFileTrafficMirrorService.getCfgById(Long.valueOf(ids));
}
initFormCondition(model, cfg);
model.addAttribute("_cfg", cfg);
return "/cfg/proxy/fileTrafficMirror/form";
}
@RequiresPermissions(value={"proxy:fileTrafficMirror:config"})
@RequestMapping(value = {"saveOrUpdate"})
public String saveOrUpdate(Model model,HttpServletRequest request
,HttpServletResponse response,MultipartFile cfgFile,
@ModelAttribute("cfg")ProxyFileTrafficMirrorCfg cfg,
RedirectAttributes redirectAttributes){
File file = null;
try{
if(cfgFile != null) {
String filename = cfgFile.getOriginalFilename();
String prefix = FileUtils.getPrefix(filename, false);
String suffix = FileUtils.getSuffix(filename, false);
file = File.createTempFile("file_"+ prefix, suffix);
cfgFile.transferTo(file);//复制文件
String md5 = FileUtils.getFileMD5(file);
Map<String,Object> srcMap = Maps.newHashMap();
srcMap.put("filetype", suffix);
srcMap.put("datatype", "dbSystem");//源文件存入数据中心
srcMap.put("createTime",new Date());
srcMap.put("key",prefix);
srcMap.put("fileName", filename);
srcMap.put("checksum", md5);
ToMaatResult result = ConfigServiceUtil.postFileCfg(null, file, JsonMapper.toJsonString(srcMap));
logger.info("注入脚本文件上传响应信息:"+JsonMapper.toJsonString(result));
}
proxyFileTrafficMirrorService.saveOrUpdate(cfg);
//配置仅保存
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) {
file.delete();//删除临时文件
}
}
return "redirect:" + adminPath +"/proxy/fileTrafficMirror/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"audit"})
@RequiresPermissions(value={"proxy:fileTrafficMirror:confirm"})
public String audit(Model model, @ModelAttribute("cfg") ProxyFileTrafficMirrorCfg cfg, Integer isValid, Integer isAudit,
String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
HttpServletRequest request) {
if (!StringUtil.isEmpty(ids)) {
String[] idArray = ids.split(",");
for (String id : idArray) {
try {
proxyFileTrafficMirrorService.audit(isAudit, isValid, functionId, id);
addMessage(redirectAttributes, "success", "audit_success");
} 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);
}
}
} else {
Page<ProxyFileTrafficMirrorCfg> searchPage = new Page<ProxyFileTrafficMirrorCfg>(request, response, "a");
Page<ProxyFileTrafficMirrorCfg> auditPage = new Page<ProxyFileTrafficMirrorCfg>(request, response, "a");
try {
BeanUtils.copyProperties(searchPage, auditPage);
auditAll(auditPage, isValid, cfg);
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", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return fileTrafficMirrorList(cfg, model, request, response);
}
return "redirect:" + adminPath +"/proxy/fileTrafficMirror/list?functionId="+functionId;
}
@RequestMapping(value = {"delete"})
@RequiresPermissions(value={"proxy:fileTrafficMirror:config"})
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, @ModelAttribute("cfg")ProxyFileTrafficMirrorCfg cfg,
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
try {
if (!StringUtil.isEmpty(ids)) {
proxyFileTrafficMirrorService.delete(isAudit, isValid, ids, functionId);
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<ProxyFileTrafficMirrorCfg> searchPage = new Page<ProxyFileTrafficMirrorCfg>(request, response, "d");
deleteAll(searchPage, functionId, cfg);
}
} 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", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath +"/proxy/fileTrafficMirror/list?functionId="+functionId;
}
@RequestMapping(value = "exportFileTrafficMirror")
public void exportFileHijack(Model model, HttpServletRequest request, HttpServletResponse response,
@ModelAttribute("cfg") ProxyFileTrafficMirrorCfg entity, String ids, 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>();
List<ProxyFileTrafficMirrorCfg> ipLists = new ArrayList<ProxyFileTrafficMirrorCfg>();
// 导出选中记录
if (!StringUtil.isEmpty(ids)) {
ipLists = proxyFileTrafficMirrorService.findByList(ids);
} else {
entity.setTableName(IpPortCfg.getTablename());
Page<ProxyFileTrafficMirrorCfg> pageInfo = new Page<ProxyFileTrafficMirrorCfg>(request, response, "a");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page<ProxyFileTrafficMirrorCfg> page = proxyFileTrafficMirrorService.findPage(pageInfo, entity);
ipLists = page.getList();
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), ProxyFileTrafficMirrorCfg.class);
String cfgIndexInfoNoExport = ",config_describe,whether_area_block,block_type,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) {
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
}
if (!StringUtil.isEmpty(entity.gethColumns())) {
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
}
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
dataMap.put(entity.getMenuNameCode(), ipLists);
String timeRange = initTimeMap(entity);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(entity.getExType())) {
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
}
} catch (Exception e) {
logger.error("proxyFileTrafficMirror export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}

View File

@@ -25,6 +25,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.FunctionRegionDict; import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict; import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page; import com.nis.domain.Page;
import com.nis.domain.callback.ProxyFileResponsePageCfg;
import com.nis.domain.callback.ProxyFileStrategyCfg; import com.nis.domain.callback.ProxyFileStrategyCfg;
import com.nis.domain.configuration.BaseStringCfg; import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.CfgIndexInfo;
@@ -63,8 +64,8 @@ public class HttpRedirectPolicyController extends BaseController {
model.addAttribute("page", page); model.addAttribute("page", page);
initPageCondition(model, cfg); initPageCondition(model, cfg);
// 获取所有的响应文件内容,阻断,或重定向时可以选择 // 获取所有的响应文件内容,阻断,或重定向时可以选择
List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService List<ProxyFileResponsePageCfg> allProxyFileStrategys = proxyFileResponsePageService
.getProxyFileStrategyCfgList(new ProxyFileStrategyCfg()); .getProxyFileResponsePageCfgList(new ProxyFileResponsePageCfg());
model.addAttribute("allProxyFileStrategys", allProxyFileStrategys); model.addAttribute("allProxyFileStrategys", allProxyFileStrategys);
return "/cfg/proxy/control/httpRedirectList"; return "/cfg/proxy/control/httpRedirectList";
} }
@@ -174,8 +175,8 @@ public class HttpRedirectPolicyController extends BaseController {
initFormCondition(model, entity); initFormCondition(model, entity);
} }
// 获取所有的响应文件内容,阻断,或重定向时可以选择 // 获取所有的响应文件内容,阻断,或重定向时可以选择
List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService List<ProxyFileResponsePageCfg> allProxyFileStrategys = proxyFileResponsePageService
.getProxyFileStrategyCfgList(new ProxyFileStrategyCfg()); .getProxyFileResponsePageCfgList(new ProxyFileResponsePageCfg());
model.addAttribute("_cfg", entity); model.addAttribute("_cfg", entity);
model.addAttribute("allProxyFileStrategys", allProxyFileStrategys); model.addAttribute("allProxyFileStrategys", allProxyFileStrategys);
return "/cfg/proxy/control/httpRedirectForm"; return "/cfg/proxy/control/httpRedirectForm";
@@ -330,8 +331,18 @@ public class HttpRedirectPolicyController extends BaseController {
Page<CfgIndexInfo> page = httpRedirectCfgService.getHttpRedirectList(pageInfo, entity); Page<CfgIndexInfo> page = httpRedirectCfgService.getHttpRedirectList(pageInfo, entity);
ipLists = page.getList(); ipLists = page.getList();
} }
Integer fucntionId = Integer.parseInt(request.getParameter("functionId"));
if(fucntionId==207){
for(CfgIndexInfo cfg:ipLists){
String userRegion3 = cfg.getUserRegion3();
if(!"".equals(userRegion3) && userRegion3 !=null){
ProxyFileResponsePageCfg temp = new ProxyFileResponsePageCfg();
temp.setCompileId(Integer.parseInt(cfg.getUserRegion3()));
List<ProxyFileResponsePageCfg> list = proxyFileResponsePageService.getProxyFileResponsePageCfgList(temp);
cfg.setUserRegion2(list.get(0).getFileDesc());
}
}
}
//日志总量 //日志总量
List<Map<String,Object>> logTotals=new ArrayList<Map<String,Object>>(); List<Map<String,Object>> logTotals=new ArrayList<Map<String,Object>>();
StringBuilder compileIds=new StringBuilder(",");//配置ids StringBuilder compileIds=new StringBuilder(",");//配置ids
@@ -365,12 +376,12 @@ public class HttpRedirectPolicyController extends BaseController {
if (entity.getFunctionId() == 207 || entity.getFunctionId() == 208) { if (entity.getFunctionId() == 207 || entity.getFunctionId() == 208) {
if (StringUtil.isEmpty(str.getUserRegion2())) { if (StringUtil.isEmpty(str.getUserRegion2())) {
if (!StringUtil.isEmpty(str.getUserRegion3())) { if (!StringUtil.isEmpty(str.getUserRegion3())) {
ProxyFileStrategyCfg file = new ProxyFileStrategyCfg(); ProxyFileResponsePageCfg file = new ProxyFileResponsePageCfg();
file.setCompileId(Integer.valueOf(str.getUserRegion3())); file.setCompileId(Integer.valueOf(str.getUserRegion3()));
List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService List<ProxyFileResponsePageCfg> allProxyFileResponsePageCfg = proxyFileResponsePageService
.getProxyFileStrategyCfgList(file); .getProxyFileResponsePageCfgList(file);
if (allProxyFileStrategys != null && allProxyFileStrategys.size() > 0) { if (allProxyFileResponsePageCfg != null && allProxyFileResponsePageCfg.size() > 0) {
str.setUserRegion2(allProxyFileStrategys.get(0).getCfgDesc()); str.setUserRegion2(allProxyFileResponsePageCfg.get(0).getCfgDesc());
} }
} }
} }
@@ -394,13 +405,15 @@ public class HttpRedirectPolicyController extends BaseController {
String cfgIndexInfoNoExport = ",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,"; String cfgIndexInfoNoExport = ",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
if (entity.getFunctionId() == 207) { if (entity.getFunctionId() == 207) {
cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:response_code-userregion2:response_content-"; cfgIndexInfoNoExport = ",log_total,policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:response_code-userregion2:response_content-";
} else if (entity.getFunctionId() == 208) { } else if (entity.getFunctionId() == 208) {
cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:redirect_response_code-userregion2:redirect_url-"; cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:redirect_response_code-userregion2:redirect_url-";
} else if (entity.getFunctionId() == 209) { } else if (entity.getFunctionId() == 209) {
cfgIndexInfoNoExport = ",policy_name,group_name,userregion4,userregion5,&userregion1:replace_zone-userregion2:replaced_content-userregion3:replace_content-"; cfgIndexInfoNoExport = ",policy_name,group_name,userregion4,userregion5,&userregion1:replace_zone-userregion2:replaced_content-userregion3:replace_content-";
} else if (entity.getFunctionId() == 211) { } else if (entity.getFunctionId() == 211) {
cfgIndexInfoNoExport = ",do_log,log_total,policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,"; cfgIndexInfoNoExport = ",do_log,log_total,policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
}else if (entity.getFunctionId() == 210) {
cfgIndexInfoNoExport = ",log_total,policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
} }
String httpUrlCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator" String httpUrlCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time" + ",config_time,editor,edit_time,auditor,audit_time"
@@ -488,12 +501,7 @@ public class HttpRedirectPolicyController extends BaseController {
dataMap.put(entity.getMenuNameCode(), ipLists); dataMap.put(entity.getMenuNameCode(), ipLists);
dataMap.put("NTC_HTTP_URL", httpUrlList); dataMap.put("NTC_HTTP_URL", httpUrlList);
dataMap.put("NTC_HTTP_REQ_HDR", httpReqHdrList); dataMap.put("NTC_HTTP_REQ_HDR", httpReqHdrList);
if (entity.getFunctionId() != 208 && entity.getFunctionId() != 211) { if (entity.getFunctionId() != 211) {
titleList.add("NTC_HTTP_RES_BODY");
classMap.put("NTC_HTTP_RES_BODY", HttpBodyCfg.class);
noExportMap.put("NTC_HTTP_RES_BODY", httpResBodyCfgNoExport);
dataMap.put("NTC_HTTP_RES_BODY", httpResBodyList);
} else if (entity.getFunctionId() != 211) {
titleList.add("NTC_HTTP_RES_HDR"); titleList.add("NTC_HTTP_RES_HDR");
titleList.add("NTC_HTTP_REQ_BODY"); titleList.add("NTC_HTTP_REQ_BODY");
classMap.put("NTC_HTTP_RES_HDR", HttpResHeadCfg.class); classMap.put("NTC_HTTP_RES_HDR", HttpResHeadCfg.class);
@@ -502,6 +510,12 @@ public class HttpRedirectPolicyController extends BaseController {
noExportMap.put("NTC_HTTP_REQ_BODY", httpReqBodyCfgNoExport); noExportMap.put("NTC_HTTP_REQ_BODY", httpReqBodyCfgNoExport);
dataMap.put("NTC_HTTP_RES_HDR", httpResHdrList); dataMap.put("NTC_HTTP_RES_HDR", httpResHdrList);
dataMap.put("NTC_HTTP_REQ_BODY", httpReqBodyList); dataMap.put("NTC_HTTP_REQ_BODY", httpReqBodyList);
if (entity.getFunctionId() != 208) {
titleList.add("NTC_HTTP_RES_BODY");
classMap.put("NTC_HTTP_RES_BODY", HttpBodyCfg.class);
noExportMap.put("NTC_HTTP_RES_BODY", httpResBodyCfgNoExport);
dataMap.put("NTC_HTTP_RES_BODY", httpResBodyList);
}
} }
titleList.add("NTC_UNIVERSAL_IP"); titleList.add("NTC_UNIVERSAL_IP");
titleList.add("NTC_SUBSCRIBE_ID"); titleList.add("NTC_SUBSCRIBE_ID");

View File

@@ -18,15 +18,19 @@ import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes; import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page; import com.nis.domain.Page;
import com.nis.domain.basics.PolicyGroupInfo; import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.domain.callback.ProxyFileTrafficMirrorCfg;
import com.nis.domain.configuration.BaseStringCfg; import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.HttpUrlCfg; import com.nis.domain.configuration.HttpUrlCfg;
import com.nis.domain.configuration.InterceptPktBin; import com.nis.domain.configuration.InterceptPktBin;
import com.nis.domain.configuration.IpPortCfg; import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.PxyInterceptCfg;
import com.nis.domain.configuration.PxyObjKeyring; import com.nis.domain.configuration.PxyObjKeyring;
import com.nis.domain.configuration.PxyObjSpoofingIpPool; import com.nis.domain.configuration.PxyObjSpoofingIpPool;
import com.nis.exceptions.MaatConvertException; import com.nis.exceptions.MaatConvertException;
@@ -36,6 +40,7 @@ import com.nis.util.LogUtils;
import com.nis.util.StringUtil; import com.nis.util.StringUtil;
import com.nis.web.controller.configuration.CommonController; import com.nis.web.controller.configuration.CommonController;
import com.nis.web.security.UserUtils; import com.nis.web.security.UserUtils;
import com.nis.web.service.BaseService;
/** /**
* IP相关配置控制类 * IP相关配置控制类
@@ -57,13 +62,17 @@ public class InterceptController extends CommonController {
// 获取证书信息 // 获取证书信息
List<PxyObjKeyring> certificateList = new ArrayList<PxyObjKeyring>(); List<PxyObjKeyring> certificateList = new ArrayList<PxyObjKeyring>();
if (cfg.getFunctionId().equals(200)) { List<ProxyFileTrafficMirrorCfg> mirrorProfiles = new ArrayList<ProxyFileTrafficMirrorCfg>();
certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "ip"); if (cfg.getFunctionId().equals(200)) {//改为ajax查询
//certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "ip");
//mirrorProfiles=proxyFileTrafficMirrorService.findMirrorList(null,1,1);
} }
if (cfg.getFunctionId().equals(201)) { if (cfg.getFunctionId().equals(201)) {
certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "domain"); certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "domain");
} }
model.addAttribute("certificateList", certificateList); model.addAttribute("certificateList", certificateList);
model.addAttribute("mirrorProfiles", mirrorProfiles);
/*if(cfg.getFunctionId().equals(214)){ /*if(cfg.getFunctionId().equals(214)){
// IP地址仿冒策略使用策略组 // IP地址仿冒策略使用策略组
//List<PolicyGroupInfo> policyGroups = policyGroupInfoService.findPolicyGroupInfosByType(6); //List<PolicyGroupInfo> policyGroups = policyGroupInfoService.findPolicyGroupInfosByType(6);
@@ -89,13 +98,16 @@ public class InterceptController extends CommonController {
} }
// 获取证书信息 // 获取证书信息
List<PxyObjKeyring> certificateList = new ArrayList<PxyObjKeyring>(); List<PxyObjKeyring> certificateList = new ArrayList<PxyObjKeyring>();
List<ProxyFileTrafficMirrorCfg> mirrorProfiles = new ArrayList<ProxyFileTrafficMirrorCfg>();
// if (entity.getFunctionId().equals(200)) { // if (entity.getFunctionId().equals(200)) {
certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, null); certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, null);
mirrorProfiles=proxyFileTrafficMirrorService.findMirrorList(null,1,1);
// } // }
// if (entity.getFunctionId().equals(201)) { // if (entity.getFunctionId().equals(201)) {
// certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "domain"); // certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "domain");
// } // }
model.addAttribute("certificateList", certificateList); model.addAttribute("certificateList", certificateList);
model.addAttribute("mirrorProfiles", mirrorProfiles);
model.addAttribute("_cfg", entity); model.addAttribute("_cfg", entity);
// IP地址仿冒策略使用策略组 // IP地址仿冒策略使用策略组
@@ -110,6 +122,129 @@ public class InterceptController extends CommonController {
public String saveInterceptIpCfg(RedirectAttributes redirectAttributes, Model model, HttpServletRequest request, public String saveInterceptIpCfg(RedirectAttributes redirectAttributes, Model model, HttpServletRequest request,
HttpServletResponse response, String ids, CfgIndexInfo entity) { HttpServletResponse response, String ids, CfgIndexInfo entity) {
try { try {
if(!entity.getAction().equals(2)||!entity.getServiceId().equals(512)) {
entity.setUserRegion(null);
}else {
if(entity.getUserRegion()==null) {
entity.setUserRegion(new HashMap<String,Object>());
}
//keyring
String keyring = request.getParameter("keyring");
if(StringUtils.isNotBlank(keyring)) {
entity.getUserRegion().put("keyring", Long.parseLong(keyring));
}else {
entity.getUserRegion().put("keyring", 1);
}
Map<String,Object> map = new HashMap();
//exclusions
String ev_cert = request.getParameter("ev_cert");
String cert_transparency = request.getParameter("cert_transparency");
String client_cert_req = request.getParameter("client_cert_req");
String pinning = request.getParameter("pinning");
String protocol_errors = request.getParameter("protocol_errors");
if(StringUtils.isNotBlank(ev_cert)){
map.put("ev_cert", Integer.parseInt(ev_cert.trim()));
}else {
map.put("ev_cert", 0);
}
if(StringUtils.isNotBlank(cert_transparency)){
map.put("cert_transparency",Integer.parseInt(cert_transparency.trim()));
}else {
map.put("cert_transparency", 0);
}
if(StringUtils.isNotBlank(pinning)){
map.put("pinning", Integer.parseInt(pinning.trim()));
}else {
map.put("pinning", 0);
}
if(StringUtils.isNotBlank(protocol_errors)){
map.put("protocol_errors", Integer.parseInt(protocol_errors.trim()));
}else {
map.put("protocol_errors", 0);
}
if(StringUtils.isNotBlank(client_cert_req)){
map.put("client_cert_req", Integer.parseInt(client_cert_req.trim()));
}else {
map.put("client_cert_req", 0);
}
entity.getUserRegion().put("exclusions", map);
//cert_verify
Map<String,Object> map1=new HashMap<>();
map=new HashMap<>();
String cn=request.getParameter("cn");
String issuer=request.getParameter("issuer");
String self_signed=request.getParameter("self-signed");
String expiration=request.getParameter("expiration");
if(StringUtils.isNotBlank(cn)){
map.put("cn",Integer.parseInt(cn.trim()));
}else {
map.put("cn",0);
}
if(StringUtils.isNotBlank(issuer)){
map.put("issuer",Integer.parseInt(issuer.trim()));
}else {
map.put("issuer",0);
}
if(StringUtils.isNotBlank(self_signed)){
map.put("self-signed",Integer.parseInt(self_signed.trim()));
}else {
map.put("self-signed",0);
}
if(StringUtils.isNotBlank(expiration)){
map.put("expiration",Integer.parseInt(expiration.trim()));
}else {
map.put("expiration",0);
}
map1.put("approach", map);
String fail_method=request.getParameter("fail_method");
if(StringUtils.isNotBlank(fail_method)){
map1.put("fail_method",fail_method.trim());
}
entity.getUserRegion().put("cert_verify", map1);
//ssl_ver
map=new HashMap<>();
String mirror_client=request.getParameter("mirror_client");
String allow_http2 = request.getParameter("allow_http2");
String min=request.getParameter("min");
String max=request.getParameter("max");
if(StringUtils.isNotBlank(mirror_client)){
map.put("mirror_client", Integer.parseInt(mirror_client.trim()));
}else {
mirror_client="0";
map.put("mirror_client", 0);
}
if(StringUtils.isNotBlank(allow_http2)){
map.put("allow_http2", Integer.parseInt(allow_http2.trim()));
}else {
allow_http2="0";
map.put("allow_http2", 0);
}
if("0".equals(mirror_client)) {
if(StringUtils.isNotBlank(min)){
map.put("min", min.trim());
}
if(StringUtils.isNotBlank(max)){
map.put("max", max.trim());
}
}
entity.getUserRegion().put("ssl_ver", map);
//decrypt_mirror
map=new HashMap<>();
String enable=request.getParameter("enable");
String mirror_profile=request.getParameter("mirror_profile");
if(StringUtils.isNotBlank(enable)){
map.put("enable", Integer.parseInt(enable.trim()));
}else {
enable="0";
map.put("enable", 0);
}
if("1".equals(enable)) {
if(StringUtils.isNotBlank(mirror_profile)){
map.put("mirror_profile", Integer.parseInt(mirror_profile));
}
}
entity.getUserRegion().put("decrypt_mirror", map);
}
interceptCfgService.saveInterceptCfg(entity); interceptCfgService.saveInterceptCfg(entity);
//配置仅保存 //配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) { if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
@@ -169,6 +304,33 @@ public class InterceptController extends CommonController {
model.addAttribute("tabList", tabList); model.addAttribute("tabList", tabList);
return "/cfg/intercept/interceptSubList"; return "/cfg/intercept/interceptSubList";
} }
//替换keyring,mirror_profiles
@RequestMapping(value = { "/ajaxGetValues" })
@ResponseBody
public Map<String,Object> ajaxGetValues(Model model, @RequestParam(required=false,value="keyrings")String keyrings, @RequestParam(required=false,value="mirrorProfiles")String mirrorProfiles) {
Map<String,Object> datas=new HashMap<>();
List<PxyObjKeyring> certificateList = new ArrayList<PxyObjKeyring>();
List<ProxyFileTrafficMirrorCfg> mirrorProfileList = new ArrayList<ProxyFileTrafficMirrorCfg>();
// if (entity.getFunctionId().equals(200)) {
Map<String,Object> _datas=new HashMap<>();
if(StringUtils.isNotBlank(keyrings)) {
certificateList = pxyObjKeyringService.findAllPxyObjKeyrings(keyrings, 1, 1, null);
for(PxyObjKeyring certificate:certificateList) {
_datas.put(certificate.getCompileId().toString(), certificate.getCfgDesc());
}
datas.put("keyrings", _datas);
}
if(StringUtils.isNotBlank(mirrorProfiles)) {
mirrorProfileList=proxyFileTrafficMirrorService.findMirrorList(mirrorProfiles,1,1);
_datas=new HashMap<>();
for(ProxyFileTrafficMirrorCfg mirrorProfile:mirrorProfileList) {
_datas.put(mirrorProfile.getCompileId().toString(), mirrorProfile.getCfgDesc());
}
datas.put("mirrorProfiles", _datas);
}
return datas;
}
@RequestMapping(value = { "auditInterceptIpCfg", "auditInterceptDomainCfg", "auditInterceptIpPayloadCfg" }) @RequestMapping(value = { "auditInterceptIpCfg", "auditInterceptDomainCfg", "auditInterceptIpPayloadCfg" })
public String auditInterceptIpCfg(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, Integer isValid, public String auditInterceptIpCfg(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, Integer isValid,
@@ -284,6 +446,7 @@ public class InterceptController extends CommonController {
Map<String, String> replaceExportMap = new HashMap<String, String>(); Map<String, String> replaceExportMap = new HashMap<String, String>();
Properties prop = getMsgProp(); Properties prop = getMsgProp();
List<CfgIndexInfo> ipLists = new ArrayList<CfgIndexInfo>(); List<CfgIndexInfo> ipLists = new ArrayList<CfgIndexInfo>();
List<PxyInterceptCfg> pxyInterceptCfgs=new ArrayList<>();
// 导出选中记录 // 导出选中记录
if (!StringUtil.isEmpty(ids)) { if (!StringUtil.isEmpty(ids)) {
ipLists = ipCfgService.getByIdsList(ids); ipLists = ipCfgService.getByIdsList(ids);
@@ -326,59 +489,132 @@ public class InterceptController extends CommonController {
} }
// 获取证书信息 // 获取证书信息
List<PxyObjKeyring> certificateList = new ArrayList<PxyObjKeyring>(); List<PxyObjKeyring> certificateList = new ArrayList<PxyObjKeyring>();
//获取镜像相关信息
List<ProxyFileTrafficMirrorCfg> mirrorProfileList=new ArrayList<>();
if (entity.getFunctionId().equals(200)) { if (entity.getFunctionId().equals(200)) {
certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "ip"); certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "ip");
mirrorProfileList=proxyFileTrafficMirrorService.findMirrorList(null, 1, 1);
} }
if (entity.getFunctionId().equals(201)) { if (entity.getFunctionId().equals(201)) {
certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "domain"); certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "domain");
} }
for (CfgIndexInfo str : ipLists) { for (CfgIndexInfo str : ipLists) {
PxyInterceptCfg pxyInterceptCfg=new PxyInterceptCfg();
BeanUtils.copyProperties(str, pxyInterceptCfg);
if (!StringUtil.isEmpty(str.getUserRegion5())) { if (!StringUtil.isEmpty(str.getUserRegion5())) {
String cs = DictUtils.getDictLabel("INTERCEPT_DOMAIN_INTENSITY", str.getUserRegion5()); String cs = DictUtils.getDictLabel("INTERCEPT_DOMAIN_INTENSITY", str.getUserRegion5());
str.setUserRegion5(prop.getProperty(cs)); str.setUserRegion5(prop.getProperty(cs));
} }
str.setUserRegion(new HashMap<String,Object>());
if (certificateList != null) { if (certificateList != null) {
if (entity.getFunctionId() == 200 || entity.getFunctionId() == 201) { if (entity.getFunctionId().equals(200) ) {
if (!StringUtil.isEmpty(str.getUserRegion1())) { if (!StringUtil.isEmpty(str.getUserRegion1())&&str.getUserRegion1().startsWith("{")) {
boolean flag = false;
for (PxyObjKeyring pxyObjKeyring : certificateList) { Map<String,Object> userregion=BaseService.gsonFromJson(str.getUserRegion1(), Map.class);
if (str.getUserRegion1().equals(String.valueOf(pxyObjKeyring.getCompileId()))) { if(userregion.containsKey("keyring")) {
str.setUserRegion1(pxyObjKeyring.getCfgDesc()); for (PxyObjKeyring pxyObjKeyring : certificateList) {
flag = true; if (String.valueOf(pxyObjKeyring.getCompileId()).equals(userregion.get("keyring").toString())) {
break; pxyInterceptCfg.setKeyring(pxyObjKeyring.getCfgDesc());
break;
}
} }
} }
if (!flag) { if(((Map<String,Object>)userregion.get("exclusions")).containsKey("ev_cert")){
str.setUserRegion1(null); pxyInterceptCfg.setEvCert(((Map<String,Object>)userregion.get("exclusions")).get("ev_cert").toString());
}
if(((Map<String,Object>)userregion.get("exclusions")).containsKey("cert_transparency")){
pxyInterceptCfg.setCertTransparency(((Map<String,Object>)userregion.get("exclusions")).get("cert_transparency").toString());
}
if(((Map<String,Object>)userregion.get("exclusions")).containsKey("ev_cert")) {
pxyInterceptCfg.setClientCertReq(((Map<String,Object>)userregion.get("exclusions")).get("client_cert_req").toString());
}
if(((Map<String,Object>)userregion.get("exclusions")).containsKey("ev_cert")) {
pxyInterceptCfg.setPinning(((Map<String,Object>)userregion.get("exclusions")).get("pinning").toString());
}
if(((Map<String,Object>)userregion.get("exclusions")).containsKey("ev_cert")) {
pxyInterceptCfg.setProtocolErrors(String.valueOf(((Map<String,Object>)userregion.get("exclusions")).get("protocol_errors")));
}
if(((Map<String,Object>)((Map<String,Object>)userregion.get("cert_verify")).get("approach")).containsKey("cn")) {
pxyInterceptCfg.setCn(((Map<String,Object>)((Map<String,Object>)userregion.get("cert_verify")).get("approach")).get("cn").toString());
}
if(((Map<String,Object>)((Map<String,Object>)userregion.get("cert_verify")).get("approach")).containsKey("issuer")) {
pxyInterceptCfg.setIssuer(((Map<String,Object>)((Map<String,Object>)userregion.get("cert_verify")).get("approach")).get("issuer").toString());
}
if(((Map<String,Object>)((Map<String,Object>)userregion.get("cert_verify")).get("approach")).containsKey("self-signed")) {
pxyInterceptCfg.setSelfSigned(((Map<String,Object>)((Map<String,Object>)userregion.get("cert_verify")).get("approach")).get("self-signed").toString());
}
if(((Map<String,Object>)((Map<String,Object>)userregion.get("cert_verify")).get("approach")).containsKey("expiration")) {
pxyInterceptCfg.setExpiration(((Map<String,Object>)((Map<String,Object>)userregion.get("cert_verify")).get("approach")).get("expiration").toString());
}
if(((Map<String,Object>)userregion.get("cert_verify")).containsKey("fail_method")) {
pxyInterceptCfg.setFailMethod(((Map<String,Object>)userregion.get("cert_verify")).get("fail_method").toString());
}
if(((Map<String,Object>)userregion.get("ssl_ver")).containsKey("min")) {
pxyInterceptCfg.setMin(((Map<String,Object>)userregion.get("ssl_ver")).get("min").toString());
}
if(((Map<String,Object>)userregion.get("ssl_ver")).containsKey("max")) {
pxyInterceptCfg.setMax(((Map<String,Object>)userregion.get("ssl_ver")).get("max").toString());
}
if(((Map<String,Object>)userregion.get("ssl_ver")).containsKey("mirror_client")) {
pxyInterceptCfg.setMirrorClient(((Map<String,Object>)userregion.get("ssl_ver")).get("mirror_client").toString());
}
if(((Map<String,Object>)userregion.get("ssl_ver")).containsKey("allow_http2")) {
pxyInterceptCfg.setAllowHttp2(((Map<String,Object>)userregion.get("ssl_ver")).get("allow_http2").toString());
}
if(((Map<String,Object>)userregion.get("decrypt_mirror")).containsKey("enable")) {
pxyInterceptCfg.setEnable(((Map<String,Object>)userregion.get("decrypt_mirror")).get("enable").toString());
}
if(((Map<String,Object>)userregion.get("decrypt_mirror")).containsKey("mirror_profile")) {
}
//pxyInterceptCfg.setMirrorProfile(((Map<String,Object>)userregion.get("decrypt_mirror")).get("mirror_profile").toString());
if(((Map<String,Object>)userregion.get("decrypt_mirror")).containsKey("mirror_profile")) {
for (ProxyFileTrafficMirrorCfg mirrorProfile : mirrorProfileList) {
if (String.valueOf(mirrorProfile.getCompileId()).equals(((Map<String,Object>)userregion.get("decrypt_mirror")).get("mirror_profile").toString())) {
pxyInterceptCfg.setMirrorProfile(mirrorProfile.getCfgDesc());
break;
}
}
} }
} }
} }
} }
pxyInterceptCfgs.add(pxyInterceptCfg);
} }
titleList.add(entity.getMenuNameCode()); titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class); if(entity.getFunctionId().equals(200)) {
classMap.put(entity.getMenuNameCode(), PxyInterceptCfg.class);
}else {
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
}
String cfgIndexInfoNoExport = ""; String cfgIndexInfoNoExport = "";
String ipPortInfoNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator" String ipPortInfoNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time" + ",config_time,editor,edit_time,auditor,audit_time"
+ ",letter,whether_area_block,classification,attribute,label" + ",letter,whether_area_block,classification,attribute,label,block_type,"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,"; + ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
String interceptNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator" String interceptNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time" + ",config_time,editor,edit_time,auditor,audit_time"
+ ",letter,whether_area_block,classification,attribute,label" + ",letter,whether_area_block,classification,attribute,label,block_type,"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,"; + ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
String httpUrlCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator" String httpUrlCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time" + ",config_time,editor,edit_time,auditor,audit_time"
+ ",letter,whether_area_block,classification,attribute,label" + ",letter,whether_area_block,classification,attribute,label"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,"; + ",userregion1,userregion2,userregion3,userregion4,userregion5,block_type,";
List<IpPortCfg> ipList = new ArrayList<IpPortCfg>(); List<IpPortCfg> ipList = new ArrayList<IpPortCfg>();
List<BaseStringCfg> httpUrlList = new ArrayList<BaseStringCfg>(); List<BaseStringCfg> httpUrlList = new ArrayList<BaseStringCfg>();
List<BaseStringCfg> pktBinList = new ArrayList<BaseStringCfg>(); List<BaseStringCfg> pktBinList = new ArrayList<BaseStringCfg>();
int index=0;
for (CfgIndexInfo cfg : ipLists) { for (CfgIndexInfo cfg : ipLists) {
for (Map<String,Object> logTotal : logTotals) { for (Map<String,Object> logTotal : logTotals) {
if(cfg.getCompileId().equals(Integer.parseInt((String) logTotal.get("compileId")))){ if(cfg.getCompileId().equals(Integer.parseInt((String) logTotal.get("compileId")))){
cfg.setTotalLogs((Long)logTotal.get("sum")); cfg.setTotalLogs((Long)logTotal.get("sum"));
if (entity.getFunctionId().equals(200)){
pxyInterceptCfgs.get(index).setTotalLogs((Long)logTotal.get("sum"));
}
break; break;
} }
} }
@@ -388,29 +624,40 @@ public class InterceptController extends CommonController {
pktBinList.addAll(maps.get("PXY_INTERCEPT_PKT_BIN")); pktBinList.addAll(maps.get("PXY_INTERCEPT_PKT_BIN"));
if (entity.getFunctionId() == 200){ if (entity.getFunctionId() == 200){
Properties msgProp = getMsgProp(); Properties msgProp = getMsgProp();
if(cfg.getAction().equals(1)) { if(cfg.getAction().equals(2)) {
cfg.setUserRegion5(msgProp.getProperty("intercept")); pxyInterceptCfgs.get(index).setUserRegion5(msgProp.getProperty("intercept"));
}else if(cfg.getAction().equals(48)) { }else if(cfg.getAction().equals(48)) {
cfg.setUserRegion5(msgProp.getProperty("action_spoofing")); pxyInterceptCfgs.get(index).setUserRegion5(msgProp.getProperty("action_spoofing"));
}else if(cfg.getAction().equals(128)) { }else if(cfg.getAction().equals(128)) {
cfg.setUserRegion5(msgProp.getProperty("bypass")); pxyInterceptCfgs.get(index).setUserRegion5(msgProp.getProperty("bypass"));
}else { }else {
cfg.setUserRegion5(msgProp.getProperty(DictUtils.getDictLabels("SERVICE_ACTION", cfg.getAction().toString(), cfg.getAction().toString()))); pxyInterceptCfgs.get(index).setUserRegion5(msgProp.getProperty(DictUtils.getDictLabels("SERVICE_ACTION", cfg.getAction().toString(), cfg.getAction().toString())));
} }
} }
if (214==entity.getFunctionId()) {
if (!StringUtil.isBlank(cfg.getUserRegion1())) {
cfg.setUserRegion1(DictUtils.getDictLabels("SPOOFING_IP_TYPE", cfg.getUserRegion1(),cfg.getUserRegion1()));
}
}
index++;
} }
//为何多循环一次???
if (214==entity.getFunctionId()) { /*if (214==entity.getFunctionId()) {
for (CfgIndexInfo cfg : ipLists) { for (CfgIndexInfo cfg : ipLists) {
if (!StringUtil.isBlank(cfg.getUserRegion1())) { if (!StringUtil.isBlank(cfg.getUserRegion1())) {
cfg.setUserRegion1(DictUtils.getDictLabels("SPOOFING_IP_TYPE", cfg.getUserRegion1(),cfg.getUserRegion1())); cfg.setUserRegion1(DictUtils.getDictLabels("SPOOFING_IP_TYPE", cfg.getUserRegion1(),cfg.getUserRegion1()));
} }
} }
} }*/
pktBinList = BaseStringCfg.replaceBaseKeyList(pktBinList); pktBinList = BaseStringCfg.replaceBaseKeyList(pktBinList);
httpUrlList = BaseStringCfg.baseHexList(httpUrlList); httpUrlList = BaseStringCfg.baseHexList(httpUrlList);
dataMap.put(entity.getMenuNameCode(), ipLists); if(entity.getFunctionId().equals(200)) {
dataMap.put(entity.getMenuNameCode(), pxyInterceptCfgs);
}else {
dataMap.put(entity.getMenuNameCode(), ipLists);
}
if (entity.getFunctionId() == 212) { // IP Payload if (entity.getFunctionId() == 212) { // IP Payload
cfgIndexInfoNoExport = ",policy_name,group_name,userregion4,userregion5,&userregion1:replace_zone-userregion2:replaced_content-userregion3:replace_content-"; cfgIndexInfoNoExport = ",policy_name,group_name,userregion4,userregion5,&userregion1:replace_zone-userregion2:replaced_content-userregion3:replace_content-";
titleList.add("PXY_INTERCEPT_IP"); titleList.add("PXY_INTERCEPT_IP");
@@ -422,11 +669,15 @@ public class InterceptController extends CommonController {
dataMap.put("PXY_INTERCEPT_IP", ipList); dataMap.put("PXY_INTERCEPT_IP", ipList);
dataMap.put("PXY_INTERCEPT_PKT_BIN", pktBinList); dataMap.put("PXY_INTERCEPT_PKT_BIN", pktBinList);
} else if (entity.getFunctionId() == 200) {// IP拦截 } else if (entity.getFunctionId() == 200) {// IP拦截
cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,block_type,&userregion1:intercept_file_strategy-userregion2:ratelimit-userregion5:block_type"; cfgIndexInfoNoExport = ",log_total,userRegion1,userRegion5,do_log,policy_name,group_name,userregion3,userregion4,block_type,&userregion2:ratelimit-userregion5:block_type";
titleList.add("PXY_INTERCEPT_IP"); titleList.add("PXY_INTERCEPT_IP");
classMap.put("PXY_INTERCEPT_IP", IpPortCfg.class); classMap.put("PXY_INTERCEPT_IP", IpPortCfg.class);
noExportMap.put("PXY_INTERCEPT_IP", ipPortInfoNoExport); noExportMap.put("PXY_INTERCEPT_IP", ipPortInfoNoExport);
dataMap.put("PXY_INTERCEPT_IP", ipList); dataMap.put("PXY_INTERCEPT_IP", ipList);
titleList.add("PXY_INTERCEPT_DOMAIN");
classMap.put("PXY_INTERCEPT_DOMAIN", HttpUrlCfg.class);
noExportMap.put("PXY_INTERCEPT_DOMAIN", httpUrlCfgNoExport);
dataMap.put("PXY_INTERCEPT_DOMAIN", httpUrlList);
} else if (entity.getFunctionId() == 201) {// 域名拦截 } else if (entity.getFunctionId() == 201) {// 域名拦截
cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,&userregion2:ratelimit-userregion1:intercept_file_strategy-userregion5:intercept_intensity-"; cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,&userregion2:ratelimit-userregion1:intercept_file_strategy-userregion5:intercept_intensity-";
titleList.add("NTC_HTTP_URL"); titleList.add("NTC_HTTP_URL");

View File

@@ -0,0 +1,565 @@
package com.nis.web.controller.configuration.proxy;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
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.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.alibaba.fastjson.JSON;
import com.nis.domain.FunctionRegionDict;
import com.nis.domain.Page;
import com.nis.domain.callback.ProxyFileHijackCfg;
import com.nis.domain.callback.ProxyFileInsertScriptCfg;
import com.nis.domain.callback.ProxyFileResponsePageCfg;
import com.nis.domain.callback.ProxyFileStrategyCfg;
import com.nis.domain.configuration.BaseCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.ComplexkeywordCfg;
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.IpPortCfg;
import com.nis.domain.configuration.ManipulatCfgExport;
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;
import jersey.repackaged.com.google.common.collect.Lists;
/**
* 操控策略业务
*/
@Controller
@RequestMapping("${adminPath}/proxy/control/manipulatPolicy")
public class ManipulatPolicyController extends BaseController {
@RequestMapping("list")
public String list(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, HttpServletRequest request, HttpServletResponse response) {
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
Page<CfgIndexInfo> page = manipulatPolicyService.getPolicyList(searchPage, cfg);
model.addAttribute("page", page);
initPageCondition(model, cfg);
// 获取所有的响应文件内容Block可以选择
/*List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService.getProxyFileStrategyCfgList(new ProxyFileStrategyCfg());
model.addAttribute("allProxyFileStrategys", allProxyFileStrategys);*/
manipulatPolicyService.setFileRegion(model);
return "/cfg/proxy/control/manipulatPolicyList";
}
@RequestMapping("form")
public String form(Model model, @ModelAttribute("cfg") CfgIndexInfo entity, HttpServletRequest request, HttpServletResponse response, String ids) {
if (StringUtils.isNotBlank(ids)) {
entity = manipulatPolicyService.getPolicyCfg(Long.parseLong(ids), null);
HttpUrlCfg urlCfg = new HttpUrlCfg();
urlCfg.setCfgType(Constants.HTTP_REDIRECT_URL_REGION);
entity.setHttpUrl(urlCfg);
HttpReqHeadCfg reqHdrCfg = new HttpReqHeadCfg();
reqHdrCfg.setCfgType(Constants.HTTP_REDIRECT_REQ_HEAD_REGION);
entity.setHttpReqHdr(reqHdrCfg);
HttpResHeadCfg resHdrCfg = new HttpResHeadCfg();
resHdrCfg.setCfgType(Constants.HTTP_REDIRECT_RES_HEAD_REGION);
entity.setHttpResHdr(resHdrCfg);
HttpBodyCfg reqBodyCfg = new HttpBodyCfg();
reqBodyCfg.setCfgType(Constants.HTTP_REDIRECT_REQ_BODY_REGION);
entity.setHttpReqBody(reqBodyCfg);
HttpBodyCfg resBodyCfg = new HttpBodyCfg();
resBodyCfg.setCfgType(Constants.HTTP_REDIRECT_RES_BODY_REGION);
entity.setHttpResBody(resBodyCfg);
IpPortCfg ipPortCfg = new IpPortCfg();
ipPortCfg.setCfgType(Constants.HTTP_REDIRECT_IP_REGION);
entity.setIpPort(ipPortCfg);
NtcSubscribeIdCfg subscribeIdCfg = new NtcSubscribeIdCfg();
subscribeIdCfg.setCfgType(Constants.PXY_CRTL_SUBSCRIBE_ID_REGION);
entity.setNtcSubscribeIdCfg(subscribeIdCfg);
if (entity.getHttpUrlList().size() == 0) {
entity.getHttpUrlList().add(urlCfg);
}
if (entity.getHttpReqHdrList().size() == 0) {
entity.getHttpReqHdrList().add(reqHdrCfg);
}
if (entity.getHttpResHdrList().size() == 0) {
entity.getHttpResHdrList().add(resHdrCfg);
}
if (entity.getHttpReqBodyList().size() == 0) {
entity.getHttpReqBodyList().add(reqBodyCfg);
}
if (entity.getHttpResBodyList().size() == 0) {
entity.getHttpResBodyList().add(resBodyCfg);
}
if (entity.getIpPortList().size() == 0) {
entity.getIpPortList().add(ipPortCfg);
}
if (entity.getNtcSubscribeIdCfgList().size() == 0) {
entity.getNtcSubscribeIdCfgList().add(subscribeIdCfg);
}
initUpdateFormCondition(model, entity);
manipulatPolicyService.setFileRegion(model);
} else {
// 设置http各类配置的配置域类型
HttpUrlCfg urlCfg = new HttpUrlCfg();
urlCfg.setCfgType(Constants.HTTP_REDIRECT_URL_REGION);
entity.setHttpUrl(urlCfg);
HttpReqHeadCfg reqHdrCfg = new HttpReqHeadCfg();
reqHdrCfg.setCfgType(Constants.HTTP_REDIRECT_REQ_HEAD_REGION);
entity.setHttpReqHdr(reqHdrCfg);
HttpResHeadCfg resHdrCfg = new HttpResHeadCfg();
resHdrCfg.setCfgType(Constants.HTTP_REDIRECT_RES_HEAD_REGION);
entity.setHttpResHdr(resHdrCfg);
HttpBodyCfg reqBodyCfg = new HttpBodyCfg();
reqBodyCfg.setCfgType(Constants.HTTP_REDIRECT_REQ_BODY_REGION);
entity.setHttpReqBody(reqBodyCfg);
HttpBodyCfg resBodyCfg = new HttpBodyCfg();
resBodyCfg.setCfgType(Constants.HTTP_REDIRECT_RES_BODY_REGION);
entity.setHttpResBody(resBodyCfg);
IpPortCfg ipPortCfg = new IpPortCfg();
ipPortCfg.setCfgType(Constants.HTTP_IP_REGION);
entity.setIpPort(ipPortCfg);
// subscribeId
NtcSubscribeIdCfg subscribeIdCfg = new NtcSubscribeIdCfg();
subscribeIdCfg.setCfgType(Constants.PXY_CRTL_SUBSCRIBE_ID_REGION);
entity.setNtcSubscribeIdCfg(subscribeIdCfg);
List<HttpUrlCfg> urlList = new ArrayList<HttpUrlCfg>();
urlList.add(urlCfg);
entity.setHttpUrlList(urlList);
List<HttpReqHeadCfg> reqHdrList = new ArrayList<HttpReqHeadCfg>();
reqHdrList.add(reqHdrCfg);
entity.setHttpReqHdrList(reqHdrList);
List<HttpResHeadCfg> resHdrList = new ArrayList<HttpResHeadCfg>();
resHdrList.add(resHdrCfg);
entity.setHttpResHdrList(resHdrList);
List<HttpBodyCfg> reqBodyList = new ArrayList<HttpBodyCfg>();
reqBodyList.add(reqBodyCfg);
entity.setHttpReqBodyList(reqBodyList);
List<HttpBodyCfg> resBodyList = new ArrayList<HttpBodyCfg>();
resBodyList.add(resBodyCfg);
entity.setHttpResBodyList(resBodyList);
List<IpPortCfg> ipPortList = new ArrayList<IpPortCfg>();
ipPortList.add(ipPortCfg);
entity.setIpPortList(ipPortList);
List<NtcSubscribeIdCfg> subscribeCfgList = Lists.newArrayList();
subscribeCfgList.add(subscribeIdCfg);
entity.setNtcSubscribeIdCfgList(subscribeCfgList);
initFormCondition(model, entity);
}
// 获取所有的响应文件内容Block可以选择
/*List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService.getProxyFileStrategyCfgList(new ProxyFileStrategyCfg());
model.addAttribute("allProxyFileStrategys", allProxyFileStrategys);*/
model.addAttribute("_cfg", entity);
return "/cfg/proxy/control/manipulatPolicyForm";
}
@RequestMapping("saveOrUpdate")
public String saveOrUpdate(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response) {
try {
manipulatPolicyService.savePolicyCfg(cfg);
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) { // 配置仅保存
addMessage(redirectAttributes, "success", "save_success");
}else { // 配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (Exception e) {
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/control/manipulatPolicy/list?functionId=" + cfg.getFunctionId();
}
@RequestMapping("ajaxPolicySubList")
public String ajaxPolicySubList(Model model, Long cfgId, Integer index, Integer compileId) {
CfgIndexInfo cfg = manipulatPolicyService.getPolicyCfg(cfgId, compileId);
model.addAttribute("_cfg", cfg);
model.addAttribute("index", index);
return "/cfg/proxy/control/httpRedirectSubList";
}
@RequestMapping("delete")
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
try {
if (!StringUtil.isEmpty(ids)) {
manipulatPolicyService.updatePolicyCfgValid(isValid, ids, functionId);
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
} 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", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath + "/proxy/control/manipulatPolicy/list?functionId=" + functionId;
}
@RequestMapping("audit")
public String audit(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, Integer isValid, Integer isAudit, String ids,
Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,HttpServletRequest request) {
if (!StringUtil.isEmpty(ids)) {
CfgIndexInfo entity = new CfgIndexInfo();
String[] idArray = ids.split(",");
for (String id : idArray) {
entity = manipulatPolicyService.getPolicyCfg(Long.parseLong(id), null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
manipulatPolicyService.auditPolicyCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
e.printStackTrace();
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);
}
}
}
} else {// 条件下所有配置审核
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
Page<CfgIndexInfo> auditPage = new Page<CfgIndexInfo>(request, response, "a");
BeanUtils.copyProperties(searchPage, auditPage);
try {
auditAll(auditPage, isValid, cfg);
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", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return list(model, cfg, request, response);
}
return "redirect:" + adminPath + "/proxy/control/manipulatPolicy/list?functionId=" + functionId;
}
// 配置导出
@RequestMapping(value = "exportPolicy")
public void exportPolicy(Model model,@ModelAttribute("cfg") CfgIndexInfo entity, String ids, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response) {
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>();
List<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId());
List<CfgIndexInfo> ipLists = new ArrayList<CfgIndexInfo>();
// 导出选中记录
if (!StringUtil.isEmpty(ids)) {
ipLists = ipCfgService.getByIdsList(ids);
} else {
Page<CfgIndexInfo> pageInfo = new Page<CfgIndexInfo>(request, response, "a");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page<CfgIndexInfo> page = manipulatPolicyService.getPolicyList(pageInfo, entity);
ipLists = page.getList();
}
//日志总量
List<Map<String,Object>> logTotals=new ArrayList<Map<String,Object>>();
StringBuilder compileIds=new StringBuilder(",");//配置ids
Set<Integer> set=new HashSet<Integer>();//服务ids
Map<String, String> blockDict = DictUtils.getDictMap("RESPONSE_CODE"); // Block
Map<String, String> redirectDict = DictUtils.getDictMap("REDIRECT_RESPONSE_CODE"); // Redirect
Map<String, String> replaceDict = DictUtils.getDictMap("CONTROL_REPLACE_ZONE"); // Replace
// 用于检索引用的文件配置信息
ProxyFileResponsePageCfg searchResponseFile = new ProxyFileResponsePageCfg();
ProxyFileHijackCfg searchHijackFile = new ProxyFileHijackCfg();
ProxyFileInsertScriptCfg searchInsertFile = new ProxyFileInsertScriptCfg();
Properties prop = getMsgProp();
List<ManipulatCfgExport> baseLists = new ArrayList<ManipulatCfgExport>();
for (CfgIndexInfo source : ipLists) {
ManipulatCfgExport str = new ManipulatCfgExport();
BeanUtils.copyProperties(source, str);
str.setActionExport("action_manipulate");
if(str.getUserRegion5().equals("85")) {
str.setMethodExport("action_hijack");
}else if(str.getUserRegion5().equals("90")) {
str.setMethodExport("action_insert");
}else {
str.setMethodExport(str.getUserRegion5());
}
if(str.getIsAudit()!=0){
set.add(str.getServiceId());
compileIds.append(str.getCompileId()+",");
}else{
Map<String,Object> logTotal=new HashMap<String,Object>();
logTotal.put("compileId", str.getCompileId()+"");
logTotal.put("sum",0L);
logTotals.add(logTotal);
}
if (!str.getUserRegion5().equals("85") && !str.getUserRegion5().equals("90")) {
String value = "";
/*if(str.getUserRegion5().equals("16")) {// Block
value = blockDict.get(str.getUserRegion1());
str.setResponseCode(prop.getProperty(value));
str.setUserRegion1(str.getUserRegion2());
str.setUserRegion2(null);
}else*/
if(str.getUserRegion5().equals("48")) {// Redirect
value = redirectDict.get(str.getUserRegion1());
str.setResponseCode(prop.getProperty(value));
str.setUserRegion1(null);
}else if(str.getUserRegion5().equals("80")) {// Replace
value = replaceDict.get(str.getUserRegion1());
str.setUserRegion5(str.getUserRegion3());
str.setUserRegion3(prop.getProperty(value));
str.setUserRegion4(str.getUserRegion2());
str.setUserRegion1(null);
str.setUserRegion2(null);
}
/*if (str.getUserRegion5().equals("16") || str.getUserRegion5().equals("48")) {
if (!StringUtil.isEmpty(str.getUserRegion3())) { // 是否存在文件策略
searchResponseFile.setCompileId(Integer.valueOf(str.getUserRegion3()));
List<ProxyFileResponsePageCfg> allProxyFileStrategys = proxyFileResponsePageService.getProxyFileResponsePageCfgList(searchResponseFile);
if (allProxyFileStrategys != null && allProxyFileStrategys.size() > 0) {
str.setUserRegion1(allProxyFileStrategys.get(0).getFileDesc());
}
str.setUserRegion3(null);
}
}*/
}
if(str.getUserRegion5().equals("48") || str.getUserRegion5().equals("85") ||
str.getUserRegion5().equals("90")) {
if(str.getUserRegion5().equals("85")) {
searchHijackFile.setCompileId(Integer.parseInt(source.getUserRegion4()));
Page<ProxyFileHijackCfg> page = proxyFileHijackService.findPage(new Page<ProxyFileHijackCfg>(request, response, "a"), searchHijackFile);
List<ProxyFileHijackCfg> list = page.getList();
if(list != null && list.size() > 0) {
str.setProfileInfo(list.get(0).getCfgDesc());
}
//str.setUserRegion1(null);
str.setUserRegion4(null);
}else if(str.getUserRegion5().equals("90")) {
searchInsertFile.setCompileId(Integer.parseInt(source.getUserRegion4()));
Page<ProxyFileInsertScriptCfg> page = proxyFileInsertScriptService.findPage(new Page<ProxyFileInsertScriptCfg>(request, response, "a"), searchInsertFile);
List<ProxyFileInsertScriptCfg> list = page.getList();
if(list != null && list.size() > 0) {
str.setProfileInfo(list.get(0).getCfgDesc());
}
str.setUserRegion4(null);
}
str.setUserRegion5(null);
}
baseLists.add(str);
}
//获取日志总量
StringBuilder serviceIds=new StringBuilder(",");
if(set.size()>0) {
for (Integer id : set) {
serviceIds.append(id+",");
}
String serviceIdsStr=serviceIds.toString().substring(1, serviceIds.length()-1);
String compileIdsStr=compileIds.toString().substring(1, compileIds.length()-1);
if(!StringUtils.isBlank(serviceIdsStr)&&!StringUtils.isBlank(compileIdsStr)){
List<Map<String,Object>> logs = getLogTotal( null,serviceIdsStr,compileIdsStr);
logTotals.addAll(logs);
}
}
String cfgIndexInfoNoExport = ",log_total,policy_name,group_name,userregion1,&method_export:method-responseCode:response_code-userregion2:redirect_url-userregion3:replace_zone-userregion4:replaced_content-userregion5:replace_content-";
String httpUrlCfgNoExport = ",do_log,action,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,";
String httpReqHeadCfgNoExport = ",do_log,action,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,";
String httpResHeadCfgNoExport = ",do_log,action,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,";
String httpReqBodyCfgNoExport = ",do_log,action,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,";
String httpResBodyCfgNoExport = ",do_log,action,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,";
String ipPortCfgNoExport = ",do_log,action,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,";
String ntcSubscribeIdCfgNoExport = ",do_log,action,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,";
// 时间过滤
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
}
if (!StringUtil.isEmpty(entity.gethColumns())) {
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
}
List<BaseStringCfg> httpUrlList = new ArrayList<>();
List<ComplexkeywordCfg> httpReqHdrList = new ArrayList<>();
List<ComplexkeywordCfg> httpResHdrList = new ArrayList<>();
List<BaseStringCfg> httpReqBodyList = new ArrayList<>();
List<BaseStringCfg> httpResBodyList = new ArrayList<>();
List<IpPortCfg> ipPortList = new ArrayList<>();
List<BaseStringCfg> subscribeIdList = new ArrayList<>();
for (ManipulatCfgExport cfg : baseLists) {
Map<String, List> maps = manipulatPolicyService.exportHttpCfg(cfg);
httpUrlList.addAll(maps.get("NTC_HTTP_URL"));
httpReqHdrList.addAll(maps.get("NTC_HTTP_REQ_HDR"));
httpResHdrList.addAll(maps.get("NTC_HTTP_RES_HDR"));
httpReqBodyList.addAll(maps.get("NTC_HTTP_REQ_BODY"));
httpResBodyList.addAll(maps.get("NTC_HTTP_RES_BODY"));
ipPortList.addAll(maps.get("NTC_UNIVERSAL_IP"));
subscribeIdList.addAll(maps.get("NTC_SUBSCRIBE_ID"));
for (Map<String,Object> logTotal : logTotals) {
if(cfg.getCompileId().equals(Integer.parseInt((String) logTotal.get("compileId")))){
cfg.setTotalLogs((Long)logTotal.get("sum"));
break;
}
}
}
httpUrlList = BaseStringCfg.replaceBaseKeyList(httpUrlList);
httpReqHdrList = ComplexkeywordCfg.replaceComplexKeyList(httpReqHdrList);
httpResHdrList = ComplexkeywordCfg.replaceComplexKeyList(httpResHdrList);
httpReqBodyList = BaseStringCfg.replaceBaseKeyList(httpReqBodyList);
httpResBodyList = BaseStringCfg.replaceBaseKeyList(httpResBodyList);
subscribeIdList = BaseStringCfg.baseHexList(subscribeIdList);
titleList.add(entity.getMenuNameCode());
titleList.add("NTC_HTTP_URL");
titleList.add("NTC_HTTP_REQ_HDR");
classMap.put(entity.getMenuNameCode(), ManipulatCfgExport.class);
classMap.put("NTC_HTTP_URL", HttpUrlCfg.class);
classMap.put("NTC_HTTP_REQ_HDR", HttpReqHeadCfg.class);
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
noExportMap.put("NTC_HTTP_URL", httpUrlCfgNoExport);
noExportMap.put("NTC_HTTP_REQ_HDR", httpReqHeadCfgNoExport);
dataMap.put(entity.getMenuNameCode(), baseLists);
dataMap.put("NTC_HTTP_URL", httpUrlList);
dataMap.put("NTC_HTTP_REQ_HDR", httpReqHdrList);
titleList.add("NTC_HTTP_RES_HDR");
titleList.add("NTC_HTTP_REQ_BODY");
classMap.put("NTC_HTTP_RES_HDR", HttpResHeadCfg.class);
classMap.put("NTC_HTTP_REQ_BODY", HttpBodyCfg.class);
noExportMap.put("NTC_HTTP_RES_HDR", httpResHeadCfgNoExport);
noExportMap.put("NTC_HTTP_REQ_BODY", httpReqBodyCfgNoExport);
dataMap.put("NTC_HTTP_RES_HDR", httpResHdrList);
dataMap.put("NTC_HTTP_REQ_BODY", httpReqBodyList);
titleList.add("NTC_UNIVERSAL_IP");
titleList.add("NTC_SUBSCRIBE_ID");
classMap.put("NTC_UNIVERSAL_IP", IpPortCfg.class);
classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class);
noExportMap.put("NTC_UNIVERSAL_IP", ipPortCfgNoExport);
noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport);
dataMap.put("NTC_UNIVERSAL_IP", ipPortList);
dataMap.put("NTC_SUBSCRIBE_ID", subscribeIdList);
String timeRange = initTimeMap(entity);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(entity.getExType())) {
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
}
} catch (Exception e) {
logger.error("http export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@ResponseBody
@RequestMapping("ajaxGetProfileInfo")
public List<BaseCfg> ajaxGetProfileInfo(Integer source, HttpServletRequest request, HttpServletResponse response){
return manipulatPolicyService.getProfileInfo(source);
}
}

View File

@@ -13,6 +13,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
@@ -26,13 +27,15 @@ import javax.net.ssl.TrustManagerFactory;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils; import org.springframework.beans.BeanUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.util.FileCopyUtils; import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes; import org.springframework.web.servlet.mvc.support.RedirectAttributes;
@@ -60,6 +63,7 @@ import com.nis.util.JsonMapper;
import com.nis.util.LogUtils; import com.nis.util.LogUtils;
import com.nis.util.StringUtil; import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController; import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
/** /**
* 拦截策略 * 拦截策略
@@ -210,7 +214,7 @@ public class PxyObjKeyringController extends BaseController {
String filename = publicKeyFileI.getOriginalFilename(); String filename = publicKeyFileI.getOriginalFilename();
String prefix = FileUtils.getPrefix(filename, false); String prefix = FileUtils.getPrefix(filename, false);
String suffix = FileUtils.getSuffix(filename, false); String suffix = FileUtils.getSuffix(filename, false);
file = File.createTempFile("file_" + prefix, suffix); file = File.createTempFile("file_" + prefix, FileUtils.getSuffix(filename, true));
publicKeyFileI.transferTo(file);// 复制文件 publicKeyFileI.transferTo(file);// 复制文件
String md5 = FileUtils.getFileMD5(file); String md5 = FileUtils.getFileMD5(file);
Map<String, Object> srcMap = Maps.newHashMap(); Map<String, Object> srcMap = Maps.newHashMap();
@@ -234,7 +238,7 @@ public class PxyObjKeyringController extends BaseController {
String filename = privateKeyFileI.getOriginalFilename(); String filename = privateKeyFileI.getOriginalFilename();
String prefix = FileUtils.getPrefix(filename, false); String prefix = FileUtils.getPrefix(filename, false);
String suffix = FileUtils.getSuffix(filename, false); String suffix = FileUtils.getSuffix(filename, false);
file = File.createTempFile("file_" + prefix, suffix); file = File.createTempFile("file_" + prefix, FileUtils.getSuffix(filename, true));
privateKeyFileI.transferTo(file);// 复制文件 privateKeyFileI.transferTo(file);// 复制文件
String md5 = FileUtils.getFileMD5(file); String md5 = FileUtils.getFileMD5(file);
Map<String, Object> srcMap = Maps.newHashMap(); Map<String, Object> srcMap = Maps.newHashMap();
@@ -292,6 +296,13 @@ public class PxyObjKeyringController extends BaseController {
* @throws Exception * @throws Exception
*/ */
public boolean validCertFileContent(MultipartFile file,MultipartFile privateFile, String validateType) throws Exception { public boolean validCertFileContent(MultipartFile file,MultipartFile privateFile, String validateType) throws Exception {
boolean delTempFile=true;
//内置可信证书列表不允许删除
if("-incacert".equals(validateType)) {
delTempFile=false;
validateType="-incert";
}
String os = System.getProperty("os.name").toLowerCase(); String os = System.getProperty("os.name").toLowerCase();
if (!os.contains("windows") && file != null) { if (!os.contains("windows") && file != null) {
// 证书文件临时保存路径 // 证书文件临时保存路径
@@ -319,7 +330,7 @@ public class PxyObjKeyringController extends BaseController {
// 验证文件 // 验证文件
logger.info(x509Shell + " " + validateType + " " + filePath+ " " + privateFilePath); logger.info(x509Shell + " " + validateType + " " + filePath+ " " + privateFilePath);
Map<String, Object> resultMap = this.execShell(x509Shell, validateType, filePath, privateFilePath); Map<String, Object> resultMap = this.execShell(x509Shell, validateType, filePath, privateFilePath);
if (resultMap == null || StringUtil.isEmpty(resultMap.get("out"))) { if (resultMap == null || StringUtil.isEmpty(resultMap.get("out"))) {
// 临时文件删除 // 临时文件删除
logger.info("delete file" + filePath); logger.info("delete file" + filePath);
@@ -342,9 +353,15 @@ public class PxyObjKeyringController extends BaseController {
return false; return false;
} }
// 临时文件删除 // 临时文件删除
logger.info("delete file" + filePath); if(!delTempFile) {
FileUtils.deleteFile(filePath); this.certInfoMap.put("certFilePath", filePath);
logger.info("证书列表文件目录"+certInfoMap.get("certFilePath"));
}else {
logger.info("delete file" + filePath);
FileUtils.deleteFile(filePath);
}
} }
return true; return true;
} }
@@ -355,6 +372,23 @@ public class PxyObjKeyringController extends BaseController {
// 查询时left join policyGroup // 查询时left join policyGroup
Page<PxyObjKeyring> page = pxyObjKeyringService.findPage(new Page<PxyObjKeyring>(request, response, "r"), Page<PxyObjKeyring> page = pxyObjKeyringService.findPage(new Page<PxyObjKeyring>(request, response, "r"),
entity); entity);
//查询是否存在内置配置
PxyObjKeyring searchEntity0=new PxyObjKeyring();
searchEntity0.setCompileId(0);
PxyObjKeyring searchEntity1=new PxyObjKeyring();
searchEntity1.setCompileId(1);
Page<PxyObjKeyring> searchPage=new Page<PxyObjKeyring>();
Page<PxyObjKeyring> builtInPage0 = pxyObjKeyringService.findPage(searchPage,
searchEntity0);
Page<PxyObjKeyring> builtInPage1 = pxyObjKeyringService.findPage(searchPage,
searchEntity1);
if((builtInPage0 != null && !StringUtil.isEmpty(builtInPage0.getList())) || (builtInPage1 != null && !StringUtil.isEmpty(builtInPage1.getList()))) {
model.addAttribute("hasBuiltIn", true);
}else {
model.addAttribute("hasBuiltIn", false);
}
model.addAttribute("page", page); model.addAttribute("page", page);
initPageCondition(model, entity); initPageCondition(model, entity);
return "/cfg/intercept/strateagy/list"; return "/cfg/intercept/strateagy/list";
@@ -535,9 +569,12 @@ public class PxyObjKeyringController extends BaseController {
Page<PxyObjTrustedCaCert> page = pxyObjKeyringService.findTrustedCertPage(pageInfo, entity); Page<PxyObjTrustedCaCert> page = pxyObjKeyringService.findTrustedCertPage(pageInfo, entity);
ipLists = page.getList(); ipLists = page.getList();
} }
Properties prop = getMsgProp();
for (PxyObjTrustedCaCert cert : ipLists) { for (PxyObjTrustedCaCert cert : ipLists) {
if (!StringUtil.isEmpty(cert.getCompileId())) { if (!StringUtil.isEmpty(cert.getCompileId())) {
cert.setCrlFile(ConfigDictUtils.getTrustedCrlByCerId(cert.getCompileId())); cert.setCrlFile(ConfigDictUtils.getTrustedCrlByCerId(cert.getCompileId()));
cert.setBuiltInExp(prop.getProperty(cert.getBuiltIn()==0?"no":"yes"));
} }
} }
titleList.add(entity.getMenuNameCode()); titleList.add(entity.getMenuNameCode());
@@ -585,6 +622,20 @@ public class PxyObjKeyringController extends BaseController {
@ModelAttribute("cfg") PxyObjTrustedCaCert entity, RedirectAttributes redirectAttributes) { @ModelAttribute("cfg") PxyObjTrustedCaCert entity, RedirectAttributes redirectAttributes) {
Page<PxyObjTrustedCaCert> page = pxyObjKeyringService Page<PxyObjTrustedCaCert> page = pxyObjKeyringService
.findTrustedCertPage(new Page<PxyObjTrustedCaCert>(request, response, "r"), entity); .findTrustedCertPage(new Page<PxyObjTrustedCaCert>(request, response, "r"), entity);
//判断是否存在内置证书,不存在则按钮开放。
PxyObjTrustedCaCert searchBuiltIn=new PxyObjTrustedCaCert();
searchBuiltIn.setBuiltIn(1);
searchBuiltIn.setIsValid(1);
searchBuiltIn.setIsAudit(1);
Page<PxyObjTrustedCaCert> searchPage =new Page<PxyObjTrustedCaCert>();
Page<PxyObjTrustedCaCert> builtInReslt = pxyObjKeyringService
.findTrustedCertPage(searchPage, searchBuiltIn);
if(builtInReslt != null && !StringUtil.isEmpty(builtInReslt.getList())) {
model.addAttribute("hasBuiltIn", true);
}else {
model.addAttribute("hasBuiltIn", false);
}
model.addAttribute("page", page); model.addAttribute("page", page);
initPageCondition(model, entity); initPageCondition(model, entity);
return "/cfg/intercept/strateagy/trustedCertList"; return "/cfg/intercept/strateagy/trustedCertList";
@@ -666,7 +717,7 @@ public class PxyObjKeyringController extends BaseController {
String filename = certFileI.getOriginalFilename(); String filename = certFileI.getOriginalFilename();
String prefix = FileUtils.getPrefix(filename, false); String prefix = FileUtils.getPrefix(filename, false);
String suffix = FileUtils.getSuffix(filename, false); String suffix = FileUtils.getSuffix(filename, false);
file = File.createTempFile("file_" + prefix, suffix); file = File.createTempFile("file_" + prefix, FileUtils.getSuffix(filename, true));
certFileI.transferTo(file);// 复制文件 certFileI.transferTo(file);// 复制文件
String md5 = FileUtils.getFileMD5(file); String md5 = FileUtils.getFileMD5(file);
Map<String, Object> srcMap = Maps.newHashMap(); Map<String, Object> srcMap = Maps.newHashMap();
@@ -746,7 +797,7 @@ public class PxyObjKeyringController extends BaseController {
LogUtils.saveLog(request, null, e, null); LogUtils.saveLog(request, null, e, null);
} }
} }
try { try {
if (validFlag) { if (validFlag) {
validFlag = true; validFlag = true;
@@ -762,7 +813,7 @@ public class PxyObjKeyringController extends BaseController {
} else { } else {
cfg.setIssuer(issuer); cfg.setIssuer(issuer);
} }
} }
} else { } else {
logger.error("crl的issuser为空"); logger.error("crl的issuser为空");
@@ -787,7 +838,7 @@ public class PxyObjKeyringController extends BaseController {
String filename = crlFileI.getOriginalFilename(); String filename = crlFileI.getOriginalFilename();
String prefix = FileUtils.getPrefix(filename, false); String prefix = FileUtils.getPrefix(filename, false);
String suffix = FileUtils.getSuffix(filename, false); String suffix = FileUtils.getSuffix(filename, false);
file = File.createTempFile("file_" + prefix, suffix); file = File.createTempFile("file_" + prefix, FileUtils.getSuffix(filename, true));
crlFileI.transferTo(file);// 复制文件 crlFileI.transferTo(file);// 复制文件
String md5 = FileUtils.getFileMD5(file); String md5 = FileUtils.getFileMD5(file);
Map<String, Object> srcMap = Maps.newHashMap(); Map<String, Object> srcMap = Maps.newHashMap();
@@ -807,10 +858,10 @@ public class PxyObjKeyringController extends BaseController {
} }
} }
pxyObjKeyringService.trustedCrlsaveOrUpdate(cfg); pxyObjKeyringService.trustedCrlsaveOrUpdate(cfg);
addMessage(redirectAttributes, "success", "save_success"); addMessage(redirectAttributes, "success", "save_success");
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("crl上传失败", e); logger.error("crl上传失败", e);
if (e instanceof MaatConvertException) { if (e instanceof MaatConvertException) {
@@ -824,9 +875,415 @@ public class PxyObjKeyringController extends BaseController {
LogUtils.saveLog(request, null, e, null); LogUtils.saveLog(request, null, e, null);
} }
} }
return "redirect:" + adminPath + "/proxy/intercept/strateagy/trustedCertList?functionId=" + cfg.getFunctionId(); return "redirect:" + adminPath + "/proxy/intercept/strateagy/trustedCertList?functionId=" + cfg.getFunctionId();
} }
/**
* 内置可信证书导入
* @param model
* @param request
* @param response
* @param cfg
* @param crlFileI
* @param redirectAttributes
* @return
*/
@RequestMapping(value = { "/addBuiltInCert" })
public String trustedCertBuiltIn(Model model, HttpServletRequest request, HttpServletResponse response,
@ModelAttribute("cfg") PxyObjTrustedCaCert cfg, MultipartFile crlFileI,
RedirectAttributes redirectAttributes) {
logger.info("证书列表开始校验");
boolean validFlag = true;
try {
if(crlFileI != null) {
//校验证书格式
boolean certFileflag = validCertFileContent(crlFileI,null, "-incacert");
logger.info("证书列表校验结果"+certFileflag);
if (!certFileflag) {
addMessage(redirectAttributes, "error", "save_failed");
logger.error(crlFileI.getOriginalFilename() + " file non crl file format ");
throw new MultiPartNewException(this.getMsgProp().getProperty("cert_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);
}
}
logger.info("证书列表开始解析");
//2、调用脚本生成pem文件
//./cacert.sh tls-ca-bundle.pem /home/ddm/cacert
String certFilePath="";
String resultDirPath="";
try {
if(validFlag && !certInfoMap.isEmpty() && !StringUtil.isEmpty(certInfoMap.get("certFilePath"))) {
certFilePath=certInfoMap.get("certFilePath").toString();
logger.info("证书列表解析文件"+certFilePath);
String cacert = Thread.currentThread().getContextClassLoader()
.getResource(File.separator + "shell" + File.separator + Constants.CA_CERT_FILE).getPath();
this.execShell("", "chmod", "+x", cacert);
logger.info(Constants.CA_CERT_FILE+"脚本分配可执行权限:" + "chmod" + " " + "+x" + " " + cacert);
FileUtils.createDirectory(Constants.CA_CERT_DIR);
resultDirPath = Constants.CA_CERT_DIR;
logger.info("证书列表解析结果目录"+resultDirPath);
this.execShell(cacert, certFilePath,resultDirPath);
logger.info("内置证书文件生成:"+cacert + " " + certFilePath+" "+resultDirPath);
}
//删除临时文件
if(!StringUtil.isEmpty(certFilePath)) {
logger.info("delete file" + certFilePath);
FileUtils.deleteFile(certFilePath);
}
} catch (Exception e) {
validFlag = false;
logger.error("可信证书列表解析失败", e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
logger.info("所有证书开始校验");
//校验内置证书并获取issuer信息
File fileDir=null;
Map<String,String> issuerMap=new HashMap<>();
if(validFlag && !StringUtil.isEmpty(resultDirPath)) {
logger.info("证书列表文件解析结果目录:"+resultDirPath);
fileDir=new File(resultDirPath);
try {
if(validFlag) {
for (File file : fileDir.listFiles()) {
FileInputStream fileInputStream = new FileInputStream(file);
MultipartFile multipartFile = new MockMultipartFile(file.getName(),fileInputStream);
//校验证书格式
boolean validResult = validCertFileContent(multipartFile,null, "-incacert");
logger.info("证书校验结果"+validResult);
if (validResult && !certInfoMap.isEmpty() && !StringUtil.isEmpty(certInfoMap.get("ca issuer"))) {
String issuer=certInfoMap.get("ca issuer").toString();
issuerMap.put(file.getName(), issuer);
}else{
addMessage(redirectAttributes, "error", "save_failed");
logger.error(crlFileI.getOriginalFilename() + " file non crl file format ");
throw new MultiPartNewException(this.getMsgProp().getProperty("cert_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);
}
}
}
logger.info("所有证书开始上传minio");
List<PxyObjTrustedCaCert> caCertList=new ArrayList<PxyObjTrustedCaCert>();
if(validFlag && fileDir != null && !StringUtil.isEmpty(fileDir.listFiles())) {
int index=1;
for (File file : fileDir.listFiles()) {
File newFile = null;
String filename ="";
try {
FileInputStream fileInputStream = new FileInputStream(file);
MultipartFile multipartFile = new MockMultipartFile(file.getName(),fileInputStream);
PxyObjTrustedCaCert cacertBuitIn=new PxyObjTrustedCaCert();
cfg.setBuiltIn(1);
BeanUtils.copyProperties(cfg, cacertBuitIn);
filename = file.getName();
String prefix = FileUtils.getPrefix(filename, false);
String suffix = FileUtils.getSuffix(filename, false);
newFile = File.createTempFile("file_" + prefix, FileUtils.getSuffix(filename, true));
multipartFile.transferTo(newFile);// 复制文件
String md5 = FileUtils.getFileMD5(file);
Map<String, Object> srcMap = Maps.newHashMap();
srcMap.put("filetype", suffix);
srcMap.put("datatype", "dbSystem");// 源文件存入数据中心
srcMap.put("createTime", new Date());
srcMap.put("key", prefix);
srcMap.put("fileName", filename);
srcMap.put("checksum", md5);
ToMaatResult result = ConfigServiceUtil.postFileCfg(null, file, JsonMapper.toJsonString(srcMap));
logger.info("可信证书内置证书 文件上传响应信息:" + JsonMapper.toJsonString(result));
String crlFileAccessUrl = null;
if (!StringUtil.isEmpty(result)) {
ResponseData data = result.getData();
crlFileAccessUrl = data.getAccessUrl();
cacertBuitIn.setCertFile(crlFileAccessUrl);
}
cacertBuitIn.setIssuer(issuerMap.get(file.getName()));
cacertBuitIn.setCfgDesc("built-in_cert"+index);
caCertList.add(cacertBuitIn);
} catch (Exception e) {
validFlag = false;
logger.error("内置可信证书"+filename+"上传minio失败", 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);
}
}
index++;
}
}
logger.info("所有证书信息开始入库并下发");
//入库并下发
if(validFlag){
try {
if(!StringUtil.isEmpty(caCertList)){
pxyObjKeyringService.caCertSaveAndAudit(caCertList);
}
}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 {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}
return "redirect:" + adminPath + "/proxy/intercept/strateagy/trustedCertList?functionId=" + cfg.getFunctionId();
}
/**
* 内置Keyring 导入功能
* @param model
* @param request
* @param response
* @param cfg
* @param certFileI
* @param redirectAttributes
* @return
*/
@RequestMapping(value = { "/addKeyRingBuiltInCert" })
public String addKeyRingBuiltInCert(Model model, HttpServletRequest request, HttpServletResponse response,
@ModelAttribute("cfg") PxyObjKeyring cfg, @RequestParam("certFileI")MultipartFile[] certFileI,
RedirectAttributes redirectAttributes) {
logger.info("keyring内置证书开始校验");
boolean validFlag = true;
//每个证书文件的内容
Map<String, Map> fileCertMap=new HashMap<>();
try {
if(certFileI != null && certFileI.length > 0) {
for (MultipartFile multipartFile : certFileI) {
//校验证书格式
boolean certFileflag = validCertFileContent(multipartFile,null, "-incert");
logger.info("证书列表校验结果"+certFileflag);
if (!certFileflag) {
addMessage(redirectAttributes, "error", "save_failed");
logger.error(multipartFile.getOriginalFilename() + " file non crl file format ");
throw new MultiPartNewException(this.getMsgProp().getProperty("cert_file_error"));
}else {
if(!certInfoMap.isEmpty()) {
String issuer = StringUtil.isEmpty(certInfoMap.get("ca issuer")) ? ""
: certInfoMap.get("ca issuer").toString();// 颁发者
String fingerprint = StringUtil.isEmpty(certInfoMap.get("ca fingerprint")) ? ""
: certInfoMap.get("ca fingerprint").toString();// 指纹
if(!StringUtil.isEmpty(issuer) && !StringUtil.isEmpty(fingerprint)) {
if(Constants.KEYRING_BUILT_IN_ISSER.contains("||"+issuer+"||")
&& Constants.KEYRING_BUILT_IN_FINGERPRINT.contains("||"+fingerprint+"||")) {
fileCertMap.put(multipartFile.getOriginalFilename(), certInfoMap);
}else {
validFlag=false;
break;
}
}else {
validFlag=false;
break;
}
}else {
validFlag=false;
break;
}
}
}
}else {
addMessage(redirectAttributes, "error", "save_failed");
logger.error(" keyring is null ");
throw new Exception();
}
} 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);
}
}
List<PxyObjKeyring> keyringList=new ArrayList<PxyObjKeyring>();
//是keyring内置证书且验证通过进行证书文件上传
try {
if(validFlag) {
File file=null;
for (MultipartFile certFile :certFileI) {
PxyObjKeyring keyring=new PxyObjKeyring();
BeanUtils.copyProperties(cfg, keyring);
/**************************证书信息获取*************************************/
String issuer = StringUtil.isEmpty(fileCertMap.get(certFile.getOriginalFilename()).get("ca issuer")) ? ""
: fileCertMap.get(certFile.getOriginalFilename()).get("ca issuer").toString();// 颁发者
String subject = StringUtil.isEmpty(fileCertMap.get(certFile.getOriginalFilename()).get("ca subjectname")) ? ""
: fileCertMap.get(certFile.getOriginalFilename()).get("ca subjectname").toString();// 颁发给
String notBeforeStr = "";
if (!StringUtil.isEmpty(fileCertMap.get(certFile.getOriginalFilename()).get("ca notbefore"))) {
Date notBeforeTime = new Date(fileCertMap.get(certFile.getOriginalFilename()).get("ca notbefore").toString());// 开始时间
notBeforeStr = sdf.format(notBeforeTime);
}
String notAfterStr = "";
if (!StringUtil.isEmpty(fileCertMap.get(certFile.getOriginalFilename()).get("ca notafter"))) {
Date notAfterTime = new Date(fileCertMap.get(certFile.getOriginalFilename()).get("ca notafter").toString());// 结束时间
notAfterStr = sdf.format(notAfterTime);
}
String cn = "";// CN
// CN精确信息获取
if (!StringUtil.isEmpty(subject)) {
for (String cnStr : subject.split(",")) {
cnStr = StringUtil.isEmpty(cnStr) ? "" : cnStr.trim();
if (cnStr.split("=").length > 1) {
cn = cnStr.split("=")[1];
cn = StringUtil.isEmpty(cn) ? "" : cn.trim();
}
}
}
String altName = StringUtil.isEmpty(fileCertMap.get(certFile.getOriginalFilename()).get("ca altname")) ? ""
: fileCertMap.get(certFile.getOriginalFilename()).get("ca altname").toString();// SAN
keyring.setIssuer(issuer);
keyring.setSubject(subject);
keyring.setCn(cn);
keyring.setAltName(altName);
keyring.setNotBeforeTime(notBeforeStr);
keyring.setNotAfterTime(notAfterStr);
keyring.setKeyringType("root");
keyring.setExpireAfter(30);
keyring.setCrl("");
keyring.setPublicKeyAlgo("");
/**************************公私钥文件上传*************************************/
if (certFile != null) {
String filename = certFile.getOriginalFilename();
String prefix = FileUtils.getPrefix(filename, false);
keyring.setKeyringName(prefix);
keyring.setCfgDesc(prefix);
String suffix = FileUtils.getSuffix(filename, false);
file = File.createTempFile("file_" + prefix, FileUtils.getSuffix(filename, true));
certFile.transferTo(file);// 复制文件
String md5 = FileUtils.getFileMD5(file);
Map<String, Object> srcMap = Maps.newHashMap();
srcMap.put("filetype", suffix);
srcMap.put("datatype", "dbSystem");// 源文件存入数据中心
srcMap.put("createTime", new Date());
srcMap.put("key", prefix);
srcMap.put("fileName", filename);
srcMap.put("checksum", md5);
ToMaatResult result = ConfigServiceUtil.postFileCfg(null, file, JsonMapper.toJsonString(srcMap));
logger.info("proxy 证书文件策略公钥 文件上传响应信息:" + JsonMapper.toJsonString(result));
String publicKeyFileAccessUrl = null;
if (!StringUtil.isEmpty(result)) {
ResponseData data = result.getData();
publicKeyFileAccessUrl = data.getAccessUrl();
keyring.setPublicKeyFile(publicKeyFileAccessUrl);
}
}
if (certFile != null) {
String filename = certFile.getOriginalFilename();
String prefix = FileUtils.getPrefix(filename, false);
String suffix = FileUtils.getSuffix(filename, false);
file = File.createTempFile("file_" + prefix, FileUtils.getSuffix(filename, true));
certFile.transferTo(file);// 复制文件
String md5 = FileUtils.getFileMD5(file);
Map<String, Object> srcMap = Maps.newHashMap();
srcMap.put("filetype", suffix);
srcMap.put("datatype", "dbSystem");// 源文件存入数据中心
srcMap.put("createTime", new Date());
srcMap.put("key", prefix);
srcMap.put("fileName", filename);
srcMap.put("checksum", md5);
ToMaatResult result = ConfigServiceUtil.postFileCfg(null, file, JsonMapper.toJsonString(srcMap));
logger.info("proxy 证书文件策略私钥 上传响应信息:" + JsonMapper.toJsonString(result));
String privateKeyFileAccessUrl = null;
if (!StringUtil.isEmpty(result)) {
ResponseData data = result.getData();
privateKeyFileAccessUrl = data.getAccessUrl();
keyring.setPrivateKeyFile(privateKeyFileAccessUrl);
;
}
}
logger.info(keyring.getPublicKeyFile());
logger.info(keyring.getPrivateKeyFile());
keyringList.add(keyring);
}
}
} 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);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
try {
if(!StringUtil.isEmpty(keyringList)) {
pxyObjKeyringService.saveAndAuditKeyring(keyringList);
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.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 (Exception e) {
logger.error("策略配置保存失败:",e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/proxy/intercept/strateagy/list?functionId=" + cfg.getFunctionId();
}
/** /**
* 调用shell脚本 返回运行结果 * 调用shell脚本 返回运行结果
@@ -1012,31 +1469,4 @@ public class PxyObjKeyringController extends BaseController {
} }
return "redirect:" + adminPath + "/proxy/intercept/strateagy/trustedCertList?functionId=" + functionId; return "redirect:" + adminPath + "/proxy/intercept/strateagy/trustedCertList?functionId=" + functionId;
} }
/**
* 验证Keyring是否有被使用
*
* @param entity
* @param request
* @param response
* @return
*/
@ResponseBody
@RequestMapping(value = { "/ajaxKeyinfIsUsed" })
public boolean ajaxKeyinfIsUsed(String[] compileIds, HttpServletRequest request, HttpServletResponse response) {
for(String compileId:compileIds){
CfgIndexInfo cfg = new CfgIndexInfo();
cfg.setIsAudit(1);
cfg.setIsValid(1);
cfg.setFunctionId(200);//代理拦截策略
cfg.setServiceId(512);
cfg.setUserRegion1(compileId);
List<CfgIndexInfo> list = httpRedirectCfgService.getCfgIndexInfos(cfg);
if (list.size() > 0) {
return false;
}
}
return true;
}
} }

View File

@@ -0,0 +1,99 @@
package com.nis.web.controller.configuration.proxy;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.web.controller.BaseController;
import com.nis.web.service.BaseService;
import com.nis.web.service.configuration.StatusOfUsedService;
@Controller
@RequestMapping("${adminPath}/proxy/statusOfUsed")
public class StatusOfUsedController extends BaseController{
@Autowired
protected StatusOfUsedService statusOfUsedService;
@ResponseBody
@RequestMapping(value = { "/ajaxRequest" })
public boolean statusOfUsed(String[] compileIds, HttpServletRequest request, HttpServletResponse response) {
Integer isValid = Integer.parseInt(request.getParameter("isValid"));
Integer ServiceId = Integer.parseInt(request.getParameter("serviceId"));
Integer functionId = 0;
String key = "";
//拦截证书策略
if(ServiceId==520){
functionId = 200;
ServiceId = 512;
key = "keyring";
}//流量转发目的地址
if(ServiceId==645){
functionId = 200;
ServiceId = 512;
key = "mirror_profile";
}
//劫持文件、注入脚本文件
else if(ServiceId==643 || ServiceId==644){
functionId = 215;
ServiceId = 656;
}//访问阻断页面
else if(ServiceId==646){
functionId = 207;
ServiceId = 576;
}
if(ServiceId == 576 || ServiceId==656){
for(String compileId:compileIds){
CfgIndexInfo cfg = new CfgIndexInfo();
if(ServiceId==656){
cfg.setUserRegion4(compileId);
}else if(ServiceId==576){
cfg.setUserRegion3(compileId);
}
cfg.setIsValid(isValid);
cfg.setFunctionId(functionId);
cfg.setServiceId(ServiceId);
List<CfgIndexInfo> list = statusOfUsedService.getStatusOfUsed(cfg);
if (list.size() > 0) {
return false;
}
}
return true;
}else if(ServiceId==512){
CfgIndexInfo cfg = new CfgIndexInfo();
cfg.setIsValid(isValid);
cfg.setFunctionId(functionId);
cfg.setServiceId(ServiceId);
List<CfgIndexInfo> list = statusOfUsedService.getStatusOfUsed(cfg);
Map<String,Map<String,Object>> tempMap = new HashMap<>();
for(CfgIndexInfo temp:list){
tempMap = BaseService.gsonFromJson(temp.getUserRegion1(), Map.class);
String value = "";
if("keyring".equals(key)){
value = String.valueOf(tempMap.get(key));
}else if("mirror_profile".equals(key)){
value = String.valueOf(tempMap.get("decrypt_mirror").get("mirror_profile"));
}
for(String s: compileIds){
if(s.equals(value))
return false;
}
}
return true;
}
return true;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,385 @@
package com.nis.web.controller.log.pxy;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
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.SysDataDictionaryItem;
import com.nis.domain.SysUser;
import com.nis.domain.configuration.AppIpCfg;
import com.nis.domain.log.BaseLogEntity;
import com.nis.domain.log.PxyHttpLog;
import com.nis.domain.log.PxyHttpManipulationLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.domain.specific.SpecificServiceCfg;
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.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.dao.dashboard.codedic.CodeResult;
import com.nis.web.security.UserUtils;
@Controller
@RequestMapping("${adminPath}/log/pxy")
public class PxyHttpBlockLogController extends BaseController{
@RequestMapping(value = "/httpBlockList")
public String list(@ModelAttribute("log") PxyHttpManipulationLog log, Model model, HttpServletRequest request,
HttpServletResponse response,Integer searchAction) {
try {
List<CodeResult> protocolCodeList = CodeDicUtils.getCodeList("protocolCode");
List<CodeResult> appCodeList = CodeDicUtils.getCodeList("appCode");
PageLog<PxyHttpManipulationLog> page = new PageLog<PxyHttpManipulationLog>(request, response);
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());
if(searchAction !=null){
log.setAction(searchAction);
}
if (StringUtils.isNotBlank(log.getDomain())) {
String domain = StringEscapeUtils.unescapeHtml(log.getDomain());
params.put("searchDomain", domain);
}
if (StringUtils.isNotBlank(log.getUrl())) {
String httpurl = StringEscapeUtils.unescapeHtml(log.getUrl());
params.put("searchUrl", httpurl);
}
if (StringUtils.isNotBlank(log.getsIp())) {
log.setClientIp(log.getsIp());
}
if (StringUtils.isNotBlank(log.getdIp())) {
log.setServerIp(log.getdIp());
}
if(log.getCfgId()!=null && log.getPolicyId() ==null){
log.setPolicyId(log.getCfgId());
}
if (StringUtils.isNotBlank(log.getAppId())) {
params.put("searchAppId", log.getAppId());
}
if (StringUtils.isNotBlank(log.getProtocolId())) {
params.put("searchProtocolId", log.getProtocolId());
}
initLogSearchValues(log, params);
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
model.addAttribute("serviceList", serviceList);
model.addAttribute("appList", appCodeList);
model.addAttribute("protocolList", protocolCodeList);
String url = Constants.LOG_BASE_URL + Constants.POLICY_EVENT;
String recv = HttpClientUtil.getMsg(url, params, request);
Gson gson = new GsonBuilder().create();
LogRecvData<PxyHttpManipulationLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<PxyHttpManipulationLog>>() {
}.getType());
if (fromJson.getStatus().intValue() == 200) {
Page<PxyHttpManipulationLog> data = fromJson.getData();
page.setCount(data.getCount());
page.setLast(data.getLast());
page.setList(data.getList());
List<PxyHttpManipulationLog> list = page.getList();
for (PxyHttpManipulationLog l : list) {
l.setFunctionId(log.getFunctionId());
// setLogAction(l, serviceList);
l.setStartTime(timeStamp2Date(l.getStartTime(),null));
l.setEndTime(timeStamp2Date(l.getEndTime(),null));
l.setRecvTime(timeStamp2Date(l.getRecvTime(),null));
for (CodeResult code : appCodeList) {
Integer value3 = Integer.valueOf(code.getCode());
if(StringUtils.isNotBlank(l.getAppId()) && l.getAppId().equals(code.getCode())){
l.setAppName(code.getItem());
break;
}
}
for (CodeResult code : protocolCodeList) {
Integer value3 = Integer.valueOf(code.getCode());
if(StringUtils.isNotBlank(l.getProtocolId()) && l.getProtocolId().equals(code.getCode())){
l.setProtocolName(code.getItem());
break;
}
}
}
}
model.addAttribute("page", page);
} catch (Exception e) {
logger.error("查询失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/pxy/pxyHttpBlockList";
}
// 导出
@RequestMapping(value = "exportPxyHttpBlock")
public void exportPxy(@ModelAttribute("log") PxyHttpManipulationLog log, Model model, String hColumns, String type,
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
try {
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>();
// ---------------------------
List<CodeResult> protocolCodeList = CodeDicUtils.getCodeList("protocolCode");
List<CodeResult> appCodeList = CodeDicUtils.getCodeList("appCode");
PageLog<PxyHttpManipulationLog> page = new PageLog<PxyHttpManipulationLog>(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.getsIp())) {
log.setClientIp(log.getsIp());
}
if (StringUtils.isNotBlank(log.getdIp())) {
log.setServerIp(log.getdIp());
}
initLogSearchValues(log, params);
if (StringUtils.isNotBlank(log.getUrl())) {
String httpurl = StringEscapeUtils.unescapeHtml(log.getUrl());
params.put("searchUrl", httpurl);
}
if (StringUtils.isNotBlank(log.getDomain())) {
String domain = StringEscapeUtils.unescapeHtml(log.getDomain());
params.put("searchDomain", domain);
}
if (StringUtils.isNotBlank(log.getAppId())) {
params.put("searchAppId", log.getAppId());
}
if (StringUtils.isNotBlank(log.getProtocolId())) {
params.put("searchProtocolId", log.getProtocolId());
}
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
model.addAttribute("serviceList", serviceList);
String url = Constants.LOG_BASE_URL + Constants.POLICY_EVENT;
String recv = HttpClientUtil.getMsg(url, params, request);
List<PxyHttpManipulationLog> list = new ArrayList<PxyHttpManipulationLog>();
if (StringUtils.isNotBlank(recv)) {
Gson gson = new GsonBuilder().create();
LogRecvData<PxyHttpManipulationLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<PxyHttpManipulationLog>>() {
}.getType());
if (fromJson.getStatus().intValue() == 200) {
Page<PxyHttpManipulationLog> data = fromJson.getData();
list = data.getList();
}
}
for (PxyHttpManipulationLog l : list) {
l.setFunctionId(log.getFunctionId());
l.setStartTime(timeStamp2Date(l.getStartTime(),null));
l.setEndTime(timeStamp2Date(l.getEndTime(),null));
l.setRecvTime(timeStamp2Date(l.getRecvTime(),null));
for (CodeResult code : appCodeList) {
Integer value3 = Integer.valueOf(code.getCode());
if(StringUtils.isNotBlank(l.getAppId()) && l.getAppId().equals(code.getCode())){
l.setAppName(code.getItem());
break;
}
}
for (CodeResult code : protocolCodeList) {
Integer value3 = Integer.valueOf(code.getCode());
if(StringUtils.isNotBlank(l.getProtocolId()) && l.getProtocolId().equals(code.getCode())){
l.setProtocolName(code.getItem());
break;
}
}
}
titleList.add("http_manipulation");
classMap.put("http_manipulation", PxyHttpManipulationLog.class);
SysUser user = UserUtils.getUser();
if (!user.isAdmin()) {
hColumns += ",scene_file,";
} else {
hColumns += ",";
}
String cfgIndexInfoNoExport = ",req_header,resp_header,inner_smac,inner_dmac,nest_addr_list,scene_file,"
+ ",found_time,"
+ hColumns;
noExportMap.put("http_manipulation", cfgIndexInfoNoExport);
dataMap.put("http_manipulation", list);
String timeRange= initLogMaps(log,"http_manipulation");
noExportMap.put("timeRange", timeRange);
if ("csv".equals(type)) {
this._exportCsv(model, request, response, redirectAttributes, "http_manipulation", titleList, classMap,
dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, "http_manipulation", titleList, classMap, dataMap,
noExportMap);
}
} catch (Exception e) {
logger.error("Http Manipulation export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
public void initLogSearchValues(PxyHttpManipulationLog entry, Map<String, Object> params) {
if (StringUtils.isNotBlank(entry.getSearchFoundStartTime())
&& StringUtils.isNotBlank(entry.getSearchFoundEndTime())) {
params.put("searchStartRecvTime", date2TimeStamp(entry.getSearchFoundStartTime(),"yyyy-MM-dd HH:mm:ss"));
params.put("searchEndRecvTime", date2TimeStamp(entry.getSearchFoundEndTime(),"yyyy-MM-dd HH:mm:ss"));
} else {
// 判断是否是从配置界面过来的日志查询
if (StringUtils.isNotBlank(entry.getIsLogTotalSearch())) {
Calendar time = Calendar.getInstance();
String searchEndTime = DateUtils.formatDateTime(time.getTime());
time.add(Calendar.MINUTE, -(Constants.LOG_TIME_RANGE/1000/60));
String searchStartTime = DateUtils.formatDateTime(time.getTime());
params.put("searchStartRecvTime", date2TimeStamp(searchStartTime,"yyyy-MM-dd HH:mm:ss"));
params.put("searchEndRecvTime", date2TimeStamp(searchEndTime,"yyyy-MM-dd HH:mm:ss"));
entry.setSearchFoundStartTime(searchStartTime);
entry.setSearchFoundEndTime(searchEndTime);
} else {
// 设置默认查询当前时间及前五分钟
String endTime = DateUtils.getDateTime();
Date dateStart = new Date(new Date().getTime() - Constants.LOG_TIME_INTERVAL);
String startTime = DateUtils.formatDateTime(dateStart);
params.put("searchStartRecvTime", String.valueOf(dateStart.getTime()/1000));
params.put("searchEndRecvTime", date2TimeStamp(endTime,"yyyy-MM-dd HH:mm:ss"));
entry.setSearchFoundStartTime(startTime);
entry.setSearchFoundEndTime(endTime);
}
logger.info("searchStartRecvTime" + params.get("searchStartRecvTime"));
logger.info("searchEndRecvTime" + params.get("searchEndRecvTime"));
}
if (StringUtils.isNotBlank(entry.getTransProto())) {
params.put("searchTransProto", entry.getTransProto());
}
/* if (entry.getService() != null) {
params.put("searchService", entry.getService());
} else if (entry.getAction() != null) {
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entry.getFunctionId());
for (FunctionServiceDict dict : serviceList) {
if (dict.getAction().intValue() == entry.getAction().intValue()
&& dict.getFunctionId().intValue() == entry.getFunctionId().intValue()) {
entry.setService(dict.getServiceId());
params.put("searchService", dict.getServiceId());
}
}
}*/
if (StringUtils.isNotBlank(entry.getServerIp())) {
params.put("searchServerIp", entry.getServerIp());
}
if (StringUtils.isNotBlank(entry.getClientIp())) {
params.put("searchClientIp", entry.getClientIp());
}
if (StringUtils.isNotBlank(entry.getCapIp())) {
params.put("searchCapIp", entry.getCapIp());
}
if (entry.getDirection() != null) {
params.put("searchDirection", entry.getDirection());
}
if (entry.getEntranceId() != null) {
params.put("searchEntranceId", entry.getEntranceId());
}
if (entry.getPolicyId() != null) {
params.put("searchPolicyId", entry.getPolicyId());
}
if (entry.getAction() != null) {
params.put("searchAction", entry.getAction());
}
if (entry.getAddrType() != null) {
params.put("searchAddrType", entry.getAddrType());
}
if (StringUtils.isNotBlank(entry.getIsp())) {
params.put("searchIsp", entry.getIsp());
}
if (StringUtils.isNotBlank(entry.getServerLocation())) {
params.put("searchServerLocation", entry.getServerLocation());
}
if (StringUtils.isNotBlank(entry.getClientLocation())) {
params.put("searchClientLocation", entry.getClientLocation());
}
if (StringUtils.isNotBlank(entry.getHost())) {
params.put("searchHost", entry.getHost());
}
if (StringUtils.isNotBlank(entry.getSni())) {
params.put("searchSni", entry.getSni());
}
if (StringUtils.isNotBlank(entry.getSan())) {
params.put("searchSan", entry.getSan());
}
if (StringUtils.isNotBlank(entry.getCn())) {
params.put("searchCn", entry.getCn());
}
if (StringUtils.isNotBlank(entry.getOrderBy())) {
params.put("orderBy", entry.getOrderBy());
}
if (StringUtils.isNotBlank(entry.getFields())) {
params.put("fields", entry.getFields());
}
}
public String initLogMaps(PxyHttpManipulationLog log,String title){
Properties msgProp = getMsgProp();
String logTime=msgProp.getProperty(title,title);;
if(log.getSearchFoundStartTime()!=null){
logTime+=" "+msgProp.getProperty("begin_date")+""+log.getSearchFoundStartTime();
}
if(log.getSearchFoundEndTime()!=null){
logTime+=" "+msgProp.getProperty("end_date")+""+log.getSearchFoundEndTime();
}
return logTime;
}
/**
* 日期格式字符串转换成时间戳
* @param date 字符串日期
* @param format 如yyyy-MM-dd HH:mm:ss
* @return
*/
public static String date2TimeStamp(String date_str,String format){
try {
SimpleDateFormat sdf = new SimpleDateFormat(format);
return String.valueOf(sdf.parse(date_str).getTime()/1000);
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
/**
* 时间戳转换成日期格式字符串
* @param seconds 精确到秒的字符串
* @param formatStr
* @return
*/
public static String timeStamp2Date(String seconds,String format) {
if(seconds == null || seconds.isEmpty() || seconds.equals("null")){
return "";
}
if(format == null || format.isEmpty()) format = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(format);
return sdf.format(new Date(Long.valueOf(seconds+"000")));
}
}

View File

@@ -0,0 +1,393 @@
package com.nis.web.controller.log.pxy;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
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.SysDataDictionaryItem;
import com.nis.domain.SysUser;
import com.nis.domain.configuration.AppIpCfg;
import com.nis.domain.log.BaseLogEntity;
import com.nis.domain.log.PxyHttpLog;
import com.nis.domain.log.PxyHttpManipulationLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.domain.specific.SpecificServiceCfg;
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.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.dao.dashboard.codedic.CodeResult;
import com.nis.web.security.UserUtils;
@Controller
@RequestMapping("${adminPath}/log/pxy")
public class PxyHttpManipulLogController extends BaseController{
@RequestMapping(value = {"/httpManipulList", "/httpBlockLists", "/httpMonitLists"})
public String list(@ModelAttribute("log") PxyHttpManipulationLog log, Model model, HttpServletRequest request,
HttpServletResponse response,Integer searchAction) {
try {
// List<CodeResult> protocolCodeList = CodeDicUtils.getCodeList("protocolCode");
// List<CodeResult> appCodeList = CodeDicUtils.getCodeList("appCode");
PageLog<PxyHttpManipulationLog> page = new PageLog<PxyHttpManipulationLog>(request, response);
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());
if(searchAction !=null){
log.setAction(searchAction);
}
if (StringUtils.isNotBlank(log.getDomain())) {
String domain = StringEscapeUtils.unescapeHtml(log.getDomain());
params.put("searchDomain", domain);
}
if (StringUtils.isNotBlank(log.getUrl())) {
String httpurl = StringEscapeUtils.unescapeHtml(log.getUrl());
params.put("searchUrl", httpurl);
}
if (StringUtils.isNotBlank(log.getsIp())) {
log.setClientIp(log.getsIp());
}
if (StringUtils.isNotBlank(log.getdIp())) {
log.setServerIp(log.getdIp());
}
if(log.getCfgId()!=null && log.getPolicyId() ==null){
log.setPolicyId(log.getCfgId());
}
// if (StringUtils.isNotBlank(log.getAppId())) {
// params.put("searchAppId", log.getAppId());
// }
// if (StringUtils.isNotBlank(log.getProtocolId())) {
// params.put("searchProtocolId", log.getProtocolId());
// }
initLogSearchValues(log, params);
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
model.addAttribute("serviceList", serviceList);
// model.addAttribute("appList", appCodeList);
// model.addAttribute("protocolList", protocolCodeList);
String url = Constants.LOG_BASE_URL + Constants.POLICY_EVENT;
String recv = HttpClientUtil.getMsg(url, params, request);
Gson gson = new GsonBuilder().create();
LogRecvData<PxyHttpManipulationLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<PxyHttpManipulationLog>>() {
}.getType());
if (fromJson.getStatus().intValue() == 200) {
Page<PxyHttpManipulationLog> data = fromJson.getData();
page.setCount(data.getCount());
page.setLast(data.getLast());
page.setList(data.getList());
List<PxyHttpManipulationLog> list = page.getList();
for (PxyHttpManipulationLog l : list) {
l.setFunctionId(log.getFunctionId());
// setLogAction(l, serviceList);
l.setStartTime(timeStamp2Date(l.getStartTime(),null));
l.setEndTime(timeStamp2Date(l.getEndTime(),null));
l.setRecvTime(timeStamp2Date(l.getRecvTime(),null));
/*for (CodeResult code : appCodeList) {
Integer value3 = Integer.valueOf(code.getCode());
if(StringUtils.isNotBlank(l.getAppId()) && l.getAppId().equals(code.getCode())){
l.setAppName(code.getItem());
break;
}
}
for (CodeResult code : protocolCodeList) {
Integer value3 = Integer.valueOf(code.getCode());
if(StringUtils.isNotBlank(l.getProtocolId()) && l.getProtocolId().equals(code.getCode())){
l.setProtocolName(code.getItem());
break;
}
}*/
}
}
model.addAttribute("page", page);
} catch (Exception e) {
logger.error("查询失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/pxy/pxyHttpManipulationList";
}
// 导出
@RequestMapping(value = "exportPxyHttpManipul")
public void exportPxy(@ModelAttribute("log") PxyHttpManipulationLog log, Model model, String hColumns, String type,
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
try {
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>();
// ---------------------------
// List<CodeResult> protocolCodeList = CodeDicUtils.getCodeList("protocolCode");
// List<CodeResult> appCodeList = CodeDicUtils.getCodeList("appCode");
PageLog<PxyHttpManipulationLog> page = new PageLog<PxyHttpManipulationLog>(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.getsIp())) {
log.setClientIp(log.getsIp());
}
if (StringUtils.isNotBlank(log.getdIp())) {
log.setServerIp(log.getdIp());
}
initLogSearchValues(log, params);
if (StringUtils.isNotBlank(log.getUrl())) {
String httpurl = StringEscapeUtils.unescapeHtml(log.getUrl());
params.put("searchUrl", httpurl);
}
if (StringUtils.isNotBlank(log.getDomain())) {
String domain = StringEscapeUtils.unescapeHtml(log.getDomain());
params.put("searchDomain", domain);
}
// if (StringUtils.isNotBlank(log.getAppId())) {
// params.put("searchAppId", log.getAppId());
// }
// if (StringUtils.isNotBlank(log.getProtocolId())) {
// params.put("searchProtocolId", log.getProtocolId());
// }
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
model.addAttribute("serviceList", serviceList);
String url = Constants.LOG_BASE_URL + Constants.POLICY_EVENT;
String recv = HttpClientUtil.getMsg(url, params, request);
List<PxyHttpManipulationLog> list = new ArrayList<PxyHttpManipulationLog>();
if (StringUtils.isNotBlank(recv)) {
Gson gson = new GsonBuilder().create();
LogRecvData<PxyHttpManipulationLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<PxyHttpManipulationLog>>() {
}.getType());
if (fromJson.getStatus().intValue() == 200) {
Page<PxyHttpManipulationLog> data = fromJson.getData();
list = data.getList();
}
}
for (PxyHttpManipulationLog l : list) {
l.setFunctionId(log.getFunctionId());
l.setStartTime(timeStamp2Date(l.getStartTime(),null));
l.setEndTime(timeStamp2Date(l.getEndTime(),null));
l.setRecvTime(timeStamp2Date(l.getRecvTime(),null));
// for (CodeResult code : appCodeList) {
// Integer value3 = Integer.valueOf(code.getCode());
// if(StringUtils.isNotBlank(l.getAppId()) && l.getAppId().equals(code.getCode())){
// l.setAppName(code.getItem());
// break;
// }
// }
// for (CodeResult code : protocolCodeList) {
// Integer value3 = Integer.valueOf(code.getCode());
// if(StringUtils.isNotBlank(l.getProtocolId()) && l.getProtocolId().equals(code.getCode())){
// l.setProtocolName(code.getItem());
// break;
// }
// }
}
String title="";
if(log.getAction().equals(1)){//监测
title="http_monit";
}else if(log.getAction().equals(16)){//阻断
title="http_block";
}else if(log.getAction().equals(48)){//操控
title="http_manipulation";
}
titleList.add(title);
classMap.put(title, PxyHttpManipulationLog.class);
SysUser user = UserUtils.getUser();
if (!user.isAdmin()) {
hColumns += ",scene_file,";
} else {
hColumns += ",";
}
String cfgIndexInfoNoExport = ",req_header,resp_header,inner_smac,inner_dmac,nest_addr_list,scene_file,"
+ ",found_time,"
+ hColumns;
noExportMap.put(title, cfgIndexInfoNoExport);
dataMap.put(title, list);
String timeRange= initLogMaps(log,title);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(type)) {
this._exportCsv(model, request, response, redirectAttributes, title, titleList, classMap,
dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, title, titleList, classMap, dataMap,
noExportMap);
}
} catch (Exception e) {
logger.error("Http Manipulation export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
public void initLogSearchValues(PxyHttpManipulationLog entry, Map<String, Object> params) {
if (StringUtils.isNotBlank(entry.getSearchFoundStartTime())
&& StringUtils.isNotBlank(entry.getSearchFoundEndTime())) {
params.put("searchStartRecvTime", date2TimeStamp(entry.getSearchFoundStartTime(),"yyyy-MM-dd HH:mm:ss"));
params.put("searchEndRecvTime", date2TimeStamp(entry.getSearchFoundEndTime(),"yyyy-MM-dd HH:mm:ss"));
} else {
// 判断是否是从配置界面过来的日志查询
if (StringUtils.isNotBlank(entry.getIsLogTotalSearch())) {
Calendar time = Calendar.getInstance();
String searchEndTime = DateUtils.formatDateTime(time.getTime());
time.add(Calendar.MINUTE, -(Constants.LOG_TIME_RANGE/1000/60));
String searchStartTime = DateUtils.formatDateTime(time.getTime());
params.put("searchStartRecvTime", date2TimeStamp(searchStartTime,"yyyy-MM-dd HH:mm:ss"));
params.put("searchEndRecvTime", date2TimeStamp(searchEndTime,"yyyy-MM-dd HH:mm:ss"));
entry.setSearchFoundStartTime(searchStartTime);
entry.setSearchFoundEndTime(searchEndTime);
} else {
// 设置默认查询当前时间及前五分钟
String endTime = DateUtils.getDateTime();
Date dateStart = new Date(new Date().getTime() - Constants.LOG_TIME_INTERVAL);
String startTime = DateUtils.formatDateTime(dateStart);
params.put("searchStartRecvTime", String.valueOf(dateStart.getTime()/1000));
params.put("searchEndRecvTime", date2TimeStamp(endTime,"yyyy-MM-dd HH:mm:ss"));
entry.setSearchFoundStartTime(startTime);
entry.setSearchFoundEndTime(endTime);
}
logger.info("searchStartRecvTime" + params.get("searchStartRecvTime"));
logger.info("searchEndRecvTime" + params.get("searchEndRecvTime"));
}
if (StringUtils.isNotBlank(entry.getTransProto())) {
params.put("searchTransProto", entry.getTransProto());
}
/* if (entry.getService() != null) {
params.put("searchService", entry.getService());
} else if (entry.getAction() != null) {
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entry.getFunctionId());
for (FunctionServiceDict dict : serviceList) {
if (dict.getAction().intValue() == entry.getAction().intValue()
&& dict.getFunctionId().intValue() == entry.getFunctionId().intValue()) {
entry.setService(dict.getServiceId());
params.put("searchService", dict.getServiceId());
}
}
}*/
if (StringUtils.isNotBlank(entry.getServerIp())) {
params.put("searchServerIp", entry.getServerIp());
}
if (StringUtils.isNotBlank(entry.getClientIp())) {
params.put("searchClientIp", entry.getClientIp());
}
if (StringUtils.isNotBlank(entry.getCapIp())) {
params.put("searchCapIp", entry.getCapIp());
}
if (entry.getDirection() != null) {
params.put("searchDirection", entry.getDirection());
}
if (entry.getEntranceId() != null) {
params.put("searchEntranceId", entry.getEntranceId());
}
if (entry.getPolicyId() != null) {
params.put("searchPolicyId", entry.getPolicyId());
}
if (entry.getAction() != null) {
params.put("searchAction", entry.getAction());
}
if (entry.getAddrType() != null) {
params.put("searchAddrType", entry.getAddrType());
}
if (StringUtils.isNotBlank(entry.getIsp())) {
params.put("searchIsp", entry.getIsp());
}
if (StringUtils.isNotBlank(entry.getServerLocation())) {
params.put("searchServerLocation", entry.getServerLocation());
}
if (StringUtils.isNotBlank(entry.getClientLocation())) {
params.put("searchClientLocation", entry.getClientLocation());
}
if (StringUtils.isNotBlank(entry.getHost())) {
params.put("searchHost", entry.getHost());
}
if (StringUtils.isNotBlank(entry.getSni())) {
params.put("searchSni", entry.getSni());
}
if (StringUtils.isNotBlank(entry.getSan())) {
params.put("searchSan", entry.getSan());
}
if (StringUtils.isNotBlank(entry.getCn())) {
params.put("searchCn", entry.getCn());
}
if (StringUtils.isNotBlank(entry.getOrderBy())) {
params.put("orderBy", entry.getOrderBy());
}
if (StringUtils.isNotBlank(entry.getFields())) {
params.put("fields", entry.getFields());
}
}
public String initLogMaps(PxyHttpManipulationLog log,String title){
Properties msgProp = getMsgProp();
String logTime=msgProp.getProperty(title,title);;
if(log.getSearchFoundStartTime()!=null){
logTime+=" "+msgProp.getProperty("begin_date")+""+log.getSearchFoundStartTime();
}
if(log.getSearchFoundEndTime()!=null){
logTime+=" "+msgProp.getProperty("end_date")+""+log.getSearchFoundEndTime();
}
return logTime;
}
/**
* 日期格式字符串转换成时间戳
* @param date 字符串日期
* @param format 如yyyy-MM-dd HH:mm:ss
* @return
*/
public static String date2TimeStamp(String date_str,String format){
try {
SimpleDateFormat sdf = new SimpleDateFormat(format);
return String.valueOf(sdf.parse(date_str).getTime()/1000);
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
/**
* 时间戳转换成日期格式字符串
* @param seconds 精确到秒的字符串
* @param formatStr
* @return
*/
public static String timeStamp2Date(String seconds,String format) {
if(seconds == null || seconds.isEmpty() || seconds.equals("null")){
return "";
}
if(format == null || format.isEmpty()) format = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(format);
return sdf.format(new Date(Long.valueOf(seconds+"000")));
}
}

View File

@@ -0,0 +1,40 @@
package com.nis.web.dao.basics;
import java.util.List;
import java.util.Set;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.basics.CommonGroupInfo;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface CommonGroupManageDao extends CrudDao<CommonGroupInfo> {
List<CommonGroupInfo> findCommonGroupInfoList(CommonGroupInfo commonGroupInfo);
CommonGroupInfo getById(int id);
List<CommonGroupInfo> findCommonGroupInfosByType(int groupType);
List<CommonGroupInfo> findGroupInfoList(@Param("ids")String ids);
void updateGroupStatus(@Param("serviceGroupId")String serviceGroupId, @Param("udFlag")Integer udFlag, @Param("groupType")Integer groupType);
CommonGroupInfo getGroupInfo(CommonGroupInfo searchCfg);
Integer getCompileIdByGroupId(String groupId);
// 校验是否是当前引用Group的最后一条配置
public Integer ajaxCheckIsLastOneCfg(@Param("groupId")Integer groupId, @Param("cfgIds")String CfgIds, @Param("tableName")String indextable);
Set<String> getCountByGroupName(@Param("groupNameSet")Set<String> set, @Param("groupType")Integer groupType);
Integer getGroupIdByGroupName(@Param("groupName")String groupName, @Param("groupType")Integer groupType);
int insertBatch(List<CommonGroupInfo> list);
void reLoadGroupInfo(@Param("groupType")String groupType);
void deleteGroupRegionInfo(@Param("tableName")String tableName);
}

View File

@@ -0,0 +1,274 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.basics.CommonGroupManageDao" >
<resultMap id="CommonGroupInfoMap" type="com.nis.domain.basics.CommonGroupInfo" >
<id column="group_id" property="groupId" jdbcType="INTEGER" />
<result column="group_name" property="groupName" jdbcType="VARCHAR" />
<result column="group_type" property="groupType" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="service_group_id" property="serviceGroupId" jdbcType="INTEGER" />
<result column="description" property="description" jdbcType="VARCHAR" />
<result column="ud_flag" property="udFlag" jdbcType="INTEGER" />
</resultMap>
<sql id="CommonGroupInfoColumns">
r.group_id,r.group_name,r.group_type,r.is_valid,r.create_time,r.edit_time,
r.creator_id,r.editor_id,r.service_group_id,r.description, ud_flag
</sql>
<!-- 查出所有 有效数据-->
<select id="findCommonGroupInfoList" resultMap="CommonGroupInfoMap">
SELECT
<include refid="CommonGroupInfoColumns"/>
<trim prefix="," prefixOverrides=",">
, s.name as creator_name
,e.name as editor_name
</trim>
FROM policy_group_info r
left join sys_user s on r.creator_id=s.id
left join sys_user e on r.editor_id=e.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="groupName != null and groupName != ''">
AND r.group_name like concat(concat('%',#{groupName,jdbcType=VARCHAR}),'%')
</if>
<if test="groupType != null">
AND r.group_type =#{groupType }
</if>
<if test="groupType == null">
AND r.group_type IN(5,7,8,9)
</if>
AND r.IS_VALID =1
<if test="creatorName != null and creatorName != ''">
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editorName != null and editorName != ''">
AND r.EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<!-- 数据范围过滤 -->
<!-- ${sqlMap.dsf} -->
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY r.group_id desc
</otherwise>
</choose>
</select>
<select id="getById" resultType="com.nis.domain.basics.CommonGroupInfo">
SELECT
<include refid="CommonGroupInfoColumns"/>
FROM
policy_group_info r
WHERE
r.group_id = #{groupId}
</select>
<insert id="insert" parameterType="com.nis.domain.basics.CommonGroupInfo" >
INSERT INTO policy_group_info(
IS_VALID,
CREATOR_ID,
CREATE_TIME,
GROUP_NAME,
GROUP_TYPE,
SERVICE_GROUP_ID,
DESCRIPTION
)values (
1,
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{groupName,jdbcType=VARCHAR},
#{groupType,jdbcType=INTEGER},
#{serviceGroupId,jdbcType=INTEGER},
#{description,jdbcType=VARCHAR}
)
</insert>
<insert id="insertBatch">
INSERT INTO policy_group_info(
IS_VALID,
CREATOR_ID,
CREATE_TIME,
GROUP_NAME,
GROUP_TYPE,
SERVICE_GROUP_ID,
DESCRIPTION,
UD_FLAG
)values
<foreach collection ="list" item="info" separator =",">
(
1,
#{info.creatorId,jdbcType=INTEGER},
#{info.createTime,jdbcType=TIMESTAMP},
#{info.groupName,jdbcType=VARCHAR},
#{info.groupType,jdbcType=INTEGER},
#{info.serviceGroupId,jdbcType=INTEGER},
#{info.description,jdbcType=VARCHAR},
#{info.udFlag,jdbcType=INTEGER}
)
</foreach>
</insert>
<update id="update" parameterType="com.nis.domain.basics.CommonGroupInfo" >
UPDATE policy_group_info
<set>
<trim suffixOverrides=",">
<if test="groupName != null and groupName != ''" >
group_name = #{groupName,jdbcType=VARCHAR},
</if>
<if test="groupType != null" >
group_type = #{groupType,jdbcType=INTEGER},
</if>
<if test="description != null" >
description = #{description,jdbcType=VARCHAR},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
<if test="editTime != null and editTime != ''" >
edit_time = #{editTime,jdbcType=TIMESTAMP},
</if>
</trim>
</set>
<where>
<if test="groupId != null" >
and group_id = #{groupId,jdbcType=INTEGER}
</if>
<if test="serviceGroupId != null" >
and service_group_id = #{serviceGroupId,jdbcType=INTEGER}
</if>
</where>
</update>
<select id="findCommonGroupInfosByType" resultMap="CommonGroupInfoMap">
SELECT
<include refid="CommonGroupInfoColumns"/>
FROM
policy_group_info r
WHERE
r.is_valid=1 and r.group_type=#{groupType,jdbcType=INTEGER}
</select>
<select id="findGroupInfoList" resultMap="CommonGroupInfoMap">
SELECT
<include refid="CommonGroupInfoColumns"/>
<trim prefix="," prefixOverrides=",">
, s.name as creator_name
,e.name as editor_name
</trim>
FROM
policy_group_info r
left join sys_user s on r.creator_id=s.id
left join sys_user e on r.editor_id=e.id
WHERE
r.group_id IN (${ids})
</select>
<update id="updateGroupStatus">
UPDATE
policy_group_info
SET
ud_flag = #{udFlag,jdbcType=INTEGER}
WHERE
service_group_id IN (${serviceGroupId}) AND group_type = #{groupType}
</update>
<select id="getGroupInfo" resultType="com.nis.domain.basics.CommonGroupInfo">
SELECT
<include refid="CommonGroupInfoColumns"/>
FROM
policy_group_info r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="groupName != null and groupName != ''" >
AND group_name = #{groupName,jdbcType=VARCHAR}
</if>
<if test="groupType != null" >
AND group_type = #{groupType,jdbcType=INTEGER}
</if>
<if test="serviceGroupId != null" >
AND service_group_id = #{serviceGroupId,jdbcType=INTEGER}
</if>
<if test="isValid != null" >
AND is_valid = #{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null" >
AND is_valid != 0
</if>
</trim>
</select>
<select id="getCompileIdByGroupId" resultType="java.lang.Integer">
SELECT
compile_id
FROM
cfg_index_info
WHERE
common_group_ids = #{groupId,jdbcType=VARCHAR} AND is_valid != -1 AND is_audit = 1
</select>
<select id="ajaxCheckIsLastOneCfg" resultType="java.lang.Integer">
SELECT
COUNT(1)
FROM
${tableName} r
WHERE
r.group_id = #{groupId} AND r.cfg_id NOT IN(${cfgIds})
</select>
<select id="getCountByGroupName" resultType="java.lang.String">
SELECT
r.group_name
FROM
policy_group_info r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<foreach collection="groupNameSet" index="index" item="item" open="(" separator="OR" close=")">
r.group_name = #{item,jdbcType=VARCHAR}
</foreach>
<if test="groupType != null" >
AND r.group_type = #{groupType,jdbcType=INTEGER}
</if>
AND r.is_valid != 0
</trim>
</select>
<select id="getGroupIdByGroupName" resultType="java.lang.Integer">
SELECT
r.service_group_id
FROM
policy_group_info r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="groupName != null and groupName != ''" >
AND r.group_name = #{groupName,jdbcType=VARCHAR}
</if>
<if test="groupType != null" >
AND r.group_type = #{groupType,jdbcType=INTEGER}
</if>
AND is_valid != 0
</trim>
</select>
<update id="reLoadGroupInfo" parameterType="java.lang.String">
UPDATE
policy_group_info
SET
ud_flag = 0
WHERE
is_valid != 0 AND group_type IN(${groupType})
</update>
<delete id="deleteGroupRegionInfo" parameterType="java.lang.String">
DELETE FROM ${tableName}
</delete>
</mapper>

View File

@@ -0,0 +1,38 @@
package com.nis.web.dao.basics;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.basics.DomainCommCfg;
import com.nis.domain.basics.UrlCommCfg;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface DomainCommGroupDao extends CrudDao<DomainCommCfg>{
// 查询列表
public List<DomainCommCfg> findAllPageList(DomainCommCfg entity);
public List<DomainCommCfg> findByPage(@Param("ids")String ids);
public List<DomainCommCfg> findInfoByCfgId(@Param("cfgId")Long cfgId);
//新增
public int insertCommGroupCfg(DomainCommCfg entity);
//修改
public int update(DomainCommCfg entity);
//删除
public int delete(@Param("ids")String ids);
public List<DomainCommCfg> getByIds(@Param("ids")String ids);
public Integer getGroupIdCount(@Param("groupId")String groupId);
// 校验分组是否被引用
public Integer getCfgInfoByGroupIds(@Param("ids")String ids);
public List<DomainCommCfg> getGroupIds(DomainCommCfg cfg);
}

View File

@@ -0,0 +1,525 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.basics.DomainCommGroupDao">
<resultMap id="domainCommGroupCfgMap" type="com.nis.domain.basics.DomainCommCfg">
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="expr_type" property="exprType" jdbcType="INTEGER" />
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
<result column="group_name" property="groupName" jdbcType="VARCHAR" />
</resultMap>
<sql id="columns">
r.cfg_id,r.cfg_desc,r.cfg_keywords,r.action,r.is_valid,r.is_audit,r.creator_id,
r.create_time,r.editor_id,r.edit_time,r.auditor_id,r.audit_time,r.service_id,
r.request_id,r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable,
r.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,
r.cfg_region_code,r.cfg_type,r.ratelimit, r.region_id, r.group_id,r.user_region1,r.user_region2,
r.user_region3,r.user_region4,r.user_region5
</sql>
<select id="findAllPageList" parameterType="com.nis.domain.basics.DomainCommCfg" resultMap="domainCommGroupCfgMap">
SELECT
<include refid="columns"></include>
<trim prefix="," prefixOverrides=",">
,s.name AS creator_name,e.name AS editor_name,u.name AS auditor_name,c.group_name
</trim>
FROM
domain_comm_cfg r
LEFT JOIN sys_user s ON r.creator_id = s.id
LEFT JOIN sys_user e ON r.editor_id = e.id
LEFT JOIN sys_user u ON r.auditor_id = u.id
LEFT JOIN policy_group_info c ON c.service_group_id=r.user_region3
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgKeywords != null and cfgKeywords != ''">
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{cfgType,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND r.IS_VALID != -1
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorName != null and creatorName !=''">
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editorName != null and editorName !=''">
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditorName != null and auditorName !=''">
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditTime != null and auditTime !=''">
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY r.is_audit,r.create_time desc
</otherwise>
</choose>
</select>
<select id="findByPage" resultMap="domainCommGroupCfgMap">
SELECT
<include refid="columns"></include>
<trim prefix="," prefixOverrides=",">
,s.name AS creator_name,e.name AS editor_name,u.name AS auditor_name
</trim>
FROM
domain_comm_cfg r
LEFT JOIN sys_user s ON r.creator_id = s.id
LEFT JOIN sys_user e ON r.editor_id = e.id
LEFT JOIN sys_user u ON r.auditor_id = u.id
where r.CFG_ID in (${ids})
</select>
<select id="findInfoByCfgId" resultMap="domainCommGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
domain_comm_cfg r
where r.CFG_ID =#{cfgId}
</select>
<!-- 修改时检索 -->
<select id="get" resultMap="domainCommGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
domain_comm_cfg r
WHERE
r.cfg_id = #{ids} AND r.is_valid != -1
</select>
<select id="getCfgInfoByGroupIds" resultType="java.lang.Integer">
SELECT
COUNT(1)
FROM
domain_comm_cfg r
WHERE
r.group_id IN(${ids}) AND r.is_valid != -1
</select>
<insert id="insertCommGroupCfg" parameterType="com.nis.domain.basics.DomainCommCfg">
insert into domain_comm_cfg (
CFG_DESC,
cfg_keywords,
action,
is_valid,
is_audit,
creator_id,
create_time,
editor_id,
edit_time,
auditor_id,
audit_time,
service_id,
request_id,
compile_id,
IS_AREA_EFFECTIVE,
CLASSIFY,
ATTRIBUTE,
LABLE,
expr_type,
match_method,
is_hexbin,
area_effective_ids,
function_id,
cfg_region_code,
cfg_type,
ratelimit,
region_id,
group_id,
user_region1,
user_region2,
user_region3,
user_region4,
user_region5
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{cfgKeywords,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
#{isValid,jdbcType=INTEGER},
#{isAudit,jdbcType=INTEGER},
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{exprType,jdbcType=INTEGER},
#{matchMethod,jdbcType=INTEGER},
#{isHexbin,jdbcType=INTEGER},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{cfgRegionCode,jdbcType=INTEGER},
#{cfgType,jdbcType=VARCHAR},
#{ratelimit,jdbcType=VARCHAR},
#{regionId,jdbcType=INTEGER},
#{groupId,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
)
</insert>
<update id="update" parameterType="com.nis.domain.basics.DomainCommCfg" >
update domain_comm_cfg
<set >
<trim suffixOverrides=",">
<if test="cfgDesc != null and cfgDesc != ''" >
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="cfgKeywords != null and cfgKeywords != ''" >
cfg_keywords = #{cfgKeywords,jdbcType=VARCHAR},
</if>
<if test="action != null" >
action = #{action,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
<if test="editTime != null and editTime != ''" >
edit_time = #{editTime,jdbcType=TIMESTAMP},
</if>
<if test="auditorId != null" >
AUDITOR_ID = #{auditorId,jdbcType=INTEGER},
</if>
<if test="auditTime != null and auditTime != ''" >
AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP},
</if>
<if test="serviceId != null" >
service_id = #{serviceId,jdbcType=INTEGER},
</if>
<if test="requestId != null" >
request_id = #{requestId,jdbcType=INTEGER},
</if>
<if test="compileId != null and compileId != ''" >
compile_id = #{compileId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
classify = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
attribute = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
lable = #{lable,jdbcType=VARCHAR},
</if>
<if test="exprType != null" >
expr_type = #{exprType,jdbcType=INTEGER},
</if>
<if test="matchMethod != null" >
match_method = #{matchMethod,jdbcType=INTEGER},
</if>
<if test="isHexbin != null" >
is_hexbin = #{isHexbin,jdbcType=INTEGER},
</if>
<if test="areaEffectiveIds != null" >
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="cfgType != null and cfgType != ''" >
cfg_type = #{cfgType,jdbcType=VARCHAR},
</if>
<if test="cfgRegionCode != null " >
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
</if>
<if test="ratelimit != null and ratelimit != ''" >
ratelimit = #{ratelimit,jdbcType=VARCHAR},
</if>
<if test="groupId != null">
group_id = #{groupId,jdbcType=INTEGER}
</if>
<if test="userRegion2 != null and userRegion2 != ''" >
user_region2 = #{userRegion2,jdbcType=VARCHAR},
</if>
<if test="userRegion3 != null and userRegion3 != ''" >
user_region3 = #{userRegion3,jdbcType=VARCHAR},
</if>
<if test="userRegion4 != null and userRegion4 != ''" >
user_region4 = #{userRegion4,jdbcType=VARCHAR},
</if>
<if test="userRegion5 != null and userRegion5 != ''" >
user_region5 = #{userRegion5,jdbcType=VARCHAR},
</if>
</trim>
</set>
<where>
and cfg_id = #{cfgId,jdbcType=INTEGER}
</where>
</update>
<delete id="delete" parameterType="java.lang.String" >
delete from domain_comm_cfg where cfg_id in (${ids})
</delete>
<select id="getByIds" resultMap="domainCommGroupCfgMap">
select
<include refid="columns"></include>
from domain_comm_cfg r
where r.cfg_id in (${ids}) and is_valid !=-1
</select>
<select id="getGroupIdCount" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT COUNT(cfg_id) groupCount from domain_comm_cfg
WHERE user_region3= #{groupId}
and is_valid=1
</select>
<select id="findAllList" parameterType="com.nis.domain.basics.DomainCommCfg" resultMap="domainCommGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
domain_comm_cfg r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgKeywords != null and cfgKeywords != ''">
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{cfgType,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND r.IS_VALID != -1
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditTime != null and auditTime !=''">
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
<if test="commonGroupIds != null">
AND r.group_id in(${commonGroupIds})
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
</select>
<select id="getGroupIds" parameterType="com.nis.domain.basics.DomainCommCfg" resultMap="domainCommGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
domain_comm_cfg r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgKeywords != null and cfgKeywords != ''">
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{cfgType,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
<if test="commonGroupIds != null">
AND r.group_id in(${commonGroupIds})
</if>
</trim>
</select>
</mapper>

View File

@@ -0,0 +1,35 @@
package com.nis.web.dao.basics;
import java.util.List;
import java.util.Set;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.basics.IpCommCfg;
import com.nis.domain.basics.Varibles;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface IpCommGroupCfgDao extends CrudDao<IpCommCfg>{
public List<IpCommCfg> findPage(IpCommCfg cfg);
public List<IpCommCfg> findByPage(@Param("ids")String ids);
public void delete(@Param("ids")String ids);
public void updateIssued(IpCommCfg cfg);
public List<IpCommCfg> getByIds(@Param("ids")String ids);
public List<IpCommCfg> findAllList(IpCommCfg cfg);
public List<Integer> findOtherIps(@Param("groupId")Integer groupId,@Param("cfgId")Integer cfgId);
public List<Integer> countValidIPs(@Param("groups")String groups,@Param("ids")String ids);
public int insertBatch(List<IpCommCfg> list);
public Varibles getVaribles(@Param("name")String name);
public void ajaxDeleteAsnIp(@Param("ids")String ids);
public IpCommCfg getOne(IpCommCfg cfg);
public List<Object[]> findAllIpCommGroupCfgList();
public void insertIpCommGroupCfg(IpCommCfg ipPortCfg);
public int getGroupIdCount(int groupId);
// 校验分组是否被引用
public Integer getCfgInfoByGroupIds(@Param("ids")String ids);
public List<IpCommCfg> getGroupIds(IpCommCfg cfg);
public void deleteCfgByGroupIds(@Param("groupIds")String groupIds);
}

View File

@@ -0,0 +1,728 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.basics.IpCommGroupCfgDao">
<resultMap id="IpCommGroupCfgMap" type="com.nis.domain.basics.IpCommCfg">
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
<result column="port_pattern" property="portPattern" jdbcType="INTEGER" />
<result column="src_port" property="srcPort" jdbcType="VARCHAR" />
<result column="dest_port" property="destPort" jdbcType="VARCHAR" />
<result column="direction" property="direction" jdbcType="INTEGER" />
<result column="protocol" property="protocol" jdbcType="INTEGER" />
<result column="protocol_id" property="protocolId" jdbcType="INTEGER" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
</resultMap>
<sql id="columns">
r.cfg_id,r.cfg_desc,r.cfg_type,r.cfg_region_code,r.ip_type,r.src_ip_pattern,r.src_ip_address,r.dest_ip_pattern,r.dest_ip_address,
r.src_port_pattern,r.src_port,r.dest_port_pattern,r.dest_port
,r.protocol,r.protocol_id,r.direction,r.action
,r.is_valid,r.is_audit,r.creator_id,r.create_time,r.editor_id
,r.edit_time,r.auditor_id,r.audit_time,r.service_id,r.request_id,
r.is_area_effective,r.classify,r.attribute,r.lable
,r.area_effective_ids,r.function_id,r.user_region1
,r.user_region2,r.user_region3,r.user_region4,r.user_region5,r.compile_id,r.region_id,r.group_id
</sql>
<select id="findPage" resultMap="IpCommGroupCfgMap">
select
<include refid="columns"></include>
<trim prefix="," prefixOverrides=",">
,s.name as creator_name,e.name as editor_name,u.name as auditor_name
</trim>
from ip_comm_cfg r
left join sys_user s on r.creator_id=s.id
left join sys_user e on r.editor_id=e.id
left join sys_user u on r.auditor_id=u.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{CFG_TYPE,jdbcType=VARCHAR}),'%')
</if>
<if test="ipType != null">
AND r.IP_TYPE=#{ipType,jdbcType=INTEGER}
</if>
<if test="srcIpPattern != null">
AND r.src_ip_pattern=#{srcIpPattern,jdbcType=INTEGER}
</if>
<if test="destIpPattern != null">
AND r.dest_ip_pattern=#{destIpPattern,jdbcType=INTEGER}
</if>
<if test="srcIpAddress != null and srcIpAddress != ''">
AND r.SRC_IP_ADDRESS=#{srcIpAddress,jdbcType=VARCHAR}
</if>
<if test="destIpAddress != null and destIpAddress != ''">
AND r.DEST_IP_ADDRESS=#{destIpAddress,jdbcType=VARCHAR}
</if>
<if test="srcPortPattern != null">
AND r.src_port_pattern=#{srcPortPattern,jdbcType=INTEGER}
</if>
<if test="destPortPattern != null">
AND r.dest_port_pattern=#{destPortPattern,jdbcType=INTEGER}
</if>
<if test="srcPort != null and srcPort !=''">
AND r.SRC_PORT=#{srcPort,jdbcType=VARCHAR}
</if>
<if test="destPort != null and destPort !=''">
AND r.DEST_PORT=#{destPort,jdbcType=VARCHAR}
</if>
<if test="direction != null">
AND r.DIRECTION=#{direction,jdbcType=INTEGER}
</if>
<if test="protocol != null">
AND r.PROTOCOL=#{protocol,jdbcType=INTEGER}
</if>
<if test="protocolId != null">
AND r.PROTOCOL_ID=#{protocolId,jdbcType=INTEGER}
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND r.IS_VALID != -1
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorName != null and creatorName !=''">
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editorName != null and editorName !=''">
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditorName != null and auditorName !=''">
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditTime != null and auditTime !=''">
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="regionId != null">
AND r.region_id=#{regionId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="userRegion3 != null">
AND r.user_region3 like concat(concat('%',#{userRegion3,jdbcType=VARCHAR}),'%')
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY r.CFG_ID desc
</otherwise>
</choose>
</select>
<!-- 配置修改时检索 -->
<select id="get" resultMap="IpCommGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
ip_comm_cfg r
WHERE
r.cfg_id = #{ids} AND r.is_valid != -1
</select>
<select id="getCfgInfoByGroupIds" resultType="java.lang.Integer">
SELECT
COUNT(1)
FROM
ip_comm_cfg r
WHERE
r.group_id IN(${ids}) AND r.is_valid != -1
</select>
<select id="getByIds" resultMap="IpCommGroupCfgMap">
select
<include refid="columns"></include>
from ip_comm_cfg r
where r.cfg_id in (${ids}) and r.is_valid !=-1
</select>
<select id="getByAsnNo" resultMap="IpCommGroupCfgMap" parameterType="java.lang.Long" >
select
<include refid="columns"></include>
from ip_comm_cfg r where r.is_valid!=-1 and r.user_region1=#{asnId}
</select>
<insert id="insertIpCommGroupCfg" parameterType="com.nis.domain.basics.IpCommCfg" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ip_comm_cfg (
CFG_DESC,
ACTION,
IS_VALID,
IS_AUDIT,
CREATOR_ID,
CREATE_TIME,
EDITOR_ID,
EDIT_TIME,
AUDITOR_ID,
AUDIT_TIME,
SERVICE_ID,
REQUEST_ID,
REGION_ID,
GROUP_ID,
COMPILE_ID,
IS_AREA_EFFECTIVE,
CLASSIFY,
ATTRIBUTE,
LABLE,
AREA_EFFECTIVE_IDS,
FUNCTION_ID,
IP_TYPE,
SRC_IP_ADDRESS,
SRC_IP_PATTERN,
DEST_IP_PATTERN,
SRC_PORT_PATTERN,
DEST_PORT_PATTERN,
SRC_PORT,
PROTOCOL,
PROTOCOL_ID,
DIRECTION,
DEST_PORT,
DEST_IP_ADDRESS,
CFG_TYPE,
CFG_REGION_CODE,
USER_REGION1,
USER_REGION2,
USER_REGION3,
USER_REGION4,
USER_REGION5,
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
#{isValid,jdbcType=INTEGER},
#{isAudit,jdbcType=INTEGER},
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{regionId,jdbcType=INTEGER},
#{groupId,jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},
#{direction,jdbcType=INTEGER},
#{destPort,jdbcType=VARCHAR},
#{destIpAddress,jdbcType=VARCHAR},
#{cfgType,jdbcType=VARCHAR},
#{cfgRegionCode,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
)
</insert>
<insert id="insertForBatch" parameterType="com.nis.domain.basics.IpCommCfg" >
insert into ip_comm_cfg (
CFG_DESC,
ACTION,
IS_VALID,
IS_AUDIT,
CREATOR_ID,
CREATE_TIME,
EDITOR_ID,
EDIT_TIME,
AUDITOR_ID,
AUDIT_TIME,
SERVICE_ID,
REQUEST_ID,
REGION_ID,
GROUP_ID,
COMPILE_ID,
IS_AREA_EFFECTIVE,
CLASSIFY,
ATTRIBUTE,
LABLE,
AREA_EFFECTIVE_IDS,
FUNCTION_ID,
IP_TYPE,
SRC_IP_ADDRESS,
SRC_IP_PATTERN,
DEST_IP_PATTERN,
SRC_PORT_PATTERN,
DEST_PORT_PATTERN,
SRC_PORT,
PROTOCOL,
PROTOCOL_ID,
DIRECTION,
DEST_PORT,
DEST_IP_ADDRESS,
CFG_TYPE,
CFG_REGION_CODE,
USER_REGION1,
USER_REGION2,
USER_REGION3,
USER_REGION4,
USER_REGION5
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
#{isValid,jdbcType=INTEGER},
#{isAudit,jdbcType=INTEGER},
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{regionId,jdbcType=INTEGER},
#{groupId,jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},
#{direction,jdbcType=INTEGER},
#{destPort,jdbcType=VARCHAR},
#{destIpAddress,jdbcType=VARCHAR},
#{cfgType,jdbcType=VARCHAR},
#{cfgRegionCode,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
)
</insert>
<update id="update" parameterType="com.nis.domain.basics.IpCommCfg" >
update ip_comm_cfg
<set >
<trim suffixOverrides=",">
<if test="cfgDesc != null and cfgDesc != ''" >
CFG_DESC = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="action != null" >
ACTION = #{action,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
IS_VALID = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
IS_AUDIT = #{isAudit,jdbcType=INTEGER},
</if>
<if test="editorId != null" >
EDITOR_ID = #{editorId,jdbcType=INTEGER},
</if>
<if test="editTime != null and editTime != ''" >
EDIT_TIME = #{editTime,jdbcType=TIMESTAMP},
</if>
<if test="auditorId != null" >
AUDITOR_ID = #{auditorId,jdbcType=INTEGER},
</if>
<if test="auditTime != null and auditTime != ''" >
AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP},
</if>
<if test="requestId != null" >
REQUEST_ID = #{requestId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
IS_AREA_EFFECTIVE = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
CLASSIFY = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
ATTRIBUTE = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
LABLE = #{lable,jdbcType=VARCHAR},
</if>
<if test="areaEffectiveIds != null" >
AREA_EFFECTIVE_IDS = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
<if test="functionId != null" >
FUNCTION_ID = #{functionId,jdbcType=INTEGER},
</if>
<if test="serviceId != null" >
SERVICE_ID = #{serviceId,jdbcType=INTEGER},
</if>
<if test="ipType != null" >
IP_TYPE = #{ipType,jdbcType=INTEGER},
</if>
<if test="srcIpAddress != null and srcIpAddress != ''" >
SRC_IP_ADDRESS = #{srcIpAddress,jdbcType=VARCHAR},
</if>
<if test="srcIpPattern != null" >
SRC_IP_PATTERN = #{srcIpPattern,jdbcType=INTEGER},
</if>
<if test="destIpPattern != null" >
DEST_IP_PATTERN =#{destIpPattern,jdbcType=INTEGER},
</if>
<if test="srcPortPattern != null" >
SRC_PORT_PATTERN = #{srcPortPattern,jdbcType=INTEGER},
</if>
<if test="destPortPattern != null" >
DEST_PORT_PATTERN = #{destPortPattern,jdbcType=INTEGER},
</if>
<if test="srcPort != null and srcPort != ''" >
SRC_PORT = #{srcPort,jdbcType=VARCHAR},
</if>
<if test="protocol != null" >
PROTOCOL = #{protocol,jdbcType=INTEGER},
</if>
<if test="protocolId != null" >
PROTOCOL_ID = #{protocolId,jdbcType=INTEGER},
</if>
<if test="direction != null" >
DIRECTION = #{direction,jdbcType=INTEGER},
</if>
<if test="destPort != null and destPort != ''" >
DEST_PORT = #{destPort,jdbcType=VARCHAR},
</if>
<if test="destIpAddress != null and destIpAddress != ''" >
DEST_IP_ADDRESS = #{destIpAddress,jdbcType=VARCHAR},
</if>
<if test="cfgType != null and cfgType != ''" >
CFG_TYPE = #{cfgType,jdbcType=VARCHAR},
</if>
<if test="cfgRegionCode != null " >
CFG_REGION_CODE = #{cfgRegionCode,jdbcType=INTEGER},
</if>
<if test="userRegion2 != null and userRegion2 != ''" >
USER_REGION2 = #{userRegion2,jdbcType=VARCHAR},
</if>
<if test="userRegion3 != null and userRegion3 != ''" >
USER_REGION3 = #{userRegion3,jdbcType=VARCHAR},
</if>
<if test="userRegion4 != null and userRegion4 != ''" >
USER_REGION4 = #{userRegion4,jdbcType=VARCHAR},
</if>
<if test="userRegion5 != null and userRegion5 != ''" >
USER_REGION5 = #{userRegion5,jdbcType=VARCHAR},
</if>
<if test="groupId != null" >
GROUP_ID = #{groupId,jdbcType=INTEGER},
</if>
<if test="regionId != null" >
REGION_ID = #{regionId,jdbcType=INTEGER},
</if>
</trim>
</set>
<where>
and cfg_id = #{cfgId,jdbcType=INTEGER}
</where>
</update>
<delete id="delete" parameterType="java.lang.String" >
delete from ip_comm_cfg where cfg_id in (${ids})
</delete>
<select id="getGroupIdCount" parameterType="java.lang.Integer" resultType="java.lang.Integer">
SELECT COUNT(cfg_id) groupCount from ip_comm_cfg
WHERE group_id= #{groupId}
and is_valid=1
</select>
<select id="findAllList" resultMap="IpCommGroupCfgMap">
select
<include refid="columns"></include>
from ip_comm_cfg r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{CFG_TYPE,jdbcType=VARCHAR}),'%')
</if>
<if test="ipType != null">
AND r.IP_TYPE=#{ipType,jdbcType=INTEGER}
</if>
<if test="srcIpPattern != null">
AND r.src_ip_pattern=#{srcIpPattern,jdbcType=INTEGER}
</if>
<if test="destIpPattern != null">
AND r.dest_ip_pattern=#{destIpPattern,jdbcType=INTEGER}
</if>
<if test="srcIpAddress != null and srcIpAddress != ''">
AND r.SRC_IP_ADDRESS=#{srcIpAddress,jdbcType=VARCHAR}
</if>
<if test="destIpAddress != null and destIpAddress != ''">
AND r.DEST_IP_ADDRESS=#{destIpAddress,jdbcType=VARCHAR}
</if>
<if test="srcPortPattern != null">
AND r.src_port_pattern=#{srcPortPattern,jdbcType=INTEGER}
</if>
<if test="destPortPattern != null">
AND r.dest_port_pattern=#{destPortPattern,jdbcType=INTEGER}
</if>
<if test="srcPort != null and srcPort !=''">
AND r.SRC_PORT=#{srcPort,jdbcType=VARCHAR}
</if>
<if test="destPort != null and destPort !=''">
AND r.DEST_PORT=#{destPort,jdbcType=VARCHAR}
</if>
<if test="direction != null">
AND r.DIRECTION=#{direction,jdbcType=INTEGER}
</if>
<if test="protocol != null">
AND r.PROTOCOL=#{protocol,jdbcType=INTEGER}
</if>
<if test="protocolId != null">
AND r.PROTOCOL_ID=#{protocolId,jdbcType=INTEGER}
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND r.IS_VALID != -1
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditTime != null and auditTime !=''">
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="regionId != null">
AND r.region_id=#{regionId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="userRegion1 != null">
AND r.user_region1 like concat(concat('%',#{userRegion1,jdbcType=VARCHAR}),'%')
</if>
<if test="userRegion2 != null">
AND r.user_region2 like concat(concat('%',#{userRegion2,jdbcType=VARCHAR}),'%')
</if>
<if test="userRegion3 != null">
AND r.user_region3 like concat(concat('%',#{userRegion3,jdbcType=VARCHAR}),'%')
</if>
<if test="userRegion4 != null">
AND r.user_region4 like concat(concat('%',#{userRegion4,jdbcType=VARCHAR}),'%')
</if>
<if test="userRegion5 != null">
AND r.user_region5 like concat(concat('%',#{userRegion5,jdbcType=VARCHAR}),'%')
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
<if test="commonGroupIds != null">
AND r.group_id in(${commonGroupIds})
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
</select>
<select id="getGroupIds" parameterType="com.nis.domain.basics.IpCommCfg" resultMap="IpCommGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
ip_comm_cfg r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{CFG_TYPE,jdbcType=VARCHAR}),'%')
</if>
<if test="ipType != null">
AND r.IP_TYPE=#{ipType,jdbcType=INTEGER}
</if>
<if test="srcIpPattern != null">
AND r.src_ip_pattern=#{srcIpPattern,jdbcType=INTEGER}
</if>
<if test="destIpPattern != null">
AND r.dest_ip_pattern=#{destIpPattern,jdbcType=INTEGER}
</if>
<if test="srcIpAddress != null and srcIpAddress != ''">
AND r.SRC_IP_ADDRESS=#{srcIpAddress,jdbcType=VARCHAR}
</if>
<if test="destIpAddress != null and destIpAddress != ''">
AND r.DEST_IP_ADDRESS=#{destIpAddress,jdbcType=VARCHAR}
</if>
<if test="srcPortPattern != null">
AND r.src_port_pattern=#{srcPortPattern,jdbcType=INTEGER}
</if>
<if test="destPortPattern != null">
AND r.dest_port_pattern=#{destPortPattern,jdbcType=INTEGER}
</if>
<if test="srcPort != null and srcPort !=''">
AND r.SRC_PORT=#{srcPort,jdbcType=VARCHAR}
</if>
<if test="destPort != null and destPort !=''">
AND r.DEST_PORT=#{destPort,jdbcType=VARCHAR}
</if>
<if test="direction != null">
AND r.DIRECTION=#{direction,jdbcType=INTEGER}
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
</trim>
</select>
<delete id="deleteCfgByGroupIds" parameterType="java.lang.String" >
delete from ip_comm_cfg where group_id in (${groupIds})
</delete>
</mapper>

View File

@@ -26,4 +26,10 @@ public interface PolicyGroupInfoDao extends CrudDao<PolicyGroupInfo> {
PolicyGroupInfo getGroupInfo(PolicyGroupInfo policyGroupInfo); PolicyGroupInfo getGroupInfo(PolicyGroupInfo policyGroupInfo);
List<PolicyGroupInfo> findPolicyByGroupInfoList(@Param("ids")String ids); List<PolicyGroupInfo> findPolicyByGroupInfoList(@Param("ids")String ids);
List<PolicyGroupInfo> findPolicyByGroupInfoListByGroupIds(@Param("serviceGroupIds")String ids);
List<PolicyGroupInfo> findPolicyGroupInfosByTypeForUD(@Param("groupType")Integer groupType,@Param("flag")Integer flag);
List<PolicyGroupInfo> findLimitedPolicyGroupInfosByTypeForUD(@Param("groupType")Integer groupType,@Param("flag")Integer flag,@Param("limit")Integer limit);
void updateUdFlag(@Param("groupIds")String groupIds,@Param("udFlag")int udFlag,@Param("groupType")Integer groupType);
List<PolicyGroupInfo> findPolicyByServiceGroupInfoList(@Param("ids")String ids);
} }

View File

@@ -17,7 +17,7 @@
</resultMap> </resultMap>
<sql id="PolicyGroupInfoColumns"> <sql id="PolicyGroupInfoColumns">
r.group_id,r.group_name,r.group_type,r.is_valid,r.create_time,r.edit_time, r.group_id,r.group_name,r.group_type,r.is_valid,r.create_time,r.edit_time,
r.creator_id,r.editor_id,r.service_group_id,r.asn_no,r.description r.creator_id,r.editor_id,r.service_group_id,r.asn_no,r.description,r.ud_flag
</sql> </sql>
<!-- 查出所有 有效数据--> <!-- 查出所有 有效数据-->
@@ -266,6 +266,64 @@
WHERE WHERE
r.group_id IN (${ids}) r.group_id IN (${ids})
</select> </select>
<!-- 查出所有 有效数据-->
<select id="findPolicyByGroupInfoListByGroupIds" resultMap="PolicyGroupInfoMap">
SELECT
<include refid="PolicyGroupInfoColumns"/>
<trim prefix="," prefixOverrides=",">
, s.name as creator_name
,e.name as editor_name
</trim>
FROM
policy_group_info r
left join sys_user s on r.creator_id=s.id
left join sys_user e on r.editor_id=e.id
WHERE
r.group_id IN (${serviceGroupIds})
</select>
<select id="findPolicyByServiceGroupInfoList" resultMap="PolicyGroupInfoMap">
SELECT
<include refid="PolicyGroupInfoColumns"/>
<trim prefix="," prefixOverrides=",">
, s.name as creator_name
,e.name as editor_name
</trim>
FROM
policy_group_info r
left join sys_user s on r.creator_id=s.id
left join sys_user e on r.editor_id=e.id
WHERE
r.service_group_id IN (${ids})
</select>
<select id="findPolicyGroupInfosByTypeForUD" resultMap="PolicyGroupInfoMap">
SELECT
<include refid="PolicyGroupInfoColumns"/>
FROM policy_group_info r
where r.is_valid=1 and r.group_type=#{groupType,jdbcType=INTEGER}
<if test="flag!=null">
and ud_flag=#{flag}
</if>
</select>
<select id="findLimitedPolicyGroupInfosByTypeForUD" resultMap="PolicyGroupInfoMap">
SELECT
<include refid="PolicyGroupInfoColumns"/>
FROM policy_group_info r
where r.is_valid=1 and r.group_type=#{groupType,jdbcType=INTEGER}
<if test="flag!=null">
and ud_flag=#{flag}
</if>
<if test="flag!=null">
limit #{limit}
</if>
</select>
<update id="updateUdFlag">
UPDATE policy_group_info SET ud_flag =#{udFlag}
WHERE service_group_id in (${groupIds})
<if test="groupType!=null">
and group_type=#{groupType}
</if>
</update>
</mapper> </mapper>

View File

@@ -0,0 +1,37 @@
package com.nis.web.dao.basics;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.basics.ScriberIdCommCfg;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface ScriberIdCommGroupDao extends CrudDao<ScriberIdCommCfg>{
// 查询列表
public List<ScriberIdCommCfg> findAllPageList(ScriberIdCommCfg entity);
public List<ScriberIdCommCfg> findByPage(@Param("ids")String ids);
public List<ScriberIdCommCfg> findInfoByCfgId(@Param("cfgId")Long cfgId);
//新增
public int insertCommGroupCfg(ScriberIdCommCfg entity);
//修改
public int update(ScriberIdCommCfg entity);
//删除
public int delete(@Param("ids")String ids);
public List<ScriberIdCommCfg> getByIds(@Param("ids")String ids);
public Integer getGroupIdCount(@Param("groupId")String groupId);
// 校验分组是否被引用
public Integer getCfgInfoByGroupIds(@Param("ids")String ids);
public List<ScriberIdCommCfg> getGroupIds(ScriberIdCommCfg cfg);
}

View File

@@ -0,0 +1,525 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.basics.ScriberIdCommGroupDao">
<resultMap id="commGroupCfgMap" type="com.nis.domain.basics.ScriberIdCommCfg">
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="expr_type" property="exprType" jdbcType="INTEGER" />
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
<result column="group_name" property="groupName" jdbcType="VARCHAR" />
</resultMap>
<sql id="columns">
r.cfg_id,r.cfg_desc,r.cfg_keywords,r.action,r.is_valid,r.is_audit,r.creator_id,
r.create_time,r.editor_id,r.edit_time,r.auditor_id,r.audit_time,r.service_id,
r.request_id,r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable,
r.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,
r.cfg_region_code,r.cfg_type,r.ratelimit, r.region_id, r.group_id,r.user_region1,r.user_region2,
r.user_region3,r.user_region4,r.user_region5
</sql>
<select id="findAllPageList" parameterType="com.nis.domain.basics.ScriberIdCommCfg" resultMap="commGroupCfgMap">
SELECT
<include refid="columns"></include>
<trim prefix="," prefixOverrides=",">
,s.name AS creator_name,e.name AS editor_name,u.name AS auditor_name,c.group_name
</trim>
FROM
scriberid_comm_cfg r
LEFT JOIN sys_user s ON r.creator_id = s.id
LEFT JOIN sys_user e ON r.editor_id = e.id
LEFT JOIN sys_user u ON r.auditor_id = u.id
LEFT JOIN policy_group_info c ON c.service_group_id=r.user_region3
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgKeywords != null and cfgKeywords != ''">
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{cfgType,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND r.IS_VALID != -1
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorName != null and creatorName !=''">
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editorName != null and editorName !=''">
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditorName != null and auditorName !=''">
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditTime != null and auditTime !=''">
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY r.is_audit,r.create_time desc
</otherwise>
</choose>
</select>
<select id="findByPage" resultMap="commGroupCfgMap">
SELECT
<include refid="columns"></include>
<trim prefix="," prefixOverrides=",">
,s.name AS creator_name,e.name AS editor_name,u.name AS auditor_name
</trim>
FROM
scriberid_comm_cfg r
LEFT JOIN sys_user s ON r.creator_id = s.id
LEFT JOIN sys_user e ON r.editor_id = e.id
LEFT JOIN sys_user u ON r.auditor_id = u.id
where r.CFG_ID in (${ids})
</select>
<select id="findInfoByCfgId" resultMap="commGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
scriberid_comm_cfg r
where r.CFG_ID =#{cfgId}
</select>
<!-- 修改时检索 -->
<select id="get" resultMap="commGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
scriberid_comm_cfg r
WHERE
r.cfg_id = #{ids} AND r.is_valid != -1
</select>
<select id="getCfgInfoByGroupIds" resultType="java.lang.Integer">
SELECT
COUNT(1)
FROM
scriberid_comm_cfg r
WHERE
r.group_id IN(${ids}) AND r.is_valid != -1
</select>
<insert id="insertCommGroupCfg" parameterType="com.nis.domain.basics.ScriberIdCommCfg">
insert into scriberid_comm_cfg (
CFG_DESC,
cfg_keywords,
action,
is_valid,
is_audit,
creator_id,
create_time,
editor_id,
edit_time,
auditor_id,
audit_time,
service_id,
request_id,
compile_id,
IS_AREA_EFFECTIVE,
CLASSIFY,
ATTRIBUTE,
LABLE,
expr_type,
match_method,
is_hexbin,
area_effective_ids,
function_id,
cfg_region_code,
cfg_type,
ratelimit,
region_id,
group_id,
user_region1,
user_region2,
user_region3,
user_region4,
user_region5
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{cfgKeywords,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
#{isValid,jdbcType=INTEGER},
#{isAudit,jdbcType=INTEGER},
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{exprType,jdbcType=INTEGER},
#{matchMethod,jdbcType=INTEGER},
#{isHexbin,jdbcType=INTEGER},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{cfgRegionCode,jdbcType=INTEGER},
#{cfgType,jdbcType=VARCHAR},
#{ratelimit,jdbcType=VARCHAR},
#{regionId,jdbcType=INTEGER},
#{groupId,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
)
</insert>
<update id="update" parameterType="com.nis.domain.basics.ScriberIdCommCfg" >
update scriberid_comm_cfg
<set >
<trim suffixOverrides=",">
<if test="cfgDesc != null and cfgDesc != ''" >
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="cfgKeywords != null and cfgKeywords != ''" >
cfg_keywords = #{cfgKeywords,jdbcType=VARCHAR},
</if>
<if test="action != null" >
action = #{action,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
<if test="editTime != null and editTime != ''" >
edit_time = #{editTime,jdbcType=TIMESTAMP},
</if>
<if test="auditorId != null" >
AUDITOR_ID = #{auditorId,jdbcType=INTEGER},
</if>
<if test="auditTime != null and auditTime != ''" >
AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP},
</if>
<if test="serviceId != null" >
service_id = #{serviceId,jdbcType=INTEGER},
</if>
<if test="requestId != null" >
request_id = #{requestId,jdbcType=INTEGER},
</if>
<if test="compileId != null and compileId != ''" >
compile_id = #{compileId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
classify = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
attribute = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
lable = #{lable,jdbcType=VARCHAR},
</if>
<if test="exprType != null" >
expr_type = #{exprType,jdbcType=INTEGER},
</if>
<if test="matchMethod != null" >
match_method = #{matchMethod,jdbcType=INTEGER},
</if>
<if test="isHexbin != null" >
is_hexbin = #{isHexbin,jdbcType=INTEGER},
</if>
<if test="areaEffectiveIds != null" >
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="cfgType != null and cfgType != ''" >
cfg_type = #{cfgType,jdbcType=VARCHAR},
</if>
<if test="cfgRegionCode != null " >
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
</if>
<if test="ratelimit != null and ratelimit != ''" >
ratelimit = #{ratelimit,jdbcType=VARCHAR},
</if>
<if test="groupId != null">
group_id = #{groupId,jdbcType=INTEGER}
</if>
<if test="userRegion2 != null and userRegion2 != ''" >
user_region2 = #{userRegion2,jdbcType=VARCHAR},
</if>
<if test="userRegion3 != null and userRegion3 != ''" >
user_region3 = #{userRegion3,jdbcType=VARCHAR},
</if>
<if test="userRegion4 != null and userRegion4 != ''" >
user_region4 = #{userRegion4,jdbcType=VARCHAR},
</if>
<if test="userRegion5 != null and userRegion5 != ''" >
user_region5 = #{userRegion5,jdbcType=VARCHAR},
</if>
</trim>
</set>
<where>
and cfg_id = #{cfgId,jdbcType=INTEGER}
</where>
</update>
<delete id="delete" parameterType="java.lang.String" >
delete from scriberid_comm_cfg where cfg_id in (${ids})
</delete>
<select id="getByIds" resultMap="commGroupCfgMap">
select
<include refid="columns"></include>
from scriberid_comm_cfg r
where r.cfg_id in (${ids}) and is_valid !=-1
</select>
<select id="getGroupIdCount" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT COUNT(cfg_id) groupCount from scriberid_comm_cfg
WHERE user_region3= #{groupId}
and is_valid=1
</select>
<select id="findAllList" parameterType="com.nis.domain.basics.ScriberIdCommCfg" resultMap="commGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
scriberid_comm_cfg r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgKeywords != null and cfgKeywords != ''">
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{cfgType,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND r.IS_VALID != -1
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditTime != null and auditTime !=''">
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
<if test="commonGroupIds != null">
AND r.group_id in(${commonGroupIds})
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
</select>
<select id="getGroupIds" parameterType="com.nis.domain.basics.ScriberIdCommCfg" resultMap="commGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
scriberid_comm_cfg r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgKeywords != null and cfgKeywords != ''">
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{cfgType,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
<if test="commonGroupIds != null">
AND r.group_id in(${commonGroupIds})
</if>
</trim>
</select>
</mapper>

View File

@@ -0,0 +1,42 @@
package com.nis.web.dao.basics;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.basics.UrlCommCfg;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface UrlCommGroupDao extends CrudDao<UrlCommCfg>{
// 查询列表
public List<UrlCommCfg> findAllPageList(UrlCommCfg entity);
public List<UrlCommCfg> findByPage(@Param("ids")String ids);
public List<UrlCommCfg> findInfoByCfgId(@Param("cfgId")Long cfgId);
//新增
public int insertUrlCommGroupCfg(UrlCommCfg entity);
public Integer findUrlUdFlag(@Param("groupId")Integer groupId);
public int updateUrlUdFlag(@Param("groupId")Integer groupId,@Param("udFlag")Integer udFlag);
//修改
public int update(UrlCommCfg entity);
//删除
public int delete(@Param("ids")String ids);
public List<UrlCommCfg> getByIds(@Param("ids")String ids);
public Integer getGroupIdCount(@Param("groupId")String groupId);
// 校验分组是否被引用
public Integer getCfgInfoByGroupIds(@Param("ids")String ids);
public List<UrlCommCfg> getGroupIds(UrlCommCfg cfg);
}

View File

@@ -0,0 +1,534 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.basics.UrlCommGroupDao">
<resultMap id="urlCommGroupCfgMap" type="com.nis.domain.basics.UrlCommCfg">
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="expr_type" property="exprType" jdbcType="INTEGER" />
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
<result column="group_name" property="groupName" jdbcType="VARCHAR" />
</resultMap>
<sql id="columns">
r.cfg_id,r.cfg_desc,r.cfg_keywords,r.action,r.is_valid,r.is_audit,r.creator_id,
r.create_time,r.editor_id,r.edit_time,r.auditor_id,r.audit_time,r.service_id,
r.request_id,r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable,
r.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,
r.cfg_region_code,r.cfg_type,r.ratelimit, r.region_id, r.group_id,r.user_region1,r.user_region2,
r.user_region3,r.user_region4,r.user_region5
</sql>
<select id="findAllPageList" parameterType="com.nis.domain.basics.UrlCommCfg" resultMap="urlCommGroupCfgMap">
SELECT
<include refid="columns"></include>
<trim prefix="," prefixOverrides=",">
,s.name AS creator_name,e.name AS editor_name,u.name AS auditor_name,c.group_name
</trim>
FROM
url_comm_cfg r
LEFT JOIN sys_user s ON r.creator_id = s.id
LEFT JOIN sys_user e ON r.editor_id = e.id
LEFT JOIN sys_user u ON r.auditor_id = u.id
LEFT JOIN policy_group_info c ON c.service_group_id=r.user_region3
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgKeywords != null and cfgKeywords != ''">
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{cfgType,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND r.IS_VALID != -1
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorName != null and creatorName !=''">
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editorName != null and editorName !=''">
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditorName != null and auditorName !=''">
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditTime != null and auditTime !=''">
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY r.is_audit,r.create_time desc
</otherwise>
</choose>
</select>
<select id="findByPage" resultMap="urlCommGroupCfgMap">
SELECT
<include refid="columns"></include>
<trim prefix="," prefixOverrides=",">
,s.name AS creator_name,e.name AS editor_name,u.name AS auditor_name
</trim>
FROM
url_comm_cfg r
LEFT JOIN sys_user s ON r.creator_id = s.id
LEFT JOIN sys_user e ON r.editor_id = e.id
LEFT JOIN sys_user u ON r.auditor_id = u.id
where r.CFG_ID in (${ids})
</select>
<select id="findInfoByCfgId" resultMap="urlCommGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
url_comm_cfg r
where r.CFG_ID =#{cfgId}
</select>
<!-- 修改时检索 -->
<select id="get" resultMap="urlCommGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
url_comm_cfg r
WHERE
r.cfg_id = #{ids} AND r.is_valid != -1
</select>
<select id="getCfgInfoByGroupIds" resultType="java.lang.Integer">
SELECT
COUNT(1)
FROM
url_comm_cfg r
WHERE
r.group_id IN(${ids}) AND r.is_valid != -1
</select>
<insert id="insertUrlCommGroupCfg" parameterType="com.nis.domain.basics.UrlCommCfg">
insert into url_comm_cfg (
CFG_DESC,
cfg_keywords,
action,
is_valid,
is_audit,
creator_id,
create_time,
editor_id,
edit_time,
auditor_id,
audit_time,
service_id,
request_id,
compile_id,
IS_AREA_EFFECTIVE,
CLASSIFY,
ATTRIBUTE,
LABLE,
expr_type,
match_method,
is_hexbin,
area_effective_ids,
function_id,
cfg_region_code,
cfg_type,
ratelimit,
region_id,
group_id,
user_region1,
user_region2,
user_region3,
user_region4,
user_region5
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{cfgKeywords,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
#{isValid,jdbcType=INTEGER},
#{isAudit,jdbcType=INTEGER},
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{exprType,jdbcType=INTEGER},
#{matchMethod,jdbcType=INTEGER},
#{isHexbin,jdbcType=INTEGER},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{cfgRegionCode,jdbcType=INTEGER},
#{cfgType,jdbcType=VARCHAR},
#{ratelimit,jdbcType=VARCHAR},
#{regionId,jdbcType=INTEGER},
#{groupId,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
)
</insert>
<select id="findUrlUdFlag" parameterType="java.lang.Integer" resultType="java.lang.Integer">
SELECT ud_flag from policy_group_info
where service_group_id=#{groupId}
and group_type=11
</select>
<update id="updateUrlUdFlag" parameterType="java.lang.Integer">
UPDATE policy_group_info SET ud_flag =#{udFlag}
WHERE service_group_id=#{groupId}
and group_type=11
</update>
<update id="update" parameterType="com.nis.domain.basics.UrlCommCfg" >
update url_comm_cfg
<set >
<trim suffixOverrides=",">
<if test="cfgDesc != null and cfgDesc != ''" >
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="cfgKeywords != null and cfgKeywords != ''" >
cfg_keywords = #{cfgKeywords,jdbcType=VARCHAR},
</if>
<if test="action != null" >
action = #{action,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
<if test="editTime != null and editTime != ''" >
edit_time = #{editTime,jdbcType=TIMESTAMP},
</if>
<if test="auditorId != null" >
AUDITOR_ID = #{auditorId,jdbcType=INTEGER},
</if>
<if test="auditTime != null and auditTime != ''" >
AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP},
</if>
<if test="serviceId != null" >
service_id = #{serviceId,jdbcType=INTEGER},
</if>
<if test="requestId != null" >
request_id = #{requestId,jdbcType=INTEGER},
</if>
<if test="compileId != null and compileId != ''" >
compile_id = #{compileId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
classify = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
attribute = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
lable = #{lable,jdbcType=VARCHAR},
</if>
<if test="exprType != null" >
expr_type = #{exprType,jdbcType=INTEGER},
</if>
<if test="matchMethod != null" >
match_method = #{matchMethod,jdbcType=INTEGER},
</if>
<if test="isHexbin != null" >
is_hexbin = #{isHexbin,jdbcType=INTEGER},
</if>
<if test="areaEffectiveIds != null" >
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="cfgType != null and cfgType != ''" >
cfg_type = #{cfgType,jdbcType=VARCHAR},
</if>
<if test="cfgRegionCode != null " >
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
</if>
<if test="ratelimit != null and ratelimit != ''" >
ratelimit = #{ratelimit,jdbcType=VARCHAR},
</if>
<if test="groupId != null">
group_id = #{groupId,jdbcType=INTEGER}
</if>
<if test="userRegion2 != null and userRegion2 != ''" >
user_region2 = #{userRegion2,jdbcType=VARCHAR},
</if>
<if test="userRegion3 != null and userRegion3 != ''" >
user_region3 = #{userRegion3,jdbcType=VARCHAR},
</if>
<if test="userRegion4 != null and userRegion4 != ''" >
user_region4 = #{userRegion4,jdbcType=VARCHAR},
</if>
<if test="userRegion5 != null and userRegion5 != ''" >
user_region5 = #{userRegion5,jdbcType=VARCHAR},
</if>
</trim>
</set>
<where>
and cfg_id = #{cfgId,jdbcType=INTEGER}
</where>
</update>
<delete id="delete" parameterType="java.lang.String" >
delete from url_comm_cfg where cfg_id in (${ids})
</delete>
<select id="getByIds" resultMap="urlCommGroupCfgMap">
select
<include refid="columns"></include>
from url_comm_cfg r
where r.cfg_id in (${ids}) and is_valid !=-1
</select>
<select id="getGroupIdCount" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT COUNT(cfg_id) groupCount from url_comm_cfg
WHERE user_region3= #{groupId}
and is_valid=1
</select>
<select id="findAllList" parameterType="com.nis.domain.basics.UrlCommCfg" resultMap="urlCommGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
url_comm_cfg r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgKeywords != null and cfgKeywords != ''">
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{cfgType,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND r.IS_VALID != -1
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditTime != null and auditTime !=''">
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
<if test="commonGroupIds != null">
AND r.group_id in(${commonGroupIds})
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
</select>
<select id="getGroupIds" parameterType="com.nis.domain.basics.UrlCommCfg" resultMap="urlCommGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
url_comm_cfg r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgKeywords != null and cfgKeywords != ''">
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{cfgType,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
</trim>
</select>
</mapper>

View File

@@ -2,13 +2,9 @@ package com.nis.web.dao.configuration;
import java.util.List; import java.util.List;
import com.nis.domain.configuration.*;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.nis.domain.configuration.BaseCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CachePolicyUserRegion;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.web.dao.MyBatisDao; import com.nis.web.dao.MyBatisDao;
@@ -47,4 +43,16 @@ public interface CommonPolicyDao {
@Param("compileIds")List compileIds); @Param("compileIds")List compileIds);
public void clearPolicies(@Param("tableName")String tableName); public void clearPolicies(@Param("tableName")String tableName);
List<CfgIndexInfo> getObjGroupListByGroupIds(@Param("groupIds")String groupIds,@Param("functionId")Integer functionId,@Param("isValid") Integer isValid);
void updateCfgIndexCommonGroupIds(CfgIndexInfo cfgIndexInfo);
List<ObjGroupCfg> getObjGroupList(@Param("ids")String ids);
List<ObjGroupCfg> getObjGroupPagedList(ObjGroupCfg entity);
void cancelScheduCfg(@Param("compileIds")String compileIds,@Param("tableName")String tableName);
// 分组域配置管理 批量删除时使用
void updateCfgIndexCommonGroupIdsBatch(CfgIndexInfo cfgIndexInfo);
} }

View File

@@ -74,7 +74,7 @@
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" /> <id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" /> <result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" /> <result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" /> <result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" /> <result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" /> <result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" /> <result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
@@ -164,13 +164,16 @@
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" /> <result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" /> <result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
</resultMap> </resultMap>
<resultMap id="ObjMap" type="com.nis.domain.configuration.ObjGroupCfg" extends="CfgIndexInfoMap" >
<result column="common_group_ids" property="commonGroupIds" jdbcType="VARCHAR" />
</resultMap>
<sql id="ConfigIndex_Column" > <sql id="ConfigIndex_Column" >
a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT, a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT,
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME, a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY, a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.dns_strategy_id,a.user_region1, a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.dns_strategy_id,a.user_region1,
a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log,a.source_compile_id,a.cancel_request_id, a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log,a.source_compile_id,a.cancel_request_id,
a.do_blacklist a.do_blacklist,a.common_group_ids
</sql> </sql>
<sql id="IpCfg_Column" > <sql id="IpCfg_Column" >
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port
@@ -340,6 +343,14 @@
</where> </where>
) )
</if> </if>
<if test="userRegion5 != null and userRegion5 != ''">
AND
<foreach collection="userRegion5.split(',')" index="index" item="item" open="(" separator="OR" close=")">
<if test="item != ''">
a.common_group_ids LIKE concat(concat('%',#{item,jdbcType=VARCHAR}),'%')
</if>
</foreach>
</if>
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${sqlMap.dsf} ${sqlMap.dsf}
@@ -447,7 +458,8 @@
user_region5, user_region5,
do_log, do_log,
source_compile_id, source_compile_id,
do_blacklist do_blacklist,
common_group_ids
)values ( )values (
#{cfgDesc,jdbcType=VARCHAR}, #{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER}, #{action,jdbcType=INTEGER},
@@ -476,7 +488,8 @@
#{userRegion5,jdbcType=VARCHAR}, #{userRegion5,jdbcType=VARCHAR},
#{doLog,jdbcType=INTEGER}, #{doLog,jdbcType=INTEGER},
#{sourceCompileId,jdbcType=INTEGER}, #{sourceCompileId,jdbcType=INTEGER},
#{doBlackList,jdbcType=INTEGER} #{doBlackList,jdbcType=INTEGER},
#{commonGroupIds,jdbcType=VARCHAR}
) )
</insert> </insert>
@@ -760,10 +773,30 @@
user_region3 = #{userRegion3,jdbcType=VARCHAR}, user_region3 = #{userRegion3,jdbcType=VARCHAR},
user_region4 = #{userRegion4,jdbcType=VARCHAR}, user_region4 = #{userRegion4,jdbcType=VARCHAR},
user_region5 = #{userRegion5,jdbcType=VARCHAR}, user_region5 = #{userRegion5,jdbcType=VARCHAR},
<if test="commonGroupIds != null">
common_group_ids= #{commonGroupIds,jdbcType=VARCHAR},
</if>
</trim> </trim>
</set> </set>
where cfg_id = #{cfgId,jdbcType=BIGINT} where cfg_id = #{cfgId,jdbcType=BIGINT}
</update> </update>
<update id="updateCfgIndexCommonGroupIds" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
update cfg_index_info
<set >
<trim suffixOverrides=",">
<if test="commonGroupIds != null">
common_group_ids= #{commonGroupIds,jdbcType=VARCHAR},
</if>
<if test="isValid != null">
is_valid= #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null">
is_audit= #{isAudit,jdbcType=INTEGER},
</if>
</trim>
</set>
where cfg_id = #{cfgId,jdbcType=BIGINT}
</update>
<!-- 删除子配置 --> <!-- 删除子配置 -->
<delete id="deleteIpPortCfg" > <delete id="deleteIpPortCfg" >
@@ -1081,5 +1114,176 @@
SET is_valid = -1, is_audit = 0 SET is_valid = -1, is_audit = 0
WHERE is_valid != -1 WHERE is_valid != -1
</update> </update>
<select id="getObjGroupListByGroupIds" resultMap="CfgIndexInfoMap">
SELECT
<include refid="ConfigIndex_Column" />
FROM cfg_index_info a
<trim prefix="WHERE" prefixOverrides="AND">
<if test="groupIds!=null">
AND (
<foreach collection="groupIds.split(',')" index="index" item="item" >
<if test="index==0">
a.common_group_ids like concat('%,',#{item,jdbcType=INTEGER},',%')
</if>
<if test="index!=0">
OR a.common_group_ids like concat('%,',#{item,jdbcType=INTEGER},',%')
</if>
</foreach>
)
</if>
<if test="functionId!=null" >
AND function_id=#{functionId,jdbcType=INTEGER}
</if>
<if test="isValid!=null" >
AND is_valid=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid==null" >
AND is_valid !=-1
</if>
</trim>
</select>
<select id="getObjGroupList" resultMap="ObjMap" parameterType="com.nis.domain.configuration.ObjGroupCfg" >
SELECT
<include refid="ConfigIndex_Column" />
<trim prefix="," prefixOverrides=",">
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
FROM cfg_index_info a
left join sys_user s on a.creator_id=s.id
left join sys_user e on a.editor_id=e.id
left join sys_user u on a.auditor_id=u.id
left join request_info ri on a.request_id=ri.id
where a.CFG_ID in (${ids})
</select>
<select id="getObjGroupPagedList" resultMap="ObjMap" parameterType="com.nis.domain.configuration.ObjGroupCfg" >
SELECT
<include refid="ConfigIndex_Column" />
<trim prefix="," prefixOverrides=",">
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
FROM cfg_index_info a
left join sys_user s on a.creator_id=s.id
left join sys_user e on a.editor_id=e.id
left join sys_user u on a.auditor_id=u.id
left join request_info ri on a.request_id=ri.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND a.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND a.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND a.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND a.IS_VALID != -1
</if>
<if test="isAudit != null">
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorName != null and creatorName != ''">
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editorName != null and editorName != ''">
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditorName != null and auditorName != ''">
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="serviceId != null">
AND a.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND a.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="compileId != null">
AND a.COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
<if test="compileIdNew != null and compileIdNew != '' and compileIdNew.indexOf('-') != -1">
<foreach collection="compileIdNew.split('-')" index="index" item="item" >
<if test="index == 0">
AND a.COMPILE_ID &gt;= #{item,jdbcType=INTEGER}
</if>
<if test="index == 1">
AND a.COMPILE_ID &lt;= #{item,jdbcType=INTEGER}
</if>
</foreach>
</if>
<if test="compileIdNew !=null and compileIdNew != '' and compileIdNew.indexOf(',') != -1">
AND a.COMPILE_ID in
<foreach collection="compileIdNew.split(',')" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="compileIdNew !=null and compileIdNew != '' and compileIdNew.indexOf(',') == -1 and compileIdNew.indexOf('-') == -1">
AND a.COMPILE_ID=#{compileIdNew,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND a.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify != ''">
AND a.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute != ''">
AND a.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable != ''">
AND a.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
AND a.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND a.function_id=#{functionId,jdbcType=INTEGER}
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}, a.is_audit,a.CFG_ID desc
</when>
<otherwise>
ORDER BY a.is_audit,a.CFG_ID desc
</otherwise>
</choose>
</select>
<delete id="cancelScheduCfg" >
delete from schedule_cfg
where table_name= #{tableName}
and compile_id in(${compileIds})
</delete>
<update id="updateCfgIndexCommonGroupIdsBatch" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
UPDATE
cfg_index_info a
SET
a.common_group_ids = #{commonGroupIds,jdbcType=VARCHAR}
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="isValid != null">
AND a.IS_VALID = #{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND a.IS_VALID != -1
</if>
<if test="userRegion5 != null and userRegion5 != ''">
AND
<foreach collection="userRegion5.split(',')" index="index" item="item" open="(" separator="OR" close=")">
<if test="item != ''">
a.common_group_ids LIKE concat(concat('%',#{item,jdbcType=VARCHAR}),'%')
</if>
</foreach>
</if>
</trim>
</update>
</mapper> </mapper>

View File

@@ -4,11 +4,11 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.nis.domain.basics.*;
import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.ResultType; import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.nis.domain.basics.AsnIpCfg;
import com.nis.domain.configuration.AppByteCfg; import com.nis.domain.configuration.AppByteCfg;
import com.nis.domain.configuration.AppComplexKeywordCfg; import com.nis.domain.configuration.AppComplexKeywordCfg;
import com.nis.domain.configuration.AppDomainCfg; import com.nis.domain.configuration.AppDomainCfg;
@@ -106,4 +106,8 @@ public interface ConfigSynchronizationDao {
public void updateCfgStatus(BaseCfg entity); public void updateCfgStatus(BaseCfg entity);
public PxyObjSpoofingIpPool getPxyObjSpoofingIpPool(Long cfgId); public PxyObjSpoofingIpPool getPxyObjSpoofingIpPool(Long cfgId);
List<IpCommCfg> getIpCommCfgPortList(@Param("groupIds")List groupIds);
List<UrlCommCfg> getUrlCommCfgPortList(@Param("groupIds")List<Integer> groupIds);
List<ScriberIdCommCfg> getSubscribeIdCommCfgPortList(@Param("groupIds")List<Integer> groupIds);
List<DomainCommCfg> getDomainCommCfgPortList(@Param("groupIds")List<Integer> groupIds);
} }

View File

@@ -80,7 +80,7 @@
<result column="app_code" property="appCode" jdbcType="INTEGER" /> <result column="app_code" property="appCode" jdbcType="INTEGER" />
<result column="behav_code" property="behavCode" jdbcType="INTEGER" /> <result column="behav_code" property="behavCode" jdbcType="INTEGER" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" /> <result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" /> <result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" /> <result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" /> <result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" /> <result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
@@ -241,7 +241,7 @@
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" /> <id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" /> <result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" /> <result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" /> <result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" /> <result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" /> <result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" /> <result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
@@ -378,12 +378,13 @@
<result column="source_compile_id" property="sourceCompileId" jdbcType="INTEGER" /> <result column="source_compile_id" property="sourceCompileId" jdbcType="INTEGER" />
<result column="cancel_request_id" property="cancelRequestId" jdbcType="INTEGER" /> <result column="cancel_request_id" property="cancelRequestId" jdbcType="INTEGER" />
<result column="do_blacklist" property="doBlackList" jdbcType="INTEGER" /> <result column="do_blacklist" property="doBlackList" jdbcType="INTEGER" />
<result column="common_group_ids" property="commonGroupIds" jdbcType="VARCHAR" />
</resultMap> </resultMap>
<resultMap id="ipPortMap" type="com.nis.domain.configuration.IpPortCfg" > <resultMap id="ipPortMap" type="com.nis.domain.configuration.IpPortCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" /> <id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" /> <result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" /> <result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" /> <result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" /> <result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" /> <result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" /> <result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
@@ -414,6 +415,10 @@
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" /> <result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" /> <result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
</resultMap> </resultMap>
<resultMap id="ipCommMap" type="com.nis.domain.basics.IpCommCfg" extends="ipPortMap">
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
</resultMap>
<resultMap id="stringCfgMap" type="com.nis.domain.configuration.BaseStringCfg" > <resultMap id="stringCfgMap" type="com.nis.domain.configuration.BaseStringCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" /> <id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" /> <result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
@@ -446,6 +451,18 @@
<result column="app_code" property="appCode" jdbcType="INTEGER" /> <result column="app_code" property="appCode" jdbcType="INTEGER" />
<result column="behav_code" property="behavCode" jdbcType="INTEGER" /> <result column="behav_code" property="behavCode" jdbcType="INTEGER" />
</resultMap> </resultMap>
<resultMap id="urlCommMap" type="com.nis.domain.basics.UrlCommCfg" extends="stringCfgMap">
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
</resultMap>
<resultMap id="scriberIdCommMap" type="com.nis.domain.basics.ScriberIdCommCfg" extends="stringCfgMap">
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
</resultMap>
<resultMap id="domainCommMap" type="com.nis.domain.basics.DomainCommCfg" extends="stringCfgMap">
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
</resultMap>
<resultMap id="complexCfgMap" type="com.nis.domain.configuration.ComplexkeywordCfg" > <resultMap id="complexCfgMap" type="com.nis.domain.configuration.ComplexkeywordCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" /> <id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" /> <result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
@@ -704,7 +721,7 @@
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" /> <id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" /> <result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" /> <result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" /> <result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" /> <result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" /> <result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" /> <result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
@@ -787,6 +804,10 @@
a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port, a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port,
a.protocol,a.protocol_id,a.direction,a.dest_port,a.dest_ip_address,a.cfg_type,a.compile_id a.protocol,a.protocol_id,a.direction,a.dest_port,a.dest_ip_address,a.cfg_type,a.compile_id
</sql> </sql>
<sql id="IpCommCfg_Column" >
a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port,
a.protocol,a.protocol_id,a.direction,a.dest_port,a.dest_ip_address,a.cfg_type,a.compile_id,a.region_id,a.group_id
</sql>
<sql id="IpCfg_AllColumn" > <sql id="IpCfg_AllColumn" >
a.cfg_id,a.cfg_desc,a.action,a.is_valid,a.is_audit,a.creator_id,a.audit_time, a.cfg_id,a.cfg_desc,a.action,a.is_valid,a.is_audit,a.creator_id,a.audit_time,
a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable, a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable,
@@ -812,6 +833,10 @@
a.cfg_keywords,a.cfg_type, a.cfg_keywords,a.cfg_type,
a.expr_type,a.match_method,a.is_hexbin,a.compile_id a.expr_type,a.match_method,a.is_hexbin,a.compile_id
</sql> </sql>
<sql id="CommStrCfg_Column" >
a.cfg_keywords,a.cfg_type,
a.expr_type,a.match_method,a.is_hexbin,a.compile_id,a.region_id,a.group_id
</sql>
<sql id="ComplexCfg_Column" > <sql id="ComplexCfg_Column" >
a.cfg_keywords,a.district,a.cfg_type, a.cfg_keywords,a.district,a.cfg_type,
a.expr_type,a.match_method,a.is_hexbin,a.compile_id a.expr_type,a.match_method,a.is_hexbin,a.compile_id
@@ -1025,7 +1050,7 @@
SELECT SELECT
<include refid="BaseCfg_Column" /> <include refid="BaseCfg_Column" />
<trim prefix="," prefixOverrides=","> <trim prefix="," prefixOverrides=",">
, s.name as creator_name,u.name as auditor_name ,a.common_group_ids, s.name as creator_name,u.name as auditor_name
<if test="serviceId !=null and serviceId == 18"> <if test="serviceId !=null and serviceId == 18">
,dns.cfg_desc as dns_strategy_name ,dns.cfg_desc as dns_strategy_name
</if> </if>
@@ -1096,16 +1121,16 @@
ORDER BY a.CFG_ID ORDER BY a.CFG_ID
</select> </select>
<select id="getIpPortList" resultMap="ipPortMap" parameterType="com.nis.domain.configuration.CfgIndexInfo"> <select id="getIpPortList" resultMap="ipPortMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT SELECT
<include refid="IpCfg_Column" /> <include refid="IpCfg_Column" />
FROM ${tableName} a FROM ${tableName} a
<where> <where>
and a.compile_id in and a.compile_id in
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")"> <foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
#{compileId} #{compileId}
</foreach> </foreach>
</where> </where>
</select> </select>
<select id="getIpDropList" resultMap="ipPortMap" parameterType="com.nis.domain.configuration.CfgIndexInfo"> <select id="getIpDropList" resultMap="ipPortMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT SELECT
<include refid="IpDropCfg_Column" /> <include refid="IpDropCfg_Column" />
@@ -1926,4 +1951,48 @@
</if> </if>
</trim> </trim>
</select> --> </select> -->
<select id="getIpCommCfgPortList" resultMap="ipCommMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="IpCommCfg_Column" />
FROM ip_comm_cfg a
<where>
and a.group_id in
<foreach collection="groupIds" index="index" item="groupId" open="(" separator="," close=")">
#{groupId}
</foreach>
</where>
</select>
<select id="getUrlCommCfgPortList" resultMap="urlCommMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="CommStrCfg_Column" />
FROM url_comm_cfg a
<where>
and a.group_id in
<foreach collection="groupIds" index="index" item="groupId" open="(" separator="," close=")">
#{groupId}
</foreach>
</where>
</select>
<select id="getSubscribeIdCommCfgPortList" resultMap="scriberIdCommMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="CommStrCfg_Column" />
FROM scriberid_comm_cfg a
<where>
and a.group_id in
<foreach collection="groupIds" index="index" item="groupId" open="(" separator="," close=")">
#{groupId}
</foreach>
</where>
</select>
<select id="getDomainCommCfgPortList" resultMap="domainCommMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="CommStrCfg_Column" />
FROM domain_comm_cfg a
<where>
and a.group_id in
<foreach collection="groupIds" index="index" item="groupId" open="(" separator="," close=")">
#{groupId}
</foreach>
</where>
</select>
</mapper> </mapper>

View File

@@ -0,0 +1,23 @@
package com.nis.web.dao.configuration;
import com.nis.domain.basics.DomainCommCfg;
import com.nis.domain.basics.IpCommCfg;
import com.nis.domain.basics.ScriberIdCommCfg;
import com.nis.domain.basics.UrlCommCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@MyBatisDao
public interface ObjectGroupDao extends CrudDao<CfgIndexInfo> {
public CfgIndexInfo getObjectGroupConfig(@Param("cfgId")Long cfgId,@Param("compileId")Integer compileId);
List<UrlCommCfg> getUrlCommonList(@Param("groupIds")String groupIds, @Param("compileId")Long compileId);
List<ScriberIdCommCfg> getScriberIdCommonList(@Param("groupIds")String groupIds, @Param("compileId")Long compileId);
List<DomainCommCfg> getDomainCommonList(@Param("groupIds")String groupIds, @Param("compileId")Long compileId);
List<IpCommCfg> getIpCommonList(@Param("groupIds")String groupIds, @Param("compileId")Long compileId);
}

View File

@@ -0,0 +1,326 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.configuration.ObjectGroupDao" >
<resultMap id="CfgIndexInfoMap" type="com.nis.domain.configuration.CfgIndexInfo" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="dns_strategy_id" property="dnsStrategyId" jdbcType="INTEGER" />
<result column="dns_strategy_name" property="dnsStrategyName" jdbcType="VARCHAR" />
<result column="do_log" property="doLog" jdbcType="INTEGER" />
<result column="do_blacklist" property="doBlackList" jdbcType="INTEGER" />
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="IpCommGroupCfgMap" type="com.nis.domain.basics.IpCommCfg">
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
<result column="port_pattern" property="portPattern" jdbcType="INTEGER" />
<result column="src_port" property="srcPort" jdbcType="VARCHAR" />
<result column="dest_port" property="destPort" jdbcType="VARCHAR" />
<result column="direction" property="direction" jdbcType="INTEGER" />
<result column="protocol" property="protocol" jdbcType="INTEGER" />
<result column="protocol_id" property="protocolId" jdbcType="INTEGER" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="urlCommGroupCfgMap" type="com.nis.domain.basics.UrlCommCfg">
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="expr_type" property="exprType" jdbcType="INTEGER" />
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="domainCommGroupCfgMap" type="com.nis.domain.basics.DomainCommCfg">
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="expr_type" property="exprType" jdbcType="INTEGER" />
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="scribeIdCommGroupCfgMap" type="com.nis.domain.basics.ScriberIdCommCfg">
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="expr_type" property="exprType" jdbcType="INTEGER" />
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
</resultMap>
<sql id="ConfigIndex_Column" >
a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT,
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.dns_strategy_id,a.user_region1,
a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log,a.do_blacklist,a.common_group_ids
</sql>
<sql id="Cfg_Column_List" >
CFG_DESC,CFG_REGION_CODE,CFG_TYPE,ACTION,
IS_VALID,IS_AUDIT,CREATOR_ID,
CREATE_TIME,EDITOR_ID,EDIT_TIME,
AUDITOR_ID,AUDIT_TIME,SERVICE_ID,
REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,
CLASSIFY,ATTRIBUTE,LABLE,
AREA_EFFECTIVE_IDS,FUNCTION_ID,RATELIMIT,
DNS_STRATEGY_ID,IR_TYPE,USER_REGION1,USER_REGION2,USER_REGION3,USER_REGION4,USER_REGION5
</sql>
<sql id="Cfg_Value_List" >
#{cfgDesc,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER},#{cfgType,jdbcType=VARCHAR},#{action,jdbcType=INTEGER},
#{isValid,jdbcType=INTEGER},#{isAudit,jdbcType=INTEGER},#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},#{editorId,jdbcType=INTEGER},#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},#{auditTime,jdbcType=TIMESTAMP},#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},#{compileId,jdbcType=INTEGER},#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},#{attribute,jdbcType=VARCHAR},#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR}, #{functionId,jdbcType=INTEGER}, #{ratelimit,jdbcType=VARCHAR},
#{dnsStrategyId,jdbcType=INTEGER},#{irType,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
</sql>
<sql id="IpCfg_Column">
r.cfg_id,r.cfg_desc,r.cfg_type,r.cfg_region_code,r.ip_type,r.src_ip_pattern,r.src_ip_address,r.dest_ip_pattern,r.dest_ip_address,
r.src_port_pattern,r.src_port,r.dest_port_pattern,r.dest_port
,r.protocol,r.protocol_id,r.direction,r.action
,r.is_valid,r.is_audit,r.creator_id,r.create_time,r.editor_id
,r.edit_time,r.auditor_id,r.audit_time,r.service_id,r.request_id,
r.is_area_effective,r.classify,r.attribute,r.lable
,r.area_effective_ids,r.function_id,r.user_region1
,r.user_region2,r.user_region3,r.user_region4,r.user_region5,r.compile_id,r.region_id,r.group_id
</sql>
<sql id="StringCfg_Column">
r.cfg_id,r.cfg_desc,r.cfg_keywords,r.action,r.is_valid,r.is_audit,r.creator_id,
r.create_time,r.editor_id,r.edit_time,r.auditor_id,r.audit_time,r.service_id,
r.request_id,r.is_area_effective,r.classify,r.attribute,r.lable,
r.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,
r.ratelimit,r.user_region1,r.user_region2,r.user_region3,r.user_region4,r.user_region5,
r.compile_id,r.region_id,r.group_id
</sql>
<select id="getObjectGroupConfig" resultMap="CfgIndexInfoMap">
SELECT
<include refid="ConfigIndex_Column" />
FROM CFG_INDEX_INFO a
<where>
<if test="cfgId !=null">
CFG_ID = #{cfgId,jdbcType=BIGINT}
</if>
<if test="compileId != null">
AND COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
</where>
</select>
<insert id="insert" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cfg_index_info (
<include refid="Cfg_Column_List" />
)values (
<include refid="Cfg_Value_List" />
)
</insert>
<insert id="insertForBatch" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
insert into ${tableName} (
<include refid="Cfg_Column_List" />
)values (
<include refid="Cfg_Column_List" />
)
</insert>
<select id="getIpCommonList" resultMap="IpCommGroupCfgMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="IpCfg_Column" />
FROM ip_comm_cfg r
<where>
<if test="compileId != null">
AND r.compile_id =#{compileId}
</if>
<if test="groupIds != null and groupIds !=''">
AND r.group_id in (${groupIds})
</if>
</where>
</select>
<select id="getUrlCommonList" resultMap="urlCommGroupCfgMap" >
SELECT
<include refid="StringCfg_Column" />
FROM url_comm_cfg r
<where>
<if test="compileId != null">
AND r.compile_id =#{compileId}
</if>
<if test="groupIds != null and groupIds !=''">
AND r.group_id in (${groupIds})
</if>
</where>
</select><select id="getScriberIdCommonList" resultMap="scribeIdCommGroupCfgMap" >
SELECT
<include refid="StringCfg_Column" />
FROM scriberid_comm_cfg r
<where>
<if test="compileId != null">
AND r.compile_id =#{compileId}
</if>
<if test="groupIds != null and groupIds !=''">
AND r.group_id in (${groupIds})
</if>
</where>
</select><select id="getDomainCommonList" resultMap="domainCommGroupCfgMap" >
SELECT
<include refid="StringCfg_Column" />
FROM domain_comm_cfg r
<where>
<if test="compileId != null">
AND r.compile_id =#{compileId}
</if>
<if test="groupIds != null and groupIds !=''">
AND r.group_id in (${groupIds})
</if>
</where>
</select>
<!--<select id="getComplexStringList" resultMap="complexCfgMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="ComplexCfg_Column" />
FROM complex_keyword_cfg a
<where>
<if test="compileId != null">
AND a.compile_id =#{compileId}
</if>
<if test="functionId != null">
AND a.function_id =#{functionId}
</if>
<if test="cfgType != null and cfgType !='' ">
AND a.cfg_type =#{cfgType}
</if>
</where>
</select>-->
</mapper>

View File

@@ -0,0 +1,29 @@
package com.nis.web.dao.configuration;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.callback.ProxyFileHijackCfg;
import com.nis.domain.callback.ProxyFileInsertScriptCfg;
import com.nis.domain.configuration.PxyObjKeyring;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
/**
* 劫持文件处理
* @author lenovo
*
*/
@MyBatisDao
public interface ProxyFileHijackDao extends CrudDao<ProxyFileHijackCfg>{
public List<ProxyFileHijackCfg> findPage(ProxyFileHijackCfg entity) ;
public ProxyFileHijackCfg getCfgById(@Param("cfgId")Long cfgId);
public int insert(ProxyFileHijackCfg entity);
public int update(ProxyFileHijackCfg entity);
List<ProxyFileHijackCfg> findByList(@Param("ids")String ids);
public List<ProxyFileHijackCfg> findHijackFiles(ProxyFileHijackCfg hijackSearch);
}

View File

@@ -0,0 +1,346 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.configuration.ProxyFileHijackDao" >
<resultMap id="ProxyFileHijackCfg" type="com.nis.domain.callback.ProxyFileHijackCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="level" property="level" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="creator_name" property="creatorName" jdbcType="VARCHAR" />
<result column="auditor_name" property="auditorName" jdbcType="VARCHAR" />
<result column="editor_name" property="editorName" jdbcType="VARCHAR" />
<result column="content_type" property="contentType" jdbcType="VARCHAR" />
<result column="content_name" property="contentName" jdbcType="VARCHAR" />
<result column="path" property="path" jdbcType="VARCHAR" />
<result column="cancel_request_id" property="cancelRequestId" jdbcType="INTEGER" />
</resultMap>
<sql id="ProxyFileHijackCfgColumn" >
a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT,
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.cfg_type,a.cfg_region_code,
a.CONTENT_TYPE,a.CONTENT_NAME,a.PATH,a.CANCEL_REQUEST_ID
</sql>
<!-- voip条件查询列表信息 -->
<select id="findPage" resultMap="ProxyFileHijackCfg" parameterType="com.nis.domain.callback.ProxyFileHijackCfg" >
SELECT
<include refid="ProxyFileHijackCfgColumn" />
<trim prefix="," prefixOverrides=",">
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
FROM PXY_PROFILE_HIJACK_FILES a
left join sys_user s on a.creator_id=s.id
left join sys_user e on a.editor_id=e.id
left join sys_user u on a.auditor_id=u.id
left join request_info ri on a.request_id=ri.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND a.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND a.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND a.ACTION=#{action,jdbcType=INTEGER}
</if>
<choose>
<!-- 判断是否批量操作 -->
<when test="batchValidValue != null and batchValidValue != ''">
AND a.IS_VALID in (${batchValidValue})
</when>
<otherwise>
<if test="isValid != null">
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND a.IS_VALID != -1
</if>
</otherwise>
</choose>
<choose>
<!-- 判断是否批量操作 -->
<when test="batchAuditValue != null and batchAuditValue != ''">
AND a.IS_AUDIT in(${batchAuditValue})
</when>
<otherwise>
<if test="isAudit != null">
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
</otherwise>
</choose>
<if test="creatorName != null and creatorName != ''">
AND a.CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editorName != null and editorName != ''">
AND a.EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditorName != null and auditorName != ''">
AND a.AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="serviceId != null">
AND a.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND a.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="compileId != null">
AND a.COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
<if test="compileIdNew != null and compileIdNew != '' and compileIdNew.indexOf('-') != -1">
<foreach collection="compileIdNew.split('-')" index="index" item="item" >
<if test="index == 0">
AND a.COMPILE_ID &gt;= #{item,jdbcType=INTEGER}
</if>
<if test="index == 1">
AND a.COMPILE_ID &lt;= #{item,jdbcType=INTEGER}
</if>
</foreach>
</if>
<if test="compileIdNew !=null and compileIdNew != '' and compileIdNew.indexOf(',') != -1">
AND a.COMPILE_ID in
<foreach collection="compileIdNew.split(',')" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="compileIdNew !=null and compileIdNew != '' and compileIdNew.indexOf(',') == -1 and compileIdNew.indexOf('-') == -1">
AND a.COMPILE_ID=#{compileIdNew,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND a.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify != ''">
AND a.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute != ''">
AND a.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable != ''">
AND a.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
AND a.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND a.function_id=#{functionId,jdbcType=INTEGER}
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy},a.is_audit,a.CFG_ID desc
</when>
<otherwise>
ORDER BY a.is_audit,a.CFG_ID desc
</otherwise>
</choose>
</select>
<select id="getCfgById" resultMap="ProxyFileHijackCfg">
SELECT
<include refid="ProxyFileHijackCfgColumn" />
FROM PXY_PROFILE_HIJACK_FILES a
<where>
<if test="cfgId != null">
and a.CFG_ID=#{cfgId,jdbcType=INTEGER}
</if>
</where>
</select>
<insert id="insert" parameterType="com.nis.domain.callback.ProxyFileHijackCfg">
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into PXY_PROFILE_HIJACK_FILES (
CFG_DESC,
ACTION,
IS_VALID,
IS_AUDIT,
CREATOR_ID,
CREATE_TIME,
EDITOR_ID,
EDIT_TIME,
AUDITOR_ID,
AUDIT_TIME,
SERVICE_ID,
REQUEST_ID,
COMPILE_ID,
IS_AREA_EFFECTIVE,
CLASSIFY,
ATTRIBUTE,
LABLE,
AREA_EFFECTIVE_IDS,
function_id,
cfg_type,
cfg_region_code,
path,
content_type,
content_name
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
#{isValid,jdbcType=INTEGER},
#{isAudit,jdbcType=INTEGER},
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{cfgType,jdbcType=VARCHAR},
#{cfgRegionCode,jdbcType=INTEGER},
#{path,jdbcType=VARCHAR},
#{contentType,jdbcType=VARCHAR},
#{contentName,jdbcType=VARCHAR}
)
</insert>
<update id="update" parameterType="com.nis.domain.callback.ProxyFileHijackCfg" >
update PXY_PROFILE_HIJACK_FILES
<set>
<if test="cfgDesc != null and cfgDesc != ''" >
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="action != null" >
action = #{action,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="creatorId != null" >
creator_id = #{creatorId,jdbcType=INTEGER},
</if>
<if test="createTime != null and createTime != ''" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
edit_time = #{editTime,jdbcType=TIMESTAMP},
<if test="auditorId != null" >
auditor_id = #{auditorId,jdbcType=INTEGER},
</if>
<if test="auditTime != null and auditTime != ''" >
audit_time = #{auditTime,jdbcType=TIMESTAMP},
</if>
<if test="serviceId != null" >
service_id = #{serviceId,jdbcType=INTEGER},
</if>
<if test="requestId != null" >
request_id = #{requestId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
classify = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
attribute = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
lable = #{lable,jdbcType=VARCHAR},
</if>
<if test="areaEffectiveIds != null" >
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="cfgRegionCode != null" >
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
</if>
<if test="cfgType != null" >
cfg_type = #{cfgType,jdbcType=VARCHAR},
</if>
<if test="path != null" >
path = #{path,jdbcType=VARCHAR},
</if>
<if test="contentType != null" >
content_type = #{contentType,jdbcType=VARCHAR},
</if>
<if test="contentName != null" >
content_name = #{contentName,jdbcType=VARCHAR},
</if>
</set>
where cfg_id = #{cfgId,jdbcType=BIGINT}
</update>
<!-- 查出所有 有效数据-->
<select id="findByList" resultMap="ProxyFileHijackCfg">
SELECT
<include refid="ProxyFileHijackCfgColumn"/>
<trim prefix="," prefixOverrides=",">
,s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
FROM PXY_PROFILE_HIJACK_FILES a
left join sys_user s on a.creator_id=s.id
left join sys_user e on a.editor_id=e.id
left join sys_user u on a.auditor_id=u.id
left join request_info ri on a.request_id=ri.id
where a.CFG_ID in (${ids})
</select>
<select id="findHijackFiles" parameterType="com.nis.domain.callback.ProxyFileHijackCfg" resultMap="ProxyFileHijackCfg">
SELECT
<include refid="ProxyFileHijackCfgColumn" />
FROM
pxy_profile_hijack_files a
<where>
<if test="isValid != null">
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND a.IS_VALID != -1
</if>
<if test="isAudit != null">
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,32 @@
package com.nis.web.dao.configuration;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.callback.ProxyFileHijackCfg;
import com.nis.domain.callback.ProxyFileInsertScriptCfg;
import com.nis.domain.configuration.PxyObjKeyring;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
/**
* 注入脚本文件
* @author lenovo
*
*/
@MyBatisDao
public interface ProxyFileInsertScriptDao extends CrudDao<ProxyFileInsertScriptCfg> {
public List<ProxyFileInsertScriptCfg> findPage(ProxyFileInsertScriptCfg entity);
public ProxyFileInsertScriptCfg getCfgById(@Param("cfgId")Long cfgId);
public int insert(ProxyFileInsertScriptCfg entity);
public int update(ProxyFileInsertScriptCfg entity);
List<ProxyFileInsertScriptCfg> findByList(@Param("ids")String ids);
public List<ProxyFileInsertScriptCfg> findInsertFiles(ProxyFileInsertScriptCfg insertSearch);
}

View File

@@ -0,0 +1,340 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.configuration.ProxyFileInsertScriptDao" >
<resultMap id="ProxyFileInsertScriptCfg" type="com.nis.domain.callback.ProxyFileInsertScriptCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="format" property="format" jdbcType="VARCHAR" />
<result column="path" property="path" jdbcType="VARCHAR" />
<result column="cancel_request_id" property="cancelRequestId" jdbcType="INTEGER" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="level" property="level" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="creator_name" property="creatorName" jdbcType="VARCHAR" />
<result column="auditor_name" property="auditorName" jdbcType="VARCHAR" />
<result column="editor_name" property="editorName" jdbcType="VARCHAR" />
</resultMap>
<sql id="ProxyFileInsertScriptCfgColumn" >
a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT,
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.cfg_type,a.cfg_region_code,
a.FORMAT,a.PATH,a.cancel_request_id
</sql>
<!-- voip条件查询列表信息 -->
<select id="findPage" resultMap="ProxyFileInsertScriptCfg" parameterType="com.nis.domain.callback.ProxyFileInsertScriptCfg" >
SELECT
<include refid="ProxyFileInsertScriptCfgColumn" />
<trim prefix="," prefixOverrides=",">
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
FROM PXY_PROFILE_INSERT_SCRIPTS a
left join sys_user s on a.creator_id=s.id
left join sys_user e on a.editor_id=e.id
left join sys_user u on a.auditor_id=u.id
left join request_info ri on a.request_id=ri.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND a.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND a.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND a.ACTION=#{action,jdbcType=INTEGER}
</if>
<choose>
<!-- 判断是否批量操作 -->
<when test="batchValidValue != null and batchValidValue != ''">
AND a.IS_VALID in (${batchValidValue})
</when>
<otherwise>
<if test="isValid != null">
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND a.IS_VALID != -1
</if>
</otherwise>
</choose>
<choose>
<!-- 判断是否批量操作 -->
<when test="batchAuditValue != null and batchAuditValue != ''">
AND a.IS_AUDIT in(${batchAuditValue})
</when>
<otherwise>
<if test="isAudit != null">
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
</otherwise>
</choose>
<if test="creatorName != null and creatorName != ''">
AND a.CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editorName != null and editorName != ''">
AND a.EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditorName != null and auditorName != ''">
AND a.AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="serviceId != null">
AND a.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND a.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="compileId != null">
AND a.COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
<if test="compileIdNew != null and compileIdNew != '' and compileIdNew.indexOf('-') != -1">
<foreach collection="compileIdNew.split('-')" index="index" item="item" >
<if test="index == 0">
AND a.COMPILE_ID &gt;= #{item,jdbcType=INTEGER}
</if>
<if test="index == 1">
AND a.COMPILE_ID &lt;= #{item,jdbcType=INTEGER}
</if>
</foreach>
</if>
<if test="compileIdNew !=null and compileIdNew != '' and compileIdNew.indexOf(',') != -1">
AND a.COMPILE_ID in
<foreach collection="compileIdNew.split(',')" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="compileIdNew !=null and compileIdNew != '' and compileIdNew.indexOf(',') == -1 and compileIdNew.indexOf('-') == -1">
AND a.COMPILE_ID=#{compileIdNew,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND a.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify != ''">
AND a.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute != ''">
AND a.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable != ''">
AND a.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
AND a.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND a.function_id=#{functionId,jdbcType=INTEGER}
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy},a.is_audit,a.CFG_ID desc
</when>
<otherwise>
ORDER BY a.is_audit,a.CFG_ID desc
</otherwise>
</choose>
</select>
<select id="getCfgById" resultMap="ProxyFileInsertScriptCfg">
SELECT
<include refid="ProxyFileInsertScriptCfgColumn" />
FROM PXY_PROFILE_INSERT_SCRIPTS a
<where>
<if test="cfgId != null">
and a.CFG_ID=#{cfgId,jdbcType=INTEGER}
</if>
</where>
</select>
<insert id="insert" parameterType="com.nis.domain.callback.ProxyFileInsertScriptCfg">
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into PXY_PROFILE_INSERT_SCRIPTS (
CFG_DESC,
ACTION,
IS_VALID,
IS_AUDIT,
CREATOR_ID,
CREATE_TIME,
EDITOR_ID,
EDIT_TIME,
AUDITOR_ID,
AUDIT_TIME,
SERVICE_ID,
REQUEST_ID,
COMPILE_ID,
IS_AREA_EFFECTIVE,
CLASSIFY,
ATTRIBUTE,
LABLE,
AREA_EFFECTIVE_IDS,
function_id,
cfg_type,
cfg_region_code,
path,
format
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
0,
0,
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{cfgType,jdbcType=VARCHAR},
#{cfgRegionCode,jdbcType=INTEGER},
#{path,jdbcType=VARCHAR},
#{format,jdbcType=VARCHAR}
)
</insert>
<update id="update" parameterType="com.nis.domain.callback.ProxyFileInsertScriptCfg" >
update PXY_PROFILE_INSERT_SCRIPTS
<set>
<if test="cfgDesc != null and cfgDesc != ''" >
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="action != null" >
action = #{action,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="creatorId != null" >
creator_id = #{creatorId,jdbcType=INTEGER},
</if>
<if test="createTime != null and createTime != ''" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
edit_time = #{editTime,jdbcType=TIMESTAMP},
<if test="auditorId != null" >
auditor_id = #{auditorId,jdbcType=INTEGER},
</if>
<if test="auditTime != null and auditTime != ''" >
audit_time = #{auditTime,jdbcType=TIMESTAMP},
</if>
<if test="serviceId != null" >
service_id = #{serviceId,jdbcType=INTEGER},
</if>
<if test="requestId != null" >
request_id = #{requestId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
classify = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
attribute = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
lable = #{lable,jdbcType=VARCHAR},
</if>
<if test="areaEffectiveIds != null" >
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="cfgRegionCode != null" >
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
</if>
<if test="cfgType != null" >
cfg_type = #{cfgType,jdbcType=VARCHAR},
</if>
<if test="path != null" >
path = #{path ,jdbcType=VARCHAR},
</if>
<if test="format != null" >
format = #{format ,jdbcType=VARCHAR},
</if>
</set>
where cfg_id = #{cfgId,jdbcType=BIGINT}
</update>
<!-- 查出所有 有效数据-->
<select id="findByList" resultMap="ProxyFileInsertScriptCfg">
SELECT
<include refid="ProxyFileInsertScriptCfgColumn"/>
<trim prefix="," prefixOverrides=",">
,s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
FROM PXY_PROFILE_INSERT_SCRIPTS a
left join sys_user s on a.creator_id=s.id
left join sys_user e on a.editor_id=e.id
left join sys_user u on a.auditor_id=u.id
left join request_info ri on a.request_id=ri.id
where a.CFG_ID in (${ids})
</select>
<select id="findInsertFiles" parameterType="com.nis.domain.callback.ProxyFileInsertScriptCfg" resultMap="ProxyFileInsertScriptCfg">
SELECT
<include refid="ProxyFileInsertScriptCfgColumn" />
FROM
pxy_profile_insert_scripts a
<where>
<if test="isValid != null">
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND a.IS_VALID != -1
</if>
<if test="isAudit != null">
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,25 @@
package com.nis.web.dao.configuration;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.callback.ProxyFileResponsePageCfg;
import com.nis.web.dao.MyBatisDao;
/**
* 特定协议相关配置数据处理类
* @author dell
*
*/
@MyBatisDao
public interface ProxyFileResponsePageDao {
public List<ProxyFileResponsePageCfg> findPage(ProxyFileResponsePageCfg entity) ;
public ProxyFileResponsePageCfg getCfgById(@Param("cfgId")Long cfgId);
public void insert(ProxyFileResponsePageCfg entity);
public void update(ProxyFileResponsePageCfg entity);
List<ProxyFileResponsePageCfg> findByList(@Param("ids")String ids);
}

View File

@@ -0,0 +1,346 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.configuration.ProxyFileResponsePageDao" >
<resultMap id="ProxyFileResponsePageCfg" type="com.nis.domain.callback.ProxyFileResponsePageCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="file_desc" property="fileDesc" jdbcType="VARCHAR" />
<result column="url" property="url" jdbcType="VARCHAR" />
<result column="content_type" property="contentType" jdbcType="VARCHAR" />
<result column="content_length" property="contentLength" jdbcType="VARCHAR" />
<result column="md5" property="md5" jdbcType="VARCHAR" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="level" property="level" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="creator_name" property="creatorName" jdbcType="VARCHAR" />
<result column="auditor_name" property="auditorName" jdbcType="VARCHAR" />
<result column="editor_name" property="editorName" jdbcType="VARCHAR" />
</resultMap>
<sql id="ProxyFileResponsePageCfgColumn" >
a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT,
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.cfg_type,a.cfg_region_code,
a.FILE_DESC,a.URL,a.CONTENT_TYPE,a.CONTENT_LENGTH,a.MD5
</sql>
<!-- voip条件查询列表信息 -->
<select id="findPage" resultMap="ProxyFileResponsePageCfg" parameterType="com.nis.domain.callback.ProxyFileResponsePageCfg" >
SELECT
<include refid="ProxyFileResponsePageCfgColumn" />
<trim prefix="," prefixOverrides=",">
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
FROM pxy_profile_response_pages a
left join sys_user s on a.creator_id=s.id
left join sys_user e on a.editor_id=e.id
left join sys_user u on a.auditor_id=u.id
left join request_info ri on a.request_id=ri.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND a.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND a.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND a.ACTION=#{action,jdbcType=INTEGER}
</if>
<choose>
<!-- 判断是否批量操作 -->
<when test="batchValidValue != null and batchValidValue != ''">
AND a.IS_VALID in (${batchValidValue})
</when>
<otherwise>
<if test="isValid != null">
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND a.IS_VALID != -1
</if>
</otherwise>
</choose>
<choose>
<!-- 判断是否批量操作 -->
<when test="batchAuditValue != null and batchAuditValue != ''">
AND a.IS_AUDIT in(${batchAuditValue})
</when>
<otherwise>
<if test="isAudit != null">
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
</otherwise>
</choose>
<if test="creatorName != null and creatorName != ''">
AND a.CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editorName != null and editorName != ''">
AND a.EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditorName != null and auditorName != ''">
AND a.AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="serviceId != null">
AND a.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND a.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="compileId != null">
AND a.COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
<if test="compileIdNew != null and compileIdNew != '' and compileIdNew.indexOf('-') != -1">
<foreach collection="compileIdNew.split('-')" index="index" item="item" >
<if test="index == 0">
AND a.COMPILE_ID &gt;= #{item,jdbcType=INTEGER}
</if>
<if test="index == 1">
AND a.COMPILE_ID &lt;= #{item,jdbcType=INTEGER}
</if>
</foreach>
</if>
<if test="compileIdNew !=null and compileIdNew != '' and compileIdNew.indexOf(',') != -1">
AND a.COMPILE_ID in
<foreach collection="compileIdNew.split(',')" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="compileIdNew !=null and compileIdNew != '' and compileIdNew.indexOf(',') == -1 and compileIdNew.indexOf('-') == -1">
AND a.COMPILE_ID=#{compileIdNew,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND a.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify != ''">
AND a.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute != ''">
AND a.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable != ''">
AND a.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
AND a.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND a.function_id=#{functionId,jdbcType=INTEGER}
</if>
<if test="fileDesc != null and fileDesc != ''">
AND a.file_desc like concat(concat('%',#{fileDesc,jdbcType=VARCHAR}),'%')
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy},a.is_audit,a.CFG_ID desc
</when>
<otherwise>
ORDER BY a.is_audit,a.CFG_ID desc
</otherwise>
</choose>
</select>
<!-- 根据Id获取ProxyFileResponsePageCfg信息 -->
<select id="getCfgById" resultMap="ProxyFileResponsePageCfg">
SELECT
<include refid="ProxyFileResponsePageCfgColumn" />
FROM pxy_profile_response_pages a
<where>
<if test="cfgId != null">
and a.CFG_ID=#{cfgId,jdbcType=INTEGER}
</if>
</where>
</select>
<insert id="insert" parameterType="com.nis.domain.callback.ProxyFileResponsePageCfg" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into pxy_profile_response_pages (
CFG_DESC,
ACTION,
IS_VALID,
IS_AUDIT,
CREATOR_ID,
CREATE_TIME,
EDITOR_ID,
EDIT_TIME,
AUDITOR_ID,
AUDIT_TIME,
SERVICE_ID,
REQUEST_ID,
COMPILE_ID,
IS_AREA_EFFECTIVE,
CLASSIFY,
ATTRIBUTE,
LABLE,
AREA_EFFECTIVE_IDS,
function_id,
cfg_type,
cfg_region_code,
file_desc,
url,
content_type,
content_length,
md5
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
#{isValid,jdbcType=INTEGER},
#{isAudit,jdbcType=INTEGER},
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{cfgType,jdbcType=VARCHAR},
#{cfgRegionCode,jdbcType=INTEGER},
#{fileDesc,jdbcType=VARCHAR},
#{url,jdbcType=VARCHAR},
#{contentType,jdbcType=VARCHAR},
#{contentLength,jdbcType=INTEGER},
#{md5,jdbcType=VARCHAR}
)
</insert>
<update id="update" parameterType="com.nis.domain.callback.ProxyFileResponsePageCfg" >
update pxy_profile_response_pages
<set>
<if test="cfgDesc != null and cfgDesc != ''" >
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="action != null" >
action = #{action,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="creatorId != null" >
creator_id = #{creatorId,jdbcType=INTEGER},
</if>
<if test="createTime != null and createTime != ''" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
edit_time = #{editTime,jdbcType=TIMESTAMP},
<if test="auditorId != null" >
auditor_id = #{auditorId,jdbcType=INTEGER},
</if>
<if test="auditTime != null and auditTime != ''" >
audit_time = #{auditTime,jdbcType=TIMESTAMP},
</if>
<if test="serviceId != null" >
service_id = #{serviceId,jdbcType=INTEGER},
</if>
<if test="requestId != null" >
request_id = #{requestId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
classify = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
attribute = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
lable = #{lable,jdbcType=VARCHAR},
</if>
<if test="areaEffectiveIds != null" >
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="cfgRegionCode != null" >
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
</if>
<if test="cfgType != null" >
cfg_type = #{cfgType,jdbcType=VARCHAR},
</if>
<if test="fileDesc != null" >
file_desc = #{fileDesc ,jdbcType=VARCHAR},
</if>
<if test="url != null" >
url = #{url ,jdbcType=VARCHAR},
</if>
<if test="contentType != null" >
content_type = #{contentType ,jdbcType=VARCHAR},
</if>
<if test="contentLength != null" >
content_length = #{contentLength ,jdbcType=BIGINT},
</if>
<if test="md5 != null" >
md5 = #{md5 ,jdbcType=VARCHAR},
</if>
</set>
where cfg_id = #{cfgId,jdbcType=BIGINT}
</update>
<!-- 查出所有 有效数据-->
<select id="findByList" resultMap="ProxyFileResponsePageCfg">
SELECT
<include refid="ProxyFileResponsePageCfgColumn"/>
<trim prefix="," prefixOverrides=",">
,s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
FROM pxy_profile_response_pages a
left join sys_user s on a.creator_id=s.id
left join sys_user e on a.editor_id=e.id
left join sys_user u on a.auditor_id=u.id
left join request_info ri on a.request_id=ri.id
where a.CFG_ID in (${ids})
</select>
</mapper>

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