Merge branch 'develop' of https://git.mesalab.cn/K18_NTCS_WEB/NTC.git into develop
This commit is contained in:
@@ -47,6 +47,7 @@ import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.basics.SysDictInfo;
|
||||
import com.nis.domain.configuration.AppComplexFeatureCfg;
|
||||
import com.nis.domain.configuration.AppDomainCfg;
|
||||
import com.nis.domain.configuration.AppFeatureIndex;
|
||||
import com.nis.domain.configuration.AppHttpCfg;
|
||||
@@ -75,6 +76,7 @@ import com.nis.domain.configuration.PxyObjTrustedCaCrl;
|
||||
import com.nis.domain.configuration.RequestInfo;
|
||||
import com.nis.domain.configuration.StringCfgTemplate;
|
||||
import com.nis.domain.configuration.template.AppDomainTemplate;
|
||||
import com.nis.domain.configuration.template.AppPayloadTemplate;
|
||||
import com.nis.domain.configuration.template.AsnIpTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
||||
import com.nis.domain.configuration.template.DdosIpTemplate;
|
||||
@@ -85,6 +87,15 @@ import com.nis.domain.configuration.template.DnsResStrategyTemplate;
|
||||
import com.nis.domain.configuration.template.DomainInterceptMonitTemplate;
|
||||
import com.nis.domain.configuration.template.DomainInterceptRateLimitTemplate;
|
||||
import com.nis.domain.configuration.template.DomainInterceptTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsRedirectComplexTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsRedirectIpTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsRedirectTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsRejectComplexTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsRejectIpTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsRejectTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsReplaceComplexTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsReplaceIpTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsReplaceTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.IpCfgTemplate;
|
||||
import com.nis.domain.configuration.template.IpPayloadTemplate;
|
||||
@@ -118,6 +129,7 @@ import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ExcelCsv;
|
||||
import com.nis.util.excel.ExportExcel;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.util.excel.thread.CheckAppFeatureComplexStringFormatThread;
|
||||
import com.nis.util.excel.thread.CheckComplexStringFormatThread;
|
||||
import com.nis.util.excel.thread.CheckDnsResStrategyFormatThread;
|
||||
import com.nis.util.excel.thread.CheckIpFormatThread;
|
||||
@@ -1084,6 +1096,48 @@ public class BaseController {
|
||||
return queue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 多线程验证
|
||||
* @param _msg
|
||||
* @param serviceDict
|
||||
* @param regionDict
|
||||
* @param list
|
||||
* @return
|
||||
* @throws InterruptedException
|
||||
* @throws ExecutionException
|
||||
* @throws ServiceException
|
||||
*/
|
||||
public BlockingQueue<AppComplexFeatureCfg> checkAppComplexFeatureStringCfgMulity(StringBuffer _msg,FunctionServiceDict serviceDict, FunctionRegionDict regionDict,BlockingQueue<? extends Object> list) throws InterruptedException, ExecutionException, ServiceException{
|
||||
logger.warn("start checkAppComplexFeatureStringCfgMulity ,size "+list.size());
|
||||
long start=System.currentTimeMillis();
|
||||
BlockingQueue<AppComplexFeatureCfg> queue=new ArrayBlockingQueue<>(list.size());
|
||||
ExecutorService service=Executors.newFixedThreadPool(Constants.MULITY_THREAD_SIZE);
|
||||
List<Future<String>> futures=new ArrayList<>();
|
||||
for(int i=0;i<Constants.MULITY_THREAD_SIZE;i++) {
|
||||
CheckAppFeatureComplexStringFormatThread t = new CheckAppFeatureComplexStringFormatThread(serviceDict,regionDict, this.getMsgProp(), list, queue);
|
||||
futures.add(service.submit(t));
|
||||
}
|
||||
service.shutdown();
|
||||
while(!service.isTerminated()) {
|
||||
try {
|
||||
Thread.sleep(10);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
for(Future<String> future:futures) {
|
||||
String msg = future.get();
|
||||
if(StringUtils.isNotBlank(msg)) {
|
||||
_msg.append(msg);
|
||||
//throw new ServiceException(msg);
|
||||
}
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("checkAppComplexFeatureStringCfgMulity finish,cost:"+(end-start)+",size:"+queue.size());
|
||||
return queue;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* setReportSearchTime(报表查询设置开始时间与结束时间) (这里描述这个方法适用条件 – 可选)
|
||||
@@ -1220,14 +1274,17 @@ public class BaseController {
|
||||
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
|
||||
BlockingQueue<ComplexkeywordCfg> complexkeywordCfgs =null;
|
||||
BlockingQueue<DnsResStrategy> dnsResStrategies=null;
|
||||
BlockingQueue<AppComplexFeatureCfg> appComplexFeatureCfgs=null;
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
List<AppPolicyCfg> appPolicyCfgs = new ArrayList<AppPolicyCfg>();
|
||||
List<AppFeatureIndex> appFeatureIndexs= new ArrayList<AppFeatureIndex>();
|
||||
List<Map<Long,Integer>> asnNoMaps=Lists.newArrayList();
|
||||
Map<Long,Integer> newAsnNoMap=Maps.newConcurrentMap();
|
||||
Map<Long,Integer> OldAsnNoMap=Maps.newConcurrentMap();
|
||||
asnNoMaps.add(newAsnNoMap);
|
||||
asnNoMaps.add(OldAsnNoMap);
|
||||
FunctionRegionDict appRegion = null;
|
||||
FunctionRegionDict appFeatureRegion = null;
|
||||
if(serviceDict!=null) {
|
||||
String regionCode = serviceDict.getRegionCode();
|
||||
for (String code : regionCode.split(",")) {
|
||||
@@ -1239,6 +1296,12 @@ public class BaseController {
|
||||
appRegion = d;
|
||||
break;
|
||||
}
|
||||
|
||||
if (d != null && d.getFunctionId() != null
|
||||
&& (d.getFunctionId().intValue()==565 || d.getFunctionId().intValue()==564 || d.getFunctionId().intValue()==566 || d.getFunctionId().intValue()==563)) {
|
||||
appFeatureRegion = d;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1279,9 +1342,18 @@ public class BaseController {
|
||||
AsnCacheUtils.init(true);
|
||||
BlockingQueue<AsnIpTemplate> list = ei.getDataList(AsnIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, asnNoMaps, list);
|
||||
} else if (regionDict.getFunctionId().equals(301)) {// DDOS IP
|
||||
}else if (regionDict.getFunctionId().equals(301)) {// DDOS IP
|
||||
BlockingQueue<DdosIpTemplate> list = ei.getDataList(DdosIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list);
|
||||
}else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
BlockingQueue<HttpsRejectIpTemplate> list = ei.getDataList(HttpsRejectIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list);
|
||||
}else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
BlockingQueue<HttpsRedirectIpTemplate> list = ei.getDataList(HttpsRedirectIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list);
|
||||
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
BlockingQueue<HttpsReplaceIpTemplate> list = ei.getDataList(HttpsReplaceIpTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list);
|
||||
} else {
|
||||
BlockingQueue<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class );
|
||||
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null, list);
|
||||
@@ -1307,6 +1379,15 @@ public class BaseController {
|
||||
BlockingQueue<DomainInterceptTemplate> list = ei.getDataList(DomainInterceptTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}
|
||||
}else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
BlockingQueue<HttpsRejectTemplate> list = ei.getDataList(HttpsRejectTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
BlockingQueue<HttpsRedirectTemplate> list = ei.getDataList(HttpsRedirectTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
BlockingQueue<HttpsReplaceTemplate> list = ei.getDataList(HttpsReplaceTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
BlockingQueue<StringAllTemplate> list = ei.getDataList(StringAllTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
@@ -1317,6 +1398,18 @@ public class BaseController {
|
||||
BlockingQueue<DnsComplexStringTemplate> list = ei.getDataList(DnsComplexStringTemplate.class
|
||||
);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
} else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
BlockingQueue<HttpsRejectComplexTemplate> list = ei.getDataList(HttpsRejectComplexTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
} else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
BlockingQueue<HttpsRedirectComplexTemplate> list = ei.getDataList(HttpsRedirectComplexTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
} else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
BlockingQueue<HttpsReplaceComplexTemplate> list = ei.getDataList(HttpsReplaceComplexTemplate.class);
|
||||
complexkeywordCfgs = this.checkComplexStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
} else if(regionDict.getFunctionId().equals(563)){// APP Payload
|
||||
BlockingQueue<AppPayloadTemplate> list = ei.getDataList(AppPayloadTemplate.class);
|
||||
appComplexFeatureCfgs = this.checkAppComplexFeatureStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
} else {
|
||||
BlockingQueue<ComplexStringAllTemplate> list = ei.getDataList(ComplexStringAllTemplate.class
|
||||
);
|
||||
@@ -1339,6 +1432,7 @@ public class BaseController {
|
||||
String specServiceId = request.getParameter("appId");
|
||||
String behaviorId = request.getParameter("behaviorId");
|
||||
String asnIpGroup = request.getParameter("asnGroupId");
|
||||
|
||||
String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
|
||||
SpecificServiceCfg specificServiceCfg = null;
|
||||
if (serviceDict!=null&&(serviceDict.getServiceId().intValue() == 33 || serviceDict.getServiceId().intValue() == 145
|
||||
@@ -1349,6 +1443,9 @@ public class BaseController {
|
||||
|| serviceDict.getServiceId().intValue() == 1028// app ip
|
||||
|| serviceDict.getServiceId().intValue() == 1024//app http
|
||||
|| serviceDict.getServiceId().intValue() == 1026//app domain
|
||||
|| serviceDict.getServiceId().intValue() == 1027//app dns
|
||||
|| serviceDict.getServiceId().intValue() == 1029//app ssl
|
||||
|| serviceDict.getServiceId().intValue() == 1025//app PAYLOAD
|
||||
)) {
|
||||
if (StringUtils.isNotBlank(specServiceId)) {
|
||||
specificServiceCfg = specificServiceCfgService
|
||||
@@ -1494,7 +1591,7 @@ public class BaseController {
|
||||
asnIpCfgs.add(_cfg);
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, asnIpCfgs, cfgIndexInfos, appPolicyCfgs,isSend.equals("1"));
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, asnIpCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
_ipPortCfgs.clear();
|
||||
@@ -1507,7 +1604,7 @@ public class BaseController {
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
// List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionGroupIds=Lists.newArrayList();
|
||||
List<Integer> numRegionRegionIds=Lists.newArrayList();
|
||||
if(!regionDict.getFunctionId().equals(405)) {//app ip compileId 从config_group_info中取
|
||||
try {
|
||||
@@ -1517,7 +1614,7 @@ public class BaseController {
|
||||
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
//需要获取数值域的id
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null&&serviceDict.getProtocolId()>0) {
|
||||
// numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionGroupIds = ConfigServiceUtil.getId(2,_ipPortCfgs.size());
|
||||
numRegionRegionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
|
||||
}
|
||||
}
|
||||
@@ -1558,9 +1655,9 @@ public class BaseController {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
if(serviceDict!=null&&serviceDict.getProtocolId()!=null) {
|
||||
// if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
// cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
// }
|
||||
if(numRegionGroupIds!=null&&numRegionGroupIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionGroupId(numRegionGroupIds.get(ind));
|
||||
}
|
||||
if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) {
|
||||
cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind));
|
||||
}
|
||||
@@ -1615,15 +1712,29 @@ public class BaseController {
|
||||
if(regionDict.getFunctionId().intValue()!=600
|
||||
&®ionDict.getFunctionId().intValue()!=301
|
||||
&®ionDict.getFunctionId().intValue()!=401
|
||||
&®ionDict.getFunctionId().intValue()!=405) {
|
||||
&®ionDict.getFunctionId().intValue()!=405
|
||||
&®ionDict.getFunctionId().intValue()!=565
|
||||
&®ionDict.getFunctionId().intValue()!=566
|
||||
&®ionDict.getFunctionId().intValue()!=563) {
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
}
|
||||
if(regionDict.getFunctionId().intValue()==565 || regionDict.getFunctionId().intValue()==566 || regionDict.getFunctionId().intValue()==563){
|
||||
AppFeatureIndex appfeature = new AppFeatureIndex();
|
||||
if(regionDict!=null){
|
||||
appfeature.setCfgRegionCode1(String.valueOf(regionDict.getConfigRegionCode()));
|
||||
appfeature.setCfgRegionValue(regionDict.getConfigRegionValue());
|
||||
appfeature.setCfgRegionType(String.valueOf(regionDict.getRegionType()));
|
||||
}
|
||||
BeanUtils.copyProperties(cfg, appfeature,new String[] {"cfgId"});
|
||||
appFeatureIndexs.add(appfeature);
|
||||
}
|
||||
|
||||
}
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _ipPortCfgs, cfgIndexInfos, appPolicyCfgs,isSend.equals("1"));
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _ipPortCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
_ipPortCfgs.clear();
|
||||
@@ -1748,88 +1859,205 @@ public class BaseController {
|
||||
}
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _stringCfgs, cfgIndexInfos, appPolicyCfgs,isSend.equals("1"));
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _stringCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
_stringCfgs.clear();
|
||||
}
|
||||
} else if (regionDict.getRegionType().equals(3)) {
|
||||
List<ComplexkeywordCfg> _complexkeywordCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!complexkeywordCfgs.isEmpty()) {
|
||||
complexkeywordCfgs.drainTo(_complexkeywordCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_complexkeywordCfgs.size());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (ComplexkeywordCfg cfg : _complexkeywordCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
cfg.setIsAudit(0);
|
||||
cfg.setIsValid(0);
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
if(specificServiceCfg!=null) {
|
||||
cfg.setAppCode(specificServiceCfg.getSpecServiceCode());
|
||||
cfg.setSpecServiceId(specificServiceCfg.getSpecServiceId());
|
||||
if(StringUtils.isNotBlank(behaviorId))
|
||||
cfg.setBehavCode(Integer.parseInt(behaviorId));
|
||||
}
|
||||
if (serviceDict.getServiceId().intValue() == 33
|
||||
|| serviceDict.getServiceId().intValue() == 145
|
||||
|| serviceDict.getServiceId().intValue() == 35
|
||||
|| serviceDict.getServiceId().intValue() == 147
|
||||
|| serviceDict.getServiceId().intValue() == 36
|
||||
|| serviceDict.getServiceId().intValue() == 148) {
|
||||
if (appRegion != null) {
|
||||
AppPolicyCfg appPolicyCfg = new AppPolicyCfg();
|
||||
BeanUtils.copyProperties(cfg, appPolicyCfg,new String[] {"cfgId"});
|
||||
//appPolicyCfg.setSpecServiceId(specificServiceCfg.getSpecServiceId());
|
||||
//appPolicyCfg.setAppCode(specificServiceCfg.getSpecServiceCode());
|
||||
appPolicyCfg.setMatchMethod(0);
|
||||
appPolicyCfg.setIsHexbin(0);
|
||||
appPolicyCfg.setCfgType(appRegion.getConfigRegionValue());
|
||||
appPolicyCfg.setCfgRegionCode(appRegion.getConfigRegionCode());
|
||||
if (StringUtils.isNotBlank(behaviorId)) {
|
||||
//appPolicyCfg.setBehavCode(Integer.parseInt(behaviorId));
|
||||
appPolicyCfg.setExprType(1);
|
||||
} else {
|
||||
appPolicyCfg.setExprType(0);
|
||||
}
|
||||
appPolicyCfgs.add(appPolicyCfg);
|
||||
if(!regionDict.getFunctionId().equals(563)) {
|
||||
List<ComplexkeywordCfg> _complexkeywordCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!complexkeywordCfgs.isEmpty()) {
|
||||
complexkeywordCfgs.drainTo(_complexkeywordCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_complexkeywordCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_complexkeywordCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_complexkeywordCfgs.size());
|
||||
}
|
||||
} else {
|
||||
if(!regionDict.getFunctionId().equals(402)) {
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (ComplexkeywordCfg cfg : _complexkeywordCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
//cfg.setIsAudit(0);
|
||||
//cfg.setIsValid(0);
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
if(specificServiceCfg!=null) {
|
||||
cfg.setAppCode(specificServiceCfg.getSpecServiceCode());
|
||||
cfg.setSpecServiceId(specificServiceCfg.getSpecServiceId());
|
||||
if(StringUtils.isNotBlank(behaviorId))
|
||||
cfg.setBehavCode(Integer.parseInt(behaviorId));
|
||||
}
|
||||
if (serviceDict.getServiceId().intValue() == 33
|
||||
|| serviceDict.getServiceId().intValue() == 145
|
||||
|| serviceDict.getServiceId().intValue() == 35
|
||||
|| serviceDict.getServiceId().intValue() == 147
|
||||
|| serviceDict.getServiceId().intValue() == 36
|
||||
|| serviceDict.getServiceId().intValue() == 148) {
|
||||
if (appRegion != null) {
|
||||
AppPolicyCfg appPolicyCfg = new AppPolicyCfg();
|
||||
BeanUtils.copyProperties(cfg, appPolicyCfg,new String[] {"cfgId"});
|
||||
//appPolicyCfg.setSpecServiceId(specificServiceCfg.getSpecServiceId());
|
||||
//appPolicyCfg.setAppCode(specificServiceCfg.getSpecServiceCode());
|
||||
appPolicyCfg.setMatchMethod(0);
|
||||
appPolicyCfg.setIsHexbin(0);
|
||||
appPolicyCfg.setCfgType(appRegion.getConfigRegionValue());
|
||||
appPolicyCfg.setCfgRegionCode(appRegion.getConfigRegionCode());
|
||||
if (StringUtils.isNotBlank(behaviorId)) {
|
||||
//appPolicyCfg.setBehavCode(Integer.parseInt(behaviorId));
|
||||
appPolicyCfg.setExprType(1);
|
||||
} else {
|
||||
appPolicyCfg.setExprType(0);
|
||||
}
|
||||
appPolicyCfgs.add(appPolicyCfg);
|
||||
}
|
||||
} else {
|
||||
if(!regionDict.getFunctionId().equals(402) && !regionDict.getFunctionId().equals(565)
|
||||
&& !regionDict.getFunctionId().equals(566) && !regionDict.getFunctionId().equals(564)) {
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo,new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
}
|
||||
if(regionDict.getFunctionId().intValue()==565 || regionDict.getFunctionId().intValue()==566
|
||||
|| regionDict.getFunctionId().intValue()==564){
|
||||
AppFeatureIndex appfeature = new AppFeatureIndex();
|
||||
BeanUtils.copyProperties(cfg, appfeature,new String[] {"cfgId"});
|
||||
if(regionDict!=null){
|
||||
appfeature.setCfgRegionCode1(String.valueOf(regionDict.getConfigRegionCode()));
|
||||
appfeature.setCfgRegionValue(regionDict.getConfigRegionValue());
|
||||
appfeature.setCfgRegionType(String.valueOf(regionDict.getRegionType()));
|
||||
}
|
||||
appFeatureIndexs.add(appfeature);
|
||||
}
|
||||
}
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _complexkeywordCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
_complexkeywordCfgs.clear();
|
||||
appFeatureIndexs.clear();
|
||||
}
|
||||
|
||||
}else {
|
||||
// APP Payload处理
|
||||
List<AppComplexFeatureCfg> _complexkeywordCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!appComplexFeatureCfgs.isEmpty()) {
|
||||
appComplexFeatureCfgs.drainTo(_complexkeywordCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_complexkeywordCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_complexkeywordCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_complexkeywordCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (AppComplexFeatureCfg cfg : _complexkeywordCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
/*cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);*/
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
//cfg.setIsAudit(0);
|
||||
//cfg.setIsValid(0);
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_complexkeywordCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
if(specificServiceCfg!=null) {
|
||||
cfg.setAppCode(specificServiceCfg.getSpecServiceCode());
|
||||
cfg.setSpecServiceId(specificServiceCfg.getSpecServiceId());
|
||||
if(StringUtils.isNotBlank(behaviorId))
|
||||
cfg.setBehavCode(Integer.parseInt(behaviorId));
|
||||
}
|
||||
|
||||
|
||||
AppFeatureIndex appfeature = new AppFeatureIndex();
|
||||
BeanUtils.copyProperties(cfg, appfeature,new String[] {"cfgId"});
|
||||
if(regionDict!=null){
|
||||
appfeature.setCfgRegionCode1(String.valueOf(regionDict.getConfigRegionCode()));
|
||||
appfeature.setCfgRegionValue(regionDict.getConfigRegionValue());
|
||||
appfeature.setCfgRegionType(String.valueOf(regionDict.getRegionType()));
|
||||
}
|
||||
appFeatureIndexs.add(appfeature);
|
||||
|
||||
ind++;
|
||||
}
|
||||
ind++;
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _complexkeywordCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
_complexkeywordCfgs.clear();
|
||||
appFeatureIndexs.clear();
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _complexkeywordCfgs, cfgIndexInfos, appPolicyCfgs,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
_complexkeywordCfgs.clear();
|
||||
}
|
||||
}else if(regionDict.getRegionType().equals(6)) {
|
||||
if(regionDict.getFunctionId().equals(400)) {
|
||||
@@ -1866,7 +2094,7 @@ public class BaseController {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _dnsResStrategies, cfgIndexInfos, appPolicyCfgs,isSend.equals("1"));
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _dnsResStrategies, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,isSend.equals("1"));
|
||||
_dnsResStrategies.clear();
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
@@ -1923,8 +2151,14 @@ public class BaseController {
|
||||
ei.loadInitParams(P2pIpTemplate.class, msgProp, regionDict, serviceDict);
|
||||
} else if (regionDict.getFunctionId().equals(600)) {// ASN IP
|
||||
ei.loadInitParams(AsnIpTemplate.class, msgProp, regionDict, serviceDict);
|
||||
} else if (regionDict.getFunctionId().equals(301)) {// DDOS IP
|
||||
} else if (regionDict.getFunctionId().equals(301)) {// DDOS IP
|
||||
ei.loadInitParams(DdosIpTemplate.class, msgProp, regionDict, serviceDict);
|
||||
} else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
ei.loadInitParams(HttpsRejectIpTemplate.class, this.getMsgProp(), regionDict, serviceDict);
|
||||
} else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
ei.loadInitParams(HttpsRedirectIpTemplate.class, this.getMsgProp(), regionDict, serviceDict);
|
||||
} else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
ei.loadInitParams(HttpsReplaceIpTemplate.class, this.getMsgProp(), regionDict, serviceDict);
|
||||
} else {
|
||||
ei.loadInitParams(IpAllTemplate.class, msgProp, regionDict, serviceDict);
|
||||
}
|
||||
@@ -1942,13 +2176,27 @@ public class BaseController {
|
||||
}else{// 白名单
|
||||
ei.loadInitParams(DomainInterceptTemplate.class, msgProp, regionDict, serviceDict);
|
||||
}
|
||||
} else {
|
||||
}else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
ei.loadInitParams(HttpsRejectTemplate.class, this.getMsgProp(), regionDict, serviceDict);
|
||||
}else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
ei.loadInitParams(HttpsRedirectTemplate.class, this.getMsgProp(), regionDict, serviceDict);
|
||||
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
ei.loadInitParams(HttpsReplaceTemplate.class, this.getMsgProp(), regionDict, serviceDict);
|
||||
}else {
|
||||
ei.loadInitParams(StringAllTemplate.class, msgProp, regionDict, serviceDict);
|
||||
}
|
||||
|
||||
} else if (regionDict.getRegionType().equals(3)) {// 增强字符串类
|
||||
if (regionDict.getFunctionId().equals(7)&&serviceDict!=null&&serviceDict.getAction().intValue()==16) {
|
||||
ei.loadInitParams(DnsComplexStringTemplate.class, msgProp, regionDict, serviceDict);
|
||||
}else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
ei.loadInitParams(HttpsRejectComplexTemplate.class, this.getMsgProp(), regionDict, serviceDict);
|
||||
}else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
ei.loadInitParams(HttpsRedirectComplexTemplate.class, this.getMsgProp(), regionDict, serviceDict);
|
||||
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
ei.loadInitParams(HttpsReplaceComplexTemplate.class, this.getMsgProp(), regionDict, serviceDict);
|
||||
}else if(regionDict.getFunctionId().equals(563)) {// APP Payload
|
||||
ei.loadInitParams(AppPayloadTemplate.class, this.getMsgProp(), regionDict, serviceDict);
|
||||
} else {
|
||||
ei.loadInitParams(ComplexStringAllTemplate.class, msgProp, regionDict, serviceDict);
|
||||
}
|
||||
@@ -2031,7 +2279,17 @@ public class BaseController {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ExcelCsv.writeCSVFile(response,titleList,headMap,dataList,fileName,titleTime,msgProp);
|
||||
}
|
||||
|
||||
public String initLogMap(BaseLogEntity 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.getSearchFoundStartTime();
|
||||
}
|
||||
return logTime;
|
||||
}
|
||||
|
||||
public String initTimeMap(BaseCfg cfg){
|
||||
Properties msgProp = getMsgProp();
|
||||
@@ -2040,30 +2298,25 @@ public class BaseController {
|
||||
titleTime+=" "+msgProp.getProperty("config_time")+":"+DateUtils.formatDateTime(cfg.getSearch_create_time_start());
|
||||
if(cfg.getSearch_create_time_end()!=null){
|
||||
titleTime+="—"+DateUtils.formatDateTime(cfg.getSearch_create_time_end());
|
||||
}
|
||||
}else{
|
||||
if(cfg.getSearch_create_time_end()!=null){
|
||||
titleTime+=" "+msgProp.getProperty("config_time")+":—"+DateUtils.formatDateTime(cfg.getSearch_create_time_end());
|
||||
}else{
|
||||
titleTime+="—"+DateUtils.getDateTime();
|
||||
|
||||
}
|
||||
}
|
||||
if(cfg.getSearch_edit_time_start()!=null){
|
||||
titleTime+=" "+msgProp.getProperty("edit_time")+":"+DateUtils.formatDateTime(cfg.getSearch_edit_time_start());
|
||||
if(cfg.getSearch_edit_time_end()!=null){
|
||||
titleTime+="—"+DateUtils.formatDateTime(cfg.getSearch_edit_time_end());
|
||||
}
|
||||
}else{
|
||||
if(cfg.getSearch_edit_time_end()!=null){
|
||||
titleTime+=" "+msgProp.getProperty("edit_time")+":—"+DateUtils.formatDateTime(cfg.getSearch_edit_time_end());
|
||||
}else{
|
||||
titleTime+="—"+DateUtils.getDateTime();
|
||||
}
|
||||
}
|
||||
if(cfg.getSearch_audit_time_start()!=null){
|
||||
titleTime+=" "+msgProp.getProperty("audit_time")+":"+DateUtils.formatDateTime(cfg.getSearch_audit_time_start());
|
||||
if(cfg.getSearch_audit_time_end()!=null){
|
||||
titleTime+="—"+DateUtils.formatDateTime(cfg.getSearch_audit_time_end());
|
||||
}
|
||||
}else{
|
||||
if(cfg.getSearch_audit_time_end()!=null){
|
||||
titleTime+=" "+msgProp.getProperty("audit_time")+": —"+DateUtils.formatDateTime(cfg.getSearch_audit_time_end());
|
||||
}else{
|
||||
titleTime+="—"+DateUtils.getDateTime();
|
||||
}
|
||||
}
|
||||
return titleTime;
|
||||
@@ -2272,7 +2525,7 @@ public class BaseController {
|
||||
if(auditBatchCfg != null && !StringUtil.isEmpty(auditBatchCfg.getFunctionId())) {
|
||||
functionId=auditBatchCfg.getFunctionId();
|
||||
}
|
||||
List<Map<String,Object>> serviceList = serviceTemplate.getServiceList(functionId);
|
||||
List<Map<String,Object>> serviceList = serviceTemplate.getServiceListByFunctionId(functionId);
|
||||
|
||||
for(Map<String,Object> service:serviceList){
|
||||
String tableNameXml = service.get("tableName").toString();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.nis.web.controller.basics;
|
||||
package com.nis.web.controller.basics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -7,7 +7,6 @@ import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@@ -18,20 +17,18 @@ 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.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.domain.specific.SpecificServiceCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.AsnCacheUtils;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/basics/asn")
|
||||
@@ -50,9 +47,9 @@ public class AsnIpController extends BaseController{
|
||||
|
||||
// List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(4);
|
||||
// model.addAttribute("policyGroups", policyGroups);
|
||||
AsnCacheUtils.init(false);
|
||||
List<ConfigGroupInfo> policyGroups=AsnCacheUtils.getAllAsnGroup();
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
// AsnCacheUtils.init(false);
|
||||
// List<ConfigGroupInfo> policyGroups=AsnCacheUtils.getAllAsnGroup();
|
||||
// model.addAttribute("policyGroups", policyGroups);
|
||||
return "/basics/asnIpCfgList";
|
||||
}
|
||||
@RequestMapping(value = {"/addForm"})
|
||||
@@ -186,33 +183,50 @@ public class AsnIpController extends BaseController{
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
|
||||
|
||||
/*//导出选中记录
|
||||
* if(!StringUtil.isEmpty(ids)){
|
||||
for(String id:ids.split(",")){
|
||||
Long.parseLong(id);
|
||||
}
|
||||
//List<CfgIndexInfo> list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids);
|
||||
}else{*/
|
||||
//条件导出数据大于最大导出数,只导出最大导出条数
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
List<AsnIpCfg> list = new ArrayList<AsnIpCfg>();
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
list = asnIpCfgService.findByPage(ids);
|
||||
} else {
|
||||
Page<AsnIpCfg> pageInfo=new Page<AsnIpCfg>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<AsnIpCfg> page = asnIpCfgService.findPage(pageInfo, entity);
|
||||
for (AsnIpCfg asnIp : page.getList()) {
|
||||
list=page.getList();
|
||||
}
|
||||
for (AsnIpCfg asnIp : list) {
|
||||
asnIp.setIsIssued(String.valueOf(asnIp.getIsValid()));
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), AsnIpCfg.class);
|
||||
String ipPortInfoNoExport=",do_log,action,valid_identifier,is_audit"
|
||||
String cfgIndexInfoNoExport=",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,group_name,";
|
||||
noExportMap.put(entity.getMenuNameCode(),ipPortInfoNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), page.getList());
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
+",userregion2,userregion3,userregion4,userregion5,ir_type,group_name,&userregion1:asn_no-";
|
||||
// 时间过滤
|
||||
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("asnIp export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
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.apache.commons.lang.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.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -14,6 +20,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
/**
|
||||
@@ -133,4 +140,62 @@ public class PolicyGroupController extends BaseController {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//Group配置导出
|
||||
@RequestMapping(value = "exportGroup")
|
||||
public void exportGroup(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")PolicyGroupInfo entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
entity.setMenuNameCode("policy_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<PolicyGroupInfo> list = new ArrayList<PolicyGroupInfo>();
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
list = policyGroupInfoService.findPolicyByGroupInfoList(ids);
|
||||
} else {
|
||||
Page<PolicyGroupInfo> pageInfo=new Page<PolicyGroupInfo>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page page = policyGroupInfoService.findPolicyGroupInfoList(pageInfo,entity);
|
||||
list=page.getList();
|
||||
}
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), PolicyGroupInfo.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");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,40 +1,37 @@
|
||||
package com.nis.web.controller.basics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
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.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.zookeeper.ZooDefs.Ids;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
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.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.configuration.RequestInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigDictUtils;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/basics/serviceDictInfo")
|
||||
@@ -474,4 +471,126 @@ public class ServiceDictInfoController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
// dict配置导出
|
||||
@RequestMapping(value = "exportDict")
|
||||
public void exportDict(String itType, ServiceDictInfo serviceDictInfo,Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
String ids, RedirectAttributes redirectAttributes,String exType,String hColumns) {
|
||||
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<ServiceDictInfo> list = Lists.newArrayList();
|
||||
List<Integer> intArr = ConfigDictUtils.dealTypeCondition(Configurations.getStringProperty("SERVICE_DICT_ITM_TYPE", ""), itType);
|
||||
//处理数据
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
list = serviceDictInfoService.findByDictInfo(ids,intArr);
|
||||
} else {
|
||||
|
||||
Page<ServiceDictInfo> pageCondition = new Page<ServiceDictInfo>(request, response);
|
||||
pageCondition.setPageNo(1);
|
||||
pageCondition.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
//查询符合条件总数
|
||||
List<ServiceDictInfo> allList = serviceDictInfoService.findAllServiceDictInfo(serviceDictInfo,intArr,pageCondition.getOrderBy());
|
||||
//查出顶层分页数据
|
||||
Page<ServiceDictInfo> page = serviceDictInfoService.findTopDictList(pageCondition, serviceDictInfo,intArr);
|
||||
// 删除顶层数据、取出id
|
||||
List<Integer> intList = Lists.newArrayList();
|
||||
for(ServiceDictInfo tempSe : page.getList()) {
|
||||
if (tempSe != null) {
|
||||
intList.add(tempSe.getServiceDictId());
|
||||
}
|
||||
}
|
||||
for (int i = allList.size() - 1; i >= 0; i--) {
|
||||
ServiceDictInfo se = allList.get(i);
|
||||
if(se!=null&&intList.contains(se.getServiceDictId())||(se!=null&&se.getParent().getServiceDictId()==0)){
|
||||
allList.remove(se);
|
||||
}
|
||||
}
|
||||
allList.addAll(page.getList());
|
||||
ServiceDictInfo.sortList(list,allList,0,true);
|
||||
}
|
||||
|
||||
for(ServiceDictInfo tempSe : list) {
|
||||
if(tempSe.getServiceDictCreator()!=null){
|
||||
if(tempSe.getServiceDictCreator().getId()!=null){
|
||||
SysUser creator=UserUtils.get(tempSe.getServiceDictCreator().getId().toString());
|
||||
tempSe.setCreatorName(creator.getName());
|
||||
}
|
||||
}
|
||||
if(tempSe.getServiceDictEditor()!=null){
|
||||
if(tempSe.getServiceDictEditor().getId()!=null){
|
||||
SysUser creator=UserUtils.get(tempSe.getServiceDictEditor().getId().toString());
|
||||
tempSe.setEditorName(creator.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
String dictName=getDicName(intArr);
|
||||
titleList.add(dictName);
|
||||
classMap.put(dictName, ServiceDictInfo.class);
|
||||
String cfgIndexInfoNoExport = "";
|
||||
if("5".equals(itType)){
|
||||
cfgIndexInfoNoExport=",item_type,is_leaf,&config_content:vpn_ip-";
|
||||
}
|
||||
if(serviceDictInfo.getBeginDate()==null){
|
||||
cfgIndexInfoNoExport=",create_time,"+cfgIndexInfoNoExport;
|
||||
}
|
||||
if(serviceDictInfo.getEditBeginDate()==null){
|
||||
cfgIndexInfoNoExport=",edit_time,"+cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(hColumns)) {
|
||||
cfgIndexInfoNoExport = "," +hColumns+ ","+cfgIndexInfoNoExport;
|
||||
}
|
||||
noExportMap.put(dictName, cfgIndexInfoNoExport);
|
||||
dataMap.put(dictName, list);
|
||||
String timeRange = initDictMap(serviceDictInfo,dictName);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(exType)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, dictName, titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, dictName, titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("dict white export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
|
||||
public String initDictMap(ServiceDictInfo cfg,String dictName){
|
||||
Properties msgProp = getMsgProp();
|
||||
String titleTime=dictName;
|
||||
if(cfg.getBeginDate()!=null){
|
||||
titleTime+=" "+msgProp.getProperty("create_time")+":"+DateUtils.formatDateTime(cfg.getBeginDate());
|
||||
if(cfg.getEndDate()!=null){
|
||||
titleTime+="—"+DateUtils.formatDateTime(cfg.getEndDate());
|
||||
}else{
|
||||
titleTime+="—"+DateUtils.getDateTime();
|
||||
}
|
||||
}
|
||||
if(cfg.getEditBeginDate()!=null){
|
||||
titleTime+=" "+msgProp.getProperty("edit_time")+":"+DateUtils.formatDateTime(cfg.getEditBeginDate());
|
||||
if(cfg.getEditEndDate()!=null){
|
||||
titleTime+="—"+DateUtils.formatDateTime(cfg.getEditEndDate());
|
||||
}else{
|
||||
titleTime+="—"+DateUtils.getDateTime();
|
||||
}
|
||||
}
|
||||
return titleTime;
|
||||
}
|
||||
|
||||
|
||||
public String getDicName(List intArr){
|
||||
String dicName="";
|
||||
Properties msgProp = getMsgProp();
|
||||
List<String> dict=ConfigDictUtils.getItemTypeByNo("SERVICE_DICT_ITM_TYPE",intArr);
|
||||
if(dict.size()>0){
|
||||
dicName=msgProp.getProperty(dict.get(0),dict.get(0));
|
||||
}
|
||||
return dicName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,14 +13,17 @@ 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.util.StringUtils;
|
||||
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.nis.domain.Page;
|
||||
import com.nis.domain.configuration.RequestInfo;
|
||||
import com.nis.domain.configuration.TaskInfo;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@@ -74,7 +77,8 @@ public class TaskInfoController extends BaseController{
|
||||
}else{
|
||||
if (!"true".equals(checkTaskName(taskInfo.getTaskName()))){
|
||||
logger.info(taskInfo.getTaskName()+"重复数据");
|
||||
addMessage("error",model,"save_failed");
|
||||
Properties props=this.getMsgProp();
|
||||
addMessage("error",model,props.getProperty("duplicate", "Duplicate")+" "+props.getProperty("task_name", "Task Name"));
|
||||
return form(taskInfo, model);
|
||||
}
|
||||
// 保存用户信息
|
||||
@@ -160,7 +164,7 @@ public class TaskInfoController extends BaseController{
|
||||
}
|
||||
//配置导出
|
||||
@RequestMapping(value = "exportTaskInfo")
|
||||
public void exportTaskInfo(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
public void exportTaskInfo(Model model,HttpServletRequest request,HttpServletResponse response,String hcolumn,String exType,
|
||||
@ModelAttribute("cfg")TaskInfo entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
@@ -189,6 +193,18 @@ public class TaskInfoController extends BaseController{
|
||||
if(column.toString().length()>0) {
|
||||
column.append(",");
|
||||
}
|
||||
|
||||
if(entity.getBeginDate()==null ){
|
||||
hcolumn+=",task_time,";
|
||||
}
|
||||
if(entity.getDobeginDate()==null){
|
||||
hcolumn+=",edit_time,";
|
||||
}
|
||||
|
||||
if(!StringUtils.isEmpty(hcolumn)){
|
||||
column.append(","+hcolumn+",");
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(),column.toString());
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
for(String id:ids.split(",")){
|
||||
@@ -203,15 +219,43 @@ public class TaskInfoController extends BaseController{
|
||||
Page<TaskInfo> page = taskInfoService.findTaskInfo(pageInfo, entity);
|
||||
list=page.getList();
|
||||
}
|
||||
|
||||
dataMap.put(entity.getMenuNameCode(),list);
|
||||
// 获取国际化配置
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
//获取国际化配置
|
||||
String timeRange = initTaskMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(exType)) {
|
||||
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("ip addr export failed",e);
|
||||
addMessage(redirectAttributes,"error", "export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
public String initTaskMap(TaskInfo info){
|
||||
Properties msgProp = getMsgProp();
|
||||
String logTime=msgProp.getProperty(info.getMenuNameCode(),info.getMenuNameCode());
|
||||
if(info.getBeginDate()!=null){
|
||||
logTime+=" "+msgProp.getProperty("task_time","task_time")+":"+DateUtils.formatDateTime(info.getBeginDate());
|
||||
if(info.getEndDate()!=null){
|
||||
logTime+="—"+DateUtils.formatDateTime(info.getEndDate());
|
||||
}else{
|
||||
logTime+="—"+DateUtils.getDateTime();
|
||||
}
|
||||
}
|
||||
if(info.getDobeginDate()!=null){
|
||||
logTime+=" "+msgProp.getProperty("edit_time","edit_time")+":"+DateUtils.formatDateTime(info.getDobeginDate());
|
||||
if(info.getDoendDate()!=null){
|
||||
logTime+="—"+DateUtils.formatDateTime(info.getDoendDate());
|
||||
}else{
|
||||
logTime+="—"+DateUtils.getDateTime();
|
||||
}
|
||||
}
|
||||
return logTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -64,6 +64,7 @@ import com.nis.web.security.UserUtils;
|
||||
|
||||
/**
|
||||
* 特定协议相关配置控制类
|
||||
*
|
||||
* @author zhangwei
|
||||
*
|
||||
*/
|
||||
@@ -72,48 +73,58 @@ import com.nis.web.security.UserUtils;
|
||||
public class AppFeatureCfgController extends BaseController {
|
||||
/**
|
||||
* app协议复杂特征配置列表
|
||||
*
|
||||
* @param model
|
||||
* @param cfg
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"multiFeatureCfgList"})
|
||||
public String multiFeatureCfgList(Model model,@ModelAttribute("cfg")AppFeatureIndex cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<AppFeatureIndex> searchPage=new Page<AppFeatureIndex>(request,response,"r");
|
||||
@RequestMapping(value = { "multiFeatureCfgList" })
|
||||
public String multiFeatureCfgList(Model model, @ModelAttribute("cfg") AppFeatureIndex cfg,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
Page<AppFeatureIndex> searchPage = new Page<AppFeatureIndex>(request, response, "r");
|
||||
Page<AppFeatureIndex> page = appMultiFeatureCfgService.findAppFeatureIndexList(searchPage, cfg);
|
||||
for(AppFeatureIndex entity:page.getList()){
|
||||
for (AppFeatureIndex entity : page.getList()) {
|
||||
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
||||
entity.setAppName(app.getSpecServiceName());
|
||||
}
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
initPageCondition(model, cfg);
|
||||
return "/cfg/app/appMultiFeatureCfgList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 特征配置表单
|
||||
*
|
||||
* @param model
|
||||
* @param ids
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"multiFeatureCfgForm"})
|
||||
public String multiFeatureCfgForm(Model model,String ids,AppFeatureIndex entity) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
@RequestMapping(value = { "multiFeatureCfgForm" })
|
||||
public String multiFeatureCfgForm(Model model, String ids, AppFeatureIndex entity) {
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
entity = appMultiFeatureCfgService.getAppFeatureIndex(Long.parseLong(ids));
|
||||
entity.setIpPortList(appMultiFeatureCfgService.getAppIpRangeCfg(entity.getCompileId(), entity.getFunctionId()));
|
||||
entity.setStrList(appMultiFeatureCfgService.getAppStringFeatureCfg(entity.getCompileId(), entity.getFunctionId(),null));
|
||||
entity.setComplexList(appMultiFeatureCfgService.getAppComplexFeatureCfg(entity.getCompileId(), entity.getFunctionId(),null));
|
||||
entity.setNumCfgList(appMultiFeatureCfgService.getAppTcpCfg(entity.getCompileId(), entity.getFunctionId(),null));
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
initFormCondition(model,entity);
|
||||
entity.setIpPortList(
|
||||
appMultiFeatureCfgService.getAppIpRangeCfg(entity.getCompileId(), entity.getFunctionId()));
|
||||
entity.setStrList(appMultiFeatureCfgService.getAppStringFeatureCfg(entity.getCompileId(),
|
||||
entity.getFunctionId(), null));
|
||||
entity.setComplexList(appMultiFeatureCfgService.getAppComplexFeatureCfg(entity.getCompileId(),
|
||||
entity.getFunctionId(), null));
|
||||
entity.setNumCfgList(
|
||||
appMultiFeatureCfgService.getAppTcpCfg(entity.getCompileId(), entity.getFunctionId(), null));
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
model.addAttribute("_cfg", entity);
|
||||
return "/cfg/app/appMultiFeatureCfgForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 特征配置新增修改
|
||||
*
|
||||
* @param model
|
||||
* @param request
|
||||
* @param response
|
||||
@@ -121,29 +132,32 @@ public class AppFeatureCfgController extends BaseController {
|
||||
* @param redirectAttributes
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"saveAppMultiFeatureCfg"})
|
||||
public String saveAppMultiFeatureCfg(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
AppFeatureIndex entity,RedirectAttributes redirectAttributes) {
|
||||
@RequestMapping(value = { "saveAppMultiFeatureCfg" })
|
||||
public String saveAppMultiFeatureCfg(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
AppFeatureIndex entity, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
SpecificServiceCfg specificService = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
||||
if(specificService!=null){
|
||||
SpecificServiceCfg specificService = specificServiceCfgService
|
||||
.getBySpecServiceId(entity.getSpecServiceId());
|
||||
if (specificService != null) {
|
||||
entity.setAppCode(specificService.getSpecServiceCode());
|
||||
}
|
||||
appMultiFeatureCfgService.saveOrUpdateAppFeatureCfg(entity);
|
||||
addMessage(redirectAttributes,"success", "save_success");
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "save_failed");
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/app/feature/multiFeatureCfgList?functionId="+entity.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/app/feature/multiFeatureCfgList?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 特征配置审核
|
||||
*
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids
|
||||
@@ -151,19 +165,14 @@ public class AppFeatureCfgController extends BaseController {
|
||||
* @param redirectAttributes
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"auditAppFeatureCfg"})
|
||||
public String auditAppFeatureCfg(Model model,@ModelAttribute("cfg")AppFeatureIndex cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
@RequestMapping(value = { "auditAppFeatureCfg" })
|
||||
public String auditAppFeatureCfg(Model model, @ModelAttribute("cfg") AppFeatureIndex cfg, Integer isValid,
|
||||
Integer isAudit, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response, HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
AppFeatureIndex entity = new AppFeatureIndex();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
for (String id : idArray) {
|
||||
entity = appMultiFeatureCfgService.getAppFeatureIndex(Long.parseLong(id));
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
@@ -171,247 +180,264 @@ public class AppFeatureCfgController extends BaseController {
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
appMultiFeatureCfgService.auditAppFeatureCfg(entity,isAudit);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
appMultiFeatureCfgService.auditAppFeatureCfg(entity, isAudit);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("app 特征配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
logger.error("app 特征配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("app 特征配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("app 特征配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
}
|
||||
}else {
|
||||
Page<AppPolicyCfg> searchPage=new Page<AppPolicyCfg>(request,response,"r");
|
||||
Page<AppPolicyCfg> auditPage=new Page<AppPolicyCfg>(request,response,"r");
|
||||
} else {
|
||||
Page<AppPolicyCfg> searchPage = new Page<AppPolicyCfg>(request, response, "r");
|
||||
Page<AppPolicyCfg> auditPage = new Page<AppPolicyCfg>(request, response, "r");
|
||||
|
||||
try {
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
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");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return multiFeatureCfgList(model, cfg, request, response);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/app/feature/multiFeatureCfgList?functionId="+functionId;
|
||||
|
||||
return "redirect:" + adminPath + "/app/feature/multiFeatureCfgList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 特征配置删除
|
||||
*
|
||||
* @param isValid
|
||||
* @param ids
|
||||
* @param functionId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"updateAppFeatureCfgValid"})
|
||||
public String updateAppFeatureCfgValid(Integer isValid,String ids,Integer functionId) {
|
||||
appMultiFeatureCfgService.updateAppFeatureCfgValid(isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/app/feature/multiFeatureCfgList?functionId="+functionId;
|
||||
@RequestMapping(value = { "updateAppFeatureCfgValid" })
|
||||
public String updateAppFeatureCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
appMultiFeatureCfgService.updateAppFeatureCfgValid(isValid, ids, functionId);
|
||||
return "redirect:" + adminPath + "/app/feature/multiFeatureCfgList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询特征子配置
|
||||
*
|
||||
* @param model
|
||||
* @param cfgId
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"ajaxAppFeatureList"})
|
||||
public String ajaxAppFeatureList(Model model,Long cfgId,Integer compileId,Integer functionId,Integer index) {
|
||||
List<AppIpCfg> ipRangeList = appMultiFeatureCfgService.getAppIpRangeCfg(compileId,functionId);
|
||||
@RequestMapping(value = { "ajaxAppFeatureList" })
|
||||
public String ajaxAppFeatureList(Model model, Long cfgId, Integer compileId, Integer functionId, Integer index) {
|
||||
List<AppIpCfg> ipRangeList = appMultiFeatureCfgService.getAppIpRangeCfg(compileId, functionId);
|
||||
AppFeatureIndex cfg = appMultiFeatureCfgService.getAppFeatureIndex(cfgId);
|
||||
List<Map<String,Object>> tabList = new ArrayList();
|
||||
List<Map<String, Object>> tabList = new ArrayList();
|
||||
String[] cfgRegionValue = cfg.getCfgRegionValue().split(",");
|
||||
String[] cfgRegionType = cfg.getCfgRegionType().split(",");
|
||||
String[] cfgRegionCode = cfg.getCfgRegionCode1().split(",");
|
||||
if(cfgRegionValue.length == cfgRegionType.length && cfgRegionValue.length==cfgRegionCode.length){
|
||||
for(int i=0;i<cfgRegionValue.length;i++){
|
||||
Map<String,Object> map = new HashMap();
|
||||
if (cfgRegionValue.length == cfgRegionType.length && cfgRegionValue.length == cfgRegionCode.length) {
|
||||
for (int i = 0; i < cfgRegionValue.length; i++) {
|
||||
Map<String, Object> map = new HashMap();
|
||||
map.put("regionType", cfgRegionType[i]);
|
||||
map.put("regionValue", cfgRegionValue[i]);
|
||||
if("1".equals(cfgRegionType[i])){
|
||||
if ("1".equals(cfgRegionType[i])) {
|
||||
map.put("ipRangeList", ipRangeList);
|
||||
}
|
||||
if("2".equals(cfgRegionType[i])){
|
||||
List<AppStringFeatureCfg> strList = appMultiFeatureCfgService.getAppStringFeatureCfg(compileId,functionId,Integer.valueOf(cfgRegionCode[i]));
|
||||
if ("2".equals(cfgRegionType[i])) {
|
||||
List<AppStringFeatureCfg> strList = appMultiFeatureCfgService.getAppStringFeatureCfg(compileId,
|
||||
functionId, Integer.valueOf(cfgRegionCode[i]));
|
||||
map.put("strList", strList);
|
||||
}
|
||||
if("3".equals(cfgRegionType[i])){
|
||||
List<AppComplexFeatureCfg> complexList = appMultiFeatureCfgService.getAppComplexFeatureCfg(compileId,functionId,Integer.valueOf(cfgRegionCode[i]));
|
||||
if ("3".equals(cfgRegionType[i])) {
|
||||
List<AppComplexFeatureCfg> complexList = appMultiFeatureCfgService
|
||||
.getAppComplexFeatureCfg(compileId, functionId, Integer.valueOf(cfgRegionCode[i]));
|
||||
map.put("complexList", complexList);
|
||||
}
|
||||
if("4".equals(cfgRegionType[i])){
|
||||
List<AppTcpCfg> numCfgList = appMultiFeatureCfgService.getAppTcpCfg(compileId,functionId,Integer.valueOf(cfgRegionCode[i]));
|
||||
if ("4".equals(cfgRegionType[i])) {
|
||||
List<AppTcpCfg> numCfgList = appMultiFeatureCfgService.getAppTcpCfg(compileId, functionId,
|
||||
Integer.valueOf(cfgRegionCode[i]));
|
||||
map.put("numCfgList", numCfgList);
|
||||
}
|
||||
tabList.add(map);
|
||||
}
|
||||
}else{
|
||||
Map<String,Object> map = new HashMap();
|
||||
} else {
|
||||
Map<String, Object> map = new HashMap();
|
||||
map.put("regionType", "0");
|
||||
map.put("regionValue", "query config detail error");
|
||||
tabList.add(map);
|
||||
}
|
||||
|
||||
/*if(ipRangeList!=null){
|
||||
String cfgType = null;
|
||||
for(AppIpCfg ip:ipRangeList){
|
||||
if(!ip.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",ip.getCfgType()});
|
||||
cfgType = ip.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(strList!=null){
|
||||
String cfgType = null;
|
||||
for(AppStringFeatureCfg cfg:strList){
|
||||
if(!cfg.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",cfg.getCfgType()});
|
||||
cfgType = cfg.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(complexList!=null){
|
||||
String cfgType = null;
|
||||
for(AppComplexFeatureCfg cfg:complexList){
|
||||
if(!cfg.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"3",cfg.getCfgType()});
|
||||
cfgType = cfg.getCfgType();0.
|
||||
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
/*
|
||||
* if(ipRangeList!=null){ String cfgType = null; for(AppIpCfg
|
||||
* ip:ipRangeList){ if(!ip.getCfgType().equals(cfgType)){
|
||||
* tabList.add(new String[]{"1",ip.getCfgType()}); cfgType =
|
||||
* ip.getCfgType(); } } } if(strList!=null){ String cfgType = null;
|
||||
* for(AppStringFeatureCfg cfg:strList){
|
||||
* if(!cfg.getCfgType().equals(cfgType)){ tabList.add(new
|
||||
* String[]{"2",cfg.getCfgType()}); cfgType = cfg.getCfgType(); } } }
|
||||
* if(complexList!=null){ String cfgType = null;
|
||||
* for(AppComplexFeatureCfg cfg:complexList){
|
||||
* if(!cfg.getCfgType().equals(cfgType)){ tabList.add(new
|
||||
* String[]{"3",cfg.getCfgType()}); cfgType = cfg.getCfgType();0.
|
||||
*
|
||||
* } } }
|
||||
*/
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/app/appSubFeatureList";
|
||||
}
|
||||
|
||||
//appfeature配置导出
|
||||
|
||||
// appfeature配置导出
|
||||
@RequestMapping(value = "exportFeature")
|
||||
public void exportFeature(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")AppFeatureIndex entity,String ids,RedirectAttributes redirectAttributes){
|
||||
public void exportFeature(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") AppFeatureIndex 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<AppFeatureIndex> ipLists=new ArrayList<AppFeatureIndex>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=appMultiFeatureCfgService.findAppByFeatureIndexList(ids);
|
||||
}else{
|
||||
Page<AppFeatureIndex> pageInfo=new Page<AppFeatureIndex>(request, response,"r");
|
||||
// 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<AppFeatureIndex> ipLists = new ArrayList<AppFeatureIndex>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = appMultiFeatureCfgService.findAppByFeatureIndexList(ids);
|
||||
} else {
|
||||
Page<AppFeatureIndex> pageInfo = new Page<AppFeatureIndex>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<AppFeatureIndex> page = appMultiFeatureCfgService.findAppFeatureIndexList(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
ipLists = page.getList();
|
||||
}
|
||||
|
||||
for(AppFeatureIndex feature:ipLists){
|
||||
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(feature.getSpecServiceId());
|
||||
feature.setAppName(app.getSpecServiceName());
|
||||
|
||||
for (AppFeatureIndex feature : ipLists) {
|
||||
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(feature.getSpecServiceId());
|
||||
feature.setAppName(app.getSpecServiceName());
|
||||
}
|
||||
String cfgIndexInfoNoExport = ",letter,whether_area_block,classification,attribute,label,do_log,block_type,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String appComplexNoExport = ",do_log,block_type,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortInfoNoExport = ",do_log,block_type,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+ ",letter,whether_area_block,classification,attribute,label"
|
||||
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
|
||||
// 时间过滤
|
||||
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;
|
||||
}
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), AppFeatureIndex.class);
|
||||
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
|
||||
List<IpPortCfg> ipList = new ArrayList<IpPortCfg>();
|
||||
List<AppComplexFeatureCfg> keywordList = new ArrayList<AppComplexFeatureCfg>();
|
||||
List<AppStringFeatureCfg> strList = new ArrayList<AppStringFeatureCfg>();
|
||||
for (AppFeatureIndex cfg : ipLists) {
|
||||
Map<String, List> maps = appMultiFeatureCfgService.exportFeature(cfg);
|
||||
if (entity.getFunctionId() != 567) {
|
||||
keywordList.addAll(maps.get("APP_KEYWORDS"));
|
||||
} else {
|
||||
strList.addAll(maps.get("APP_DK_GL"));
|
||||
}
|
||||
String cfgIndexInfoNoExport=",letter,whether_area_block,classification,attribute,label,do_log,block_type,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String appComplexNoExport=",do_log,block_type,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortInfoNoExport=",do_log,block_type,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), AppFeatureIndex.class);
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
List<IpPortCfg> ipList=new ArrayList<IpPortCfg>();
|
||||
List<AppComplexFeatureCfg> keywordList=new ArrayList<AppComplexFeatureCfg>();
|
||||
List<AppStringFeatureCfg> strList=new ArrayList<AppStringFeatureCfg>();
|
||||
for (AppFeatureIndex cfg : ipLists) {
|
||||
Map<String, List> maps=appMultiFeatureCfgService.exportFeature(cfg);
|
||||
if(entity.getFunctionId()!=567){
|
||||
keywordList.addAll(maps.get("APP_KEYWORDS"));
|
||||
}else{
|
||||
strList.addAll(maps.get("APP_DK_GL"));
|
||||
}
|
||||
ipList.addAll(maps.get("APP_IP_RANGE"));
|
||||
}
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
if(entity.getFunctionId()!=564 && entity.getFunctionId()!=567 ){
|
||||
keywordList=replaceKeyList(keywordList);
|
||||
titleList.add("APP_IP_RANGE");
|
||||
classMap.put("APP_IP_RANGE", IpPortCfg.class);
|
||||
noExportMap.put("APP_IP_RANGE",ipPortInfoNoExport);
|
||||
dataMap.put("APP_IP_RANGE", ipList);
|
||||
}
|
||||
if(entity.getFunctionId()==563){
|
||||
titleList.add("APP_PAYLOAD");
|
||||
classMap.put("APP_PAYLOAD", AppComplexFeatureCfg.class);
|
||||
noExportMap.put("APP_PAYLOAD",appComplexNoExport);
|
||||
dataMap.put("APP_PAYLOAD", keywordList);
|
||||
}else if(entity.getFunctionId()==565){
|
||||
titleList.add("APP_HTTP");
|
||||
classMap.put("APP_HTTP", AppComplexFeatureCfg.class);
|
||||
noExportMap.put("APP_HTTP",appComplexNoExport);
|
||||
dataMap.put("APP_HTTP", keywordList);
|
||||
}else if(entity.getFunctionId()==566){
|
||||
titleList.add("APP_SSL");
|
||||
classMap.put("APP_SSL", AppComplexFeatureCfg.class);
|
||||
noExportMap.put("APP_SSL",appComplexNoExport);
|
||||
dataMap.put("APP_SSL", keywordList);
|
||||
}else if(entity.getFunctionId()==564){
|
||||
keywordList=replaceKeyList(keywordList);
|
||||
titleList.add("APP_DNS");
|
||||
classMap.put("APP_DNS", AppComplexFeatureCfg.class);
|
||||
noExportMap.put("APP_DNS",appComplexNoExport);
|
||||
dataMap.put("APP_DNS", keywordList);
|
||||
}else if(entity.getFunctionId()==567){
|
||||
strList=replaceFeatureList(strList);
|
||||
appComplexNoExport=appComplexNoExport+"district,";
|
||||
titleList.add("APP_DK");
|
||||
classMap.put("APP_DK", AppStringFeatureCfg.class);
|
||||
noExportMap.put("APP_DK",appComplexNoExport);
|
||||
dataMap.put("APP_DK", strList);
|
||||
}
|
||||
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
ipList.addAll(maps.get("APP_IP_RANGE"));
|
||||
}
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
if (entity.getFunctionId() != 564 && entity.getFunctionId() != 567) {
|
||||
keywordList = replaceKeyList(keywordList);
|
||||
titleList.add("APP_IP_RANGE");
|
||||
classMap.put("APP_IP_RANGE", IpPortCfg.class);
|
||||
noExportMap.put("APP_IP_RANGE", ipPortInfoNoExport);
|
||||
dataMap.put("APP_IP_RANGE", ipList);
|
||||
}
|
||||
if (entity.getFunctionId() == 563) {
|
||||
titleList.add("APP_PAYLOAD");
|
||||
classMap.put("APP_PAYLOAD", AppComplexFeatureCfg.class);
|
||||
noExportMap.put("APP_PAYLOAD", appComplexNoExport);
|
||||
dataMap.put("APP_PAYLOAD", keywordList);
|
||||
} else if (entity.getFunctionId() == 565) {
|
||||
titleList.add("APP_HTTP");
|
||||
classMap.put("APP_HTTP", AppComplexFeatureCfg.class);
|
||||
noExportMap.put("APP_HTTP", appComplexNoExport);
|
||||
dataMap.put("APP_HTTP", keywordList);
|
||||
} else if (entity.getFunctionId() == 566) {
|
||||
titleList.add("APP_SSL");
|
||||
classMap.put("APP_SSL", AppComplexFeatureCfg.class);
|
||||
noExportMap.put("APP_SSL", appComplexNoExport);
|
||||
dataMap.put("APP_SSL", keywordList);
|
||||
} else if (entity.getFunctionId() == 564) {
|
||||
keywordList = replaceKeyList(keywordList);
|
||||
titleList.add("APP_DNS");
|
||||
classMap.put("APP_DNS", AppComplexFeatureCfg.class);
|
||||
noExportMap.put("APP_DNS", appComplexNoExport);
|
||||
dataMap.put("APP_DNS", keywordList);
|
||||
} else if (entity.getFunctionId() == 567) {
|
||||
strList = replaceFeatureList(strList);
|
||||
appComplexNoExport = appComplexNoExport + "district,";
|
||||
titleList.add("APP_DK");
|
||||
classMap.put("APP_DK", AppStringFeatureCfg.class);
|
||||
noExportMap.put("APP_DK", appComplexNoExport);
|
||||
dataMap.put("APP_DK", strList);
|
||||
}
|
||||
|
||||
/* } */
|
||||
|
||||
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("Appfeature export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
logger.error("Appfeature export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
public static List<AppComplexFeatureCfg> replaceKeyList(List<AppComplexFeatureCfg> list){
|
||||
|
||||
public static List<AppComplexFeatureCfg> replaceKeyList(List<AppComplexFeatureCfg> list) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
AppComplexFeatureCfg base=(AppComplexFeatureCfg)list.get(i);
|
||||
AppComplexFeatureCfg base = (AppComplexFeatureCfg) list.get(i);
|
||||
base.setIsHex(base.getIsHexbin());
|
||||
base.setIsCaseInsenstive(base.getIsHexbin());
|
||||
base.setCfgKeywords(Functions.replace(base.getCfgKeywords(), "***and***"," "));
|
||||
}
|
||||
base.setCfgKeywords(Functions.replace(base.getCfgKeywords(), "***and***", " "));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<AppStringFeatureCfg> replaceFeatureList(List<AppStringFeatureCfg> list){
|
||||
|
||||
public static List<AppStringFeatureCfg> replaceFeatureList(List<AppStringFeatureCfg> list) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
AppStringFeatureCfg base=(AppStringFeatureCfg)list.get(i);
|
||||
AppStringFeatureCfg base = (AppStringFeatureCfg) list.get(i);
|
||||
base.setIsHex(base.getIsHexbin());
|
||||
base.setIsCaseInsenstive(base.getIsHexbin());
|
||||
base.setCfgKeywords(Functions.replace(base.getCfgKeywords(), "***and***"," "));
|
||||
}
|
||||
base.setCfgKeywords(Functions.replace(base.getCfgKeywords(), "***and***", " "));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import com.nis.web.security.UserUtils;
|
||||
|
||||
/**
|
||||
* 基础协议控制类
|
||||
*
|
||||
* @author wx
|
||||
*
|
||||
*/
|
||||
@@ -43,52 +44,57 @@ import com.nis.web.security.UserUtils;
|
||||
public class BasicProtocolController extends BaseController {
|
||||
/**
|
||||
* app策略列表
|
||||
*
|
||||
* @param model
|
||||
* @param cfg
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"list"})
|
||||
public String policyCfgList(Model model,@ModelAttribute("cfg")AppPolicyCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<AppPolicyCfg> searchPage=new Page<AppPolicyCfg>(request,response,"r");
|
||||
@RequestMapping(value = { "list" })
|
||||
public String policyCfgList(Model model, @ModelAttribute("cfg") AppPolicyCfg cfg, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
Page<AppPolicyCfg> searchPage = new Page<AppPolicyCfg>(request, response, "r");
|
||||
Page<AppPolicyCfg> page = appCfgService.findAppPolicyList(searchPage, cfg);
|
||||
// for(AppPolicyCfg entity:page.getList()){
|
||||
// SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
||||
// if(app!=null) {
|
||||
// entity.setAppName(app.getSpecServiceName());
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// for(AppPolicyCfg entity:page.getList()){
|
||||
// SpecificServiceCfg app =
|
||||
// specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
||||
// if(app!=null) {
|
||||
// entity.setAppName(app.getSpecServiceName());
|
||||
// }
|
||||
//
|
||||
// }
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
initPageCondition(model, cfg);
|
||||
return "/cfg/basicprotocol/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询APP策略IP子配置
|
||||
*
|
||||
* @param model
|
||||
* @param cfgId
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"ajaxIpList"})
|
||||
public String ajaxSslSubList(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
AppPolicyCfg cfg = appCfgService.getAppPolicyCfg(cfgId,compileId);
|
||||
@RequestMapping(value = { "ajaxIpList" })
|
||||
public String ajaxSslSubList(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
AppPolicyCfg cfg = appCfgService.getAppPolicyCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
if(cfg.getIpPortList()!=null){
|
||||
if (cfg.getIpPortList() != null) {
|
||||
String cfgType = null;
|
||||
for(IpPortCfg ip:cfg.getIpPortList()){
|
||||
if(!ip.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",ip.getCfgType()});
|
||||
for (IpPortCfg ip : cfg.getIpPortList()) {
|
||||
if (!ip.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "1", ip.getCfgType() });
|
||||
cfgType = ip.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getNtcSubscribeIdCfgList()!=null){
|
||||
if (cfg.getNtcSubscribeIdCfgList() != null) {
|
||||
String cfgType = null;
|
||||
for(NtcSubscribeIdCfg ntc:cfg.getNtcSubscribeIdCfgList()){
|
||||
if(!ntc.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",ntc.getCfgType()});
|
||||
for (NtcSubscribeIdCfg ntc : cfg.getNtcSubscribeIdCfgList()) {
|
||||
if (!ntc.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "2", ntc.getCfgType() });
|
||||
cfgType = ntc.getCfgType();
|
||||
}
|
||||
}
|
||||
@@ -98,27 +104,31 @@ public class BasicProtocolController extends BaseController {
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/basicprotocol/basicProtocolSubList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 策略配置表单
|
||||
*
|
||||
* @param model
|
||||
* @param ids
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"form"})
|
||||
@RequiresPermissions(value={"basicprotocol:config"})
|
||||
public String policyCfgForm(Model model,String ids,AppPolicyCfg entity) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = appCfgService.getAppPolicyCfg(Long.parseLong(ids),null);
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
initFormCondition(model,entity);
|
||||
@RequestMapping(value = { "form" })
|
||||
@RequiresPermissions(value = { "basicprotocol:config" })
|
||||
public String policyCfgForm(Model model, String ids, AppPolicyCfg entity) {
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
entity = appCfgService.getAppPolicyCfg(Long.parseLong(ids), null);
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
model.addAttribute("_cfg", entity);
|
||||
return "/cfg/basicprotocol/form";
|
||||
}
|
||||
|
||||
/**
|
||||
* 策略配置新增修改
|
||||
*
|
||||
* @param model
|
||||
* @param request
|
||||
* @param response
|
||||
@@ -126,34 +136,37 @@ public class BasicProtocolController extends BaseController {
|
||||
* @param redirectAttributes
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"save"})
|
||||
@RequiresPermissions(value={"basicprotocol:config"})
|
||||
public String saveAppPolicyCfg(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
AppPolicyCfg entity,RedirectAttributes redirectAttributes) {
|
||||
@RequestMapping(value = { "save" })
|
||||
@RequiresPermissions(value = { "basicprotocol:config" })
|
||||
public String saveAppPolicyCfg(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
AppPolicyCfg entity, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
SpecificServiceCfg specificService = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
||||
if(specificService!=null){
|
||||
SpecificServiceCfg specificService = specificServiceCfgService
|
||||
.getBySpecServiceId(entity.getSpecServiceId());
|
||||
if (specificService != null) {
|
||||
entity.setAppCode(specificService.getSpecServiceCode());
|
||||
}
|
||||
appCfgService.saveOrUpdateAppPolicyCfg(entity);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("基础协议信息保存失败",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
// addMessage(redirectAttributes,e.getMessage());
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else if(e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes,"error","call_external_procedures_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
logger.error("基础协议信息保存失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
// addMessage(redirectAttributes,e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else if (e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/basicprotocol/list?functionId="+entity.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/basicprotocol/list?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 策略配置审核
|
||||
*
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids
|
||||
@@ -161,21 +174,16 @@ public class BasicProtocolController extends BaseController {
|
||||
* @param redirectAttributes
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"audit"})
|
||||
@RequiresPermissions(value={"basicprotocol:confirm"})
|
||||
public String auditAppPolicyCfg(Model model,@ModelAttribute("cfg")AppPolicyCfg cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
@RequestMapping(value = { "audit" })
|
||||
@RequiresPermissions(value = { "basicprotocol:confirm" })
|
||||
public String auditAppPolicyCfg(Model model, @ModelAttribute("cfg") AppPolicyCfg cfg, Integer isValid,
|
||||
Integer isAudit, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response, HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
AppPolicyCfg entity = new AppPolicyCfg();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity = appCfgService.getAppPolicyCfg(Long.parseLong(id),null);
|
||||
for (String id : idArray) {
|
||||
entity = appCfgService.getAppPolicyCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
@@ -183,138 +191,167 @@ public class BasicProtocolController extends BaseController {
|
||||
entity.setFunctionId(functionId);
|
||||
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL);
|
||||
try {
|
||||
appCfgService.auditAppPolicyCfg(entity,isAudit);
|
||||
addMessage(redirectAttributes,"success","audit_success");
|
||||
appCfgService.auditAppPolicyCfg(entity, isAudit);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
if(e instanceof MaatConvertException) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
e.printStackTrace();
|
||||
logger.info("app策略配置下发失败:"+e.getMessage());;
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else {
|
||||
logger.info("app策略配置下发失败:" + e.getMessage());
|
||||
;
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
logger.error("app策略配置下发失败",e);
|
||||
addMessage(redirectAttributes,"error","audit_failed");
|
||||
logger.error("app策略配置下发失败", e);
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}else {
|
||||
Page<AppPolicyCfg> searchPage=new Page<AppPolicyCfg>(request,response,"r");
|
||||
Page<AppPolicyCfg> auditPage=new Page<AppPolicyCfg>(request,response,"r");
|
||||
} else {
|
||||
Page<AppPolicyCfg> searchPage = new Page<AppPolicyCfg>(request, response, "r");
|
||||
Page<AppPolicyCfg> auditPage = new Page<AppPolicyCfg>(request, response, "r");
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
|
||||
|
||||
try {
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
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");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return policyCfgList(model, cfg, request, response);
|
||||
}
|
||||
return "redirect:" + adminPath +"/basicprotocol/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/basicprotocol/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 策略配置删除
|
||||
*
|
||||
* @param isValid
|
||||
* @param ids
|
||||
* @param functionId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"updateValid"})
|
||||
@RequiresPermissions(value={"basicprotocol:config"})
|
||||
public String updateAppPolicyCfgValid(Integer isValid,String ids,Integer functionId,RedirectAttributes redirectAttributes) {
|
||||
@RequestMapping(value = { "updateValid" })
|
||||
@RequiresPermissions(value = { "basicprotocol:config" })
|
||||
public String updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
appCfgService.updateAppPolicyCfgValid(isValid,ids,functionId);
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
appCfgService.updateAppPolicyCfgValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("基础协议信息保存失败",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
logger.error("基础协议信息保存失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else if(e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes,"error","call_external_procedures_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else if (e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/basicprotocol/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/basicprotocol/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
//ip配置导出
|
||||
@RequestMapping(value = "exportIpAddr")
|
||||
public void exportIpAddr(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")AppPolicyCfg 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<AppPolicyCfg> ipLists=new ArrayList<AppPolicyCfg>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=appCfgService.findAppByPolicyList(ids);
|
||||
}else{
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<AppPolicyCfg> pageInfo=new Page<AppPolicyCfg>(request, response,"a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<AppPolicyCfg> page = appCfgService.findAppPolicyList(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
}
|
||||
for(AppPolicyCfg policy:ipLists){
|
||||
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(policy.getSpecServiceId());
|
||||
if(app!=null) {
|
||||
policy.setAppName(app.getSpecServiceName());
|
||||
}
|
||||
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_IP");
|
||||
titleList.add("NTC_SUBSCRIBE_ID");
|
||||
classMap.put(entity.getMenuNameCode(), AppPolicyCfg.class);
|
||||
classMap.put("NTC_IP", IpPortCfg.class);
|
||||
classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class);
|
||||
String cfgIndexInfoNoExport=",encrypted_tunnel_behavior,behaviour_type,social_app,behaviour_type,expression_type,match_method,whether_hexbinary,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortInfoNoExport=",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 subscribeInfoNoExport=",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,";
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||
noExportMap.put("NTC_SUBSCRIBE_ID", subscribeInfoNoExport);
|
||||
List<IpPortCfg> ipList=new ArrayList<IpPortCfg>();
|
||||
List<BaseStringCfg> subscribeInfoList=new ArrayList<BaseStringCfg>();
|
||||
for (AppPolicyCfg cfg : ipLists) {
|
||||
AppPolicyCfg cfgIndexInfo=appCfgService.exportIpInfo(cfg);
|
||||
ipList.addAll(cfgIndexInfo.getIpPortList());
|
||||
subscribeInfoList.addAll(cfgIndexInfo.getNtcSubscribeIdCfgList());
|
||||
}
|
||||
subscribeInfoList=BaseStringCfg.baseHexList(subscribeInfoList);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_IP", ipList);
|
||||
dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList);
|
||||
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("ip addr export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
|
||||
// ip配置导出
|
||||
@RequestMapping(value = "exportIpAddr")
|
||||
public void exportIpAddr(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") AppPolicyCfg 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<AppPolicyCfg> ipLists = new ArrayList<AppPolicyCfg>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = appCfgService.findAppByPolicyList(ids);
|
||||
} else {
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<AppPolicyCfg> pageInfo = new Page<AppPolicyCfg>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<AppPolicyCfg> page = appCfgService.findAppPolicyList(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
for (AppPolicyCfg policy : ipLists) {
|
||||
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(policy.getSpecServiceId());
|
||||
if (app != null) {
|
||||
policy.setAppName(app.getSpecServiceName());
|
||||
}
|
||||
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_IP");
|
||||
titleList.add("NTC_SUBSCRIBE_ID");
|
||||
classMap.put(entity.getMenuNameCode(), AppPolicyCfg.class);
|
||||
classMap.put("NTC_IP", IpPortCfg.class);
|
||||
classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class);
|
||||
String cfgIndexInfoNoExport = ",encrypted_tunnel_behavior,behaviour_type,social_app,behaviour_type,expression_type,match_method,whether_hexbinary,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortInfoNoExport = ",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 subscribeInfoNoExport = ",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,";
|
||||
|
||||
// 时间过滤
|
||||
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);
|
||||
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||
noExportMap.put("NTC_SUBSCRIBE_ID", subscribeInfoNoExport);
|
||||
List<IpPortCfg> ipList = new ArrayList<IpPortCfg>();
|
||||
List<BaseStringCfg> subscribeInfoList = new ArrayList<BaseStringCfg>();
|
||||
for (AppPolicyCfg cfg : ipLists) {
|
||||
AppPolicyCfg cfgIndexInfo = appCfgService.exportIpInfo(cfg);
|
||||
ipList.addAll(cfgIndexInfo.getIpPortList());
|
||||
subscribeInfoList.addAll(cfgIndexInfo.getNtcSubscribeIdCfgList());
|
||||
}
|
||||
subscribeInfoList = BaseStringCfg.baseHexList(subscribeInfoList);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_IP", ipList);
|
||||
dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList);
|
||||
|
||||
/* } */
|
||||
|
||||
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("ip addr export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.nis.web.security.UserUtils;
|
||||
|
||||
/**
|
||||
* 加密隧道行为控制类
|
||||
*
|
||||
* @author wx
|
||||
*
|
||||
*/
|
||||
@@ -45,103 +46,117 @@ import com.nis.web.security.UserUtils;
|
||||
public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
/**
|
||||
* app策略列表
|
||||
*
|
||||
* @param model
|
||||
* @param cfg
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"list"})
|
||||
public String policyCfgList(Model model,@ModelAttribute("cfg")AppPolicyCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<AppPolicyCfg> searchPage=new Page<AppPolicyCfg>(request,response,"r");
|
||||
@RequestMapping(value = { "list" })
|
||||
public String policyCfgList(Model model, @ModelAttribute("cfg") AppPolicyCfg cfg, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
Page<AppPolicyCfg> searchPage = new Page<AppPolicyCfg>(request, response, "r");
|
||||
Page<AppPolicyCfg> page = appCfgService.findAppPolicyList(searchPage, cfg);
|
||||
// for(AppPolicyCfg entity:page.getList()){
|
||||
// SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
||||
// if(app!=null) {
|
||||
// entity.setAppName(app.getSpecServiceName());
|
||||
// }
|
||||
// }
|
||||
// //查找社交应用的所有有效二级特定服务
|
||||
// SpecificServiceCfg second=new SpecificServiceCfg();
|
||||
// for(SysDataDictionaryItem dict:DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) {
|
||||
// if(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equals(dict.getItemValue())) {
|
||||
// second.setCfgType(Integer.parseInt(dict.getItemCode()));
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// second.setIsValid(Constants.VALID_YES);
|
||||
// second.setIsLeaf(1);
|
||||
// List<SpecificServiceCfg> secondList=specificServiceCfgService.findAllSpecificServiceCfg(second, null);
|
||||
// //遍历,找到匹配项后将行为设置进去
|
||||
// for(AppPolicyCfg entity:page.getList()){
|
||||
// if(entity.getBehavCode()==null) continue;
|
||||
// for(SpecificServiceCfg secondCfg:secondList) {
|
||||
// if(secondCfg.getSpecServiceCode()==null) continue;
|
||||
// if(secondCfg.getSpecServiceCode().intValue()==entity.getBehavCode().intValue()) {
|
||||
// entity.setBehavName(secondCfg.getSpecServiceName());
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// for(AppPolicyCfg entity:page.getList()){
|
||||
// SpecificServiceCfg app =
|
||||
// specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
||||
// if(app!=null) {
|
||||
// entity.setAppName(app.getSpecServiceName());
|
||||
// }
|
||||
// }
|
||||
// //查找社交应用的所有有效二级特定服务
|
||||
// SpecificServiceCfg second=new SpecificServiceCfg();
|
||||
// for(SysDataDictionaryItem
|
||||
// dict:DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) {
|
||||
// if(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equals(dict.getItemValue()))
|
||||
// {
|
||||
// second.setCfgType(Integer.parseInt(dict.getItemCode()));
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// second.setIsValid(Constants.VALID_YES);
|
||||
// second.setIsLeaf(1);
|
||||
// List<SpecificServiceCfg>
|
||||
// secondList=specificServiceCfgService.findAllSpecificServiceCfg(second,
|
||||
// null);
|
||||
// //遍历,找到匹配项后将行为设置进去
|
||||
// for(AppPolicyCfg entity:page.getList()){
|
||||
// if(entity.getBehavCode()==null) continue;
|
||||
// for(SpecificServiceCfg secondCfg:secondList) {
|
||||
// if(secondCfg.getSpecServiceCode()==null) continue;
|
||||
// if(secondCfg.getSpecServiceCode().intValue()==entity.getBehavCode().intValue())
|
||||
// {
|
||||
// entity.setBehavName(secondCfg.getSpecServiceName());
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
initPageCondition(model, cfg);
|
||||
return "/cfg/encryptedtunnelbehav/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询APP策略IP子配置
|
||||
*
|
||||
* @param model
|
||||
* @param cfgId
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"ajaxIpList"})
|
||||
public String ajaxSslSubList(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
AppPolicyCfg cfg = appCfgService.getAppPolicyCfg(cfgId,compileId);
|
||||
@RequestMapping(value = { "ajaxIpList" })
|
||||
public String ajaxSslSubList(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
AppPolicyCfg cfg = appCfgService.getAppPolicyCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
if(cfg.getIpPortList()!=null){
|
||||
if (cfg.getIpPortList() != null) {
|
||||
String cfgType = null;
|
||||
for(IpPortCfg ip:cfg.getIpPortList()){
|
||||
if(!ip.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",ip.getCfgType()});
|
||||
for (IpPortCfg ip : cfg.getIpPortList()) {
|
||||
if (!ip.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "1", ip.getCfgType() });
|
||||
cfgType = ip.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getNtcSubscribeIdCfgList()!=null){
|
||||
if (cfg.getNtcSubscribeIdCfgList() != null) {
|
||||
String cfgType = null;
|
||||
for(NtcSubscribeIdCfg ntc:cfg.getNtcSubscribeIdCfgList()){
|
||||
if(!ntc.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",ntc.getCfgType()});
|
||||
for (NtcSubscribeIdCfg ntc : cfg.getNtcSubscribeIdCfgList()) {
|
||||
if (!ntc.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "2", ntc.getCfgType() });
|
||||
cfgType = ntc.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/encryptedtunnelbehav/encrypedTunnelSubList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 策略配置表单
|
||||
*
|
||||
* @param model
|
||||
* @param ids
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"form"})
|
||||
@RequiresPermissions(value={"encryptedtunnelbehav:config"})
|
||||
public String policyCfgForm(Model model,String ids,AppPolicyCfg entity) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = appCfgService.getAppPolicyCfg(Long.parseLong(ids),null);
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
initFormCondition(model,entity);
|
||||
@RequestMapping(value = { "form" })
|
||||
@RequiresPermissions(value = { "encryptedtunnelbehav:config" })
|
||||
public String policyCfgForm(Model model, String ids, AppPolicyCfg entity) {
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
entity = appCfgService.getAppPolicyCfg(Long.parseLong(ids), null);
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
model.addAttribute("_cfg", entity);
|
||||
return "/cfg/encryptedtunnelbehav/form";
|
||||
}
|
||||
|
||||
/**
|
||||
* 策略配置新增修改
|
||||
*
|
||||
* @param model
|
||||
* @param request
|
||||
* @param response
|
||||
@@ -149,33 +164,36 @@ public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
* @param redirectAttributes
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"save"})
|
||||
@RequiresPermissions(value={"encryptedtunnelbehav:config"})
|
||||
public String saveAppPolicyCfg(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
AppPolicyCfg entity,RedirectAttributes redirectAttributes) {
|
||||
@RequestMapping(value = { "save" })
|
||||
@RequiresPermissions(value = { "encryptedtunnelbehav:config" })
|
||||
public String saveAppPolicyCfg(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
AppPolicyCfg entity, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
SpecificServiceCfg specificService = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
||||
if(specificService!=null){
|
||||
SpecificServiceCfg specificService = specificServiceCfgService
|
||||
.getBySpecServiceId(entity.getSpecServiceId());
|
||||
if (specificService != null) {
|
||||
entity.setAppCode(specificService.getSpecServiceCode());
|
||||
}
|
||||
appCfgService.saveOrUpdateAppPolicyCfg(entity);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("加密隧道信息保存失败",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else if(e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes,"error","call_external_procedures_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
logger.error("加密隧道信息保存失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else if (e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/encryptedtunnelbehav/list?functionId="+entity.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/encryptedtunnelbehav/list?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 策略配置审核
|
||||
*
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids
|
||||
@@ -183,21 +201,16 @@ public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
* @param redirectAttributes
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"audit"})
|
||||
@RequiresPermissions(value={"encryptedtunnelbehav:confirm"})
|
||||
public String auditAppPolicyCfg(Model model,@ModelAttribute("cfg")AppPolicyCfg cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
@RequestMapping(value = { "audit" })
|
||||
@RequiresPermissions(value = { "encryptedtunnelbehav:confirm" })
|
||||
public String auditAppPolicyCfg(Model model, @ModelAttribute("cfg") AppPolicyCfg cfg, Integer isValid,
|
||||
Integer isAudit, String ids, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response, HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
AppPolicyCfg entity = new AppPolicyCfg();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity = appCfgService.getAppPolicyCfg(Long.parseLong(id),null);
|
||||
for (String id : idArray) {
|
||||
entity = appCfgService.getAppPolicyCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
@@ -205,157 +218,187 @@ public class EncryptedTunnelBehaviorController extends BaseController {
|
||||
entity.setFunctionId(functionId);
|
||||
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR);
|
||||
try {
|
||||
appCfgService.auditAppPolicyCfg(entity,isAudit);
|
||||
addMessage(redirectAttributes,"success","audit_success");
|
||||
appCfgService.auditAppPolicyCfg(entity, isAudit);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
if(e instanceof MaatConvertException) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
e.printStackTrace();
|
||||
logger.info("加密隧道配置下发失败:"+e.getMessage());;
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else {
|
||||
logger.info("加密隧道配置下发失败:" + e.getMessage());
|
||||
;
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
logger.error("加密隧道配置下发失败",e);
|
||||
addMessage(redirectAttributes,"error","audit_failed");
|
||||
logger.error("加密隧道配置下发失败", e);
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
Page<AppPolicyCfg> searchPage=new Page<AppPolicyCfg>(request,response,"r");
|
||||
Page<AppPolicyCfg> auditPage=new Page<AppPolicyCfg>(request,response,"r");
|
||||
|
||||
} else {
|
||||
Page<AppPolicyCfg> searchPage = new Page<AppPolicyCfg>(request, response, "r");
|
||||
Page<AppPolicyCfg> auditPage = new Page<AppPolicyCfg>(request, response, "r");
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
|
||||
|
||||
try {
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
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");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return policyCfgList(model, cfg, request, response);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/encryptedtunnelbehav/list?functionId="+functionId;
|
||||
|
||||
return "redirect:" + adminPath + "/encryptedtunnelbehav/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 策略配置删除
|
||||
*
|
||||
* @param isValid
|
||||
* @param ids
|
||||
* @param functionId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"updateValid"})
|
||||
@RequiresPermissions(value={"encryptedtunnelbehav:config"})
|
||||
public String updateAppPolicyCfgValid(Integer isValid,String ids,Integer functionId,RedirectAttributes redirectAttributes) {
|
||||
@RequestMapping(value = { "updateValid" })
|
||||
@RequiresPermissions(value = { "encryptedtunnelbehav:config" })
|
||||
public String updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
appCfgService.updateAppPolicyCfgValid(isValid,ids,functionId);
|
||||
appCfgService.updateAppPolicyCfgValid(isValid, ids, functionId);
|
||||
} catch (Exception e) {
|
||||
logger.error("加密隧道协议保存失败",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else if(e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes,"error","call_external_procedures_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
logger.error("加密隧道协议保存失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else if (e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/encryptedtunnelbehav/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/encryptedtunnelbehav/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
//ip配置导出
|
||||
|
||||
// ip配置导出
|
||||
@RequestMapping(value = "exportIpAddr")
|
||||
public void exportIpAddr(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")AppPolicyCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
public void exportIpAddr(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") AppPolicyCfg 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<AppPolicyCfg> ipLists=new ArrayList<AppPolicyCfg>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=appCfgService.findAppByPolicyList(ids);
|
||||
}else{
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<AppPolicyCfg> pageInfo=new Page<AppPolicyCfg>(request, response,"a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<AppPolicyCfg> page = appCfgService.findAppPolicyList(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
// 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<AppPolicyCfg> ipLists = new ArrayList<AppPolicyCfg>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = appCfgService.findAppByPolicyList(ids);
|
||||
} else {
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<AppPolicyCfg> pageInfo = new Page<AppPolicyCfg>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<AppPolicyCfg> page = appCfgService.findAppPolicyList(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
for (AppPolicyCfg policy : ipLists) {
|
||||
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(policy.getSpecServiceId());
|
||||
if (app != null) {
|
||||
policy.setBehaviorName(app.getSpecServiceName());
|
||||
}
|
||||
for(AppPolicyCfg policy:ipLists){
|
||||
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(policy.getSpecServiceId());
|
||||
if(app!=null) {
|
||||
policy.setBehaviorName(app.getSpecServiceName());
|
||||
}
|
||||
}
|
||||
// 查找社交应用的所有有效二级特定服务
|
||||
SpecificServiceCfg second = new SpecificServiceCfg();
|
||||
for (SysDataDictionaryItem dict : DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) {
|
||||
if (Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equals(dict.getItemValue())) {
|
||||
second.setCfgType(Integer.parseInt(dict.getItemCode()));
|
||||
break;
|
||||
}
|
||||
//查找社交应用的所有有效二级特定服务
|
||||
SpecificServiceCfg second=new SpecificServiceCfg();
|
||||
for(SysDataDictionaryItem dict:DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) {
|
||||
if(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equals(dict.getItemValue())) {
|
||||
second.setCfgType(Integer.parseInt(dict.getItemCode()));
|
||||
}
|
||||
second.setIsValid(Constants.VALID_YES);
|
||||
second.setIsLeaf(1);
|
||||
List<SpecificServiceCfg> secondList = specificServiceCfgService.findAllSpecificServiceCfg(second, null);
|
||||
// 遍历,找到匹配项后将行为设置进去
|
||||
for (AppPolicyCfg policy : ipLists) {
|
||||
if (policy.getBehavCode() == null)
|
||||
continue;
|
||||
for (SpecificServiceCfg secondCfg : secondList) {
|
||||
if (secondCfg.getSpecServiceCode() == null)
|
||||
continue;
|
||||
if (secondCfg.getSpecServiceCode().intValue() == policy.getBehavCode().intValue()) {
|
||||
policy.setBehavName(secondCfg.getSpecServiceName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
second.setIsValid(Constants.VALID_YES);
|
||||
second.setIsLeaf(1);
|
||||
List<SpecificServiceCfg> secondList=specificServiceCfgService.findAllSpecificServiceCfg(second, null);
|
||||
//遍历,找到匹配项后将行为设置进去
|
||||
for(AppPolicyCfg policy:ipLists){
|
||||
if(policy.getBehavCode()==null) continue;
|
||||
for(SpecificServiceCfg secondCfg:secondList) {
|
||||
if(secondCfg.getSpecServiceCode()==null) continue;
|
||||
if(secondCfg.getSpecServiceCode().intValue()==policy.getBehavCode().intValue()) {
|
||||
policy.setBehavName(secondCfg.getSpecServiceName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_IP");
|
||||
titleList.add("NTC_SUBSCRIBE_ID");
|
||||
classMap.put(entity.getMenuNameCode(), AppPolicyCfg.class);
|
||||
classMap.put("NTC_IP", IpPortCfg.class);
|
||||
classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class);
|
||||
String cfgIndexInfoNoExport=",social_app,basic_protocol,expression_type,match_method,whether_hexbinary,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortInfoNoExport=",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 subscribeInfoNoExport=",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,";
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||
noExportMap.put("NTC_SUBSCRIBE_ID", subscribeInfoNoExport);
|
||||
List<IpPortCfg> ipList=new ArrayList<IpPortCfg>();
|
||||
List<BaseStringCfg> subscribeInfoList=new ArrayList<BaseStringCfg>();
|
||||
for (AppPolicyCfg cfg : ipLists) {
|
||||
AppPolicyCfg cfgIndexInfo=appCfgService.exportIpInfo(cfg);
|
||||
ipList.addAll(cfgIndexInfo.getIpPortList());
|
||||
subscribeInfoList.addAll(cfgIndexInfo.getNtcSubscribeIdCfgList());
|
||||
}
|
||||
subscribeInfoList=BaseStringCfg.baseHexList(subscribeInfoList);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_IP", ipList);
|
||||
dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList);
|
||||
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_IP");
|
||||
titleList.add("NTC_SUBSCRIBE_ID");
|
||||
classMap.put(entity.getMenuNameCode(), AppPolicyCfg.class);
|
||||
classMap.put("NTC_IP", IpPortCfg.class);
|
||||
classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class);
|
||||
String cfgIndexInfoNoExport = ",social_app,basic_protocol,expression_type,match_method,whether_hexbinary,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortInfoNoExport = ",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 subscribeInfoNoExport = ",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,";
|
||||
|
||||
// 时间过滤
|
||||
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);
|
||||
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||
noExportMap.put("NTC_SUBSCRIBE_ID", subscribeInfoNoExport);
|
||||
List<IpPortCfg> ipList = new ArrayList<IpPortCfg>();
|
||||
List<BaseStringCfg> subscribeInfoList = new ArrayList<BaseStringCfg>();
|
||||
for (AppPolicyCfg cfg : ipLists) {
|
||||
AppPolicyCfg cfgIndexInfo = appCfgService.exportIpInfo(cfg);
|
||||
ipList.addAll(cfgIndexInfo.getIpPortList());
|
||||
subscribeInfoList.addAll(cfgIndexInfo.getNtcSubscribeIdCfgList());
|
||||
}
|
||||
subscribeInfoList = BaseStringCfg.baseHexList(subscribeInfoList);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_IP", ipList);
|
||||
dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList);
|
||||
|
||||
/* } */
|
||||
|
||||
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("TunnelBehavior export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
logger.error("TunnelBehavior export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
@@ -22,7 +23,9 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.RequestInfo;
|
||||
import com.nis.domain.configuration.TaskInfo;
|
||||
import com.nis.domain.log.BaseLogEntity;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@@ -80,7 +83,8 @@ public class RequestInfoController extends BaseController{
|
||||
}else{
|
||||
if (!"true".equals(checkRequestNumber(requestInfo.getRequestNumber()))){
|
||||
logger.info(requestInfo.getRequestNumber()+"重复数据");
|
||||
addMessage("error",model,"save_failed");
|
||||
Properties props=this.getMsgProp();
|
||||
addMessage("error",model,props.getProperty("duplicate", "Duplicate")+" "+props.getProperty("title", "Title"));
|
||||
return form(requestInfo, model);
|
||||
}
|
||||
// 保存用户信息
|
||||
@@ -188,7 +192,7 @@ public class RequestInfoController extends BaseController{
|
||||
}
|
||||
//配置导出
|
||||
@RequestMapping(value = "exportRequestInfo")
|
||||
public void exportTaskInfo(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
public void exportTaskInfo(Model model,HttpServletRequest request,HttpServletResponse response, String exType,String hcolumn,
|
||||
@ModelAttribute("requestInfo")RequestInfo entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
@@ -196,8 +200,6 @@ public class RequestInfoController extends BaseController{
|
||||
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<RequestInfo> list=Lists.newArrayList();
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
@@ -217,6 +219,17 @@ public class RequestInfoController extends BaseController{
|
||||
if(column.toString().length()>0) {
|
||||
column.append(",");
|
||||
}
|
||||
|
||||
if(entity.getBeginDate()==null){
|
||||
hcolumn+=",request_time,";
|
||||
}
|
||||
if(entity.getDobeginDate()==null){
|
||||
hcolumn+=",edit_time,";
|
||||
}
|
||||
|
||||
if(!StringUtils.isEmpty(hcolumn)){
|
||||
column.append(","+hcolumn+",");
|
||||
}
|
||||
noExportMap.put(entity.getMenuNameCode(),column.toString());
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
for(String id:ids.split(",")){
|
||||
@@ -231,14 +244,43 @@ public class RequestInfoController extends BaseController{
|
||||
Page<RequestInfo> page = requestInfoService.findRequestInfo(pageInfo, entity);
|
||||
list=page.getList();
|
||||
}
|
||||
|
||||
dataMap.put(entity.getMenuNameCode(),list);
|
||||
// 获取国际化配置
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
String timeRange = initRequestMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(exType)) {
|
||||
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("ip addr export failed",e);
|
||||
addMessage(redirectAttributes,"error", "export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
public String initRequestMap(RequestInfo info){
|
||||
Properties msgProp = getMsgProp();
|
||||
String logTime=msgProp.getProperty(info.getMenuNameCode(),info.getMenuNameCode());
|
||||
if(info.getBeginDate()!=null){
|
||||
logTime+=" "+msgProp.getProperty("request_time","request_time")+":"+DateUtils.formatDateTime(info.getBeginDate());
|
||||
if(info.getEndDate()!=null){
|
||||
logTime+="—"+DateUtils.formatDateTime(info.getEndDate());
|
||||
}else{
|
||||
logTime+="—"+DateUtils.getDateTime();
|
||||
}
|
||||
}
|
||||
if(info.getDobeginDate()!=null){
|
||||
logTime+=" "+msgProp.getProperty("edit_time","edit_time")+":"+DateUtils.formatDateTime(info.getDobeginDate());
|
||||
if(info.getDoendDate()!=null){
|
||||
logTime+="—"+DateUtils.formatDateTime(info.getDoendDate());
|
||||
}else{
|
||||
logTime+="—"+DateUtils.getDateTime();
|
||||
}
|
||||
}
|
||||
return logTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,211 +42,231 @@ import com.nis.web.service.configuration.DnsIpCfgService;
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/cfg/dnsIp")
|
||||
public class DnsIpCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = {"/list"})
|
||||
public String list(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,@ModelAttribute("cfg")DnsIpCfg entity
|
||||
,RedirectAttributes redirectAttributes){
|
||||
Page<DnsIpCfg> page = dnsIpCfgService.findPage(new Page<DnsIpCfg>(request, response,"r"), entity);
|
||||
|
||||
@RequestMapping(value = { "/list" })
|
||||
public String list(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") DnsIpCfg entity, RedirectAttributes redirectAttributes) {
|
||||
Page<DnsIpCfg> page = dnsIpCfgService.findPage(new Page<DnsIpCfg>(request, response, "r"), entity);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,entity);
|
||||
initPageCondition(model, entity);
|
||||
return "/cfg/dnsIpCfgList";
|
||||
}
|
||||
@RequestMapping(value = {"/form"})
|
||||
@RequiresPermissions(value={"dns:fake:ip:config"})
|
||||
public String form(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,String ids,@ModelAttribute("cfg")DnsIpCfg cfg
|
||||
,RedirectAttributes redirectAttributes){
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
|
||||
@RequestMapping(value = { "/form" })
|
||||
@RequiresPermissions(value = { "dns:fake:ip:config" })
|
||||
public String form(Model model, HttpServletRequest request, HttpServletResponse response, String ids,
|
||||
@ModelAttribute("cfg") DnsIpCfg cfg, RedirectAttributes redirectAttributes) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
cfg = dnsIpCfgService.getDnsIpCfg(Long.parseLong(ids));
|
||||
initUpdateFormCondition(model, cfg);
|
||||
}else{
|
||||
initFormCondition(model,cfg);
|
||||
} else {
|
||||
initFormCondition(model, cfg);
|
||||
}
|
||||
/*//获取所有响应策略信息
|
||||
List<DnsResStrategy> resStrategys=dnsResStrategyService.findDnsResStrategys(null, 1,1);
|
||||
model.addAttribute("dnsResStrategys", resStrategys);*/
|
||||
//查询policyGroup列表,供响应策略选择 2018-07-24 经确定IP欺骗只能选择非0号分组
|
||||
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(1);
|
||||
/*
|
||||
* //获取所有响应策略信息 List<DnsResStrategy>
|
||||
* resStrategys=dnsResStrategyService.findDnsResStrategys(null, 1,1);
|
||||
* model.addAttribute("dnsResStrategys", resStrategys);
|
||||
*/
|
||||
// 查询policyGroup列表,供响应策略选择 2018-07-24 经确定IP欺骗只能选择非0号分组
|
||||
List<PolicyGroupInfo> policyGroups = policyGroupInfoService.findPolicyGroupInfosByType(1);
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/dnsIpCfgForm";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 初始化一条dns fakeip配置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = {"initSpoofingIp"})
|
||||
public String initSpoofingIp(){
|
||||
Properties msg=getMsgProp();
|
||||
@RequestMapping(value = { "initSpoofingIp" })
|
||||
public String initSpoofingIp() {
|
||||
Properties msg = getMsgProp();
|
||||
try {
|
||||
DnsIpCfg entity=new DnsIpCfg();
|
||||
DnsIpCfg entity = new DnsIpCfg();
|
||||
entity.setIsAudit(1);
|
||||
entity.setIsValid(1);
|
||||
entity.setDnsStrategyId(0);
|
||||
List<DnsIpCfg> list=dnsIpCfgService.findDnsIpCfg(entity);
|
||||
if(StringUtil.isEmpty(list)) {
|
||||
List<DnsIpCfg> list = dnsIpCfgService.findDnsIpCfg(entity);
|
||||
if (StringUtil.isEmpty(list)) {
|
||||
dnsIpCfgService.saveAndAudit();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("初始化Spoofing ip失败",e);
|
||||
logger.error("初始化Spoofing ip失败", e);
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
return msg.getProperty("request_service_failed");
|
||||
}else {
|
||||
} else {
|
||||
return msg.getProperty("save_failed");
|
||||
}
|
||||
}
|
||||
return "success";
|
||||
}
|
||||
@RequestMapping(value = {"/saveOrUpdate"})
|
||||
@RequiresPermissions(value={"dns:fake:ip:config"})
|
||||
public String saveOrUpdate(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")DnsIpCfg cfg
|
||||
,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
|
||||
@RequestMapping(value = { "/saveOrUpdate" })
|
||||
@RequiresPermissions(value = { "dns:fake:ip:config" })
|
||||
public String saveOrUpdate(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") DnsIpCfg cfg, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
dnsIpCfgService.saveOrUpdate(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("信息保存失败", e);
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/cfg/dnsIp/list?functionId="+cfg.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/cfg/dnsIp/list?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/delete"})
|
||||
@RequiresPermissions(value={"dns:fake:ip:config"})
|
||||
public String delete(Integer isAudit,Integer isValid
|
||||
,String ids,Integer functionId
|
||||
,RedirectAttributes redirectAttributes){
|
||||
dnsIpCfgService.delete(isAudit,isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/cfg/dnsIp/list?functionId="+functionId;
|
||||
|
||||
@RequestMapping(value = { "/delete" })
|
||||
@RequiresPermissions(value = { "dns:fake:ip:config" })
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
dnsIpCfgService.delete(isAudit, isValid, ids, functionId);
|
||||
return "redirect:" + adminPath + "/cfg/dnsIp/list?functionId=" + functionId;
|
||||
}
|
||||
@RequestMapping(value = {"/audit"})
|
||||
@RequiresPermissions(value={"dns:fake:ip:confirm"})
|
||||
public String audit(Model model,@ModelAttribute("cfg")DnsIpCfg cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
|
||||
@RequestMapping(value = { "/audit" })
|
||||
@RequiresPermissions(value = { "dns:fake:ip:confirm" })
|
||||
public String audit(Model model, @ModelAttribute("cfg") DnsIpCfg cfg, Integer isValid, Integer isAudit, String ids,
|
||||
Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
Date auditTime = new Date();
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
dnsIpCfgService.audit(isAudit,isValid,functionId,id,auditTime);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
dnsIpCfgService.audit(isAudit, isValid, functionId, id, auditTime);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("dns fake ip配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
logger.info("dns fake ip配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("dns fake ip配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.info("dns fake ip配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}else {
|
||||
Page<DnsIpCfg> searchPage=new Page<DnsIpCfg>(request,response,"r");
|
||||
Page<DnsIpCfg> auditPage=new Page<DnsIpCfg>(request,response,"r");
|
||||
|
||||
} else {
|
||||
Page<DnsIpCfg> searchPage = new Page<DnsIpCfg>(request, response, "r");
|
||||
Page<DnsIpCfg> auditPage = new Page<DnsIpCfg>(request, response, "r");
|
||||
|
||||
try {
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
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");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return list(model, request, response,cfg, redirectAttributes);
|
||||
|
||||
return list(model, request, response, cfg, redirectAttributes);
|
||||
}
|
||||
return "redirect:" + adminPath +"/cfg/dnsIp/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/cfg/dnsIp/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DNS阻断无策略时检验
|
||||
*
|
||||
* @param entity
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = {"/dnsNoStrategyCheck"})
|
||||
public boolean dnsNoStrategyCheck(DnsIpCfg entity, HttpServletRequest request, HttpServletResponse response){
|
||||
@RequestMapping(value = { "/dnsNoStrategyCheck" })
|
||||
public boolean dnsNoStrategyCheck(DnsIpCfg entity, HttpServletRequest request, HttpServletResponse response) {
|
||||
entity.setIsAudit(1);
|
||||
entity.setIsValid(1);
|
||||
List<DnsIpCfg> list = dnsIpCfgService.findDnsIpCfg(entity);
|
||||
if(list.size() > 0){
|
||||
if (list.size() > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//dnsIp配置导出
|
||||
@RequestMapping(value = "exportDnsIp")
|
||||
public void exportDns(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")DnsIpCfg 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<DnsIpCfg> ipLists=new ArrayList<DnsIpCfg>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=dnsIpCfgService.findByPage(ids);
|
||||
}else{
|
||||
Page<DnsIpCfg> pageInfo=new Page<DnsIpCfg>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<DnsIpCfg> page = dnsIpCfgService.findPage(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
}
|
||||
|
||||
for (int i = 0; i < ipLists.size(); i++) {
|
||||
if(StringUtil.isEmpty(ipLists.get(i).getDnsStrategyName())){
|
||||
Properties msgProp = getMsgProp();
|
||||
ipLists.get(i).setDnsStrategyName(msgProp.getProperty("default_group"));
|
||||
}
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), DnsIpCfg.class);
|
||||
String cfgIndexInfoNoExport=",whether_area_block,client_ip,port_pattern,client_port,server_port,ir_type,direction,protocol,do_log,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("DnsIp export failed",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "export_failed");
|
||||
// dnsIp配置导出
|
||||
@RequestMapping(value = "exportDnsIp")
|
||||
public void exportDns(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") DnsIpCfg 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<DnsIpCfg> ipLists = new ArrayList<DnsIpCfg>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = dnsIpCfgService.findByPage(ids);
|
||||
} else {
|
||||
Page<DnsIpCfg> pageInfo = new Page<DnsIpCfg>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<DnsIpCfg> page = dnsIpCfgService.findPage(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
|
||||
for (int i = 0; i < ipLists.size(); i++) {
|
||||
if (StringUtil.isEmpty(ipLists.get(i).getDnsStrategyName())) {
|
||||
Properties msgProp = getMsgProp();
|
||||
ipLists.get(i).setDnsStrategyName(msgProp.getProperty("default_group"));
|
||||
}
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), DnsIpCfg.class);
|
||||
String cfgIndexInfoNoExport = ",whether_area_block,client_ip,port_pattern,client_port,server_port,ir_type,direction,protocol,do_log,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
|
||||
// 时间过滤
|
||||
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("DnsIp export failed", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,189 +33,206 @@ import com.nis.web.controller.BaseController;
|
||||
|
||||
/**
|
||||
* dns响应策略
|
||||
*
|
||||
* @author ddm
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/maintenance/dnsResStrategy")
|
||||
public class DnsResStrategyController extends BaseController {
|
||||
|
||||
@RequestMapping(value = {"/form"})
|
||||
@RequiresPermissions(value={"dns:res:strategy:config"})
|
||||
public String from(Model model,
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
String ids,
|
||||
@ModelAttribute("cfg")DnsResStrategy cfg
|
||||
,RedirectAttributes redirectAttributes){
|
||||
if(cfg == null){
|
||||
cfg=new DnsResStrategy();
|
||||
public class DnsResStrategyController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "/form" })
|
||||
@RequiresPermissions(value = { "dns:res:strategy:config" })
|
||||
public String from(Model model, HttpServletRequest request, HttpServletResponse response, String ids,
|
||||
@ModelAttribute("cfg") DnsResStrategy cfg, RedirectAttributes redirectAttributes) {
|
||||
if (cfg == null) {
|
||||
cfg = new DnsResStrategy();
|
||||
}
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = dnsResStrategyService.getDnsResStrategy(Long.valueOf(ids),-1);
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
cfg = dnsResStrategyService.getDnsResStrategy(Long.valueOf(ids), -1);
|
||||
initFormCondition(model, cfg);
|
||||
model.addAttribute("isAdd", false);
|
||||
}else{
|
||||
/*//不存在响应策略为0的配置,则新策略时,cfgId默认为0
|
||||
DnsResStrategy dns0=dnsResStrategyService.getDnsResStrategy(0l,null);
|
||||
if(dns0 == null){
|
||||
cfg.setCfgId(0l);
|
||||
cfg.setCfgDesc("无策略");
|
||||
}*/
|
||||
} else {
|
||||
/*
|
||||
* //不存在响应策略为0的配置,则新策略时,cfgId默认为0 DnsResStrategy
|
||||
* dns0=dnsResStrategyService.getDnsResStrategy(0l,null); if(dns0 ==
|
||||
* null){ cfg.setCfgId(0l); cfg.setCfgDesc("无策略"); }
|
||||
*/
|
||||
initFormCondition(model, cfg);
|
||||
model.addAttribute("isAdd", true);
|
||||
}
|
||||
|
||||
//查询policyGroup列表,供响应策略选择
|
||||
// List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(1);
|
||||
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findHasIpPolicyGroupInfosByType(1);
|
||||
|
||||
// 查询policyGroup列表,供响应策略选择
|
||||
// List<PolicyGroupInfo>
|
||||
// policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(1);
|
||||
List<PolicyGroupInfo> policyGroups = policyGroupInfoService.findHasIpPolicyGroupInfosByType(1);
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
|
||||
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/maintenance/dnsResStrategy/form";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/saveOrUpdate"})
|
||||
@RequiresPermissions(value={"dns:res:strategy:config"})
|
||||
public String saveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")DnsResStrategy cfg
|
||||
,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
|
||||
|
||||
@RequestMapping(value = { "/saveOrUpdate" })
|
||||
@RequiresPermissions(value = { "dns:res:strategy:config" })
|
||||
public String saveOrUpdate(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") DnsResStrategy cfg, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
|
||||
dnsResStrategyService.saveOrUpdate(cfg);
|
||||
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch (MaatConvertException e) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (MaatConvertException e) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} catch (Exception e) {
|
||||
addMessage(redirectAttributes,"error", "save_failed");
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/maintenance/dnsResStrategy/list?functionId="+cfg.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/maintenance/dnsResStrategy/list?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/list"})
|
||||
public String list(Model model,HttpServletRequest request,HttpServletResponse response
|
||||
,@ModelAttribute("cfg")DnsResStrategy entity
|
||||
,RedirectAttributes redirectAttributes){
|
||||
//查询时left join policyGroup
|
||||
Page<DnsResStrategy> page = dnsResStrategyService.findPage(new Page<DnsResStrategy>(request, response,"r"), entity);
|
||||
|
||||
@RequestMapping(value = { "/list" })
|
||||
public String list(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") DnsResStrategy entity, RedirectAttributes redirectAttributes) {
|
||||
// 查询时left join policyGroup
|
||||
Page<DnsResStrategy> page = dnsResStrategyService.findPage(new Page<DnsResStrategy>(request, response, "r"),
|
||||
entity);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,entity);
|
||||
initPageCondition(model, entity);
|
||||
return "/cfg/maintenance/dnsResStrategy/list";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/delete"})
|
||||
@RequiresPermissions(value={"dns:res:strategy:config"})
|
||||
public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId
|
||||
,Model model,HttpServletRequest request
|
||||
,HttpServletResponse response
|
||||
,RedirectAttributes redirectAttributes){
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
dnsResStrategyService.delete(isAudit,isValid,ids,functionId);
|
||||
|
||||
@RequestMapping(value = { "/delete" })
|
||||
@RequiresPermissions(value = { "dns:res:strategy:config" })
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
dnsResStrategyService.delete(isAudit, isValid, ids, functionId);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/maintenance/dnsResStrategy/list?functionId="+functionId;
|
||||
|
||||
return "redirect:" + adminPath + "/maintenance/dnsResStrategy/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/audit"})
|
||||
@RequiresPermissions(value={"dns:res:strategy:confirm"})
|
||||
public String audit(Model model,@ModelAttribute("cfg")DnsResStrategy cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
|
||||
@RequestMapping(value = { "/audit" })
|
||||
@RequiresPermissions(value = { "dns:res:strategy:confirm" })
|
||||
public String audit(Model model, @ModelAttribute("cfg") DnsResStrategy cfg, Integer isValid, Integer isAudit,
|
||||
String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
Date auditTime = new Date();
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
dnsResStrategyService.audit(isAudit,isValid,functionId,id,auditTime);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
dnsResStrategyService.audit(isAudit, isValid, functionId, id, auditTime);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} catch (Exception e) {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
Page<DnsResStrategy> searchPage=new Page<DnsResStrategy>(request,response,"r");
|
||||
Page<DnsResStrategy> auditPage=new Page<DnsResStrategy>(request,response,"r");
|
||||
|
||||
} else {
|
||||
Page<DnsResStrategy> searchPage = new Page<DnsResStrategy>(request, response, "r");
|
||||
Page<DnsResStrategy> auditPage = new Page<DnsResStrategy>(request, response, "r");
|
||||
|
||||
try {
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
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");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return list(model, request, response, cfg,redirectAttributes);
|
||||
|
||||
return list(model, request, response, cfg, redirectAttributes);
|
||||
}
|
||||
return "redirect:" + adminPath +"/maintenance/dnsResStrategy/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/maintenance/dnsResStrategy/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/validCfgId")
|
||||
public boolean validCfgId(Long cfgId) {
|
||||
DnsResStrategy dns=dnsResStrategyService.getDnsResStrategy(cfgId,null);
|
||||
if(dns == null ){
|
||||
DnsResStrategy dns = dnsResStrategyService.getDnsResStrategy(cfgId, null);
|
||||
if (dns == null) {
|
||||
return false;
|
||||
}else{
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//dns配置导出
|
||||
|
||||
// dns配置导出
|
||||
@RequestMapping(value = "exportDns")
|
||||
public void exportDns(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")DnsResStrategy entity,String ids,RedirectAttributes redirectAttributes){
|
||||
public void exportDns(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") DnsResStrategy 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<DnsResStrategy> ipLists=new ArrayList<DnsResStrategy>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=dnsResStrategyService.findByPage(ids);
|
||||
}else{
|
||||
Page<DnsResStrategy> pageInfo=new Page<DnsResStrategy>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<DnsResStrategy> page = dnsResStrategyService.findPage(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
// 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<DnsResStrategy> ipLists = new ArrayList<DnsResStrategy>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = dnsResStrategyService.findByPage(ids);
|
||||
} else {
|
||||
Page<DnsResStrategy> pageInfo = new Page<DnsResStrategy>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<DnsResStrategy> page = dnsResStrategyService.findPage(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
|
||||
for (int i = 0; i < ipLists.size(); i++) {
|
||||
ipLists.get(i).setMiTtlmax(
|
||||
String.valueOf(ipLists.get(i).getMinTtl()) + "-" + String.valueOf(ipLists.get(i).getMaxTtl()));
|
||||
ipLists.get(i).setDnsId(String.valueOf(ipLists.get(i).getCfgId()));
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), DnsResStrategy.class);
|
||||
String cfgIndexInfoNoExport = ",cfg_id,valid_identifier,do_log,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,&config_describe:policy_name-";
|
||||
|
||||
// 时间过滤
|
||||
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())) {
|
||||
if (entity.gethColumns().contains("policy_name")) {
|
||||
cfgIndexInfoNoExport = ",config_describe," + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
for (int i = 0; i < ipLists.size(); i++) {
|
||||
ipLists.get(i).setMiTtlmax(String.valueOf(ipLists.get(i).getMinTtl())+"-"+String.valueOf(ipLists.get(i).getMaxTtl()));
|
||||
ipLists.get(i).setDnsId( String.valueOf(ipLists.get(i).getCfgId()));
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), DnsResStrategy.class);
|
||||
String cfgIndexInfoNoExport=",cfg_id,valid_identifier,do_log,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(),ipLists);
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
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("Dns export failed",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "export_failed");
|
||||
logger.error("Dns export failed", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.nis.web.controller.configuration.maintenance;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -21,7 +20,6 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.IpReuseIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.IpAddrPoolCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
@@ -224,5 +222,67 @@ public class IpAddrPoolController extends BaseController{
|
||||
List<IpReuseIpCfg> ipList = ipReuseIpCfgService.getPolicyIpInfo(addrPoolId);
|
||||
return ipList;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "exportIpPool")
|
||||
public void exportIpPool(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") IpAddrPoolCfg 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<IpAddrPoolCfg> ipLists = new ArrayList<IpAddrPoolCfg>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = ipAddrPoolCfgService.findByPage(ids);
|
||||
} else {
|
||||
Page<IpAddrPoolCfg> pageInfo = new Page<IpAddrPoolCfg>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<IpAddrPoolCfg> page = ipAddrPoolCfgService.findPage(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
for (IpAddrPoolCfg ipAddrPoolCfg : ipLists) {
|
||||
Integer compId=ipAddrPoolCfg.getCfgId().intValue();
|
||||
ipAddrPoolCfg.setCompileId(compId);
|
||||
}
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), IpAddrPoolCfg.class);
|
||||
String cfgIndexInfoNoExport = ",cfg_id,config_describe,block_type,policy_name,do_log,,whether_area_block,do_blacklist,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("ip white export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,213 +34,200 @@ import com.nis.web.service.basics.SysDictInfoService;
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/maintenance/ipMultiplexPoolCfg")
|
||||
public class IpMultiplexPoolCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = {"/form"})
|
||||
@RequiresPermissions(value={"ip:mulitiplex:pool:config"})
|
||||
public String from(Model model,
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
String ids,
|
||||
@ModelAttribute("cfg")IpMultiplexPoolCfg cfg){
|
||||
if(cfg == null){
|
||||
cfg=new IpMultiplexPoolCfg();
|
||||
public class IpMultiplexPoolCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "/form" })
|
||||
@RequiresPermissions(value = { "ip:mulitiplex:pool:config" })
|
||||
public String from(Model model, HttpServletRequest request, HttpServletResponse response, String ids,
|
||||
@ModelAttribute("cfg") IpMultiplexPoolCfg cfg) {
|
||||
if (cfg == null) {
|
||||
cfg = new IpMultiplexPoolCfg();
|
||||
}
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = ipMultiplexPoolCfgService.getIpMultiplexPoolCfg(Long.valueOf(ids),null);
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
cfg = ipMultiplexPoolCfgService.getIpMultiplexPoolCfg(Long.valueOf(ids), null);
|
||||
initFormCondition(model, cfg);
|
||||
}else{
|
||||
} else {
|
||||
initFormCondition(model, cfg);
|
||||
}
|
||||
|
||||
//查询ip复用地址池配置的policyGroup列表
|
||||
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.getHasAreaPolicyGroups(3);
|
||||
|
||||
// 查询ip复用地址池配置的policyGroup列表
|
||||
List<PolicyGroupInfo> policyGroups = policyGroupInfoService.getHasAreaPolicyGroups(3);
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/maintenance/ipMultiplexPool/form";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/saveOrUpdate"})
|
||||
@RequiresPermissions(value={"ip:mulitiplex:pool:config"})
|
||||
public String saveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@ModelAttribute("cfg")IpMultiplexPoolCfg cfg){
|
||||
try{
|
||||
|
||||
@RequestMapping(value = { "/saveOrUpdate" })
|
||||
@RequiresPermissions(value = { "ip:mulitiplex:pool:config" })
|
||||
public String saveOrUpdate(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes, @ModelAttribute("cfg") IpMultiplexPoolCfg cfg) {
|
||||
try {
|
||||
// 设置省份信息
|
||||
groupAreaService.setAreaCodeByGroupId(cfg);
|
||||
|
||||
|
||||
ipMultiplexPoolCfgService.saveOrUpdate(cfg);
|
||||
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "save_failed");
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/maintenance/ipMultiplexPoolCfg/list?functionId="+cfg.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/maintenance/ipMultiplexPoolCfg/list?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/list"})
|
||||
public String list(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")IpMultiplexPoolCfg entity){
|
||||
//查询时left join policyGroup
|
||||
Page<IpMultiplexPoolCfg> page = ipMultiplexPoolCfgService.findPage(new Page<IpMultiplexPoolCfg>(request, response,"r"), entity);
|
||||
|
||||
@RequestMapping(value = { "/list" })
|
||||
public String list(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") IpMultiplexPoolCfg entity) {
|
||||
// 查询时left join policyGroup
|
||||
Page<IpMultiplexPoolCfg> page = ipMultiplexPoolCfgService
|
||||
.findPage(new Page<IpMultiplexPoolCfg>(request, response, "r"), entity);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,entity);
|
||||
initPageCondition(model, entity);
|
||||
return "/cfg/maintenance/ipMultiplexPool/list";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/delete"})
|
||||
@RequiresPermissions(value={"ip:mulitiplex:pool:config"})
|
||||
public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId,Model model,RedirectAttributes redirectAttributes
|
||||
,HttpServletRequest request,HttpServletResponse response){
|
||||
try{
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipMultiplexPoolCfgService.delete(isAudit,isValid,ids,functionId);
|
||||
|
||||
@RequestMapping(value = { "/delete" })
|
||||
@RequiresPermissions(value = { "ip:mulitiplex:pool:config" })
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model,
|
||||
RedirectAttributes redirectAttributes, HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipMultiplexPoolCfgService.delete(isAudit, isValid, ids, functionId);
|
||||
}
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
}catch(Exception e){
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes,"error", "delete_failed");
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
return "redirect:" + adminPath +"/maintenance/ipMultiplexPoolCfg/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/maintenance/ipMultiplexPoolCfg/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/audit"})
|
||||
@RequiresPermissions(value={"ip:mulitiplex:pool:confirm"})
|
||||
public String audit(Integer isAudit,Integer isValid,String ids,Integer functionId,RedirectAttributes redirectAttributes) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
|
||||
@RequestMapping(value = { "/audit" })
|
||||
@RequiresPermissions(value = { "ip:mulitiplex:pool:confirm" })
|
||||
public String audit(Integer isAudit, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
Date auditTime = new Date();
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
ipMultiplexPoolCfgService.audit(isAudit,isValid,functionId,id,auditTime);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
ipMultiplexPoolCfgService.audit(isAudit, isValid, functionId, id, auditTime);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("IP复用地址池配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}catch (Exception e) {
|
||||
logger.info("IP复用地址池配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("IP复用地址池配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.info("IP复用地址池配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath +"/maintenance/ipMultiplexPoolCfg/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/maintenance/ipMultiplexPoolCfg/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/validCfgId")
|
||||
public boolean validCfgId(Long cfgId) {
|
||||
IpMultiplexPoolCfg dns=ipMultiplexPoolCfgService.getIpMultiplexPoolCfg(cfgId,null);
|
||||
if(dns == null ){
|
||||
IpMultiplexPoolCfg dns = ipMultiplexPoolCfgService.getIpMultiplexPoolCfg(cfgId, null);
|
||||
if (dns == null) {
|
||||
return false;
|
||||
}else{
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*@RequestMapping(value = {"/snatlist"})
|
||||
public String snatlist(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")IpMultiplexPoolCfg entity){
|
||||
//查询时left join policyGroup
|
||||
Page<IpMultiplexPoolCfg> page = ipMultiplexPoolCfgService.findPage(new Page<IpMultiplexPoolCfg>(request, response,"r"), entity);
|
||||
model.addAttribute("page", page);
|
||||
initFormCondition(model,entity);
|
||||
return "/cfg/maintenance/ipMultiplexPool/snatlist";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/snatform"})
|
||||
@RequiresPermissions(value={"ip:mulitiplex:pool:config"})
|
||||
public String snatfrom(Model model,
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
String ids,
|
||||
@ModelAttribute("cfg")IpMultiplexPoolCfg cfg){
|
||||
if(cfg == null){
|
||||
cfg=new IpMultiplexPoolCfg();
|
||||
}
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = ipMultiplexPoolCfgService.getIpMultiplexPoolCfg(Long.valueOf(ids),null);
|
||||
initUpdateFormCondition(model, cfg);
|
||||
}else{
|
||||
initFormCondition(model, cfg);
|
||||
}
|
||||
|
||||
//查询ip复用地址池配置的policyGroup列表
|
||||
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.getHasAreaPolicyGroups(2);
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/maintenance/ipMultiplexPool/snatform";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/snatsaveOrUpdate"})
|
||||
@RequiresPermissions(value={"ip:mulitiplex:pool:config"})
|
||||
public String snatsaveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@ModelAttribute("cfg")IpMultiplexPoolCfg cfg){
|
||||
try{
|
||||
// 设置省份信息
|
||||
if(!StringUtil.isEmpty(cfg.getPolicyGroup())){
|
||||
groupAreaService.setAreaCodeByGroupId(cfg);
|
||||
}
|
||||
ipMultiplexPoolCfgService.saveOrUpdate(cfg);
|
||||
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/maintenance/ipMultiplexPoolCfg/snatlist?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/snataudit"})
|
||||
@RequiresPermissions(value={"ip:mulitiplex:pool:confirm"})
|
||||
public String snataudit(Integer isAudit,Integer isValid,String ids,Integer functionId,RedirectAttributes redirectAttributes) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
try {
|
||||
ipMultiplexPoolCfgService.audit(isAudit,isValid,functionId,id,auditTime);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("SNAT地址池管理配置下发失败:"+e.getMessage());
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath +"/maintenance/ipMultiplexPoolCfg/snatlist?functionId="+functionId;
|
||||
}
|
||||
@RequestMapping(value = {"/snatdelete"})
|
||||
@RequiresPermissions(value={"ip:mulitiplex:pool:config"})
|
||||
public String snatdelete(Integer isAudit,Integer isValid,String ids,Integer functionId,Model model,RedirectAttributes redirectAttributes
|
||||
,HttpServletRequest request,HttpServletResponse response){
|
||||
try{
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipMultiplexPoolCfgService.delete(isAudit,isValid,ids,functionId);
|
||||
}
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
}catch(Exception e){
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
}
|
||||
return "redirect:" + adminPath +"/maintenance/ipMultiplexPoolCfg/snatlist?functionId="+functionId;
|
||||
}*/
|
||||
|
||||
|
||||
/*
|
||||
* @RequestMapping(value = {"/snatlist"}) public String snatlist(Model
|
||||
* model,HttpServletRequest request,HttpServletResponse
|
||||
* response,@ModelAttribute("cfg")IpMultiplexPoolCfg entity){ //查询时left join
|
||||
* policyGroup Page<IpMultiplexPoolCfg> page =
|
||||
* ipMultiplexPoolCfgService.findPage(new Page<IpMultiplexPoolCfg>(request,
|
||||
* response,"r"), entity); model.addAttribute("page", page);
|
||||
* initFormCondition(model,entity); return
|
||||
* "/cfg/maintenance/ipMultiplexPool/snatlist"; }
|
||||
*
|
||||
* @RequestMapping(value = {"/snatform"})
|
||||
*
|
||||
* @RequiresPermissions(value={"ip:mulitiplex:pool:config"}) public String
|
||||
* snatfrom(Model model, HttpServletRequest request, HttpServletResponse
|
||||
* response, String ids,
|
||||
*
|
||||
* @ModelAttribute("cfg")IpMultiplexPoolCfg cfg){ if(cfg == null){ cfg=new
|
||||
* IpMultiplexPoolCfg(); } if(!StringUtil.isEmpty(ids)){ cfg =
|
||||
* ipMultiplexPoolCfgService.getIpMultiplexPoolCfg(Long.valueOf(ids),null);
|
||||
* initUpdateFormCondition(model, cfg); }else{ initFormCondition(model,
|
||||
* cfg); }
|
||||
*
|
||||
* //查询ip复用地址池配置的policyGroup列表 List<PolicyGroupInfo>
|
||||
* policyGroups=policyGroupInfoService.getHasAreaPolicyGroups(2);
|
||||
* model.addAttribute("policyGroups", policyGroups);
|
||||
* model.addAttribute("_cfg", cfg); return
|
||||
* "/cfg/maintenance/ipMultiplexPool/snatform"; }
|
||||
*
|
||||
* @RequestMapping(value = {"/snatsaveOrUpdate"})
|
||||
*
|
||||
* @RequiresPermissions(value={"ip:mulitiplex:pool:config"}) public String
|
||||
* snatsaveOrUpdate(Model model,HttpServletRequest
|
||||
* request,HttpServletResponse response,RedirectAttributes
|
||||
* redirectAttributes,
|
||||
*
|
||||
* @ModelAttribute("cfg")IpMultiplexPoolCfg cfg){ try{ // 设置省份信息
|
||||
* if(!StringUtil.isEmpty(cfg.getPolicyGroup())){
|
||||
* groupAreaService.setAreaCodeByGroupId(cfg); }
|
||||
* ipMultiplexPoolCfgService.saveOrUpdate(cfg);
|
||||
*
|
||||
* addMessage(redirectAttributes,"success","save_success"); }catch(Exception
|
||||
* e){ e.printStackTrace(); if(e instanceof MaatConvertException) {
|
||||
* addMessage(redirectAttributes,"error", "request_service_failed"); }else {
|
||||
* addMessage(redirectAttributes,"error", "save_failed"); } }
|
||||
*
|
||||
* return "redirect:" + adminPath
|
||||
* +"/maintenance/ipMultiplexPoolCfg/snatlist?functionId="+cfg.getFunctionId
|
||||
* (); }
|
||||
*
|
||||
* @RequestMapping(value = {"/snataudit"})
|
||||
*
|
||||
* @RequiresPermissions(value={"ip:mulitiplex:pool:confirm"}) public String
|
||||
* snataudit(Integer isAudit,Integer isValid,String ids,Integer
|
||||
* functionId,RedirectAttributes redirectAttributes) {
|
||||
* if(!StringUtil.isEmpty(ids)){ String[] idArray = ids.split(","); Date
|
||||
* auditTime=new Date(); for(String id :idArray){ try {
|
||||
* ipMultiplexPoolCfgService.audit(isAudit,isValid,functionId,id,auditTime);
|
||||
* } catch (Exception e) { e.printStackTrace();
|
||||
* logger.error("SNAT地址池管理配置下发失败:"+e.getMessage()); if(e instanceof
|
||||
* MaatConvertException) { addMessage(redirectAttributes,"error",
|
||||
* "request_service_failed"); }else { addMessage(redirectAttributes,"error",
|
||||
* "audit_failed"); } } }
|
||||
*
|
||||
* } return "redirect:" + adminPath
|
||||
* +"/maintenance/ipMultiplexPoolCfg/snatlist?functionId="+functionId; }
|
||||
*
|
||||
* @RequestMapping(value = {"/snatdelete"})
|
||||
*
|
||||
* @RequiresPermissions(value={"ip:mulitiplex:pool:config"}) public String
|
||||
* snatdelete(Integer isAudit,Integer isValid,String ids,Integer
|
||||
* functionId,Model model,RedirectAttributes redirectAttributes
|
||||
* ,HttpServletRequest request,HttpServletResponse response){ try{
|
||||
* if(!StringUtil.isEmpty(ids)){
|
||||
* ipMultiplexPoolCfgService.delete(isAudit,isValid,ids,functionId); }
|
||||
* addMessage(redirectAttributes,"success","delete_success");
|
||||
* }catch(Exception e){ logger.error(e);
|
||||
* addMessage(redirectAttributes,"error","delete_failed"); } return
|
||||
* "redirect:" + adminPath
|
||||
* +"/maintenance/ipMultiplexPoolCfg/snatlist?functionId="+functionId; }
|
||||
*/
|
||||
|
||||
/**
|
||||
* 校验IP是否已存在
|
||||
*
|
||||
* @param cfg
|
||||
* @param redirectAttributes
|
||||
* @param request
|
||||
@@ -248,97 +235,143 @@ public class IpMultiplexPoolCfgController extends BaseController {
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = {"/checkIp"})
|
||||
public boolean checkIp(IpMultiplexPoolCfg cfg, HttpServletRequest request, HttpServletResponse response){
|
||||
@RequestMapping(value = { "/checkIp" })
|
||||
public boolean checkIp(IpMultiplexPoolCfg cfg, HttpServletRequest request, HttpServletResponse response) {
|
||||
// 修改
|
||||
if(!StringUtil.isEmpty(cfg.getCfgId())){
|
||||
if (!StringUtil.isEmpty(cfg.getCfgId())) {
|
||||
IpMultiplexPoolCfg poolCfg = ipMultiplexPoolCfgService.getCfgInfo(cfg);
|
||||
if(poolCfg != null && poolCfg.getDestIpAddress().equals(cfg.getDestIpAddress())){
|
||||
if (poolCfg != null && poolCfg.getDestIpAddress().equals(cfg.getDestIpAddress())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
cfg.setCfgId(null);
|
||||
IpMultiplexPoolCfg poolCfg = ipMultiplexPoolCfgService.getCfgInfo(cfg);
|
||||
if(poolCfg != null){
|
||||
if (poolCfg != null) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//snat配置导出
|
||||
@RequestMapping(value = "exportSnat")
|
||||
public void exportSnat(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")IpMultiplexPoolCfg 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>();
|
||||
|
||||
|
||||
/*//导出选中记录
|
||||
* if(!StringUtil.isEmpty(ids)){
|
||||
for(String id:ids.split(",")){
|
||||
Long.parseLong(id);
|
||||
}
|
||||
//List<CfgIndexInfo> list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids);
|
||||
}else{*/
|
||||
//条件导出数据大于最大导出数,只导出最大导出条数
|
||||
Page<IpMultiplexPoolCfg> pageInfo=new Page<IpMultiplexPoolCfg>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<IpMultiplexPoolCfg> page = ipMultiplexPoolCfgService.findPage(pageInfo, entity);
|
||||
page.setList(ipMultiplexPoolCfgService.getIsp(page.getList()));
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), IpMultiplexPoolCfg.class);
|
||||
String snatNoExport=",server_port,direction,protocol,do_log,whether_area_block,userregion1,userregion2,userregion3,userregion4,userregion5,group_name,";
|
||||
noExportMap.put(entity.getMenuNameCode(),snatNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), page.getList());
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("snat export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
// snat配置导出
|
||||
@RequestMapping(value = "exportSnat")
|
||||
public void exportSnat(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") IpMultiplexPoolCfg 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>();
|
||||
|
||||
/*
|
||||
* //导出选中记录 if(!StringUtil.isEmpty(ids)){ for(String
|
||||
* id:ids.split(",")){ Long.parseLong(id); } //List<CfgIndexInfo>
|
||||
* list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename()
|
||||
* , entity.getFunctionId(), ids); }else{
|
||||
*/
|
||||
// 条件导出数据大于最大导出数,只导出最大导出条数
|
||||
Page<IpMultiplexPoolCfg> pageInfo = new Page<IpMultiplexPoolCfg>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<IpMultiplexPoolCfg> page = ipMultiplexPoolCfgService.findPage(pageInfo, entity);
|
||||
page.setList(ipMultiplexPoolCfgService.getIsp(page.getList()));
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), IpMultiplexPoolCfg.class);
|
||||
String snatNoExport = ",server_port,direction,protocol,do_log,whether_area_block,userregion1,userregion2,userregion3,userregion4,userregion5,group_name,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
snatNoExport = ",config_time" + snatNoExport;
|
||||
}
|
||||
|
||||
//dnat配置导出
|
||||
@RequestMapping(value = "exportDnat")
|
||||
public void exportDnat(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")IpMultiplexPoolCfg 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>();
|
||||
|
||||
|
||||
/*//导出选中记录
|
||||
* if(!StringUtil.isEmpty(ids)){
|
||||
for(String id:ids.split(",")){
|
||||
Long.parseLong(id);
|
||||
}
|
||||
//List<CfgIndexInfo> list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids);
|
||||
}else{*/
|
||||
//条件导出数据大于最大导出数,只导出最大导出条数
|
||||
Page<IpMultiplexPoolCfg> pageInfo=new Page<IpMultiplexPoolCfg>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<IpMultiplexPoolCfg> page = ipMultiplexPoolCfgService.findPage(pageInfo, entity);
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), IpMultiplexPoolCfg.class);
|
||||
String snatNoExport=",isp,do_log,whether_area_block,userregion1,userregion2,userregion3,userregion4,userregion5,group_name,";
|
||||
noExportMap.put(entity.getMenuNameCode(),snatNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), page.getList());
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("dnat export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
snatNoExport = ",edit_time" + snatNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
snatNoExport = ",audit_time" + snatNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
snatNoExport = "," + entity.gethColumns() + "," + snatNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), snatNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), page.getList());
|
||||
|
||||
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("snat export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
// dnat配置导出
|
||||
@RequestMapping(value = "exportDnat")
|
||||
public void exportDnat(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") IpMultiplexPoolCfg 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>();
|
||||
|
||||
/*
|
||||
* //导出选中记录 if(!StringUtil.isEmpty(ids)){ for(String
|
||||
* id:ids.split(",")){ Long.parseLong(id); } //List<CfgIndexInfo>
|
||||
* list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename()
|
||||
* , entity.getFunctionId(), ids); }else{
|
||||
*/
|
||||
// 条件导出数据大于最大导出数,只导出最大导出条数
|
||||
Page<IpMultiplexPoolCfg> pageInfo = new Page<IpMultiplexPoolCfg>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<IpMultiplexPoolCfg> page = ipMultiplexPoolCfgService.findPage(pageInfo, entity);
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), IpMultiplexPoolCfg.class);
|
||||
String snatNoExport = ",isp,do_log,whether_area_block,userregion1,userregion2,userregion3,userregion4,userregion5,group_name,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
snatNoExport = ",config_time" + snatNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
snatNoExport = ",edit_time" + snatNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
snatNoExport = ",audit_time" + snatNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
snatNoExport = "," + entity.gethColumns() + "," + snatNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), snatNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), page.getList());
|
||||
/* } */
|
||||
|
||||
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("dnat export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,9 +23,14 @@ import com.google.common.collect.Maps;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.IpReuseIpCfg;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.UserManage;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@@ -352,4 +357,83 @@ public class UserManageController extends BaseController{
|
||||
model.addAttribute("user", user);
|
||||
return "/cfg/maintenance/userManage/userView";
|
||||
}*/
|
||||
// 配置导出
|
||||
@RequestMapping(value = "exportUser")
|
||||
public void exportbgp(Model model, HttpServletRequest request, HttpServletResponse response,String hColumns,String exType,
|
||||
@ModelAttribute("cfg") UserManage 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<UserManage> ipLists = new ArrayList<UserManage>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = userManageService.findByPage(ids);
|
||||
} else {
|
||||
Page<UserManage> pageInfo = new Page<UserManage>(request, response, "a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<UserManage> page = userManageService.findPage(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
titleList.add("user_manage");
|
||||
classMap.put("user_manage", UserManage.class);
|
||||
String cfgIndexInfoNoExport = ",";
|
||||
// 时间过滤
|
||||
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 (!StringUtil.isEmpty(hColumns)) {
|
||||
cfgIndexInfoNoExport = "," + hColumns + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
for (UserManage userManage : ipLists) {
|
||||
if(!StringUtils.isEmpty( userManage.getServerIp())){
|
||||
userManage.setServerIp(userManage.getServerIp().substring(0,userManage.getServerIp().length()-1));
|
||||
}
|
||||
}
|
||||
noExportMap.put("user_manage", cfgIndexInfoNoExport);
|
||||
dataMap.put("user_manage", ipLists);
|
||||
String timeRange = initUserMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(exType)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "user_manage", titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "user_manage", titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("user export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
public String initUserMap(UserManage cfg){
|
||||
Properties msgProp = getMsgProp();
|
||||
String titleTime=msgProp.getProperty("user_manage","user_manage");
|
||||
if(cfg.getSearch_create_time_start()!=null){
|
||||
titleTime+=" "+msgProp.getProperty("config_time")+":"+DateUtils.formatDateTime(cfg.getSearch_create_time_start());
|
||||
if(cfg.getSearch_create_time_end()!=null){
|
||||
titleTime+="—"+DateUtils.formatDateTime(cfg.getSearch_create_time_end());
|
||||
}else {
|
||||
titleTime+="—"+DateUtils.getDateTime();
|
||||
}
|
||||
}
|
||||
if(cfg.getSearch_edit_time_start()!=null){
|
||||
titleTime+=" "+msgProp.getProperty("edit_time")+":"+DateUtils.formatDateTime(cfg.getSearch_edit_time_start());
|
||||
if(cfg.getSearch_edit_time_end()!=null){
|
||||
titleTime+="—"+DateUtils.formatDateTime(cfg.getSearch_edit_time_end());
|
||||
}else{
|
||||
titleTime+="—"+DateUtils.getDateTime();
|
||||
}
|
||||
}
|
||||
return titleTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,165 +39,189 @@ import com.nis.web.security.UserUtils;
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/manipulation/ddos")
|
||||
public class DdosCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = {"/list"})
|
||||
public String list(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")DdosIpCfg entity){
|
||||
Page<DdosIpCfg> page = ddosCfgService.findPage(new Page<DdosIpCfg>(request, response,"r"), entity);
|
||||
|
||||
@RequestMapping(value = { "/list" })
|
||||
public String list(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") DdosIpCfg entity) {
|
||||
Page<DdosIpCfg> page = ddosCfgService.findPage(new Page<DdosIpCfg>(request, response, "r"), entity);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,entity);
|
||||
initPageCondition(model, entity);
|
||||
return "/cfg/ddosIpCfgList";
|
||||
}
|
||||
@RequestMapping(value = {"/form"})
|
||||
@RequiresPermissions(value={"ddos:ip:config"})
|
||||
public String form(Model model,HttpServletRequest request,HttpServletResponse response,String ids,@ModelAttribute("cfg")DdosIpCfg cfg){
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = ddosCfgService.getDdosIpCfg(Long.parseLong(ids),null);
|
||||
|
||||
@RequestMapping(value = { "/form" })
|
||||
@RequiresPermissions(value = { "ddos:ip:config" })
|
||||
public String form(Model model, HttpServletRequest request, HttpServletResponse response, String ids,
|
||||
@ModelAttribute("cfg") DdosIpCfg cfg) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
cfg = ddosCfgService.getDdosIpCfg(Long.parseLong(ids), null);
|
||||
initUpdateFormCondition(model, cfg);
|
||||
}else{
|
||||
initFormCondition(model,cfg);
|
||||
} else {
|
||||
initFormCondition(model, cfg);
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/ddosIpCfgForm";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/saveOrUpdate"})
|
||||
@RequiresPermissions(value={"ddos:ip:config"})
|
||||
public String saveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")DdosIpCfg cfg, RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
|
||||
@RequestMapping(value = { "/saveOrUpdate" })
|
||||
@RequiresPermissions(value = { "ddos:ip:config" })
|
||||
public String saveOrUpdate(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") DdosIpCfg cfg, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
ddosCfgService.saveOrUpdate(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("信息保存失败", e);
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/manipulation/ddos/list?functionId="+cfg.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/manipulation/ddos/list?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/delete"})
|
||||
@RequiresPermissions(value={"ddos:ip:config"})
|
||||
public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
ddosCfgService.delete(isAudit,isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/manipulation/ddos/list?functionId="+functionId;
|
||||
|
||||
@RequestMapping(value = { "/delete" })
|
||||
@RequiresPermissions(value = { "ddos:ip:config" })
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId) {
|
||||
ddosCfgService.delete(isAudit, isValid, ids, functionId);
|
||||
return "redirect:" + adminPath + "/manipulation/ddos/list?functionId=" + functionId;
|
||||
}
|
||||
@RequestMapping(value = {"/audit"})
|
||||
//@RequiresPermissions(value={"ddos:ip:confirm"})
|
||||
public String audit(Model model,@ModelAttribute("cfg")DdosIpCfg cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
|
||||
@RequestMapping(value = { "/audit" })
|
||||
// @RequiresPermissions(value={"ddos:ip:confirm"})
|
||||
public String audit(Model model, @ModelAttribute("cfg") DdosIpCfg cfg, Integer isValid, Integer isAudit, String ids,
|
||||
Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
Date auditTime = new Date();
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
ddosCfgService.audit(isAudit,isValid,functionId,id,auditTime);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
ddosCfgService.audit(isAudit, isValid, functionId, id, auditTime);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("dns fake ip配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
logger.info("dns fake ip配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("dns fake ip配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes,"error","audit_failed");
|
||||
logger.info("dns fake ip配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}else {
|
||||
Page<DdosIpCfg> searchPage=new Page<DdosIpCfg>(request,response,"r");
|
||||
Page<DdosIpCfg> auditPage=new Page<DdosIpCfg>(request,response,"r");
|
||||
|
||||
} else {
|
||||
Page<DdosIpCfg> searchPage = new Page<DdosIpCfg>(request, response, "r");
|
||||
Page<DdosIpCfg> auditPage = new Page<DdosIpCfg>(request, response, "r");
|
||||
|
||||
try {
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
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");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return list(model, request, response, cfg);
|
||||
}
|
||||
return "redirect:" + adminPath +"/manipulation/ddos/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/manipulation/ddos/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
//ddos配置导出
|
||||
|
||||
// ddos配置导出
|
||||
@RequestMapping(value = "exportDdos")
|
||||
public void exportddos(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")DdosIpCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
public void exportddos(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") DdosIpCfg 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<DdosIpCfg> ipLists=new ArrayList<DdosIpCfg>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=ddosCfgService.findByPage(ids);
|
||||
}else{
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<DdosIpCfg> pageInfo=new Page<DdosIpCfg>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<DdosIpCfg> page = ddosCfgService.findPage(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
}
|
||||
/*//导出选中记录
|
||||
* if(!StringUtil.isEmpty(ids)){
|
||||
for(String id:ids.split(",")){
|
||||
Long.parseLong(id);
|
||||
}
|
||||
//List<CfgIndexInfo> list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids);
|
||||
}else{*/
|
||||
//条件导出数据大于最大导出数,只导出最大导出条数
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), DdosIpCfg.class);
|
||||
String cfgIndexInfoNoExport=",do_log,client_ip,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
// 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<DdosIpCfg> ipLists = new ArrayList<DdosIpCfg>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = ddosCfgService.findByPage(ids);
|
||||
} else {
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<DdosIpCfg> pageInfo = new Page<DdosIpCfg>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<DdosIpCfg> page = ddosCfgService.findPage(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
/*
|
||||
* //导出选中记录 if(!StringUtil.isEmpty(ids)){ for(String
|
||||
* id:ids.split(",")){ Long.parseLong(id); } //List<CfgIndexInfo>
|
||||
* list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename()
|
||||
* , entity.getFunctionId(), ids); }else{
|
||||
*/
|
||||
// 条件导出数据大于最大导出数,只导出最大导出条数
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), DdosIpCfg.class);
|
||||
String cfgIndexInfoNoExport = ",do_log,client_ip,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("ddos export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
logger.error("ddos export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据索引表信息异步获取子表信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"/ajaxDdosInfo"})
|
||||
public String getDdosInfo(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
@RequestMapping(value = { "/ajaxDdosInfo" })
|
||||
public String getDdosInfo(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
DdosIpCfg cfg = ddosCfgService.getDdosIpCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
//获取DdosIpCfg信息
|
||||
String cfgType = null;
|
||||
if(!cfg.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",cfg.getCfgType()});
|
||||
cfgType = cfg.getCfgType();
|
||||
}
|
||||
|
||||
model.addAttribute("_cfg", cfg);
|
||||
// 获取DdosIpCfg信息
|
||||
String cfgType = null;
|
||||
if (!cfg.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "1", cfg.getCfgType() });
|
||||
cfgType = cfg.getCfgType();
|
||||
}
|
||||
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/ddosSubList";
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.nis.domain.Page;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.IpAddrPoolCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.IpReuseDnatPolicyCfg;
|
||||
@@ -46,101 +47,116 @@ import com.nis.web.controller.configuration.CommonController;
|
||||
import com.nis.web.service.configuration.IpMultiplexService;
|
||||
|
||||
/**
|
||||
* @ClassName: ControlController.java
|
||||
* @ClassName: ControlController.java
|
||||
* @Description: TODO
|
||||
* @author (dell)
|
||||
* @date 2018年6月22日 下午4:35:42
|
||||
* @version V1.0
|
||||
*/
|
||||
@Controller
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/manipulation/ipmulitiplex")
|
||||
public class IpMultiplexController extends CommonController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private IpMultiplexService ipMultiplexService;
|
||||
|
||||
@RequestMapping(value = {"/list"})
|
||||
// @RequiresPermissions(value={"ip:mulitiplex:config","ip:mulitiplex:confirm"},logical=Logical.OR)
|
||||
public String ipList(String cfgName,Model model,@ModelAttribute("cfg")IpPortCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
this._ipList(cfgName,model, cfg, request, response);
|
||||
model.addAttribute("urlPrefix","/manipulation/ipmulitiplex");
|
||||
model.addAttribute("requiresPermissionPrefix","ip:mulitiplex");
|
||||
|
||||
@RequestMapping(value = { "/list" })
|
||||
// @RequiresPermissions(value={"ip:mulitiplex:config","ip:mulitiplex:confirm"},logical=Logical.OR)
|
||||
public String ipList(String cfgName, Model model, @ModelAttribute("cfg") IpPortCfg cfg, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
this._ipList(cfgName, model, cfg, request, response);
|
||||
model.addAttribute("urlPrefix", "/manipulation/ipmulitiplex");
|
||||
model.addAttribute("requiresPermissionPrefix", "ip:mulitiplex");
|
||||
return "/cfg/common/ipList";
|
||||
}
|
||||
@RequestMapping(value = {"/form"})
|
||||
@RequiresPermissions(value={"ip:mulitiplex:config"})
|
||||
public String ipForm(String cfgName,Model model,String ids,Integer functionId,BaseIpCfg entity) {
|
||||
this._ipForm(cfgName,model, ids, functionId, entity);
|
||||
SysDataDictionaryItem dict=null;
|
||||
List<SysDataDictionaryItem> dictList= DictUtils.getDictList("GROUP_TYPE");
|
||||
for(SysDataDictionaryItem di:dictList){
|
||||
if("IP".equals(di.getItemValue())){
|
||||
dict=di;
|
||||
|
||||
@RequestMapping(value = { "/form" })
|
||||
@RequiresPermissions(value = { "ip:mulitiplex:config" })
|
||||
public String ipForm(String cfgName, Model model, String ids, Integer functionId, BaseIpCfg entity) {
|
||||
this._ipForm(cfgName, model, ids, functionId, entity);
|
||||
SysDataDictionaryItem dict = null;
|
||||
List<SysDataDictionaryItem> dictList = DictUtils.getDictList("GROUP_TYPE");
|
||||
for (SysDataDictionaryItem di : dictList) {
|
||||
if ("IP".equals(di.getItemValue())) {
|
||||
dict = di;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(dict!=null){
|
||||
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(Integer.parseInt(dict.getItemCode()));
|
||||
if (dict != null) {
|
||||
List<PolicyGroupInfo> policyGroups = policyGroupInfoService
|
||||
.findPolicyGroupInfosByType(Integer.parseInt(dict.getItemCode()));
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
}
|
||||
model.addAttribute("urlPrefix","/manipulation/ipmulitiplex");
|
||||
model.addAttribute("requiresPermissionPrefix","ip:mulitiplex");
|
||||
model.addAttribute("urlPrefix", "/manipulation/ipmulitiplex");
|
||||
model.addAttribute("requiresPermissionPrefix", "ip:mulitiplex");
|
||||
return "/cfg/manipulation/ipmulitiplex/form";
|
||||
}
|
||||
@RequestMapping(value = {"/saveOrUpdate"})
|
||||
public String saveOrUpdateIp(String cfgName,RedirectAttributes model, IpPortCfg cfg) {
|
||||
this._saveOrUpdateIp(cfgName,model, cfg);
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/list?functionId="+cfg.getFunctionId();
|
||||
|
||||
@RequestMapping(value = { "/saveOrUpdate" })
|
||||
public String saveOrUpdateIp(String cfgName, RedirectAttributes model, IpPortCfg cfg) {
|
||||
this._saveOrUpdateIp(cfgName, model, cfg);
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/list?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"/delete"})
|
||||
|
||||
@RequestMapping(value = { "/delete" })
|
||||
@RequiresPermissions("ip:mulitiplex:config")
|
||||
public String deleteIp(String cfgName,String ids,String compileIds,Integer functionId,RedirectAttributes model) {
|
||||
this._deleteIp(cfgName,ids, compileIds, functionId, model);
|
||||
model.addAttribute("urlPrefix","/proxy/ipmulitiplex");
|
||||
model.addAttribute("requiresPermissionPrefix","ip:mulitiplex");
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/list?functionId="+functionId;
|
||||
public String deleteIp(String cfgName, String ids, String compileIds, Integer functionId,
|
||||
RedirectAttributes model) {
|
||||
this._deleteIp(cfgName, ids, compileIds, functionId, model);
|
||||
model.addAttribute("urlPrefix", "/proxy/ipmulitiplex");
|
||||
model.addAttribute("requiresPermissionPrefix", "ip:mulitiplex");
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/list?functionId=" + functionId;
|
||||
}
|
||||
@RequestMapping(value = {"/audit"})
|
||||
|
||||
@RequestMapping(value = { "/audit" })
|
||||
@RequiresPermissions("ip:mulitiplex:confirm")
|
||||
public String auditIp(String cfgName,String ids,IpPortCfg cfg,RedirectAttributes redirectAttributes) {
|
||||
this._auditIp(cfgName,ids, cfg, redirectAttributes);
|
||||
redirectAttributes.addAttribute("urlPrefix","/manipulation/ipmulitiplex");
|
||||
redirectAttributes.addAttribute("requiresPermissionPrefix","ip:mulitiplex");
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/list?functionId="+cfg.getFunctionId();
|
||||
public String auditIp(String cfgName, String ids, IpPortCfg cfg, RedirectAttributes redirectAttributes) {
|
||||
this._auditIp(cfgName, ids, cfg, redirectAttributes);
|
||||
redirectAttributes.addAttribute("urlPrefix", "/manipulation/ipmulitiplex");
|
||||
redirectAttributes.addAttribute("requiresPermissionPrefix", "ip:mulitiplex");
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/list?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
//ip配置导入
|
||||
/*@RequestMapping(value = "/import", method=RequestMethod.POST)
|
||||
public String importIp(String cfgName,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("file") MultipartFile file,IpPortCfg cfg) {
|
||||
this._importIp(cfgName,redirectAttributes, file,cfg,IpMultiplexPolicyTemplate.class);
|
||||
redirectAttributes.addAttribute("urlPrefix","/manipulation/ipmulitiplex");
|
||||
redirectAttributes.addAttribute("requiresPermissionPrefix","ip:mulitiplex");
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/list?functionId="+cfg.getFunctionId();
|
||||
}*/
|
||||
//ip模板下载
|
||||
|
||||
// ip配置导入
|
||||
/*
|
||||
* @RequestMapping(value = "/import", method=RequestMethod.POST) public
|
||||
* String importIp(String cfgName,RedirectAttributes redirectAttributes,
|
||||
*
|
||||
* @RequestParam("file") MultipartFile file,IpPortCfg cfg) {
|
||||
* this._importIp(cfgName,redirectAttributes,
|
||||
* file,cfg,IpMultiplexPolicyTemplate.class);
|
||||
* redirectAttributes.addAttribute("urlPrefix","/manipulation/ipmulitiplex")
|
||||
* ; redirectAttributes.addAttribute("requiresPermissionPrefix",
|
||||
* "ip:mulitiplex"); return "redirect:" + adminPath
|
||||
* +"/manipulation/ipmulitiplex/list?functionId="+cfg.getFunctionId(); }
|
||||
*/
|
||||
// ip模板下载
|
||||
@RequestMapping(value = "import/template")
|
||||
public void importFileTemplate(HttpServletRequest request,HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode) {
|
||||
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,IpMultiplexPolicyTemplate.class);
|
||||
public void importFileTemplate(HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes, Integer functionId, Integer cfgRegionCode) {
|
||||
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,
|
||||
IpMultiplexPolicyTemplate.class);
|
||||
}
|
||||
//ip配置导出
|
||||
|
||||
// ip配置导出
|
||||
@RequestMapping(value = "export")
|
||||
public void exportIp(String columns,Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")IpPortCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
this._exportIp(columns,model, request, response, entity, ids, redirectAttributes);
|
||||
public void exportIp(String columns, Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") IpPortCfg entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
this._exportIp(columns, model, request, response, entity, ids, redirectAttributes);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* IP复用策略拆分为SNAT/DNAT复用策略
|
||||
*/
|
||||
@RequestMapping(value = {"/snatPolicyList"})
|
||||
public String snatPolicyList(Model model,@ModelAttribute("cfg")IpReusePolicyCfg cfg,
|
||||
HttpServletRequest request,HttpServletResponse response) {
|
||||
|
||||
Page<IpReusePolicyCfg> page = ipMultiplexService.findPage(new Page<IpReusePolicyCfg>(request, response,"r"), cfg);
|
||||
@RequestMapping(value = { "/snatPolicyList" })
|
||||
public String snatPolicyList(Model model, @ModelAttribute("cfg") IpReusePolicyCfg cfg, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
|
||||
Page<IpReusePolicyCfg> page = ipMultiplexService.findPage(new Page<IpReusePolicyCfg>(request, response, "r"),
|
||||
cfg);
|
||||
model.addAttribute("page", page);
|
||||
initFormCondition(model,cfg);
|
||||
|
||||
initFormCondition(model, cfg);
|
||||
|
||||
// 获取地址池、用户信息
|
||||
List<UserManage> users = userManageService.findUsers();
|
||||
List<IpAddrPoolCfg> addrPools = ipAddrPoolCfgService.getEffectiveAddrPool();
|
||||
@@ -148,357 +164,406 @@ public class IpMultiplexController extends CommonController {
|
||||
model.addAttribute("addrPools", addrPools);
|
||||
return "/cfg/manipulation/ipmulitiplex/snatPolicyList2";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/snatPolicyForm"})
|
||||
@RequiresPermissions(value={"snat_policy:config"})
|
||||
public String snatPolicyForm(Model model, String ids, IpReusePolicyCfg cfg,
|
||||
HttpServletRequest request,HttpServletResponse response) {
|
||||
if(cfg == null){
|
||||
cfg=new IpReusePolicyCfg();
|
||||
|
||||
@RequestMapping(value = { "/snatPolicyForm" })
|
||||
@RequiresPermissions(value = { "snat_policy:config" })
|
||||
public String snatPolicyForm(Model model, String ids, IpReusePolicyCfg cfg, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
if (cfg == null) {
|
||||
cfg = new IpReusePolicyCfg();
|
||||
}
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = ipMultiplexService.getPolicyCfg(Long.valueOf(ids),null);
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
cfg = ipMultiplexService.getPolicyCfg(Long.valueOf(ids), null);
|
||||
initUpdateFormCondition(model, cfg);
|
||||
}else{
|
||||
} else {
|
||||
initFormCondition(model, cfg);
|
||||
}
|
||||
|
||||
|
||||
// 获取用户信息 地址池信息
|
||||
List<UserManage> users = userManageService.findUsers();
|
||||
|
||||
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("users", users);
|
||||
model.addAttribute("urlPrefix","/manipulation/ipmulitiplex");
|
||||
model.addAttribute("urlPrefix", "/manipulation/ipmulitiplex");
|
||||
return "/cfg/manipulation/ipmulitiplex/snatPolicyForm2";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/saveOrUpdateSnat"})
|
||||
public String saveOrUpdateSnat(Model model, HttpServletRequest request,HttpServletResponse response,
|
||||
|
||||
@RequestMapping(value = { "/saveOrUpdateSnat" })
|
||||
public String saveOrUpdateSnat(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes, IpReusePolicyCfg cfg) {
|
||||
try{
|
||||
try {
|
||||
// 添加策略配置信息
|
||||
ipMultiplexService.saveOrUpdate(cfg, request, response);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "save_failed");
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/snatPolicyList?functionId="+cfg.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/snatPolicyList?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/snatDelete"})
|
||||
|
||||
@RequestMapping(value = { "/snatDelete" })
|
||||
@RequiresPermissions("snat_policy:config")
|
||||
public String snatDelete(String ids, Integer isValid, Integer functionId,RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request,HttpServletResponse response) {
|
||||
|
||||
try{
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipMultiplexService.delete(isValid,ids,functionId);
|
||||
public String snatDelete(String ids, Integer isValid, Integer functionId, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipMultiplexService.delete(isValid, ids, functionId);
|
||||
}
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
}catch(Exception e){
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/snatPolicyList?functionId="+functionId;
|
||||
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/snatPolicyList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/auditSnat"})
|
||||
|
||||
@RequestMapping(value = { "/auditSnat" })
|
||||
@RequiresPermissions("snat_policy:confirm")
|
||||
public String auditSnat(String ids,Integer isAudit,Integer isValid,Integer functionId,RedirectAttributes redirectAttributes) {
|
||||
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
public String auditSnat(String ids, Integer isAudit, Integer isValid, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
Date auditTime = new Date();
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
ipMultiplexService.auditSnatPolicy(isAudit,isValid,functionId,id,auditTime);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
ipMultiplexService.auditSnatPolicy(isAudit, isValid, functionId, id, auditTime);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("SNAT策略配置下发失败:"+e.getMessage());
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("SNAT策略配置下发失败:" + e.getMessage());
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/snatPolicyList?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/snatPolicyList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = {"/ajaxSnatInfo"})
|
||||
public String ajaxSnatInfo(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
|
||||
@RequestMapping(value = { "/ajaxSnatInfo" })
|
||||
public String ajaxSnatInfo(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
IpReusePolicyCfg cfg = ipMultiplexService.getSnatCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
String cfgType = null;
|
||||
if(!cfg.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",cfg.getCfgType()});
|
||||
cfgType = cfg.getCfgType();
|
||||
}
|
||||
|
||||
String cfgType = null;
|
||||
if (!cfg.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "1", cfg.getCfgType() });
|
||||
cfgType = cfg.getCfgType();
|
||||
}
|
||||
|
||||
List<UserManage> users = userManageService.findUsers();
|
||||
List<IpAddrPoolCfg> addrPools = ipAddrPoolCfgService.getEffectiveAddrPool();
|
||||
model.addAttribute("users", users);
|
||||
model.addAttribute("addrPools", addrPools);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/manipulation/ipmulitiplex/snatSubList";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = {"/ajaxDnatInfo"})
|
||||
public String ajaxDnatInfo(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
|
||||
@RequestMapping(value = { "/ajaxDnatInfo" })
|
||||
public String ajaxDnatInfo(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
IpReuseDnatPolicyCfg cfg = ipMultiplexService.getDnatCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
String cfgType = null;
|
||||
if(!cfg.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",cfg.getCfgType()});
|
||||
cfgType = cfg.getCfgType();
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
String cfgType = null;
|
||||
if (!cfg.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "1", cfg.getCfgType() });
|
||||
cfgType = cfg.getCfgType();
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/manipulation/ipmulitiplex/dnatSubList";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 异步获取地址池信息
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = {"/ajaxGetAddrPools"})
|
||||
public List<IpAddrPoolCfg> ajaxGetAddrPools(HttpServletRequest request, HttpServletResponse response){
|
||||
@RequestMapping(value = { "/ajaxGetAddrPools" })
|
||||
public List<IpAddrPoolCfg> ajaxGetAddrPools(HttpServletRequest request, HttpServletResponse response) {
|
||||
List<IpAddrPoolCfg> addrPools = ipAddrPoolCfgService.getEffectiveAddrPool();
|
||||
List<IpAddrPoolCfg> addrPoolsNew=new ArrayList<>();
|
||||
List<IpAddrPoolCfg> addrPoolsNew = new ArrayList<>();
|
||||
for (IpAddrPoolCfg addrPool : addrPools) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("addr_pool_id", addrPool.getCfgId());
|
||||
String url =Constants.IP_REUSE_CALL_CGI_URL ;
|
||||
Map<String, Object> resultMap=ConfigServiceUtil.getCGIInfo(url, Constants.IP_NUM_GET, params);
|
||||
if(!StringUtil.isEmpty(resultMap)
|
||||
&& !StringUtil.isEmpty(resultMap.get("num"))
|
||||
String url = Constants.IP_REUSE_CALL_CGI_URL;
|
||||
Map<String, Object> resultMap = ConfigServiceUtil.getCGIInfo(url, Constants.IP_NUM_GET, params);
|
||||
if (!StringUtil.isEmpty(resultMap) && !StringUtil.isEmpty(resultMap.get("num"))
|
||||
&& Integer.parseInt(resultMap.get("num").toString()) > 0) {
|
||||
addrPoolsNew.add(addrPool);
|
||||
}
|
||||
}
|
||||
return addrPoolsNew;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验地址池是否被策略引用
|
||||
*
|
||||
* @param addrPoolIds
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = {"/ajaxIsUsed"})
|
||||
public boolean ajaxIsUsed(String addrPoolIds, HttpServletRequest request, HttpServletResponse response){
|
||||
@RequestMapping(value = { "/ajaxIsUsed" })
|
||||
public boolean ajaxIsUsed(String addrPoolIds, HttpServletRequest request, HttpServletResponse response) {
|
||||
for (String addrPoolId : addrPoolIds.split(",")) {
|
||||
List<IpReusePolicyCfg> ipList = ipMultiplexService.checkAddrPoolIsUsed(addrPoolId);
|
||||
if(ipList != null && ipList.size() > 0){
|
||||
if (ipList != null && ipList.size() > 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = {"/dnatPolicyList"})
|
||||
public String dnatPolicyList(String cfgName,Model model,@ModelAttribute("cfg")IpReuseDnatPolicyCfg cfg,
|
||||
HttpServletRequest request,HttpServletResponse response) {
|
||||
//this._ipList(cfgName,model, cfg, request, response);
|
||||
|
||||
Page<BaseIpCfg> page = ipMultiplexService.findPageDnat(new Page<BaseIpCfg>(request, response,"r"), cfg);
|
||||
|
||||
@RequestMapping(value = { "/dnatPolicyList" })
|
||||
public String dnatPolicyList(String cfgName, Model model, @ModelAttribute("cfg") IpReuseDnatPolicyCfg cfg,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
// this._ipList(cfgName,model, cfg, request, response);
|
||||
|
||||
Page<BaseIpCfg> page = ipMultiplexService.findPageDnat(new Page<BaseIpCfg>(request, response, "r"), cfg);
|
||||
model.addAttribute("page", page);
|
||||
initFormCondition(model,cfg);
|
||||
|
||||
initFormCondition(model, cfg);
|
||||
|
||||
return "/cfg/manipulation/ipmulitiplex/dnatPolicyList2";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/dnatPolicyForm"})
|
||||
@RequiresPermissions(value={"dnat_policy:config"})
|
||||
public String dnatPolicyForm(String cfgName,Model model,String ids,Integer functionId,IpReuseDnatPolicyCfg cfg) {
|
||||
//this._ipForm(cfgName,model, ids, functionId, entity);
|
||||
|
||||
if(cfg == null){
|
||||
cfg=new IpReuseDnatPolicyCfg();
|
||||
|
||||
@RequestMapping(value = { "/dnatPolicyForm" })
|
||||
@RequiresPermissions(value = { "dnat_policy:config" })
|
||||
public String dnatPolicyForm(String cfgName, Model model, String ids, Integer functionId,
|
||||
IpReuseDnatPolicyCfg cfg) {
|
||||
// this._ipForm(cfgName,model, ids, functionId, entity);
|
||||
|
||||
if (cfg == null) {
|
||||
cfg = new IpReuseDnatPolicyCfg();
|
||||
}
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = ipMultiplexService.getDnatPolicyCfg(Long.valueOf(ids),null);
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
cfg = ipMultiplexService.getDnatPolicyCfg(Long.valueOf(ids), null);
|
||||
initUpdateFormCondition(model, cfg);
|
||||
}else{
|
||||
} else {
|
||||
initFormCondition(model, cfg);
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/manipulation/ipmulitiplex/dnatPolicyForm2";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/saveOrUpdateDnat"})
|
||||
|
||||
@RequestMapping(value = { "/saveOrUpdateDnat" })
|
||||
public String saveOrUpdateDnat(Model model, RedirectAttributes redirectAttributes, IpReuseDnatPolicyCfg cfg,
|
||||
HttpServletRequest request,HttpServletResponse response) {
|
||||
try{
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
// 添加策略配置信息
|
||||
ipMultiplexService.saveOrUpdateDnat(cfg, request, response);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e) {
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "save_failed");
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/dnatPolicyList?functionId="+cfg.getFunctionId();
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/dnatPolicyList?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/dnatDelete"})
|
||||
|
||||
@RequestMapping(value = { "/dnatDelete" })
|
||||
@RequiresPermissions("dnat_policy:config")
|
||||
public String dnatDelete(String ids, Integer isValid, Integer functionId,RedirectAttributes redirectAttributes) {
|
||||
//this._deleteIp(cfgName,ids, compileIds, functionId, model);
|
||||
|
||||
try{
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipMultiplexService.deleteDnat(isValid,ids,functionId);
|
||||
public String dnatDelete(String ids, Integer isValid, Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
// this._deleteIp(cfgName,ids, compileIds, functionId, model);
|
||||
|
||||
try {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipMultiplexService.deleteDnat(isValid, ids, functionId);
|
||||
}
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
}catch(Exception e){
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/dnatPolicyList?functionId="+functionId;
|
||||
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/dnatPolicyList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/auditDnat"})
|
||||
|
||||
@RequestMapping(value = { "/auditDnat" })
|
||||
@RequiresPermissions("dnat_policy:confirm")
|
||||
public String auditDnat(String ids,Integer isAudit,Integer isValid,Integer functionId,RedirectAttributes redirectAttributes) {
|
||||
//this._auditIp(cfgName,ids, cfg, redirectAttributes);
|
||||
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
public String auditDnat(String ids, Integer isAudit, Integer isValid, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
// this._auditIp(cfgName,ids, cfg, redirectAttributes);
|
||||
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
Date auditTime = new Date();
|
||||
for (String id : idArray) {
|
||||
try {
|
||||
ipMultiplexService.auditDnatPolicy(isAudit,isValid,functionId,id,auditTime);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
ipMultiplexService.auditDnatPolicy(isAudit, isValid, functionId, id, auditTime);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("DNAT策略配置下发失败:"+e.getMessage());
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("DNAT策略配置下发失败:" + e.getMessage());
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/dnatPolicyList?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/dnatPolicyList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
//snat配置导出
|
||||
@RequestMapping(value = "exportSnat")
|
||||
public void exportSnat(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")BaseIpCfg 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>();
|
||||
Properties msgProp = getMsgProp();
|
||||
|
||||
/*//导出选中记录
|
||||
* if(!StringUtil.isEmpty(ids)){
|
||||
for(String id:ids.split(",")){
|
||||
Long.parseLong(id);
|
||||
}
|
||||
//List<CfgIndexInfo> list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids);
|
||||
}else{*/
|
||||
//条件导出数据大于最大导出数,只导出最大导出条数
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<BaseIpCfg> pageInfo=new Page<BaseIpCfg>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<BaseIpCfg> page = ipCfgService.findPage(pageInfo, entity);//
|
||||
for (BaseIpCfg baseIp : page.getList()) {
|
||||
if(StringUtil.isEmpty(baseIp.getGroupName())){
|
||||
baseIp.setGroupName(msgProp.getProperty("default_group"));
|
||||
}
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), BaseIpCfg.class);
|
||||
String snatNoExport=",client_ip,group_name,server_ip,ip_type,ip_pattern,port_pattern,client_port,server_port,ir_type,direction,protocol,do_log,whether_area_block,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
noExportMap.put(entity.getMenuNameCode(),snatNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), page.getList());
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("snat export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
// snat配置导出
|
||||
@RequestMapping(value = "exportSnat")
|
||||
public void exportSnat(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") IpReusePolicyCfg 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>();
|
||||
Properties msgProp = getMsgProp();
|
||||
// 导出选中记录
|
||||
List<IpReusePolicyCfg> ipLists = new ArrayList<IpReusePolicyCfg>();
|
||||
|
||||
|
||||
//dnat配置导出
|
||||
@RequestMapping(value = "exportDnat")
|
||||
public void exportDnat(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")BaseIpCfg 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>();
|
||||
Properties msgProp = getMsgProp();
|
||||
|
||||
/*//导出选中记录
|
||||
* if(!StringUtil.isEmpty(ids)){
|
||||
for(String id:ids.split(",")){
|
||||
Long.parseLong(id);
|
||||
}
|
||||
//List<CfgIndexInfo> list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids);
|
||||
}else{*/
|
||||
//条件导出数据大于最大导出数,只导出最大导出条数
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<BaseIpCfg> pageInfo=new Page<BaseIpCfg>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<BaseIpCfg> page = ipCfgService.findPage(pageInfo, entity);//
|
||||
for (BaseIpCfg baseIp : page.getList()) {
|
||||
if(StringUtil.isEmpty(baseIp.getGroupName())){
|
||||
baseIp.setGroupName(msgProp.getProperty("default_group"));
|
||||
}
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), BaseIpCfg.class);
|
||||
String snatNoExport=",direction,client_ip,ip_type,ip_pattern,port_pattern,client_port,ir_type,do_log,whether_area_block,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
noExportMap.put(entity.getMenuNameCode(),snatNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), page.getList());
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("dnat export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = ipMultiplexService.findByPage(ids);
|
||||
} else {
|
||||
Page<IpReusePolicyCfg> pageInfo = new Page<IpReusePolicyCfg>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<IpReusePolicyCfg> page = ipMultiplexService.findPage(pageInfo,entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
List<IpAddrPoolCfg> addrPools = ipAddrPoolCfgService.getEffectiveAddrPool();
|
||||
for (IpReusePolicyCfg ipReusePolicyCfg : ipLists) {
|
||||
if(ipReusePolicyCfg.getAddrPoolId()!=null){
|
||||
for (IpAddrPoolCfg addr : addrPools) {
|
||||
if(ipReusePolicyCfg.getAddrPoolId()==addr.getCfgId().intValue()){
|
||||
ipReusePolicyCfg.setAddrPoolName(addr.getAddrPoolName());
|
||||
}
|
||||
}
|
||||
}
|
||||
if(ipReusePolicyCfg.getUserType().equals("VPN")){
|
||||
ipReusePolicyCfg.setUserType(msgProp.getProperty("policy_vpn_user","VPN"));
|
||||
}else if(ipReusePolicyCfg.getUserType().equals("SIPv4")){
|
||||
ipReusePolicyCfg.setUserType(msgProp.getProperty("policy_sipv4_user","SIPv4"));
|
||||
}else if(ipReusePolicyCfg.getUserType().equals("SIPv6")){
|
||||
ipReusePolicyCfg.setUserType(msgProp.getProperty("policy_sipv6_user","SIPv6"));
|
||||
}
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), IpReusePolicyCfg.class);
|
||||
String snatNoExport = ",block_type,client_ip,group_name,server_ip,ip_type,ip_pattern,port_pattern,client_port,server_port,ir_type,direction,protocol,do_log,whether_area_block,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
snatNoExport = ",config_time" + snatNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
snatNoExport = ",edit_time" + snatNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
snatNoExport = ",audit_time" + snatNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
snatNoExport = "," + entity.gethColumns() + "," + snatNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), snatNoExport);
|
||||
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("snat export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
// dnat配置导出
|
||||
@RequestMapping(value = "exportDnat")
|
||||
public void exportDnat(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") IpReuseDnatPolicyCfg 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>();
|
||||
Properties msgProp = getMsgProp();
|
||||
// 导出选中记录
|
||||
List<BaseIpCfg> ipLists = new ArrayList<BaseIpCfg>();
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = ipMultiplexService.findPageByDnat(ids);
|
||||
} else {
|
||||
Page<BaseIpCfg> pageInfo = new Page<BaseIpCfg>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<BaseIpCfg> page = ipMultiplexService.findPageDnat(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), IpReuseDnatPolicyCfg.class);
|
||||
String snatNoExport = ",group_name,block_type,direction,client_ip,ip_type,ip_pattern,port_pattern,client_port,ir_type,do_log,whether_area_block,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
|
||||
snatNoExport = ",config_time" + snatNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
|
||||
snatNoExport = ",edit_time" + snatNoExport;
|
||||
}
|
||||
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
|
||||
snatNoExport = ",audit_time" + snatNoExport;
|
||||
}
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
snatNoExport = "," + entity.gethColumns() + "," + snatNoExport;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), snatNoExport);
|
||||
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("dnat export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,87 +19,87 @@ import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/cfg/asnPolicy")
|
||||
@Deprecated
|
||||
public class AsnPolicyCfgController extends BaseController {
|
||||
@RequestMapping(value = {"/list"})
|
||||
public String list(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,@ModelAttribute("cfg")CfgIndexInfo entity
|
||||
,RedirectAttributes redirectAttributes){
|
||||
Page<CfgIndexInfo> page = asnPolicyCfgService.findPage(new Page<CfgIndexInfo>(request, response,"r"), entity);
|
||||
@RequestMapping(value = { "/list" })
|
||||
public String list(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") CfgIndexInfo entity, RedirectAttributes redirectAttributes) {
|
||||
Page<CfgIndexInfo> page = asnPolicyCfgService.findPage(new Page<CfgIndexInfo>(request, response, "r"), entity);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,entity);
|
||||
initPageCondition(model, entity);
|
||||
return "/cfg/asnPolicyCfgList";
|
||||
}
|
||||
@RequestMapping(value = {"/form"})
|
||||
@RequiresPermissions(value={"asn:policy:config"})
|
||||
public String form(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,String ids,@ModelAttribute("cfg")CfgIndexInfo entity
|
||||
,RedirectAttributes redirectAttributes){
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
|
||||
@RequestMapping(value = { "/form" })
|
||||
@RequiresPermissions(value = { "asn:policy:config" })
|
||||
public String form(Model model, HttpServletRequest request, HttpServletResponse response, String ids,
|
||||
@ModelAttribute("cfg") CfgIndexInfo entity, RedirectAttributes redirectAttributes) {
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
entity = asnPolicyCfgService.get(Long.parseLong(ids));
|
||||
initUpdateFormCondition(model, entity);
|
||||
}else{
|
||||
initFormCondition(model,entity);
|
||||
} else {
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
List<ConfigGroupInfo> policyGroups=asnPolicyCfgService.getConfigGroupInfoList(4);
|
||||
List<ConfigGroupInfo> policyGroups = asnPolicyCfgService.getConfigGroupInfoList(4);
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
model.addAttribute("_cfg", entity);
|
||||
return "/cfg/asnPolicyCfgForm";
|
||||
}
|
||||
@RequestMapping(value = {"/saveOrUpdate"})
|
||||
@RequiresPermissions(value={"asn:policy:config"})
|
||||
public String saveOrUpdate(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CfgIndexInfo cfg
|
||||
,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
|
||||
@RequestMapping(value = { "/saveOrUpdate" })
|
||||
@RequiresPermissions(value = { "asn:policy:config" })
|
||||
public String saveOrUpdate(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") CfgIndexInfo cfg, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
asnPolicyCfgService.saveOrUpdate(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("信息保存失败", e);
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/cfg/asnPolicy/list?functionId="+cfg.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/cfg/asnPolicy/list?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"/delete"})
|
||||
@RequiresPermissions(value={"asn:policy:config"})
|
||||
public String delete(Integer isAudit,Integer isValid
|
||||
,String ids,Integer functionId
|
||||
,RedirectAttributes redirectAttributes){
|
||||
|
||||
@RequestMapping(value = { "/delete" })
|
||||
@RequiresPermissions(value = { "asn:policy:config" })
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
asnPolicyCfgService.delete(functionId, isValid, ids);
|
||||
return "redirect:" + adminPath +"/cfg/asnPolicy/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/cfg/asnPolicy/list?functionId=" + functionId;
|
||||
}
|
||||
// @RequestMapping(value = {"/audit"})
|
||||
// @RequiresPermissions(value={"asn:policy:confirm"})
|
||||
// public String audit(Integer isAudit,Integer isValid,String ids
|
||||
// ,Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
// if(!StringUtil.isEmpty(ids)){
|
||||
// String[] idArray = ids.split(",");
|
||||
// Date auditTime=new Date();
|
||||
// for(String id :idArray){
|
||||
// try {
|
||||
// asnPolicyCfgService.audit(isAudit,isValid,functionId,id,auditTime);
|
||||
// } catch (MaatConvertException e) {
|
||||
// e.printStackTrace();
|
||||
// logger.error("dns fake ip配置下发失败:"+e.getMessage());
|
||||
// addMessage(redirectAttributes,"error","request_service_failed");
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// logger.error("dns fake ip配置下发失败:"+e.getMessage());
|
||||
// addMessage(redirectAttributes,"error","audit_failed");
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// return "redirect:" + adminPath +"/cfg/asnPolicy/list?functionId="+functionId;
|
||||
// }
|
||||
// @RequestMapping(value = {"/audit"})
|
||||
// @RequiresPermissions(value={"asn:policy:confirm"})
|
||||
// public String audit(Integer isAudit,Integer isValid,String ids
|
||||
// ,Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
// if(!StringUtil.isEmpty(ids)){
|
||||
// String[] idArray = ids.split(",");
|
||||
// Date auditTime=new Date();
|
||||
// for(String id :idArray){
|
||||
// try {
|
||||
// asnPolicyCfgService.audit(isAudit,isValid,functionId,id,auditTime);
|
||||
// } catch (MaatConvertException e) {
|
||||
// e.printStackTrace();
|
||||
// logger.error("dns fake ip配置下发失败:"+e.getMessage());
|
||||
// addMessage(redirectAttributes,"error","request_service_failed");
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// logger.error("dns fake ip配置下发失败:"+e.getMessage());
|
||||
// addMessage(redirectAttributes,"error","audit_failed");
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// return "redirect:" + adminPath
|
||||
// +"/cfg/asnPolicy/list?functionId="+functionId;
|
||||
// }
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,5 @@
|
||||
package com.nis.web.controller.configuration.ntc;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -34,227 +33,245 @@ import com.nis.web.security.UserUtils;
|
||||
|
||||
/**
|
||||
* BGP配置
|
||||
*
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/ntc/other/")
|
||||
public class BgpCfgController extends BaseController{
|
||||
|
||||
@RequestMapping(value = {"bgpList"})
|
||||
// @RequiresPermissions(value={"other:bgp:config"})
|
||||
public String bgpList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg
|
||||
,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
public class BgpCfgController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "bgpList" })
|
||||
// @RequiresPermissions(value={"other:bgp:config"})
|
||||
public String bgpList(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
Page<CfgIndexInfo> page = bgpCfgService.getBgpList(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
initPageCondition(model, cfg);
|
||||
return "/cfg/other/bgpList";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"bgpForm"})
|
||||
@RequiresPermissions(value={"other:bgp:config"})
|
||||
public String bgpForm(Model model,String ids,CfgIndexInfo entity,RedirectAttributes redirectAttributes) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = bgpCfgService.getBgpCfg(Long.parseLong(ids),null);
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
initFormCondition(model,entity);
|
||||
|
||||
@RequestMapping(value = { "bgpForm" })
|
||||
@RequiresPermissions(value = { "other:bgp:config" })
|
||||
public String bgpForm(Model model, String ids, CfgIndexInfo entity, RedirectAttributes redirectAttributes) {
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
entity = bgpCfgService.getBgpCfg(Long.parseLong(ids), null);
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
model.addAttribute("_cfg", entity);
|
||||
return "/cfg/other/bgpForm";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"saveBgpCfg"})
|
||||
@RequiresPermissions(value={"other:bgp:config"})
|
||||
public String saveBgpCfg(Model model,HttpServletRequest request,HttpServletResponse response
|
||||
,String ids,CfgIndexInfo entity
|
||||
,RedirectAttributes redirectAttributes) {
|
||||
|
||||
@RequestMapping(value = { "saveBgpCfg" })
|
||||
@RequiresPermissions(value = { "other:bgp:config" })
|
||||
public String saveBgpCfg(Model model, HttpServletRequest request, HttpServletResponse response, String ids,
|
||||
CfgIndexInfo entity, RedirectAttributes redirectAttributes) {
|
||||
bgpCfgService.saveBgpCfg(entity);
|
||||
return "redirect:" + adminPath +"/ntc/other/bgpList?functionId="+entity.getFunctionId();
|
||||
return "redirect:" + adminPath + "/ntc/other/bgpList?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"ajaxBgpSubList"})
|
||||
public String ajaxBgpSubList(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
CfgIndexInfo cfg = bgpCfgService.getBgpCfg(cfgId,compileId);
|
||||
|
||||
@RequestMapping(value = { "ajaxBgpSubList" })
|
||||
public String ajaxBgpSubList(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
CfgIndexInfo cfg = bgpCfgService.getBgpCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
if(cfg.getIpPortList()!=null){
|
||||
if (cfg.getIpPortList() != null) {
|
||||
String cfgType = null;
|
||||
for(IpPortCfg ip:cfg.getIpPortList()){
|
||||
if(!ip.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",ip.getCfgType()});
|
||||
for (IpPortCfg ip : cfg.getIpPortList()) {
|
||||
if (!ip.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "1", ip.getCfgType() });
|
||||
cfgType = ip.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getNtcBgpAsCfgList()!=null){
|
||||
if (cfg.getNtcBgpAsCfgList() != null) {
|
||||
String cfgType = null;
|
||||
for(NtcBgpAsCfg ip:cfg.getNtcBgpAsCfgList()){
|
||||
if(!ip.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",ip.getCfgType()});
|
||||
for (NtcBgpAsCfg ip : cfg.getNtcBgpAsCfgList()) {
|
||||
if (!ip.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "2", ip.getCfgType() });
|
||||
cfgType = ip.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getNtcSubscribeIdCfgList()!=null){
|
||||
if (cfg.getNtcSubscribeIdCfgList() != null) {
|
||||
String cfgType = null;
|
||||
for(NtcSubscribeIdCfg ip:cfg.getNtcSubscribeIdCfgList()){
|
||||
if(!ip.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",ip.getCfgType()});
|
||||
for (NtcSubscribeIdCfg ip : cfg.getNtcSubscribeIdCfgList()) {
|
||||
if (!ip.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "2", ip.getCfgType() });
|
||||
cfgType = ip.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
/*TODO
|
||||
* if(cfg.getDomainList()!=null){
|
||||
String cfgType = null;
|
||||
for(ComplexkeywordCfg keyword:cfg.getDomainList()){
|
||||
if(!keyword.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"3",keyword.getCfgType()});
|
||||
cfgType = keyword.getCfgType();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
model.addAttribute("_cfg", cfg);
|
||||
/*
|
||||
* TODO if(cfg.getDomainList()!=null){ String cfgType = null;
|
||||
* for(ComplexkeywordCfg keyword:cfg.getDomainList()){
|
||||
* if(!keyword.getCfgType().equals(cfgType)){ tabList.add(new
|
||||
* String[]{"3",keyword.getCfgType()}); cfgType = keyword.getCfgType();
|
||||
* } } }
|
||||
*/
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/other/bgpSubList";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"updateBgpCfgValid"})
|
||||
@RequiresPermissions(value={"other:bgp:config"})
|
||||
public String updateBgpCfgValid(Integer isValid,String ids,Integer functionId,RedirectAttributes redirectAttributes) {
|
||||
bgpCfgService.updateBgpCfgValid(isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/ntc/other/bgpList?functionId="+functionId;
|
||||
|
||||
@RequestMapping(value = { "updateBgpCfgValid" })
|
||||
@RequiresPermissions(value = { "other:bgp:config" })
|
||||
public String updateBgpCfgValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
bgpCfgService.updateBgpCfgValid(isValid, ids, functionId);
|
||||
return "redirect:" + adminPath + "/ntc/other/bgpList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"auditBgpCfg"})
|
||||
@RequiresPermissions(value={"other:bgp:confirm"})
|
||||
public String auditBgpCfg(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
|
||||
@RequestMapping(value = { "auditBgpCfg" })
|
||||
@RequiresPermissions(value = { "other:bgp:confirm" })
|
||||
public String auditBgpCfg(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 = bgpCfgService.getBgpCfg(Long.parseLong(id),null);
|
||||
for (String id : idArray) {
|
||||
entity = bgpCfgService.getBgpCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
bgpCfgService.auditBgpCfg(entity,isAudit);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
bgpCfgService.auditBgpCfg(entity, isAudit);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("bgp配置下发失败",e);
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}catch (Exception e) {
|
||||
logger.error("bgp配置下发失败", e);
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("bgp配置下发失败",e);
|
||||
addMessage(redirectAttributes,"error","audit_failed");
|
||||
logger.error("bgp配置下发失败", e);
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
}
|
||||
}else {
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
Page<CfgIndexInfo> auditPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
} 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");
|
||||
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");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return bgpList(model, cfg, request, response);
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/other/bgpList?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/ntc/other/bgpList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
//bgp配置导出
|
||||
@RequestMapping(value = "exportbgp")
|
||||
public void exportbgp(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CfgIndexInfo 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<CfgIndexInfo> ipLists=new ArrayList<CfgIndexInfo>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=ipCfgService.getByIdsList(ids);
|
||||
}else{
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<CfgIndexInfo> pageInfo=new Page<CfgIndexInfo>(request, response,"a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CfgIndexInfo> page = bgpCfgService.getBgpList(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_IP");
|
||||
titleList.add("NTC_BGP_AS");
|
||||
// titleList.add("NTC_SUBSCRIBE_ID");
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
classMap.put("NTC_IP", IpPortCfg.class);
|
||||
classMap.put("NTC_BGP_AS", BaseStringCfg.class);
|
||||
// classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class);
|
||||
String cfgIndexInfoNoExport=",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortInfoNoExport=",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,";
|
||||
String regionCfgNoExport=",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,";
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||
noExportMap.put("NTC_BGP_AS", regionCfgNoExport);
|
||||
// noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport);
|
||||
List<IpPortCfg> ipList=new ArrayList<IpPortCfg>();
|
||||
// List<BaseStringCfg> subscribeInfoList=new ArrayList<BaseStringCfg>();
|
||||
List<BaseStringCfg> asInfoList=new ArrayList<BaseStringCfg>();
|
||||
for (CfgIndexInfo cfg : ipLists) {
|
||||
CfgIndexInfo cfgIndexInfo=bgpCfgService.exportbgp(cfg);
|
||||
ipList.addAll(cfgIndexInfo.getIpPortList());
|
||||
// subscribeInfoList.addAll(cfgIndexInfo.getNtcSubscribeIdCfgList());
|
||||
asInfoList.addAll(cfgIndexInfo.getNtcBgpAsCfgList());
|
||||
}
|
||||
asInfoList=BaseStringCfg.replaceBaseKeyList(asInfoList);
|
||||
// subscribeInfoList=BaseStringCfg.baseHexList(subscribeInfoList);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_IP", ipList);
|
||||
dataMap.put("NTC_BGP_AS", asInfoList);
|
||||
// dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList);
|
||||
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("bgp export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
|
||||
// bgp配置导出
|
||||
@RequestMapping(value = "exportbgp")
|
||||
public void exportbgp(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") CfgIndexInfo 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<CfgIndexInfo> ipLists = new ArrayList<CfgIndexInfo>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = ipCfgService.getByIdsList(ids);
|
||||
} else {
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<CfgIndexInfo> pageInfo = new Page<CfgIndexInfo>(request, response, "a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CfgIndexInfo> page = bgpCfgService.getBgpList(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_IP");
|
||||
titleList.add("NTC_BGP_AS");
|
||||
// titleList.add("NTC_SUBSCRIBE_ID");
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
classMap.put("NTC_IP", IpPortCfg.class);
|
||||
classMap.put("NTC_BGP_AS", BaseStringCfg.class);
|
||||
// classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class);
|
||||
String cfgIndexInfoNoExport = ",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortInfoNoExport = ",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,";
|
||||
String regionCfgNoExport = ",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;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||
noExportMap.put("NTC_BGP_AS", regionCfgNoExport);
|
||||
// noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport);
|
||||
List<IpPortCfg> ipList = new ArrayList<IpPortCfg>();
|
||||
// List<BaseStringCfg> subscribeInfoList=new
|
||||
// ArrayList<BaseStringCfg>();
|
||||
List<BaseStringCfg> asInfoList = new ArrayList<BaseStringCfg>();
|
||||
for (CfgIndexInfo cfg : ipLists) {
|
||||
CfgIndexInfo cfgIndexInfo = bgpCfgService.exportbgp(cfg);
|
||||
ipList.addAll(cfgIndexInfo.getIpPortList());
|
||||
// subscribeInfoList.addAll(cfgIndexInfo.getNtcSubscribeIdCfgList());
|
||||
asInfoList.addAll(cfgIndexInfo.getNtcBgpAsCfgList());
|
||||
}
|
||||
asInfoList = BaseStringCfg.replaceBaseKeyList(asInfoList);
|
||||
// subscribeInfoList=BaseStringCfg.baseHexList(subscribeInfoList);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_IP", ipList);
|
||||
dataMap.put("NTC_BGP_AS", asInfoList);
|
||||
// dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList);
|
||||
|
||||
/* } */
|
||||
|
||||
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("bgp export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -30,6 +30,7 @@ import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.template.AppDomainTemplate;
|
||||
import com.nis.domain.configuration.template.AppPayloadTemplate;
|
||||
import com.nis.domain.configuration.template.AsnIpTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
||||
import com.nis.domain.configuration.template.DdosIpTemplate;
|
||||
@@ -41,6 +42,15 @@ import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.DomainInterceptMonitTemplate;
|
||||
import com.nis.domain.configuration.template.DomainInterceptRateLimitTemplate;
|
||||
import com.nis.domain.configuration.template.DomainInterceptTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsRedirectComplexTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsRedirectIpTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsRedirectTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsRejectComplexTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsRejectIpTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsRejectTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsReplaceComplexTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsReplaceIpTemplate;
|
||||
import com.nis.domain.configuration.template.HttpsReplaceTemplate;
|
||||
import com.nis.domain.configuration.template.IpPayloadTemplate;
|
||||
import com.nis.domain.configuration.template.IpRateLimitTemplate;
|
||||
import com.nis.domain.configuration.template.IpWhitelistTemplate;
|
||||
@@ -291,11 +301,16 @@ public class IpController extends BaseController{
|
||||
,FunctionServiceDict serviceDict
|
||||
,Integer requestId) throws Exception{
|
||||
Properties pro=getMsgProp();
|
||||
//String serviceName=pro.getProperty(serviceDict.getServiceName());
|
||||
String regionName=pro.getProperty(regionDict.getConfigRegionValue());
|
||||
//serviceName=StringUtil.isEmpty(serviceName) ?serviceDict.getServiceName():serviceName;
|
||||
regionName=StringUtil.isEmpty(regionName) ?regionDict.getConfigRegionValue():regionName;
|
||||
String fileName = regionName+"_Template.xlsx";
|
||||
String menuCode = menuService.getMenuCodeByFunctionId(serviceDict.getFunctionId());
|
||||
String menuName = pro.getProperty(menuCode);
|
||||
String regionName = pro.getProperty(regionDict.getConfigRegionValue());
|
||||
menuName = StringUtil.isEmpty(menuName) ? menuCode : menuName;
|
||||
regionName = StringUtil.isEmpty(regionName) ? regionDict.getConfigRegionValue() : regionName;
|
||||
|
||||
String fileName = regionName + "_Template.xlsx";
|
||||
if(!menuName.equalsIgnoreCase(regionName)) {
|
||||
fileName = menuName +"_"+ fileName;
|
||||
}
|
||||
//ip类模板
|
||||
if(regionDict.getRegionType().equals(1)){
|
||||
if(regionDict.getFunctionId().equals(5)){// IP Address
|
||||
@@ -315,7 +330,12 @@ public class IpController extends BaseController{
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpPayloadTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(7)||regionDict.getFunctionId().equals(401)){ //Dns IP,DNS FAKE IP
|
||||
}else if(regionDict.getFunctionId().equals(7)) {
|
||||
List<DnsIpTemplate> classList=new ArrayList<DnsIpTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, DnsIpTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(401)){ //Dns IP,DNS FAKE IP
|
||||
List<DnsFakeIpTemplate> classList=new ArrayList<DnsFakeIpTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, DnsFakeIpTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
@@ -345,6 +365,21 @@ public class IpController extends BaseController{
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, SnatTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
List<HttpsRejectIpTemplate> classList=new ArrayList<HttpsRejectIpTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRejectIpTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
List<HttpsRedirectIpTemplate> classList=new ArrayList<HttpsRedirectIpTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRedirectIpTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
List<HttpsReplaceIpTemplate> classList=new ArrayList<HttpsReplaceIpTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceIpTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),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);
|
||||
@@ -381,6 +416,21 @@ public class IpController extends BaseController{
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}
|
||||
}else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
List<HttpsRejectTemplate> classList=new ArrayList<HttpsRejectTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRejectTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
List<HttpsRedirectTemplate> classList=new ArrayList<HttpsRedirectTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRedirectTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
List<HttpsReplaceTemplate> classList=new ArrayList<HttpsReplaceTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),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);
|
||||
@@ -396,6 +446,26 @@ public class IpController extends BaseController{
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, DnsComplexStringTemplate.class, 2);
|
||||
excel.setDataList(pro,classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
|
||||
List<HttpsRejectComplexTemplate> classList=new ArrayList<HttpsRejectComplexTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRejectComplexTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
|
||||
List<HttpsRedirectComplexTemplate> classList=new ArrayList<HttpsRedirectComplexTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRedirectComplexTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
List<HttpsReplaceComplexTemplate> classList=new ArrayList<HttpsReplaceComplexTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceComplexTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(563)) {// APP Payload
|
||||
List<AppPayloadTemplate> classList=new ArrayList<AppPayloadTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, AppPayloadTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),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);
|
||||
@@ -462,6 +532,19 @@ public class IpController extends BaseController{
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
String asnGroupInfoNoExport="";
|
||||
// 时间过滤
|
||||
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);
|
||||
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||
noExportMap.put("asn_policy", asnGroupInfoNoExport);
|
||||
@@ -480,9 +563,16 @@ public class IpController extends BaseController{
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_IP", ipList);
|
||||
dataMap.put("asn_policy", groupInfoList);
|
||||
|
||||
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);
|
||||
}
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("ip addr export failed",e);
|
||||
addMessage(redirectAttributes,"error", "export_failed");
|
||||
|
||||
@@ -44,275 +44,303 @@ import com.nis.web.security.UserUtils;
|
||||
|
||||
/**
|
||||
* 邮件相关配置控制类
|
||||
*
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/ntc/mail/")
|
||||
public class MailCfgController extends BaseController{
|
||||
@RequestMapping(value = {"mailList"})
|
||||
// @RequiresPermissions(value={"mail:config"})
|
||||
public String mailList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
public class MailCfgController extends BaseController {
|
||||
@RequestMapping(value = { "mailList" })
|
||||
// @RequiresPermissions(value={"mail:config"})
|
||||
public String mailList(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
Page<CfgIndexInfo> page = mailCfgService.getMailList(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
initPageCondition(model, cfg);
|
||||
return "/cfg/mail/mailList";
|
||||
}
|
||||
@RequestMapping(value = {"mailForm"})
|
||||
@RequiresPermissions(value={"mail:config"})
|
||||
public String mailForm(Model model,String ids,CfgIndexInfo entity) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = mailCfgService.getMailCfg(Long.parseLong(ids),null);
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
initFormCondition(model,entity);
|
||||
|
||||
@RequestMapping(value = { "mailForm" })
|
||||
@RequiresPermissions(value = { "mail:config" })
|
||||
public String mailForm(Model model, String ids, CfgIndexInfo entity) {
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
entity = mailCfgService.getMailCfg(Long.parseLong(ids), null);
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
model.addAttribute("_cfg", entity);
|
||||
return "/cfg/mail/mailForm";
|
||||
}
|
||||
@RequestMapping(value = {"saveMailCfg"})
|
||||
@RequiresPermissions(value={"mail:config"})
|
||||
public String saveMailCfg( RedirectAttributes redirectAttributes, Model model,HttpServletRequest request,HttpServletResponse response,String ids,
|
||||
CfgIndexInfo entity,MultipartFile file) {
|
||||
|
||||
|
||||
@RequestMapping(value = { "saveMailCfg" })
|
||||
@RequiresPermissions(value = { "mail:config" })
|
||||
public String saveMailCfg(RedirectAttributes redirectAttributes, Model model, HttpServletRequest request,
|
||||
HttpServletResponse response, String ids, CfgIndexInfo entity, MultipartFile file) {
|
||||
|
||||
try {
|
||||
ToMaatResult result = null;
|
||||
if(file!=null && file.getSize()>0 && entity.getDigestList()!=null && entity.getDigestList().size()>0){
|
||||
if (file != null && file.getSize() > 0 && entity.getDigestList() != null
|
||||
&& entity.getDigestList().size() > 0) {
|
||||
String sep = System.getProperty("file.separator");
|
||||
String digestFilePath = request.getRealPath("/")+"digestFile";
|
||||
String digestFilePath = request.getRealPath("/") + "digestFile";
|
||||
FileUtils.createDirectory(digestFilePath);
|
||||
String fileName = UUID.randomUUID()+FileUtils.getSuffix(file.getOriginalFilename(), true);
|
||||
File uploadFile = new File(digestFilePath+sep+fileName);
|
||||
String fileName = UUID.randomUUID() + FileUtils.getSuffix(file.getOriginalFilename(), true);
|
||||
File uploadFile = new File(digestFilePath + sep + fileName);
|
||||
FileCopyUtils.copy(file.getBytes(), uploadFile);
|
||||
Date creatTime = entity.getCreateTime();
|
||||
//获取文件摘要接口调用
|
||||
Map<String,Object> fileMap = new HashMap();
|
||||
// 获取文件摘要接口调用
|
||||
Map<String, Object> fileMap = new HashMap();
|
||||
fileMap.put("filetype", FileUtils.getSuffix(file.getOriginalFilename(), false));
|
||||
fileMap.put("datatype", "dbSystem");//源文件存入数据中心
|
||||
|
||||
fileMap.put("createTime",creatTime);
|
||||
fileMap.put("key",FileUtils.getPrefix(file.getOriginalFilename(), false));
|
||||
fileMap.put("datatype", "dbSystem");// 源文件存入数据中心
|
||||
|
||||
fileMap.put("createTime", creatTime);
|
||||
fileMap.put("key", FileUtils.getPrefix(file.getOriginalFilename(), false));
|
||||
fileMap.put("fileName", file.getOriginalFilename());
|
||||
String md5 = DigestUtils.md5Hex(file.getBytes());
|
||||
fileMap.put("checksum", md5);
|
||||
result = ConfigServiceUtil.getFileDigest(null, uploadFile, JsonMapper.toJsonString(fileMap));
|
||||
logger.info("获取文件摘要响应信息:"+result);
|
||||
}
|
||||
mailCfgService.saveMailCfg(entity,result);
|
||||
addMessage(redirectAttributes,"success", "save_success");
|
||||
} catch ( Exception e) {
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
|
||||
}else if(e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes,"error","call_external_procedures_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
logger.info("获取文件摘要响应信息:" + result);
|
||||
}
|
||||
mailCfgService.saveMailCfg(entity, result);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
|
||||
} else if (e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/ntc/mail/mailList?functionId="+entity.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/ntc/mail/mailList?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"ajaxMailSubList"})
|
||||
public String ajaxMailSubList(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
CfgIndexInfo cfg = mailCfgService.getMailCfg(cfgId,compileId);
|
||||
|
||||
@RequestMapping(value = { "ajaxMailSubList" })
|
||||
public String ajaxMailSubList(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
CfgIndexInfo cfg = mailCfgService.getMailCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
if(cfg.getIpPortList()!=null){
|
||||
if (cfg.getIpPortList() != null) {
|
||||
String cfgType = null;
|
||||
for(IpPortCfg ip:cfg.getIpPortList()){
|
||||
if(!ip.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",ip.getCfgType()});
|
||||
for (IpPortCfg ip : cfg.getIpPortList()) {
|
||||
if (!ip.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "1", ip.getCfgType() });
|
||||
cfgType = ip.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getComplexList()!=null){
|
||||
if (cfg.getComplexList() != null) {
|
||||
String cfgType = null;
|
||||
for(ComplexkeywordCfg keyword:cfg.getComplexList()){
|
||||
if(!keyword.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"3",keyword.getCfgType()});
|
||||
for (ComplexkeywordCfg keyword : cfg.getComplexList()) {
|
||||
if (!keyword.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "3", keyword.getCfgType() });
|
||||
cfgType = keyword.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getDigestList()!=null){
|
||||
if (cfg.getDigestList() != null) {
|
||||
String cfgType = null;
|
||||
for(FileDigestCfg digest:cfg.getDigestList()){
|
||||
if(!digest.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"5",digest.getCfgType()});
|
||||
for (FileDigestCfg digest : cfg.getDigestList()) {
|
||||
if (!digest.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "5", digest.getCfgType() });
|
||||
cfgType = digest.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getNtcSubscribeIdCfgList()!=null){
|
||||
if (cfg.getNtcSubscribeIdCfgList() != null) {
|
||||
String cfgType = null;
|
||||
for(NtcSubscribeIdCfg keyword:cfg.getNtcSubscribeIdCfgList()){
|
||||
if(!keyword.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",keyword.getCfgType()});
|
||||
for (NtcSubscribeIdCfg keyword : cfg.getNtcSubscribeIdCfgList()) {
|
||||
if (!keyword.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "2", keyword.getCfgType() });
|
||||
cfgType = keyword.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/mail/mailSubList";
|
||||
}
|
||||
@RequestMapping(value = {"updateMailCfgValid"})
|
||||
@RequiresPermissions(value={"mail:config"})
|
||||
public String updateMailCfgValid(Integer isValid,String ids,Integer functionId) {
|
||||
mailCfgService.updateMailCfgValid(isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/ntc/mail/mailList?functionId="+functionId;
|
||||
|
||||
@RequestMapping(value = { "updateMailCfgValid" })
|
||||
@RequiresPermissions(value = { "mail:config" })
|
||||
public String updateMailCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
mailCfgService.updateMailCfgValid(isValid, ids, functionId);
|
||||
return "redirect:" + adminPath + "/ntc/mail/mailList?functionId=" + functionId;
|
||||
}
|
||||
@RequestMapping(value = {"auditMailCfg"})
|
||||
@RequiresPermissions(value={"mail:confirm"})
|
||||
public String auditMailCfg(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
|
||||
@RequestMapping(value = { "auditMailCfg" })
|
||||
@RequiresPermissions(value = { "mail:confirm" })
|
||||
public String auditMailCfg(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 = mailCfgService.getMailCfg(Long.parseLong(id),null);
|
||||
for (String id : idArray) {
|
||||
entity = mailCfgService.getMailCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
mailCfgService.auditMailCfg(entity,isAudit);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
} catch ( Exception e) {
|
||||
mailCfgService.auditMailCfg(entity, isAudit);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("mail配置下发失败:"+e.getMessage());
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
|
||||
}else if(e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes,"error","call_external_procedures_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
logger.error("mail配置下发失败:" + e.getMessage());
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
|
||||
} else if (e instanceof CallExternalProceduresException) {
|
||||
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
Page<CfgIndexInfo> auditPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
} 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");
|
||||
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");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return mailList(model, cfg, request, response);
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/mail/mailList?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/ntc/mail/mailList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
//mail配置导出
|
||||
@RequestMapping(value = "exportmail")
|
||||
public void exportmail(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CfgIndexInfo 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<CfgIndexInfo> ipLists=new ArrayList<CfgIndexInfo>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=ipCfgService.getByIdsList(ids);
|
||||
}else{
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<CfgIndexInfo> pageInfo=new Page<CfgIndexInfo>(request, response,"a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CfgIndexInfo> page = mailCfgService.getMailList(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
}
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
String cfgIndexInfoNoExport=",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortInfoNoExport=",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,";
|
||||
String regionCfgNoExport=",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.getFunctionId()!=null){
|
||||
if(entity.getFunctionId()!=37){
|
||||
titleList.add("NTC_IP");
|
||||
titleList.add("NTC_MAIL_BODY");
|
||||
|
||||
classMap.put("NTC_IP", IpPortCfg.class);
|
||||
classMap.put("NTC_MAIL_BODY", ComplexkeywordCfg.class);
|
||||
|
||||
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||
noExportMap.put("NTC_MAIL_BODY", regionCfgNoExport);
|
||||
|
||||
}
|
||||
}
|
||||
titleList.add("NTC_MAIL_HDR");
|
||||
titleList.add("NTC_SUBSCRIBE_ID");
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
classMap.put("NTC_MAIL_HDR", ComplexkeywordCfg.class);
|
||||
classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class);
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_MAIL_HDR", regionCfgNoExport);
|
||||
noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport);
|
||||
List<IpPortCfg> ipList=new ArrayList<IpPortCfg>();
|
||||
List<BaseStringCfg> subscribeInfoList=new ArrayList<BaseStringCfg>();
|
||||
List<ComplexkeywordCfg> mailBodyList=new ArrayList<ComplexkeywordCfg>();
|
||||
List<ComplexkeywordCfg> mailReqHdrList=new ArrayList<ComplexkeywordCfg>();
|
||||
for (CfgIndexInfo cfg : ipLists) {
|
||||
Map<String, List> maps=mailCfgService.exportmail(cfg);
|
||||
mailReqHdrList.addAll(maps.get("NTC_MAIL_HDR"));
|
||||
mailBodyList.addAll(maps.get("NTC_MAIL_BODY"));
|
||||
ipList.addAll(maps.get("NTC_UNIVERSAL_IP"));
|
||||
subscribeInfoList.addAll(maps.get("NTC_SUBSCRIBE_ID"));
|
||||
}
|
||||
subscribeInfoList=BaseStringCfg.baseHexList(subscribeInfoList);
|
||||
mailBodyList=ComplexkeywordCfg.replaceComplexKeyList(mailBodyList);
|
||||
mailReqHdrList=ComplexkeywordCfg.replaceComplexKeyList(mailReqHdrList);
|
||||
if(entity.getFunctionId()!=null){
|
||||
if(entity.getFunctionId()!=37){
|
||||
dataMap.put("NTC_IP", ipList);
|
||||
dataMap.put("NTC_MAIL_BODY", mailBodyList);
|
||||
|
||||
}
|
||||
}
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_MAIL_HDR", mailReqHdrList);
|
||||
dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList);
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("mail export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
|
||||
// mail配置导出
|
||||
@RequestMapping(value = "exportmail")
|
||||
public void exportmail(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") CfgIndexInfo 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<CfgIndexInfo> ipLists = new ArrayList<CfgIndexInfo>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = ipCfgService.getByIdsList(ids);
|
||||
} else {
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<CfgIndexInfo> pageInfo = new Page<CfgIndexInfo>(request, response, "a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CfgIndexInfo> page = mailCfgService.getMailList(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
String cfgIndexInfoNoExport = ",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortInfoNoExport = ",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,";
|
||||
String regionCfgNoExport = ",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;
|
||||
}
|
||||
|
||||
if (entity.getFunctionId() != null) {
|
||||
if (entity.getFunctionId() != 37) {
|
||||
titleList.add("NTC_IP");
|
||||
titleList.add("NTC_MAIL_BODY");
|
||||
|
||||
classMap.put("NTC_IP", IpPortCfg.class);
|
||||
classMap.put("NTC_MAIL_BODY", ComplexkeywordCfg.class);
|
||||
|
||||
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||
noExportMap.put("NTC_MAIL_BODY", regionCfgNoExport);
|
||||
|
||||
}
|
||||
}
|
||||
titleList.add("NTC_MAIL_HDR");
|
||||
titleList.add("NTC_SUBSCRIBE_ID");
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
classMap.put("NTC_MAIL_HDR", ComplexkeywordCfg.class);
|
||||
classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class);
|
||||
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_MAIL_HDR", regionCfgNoExport);
|
||||
noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport);
|
||||
List<IpPortCfg> ipList = new ArrayList<IpPortCfg>();
|
||||
List<BaseStringCfg> subscribeInfoList = new ArrayList<BaseStringCfg>();
|
||||
List<ComplexkeywordCfg> mailBodyList = new ArrayList<ComplexkeywordCfg>();
|
||||
List<ComplexkeywordCfg> mailReqHdrList = new ArrayList<ComplexkeywordCfg>();
|
||||
for (CfgIndexInfo cfg : ipLists) {
|
||||
Map<String, List> maps = mailCfgService.exportmail(cfg);
|
||||
mailReqHdrList.addAll(maps.get("NTC_MAIL_HDR"));
|
||||
mailBodyList.addAll(maps.get("NTC_MAIL_BODY"));
|
||||
ipList.addAll(maps.get("NTC_UNIVERSAL_IP"));
|
||||
subscribeInfoList.addAll(maps.get("NTC_SUBSCRIBE_ID"));
|
||||
}
|
||||
subscribeInfoList = BaseStringCfg.baseHexList(subscribeInfoList);
|
||||
mailBodyList = ComplexkeywordCfg.replaceComplexKeyList(mailBodyList);
|
||||
mailReqHdrList = ComplexkeywordCfg.replaceComplexKeyList(mailReqHdrList);
|
||||
if (entity.getFunctionId() != null) {
|
||||
if (entity.getFunctionId() != 37) {
|
||||
dataMap.put("NTC_IP", ipList);
|
||||
dataMap.put("NTC_MAIL_BODY", mailBodyList);
|
||||
|
||||
}
|
||||
}
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_MAIL_HDR", mailReqHdrList);
|
||||
dataMap.put("NTC_SUBSCRIBE_ID", subscribeInfoList);
|
||||
/* } */
|
||||
|
||||
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("mail export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -33,145 +33,151 @@ import com.nis.web.security.UserUtils;
|
||||
|
||||
/**
|
||||
* 白名单
|
||||
*
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/ntc/whitelist")
|
||||
public class WhiteListController extends CommonController{
|
||||
|
||||
@RequestMapping(value = {"ip/list"})
|
||||
//@RequiresPermissions(value={"whitelist:ip:config","whitelist:ip:confirm","whitelist:ip:aduit"},logical=Logical.OR)
|
||||
public String ipList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
public class WhiteListController extends CommonController {
|
||||
|
||||
@RequestMapping(value = { "ip/list" })
|
||||
// @RequiresPermissions(value={"whitelist:ip:config","whitelist:ip:confirm","whitelist:ip:aduit"},logical=Logical.OR)
|
||||
public String ipList(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
Page<CfgIndexInfo> page = ipCfgService.getIpCfgList(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
initPageCondition(model, cfg);
|
||||
return "/cfg/whitelist/ipList";
|
||||
}
|
||||
@RequestMapping(value = {"ajaxIpSubList"})
|
||||
public String ajaxIpSubList(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
CfgIndexInfo cfg = ipCfgService.getIpPortCfg(cfgId,compileId);
|
||||
|
||||
@RequestMapping(value = { "ajaxIpSubList" })
|
||||
public String ajaxIpSubList(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
CfgIndexInfo cfg = ipCfgService.getIpPortCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
if(cfg.getIpPortList()!=null){
|
||||
if (cfg.getIpPortList() != null) {
|
||||
String cfgType = null;
|
||||
for(IpPortCfg ip:cfg.getIpPortList()){
|
||||
if(!ip.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",ip.getCfgType()});
|
||||
for (IpPortCfg ip : cfg.getIpPortList()) {
|
||||
if (!ip.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "1", ip.getCfgType() });
|
||||
cfgType = ip.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getNtcSubscribeIdCfgList()!=null){
|
||||
if (cfg.getNtcSubscribeIdCfgList() != null) {
|
||||
String cfgType = null;
|
||||
for(NtcSubscribeIdCfg keyword:cfg.getNtcSubscribeIdCfgList()){
|
||||
if(!keyword.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",keyword.getCfgType()});
|
||||
for (NtcSubscribeIdCfg keyword : cfg.getNtcSubscribeIdCfgList()) {
|
||||
if (!keyword.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "2", keyword.getCfgType() });
|
||||
cfgType = keyword.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/whitelist/ipSubList";
|
||||
}
|
||||
@RequestMapping(value = {"ip/form"})
|
||||
@RequiresPermissions(value={"whitelist:ip:config"})
|
||||
public String ipForm(Model model,String ids,CfgIndexInfo entity) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
|
||||
entity = this.ipCfgService.getIpPortCfg(Long.parseLong(ids),null);
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
initFormCondition(model,entity);
|
||||
|
||||
@RequestMapping(value = { "ip/form" })
|
||||
@RequiresPermissions(value = { "whitelist:ip:config" })
|
||||
public String ipForm(Model model, String ids, CfgIndexInfo entity) {
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
|
||||
entity = this.ipCfgService.getIpPortCfg(Long.parseLong(ids), null);
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
model.addAttribute("_cfg", entity);
|
||||
return "/cfg/whitelist/ipForm";
|
||||
}
|
||||
@RequestMapping(value = {"ip/save"})
|
||||
public String saveIpCfg(RedirectAttributes model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
|
||||
|
||||
@RequestMapping(value = { "ip/save" })
|
||||
public String saveIpCfg(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
|
||||
String ids, CfgIndexInfo entity) {
|
||||
ipCfgService.saveIpCfg(entity);
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/ip/list?functionId="+entity.getFunctionId();
|
||||
return "redirect:" + adminPath + "/ntc/whitelist/ip/list?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"ip/audit"})
|
||||
|
||||
@RequestMapping(value = { "ip/audit" })
|
||||
@RequiresPermissions("whitelist:ip:confirm")
|
||||
public String auditIp(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request
|
||||
) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
public String auditIp(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 = ipCfgService.getIpPortCfg(Long.parseLong(id),null);
|
||||
for (String id : idArray) {
|
||||
entity = ipCfgService.getIpPortCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
ipCfgService.auditIpCfg(entity,isAudit);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
ipCfgService.auditIpCfg(entity, isAudit);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
logger.info("ip配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}catch (Exception e) {
|
||||
logger.info("ip配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.info("ip配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} catch (Exception e) {
|
||||
logger.info("ip配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
Page<CfgIndexInfo> auditPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
} 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");
|
||||
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");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return ipList(model, cfg, request, response);
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/ip/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/ntc/whitelist/ip/list?functionId=" + functionId;
|
||||
}
|
||||
@RequestMapping(value = {"updateIpValid"})
|
||||
@RequiresPermissions(value={"whitelist:ip:config"})
|
||||
public String updateIpCfgValid(Integer isValid,String ids,Integer functionId) {
|
||||
ipCfgService.updateIpCfgValid(isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/ip/list?functionId="+functionId;
|
||||
|
||||
@RequestMapping(value = { "updateIpValid" })
|
||||
@RequiresPermissions(value = { "whitelist:ip:config" })
|
||||
public String updateIpCfgValid(Integer isValid, String ids, Integer functionId) {
|
||||
ipCfgService.updateIpCfgValid(isValid, ids, functionId);
|
||||
return "redirect:" + adminPath + "/ntc/whitelist/ip/list?functionId=" + functionId;
|
||||
}
|
||||
@RequestMapping(value = {"domain/list"})
|
||||
//@RequiresPermissions(value={"whitelist:domain:config","whitelist:domain:confirm","whitelist:domain:aduit"},logical=Logical.OR)
|
||||
public String domainList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
|
||||
@RequestMapping(value = { "domain/list" })
|
||||
// @RequiresPermissions(value={"whitelist:domain:config","whitelist:domain:confirm","whitelist:domain:aduit"},logical=Logical.OR)
|
||||
public String domainList(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
Page<CfgIndexInfo> page = domainService.getDomainList(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
initPageCondition(model, cfg);
|
||||
return "/cfg/whitelist/domainList";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"saveHttpUrlCfgs"})
|
||||
public String saveHttpUrlCfgs(RedirectAttributes model,HttpServletRequest request,HttpServletResponse response,CfgIndexInfo entity) {
|
||||
if(!StringUtil.isEmpty(entity) && !StringUtil.isEmpty(entity.getHttpUrlList())){
|
||||
|
||||
CfgIndexInfo sourceCfg=websiteCfgService.getCfgIndexInfo(entity.getHttpUrlList().get(0).getSourceCompileId());
|
||||
|
||||
@RequestMapping(value = { "saveHttpUrlCfgs" })
|
||||
public String saveHttpUrlCfgs(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
|
||||
CfgIndexInfo entity) {
|
||||
if (!StringUtil.isEmpty(entity) && !StringUtil.isEmpty(entity.getHttpUrlList())) {
|
||||
|
||||
CfgIndexInfo sourceCfg = websiteCfgService
|
||||
.getCfgIndexInfo(entity.getHttpUrlList().get(0).getSourceCompileId());
|
||||
for (HttpUrlCfg httpUrlCfg : entity.getHttpUrlList()) {
|
||||
CfgIndexInfo cfg=new CfgIndexInfo();
|
||||
List httpList=new ArrayList<>();
|
||||
CfgIndexInfo cfg = new CfgIndexInfo();
|
||||
List httpList = new ArrayList<>();
|
||||
httpUrlCfg.setRequestId(sourceCfg.getRequestId());
|
||||
BeanUtils.copyProperties(httpUrlCfg, cfg);
|
||||
httpList.add(httpUrlCfg);
|
||||
@@ -179,258 +185,315 @@ public class WhiteListController extends CommonController{
|
||||
websiteCfgService.saveHttpCfg(cfg);
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+entity.getFunctionId();
|
||||
return "redirect:" + adminPath + "/ntc/whitelist/domain/list?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"domain/form"})
|
||||
@RequiresPermissions(value={"whitelist:domain:config"})
|
||||
public String domainForm(Model model,String ids,CfgIndexInfo entity) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = domainService.getDomainCfg(Long.parseLong(ids),null);
|
||||
|
||||
@RequestMapping(value = { "domain/form" })
|
||||
@RequiresPermissions(value = { "whitelist:domain:config" })
|
||||
public String domainForm(Model model, String ids, CfgIndexInfo entity) {
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
entity = domainService.getDomainCfg(Long.parseLong(ids), null);
|
||||
HttpUrlCfg urlCfg = new HttpUrlCfg();
|
||||
urlCfg.setCfgType(Constants.HTTP_URL_REGION);
|
||||
entity.setHttpUrl(urlCfg);
|
||||
if(entity.getHttpUrlList().size()==0){
|
||||
if (entity.getHttpUrlList().size() == 0) {
|
||||
entity.getHttpUrlList().add(urlCfg);
|
||||
}
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
HttpUrlCfg urlCfg = new HttpUrlCfg();
|
||||
urlCfg.setCfgType(Constants.HTTP_URL_REGION);
|
||||
entity.setHttpUrl(urlCfg);
|
||||
List<HttpUrlCfg> urlList=new ArrayList<HttpUrlCfg>();
|
||||
List<HttpUrlCfg> urlList = new ArrayList<HttpUrlCfg>();
|
||||
urlList.add(urlCfg);
|
||||
entity.setHttpUrlList(urlList);
|
||||
initFormCondition(model,entity);
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
model.addAttribute("_cfg", entity);
|
||||
return "/cfg/whitelist/domainForm";
|
||||
}
|
||||
@RequestMapping(value = {"domain/save"})
|
||||
public String saveOrUpdateDomain(RedirectAttributes model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
|
||||
|
||||
@RequestMapping(value = { "domain/save" })
|
||||
public String saveOrUpdateDomain(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response,
|
||||
String ids, CfgIndexInfo entity) {
|
||||
domainService.saveDomainCfg(entity);
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+entity.getFunctionId();
|
||||
return "redirect:" + adminPath + "/ntc/whitelist/domain/list?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"domain/ajaxSubList"})
|
||||
public String ajaxDomainSubList(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
CfgIndexInfo cfg = domainService.getDomainCfg(cfgId,compileId);
|
||||
|
||||
@RequestMapping(value = { "domain/ajaxSubList" })
|
||||
public String ajaxDomainSubList(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
CfgIndexInfo cfg = domainService.getDomainCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
if(cfg.getHttpUrlList()!=null){
|
||||
if (cfg.getHttpUrlList() != null) {
|
||||
String cfgType = null;
|
||||
for(BaseStringCfg keyword:cfg.getHttpUrlList()){
|
||||
if(!keyword.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",keyword.getCfgType()});
|
||||
for (BaseStringCfg keyword : cfg.getHttpUrlList()) {
|
||||
if (!keyword.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "2", keyword.getCfgType() });
|
||||
cfgType = keyword.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getNtcSubscribeIdCfgList()!=null){
|
||||
if (cfg.getNtcSubscribeIdCfgList() != null) {
|
||||
String cfgType = null;
|
||||
for(NtcSubscribeIdCfg keyword:cfg.getNtcSubscribeIdCfgList()){
|
||||
if(!keyword.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",keyword.getCfgType()});
|
||||
for (NtcSubscribeIdCfg keyword : cfg.getNtcSubscribeIdCfgList()) {
|
||||
if (!keyword.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "2", keyword.getCfgType() });
|
||||
cfgType = keyword.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/whitelist/domianSubList";
|
||||
}
|
||||
@RequestMapping(value = {"domain/updateValid"})
|
||||
@RequiresPermissions(value={"whitelist:domain:config"})
|
||||
public String updateDomainValid(Integer isValid,String ids,Integer functionId) {
|
||||
domainService.updateDomainCfgValid(isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+functionId;
|
||||
|
||||
@RequestMapping(value = { "domain/updateValid" })
|
||||
@RequiresPermissions(value = { "whitelist:domain:config" })
|
||||
public String updateDomainValid(Integer isValid, String ids, Integer functionId) {
|
||||
domainService.updateDomainCfgValid(isValid, ids, functionId);
|
||||
return "redirect:" + adminPath + "/ntc/whitelist/domain/list?functionId=" + functionId;
|
||||
}
|
||||
@RequestMapping(value = {"domain/delete"})
|
||||
|
||||
@RequestMapping(value = { "domain/delete" })
|
||||
@RequiresPermissions("whitelist:domain:config")
|
||||
public String deleteDomain(String ids,Integer functionId,RedirectAttributes model) {
|
||||
try{
|
||||
public String deleteDomain(String ids, Integer functionId, RedirectAttributes model) {
|
||||
try {
|
||||
domainService.deleteWhiteDomain(ids);
|
||||
addMessage(model,"success","delete_success");
|
||||
}catch(Exception e){
|
||||
addMessage(model, "success", "delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("删除失败", e);
|
||||
addMessage(model,"error","delete_failed");
|
||||
addMessage(model, "error", "delete_failed");
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/ntc/whitelist/domain/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"domain/audit"})
|
||||
|
||||
@RequestMapping(value = { "domain/audit" })
|
||||
@RequiresPermissions("whitelist:domain:confirm")
|
||||
public String auditDomain(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
public String auditDomain(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 = domainService.getDomainCfg(Long.parseLong(id),null);
|
||||
for (String id : idArray) {
|
||||
entity = domainService.getDomainCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
domainService.auditDomainCfg(entity,isAudit);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
domainService.auditDomainCfg(entity, isAudit);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("domain配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}catch (Exception e) {
|
||||
logger.error("domain配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("domain配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes,"error","audit_failed");
|
||||
logger.error("domain配置下发失败:" + e.getMessage());
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
}
|
||||
}else{//条件下所有配置审核
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
Page<CfgIndexInfo> auditPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
} 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");
|
||||
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");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return domainList(model, cfg, request, response);
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/ntc/whitelist/domain/list?functionId=" + functionId;
|
||||
}
|
||||
//ip配置导入
|
||||
/*@RequestMapping(value = "ip/import", method=RequestMethod.POST)
|
||||
public String importIp(String cfgName,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("file") MultipartFile file,IpPortCfg cfg) {
|
||||
this._importIp(cfgName,redirectAttributes, file,cfg,WhiteListIpTemplate.class);
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/ip/list?functionId="+cfg.getFunctionId();
|
||||
}*/
|
||||
//ip模板下载
|
||||
|
||||
// ip配置导入
|
||||
/*
|
||||
* @RequestMapping(value = "ip/import", method=RequestMethod.POST) public
|
||||
* String importIp(String cfgName,RedirectAttributes redirectAttributes,
|
||||
*
|
||||
* @RequestParam("file") MultipartFile file,IpPortCfg cfg) {
|
||||
* this._importIp(cfgName,redirectAttributes,
|
||||
* file,cfg,WhiteListIpTemplate.class); return "redirect:" + adminPath
|
||||
* +"/ntc/whitelist/ip/list?functionId="+cfg.getFunctionId(); }
|
||||
*/
|
||||
// ip模板下载
|
||||
@RequestMapping(value = "ip/import/template")
|
||||
public void importFileTemplate(HttpServletRequest request,HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode) {
|
||||
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,WhiteListIpTemplate.class);
|
||||
public void importFileTemplate(HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes, Integer functionId, Integer cfgRegionCode) {
|
||||
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,
|
||||
WhiteListIpTemplate.class);
|
||||
}
|
||||
//ip配置导出
|
||||
|
||||
// ip配置导出
|
||||
@RequestMapping(value = "ip/export")
|
||||
public void exportIp(String columns,Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")IpPortCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
this._exportIp(columns,model, request, response, entity, ids, redirectAttributes);
|
||||
public void exportIp(String columns, Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") IpPortCfg entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
this._exportIp(columns, model, request, response, entity, ids, redirectAttributes);
|
||||
}
|
||||
|
||||
//ip配置导出
|
||||
@RequestMapping(value = "exportIpAddr")
|
||||
public void exportIpAddr(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CfgIndexInfo 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<CfgIndexInfo> ipLists=new ArrayList<CfgIndexInfo>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=ipCfgService.getByIdsList(ids);
|
||||
}else{
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<CfgIndexInfo> pageInfo=new Page<CfgIndexInfo>(request, response,"a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CfgIndexInfo> page = ipCfgService.getIpCfgList(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_IP");
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
classMap.put("NTC_IP", IpPortCfg.class);
|
||||
String cfgIndexInfoNoExport=",policy_name,do_log,letter,whether_area_block,classification,attribute,label,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortInfoNoExport=",protocol,direction,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,";
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||
List<IpPortCfg> ipList=new ArrayList<IpPortCfg>();
|
||||
for (CfgIndexInfo cfg :ipLists) {
|
||||
CfgIndexInfo cfgIndexInfo=ipCfgService.exportIpInfo(cfg);
|
||||
ipList.addAll(cfgIndexInfo.getIpPortList());
|
||||
}
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_IP", ipList);
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("ip white export failed",e);
|
||||
addMessage(redirectAttributes,"error", "export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
// ip配置导出
|
||||
@RequestMapping(value = "exportIpAddr")
|
||||
public void exportIpAddr(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") CfgIndexInfo 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<CfgIndexInfo> ipLists = new ArrayList<CfgIndexInfo>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = ipCfgService.getByIdsList(ids);
|
||||
} else {
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<CfgIndexInfo> pageInfo = new Page<CfgIndexInfo>(request, response, "a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CfgIndexInfo> page = ipCfgService.getIpCfgList(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
//ip配置导出
|
||||
@RequestMapping(value = "exportdomain")
|
||||
public void exportdomain(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CfgIndexInfo 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<CfgIndexInfo> ipLists=new ArrayList<CfgIndexInfo>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=ipCfgService.getByIdsList(ids);
|
||||
}else{
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<CfgIndexInfo> pageInfo=new Page<CfgIndexInfo>(request, response,"a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CfgIndexInfo> page = domainService.getDomainList(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
}
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_HTTP_URL");
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
classMap.put("NTC_HTTP_URL", HttpUrlCfg.class);
|
||||
String cfgIndexInfoNoExport=",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String httpUrlInfoNoExport=",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,";
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_HTTP_URL", httpUrlInfoNoExport);
|
||||
List<BaseStringCfg> httpurlList=new ArrayList<BaseStringCfg>();
|
||||
for (CfgIndexInfo cfg : ipLists) {
|
||||
CfgIndexInfo cfgIndexInfo=domainService.exportDomainInfo(cfg);
|
||||
httpurlList.addAll(cfgIndexInfo.getHttpUrlList());
|
||||
}
|
||||
httpurlList=BaseStringCfg.replaceBaseKeyList(httpurlList);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_HTTP_URL", httpurlList);
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("ip white export failed",e);
|
||||
addMessage(redirectAttributes,"error", "export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_IP");
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
classMap.put("NTC_IP", IpPortCfg.class);
|
||||
String cfgIndexInfoNoExport = ",policy_name,do_log,letter,whether_area_block,classification,attribute,label,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortInfoNoExport = ",protocol,direction,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,";
|
||||
|
||||
// 时间过滤
|
||||
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);
|
||||
noExportMap.put("NTC_IP", ipPortInfoNoExport);
|
||||
List<IpPortCfg> ipList = new ArrayList<IpPortCfg>();
|
||||
for (CfgIndexInfo cfg : ipLists) {
|
||||
CfgIndexInfo cfgIndexInfo = ipCfgService.exportIpInfo(cfg);
|
||||
ipList.addAll(cfgIndexInfo.getIpPortList());
|
||||
}
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_IP", ipList);
|
||||
/* } */
|
||||
|
||||
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("ip white export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
// ip配置导出
|
||||
@RequestMapping(value = "exportdomain")
|
||||
public void exportdomain(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") CfgIndexInfo 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<CfgIndexInfo> ipLists = new ArrayList<CfgIndexInfo>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = ipCfgService.getByIdsList(ids);
|
||||
} else {
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<CfgIndexInfo> pageInfo = new Page<CfgIndexInfo>(request, response, "a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CfgIndexInfo> page = domainService.getDomainList(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_HTTP_URL");
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
classMap.put("NTC_HTTP_URL", HttpUrlCfg.class);
|
||||
String cfgIndexInfoNoExport = ",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String httpUrlInfoNoExport = ",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;
|
||||
}
|
||||
|
||||
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_HTTP_URL", httpUrlInfoNoExport);
|
||||
List<BaseStringCfg> httpurlList = new ArrayList<BaseStringCfg>();
|
||||
for (CfgIndexInfo cfg : ipLists) {
|
||||
CfgIndexInfo cfgIndexInfo = domainService.exportDomainInfo(cfg);
|
||||
httpurlList.addAll(cfgIndexInfo.getHttpUrlList());
|
||||
}
|
||||
httpurlList = BaseStringCfg.replaceBaseKeyList(httpurlList);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("NTC_HTTP_URL", httpurlList);
|
||||
/* } */
|
||||
|
||||
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("ip white export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,39 +3,27 @@ package com.nis.web.controller.configuration.proxy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
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.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.callback.ProxyFileStrategyCfg;
|
||||
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.FileDigestCfg;
|
||||
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.NtcSubscribeIdCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
@@ -43,7 +31,6 @@ 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;
|
||||
|
||||
/**
|
||||
* http重定向策略
|
||||
@@ -233,166 +220,90 @@ public class CachePolicyController extends BaseController{
|
||||
|
||||
|
||||
//http配置导出
|
||||
/*@RequestMapping(value = "exportHttp")
|
||||
public String exportHttp(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CfgIndexInfo 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<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId());
|
||||
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
for(String id:ids.split(",")){
|
||||
Long.parseLong(id);
|
||||
}
|
||||
//List<CfgIndexInfo> list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids);
|
||||
}else{
|
||||
//条件导出数据大于最大导出数,只导出最大导出条数
|
||||
Page<CfgIndexInfo> pageInfo=new Page<CfgIndexInfo>(request, response,"a");
|
||||
if(pageInfo.getCount()>Constants.MAX_EXPORT_SIZE){
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
}else{
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(-1);
|
||||
}
|
||||
|
||||
Page<CfgIndexInfo> page = cachePolicyService.getCachePolicyList(pageInfo, entity);
|
||||
Properties prop = getMsgProp();
|
||||
for (CfgIndexInfo str : page.getList()) {
|
||||
if(entity.getFunctionId()!=210 && entity.getFunctionId()!=211){
|
||||
String type="RESPONSE_CODE";
|
||||
if(entity.getFunctionId()==207){
|
||||
type="RESPONSE_CODE";
|
||||
}else if(entity.getFunctionId()==208){
|
||||
type="REDIRECT_RESPONSE_CODE";
|
||||
}else if(entity.getFunctionId()==209){
|
||||
type="CONTROL_REPLACE_ZONE";
|
||||
}
|
||||
String dictlabel= DictUtils.getDictLabel(type, str.getUserRegion1());
|
||||
str.setUserRegion1(prop.getProperty(dictlabel));
|
||||
if(entity.getFunctionId()==207 || entity.getFunctionId()==208){
|
||||
if(StringUtil.isEmpty(str.getUserRegion2())){
|
||||
if(!StringUtil.isEmpty(str.getUserRegion3())){
|
||||
ProxyFileStrategyCfg file= new ProxyFileStrategyCfg();
|
||||
file.setCompileId(Integer.valueOf(str.getUserRegion3()));
|
||||
List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService.getProxyFileStrategyCfgList(file);
|
||||
if(allProxyFileStrategys!=null && allProxyFileStrategys.size()>0){
|
||||
str.setUserRegion2(allProxyFileStrategys.get(0).getCfgDesc());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String cfgIndexInfoNoExport=",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
if(entity.getFunctionId()==207){
|
||||
cfgIndexInfoNoExport=",policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:response_code-userregion2:response_content-";
|
||||
}else if(entity.getFunctionId()==208){
|
||||
cfgIndexInfoNoExport=",policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:redirect_response_code-userregion2:redirect_url-";
|
||||
}else if(entity.getFunctionId()==209){
|
||||
cfgIndexInfoNoExport=",policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:replace_zone-userregion2:replaced_content-userregion3:replace_content-";
|
||||
}else if(entity.getFunctionId()==211){
|
||||
cfgIndexInfoNoExport=",do_log,log_total,policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
}
|
||||
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,";
|
||||
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 (CfgIndexInfo cfg : page.getList()) {
|
||||
Map<String, List> maps=cachePolicyService.exportCachePolicy(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"));
|
||||
}
|
||||
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(), CfgIndexInfo.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(), page.getList());
|
||||
dataMap.put("NTC_HTTP_URL", httpUrlList);
|
||||
dataMap.put("NTC_HTTP_REQ_HDR", httpReqHdrList);
|
||||
if(entity.getFunctionId()!=208 && 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_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);
|
||||
|
||||
}
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("http export failed",e);
|
||||
addMessage(redirectAttributes, "export_failed");
|
||||
@RequestMapping(value = "exportCache")
|
||||
public void exportdomain(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CachePolicyUserRegion 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<CachePolicyUserRegion> ipLists = new ArrayList<CachePolicyUserRegion>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = cachePolicyService.getCachePolicyByUserRegionList(ids);
|
||||
} else {
|
||||
Page<CachePolicyUserRegion> pageInfo=new Page<CachePolicyUserRegion>(request, response,"a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CachePolicyUserRegion> page = cachePolicyService.getCachePolicyUserRegionList(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/website/httpList?functionId="+entity.getFunctionId();
|
||||
}*/
|
||||
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entity.getFunctionId());
|
||||
Properties msgProp = getMsgProp();
|
||||
for (CachePolicyUserRegion cache : ipLists) {
|
||||
for (FunctionServiceDict service : serviceList) {
|
||||
if(cache.getAction().intValue()==service.getAction().intValue()){
|
||||
cache.setActionCode(msgProp.getProperty(service.getActionCode(),service.getActionCode()));
|
||||
}
|
||||
}
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("PXY_CACHE_HTTP_URL");
|
||||
titleList.add("PXY_CACHE_HTTP_COOKIE");
|
||||
classMap.put(entity.getMenuNameCode(), CachePolicyUserRegion.class);
|
||||
classMap.put("PXY_CACHE_HTTP_URL", HttpUrlCfg.class);
|
||||
classMap.put("PXY_CACHE_HTTP_COOKIE", HttpUrlCfg.class);
|
||||
String cfgIndexInfoNoExport=",block_type,policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,&action:block_type-";
|
||||
String httpUrlInfoNoExport=",block_type,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) {
|
||||
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);
|
||||
noExportMap.put("PXY_CACHE_HTTP_URL", httpUrlInfoNoExport);
|
||||
noExportMap.put("PXY_CACHE_HTTP_COOKIE", httpUrlInfoNoExport);
|
||||
List<BaseStringCfg> urlList=new ArrayList<BaseStringCfg>();
|
||||
List<BaseStringCfg> cookieList=new ArrayList<BaseStringCfg>();
|
||||
for (CachePolicyUserRegion cfg : ipLists) {
|
||||
Map<String, List> maps=cachePolicyService.getExport(Long.valueOf(cfg.getCfgId()));
|
||||
urlList.addAll(maps.get("PXY_CACHE_HTTP_URL"));
|
||||
cookieList.addAll(maps.get("PXY_CACHE_HTTP_COOKIE"));
|
||||
}
|
||||
urlList=BaseStringCfg.replaceBaseKeyList(urlList);
|
||||
cookieList=BaseStringCfg.replaceBaseKeyList(cookieList);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
dataMap.put("PXY_CACHE_HTTP_URL", urlList);
|
||||
dataMap.put("PXY_CACHE_HTTP_COOKIE", cookieList);
|
||||
/*}*/
|
||||
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("ip white export failed",e);
|
||||
addMessage(redirectAttributes,"error", "export_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,35 +44,37 @@ import jersey.repackaged.com.google.common.collect.Lists;
|
||||
|
||||
/**
|
||||
* http重定向策略
|
||||
*
|
||||
* @author zhangwei
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/proxy/control/httpRedirect")
|
||||
public class HttpRedirectPolicyController extends BaseController{
|
||||
@RequestMapping(value = {"httpRedirectList","httpBlockList","httpReplaceList","httpMonitList","httpWhitelistList"})
|
||||
public String list(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")CfgIndexInfo cfg){
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
public class HttpRedirectPolicyController extends BaseController {
|
||||
@RequestMapping(value = { "httpRedirectList", "httpBlockList", "httpReplaceList", "httpMonitList",
|
||||
"httpWhitelistList", ""})
|
||||
public String list(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") CfgIndexInfo cfg) {
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
Page<CfgIndexInfo> page = httpRedirectCfgService.getHttpRedirectList(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
//获取所有的响应文件内容,阻断,或重定向时可以选择
|
||||
List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService.getProxyFileStrategyCfgList(new ProxyFileStrategyCfg());
|
||||
initPageCondition(model, cfg);
|
||||
// 获取所有的响应文件内容,阻断,或重定向时可以选择
|
||||
List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService
|
||||
.getProxyFileStrategyCfgList(new ProxyFileStrategyCfg());
|
||||
model.addAttribute("allProxyFileStrategys", allProxyFileStrategys);
|
||||
return "/cfg/proxy/control/httpRedirectList";
|
||||
}
|
||||
@RequestMapping(value = {"form"})
|
||||
@RequiresPermissions(value={"control:httpBlock:config"
|
||||
,"control:httpRedirect:config"
|
||||
,"control:httpReplace:config"
|
||||
,"control:httpMinit:config"
|
||||
,"control:httpWhitelist:config"
|
||||
}
|
||||
,logical=Logical.OR)
|
||||
public String form(Model model,HttpServletRequest request,HttpServletResponse response,String ids,@ModelAttribute("cfg")CfgIndexInfo entity){
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = httpRedirectCfgService.getHttpCfg(Long.parseLong(ids),null);
|
||||
|
||||
|
||||
@RequestMapping(value = { "form" })
|
||||
@RequiresPermissions(value = { "control:httpBlock:config", "control:httpRedirect:config",
|
||||
"control:httpReplace:config", "control:httpMinit:config",
|
||||
"control:httpWhitelist:config" }, logical = Logical.OR)
|
||||
public String form(Model model, HttpServletRequest request, HttpServletResponse response, String ids,
|
||||
@ModelAttribute("cfg") CfgIndexInfo entity) {
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
entity = httpRedirectCfgService.getHttpCfg(Long.parseLong(ids), null);
|
||||
|
||||
HttpUrlCfg urlCfg = new HttpUrlCfg();
|
||||
urlCfg.setCfgType(Constants.HTTP_REDIRECT_URL_REGION);
|
||||
entity.setHttpUrl(urlCfg);
|
||||
@@ -94,31 +96,31 @@ public class HttpRedirectPolicyController extends BaseController{
|
||||
NtcSubscribeIdCfg subscribeIdCfg = new NtcSubscribeIdCfg();
|
||||
subscribeIdCfg.setCfgType(Constants.PXY_CRTL_SUBSCRIBE_ID_REGION);
|
||||
entity.setNtcSubscribeIdCfg(subscribeIdCfg);
|
||||
|
||||
if(entity.getHttpUrlList().size()==0){
|
||||
|
||||
if (entity.getHttpUrlList().size() == 0) {
|
||||
entity.getHttpUrlList().add(urlCfg);
|
||||
}
|
||||
if(entity.getHttpReqHdrList().size()==0){
|
||||
if (entity.getHttpReqHdrList().size() == 0) {
|
||||
entity.getHttpReqHdrList().add(reqHdrCfg);
|
||||
}
|
||||
if(entity.getHttpResHdrList().size()==0){
|
||||
if (entity.getHttpResHdrList().size() == 0) {
|
||||
entity.getHttpResHdrList().add(resHdrCfg);
|
||||
}
|
||||
if(entity.getHttpReqBodyList().size()==0){
|
||||
if (entity.getHttpReqBodyList().size() == 0) {
|
||||
entity.getHttpReqBodyList().add(reqBodyCfg);
|
||||
}
|
||||
if(entity.getHttpResBodyList().size()==0){
|
||||
if (entity.getHttpResBodyList().size() == 0) {
|
||||
entity.getHttpResBodyList().add(resBodyCfg);
|
||||
}
|
||||
if(entity.getIpPortList().size()==0){
|
||||
if (entity.getIpPortList().size() == 0) {
|
||||
entity.getIpPortList().add(ipPortCfg);
|
||||
}
|
||||
if(entity.getNtcSubscribeIdCfgList().size()==0){
|
||||
if (entity.getNtcSubscribeIdCfgList().size() == 0) {
|
||||
entity.getNtcSubscribeIdCfgList().add(subscribeIdCfg);
|
||||
}
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
//设置http各类配置的配置域类型
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
// 设置http各类配置的配置域类型
|
||||
HttpUrlCfg urlCfg = new HttpUrlCfg();
|
||||
urlCfg.setCfgType(Constants.HTTP_REDIRECT_URL_REGION);
|
||||
entity.setHttpUrl(urlCfg);
|
||||
@@ -137,303 +139,321 @@ public class HttpRedirectPolicyController extends BaseController{
|
||||
IpPortCfg ipPortCfg = new IpPortCfg();
|
||||
ipPortCfg.setCfgType(Constants.HTTP_IP_REGION);
|
||||
entity.setIpPort(ipPortCfg);
|
||||
//subscribeId
|
||||
// subscribeId
|
||||
NtcSubscribeIdCfg subscribeIdCfg = new NtcSubscribeIdCfg();
|
||||
subscribeIdCfg.setCfgType(Constants.PXY_CRTL_SUBSCRIBE_ID_REGION);
|
||||
entity.setNtcSubscribeIdCfg(subscribeIdCfg);
|
||||
|
||||
List<HttpUrlCfg> urlList=new ArrayList<HttpUrlCfg>();
|
||||
|
||||
List<HttpUrlCfg> urlList = new ArrayList<HttpUrlCfg>();
|
||||
urlList.add(urlCfg);
|
||||
entity.setHttpUrlList(urlList);
|
||||
List<HttpReqHeadCfg> reqHdrList=new ArrayList<HttpReqHeadCfg>();
|
||||
List<HttpReqHeadCfg> reqHdrList = new ArrayList<HttpReqHeadCfg>();
|
||||
reqHdrList.add(reqHdrCfg);
|
||||
entity.setHttpReqHdrList(reqHdrList);
|
||||
List<HttpResHeadCfg> resHdrList=new ArrayList<HttpResHeadCfg>();
|
||||
List<HttpResHeadCfg> resHdrList = new ArrayList<HttpResHeadCfg>();
|
||||
resHdrList.add(resHdrCfg);
|
||||
entity.setHttpResHdrList(resHdrList);
|
||||
List<HttpBodyCfg> reqBodyList=new ArrayList<HttpBodyCfg>();
|
||||
List<HttpBodyCfg> reqBodyList = new ArrayList<HttpBodyCfg>();
|
||||
reqBodyList.add(reqBodyCfg);
|
||||
entity.setHttpReqBodyList(reqBodyList);
|
||||
List<HttpBodyCfg> resBodyList=new ArrayList<HttpBodyCfg>();
|
||||
List<HttpBodyCfg> resBodyList = new ArrayList<HttpBodyCfg>();
|
||||
resBodyList.add(resBodyCfg);
|
||||
entity.setHttpResBodyList(resBodyList);
|
||||
|
||||
List<IpPortCfg> ipPortList=new ArrayList<IpPortCfg>();
|
||||
|
||||
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);
|
||||
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
//获取所有的响应文件内容,阻断,或重定向时可以选择
|
||||
List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService.getProxyFileStrategyCfgList(new ProxyFileStrategyCfg());
|
||||
// 获取所有的响应文件内容,阻断,或重定向时可以选择
|
||||
List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService
|
||||
.getProxyFileStrategyCfgList(new ProxyFileStrategyCfg());
|
||||
model.addAttribute("_cfg", entity);
|
||||
model.addAttribute("allProxyFileStrategys", allProxyFileStrategys);
|
||||
return "/cfg/proxy/control/httpRedirectForm";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"saveOrUpdate"})
|
||||
@RequiresPermissions(value={"control:httpBlock:config"
|
||||
,"control:httpRedirect:config"
|
||||
,"control:httpReplace:config"
|
||||
,"control:httpMinit:config"
|
||||
,"control:httpWhitelist:config"}
|
||||
,logical=Logical.OR)
|
||||
public String saveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CfgIndexInfo cfg,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
|
||||
@RequestMapping(value = { "saveOrUpdate" })
|
||||
@RequiresPermissions(value = { "control:httpBlock:config", "control:httpRedirect:config",
|
||||
"control:httpReplace:config", "control:httpMinit:config",
|
||||
"control:httpWhitelist:config" }, logical = Logical.OR)
|
||||
public String saveOrUpdate(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") CfgIndexInfo cfg, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
httpRedirectCfgService.saveHttpCfg(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("信息保存失败", e);
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/proxy/control/httpRedirect/httpRedirectList?functionId="+cfg.getFunctionId();
|
||||
|
||||
return "redirect:" + adminPath + "/proxy/control/httpRedirect/httpRedirectList?functionId="
|
||||
+ cfg.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"ajaxHttpSubList"})
|
||||
public String ajaxHttpSubList(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
CfgIndexInfo cfg = httpRedirectCfgService.getHttpCfg(cfgId,compileId);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
|
||||
@RequestMapping(value = { "ajaxHttpSubList" })
|
||||
public String ajaxHttpSubList(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
CfgIndexInfo cfg = httpRedirectCfgService.getHttpCfg(cfgId, compileId);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
return "/cfg/proxy/control/httpRedirectSubList";
|
||||
}
|
||||
@RequestMapping(value = {"delete"})
|
||||
@RequiresPermissions(value={"control:httpBlock:config"
|
||||
,"control:httpRedirect:config"
|
||||
,"control:httpReplace:config"
|
||||
,"control:httpMinit:config"
|
||||
,"control:httpWhitelist:config"}
|
||||
,logical=Logical.OR)
|
||||
public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
httpRedirectCfgService.updateHttpCfgValid(isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/proxy/control/httpRedirect/httpRedirectList?functionId="+functionId;
|
||||
|
||||
@RequestMapping(value = { "delete" })
|
||||
@RequiresPermissions(value = { "control:httpBlock:config", "control:httpRedirect:config",
|
||||
"control:httpReplace:config", "control:httpMinit:config",
|
||||
"control:httpWhitelist:config" }, logical = Logical.OR)
|
||||
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId) {
|
||||
httpRedirectCfgService.updateHttpCfgValid(isValid, ids, functionId);
|
||||
return "redirect:" + adminPath + "/proxy/control/httpRedirect/httpRedirectList?functionId=" + functionId;
|
||||
}
|
||||
@RequestMapping(value = {"audit"})
|
||||
@RequiresPermissions(value={"control:httpBlock:confirm"
|
||||
,"control:httpRedirect:confirm"
|
||||
,"control:httpReplace:confirm"
|
||||
,"control:httpMinit:confirm"
|
||||
,"control:httpWhitelist:confirm"}
|
||||
,logical=Logical.OR)
|
||||
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 = httpRedirectCfgService.getHttpCfg(Long.parseLong(id),null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
httpRedirectCfgService.auditHttpCfg(entity,isAudit);
|
||||
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");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","audit_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{//条件下所有配置审核
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
Page<CfgIndexInfo> auditPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
|
||||
|
||||
@RequestMapping(value = { "audit" })
|
||||
@RequiresPermissions(value = { "control:httpBlock:confirm", "control:httpRedirect:confirm",
|
||||
"control:httpReplace:confirm", "control:httpMinit:confirm",
|
||||
"control:httpWhitelist:confirm" }, logical = Logical.OR)
|
||||
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 = httpRedirectCfgService.getHttpCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
httpRedirectCfgService.auditHttpCfg(entity, isAudit);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("配置下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
e.printStackTrace();
|
||||
logger.info("http重定向配置下发失败:" + e.getMessage());
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return list(model, request, response, cfg);
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/control/httpRedirect/httpRedirectList?functionId="+functionId;
|
||||
}
|
||||
|
||||
|
||||
//http配置导出
|
||||
@RequestMapping(value = "exportHttp")
|
||||
public void exportHttp(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CfgIndexInfo entity,String ids,RedirectAttributes redirectAttributes){
|
||||
} else {// 条件下所有配置审核
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
Page<CfgIndexInfo> auditPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
|
||||
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 = httpRedirectCfgService.getHttpRedirectList(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
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");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return list(model, request, response, cfg);
|
||||
}
|
||||
return "redirect:" + adminPath + "/proxy/control/httpRedirect/httpRedirectList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
// http配置导出
|
||||
@RequestMapping(value = "exportHttp")
|
||||
public void exportHttp(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") CfgIndexInfo 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<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 = httpRedirectCfgService.getHttpRedirectList(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
|
||||
Properties prop = getMsgProp();
|
||||
for (CfgIndexInfo str : ipLists) {
|
||||
if (entity.getFunctionId() != 210 && entity.getFunctionId() != 211) {
|
||||
String type = "RESPONSE_CODE";
|
||||
if (entity.getFunctionId() == 207) {
|
||||
type = "RESPONSE_CODE";
|
||||
} else if (entity.getFunctionId() == 208) {
|
||||
type = "REDIRECT_RESPONSE_CODE";
|
||||
} else if (entity.getFunctionId() == 209) {
|
||||
type = "CONTROL_REPLACE_ZONE";
|
||||
}
|
||||
|
||||
Properties prop = getMsgProp();
|
||||
for (CfgIndexInfo str :ipLists) {
|
||||
if(entity.getFunctionId()!=210 && entity.getFunctionId()!=211){
|
||||
String type="RESPONSE_CODE";
|
||||
if(entity.getFunctionId()==207){
|
||||
type="RESPONSE_CODE";
|
||||
}else if(entity.getFunctionId()==208){
|
||||
type="REDIRECT_RESPONSE_CODE";
|
||||
}else if(entity.getFunctionId()==209){
|
||||
type="CONTROL_REPLACE_ZONE";
|
||||
}
|
||||
String dictlabel= DictUtils.getDictLabel(type, str.getUserRegion1());
|
||||
str.setUserRegion1(prop.getProperty(dictlabel));
|
||||
if(entity.getFunctionId()==207 || entity.getFunctionId()==208){
|
||||
if(StringUtil.isEmpty(str.getUserRegion2())){
|
||||
if(!StringUtil.isEmpty(str.getUserRegion3())){
|
||||
ProxyFileStrategyCfg file= new ProxyFileStrategyCfg();
|
||||
file.setCompileId(Integer.valueOf(str.getUserRegion3()));
|
||||
List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService.getProxyFileStrategyCfgList(file);
|
||||
if(allProxyFileStrategys!=null && allProxyFileStrategys.size()>0){
|
||||
str.setUserRegion2(allProxyFileStrategys.get(0).getCfgDesc());
|
||||
}
|
||||
String dictlabel = DictUtils.getDictLabel(type, str.getUserRegion1());
|
||||
str.setUserRegion1(prop.getProperty(dictlabel));
|
||||
if (entity.getFunctionId() == 207 || entity.getFunctionId() == 208) {
|
||||
if (StringUtil.isEmpty(str.getUserRegion2())) {
|
||||
if (!StringUtil.isEmpty(str.getUserRegion3())) {
|
||||
ProxyFileStrategyCfg file = new ProxyFileStrategyCfg();
|
||||
file.setCompileId(Integer.valueOf(str.getUserRegion3()));
|
||||
List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService
|
||||
.getProxyFileStrategyCfgList(file);
|
||||
if (allProxyFileStrategys != null && allProxyFileStrategys.size() > 0) {
|
||||
str.setUserRegion2(allProxyFileStrategys.get(0).getCfgDesc());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String cfgIndexInfoNoExport=",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
if(entity.getFunctionId()==207){
|
||||
cfgIndexInfoNoExport=",policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:response_code-userregion2:response_content-";
|
||||
}else if(entity.getFunctionId()==208){
|
||||
cfgIndexInfoNoExport=",policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:redirect_response_code-userregion2:redirect_url-";
|
||||
}else if(entity.getFunctionId()==209){
|
||||
cfgIndexInfoNoExport=",policy_name,group_name,userregion4,userregion5,&userregion1:replace_zone-userregion2:replaced_content-userregion3:replace_content-";
|
||||
}else if(entity.getFunctionId()==211){
|
||||
cfgIndexInfoNoExport=",do_log,log_total,policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
}
|
||||
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,";
|
||||
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 (CfgIndexInfo cfg : ipLists) {
|
||||
Map<String, List> maps=httpRedirectCfgService.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"));
|
||||
}
|
||||
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(), CfgIndexInfo.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(), ipLists);
|
||||
dataMap.put("NTC_HTTP_URL", httpUrlList);
|
||||
dataMap.put("NTC_HTTP_REQ_HDR", httpReqHdrList);
|
||||
if(entity.getFunctionId()!=208 && 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_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);
|
||||
|
||||
/*}*/
|
||||
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");
|
||||
}
|
||||
}
|
||||
/*return "redirect:" + adminPath +"/ntc/website/httpList?functionId="+entity.getFunctionId();*/
|
||||
String cfgIndexInfoNoExport = ",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
if (entity.getFunctionId() == 207) {
|
||||
cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:response_code-userregion2:response_content-";
|
||||
} else if (entity.getFunctionId() == 208) {
|
||||
cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:redirect_response_code-userregion2:redirect_url-";
|
||||
} else if (entity.getFunctionId() == 209) {
|
||||
cfgIndexInfoNoExport = ",policy_name,group_name,userregion4,userregion5,&userregion1:replace_zone-userregion2:replaced_content-userregion3:replace_content-";
|
||||
} else if (entity.getFunctionId() == 211) {
|
||||
cfgIndexInfoNoExport = ",do_log,log_total,policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
}
|
||||
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 (CfgIndexInfo cfg : ipLists) {
|
||||
Map<String, List> maps = httpRedirectCfgService.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"));
|
||||
}
|
||||
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(), CfgIndexInfo.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(), ipLists);
|
||||
dataMap.put("NTC_HTTP_URL", httpUrlList);
|
||||
dataMap.put("NTC_HTTP_REQ_HDR", httpReqHdrList);
|
||||
if (entity.getFunctionId() != 208 && 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_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");
|
||||
}
|
||||
/*
|
||||
* return "redirect:" + adminPath
|
||||
* +"/ntc/website/httpList?functionId="+entity.getFunctionId();
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
@@ -27,6 +26,7 @@ import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.domain.configuration.InterceptPktBin;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.PxyObjKeyring;
|
||||
import com.nis.domain.configuration.PxyObjSpoofingIpPool;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
@@ -36,315 +36,361 @@ import com.nis.web.security.UserUtils;
|
||||
|
||||
/**
|
||||
* IP相关配置控制类
|
||||
*
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value={"${adminPath}/proxy/intercept"})
|
||||
public class InterceptController extends CommonController{
|
||||
|
||||
@RequestMapping(value = {"/ip/list","/domain/list","/ippayload/list"})
|
||||
public String ipList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
@RequestMapping(value = { "${adminPath}/proxy/intercept" })
|
||||
public class InterceptController extends CommonController {
|
||||
|
||||
@RequestMapping(value = { "/ip/list", "/domain/list", "/ippayload/list" })
|
||||
public String ipList(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
|
||||
Page<CfgIndexInfo> page = websiteCfgService.getWebsiteList(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
|
||||
//获取证书信息
|
||||
List<PxyObjKeyring> certificateList=new ArrayList<PxyObjKeyring>();
|
||||
if(cfg.getFunctionId().equals(200)){
|
||||
certificateList=pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "ip");
|
||||
initPageCondition(model, cfg);
|
||||
|
||||
// 获取证书信息
|
||||
List<PxyObjKeyring> certificateList = new ArrayList<PxyObjKeyring>();
|
||||
if (cfg.getFunctionId().equals(200)) {
|
||||
certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "ip");
|
||||
}
|
||||
if(cfg.getFunctionId().equals(201)){
|
||||
certificateList=pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "domain");
|
||||
if (cfg.getFunctionId().equals(201)) {
|
||||
certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "domain");
|
||||
}
|
||||
model.addAttribute("certificateList", certificateList);
|
||||
//IP地址仿冒策略使用策略组
|
||||
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(6);
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
/*if(cfg.getFunctionId().equals(214)){
|
||||
// IP地址仿冒策略使用策略组
|
||||
//List<PolicyGroupInfo> policyGroups = policyGroupInfoService.findPolicyGroupInfosByType(6);
|
||||
List<CfgIndexInfo> list = page.getList();
|
||||
for(CfgIndexInfo c:list){
|
||||
Long cfgId = Long.parseLong(c.getUserRegion2());//user_region2字段存储的为IP仿冒池的ID信息(策略组ID)
|
||||
PxyObjSpoofingIpPool pool = pxyObjSpoofingIpPoolService.getPxyObjSpoofingIpPool(cfgId);
|
||||
c.setUserRegion2(pool.getGroupName());//将IP仿冒池的策略组名重新赋给user_region2
|
||||
}
|
||||
|
||||
// model.addAttribute("policyGroups", policyGroups);
|
||||
}*/
|
||||
return "/cfg/intercept/interceptList";
|
||||
}
|
||||
@RequestMapping(value = {"/interceptIpForm","interceptDomainForm","interceptIpPayloadForm"})
|
||||
public String interceptIpForm(Model model,String ids,CfgIndexInfo entity) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = interceptCfgService.getInterceptCfg(Long.parseLong(ids),null);
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
initFormCondition(model,entity);
|
||||
|
||||
@RequestMapping(value = { "/interceptIpForm", "interceptDomainForm", "interceptIpPayloadForm" })
|
||||
public String interceptIpForm(Model model, String ids, CfgIndexInfo entity) {
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
entity = interceptCfgService.getInterceptCfg(Long.parseLong(ids), null);
|
||||
initUpdateFormCondition(model, entity);
|
||||
} else {
|
||||
initFormCondition(model, entity);
|
||||
}
|
||||
//获取证书信息
|
||||
List<PxyObjKeyring> certificateList=new ArrayList<PxyObjKeyring>();
|
||||
if(entity.getFunctionId().equals(200)){
|
||||
certificateList=pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "ip");
|
||||
// 获取证书信息
|
||||
List<PxyObjKeyring> certificateList = new ArrayList<PxyObjKeyring>();
|
||||
if (entity.getFunctionId().equals(200)) {
|
||||
certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "ip");
|
||||
}
|
||||
if(entity.getFunctionId().equals(201)){
|
||||
certificateList=pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "domain");
|
||||
if (entity.getFunctionId().equals(201)) {
|
||||
certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "domain");
|
||||
}
|
||||
model.addAttribute("certificateList", certificateList);
|
||||
|
||||
|
||||
model.addAttribute("_cfg", entity);
|
||||
//IP地址仿冒策略使用策略组
|
||||
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(6);
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
|
||||
// IP地址仿冒策略使用策略组
|
||||
// List<PolicyGroupInfo> policyGroups = policyGroupInfoService.findPolicyGroupInfosByType(6);
|
||||
// List<PxyObjSpoofingIpPool> pools = pxyObjSpoofingIpPoolService.findPxyObjSpoofingIpPools(new PxyObjSpoofingIpPool());
|
||||
// model.addAttribute("policyGroups", pools);
|
||||
|
||||
return "/cfg/intercept/interceptForm";
|
||||
}
|
||||
@RequestMapping(value = {"/ip/saveOrUpdate","/domain/saveOrUpdate","/ippayload/SaveOrUpdate"})
|
||||
public String saveInterceptIpCfg(RedirectAttributes redirectAttributes,Model model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
|
||||
|
||||
@RequestMapping(value = { "/ip/saveOrUpdate", "/domain/saveOrUpdate", "/ippayload/SaveOrUpdate" })
|
||||
public String saveInterceptIpCfg(RedirectAttributes redirectAttributes, Model model, HttpServletRequest request,
|
||||
HttpServletResponse response, String ids, CfgIndexInfo entity) {
|
||||
try {
|
||||
interceptCfgService.saveInterceptCfg(entity);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("save_failed", e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "save_failed");
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/intercept/ip/list?functionId="+entity.getFunctionId();
|
||||
return "redirect:" + adminPath + "/proxy/intercept/ip/list?functionId=" + entity.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/ajaxInterceptIpSubList","/ajaxInterceptDomainSubList","/ajaxInterceptIpPayloadSubList"})
|
||||
public String ajaxInterceptIpSubList(Model model,Long cfgId,Integer index,Integer compileId) {
|
||||
CfgIndexInfo cfg = interceptCfgService.getInterceptCfg(cfgId,compileId);
|
||||
|
||||
@RequestMapping(value = { "/ajaxInterceptIpSubList", "/ajaxInterceptDomainSubList",
|
||||
"/ajaxInterceptIpPayloadSubList" })
|
||||
public String ajaxInterceptIpSubList(Model model, Long cfgId, Integer index, Integer compileId) {
|
||||
CfgIndexInfo cfg = interceptCfgService.getInterceptCfg(cfgId, compileId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
if(cfg.getIpPortList()!=null){
|
||||
if (cfg.getIpPortList() != null) {
|
||||
String cfgType = null;
|
||||
for(IpPortCfg ip:cfg.getIpPortList()){
|
||||
if(!ip.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",ip.getCfgType()});
|
||||
for (IpPortCfg ip : cfg.getIpPortList()) {
|
||||
if (!ip.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "1", ip.getCfgType() });
|
||||
cfgType = ip.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getInterceptPktBinList()!=null){
|
||||
if (cfg.getInterceptPktBinList() != null) {
|
||||
String cfgType = null;
|
||||
for(BaseStringCfg keyword:cfg.getInterceptPktBinList()){
|
||||
if(!keyword.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",keyword.getCfgType()});
|
||||
for (BaseStringCfg keyword : cfg.getInterceptPktBinList()) {
|
||||
if (!keyword.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "2", keyword.getCfgType() });
|
||||
cfgType = keyword.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getHttpUrlList()!=null){
|
||||
if (cfg.getHttpUrlList() != null) {
|
||||
String cfgType = null;
|
||||
for(BaseStringCfg keyword:cfg.getHttpUrlList()){
|
||||
if(!keyword.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",keyword.getCfgType()});
|
||||
for (BaseStringCfg keyword : cfg.getHttpUrlList()) {
|
||||
if (!keyword.getCfgType().equals(cfgType)) {
|
||||
tabList.add(new String[] { "2", keyword.getCfgType() });
|
||||
cfgType = keyword.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/intercept/interceptSubList";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"auditInterceptIpCfg","auditInterceptDomainCfg","auditInterceptIpPayloadCfg"})
|
||||
public String auditInterceptIpCfg(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,
|
||||
Integer isValid,
|
||||
Integer isAudit,
|
||||
String ids,
|
||||
Integer functionId,
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
|
||||
@RequestMapping(value = { "auditInterceptIpCfg", "auditInterceptDomainCfg", "auditInterceptIpPayloadCfg" })
|
||||
public String auditInterceptIpCfg(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 = interceptCfgService.getInterceptCfg(Long.parseLong(id),null);
|
||||
for (String id : idArray) {
|
||||
entity = interceptCfgService.getInterceptCfg(Long.parseLong(id), null);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
interceptCfgService.auditInterceptIpCfg(entity,isAudit);
|
||||
addMessage(redirectAttributes,"success","audit_success");
|
||||
} catch ( Exception e) {
|
||||
logger.error("intercept ip audit failed",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
interceptCfgService.auditInterceptIpCfg(entity, isAudit);
|
||||
addMessage(redirectAttributes, "success", "audit_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("intercept ip audit failed", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{//条件下所有配置审核
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
Page<CfgIndexInfo> auditPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
} 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);
|
||||
auditAll(auditPage, isValid, cfg);
|
||||
} catch (Exception e) {
|
||||
logger.error("配置下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error", "audit_failed");
|
||||
logger.error("配置下发失败:", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
} else {
|
||||
addMessage(redirectAttributes, "error", "audit_failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return ipList(model, cfg, request, response);
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/intercept/ip/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/proxy/intercept/ip/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"updateInterceptIpValid","updateInterceptDomainValid","updateInterceptIpPayloadValid"})
|
||||
public String updateInterceptIpValid(Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
|
||||
@RequestMapping(value = { "updateInterceptIpValid", "updateInterceptDomainValid", "updateInterceptIpPayloadValid" })
|
||||
public String updateInterceptIpValid(Integer isValid, String ids, Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
interceptCfgService.updatInterceptValid(isValid,ids,functionId);
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
interceptCfgService.updatInterceptValid(isValid, ids, functionId);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("intercept ip delete failed",e);
|
||||
addMessage(redirectAttributes,"error","delete_failed");
|
||||
logger.error("intercept ip delete failed", e);
|
||||
addMessage(redirectAttributes, "error", "delete_failed");
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/intercept/ip/list?functionId="+functionId;
|
||||
return "redirect:" + adminPath + "/proxy/intercept/ip/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
//ip配置导入
|
||||
@RequestMapping(value = "/ip/import", method=RequestMethod.POST)
|
||||
public String importIp(String cfgName,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("file") MultipartFile file,IpPortCfg cfg) {
|
||||
this._importIp(cfgName,redirectAttributes, file,cfg,IpAddrTemplate.class);
|
||||
redirectAttributes.addAttribute("urlPrefix","/proxy/intercept/ip");
|
||||
redirectAttributes.addAttribute("requiresPermissionPrefix","intercept:ip");
|
||||
return "redirect:" + adminPath +"/proxy/intercept/ip/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = "/ip/import/template")
|
||||
public void importFileTemplate(HttpServletRequest request,HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode) {
|
||||
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,IpAddrTemplate.class);
|
||||
}
|
||||
//ip配置导出
|
||||
@RequestMapping(value = "/ip/export")
|
||||
public void exportIp(String columns,Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")IpPortCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
this._exportIp(columns,model, request, response, entity, ids, redirectAttributes);
|
||||
}*/
|
||||
|
||||
//ip配置导出
|
||||
@RequestMapping(value = "exportIpAddr")
|
||||
public void exportIpAddr(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CfgIndexInfo 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>();
|
||||
Map<String, String> replaceExportMap=new HashMap<String, String>();
|
||||
Properties prop = getMsgProp();
|
||||
List<CfgIndexInfo> ipLists=new ArrayList<CfgIndexInfo>();
|
||||
//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
ipLists=ipCfgService.getByIdsList(ids);
|
||||
}else{
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<CfgIndexInfo> pageInfo=new Page<CfgIndexInfo>(request, response,"a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CfgIndexInfo> page = ipCfgService.getIpCfgList(pageInfo, entity);
|
||||
ipLists=page.getList();
|
||||
}
|
||||
//获取证书信息
|
||||
List<PxyObjKeyring> certificateList=new ArrayList<PxyObjKeyring>();
|
||||
if(entity.getFunctionId().equals(200)){
|
||||
certificateList=pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "ip");
|
||||
}
|
||||
if(entity.getFunctionId().equals(201)){
|
||||
certificateList=pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "domain");
|
||||
}
|
||||
for (CfgIndexInfo str : ipLists) {
|
||||
if(!StringUtil.isEmpty(str.getUserRegion5())){
|
||||
String cs= DictUtils.getDictLabel("INTERCEPT_DOMAIN_INTENSITY", str.getUserRegion5());
|
||||
str.setUserRegion5(prop.getProperty(cs));
|
||||
}
|
||||
if(certificateList!=null){
|
||||
if(entity.getFunctionId()==200|| entity.getFunctionId()==201){
|
||||
if(!StringUtil.isEmpty(str.getUserRegion1())){
|
||||
boolean flag=false;
|
||||
for (PxyObjKeyring pxyObjKeyring : certificateList) {
|
||||
if(str.getUserRegion1().equals(String.valueOf(pxyObjKeyring.getCompileId()))){
|
||||
str.setUserRegion1(pxyObjKeyring.getCfgDesc());
|
||||
flag=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!flag){
|
||||
str.setUserRegion1(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
String cfgIndexInfoNoExport="";
|
||||
String ipPortInfoNoExport=",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 interceptNoExport=",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 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,";
|
||||
|
||||
List<IpPortCfg> ipList=new ArrayList<IpPortCfg>();
|
||||
List<BaseStringCfg> httpUrlList=new ArrayList<BaseStringCfg>();
|
||||
List<BaseStringCfg> pktBinList=new ArrayList<BaseStringCfg>();
|
||||
for (CfgIndexInfo cfg : ipLists) {
|
||||
Map<String, List> maps=interceptCfgService.exportIpInfo(cfg);
|
||||
httpUrlList.addAll(maps.get("NTC_HTTP_URL"));
|
||||
ipList.addAll(maps.get("PXY_INTERCEPT_IP"));
|
||||
pktBinList.addAll(maps.get("PXY_INTERCEPT_PKT_BIN"));
|
||||
}
|
||||
pktBinList=BaseStringCfg.replaceBaseKeyList(pktBinList);
|
||||
httpUrlList=BaseStringCfg.baseHexList(httpUrlList);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
if(entity.getFunctionId()==212){ //IP Payload
|
||||
cfgIndexInfoNoExport=",do_log,log_total,policy_name,group_name,userregion4,userregion5,&userregion1:replace_zone-userregion2:replaced_content-userregion3:replace_content-";
|
||||
titleList.add("PXY_INTERCEPT_IP");
|
||||
titleList.add("PXY_INTERCEPT_PKT_BIN");
|
||||
classMap.put("PXY_INTERCEPT_IP", IpPortCfg.class);
|
||||
classMap.put("PXY_INTERCEPT_PKT_BIN", InterceptPktBin.class);
|
||||
noExportMap.put("PXY_INTERCEPT_IP", ipPortInfoNoExport);
|
||||
noExportMap.put("PXY_INTERCEPT_PKT_BIN", interceptNoExport);
|
||||
dataMap.put("PXY_INTERCEPT_IP", ipList);
|
||||
dataMap.put("PXY_INTERCEPT_PKT_BIN", pktBinList);
|
||||
}else if(entity.getFunctionId()==200){//IP拦截
|
||||
cfgIndexInfoNoExport=",policy_name,group_name,userregion3,userregion4,userregion5,&userregion2:ratelimit-userregion1:certificate-";
|
||||
titleList.add("PXY_INTERCEPT_IP");
|
||||
classMap.put("PXY_INTERCEPT_IP", IpPortCfg.class);
|
||||
noExportMap.put("PXY_INTERCEPT_IP", ipPortInfoNoExport);
|
||||
dataMap.put("PXY_INTERCEPT_IP", ipList);
|
||||
}else if(entity.getFunctionId()==201){//域名拦截
|
||||
cfgIndexInfoNoExport=",policy_name,group_name,userregion3,userregion4,&userregion2:ratelimit-userregion1:certificate-userregion5:intercept_intensity-";
|
||||
titleList.add("NTC_HTTP_URL");
|
||||
classMap.put("NTC_HTTP_URL", HttpUrlCfg.class);
|
||||
noExportMap.put("NTC_HTTP_URL", httpUrlCfgNoExport);
|
||||
dataMap.put("NTC_HTTP_URL", httpUrlList);
|
||||
}
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("ip addr export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
* //ip配置导入
|
||||
*
|
||||
* @RequestMapping(value = "/ip/import", method=RequestMethod.POST) public
|
||||
* String importIp(String cfgName,RedirectAttributes redirectAttributes,
|
||||
*
|
||||
* @RequestParam("file") MultipartFile file,IpPortCfg cfg) {
|
||||
* this._importIp(cfgName,redirectAttributes,
|
||||
* file,cfg,IpAddrTemplate.class);
|
||||
* redirectAttributes.addAttribute("urlPrefix","/proxy/intercept/ip");
|
||||
* redirectAttributes.addAttribute("requiresPermissionPrefix","intercept:ip"
|
||||
* ); return "redirect:" + adminPath
|
||||
* +"/proxy/intercept/ip/list?functionId="+cfg.getFunctionId(); }
|
||||
*
|
||||
* @RequestMapping(value = "/ip/import/template") public void
|
||||
* importFileTemplate(HttpServletRequest request,HttpServletResponse
|
||||
* response, RedirectAttributes redirectAttributes,Integer
|
||||
* functionId,Integer cfgRegionCode) { this._importFileTemplate(request,
|
||||
* response, redirectAttributes, functionId,
|
||||
* cfgRegionCode,IpAddrTemplate.class); } //ip配置导出
|
||||
*
|
||||
* @RequestMapping(value = "/ip/export") public void exportIp(String
|
||||
* columns,Model model,HttpServletRequest request,HttpServletResponse
|
||||
* response,
|
||||
*
|
||||
* @ModelAttribute("cfg")IpPortCfg entity,String ids,RedirectAttributes
|
||||
* redirectAttributes){ this._exportIp(columns,model, request, response,
|
||||
* entity, ids, redirectAttributes); }
|
||||
*/
|
||||
|
||||
// ip配置导出
|
||||
@RequestMapping(value = "exportIpAddr")
|
||||
public void exportIpAddr(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") CfgIndexInfo 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>();
|
||||
Map<String, String> replaceExportMap = new HashMap<String, String>();
|
||||
Properties prop = getMsgProp();
|
||||
List<CfgIndexInfo> ipLists = new ArrayList<CfgIndexInfo>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = ipCfgService.getByIdsList(ids);
|
||||
} else {
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<CfgIndexInfo> pageInfo = new Page<CfgIndexInfo>(request, response, "a");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<CfgIndexInfo> page = ipCfgService.getIpCfgList(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
// 获取证书信息
|
||||
List<PxyObjKeyring> certificateList = new ArrayList<PxyObjKeyring>();
|
||||
if (entity.getFunctionId().equals(200)) {
|
||||
certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "ip");
|
||||
}
|
||||
if (entity.getFunctionId().equals(201)) {
|
||||
certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "domain");
|
||||
}
|
||||
for (CfgIndexInfo str : ipLists) {
|
||||
if (!StringUtil.isEmpty(str.getUserRegion5())) {
|
||||
String cs = DictUtils.getDictLabel("INTERCEPT_DOMAIN_INTENSITY", str.getUserRegion5());
|
||||
str.setUserRegion5(prop.getProperty(cs));
|
||||
}
|
||||
if (certificateList != null) {
|
||||
if (entity.getFunctionId() == 200 || entity.getFunctionId() == 201) {
|
||||
if (!StringUtil.isEmpty(str.getUserRegion1())) {
|
||||
boolean flag = false;
|
||||
for (PxyObjKeyring pxyObjKeyring : certificateList) {
|
||||
if (str.getUserRegion1().equals(String.valueOf(pxyObjKeyring.getCompileId()))) {
|
||||
str.setUserRegion1(pxyObjKeyring.getCfgDesc());
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
str.setUserRegion1(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
String cfgIndexInfoNoExport = "";
|
||||
String ipPortInfoNoExport = ",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 interceptNoExport = ",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 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,";
|
||||
|
||||
List<IpPortCfg> ipList = new ArrayList<IpPortCfg>();
|
||||
List<BaseStringCfg> httpUrlList = new ArrayList<BaseStringCfg>();
|
||||
List<BaseStringCfg> pktBinList = new ArrayList<BaseStringCfg>();
|
||||
for (CfgIndexInfo cfg : ipLists) {
|
||||
Map<String, List> maps = interceptCfgService.exportIpInfo(cfg);
|
||||
httpUrlList.addAll(maps.get("NTC_HTTP_URL"));
|
||||
ipList.addAll(maps.get("PXY_INTERCEPT_IP"));
|
||||
pktBinList.addAll(maps.get("PXY_INTERCEPT_PKT_BIN"));
|
||||
}
|
||||
pktBinList = BaseStringCfg.replaceBaseKeyList(pktBinList);
|
||||
httpUrlList = BaseStringCfg.baseHexList(httpUrlList);
|
||||
dataMap.put(entity.getMenuNameCode(), ipLists);
|
||||
if (entity.getFunctionId() == 212) { // IP Payload
|
||||
cfgIndexInfoNoExport = ",do_log,log_total,policy_name,group_name,userregion4,userregion5,&userregion1:replace_zone-userregion2:replaced_content-userregion3:replace_content-";
|
||||
titleList.add("PXY_INTERCEPT_IP");
|
||||
titleList.add("PXY_INTERCEPT_PKT_BIN");
|
||||
classMap.put("PXY_INTERCEPT_IP", IpPortCfg.class);
|
||||
classMap.put("PXY_INTERCEPT_PKT_BIN", InterceptPktBin.class);
|
||||
noExportMap.put("PXY_INTERCEPT_IP", ipPortInfoNoExport);
|
||||
noExportMap.put("PXY_INTERCEPT_PKT_BIN", interceptNoExport);
|
||||
dataMap.put("PXY_INTERCEPT_IP", ipList);
|
||||
dataMap.put("PXY_INTERCEPT_PKT_BIN", pktBinList);
|
||||
} else if (entity.getFunctionId() == 200) {// IP拦截
|
||||
cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,userregion5,userregion2,&userregion1:intercept_file_strategy-";
|
||||
titleList.add("PXY_INTERCEPT_IP");
|
||||
classMap.put("PXY_INTERCEPT_IP", IpPortCfg.class);
|
||||
noExportMap.put("PXY_INTERCEPT_IP", ipPortInfoNoExport);
|
||||
dataMap.put("PXY_INTERCEPT_IP", ipList);
|
||||
} else if (entity.getFunctionId() == 201) {// 域名拦截
|
||||
cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,&userregion2:ratelimit-userregion1:intercept_file_strategy-userregion5:intercept_intensity-";
|
||||
titleList.add("NTC_HTTP_URL");
|
||||
classMap.put("NTC_HTTP_URL", HttpUrlCfg.class);
|
||||
noExportMap.put("NTC_HTTP_URL", httpUrlCfgNoExport);
|
||||
dataMap.put("NTC_HTTP_URL", httpUrlList);
|
||||
}else if(entity.getFunctionId()==214){
|
||||
cfgIndexInfoNoExport=",policy_name,group_name,userregion3,userregion4,userregion5,&userregion2:With-userregion1:Spoofing-";
|
||||
}
|
||||
// 时间过滤
|
||||
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);
|
||||
|
||||
/* } */
|
||||
|
||||
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("ip addr export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -39,6 +39,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.DnsResStrategy;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.PxyObjSpoofingIpPool;
|
||||
@@ -88,7 +89,7 @@ public class PxyObjSpoofingIpPoolController extends BaseController {
|
||||
model.addAttribute("isAdd", true);
|
||||
}
|
||||
|
||||
List<PolicyGroupInfo> groups=policyGroupInfoService.findPolicyGroupInfosByType(6);
|
||||
/*List<PolicyGroupInfo> groups=policyGroupInfoService.findPolicyGroupInfosByType(6);
|
||||
List<PolicyGroupInfo> policyGroups = new ArrayList();
|
||||
//解决目前一个分组只能有一个生效IP
|
||||
for(PolicyGroupInfo group:groups){
|
||||
@@ -100,7 +101,7 @@ public class PxyObjSpoofingIpPoolController extends BaseController {
|
||||
policyGroups.add(group);
|
||||
}
|
||||
}
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
model.addAttribute("policyGroups", policyGroups);*/
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/proxy/spoofingIpPool/form";
|
||||
}
|
||||
@@ -198,4 +199,66 @@ public class PxyObjSpoofingIpPoolController extends BaseController {
|
||||
return "redirect:" + adminPath +"/proxy/spoofing/pool/list?functionId="+functionId;
|
||||
}
|
||||
|
||||
|
||||
// ip配置导出
|
||||
@RequestMapping(value = "exportIpPool")
|
||||
public void exportIpAddr(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") PxyObjSpoofingIpPool 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<PxyObjSpoofingIpPool> ipLists = new ArrayList<PxyObjSpoofingIpPool>();
|
||||
// 导出选中记录
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
ipLists = pxyObjSpoofingIpPoolService.findByPage(ids);
|
||||
} else {
|
||||
Page<PxyObjSpoofingIpPool> pageInfo = new Page<PxyObjSpoofingIpPool>(request, response, "r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page<PxyObjSpoofingIpPool> page = pxyObjSpoofingIpPoolService.findPage(pageInfo, entity);
|
||||
ipLists = page.getList();
|
||||
}
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), PxyObjSpoofingIpPool.class);
|
||||
String cfgIndexInfoNoExport = ",policy_name,do_log,ir_type,whether_area_block,do_blacklist,block_type,ip_pattern,client_ip,server_ip,port_pattern,client_port,server_port,direction,protocol,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("ip white export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -133,4 +134,61 @@ public class ConfigureStatisticsController extends BaseController{
|
||||
map.put("ruleLimit", ruleLimit);
|
||||
return map;
|
||||
}
|
||||
|
||||
//configureStateStatisticsPrint
|
||||
@ResponseBody
|
||||
@RequestMapping(value = {"/configureStateStatisticsPrint"})
|
||||
public Map configureStateStatisticsPrint(Model model,HttpServletRequest request
|
||||
,HttpServletResponse response
|
||||
,RedirectAttributes redirectAttributes){
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
/****************************Request Info Statistics*****************************/
|
||||
//1、查询所有有效的service
|
||||
List<FunctionServiceDict> serviceDictList = DictUtils.getFunctionServiceDictList();
|
||||
//2、查询所有菜单
|
||||
List<SysMenu> menuList = UserUtils.getMenuCfgList();
|
||||
//3、根据来函分页
|
||||
RequestInfo requestInfo=new RequestInfo();
|
||||
requestInfo.setIsAudit(1);
|
||||
requestInfo.setIsValid(1);
|
||||
Page page = new Page(request, response,"r");
|
||||
page.setPageNo(1);
|
||||
page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE);
|
||||
Page requestPage = requestInfoService.findRequestInfo(page,requestInfo);
|
||||
List<RequestInfo> requestInfos=requestPage.getList();
|
||||
//4、根据当前页的requestInfo信息查询request统计信息
|
||||
List<Object[]> requestStatisticList=new ArrayList<Object[]>();
|
||||
if(!StringUtil.isEmpty(requestInfos)){
|
||||
Date requestStatisticTime=configureStatisticsService.getRequestStatisticTime();
|
||||
String requestStatisticTimeStr="";
|
||||
if(!StringUtil.isEmpty(requestStatisticTime)){
|
||||
requestStatisticTimeStr=sdf.format(requestStatisticTime);
|
||||
}
|
||||
requestStatisticList=configureStatisticsService.getRequestStateStatistics(requestInfos,menuList,requestStatisticTimeStr);
|
||||
if(!StringUtil.isEmpty(requestStatisticList)){
|
||||
for (Iterator iterator = requestStatisticList.iterator(); iterator.hasNext();) {
|
||||
Map map = (Map) iterator.next();
|
||||
for (RequestInfo requestInfoO : requestInfos) {
|
||||
if(requestInfoO.getId().toString().equals(map.get("request").toString())){
|
||||
map.put("request", requestInfoO.getRequestTitle());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
model.addAttribute("requestStatisticTime", requestStatisticTimeStr);
|
||||
}
|
||||
Properties msgProp = getMsgProp();
|
||||
for (int i = 0; i < menuList.size(); i++) {
|
||||
String property = msgProp.getProperty(menuList.get(i).getCode(), menuList.get(i).getCode());
|
||||
menuList.get(i).setCode(property);
|
||||
}
|
||||
requestPage.setList(requestStatisticList);
|
||||
model.addAttribute("requestInfos", requestInfos);
|
||||
model.addAttribute("serviceList", serviceDictList);
|
||||
model.addAttribute("page", requestPage);
|
||||
Map<String,Object> maps=new HashMap<String,Object>();
|
||||
maps.put("menuList", menuList);
|
||||
maps.put("requestStatisticList", requestStatisticList);
|
||||
return maps;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -94,6 +96,49 @@ public class DashboardController extends BaseController{
|
||||
}
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 跳转活跃端口详情界面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="portActiveChart")
|
||||
@ResponseBody
|
||||
public List portActiveChart(String beginDate,String endDate){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
try {
|
||||
String url=Constants.DASHBOARD_URL+Constants.TRAFFIC_PORTACTIVE_FIVEMINUTE;//+Constants.TRAFFIC_IPACTIVE_ONEHOUR;
|
||||
url=urlAddDate(url, beginDate, endDate);
|
||||
String string = HttpClientUtil.get(url);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
||||
logger.debug("活跃端口从"+beginDate+"到"+endDate+",间隔5分钟数据"+fromJsonList);
|
||||
list = (ArrayList) fromJsonList.get("data");
|
||||
return list;
|
||||
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
logger.error("活跃端口详情界面数据获取错误"+e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转活跃端口详情界面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="portActiveList")
|
||||
public String portActiveList(Model model){
|
||||
// 默认当前时间一小时
|
||||
Calendar cal = Calendar. getInstance ();
|
||||
cal.setTime(new Date());
|
||||
String endDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());//获取到完整的时间
|
||||
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1);
|
||||
String beginDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());
|
||||
model.addAttribute("beginDate", beginDate);
|
||||
model.addAttribute("endDate", endDate);
|
||||
return "/dashboard/trafficPortActiveList";
|
||||
}
|
||||
/**
|
||||
* 活跃IP TOP10
|
||||
*/
|
||||
@@ -194,7 +239,7 @@ public class DashboardController extends BaseController{
|
||||
return "/dashboard/trafficIpActiveList";
|
||||
}
|
||||
/**
|
||||
* 活跃IP TOP10 一小时 间隔5分钟数据
|
||||
* 活跃IP TOP10 一小时每个IP的最大值
|
||||
*/
|
||||
@RequestMapping(value="ajaxIpActiveList")
|
||||
@ResponseBody
|
||||
@@ -209,6 +254,24 @@ public class DashboardController extends BaseController{
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map<String, Object>>(){}.getType());
|
||||
logger.debug("活跃IP1小时"+fromJsonList);
|
||||
list = gson.fromJson(fromJsonList.get("data").toString(), new TypeToken<List<TrafficIpActiveStatistic>>() {}.getType()) ;
|
||||
Collections.sort(list, new Comparator<TrafficIpActiveStatistic>() {
|
||||
|
||||
@Override
|
||||
public int compare(TrafficIpActiveStatistic o1, TrafficIpActiveStatistic o2) {
|
||||
if(o1==null&&o2!=null){
|
||||
return 1;
|
||||
}
|
||||
if(o1!=null&&o2==null){
|
||||
return -1;
|
||||
}
|
||||
if(o1==o2&&o1==null){
|
||||
return 0;
|
||||
}
|
||||
Long ob1 = o1.getC2sByteLen()+o1.getS2cByteLen();
|
||||
Long ob2 = o2.getC2sByteLen()+o2.getS2cByteLen();
|
||||
return -(ob1).compareTo(ob2);
|
||||
}
|
||||
});
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -283,19 +346,19 @@ public class DashboardController extends BaseController{
|
||||
//将数字替换为标签文字
|
||||
if(list!=null&&!list.isEmpty()){
|
||||
for (Map map : list) {
|
||||
Double value1 = Double.parseDouble(map.get("protoType").toString());
|
||||
Double value1 = Double.parseDouble(map.get("protoType").toString().trim());
|
||||
for (CodeResult code : codeList) {
|
||||
Double value2 = Double.valueOf(code.getCode());
|
||||
Double value2 = Double.valueOf(code.getCode().trim());
|
||||
if(value1.equals(value2)){
|
||||
map.put("protoType", code.getItem());
|
||||
map.put("protoType", code.getItem().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 协议没匹配的匹配app码表
|
||||
for (CodeResult code : appCodeList) {
|
||||
Double value3 = Double.valueOf(code.getCode());
|
||||
Double value3 = Double.valueOf(code.getCode().trim());
|
||||
if(value1.equals(value3)){
|
||||
map.put("protoType", code.getItem());
|
||||
map.put("protoType", code.getItem().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -330,11 +393,11 @@ public class DashboardController extends BaseController{
|
||||
//将数字替换为标签文字
|
||||
if(list!=null&&!list.isEmpty()){
|
||||
for (Map map : list) {
|
||||
Double value1 = Double.parseDouble(map.get("appType").toString());
|
||||
Double value1 = Double.parseDouble(map.get("appType").toString().trim());
|
||||
for (CodeResult code : codeList) {
|
||||
Double value2 = Double.valueOf(code.getCode());
|
||||
Double value2 = Double.valueOf(code.getCode().trim());
|
||||
if(value1.equals(value2)){
|
||||
map.put("appType", code.getItem());
|
||||
map.put("appType", code.getItem().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -369,11 +432,11 @@ public class DashboardController extends BaseController{
|
||||
//将数字替换为标签文字
|
||||
if(list!=null&&!list.isEmpty()){
|
||||
for (Map map : list) {
|
||||
Double value1 = Double.parseDouble(map.get("osType").toString());
|
||||
Double value1 = Double.parseDouble(map.get("osType").toString().trim());
|
||||
for (CodeResult code : codeList) {
|
||||
Double value2 = Double.valueOf(code.getCode());
|
||||
Double value2 = Double.valueOf(code.getCode().trim());
|
||||
if(value1.equals(value2)){
|
||||
map.put("osType", code.getItem());
|
||||
map.put("osType", code.getItem().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -403,8 +466,8 @@ public class DashboardController extends BaseController{
|
||||
//将标签文字转为数字
|
||||
Integer os=null;
|
||||
for (CodeResult codeResult : codeList1) {
|
||||
if(osType.equalsIgnoreCase(codeResult.getItem())){
|
||||
os=Integer.parseInt(codeResult.getCode());
|
||||
if(osType.equalsIgnoreCase(codeResult.getItem().trim())){
|
||||
os=Integer.parseInt(codeResult.getCode().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -421,11 +484,11 @@ public class DashboardController extends BaseController{
|
||||
//将数字替换为标签文字
|
||||
if(null!=list&&!list.isEmpty()){
|
||||
for (Map map : list) {
|
||||
Double value1 = Double.parseDouble(map.get("bsType").toString());
|
||||
Double value1 = Double.parseDouble(map.get("bsType").toString().trim());
|
||||
for (CodeResult code : codeList2) {
|
||||
Double value2 = Double.valueOf(code.getCode());
|
||||
Double value2 = Double.valueOf(code.getCode().trim());
|
||||
if(value1.equals(value2)){
|
||||
map.put("bsType", code.getItem());
|
||||
map.put("bsType", code.getItem().trim());
|
||||
break;
|
||||
}
|
||||
//10个域名之外的为others 设为-1外
|
||||
@@ -465,11 +528,11 @@ public class DashboardController extends BaseController{
|
||||
//将数字替换为标签文字
|
||||
if(list!=null&&!list.isEmpty()){
|
||||
for (Map map : list) {
|
||||
Double value1 = Double.parseDouble(map.get("bsType").toString());
|
||||
Double value1 = Double.parseDouble(map.get("bsType").toString().trim());
|
||||
for (CodeResult code : codeList) {
|
||||
Double value2 = Double.valueOf(code.getCode());
|
||||
Double value2 = Double.valueOf(code.getCode().trim());
|
||||
if(value1.equals(value2)){
|
||||
map.put("bsType", code.getItem());
|
||||
map.put("bsType", code.getItem().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -499,13 +562,13 @@ public class DashboardController extends BaseController{
|
||||
//将标签文字转为数字
|
||||
Integer bs=null;
|
||||
for (CodeResult codeResult : codeList1) {
|
||||
if(bsType.equalsIgnoreCase(codeResult.getItem())){
|
||||
bs=Integer.parseInt(codeResult.getCode());
|
||||
if(bsType.equalsIgnoreCase(codeResult.getItem().trim())){
|
||||
bs=Integer.parseInt(codeResult.getCode().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(bs==null){
|
||||
bs=Integer.parseInt(bsType);//处理为匹配项编码
|
||||
bs=Integer.parseInt(bsType.trim());//处理为匹配项编码
|
||||
}
|
||||
try {
|
||||
String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.TRAFFIC_SYSTEM_CHART+"?bsType="+bs);
|
||||
@@ -517,16 +580,16 @@ public class DashboardController extends BaseController{
|
||||
//将数字替换为标签文字
|
||||
if(null!=list&&!list.isEmpty()){
|
||||
for (Map map : list) {
|
||||
Double value1 = Double.parseDouble(map.get("osType").toString());
|
||||
Double value1 = Double.parseDouble(map.get("osType").toString().trim());
|
||||
for (CodeResult code : codeList2) {
|
||||
Double value2 = Double.valueOf(code.getCode());
|
||||
Double value2 = Double.valueOf(code.getCode().trim());
|
||||
//10个域名之外的为others webId设为-1外
|
||||
if(map.get("osType").toString().equals("-1")){
|
||||
map.put("osType", "Others");
|
||||
break;
|
||||
}
|
||||
if(value1.equals(value2)){
|
||||
map.put("osType", code.getItem());
|
||||
map.put("osType", code.getItem().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -563,15 +626,15 @@ public class DashboardController extends BaseController{
|
||||
if(list!=null&&!list.isEmpty()){
|
||||
for (Map map : list) {
|
||||
Double value1=0d;
|
||||
if(StringUtil.isBlank(map.get("websiteServiceId").toString())){
|
||||
if(StringUtil.isBlank(map.get("websiteServiceId").toString().trim())){
|
||||
value1=268435455d;
|
||||
}else{
|
||||
value1 = Double.parseDouble(map.get("websiteServiceId").toString());
|
||||
value1 = Double.parseDouble(map.get("websiteServiceId").toString().trim());
|
||||
}
|
||||
for (SysDataDictionaryItem code : codeList) {
|
||||
Double value2 = Double.valueOf(code.getItemCode());
|
||||
Double value2 = Double.valueOf(code.getItemCode().trim());
|
||||
if(value1.equals(value2)){
|
||||
map.put("websiteService", code.getItemValue());
|
||||
map.put("websiteService", code.getItemValue().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -611,7 +674,7 @@ public class DashboardController extends BaseController{
|
||||
if(wdt!=null){
|
||||
String domain = wdt.getDomain();
|
||||
Double domainId = wdt.getId().doubleValue();
|
||||
Double webId = Double.parseDouble(dataMap.get("webId").toString());
|
||||
Double webId = Double.parseDouble(dataMap.get("webId").toString().trim());
|
||||
//10个域名之外的为others webId设为-1外
|
||||
if(dataMap.get("webId").toString().equals("-1")){
|
||||
dataMap.put("domain", "Others");
|
||||
@@ -661,12 +724,12 @@ public class DashboardController extends BaseController{
|
||||
if(StringUtil.isBlank(map.get("topicId").toString())){
|
||||
value1=268435455d;
|
||||
}else{
|
||||
value1 = Double.parseDouble(map.get("topicId").toString());
|
||||
value1 = Double.parseDouble(map.get("topicId").toString().trim());
|
||||
}
|
||||
for (SysDataDictionaryItem code : codeList) {
|
||||
Double value2 = Double.valueOf(code.getItemCode());
|
||||
Double value2 = Double.valueOf(code.getItemCode().trim());
|
||||
if(value1.equals(value2)){
|
||||
map.put("topic", code.getItemValue());
|
||||
map.put("topic", code.getItemValue().trim());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -678,7 +741,7 @@ public class DashboardController extends BaseController{
|
||||
if(wdt!=null){
|
||||
String domain = wdt.getDomain();
|
||||
Double domainId = wdt.getId().doubleValue();
|
||||
Double webId = Double.parseDouble(dataMap.get("webId").toString());
|
||||
Double webId = Double.parseDouble(dataMap.get("webId").toString().trim());
|
||||
//10个域名之外的为others webId设为-1
|
||||
// if(dataMap.get("webId").toString().equals("-1")){
|
||||
// dataMap.put("domain", "Others");
|
||||
|
||||
@@ -67,27 +67,26 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
HashMap<String, Object> m = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
try {
|
||||
String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.NTC_TOTAL_REPORT);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
||||
list = (ArrayList) fromJsonList.get("data");
|
||||
Random r = new Random();
|
||||
Double rejectNum=0d;
|
||||
Double dropConnNum=0d;
|
||||
Double monitorNum=0d;
|
||||
Double loopConnNum=0d;
|
||||
Double liveConnNum=0d;
|
||||
Double closeConnNum=0d;
|
||||
Double newUniConnNum=0d;
|
||||
Double inoctetsNum=0d;
|
||||
Double outoctetsNum=0d;
|
||||
Double bandwidth=0d;
|
||||
if(list!=null&&list.size()>0){
|
||||
String string = HttpClientUtil.get(Constants.DASHBOARD_URL+Constants.NTC_TOTAL_REPORT);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
||||
list = (ArrayList) fromJsonList.get("data");
|
||||
if(fromJsonList!=null&&list!=null&&list.size()>0){
|
||||
Map map = (Map) list.get(0);
|
||||
rejectNum = (Double) map.get("rejectNum") ;
|
||||
monitorNum = (Double) map.get("monitorNum");
|
||||
dropConnNum = (Double) map.get("dropConnNum");
|
||||
loopConnNum = (Double) map.get("loopConnNum");
|
||||
liveConnNum = (Double) map.get("liveConnNum");
|
||||
closeConnNum = (Double) map.get("closeConnNum");
|
||||
newUniConnNum = (Double) map.get("newUniConnNum");
|
||||
inoctetsNum = (Double) map.get("inoctets");
|
||||
outoctetsNum = (Double) map.get("outoctets");
|
||||
@@ -101,7 +100,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
m.put("monitorNum", monitorNum);
|
||||
m.put("loopConnNum", loopConnNum);
|
||||
m.put("dropConnNum", dropConnNum);
|
||||
m.put("liveConnNum", liveConnNum);
|
||||
m.put("closeConnNum", closeConnNum);
|
||||
m.put("newUniConnNum", newUniConnNum);
|
||||
|
||||
m.put("bandwidth", bandwidth);
|
||||
@@ -261,17 +260,15 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value="bandwidthTransThree")
|
||||
@ResponseBody
|
||||
public Map bandwidthTransThree(String beginDate,String endDate){
|
||||
public Map bandwidthTransThree(String beginDate,String endDate,String searchQuotaType){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
Map map = new HashMap();
|
||||
//String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_BANDWIDTH_TRANS_TWO;
|
||||
//String url="http://192.168.11.78:8080/galaxy/service/log/v1/"+Constants.TRAFFIC_BANDWIDTH_TRANS_THREE;
|
||||
//String url="http://192.168.11.78:8080/galaxy/service/log/v1/"+Constants.TRAFFIC_BANDWIDTH_TRANS_FOUR;
|
||||
String url=Constants.DASHBOARD_URL+Constants.TRAFFIC_BANDWIDTH_TRANS_THREE;
|
||||
//String url=Constants.DASHBOARD_URL+Constants.TRAFFIC_BANDWIDTH_TRANS_FOUR;
|
||||
try {
|
||||
url=urlAddDate(url,beginDate,endDate);
|
||||
|
||||
url=url+"&searchQuotaType="+searchQuotaType;
|
||||
String string = HttpClientUtil.get(url);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
||||
@@ -303,12 +300,19 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value="protocolList")
|
||||
@ResponseBody
|
||||
public List protocolList(Model model,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate){
|
||||
public List protocolList(Model model,Integer[] protoType,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_PROTOCOL_LIST;
|
||||
try {
|
||||
url=urlAddDate(url,beginDate,endDate);
|
||||
if(protoType!=null){
|
||||
for (Integer dom : protoType) {
|
||||
if(dom!=null){
|
||||
url=url+"&protoType="+dom;
|
||||
}
|
||||
}
|
||||
}
|
||||
String string = HttpClientUtil.get(url);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
||||
@@ -374,14 +378,18 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value="appList")
|
||||
@ResponseBody
|
||||
public List appList(@RequestParam(value="appType",required=false)Integer appType,@RequestParam(value="beginDate",required=false)String beginDate,@RequestParam(value="endDate",required=false)String endDate){
|
||||
public List appList(@RequestParam(value="appType",required=false)Integer[] appType,@RequestParam(value="beginDate",required=false)String beginDate,@RequestParam(value="endDate",required=false)String endDate){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_APP_LIST;
|
||||
try {
|
||||
url=urlAddDate(url,beginDate,endDate);
|
||||
if(!StringUtil.isEmpty(appType)){
|
||||
url=url+"&appType="+appType;
|
||||
if(appType!=null){
|
||||
for (Integer dom : appType) {
|
||||
if(dom!=null){
|
||||
url=url+"&appType="+dom;
|
||||
}
|
||||
}
|
||||
}
|
||||
String string = HttpClientUtil.get(url);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
@@ -477,7 +485,7 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value="websiteList")
|
||||
@ResponseBody
|
||||
public List websiteList(Integer entranceId,Integer domain,Model model,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate){
|
||||
public List websiteList(Integer entranceId,Integer[] domain,Model model,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_WEBSITELIST_NOTIME;
|
||||
@@ -491,7 +499,11 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
}
|
||||
url=urlAddDate(url, beginDate, endDate);
|
||||
if(domain!=null){
|
||||
url=url+"&domain="+domain;
|
||||
for (Integer dom : domain) {
|
||||
if(dom!=null){
|
||||
url=url+"&domain="+dom;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(entranceId!=null){
|
||||
url=url+"&entranceId="+entranceId;
|
||||
@@ -502,9 +514,9 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
logger.debug("website接口数据"+fromJsonList);
|
||||
list = (ArrayList) fromJsonList.get("data");
|
||||
BigDecimal divisor=new BigDecimal(1024*1024*1024);
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
DecimalFormat df = new DecimalFormat("0.000000000");
|
||||
DecimalFormat dl = new DecimalFormat("0");
|
||||
DecimalFormat pf = new DecimalFormat("0.00%");
|
||||
DecimalFormat pf = new DecimalFormat("0.000000000");
|
||||
// Double totalLink=0d;
|
||||
Double totalGbyte=0d;
|
||||
Double totalPackets=0d;
|
||||
@@ -528,10 +540,10 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
Map m=(Map)object;
|
||||
// Double perLink = ((Double)m.get("linkNum"))/totalLink;
|
||||
// m.put("perLink",pf.format(perLink));
|
||||
Double perPackets = ((Double)m.get("pktCount"))/totalPackets;
|
||||
m.put("perPackets", pf.format(perPackets));
|
||||
Double perGbyte = ((Double)m.get("byteCount"))/totalGbyte;
|
||||
m.put("perGbyte", pf.format(perGbyte));
|
||||
// Double perPackets = ((Double)m.get("pktCount"))/totalPackets;
|
||||
m.put("totalPackets", pf.format(totalPackets));
|
||||
// Double perGbyte = ((Double)m.get("byteCount"))/totalGbyte;
|
||||
m.put("totalGbyte", pf.format(totalGbyte/1024/1024/1024));
|
||||
if(map.containsKey(Long.parseLong(dl.format(m.get("webId"))))){
|
||||
m.put("website", map.get(Long.parseLong(dl.format(m.get("webId")))));
|
||||
}else{
|
||||
@@ -626,4 +638,70 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
}
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* drop, loop,new link,close link,pass,live link
|
||||
*/
|
||||
@RequestMapping("ntcTotalReportDetail")
|
||||
public String ntcTotalReportDetail(Model model,String searchAction){
|
||||
Calendar cal = Calendar. getInstance ();
|
||||
cal.setTime(new Date());
|
||||
String now = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());//鑾峰彇鍒板畬鏁寸殑鏃堕棿
|
||||
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1);
|
||||
String oneHoursAgo = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());
|
||||
model.addAttribute("searchAction", searchAction);
|
||||
model.addAttribute("beginDate", oneHoursAgo);
|
||||
model.addAttribute("endDate", now);
|
||||
return "/dashboard/ntcTotalReportDetailList";
|
||||
}
|
||||
@RequestMapping("ajaxNtcTotalReportDetail")
|
||||
@ResponseBody
|
||||
public Map ajaxNtcTotalReportDetail(String beginDate,String endDate,Model model,String searchAction){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
Map map = new HashMap();
|
||||
try {
|
||||
String url=Constants.DASHBOARD_URL+Constants.TREND_TOTAL_REPORT;
|
||||
if(StringUtil.isBlank(beginDate)||StringUtil.isBlank(endDate)){
|
||||
Calendar cal = Calendar. getInstance ();
|
||||
cal.setTime(new Date());
|
||||
endDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());//获取到完整的时间
|
||||
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1);
|
||||
beginDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());
|
||||
}
|
||||
URIBuilder uriBuilder = new URIBuilder(url);
|
||||
uriBuilder.addParameter("searchReportStartTime",beginDate);
|
||||
uriBuilder.addParameter("searchReportEndTime",endDate);
|
||||
url=uriBuilder.toString();
|
||||
if(searchAction!=null){
|
||||
if("action_drop".equals(searchAction)){
|
||||
url=url+"&searchBusinessType="+1;
|
||||
}
|
||||
if("action_loop".equals(searchAction)){
|
||||
url=url+"&searchBusinessType="+2;
|
||||
}
|
||||
if("new_link".equals(searchAction)){
|
||||
url=url+"&searchBusinessType="+3;
|
||||
}
|
||||
if("close_link".equals(searchAction)){
|
||||
url=url+"&searchBusinessType="+4;
|
||||
}
|
||||
if("pass".equals(searchAction)){
|
||||
url=url+"&searchBusinessType="+6;
|
||||
}
|
||||
if("live_link".equals(searchAction)){
|
||||
url=url+"&searchBusinessType="+5;
|
||||
}
|
||||
}
|
||||
|
||||
String string = HttpClientUtil.get(url);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map<String, Object>>(){}.getType());
|
||||
logger.debug("动作详情统计一小时"+fromJsonList);
|
||||
map = (Map) fromJsonList.get("data");
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("动作详情统计一小时数据获取错误"+e);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,13 +6,16 @@ import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
@@ -23,20 +26,31 @@ 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.Page;
|
||||
import com.nis.domain.PageLog;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.dashboard.NtcRadiusReport;
|
||||
import com.nis.domain.log.BaseLogEntity;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.domain.report.NtcAsnRecord;
|
||||
import com.nis.domain.report.NtcIpRangeReport;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@Controller
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/traffic")
|
||||
public class TrafficStatisticsReportController extends BaseController {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 用户行为查询
|
||||
*
|
||||
* @param bean
|
||||
* @param model
|
||||
* @param request
|
||||
@@ -44,140 +58,382 @@ public class TrafficStatisticsReportController extends BaseController {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("userBehavior")
|
||||
public String list(@ModelAttribute("log") NtcRadiusReport bean,Model model, HttpServletRequest request, HttpServletResponse response,RedirectAttributes redirectAttributes) {
|
||||
public String list(@ModelAttribute("log") NtcRadiusReport bean, Model model, HttpServletRequest request,
|
||||
HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
Map<String, Object> userJsonList = new HashMap<String, Object>();
|
||||
Map<String, Object> ipJsonList = new HashMap<String, Object>();
|
||||
String searchBusinessType = bean.getSearchBusinessType();
|
||||
if("2".endsWith(searchBusinessType)) {
|
||||
if ("2".endsWith(searchBusinessType)) {
|
||||
model.addAttribute("searchBusinessType", 2);// 用户查询
|
||||
}
|
||||
if("3".endsWith(searchBusinessType)) {
|
||||
if ("3".endsWith(searchBusinessType)) {
|
||||
model.addAttribute("searchBusinessType", 3);// IP查询
|
||||
}
|
||||
String url = Constants.DASHBOARD_URL+Constants.NTC_RADIUS_REPORT;
|
||||
String url = Constants.DASHBOARD_URL + Constants.NTC_RADIUS_REPORT;
|
||||
String statTime = bean.getSearchFoundStartTime();
|
||||
String endTime = bean.getSearchFoundEndTime();
|
||||
String account = bean.getAccount();
|
||||
String nasIp = bean.getNasIp();
|
||||
String destUrl = url+ "?searchBusinessType=1";
|
||||
String userUrl = url+ "?searchBusinessType=2";
|
||||
String ipUrl =url + "?searchBusinessType=3";
|
||||
String destUrl = url + "?searchBusinessType=1";
|
||||
String userUrl = url + "?searchBusinessType=2";
|
||||
String ipUrl = url + "?searchBusinessType=3";
|
||||
List list = new ArrayList();
|
||||
List userList = new ArrayList();
|
||||
List ipList = new ArrayList();
|
||||
try {
|
||||
if(StringUtil.isBlank(statTime)&&StringUtil.isBlank(endTime)) {
|
||||
if (StringUtil.isBlank(statTime) && StringUtil.isBlank(endTime)) {
|
||||
// 设置默认时间为1小时
|
||||
// statTime=DateUtils.getDate()+" 00:00:00"; // 默认今天
|
||||
// endTime=DateUtils.getDateTime();
|
||||
|
||||
Calendar cal = Calendar. getInstance ();
|
||||
// statTime=DateUtils.getDate()+" 00:00:00"; // 默认今天
|
||||
// endTime=DateUtils.getDateTime();
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(new Date());
|
||||
endTime = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format(cal.getTime());//获取到完整的时间
|
||||
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1);
|
||||
statTime = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format(cal.getTime());
|
||||
endTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.getTime());// 获取到完整的时间
|
||||
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1);
|
||||
statTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.getTime());
|
||||
bean.setSearchFoundStartTime(statTime);
|
||||
bean.setSearchFoundEndTime(endTime);
|
||||
statTime=URLEncoder.encode(statTime, "UTF-8");
|
||||
endTime=URLEncoder.encode(endTime, "UTF-8");
|
||||
String paramUrl="&searchReportStartTime="+statTime+"&searchReportEndTime="+endTime;
|
||||
destUrl=destUrl+paramUrl;
|
||||
userUrl=userUrl+paramUrl;
|
||||
ipUrl=ipUrl+paramUrl;
|
||||
}else {
|
||||
statTime=URLEncoder.encode(statTime, "UTF-8");
|
||||
endTime=URLEncoder.encode(endTime, "UTF-8");
|
||||
String paramUrl="&searchReportStartTime="+statTime+"&searchReportEndTime="+endTime;
|
||||
destUrl=destUrl+paramUrl;
|
||||
userUrl=userUrl+paramUrl;
|
||||
ipUrl=ipUrl+paramUrl;
|
||||
statTime = URLEncoder.encode(statTime, "UTF-8");
|
||||
endTime = URLEncoder.encode(endTime, "UTF-8");
|
||||
String paramUrl = "&searchReportStartTime=" + statTime + "&searchReportEndTime=" + endTime;
|
||||
destUrl = destUrl + paramUrl;
|
||||
userUrl = userUrl + paramUrl;
|
||||
ipUrl = ipUrl + paramUrl;
|
||||
} else {
|
||||
statTime = URLEncoder.encode(statTime, "UTF-8");
|
||||
endTime = URLEncoder.encode(endTime, "UTF-8");
|
||||
String paramUrl = "&searchReportStartTime=" + statTime + "&searchReportEndTime=" + endTime;
|
||||
destUrl = destUrl + paramUrl;
|
||||
userUrl = userUrl + paramUrl;
|
||||
ipUrl = ipUrl + paramUrl;
|
||||
}
|
||||
model.addAttribute("nowTime", DateUtils.getDateTime());
|
||||
// 用户及IP数据
|
||||
String string = HttpClientUtil.get(destUrl);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map>() {
|
||||
}.getType());
|
||||
list = (ArrayList) fromJsonList.get("data");
|
||||
Map map = (Map) list.get(0);
|
||||
List nasIpList=(List) map.get("nasIpList");
|
||||
List accountList=(List) map.get("accountList");
|
||||
if (!StringUtil.isEmpty(nasIpList)&&nasIpList.size()>0) {
|
||||
List nasIpList = (List) map.get("nasIpList");
|
||||
List accountList = (List) map.get("accountList");
|
||||
if (!StringUtil.isEmpty(nasIpList) && nasIpList.size() > 0) {
|
||||
List newNasIpList = new ArrayList();
|
||||
for (int i = 0; i < nasIpList.size(); i++) {
|
||||
newNasIpList.add(nasIpList.get(i));
|
||||
if (i+1>=10) {
|
||||
if (i + 1 >= 10) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
nasIpList = newNasIpList;
|
||||
}
|
||||
if (!StringUtil.isEmpty(accountList)&&accountList.size()>0) {
|
||||
if (!StringUtil.isEmpty(accountList) && accountList.size() > 0) {
|
||||
List newAccountList = new ArrayList();
|
||||
for (int i = 0; i < accountList.size(); i++) {
|
||||
newAccountList.add(accountList.get(i));
|
||||
if (i+1>=10) {
|
||||
if (i + 1 >= 10) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
accountList = newAccountList;
|
||||
}
|
||||
System.out.println("-------------------:"+nasIpList.size()+"+++"+accountList.size()+"==================");
|
||||
System.out.println(
|
||||
"-------------------:" + nasIpList.size() + "+++" + accountList.size() + "==================");
|
||||
model.addAttribute("nasIpList", nasIpList);
|
||||
model.addAttribute("accountList", accountList);
|
||||
if(StringUtil.isBlank(account)&&accountList!=null&&accountList.size()>0&&!"3".equals(searchBusinessType)) {
|
||||
if (StringUtil.isBlank(account) && accountList != null && accountList.size() > 0
|
||||
&& !"3".equals(searchBusinessType)) {
|
||||
Map accountMap = (Map) accountList.get(0);
|
||||
String firstAccount="";
|
||||
if(accountMap!=null&&accountMap.get("account")!=null){
|
||||
firstAccount=(String) accountMap.get("account");
|
||||
String userString = HttpClientUtil.get(userUrl+"&searchAccount="+firstAccount);
|
||||
String firstAccount = "";
|
||||
if (accountMap != null && accountMap.get("account") != null) {
|
||||
firstAccount = (String) accountMap.get("account");
|
||||
String userString = HttpClientUtil.get(userUrl + "&searchAccount=" + firstAccount);
|
||||
// 指定用户 查询
|
||||
Gson usergson = new GsonBuilder().create();
|
||||
userJsonList = usergson.fromJson(userString, new TypeToken<Map>(){}.getType());
|
||||
userJsonList = usergson.fromJson(userString, new TypeToken<Map>() {
|
||||
}.getType());
|
||||
userList = (ArrayList) userJsonList.get("data");
|
||||
}
|
||||
model.addAttribute("userList", userList);
|
||||
model.addAttribute("searchAccount", firstAccount);
|
||||
}
|
||||
if(StringUtil.isBlank(nasIp)&&nasIpList!=null&&nasIpList.size()>0&&!"2".equals(searchBusinessType)) {
|
||||
if (StringUtil.isBlank(nasIp) && nasIpList != null && nasIpList.size() > 0
|
||||
&& !"2".equals(searchBusinessType)) {
|
||||
Map ipMap = (Map) nasIpList.get(0);
|
||||
String firstIp="";
|
||||
if(ipMap!=null&&ipMap.get("nasIp")!=null){
|
||||
firstIp=(String) ipMap.get("nasIp");
|
||||
String ipString = HttpClientUtil.get(ipUrl+"&searchNasIp="+firstIp);
|
||||
String firstIp = "";
|
||||
if (ipMap != null && ipMap.get("nasIp") != null) {
|
||||
firstIp = (String) ipMap.get("nasIp");
|
||||
String ipString = HttpClientUtil.get(ipUrl + "&searchNasIp=" + firstIp);
|
||||
// 指定IP查询
|
||||
Gson ipgson = new GsonBuilder().create();
|
||||
ipJsonList = ipgson.fromJson(ipString, new TypeToken<Map>(){}.getType());
|
||||
ipJsonList = ipgson.fromJson(ipString, new TypeToken<Map>() {
|
||||
}.getType());
|
||||
ipList = (ArrayList) ipJsonList.get("data");
|
||||
}
|
||||
model.addAttribute("ipList", ipList);
|
||||
model.addAttribute("searchNasIp", firstIp);
|
||||
|
||||
|
||||
}
|
||||
if("2".endsWith(searchBusinessType)&&!StringUtil.isBlank(account)) {
|
||||
|
||||
String userString = HttpClientUtil.get(userUrl+"&searchAccount="+account);
|
||||
if ("2".endsWith(searchBusinessType) && !StringUtil.isBlank(account)) {
|
||||
|
||||
String userString = HttpClientUtil.get(userUrl + "&searchAccount=" + account);
|
||||
// 指定用户 查询
|
||||
Gson usergson = new GsonBuilder().create();
|
||||
userJsonList = usergson.fromJson(userString, new TypeToken<Map>(){}.getType());
|
||||
userJsonList = usergson.fromJson(userString, new TypeToken<Map>() {
|
||||
}.getType());
|
||||
userList = (ArrayList) userJsonList.get("data");
|
||||
model.addAttribute("userList", userList);
|
||||
model.addAttribute("searchAccount", account);
|
||||
}
|
||||
if ("3".endsWith(searchBusinessType)&&!StringUtil.isBlank(nasIp)) {
|
||||
String ipString = HttpClientUtil.get(ipUrl+"&searchNasIp="+nasIp);
|
||||
if ("3".endsWith(searchBusinessType) && !StringUtil.isBlank(nasIp)) {
|
||||
String ipString = HttpClientUtil.get(ipUrl + "&searchNasIp=" + nasIp);
|
||||
// 指定IP查询
|
||||
Gson ipgson = new GsonBuilder().create();
|
||||
ipJsonList = ipgson.fromJson(ipString, new TypeToken<Map>(){}.getType());
|
||||
ipJsonList = ipgson.fromJson(ipString, new TypeToken<Map>() {
|
||||
}.getType());
|
||||
ipList = (ArrayList) ipJsonList.get("data");
|
||||
model.addAttribute("ipList", ipList);
|
||||
model.addAttribute("searchNasIp", nasIp);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"error","request_service_failed");
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
}
|
||||
return "/dashboard/trafficUserBehavior";
|
||||
}
|
||||
|
||||
// 用户行为导出
|
||||
@RequestMapping(value = "userBehaviorExport")
|
||||
public void userBehaviorExport(@ModelAttribute("log") NtcRadiusReport bean, Model model, String hColumns,
|
||||
String type, HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
|
||||
List<NtcRadiusReport> exportList = new ArrayList<NtcRadiusReport>();
|
||||
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
Map<String, Object> userJsonList = new HashMap<String, Object>();
|
||||
Map<String, Object> ipJsonList = new HashMap<String, Object>();
|
||||
String searchBusinessType = bean.getSearchBusinessType();
|
||||
if ("2".endsWith(searchBusinessType)) {
|
||||
model.addAttribute("searchBusinessType", 2);// 用户查询
|
||||
}
|
||||
if ("3".endsWith(searchBusinessType)) {
|
||||
model.addAttribute("searchBusinessType", 3);// IP查询
|
||||
}
|
||||
String url = Constants.DASHBOARD_URL+ Constants.NTC_RADIUS_REPORT;
|
||||
String statTime = bean.getSearchFoundStartTime();
|
||||
String endTime = bean.getSearchFoundEndTime();
|
||||
String account = bean.getAccount();
|
||||
String nasIp = bean.getNasIp();
|
||||
String destUrl = url + "?searchBusinessType=1";
|
||||
String userUrl = url + "?searchBusinessType=2";
|
||||
String ipUrl = url + "?searchBusinessType=3";
|
||||
List list = new ArrayList();
|
||||
List userList = new ArrayList();
|
||||
List ipList = new ArrayList();
|
||||
try {
|
||||
if (StringUtil.isBlank(statTime) && StringUtil.isBlank(endTime)) {
|
||||
// 设置默认时间为1小时
|
||||
// statTime=DateUtils.getDate()+" 00:00:00"; // 默认今天
|
||||
// endTime=DateUtils.getDateTime();
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(new Date());
|
||||
endTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.getTime());// 获取到完整的时间
|
||||
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1);
|
||||
statTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.getTime());
|
||||
bean.setSearchFoundStartTime(statTime);
|
||||
bean.setSearchFoundEndTime(endTime);
|
||||
statTime = URLEncoder.encode(statTime, "UTF-8");
|
||||
endTime = URLEncoder.encode(endTime, "UTF-8");
|
||||
String paramUrl = "&searchReportStartTime=" + statTime + "&searchReportEndTime=" + endTime;
|
||||
destUrl = destUrl + paramUrl;
|
||||
userUrl = userUrl + paramUrl;
|
||||
ipUrl = ipUrl + paramUrl;
|
||||
} else {
|
||||
statTime = URLEncoder.encode(statTime, "UTF-8");
|
||||
endTime = URLEncoder.encode(endTime, "UTF-8");
|
||||
String paramUrl = "&searchReportStartTime=" + statTime + "&searchReportEndTime=" + endTime;
|
||||
destUrl = destUrl + paramUrl;
|
||||
userUrl = userUrl + paramUrl;
|
||||
ipUrl = ipUrl + paramUrl;
|
||||
}
|
||||
model.addAttribute("nowTime", DateUtils.getDateTime());
|
||||
// 用户及IP数据
|
||||
String string = HttpClientUtil.get(destUrl);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map>() {
|
||||
}.getType());
|
||||
list = (ArrayList) fromJsonList.get("data");
|
||||
Map map = (Map) list.get(0);
|
||||
List nasIpList = (List) map.get("nasIpList");
|
||||
List accountList = (List) map.get("accountList");
|
||||
if (!StringUtil.isEmpty(nasIpList) && nasIpList.size() > 0) {
|
||||
List newNasIpList = new ArrayList();
|
||||
for (int i = 0; i < nasIpList.size(); i++) {
|
||||
newNasIpList.add(nasIpList.get(i));
|
||||
if (i + 1 >= 10) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
nasIpList = newNasIpList;
|
||||
}
|
||||
if (!StringUtil.isEmpty(accountList) && accountList.size() > 0) {
|
||||
List newAccountList = new ArrayList();
|
||||
for (int i = 0; i < accountList.size(); i++) {
|
||||
newAccountList.add(accountList.get(i));
|
||||
if (i + 1 >= 10) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
accountList = newAccountList;
|
||||
}
|
||||
System.out.println(
|
||||
"-------------------:" + nasIpList.size() + "+++" + accountList.size() + "==================");
|
||||
model.addAttribute("nasIpList", nasIpList);
|
||||
model.addAttribute("accountList", accountList);
|
||||
if (StringUtil.isBlank(account) && accountList != null && accountList.size() > 0
|
||||
&& !"3".equals(searchBusinessType)) {
|
||||
Map accountMap = (Map) accountList.get(0);
|
||||
String firstAccount = "";
|
||||
if (accountMap != null && accountMap.get("account") != null) {
|
||||
firstAccount = (String) accountMap.get("account");
|
||||
String userString = HttpClientUtil.get(userUrl + "&searchAccount=" + firstAccount);
|
||||
// 指定用户 查询
|
||||
Gson usergson = new GsonBuilder().create();
|
||||
userJsonList = usergson.fromJson(userString, new TypeToken<Map>() {
|
||||
}.getType());
|
||||
userList = (ArrayList) userJsonList.get("data");
|
||||
|
||||
for (int i = 0; i < userList.size(); i++) {
|
||||
JSONObject fromObject = JSONObject.fromObject(userList.get(i));
|
||||
NtcRadiusReport stu = (NtcRadiusReport) JSONObject.toBean(fromObject, NtcRadiusReport.class);
|
||||
exportList.add(stu);
|
||||
}
|
||||
|
||||
}
|
||||
model.addAttribute("userList", userList);
|
||||
model.addAttribute("searchAccount", firstAccount);
|
||||
}
|
||||
if (StringUtil.isBlank(nasIp) && nasIpList != null && nasIpList.size() > 0
|
||||
&& !"2".equals(searchBusinessType)) {
|
||||
Map ipMap = (Map) nasIpList.get(0);
|
||||
String firstIp = "";
|
||||
if (ipMap != null && ipMap.get("nasIp") != null) {
|
||||
firstIp = (String) ipMap.get("nasIp");
|
||||
String ipString = HttpClientUtil.get(ipUrl + "&searchNasIp=" + firstIp);
|
||||
// 指定IP查询
|
||||
Gson ipgson = new GsonBuilder().create();
|
||||
ipJsonList = ipgson.fromJson(ipString, new TypeToken<Map>() {
|
||||
}.getType());
|
||||
ipList = (ArrayList) ipJsonList.get("data");
|
||||
|
||||
for (int i = 0; i < ipList.size(); i++) {
|
||||
JSONObject fromObject = JSONObject.fromObject(ipList.get(i));
|
||||
NtcRadiusReport stu = (NtcRadiusReport) JSONObject.toBean(fromObject, NtcRadiusReport.class);
|
||||
exportList.add(stu);
|
||||
}
|
||||
|
||||
}
|
||||
model.addAttribute("ipList", ipList);
|
||||
model.addAttribute("searchNasIp", firstIp);
|
||||
|
||||
}
|
||||
if ("2".endsWith(searchBusinessType) && !StringUtil.isBlank(account)) {
|
||||
|
||||
String userString = HttpClientUtil.get(userUrl + "&searchAccount=" + account);
|
||||
// 指定用户 查询
|
||||
Gson usergson = new GsonBuilder().create();
|
||||
userJsonList = usergson.fromJson(userString, new TypeToken<Map>() {
|
||||
}.getType());
|
||||
userList = (ArrayList) userJsonList.get("data");
|
||||
|
||||
for (int i = 0; i < userList.size(); i++) {
|
||||
JSONObject fromObject = JSONObject.fromObject(userList.get(i));
|
||||
NtcRadiusReport stu = (NtcRadiusReport) JSONObject.toBean(fromObject, NtcRadiusReport.class);
|
||||
exportList.add(stu);
|
||||
}
|
||||
|
||||
model.addAttribute("userList", userList);
|
||||
model.addAttribute("searchAccount", account);
|
||||
}
|
||||
if ("3".endsWith(searchBusinessType) && !StringUtil.isBlank(nasIp)) {
|
||||
String ipString = HttpClientUtil.get(ipUrl + "&searchNasIp=" + nasIp);
|
||||
// 指定IP查询
|
||||
Gson ipgson = new GsonBuilder().create();
|
||||
ipJsonList = ipgson.fromJson(ipString, new TypeToken<Map>() {
|
||||
}.getType());
|
||||
ipList = (ArrayList) ipJsonList.get("data");
|
||||
|
||||
for (int i = 0; i < ipList.size(); i++) {
|
||||
JSONObject fromObject = JSONObject.fromObject(ipList.get(i));
|
||||
NtcRadiusReport stu = (NtcRadiusReport) JSONObject.toBean(fromObject, NtcRadiusReport.class);
|
||||
exportList.add(stu);
|
||||
}
|
||||
|
||||
model.addAttribute("ipList", ipList);
|
||||
model.addAttribute("searchNasIp", nasIp);
|
||||
}
|
||||
|
||||
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>();
|
||||
|
||||
titleList.add("traffic_user_behavior");
|
||||
classMap.put("traffic_user_behavior", NtcRadiusReport.class);
|
||||
|
||||
Properties msgProp = getMsgProp();
|
||||
NtcRadiusReport ntcRadiusReport = new NtcRadiusReport();
|
||||
long nums = 0;
|
||||
for (NtcRadiusReport entity : exportList) {
|
||||
if (null != entity.getNum()) {
|
||||
nums += entity.getNum();
|
||||
}
|
||||
}
|
||||
String report_total = msgProp.getProperty("report_total");
|
||||
ntcRadiusReport.setAccount(report_total);
|
||||
ntcRadiusReport.setNum(nums);
|
||||
ntcRadiusReport.setNasIp(" 一 ");
|
||||
ntcRadiusReport.setReportTime(" 一 ");
|
||||
|
||||
exportList.add(ntcRadiusReport);
|
||||
|
||||
dataMap.put("traffic_user_behavior", exportList);
|
||||
|
||||
String cfgIndexInfoNoExport = "";
|
||||
noExportMap.put("traffic_user_behavior", cfgIndexInfoNoExport);
|
||||
String timeRange = initLogMap(bean, "traffic_user_behavior");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "traffic_user_behavior", titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "traffic_user_behavior", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String initLogMap(NtcRadiusReport 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.getSearchFoundStartTime();
|
||||
}
|
||||
return logTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,9 +42,16 @@ public class DynamicIndexController extends BaseController {
|
||||
public String dynamicIndex(HttpServletRequest request){
|
||||
String serviceIds = request.getParameter("sid");
|
||||
String baseNum = request.getParameter("baseNum");
|
||||
Object trafficAreaStat = trafficAreaStat(null, Integer.parseInt(baseNum));
|
||||
Object dropStat = dropStat(null, Integer.parseInt(baseNum));
|
||||
Object logStat = logStat(null, serviceIds, Integer.parseInt(baseNum));
|
||||
String hourStr = request.getParameter("hour");
|
||||
String dropBaseNum = request.getParameter("dropBaseNum");
|
||||
String serviceBaseNum = request.getParameter("serviceBaseNum");
|
||||
Integer hour = null;
|
||||
if(hourStr!=null &&!"".equals(hourStr)){
|
||||
hour = Integer.parseInt(hourStr);
|
||||
}
|
||||
Object trafficAreaStat = trafficAreaStat(hour, Long.valueOf(baseNum));
|
||||
Object dropStat = dropStat(hour, Long.valueOf(dropBaseNum));
|
||||
Object logStat = logStat(hour, serviceIds, Long.valueOf(serviceBaseNum));
|
||||
Gson gson = new GsonBuilder().create();
|
||||
String trafficJson = gson.toJson(trafficAreaStat);
|
||||
String dropJson = gson.toJson(dropStat);
|
||||
@@ -89,26 +96,25 @@ public class DynamicIndexController extends BaseController {
|
||||
* @param hour 取hour小时内的流量数据,默认24小时
|
||||
* @return
|
||||
*/
|
||||
public Object trafficAreaStat(Integer hour, Integer baseNum) {
|
||||
public Object trafficAreaStat(Integer hour, long baseNum) {
|
||||
List<Map> results = new ArrayList<>();
|
||||
|
||||
if (hour == null || hour <= 0) {
|
||||
hour = 24;
|
||||
}
|
||||
|
||||
hour = 2;
|
||||
}
|
||||
Date now = new Date();
|
||||
Date start = new Date(now.getTime()-(hour*60*60*1000));
|
||||
|
||||
Date start = new Date(now.getTime()-(hour*60*60*1000)-(5*60*1000));
|
||||
now = new Date(now.getTime()-5*60*1000);
|
||||
String nowString = DateUtils.formatDate(now, "yyyy-MM-dd HH:mm:ss");
|
||||
String startString = DateUtils.formatDate(start, "yyyy-MM-dd HH:mm:ss");
|
||||
nowString = "2018-12-05 00:00:00";
|
||||
startString = "2018-12-04 17:00:00";
|
||||
/*nowString = "2018-12-05 00:00:00";
|
||||
startString = "2018-12-04 17:00:00";*/
|
||||
String url = Constants.LOG_BASE_URL + Constants.TRAFFIC_AREA_STAT;
|
||||
//String url = "http://localhost:8080/ntc/helloworld/test";
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("searchReportStartTime", startString);
|
||||
params.put("searchReportEndTime", nowString);
|
||||
//params.put("baseNum", baseNum);
|
||||
params.put("baseNum", baseNum);
|
||||
|
||||
try {
|
||||
String recv = HttpClientUtil.getMsg(url, params, null);
|
||||
@@ -126,7 +132,11 @@ public class DynamicIndexController extends BaseController {
|
||||
}
|
||||
List<Object> point = new ArrayList<>();//每个点 [时间戳, 数值]
|
||||
point.add(DateUtils.parseDate(entity.getReportTime()).getTime());
|
||||
point.add(entity.getSum());
|
||||
/*if(0<entity.getSum()){//1024*1024*1024=1073741824
|
||||
point.add(entity.getSum()/1073741824);
|
||||
}else{
|
||||
point.add(entity.getSum());
|
||||
}*/point.add(entity.getSum());
|
||||
|
||||
List<List<Object>> points = t.get(entity.getArea());//所有点
|
||||
points.add(point);
|
||||
@@ -166,11 +176,12 @@ public class DynamicIndexController extends BaseController {
|
||||
* @param hour 取hour小时内的丢弃数据,默认24小时
|
||||
* @return
|
||||
*/
|
||||
public Object dropStat(Integer hour, Integer baseNum) {
|
||||
public Object dropStat(Integer hour, long baseNum) {
|
||||
List<Map> results = new ArrayList<>();
|
||||
|
||||
if (hour == null || hour <= 0) {
|
||||
hour = 24;
|
||||
//hour = 24;
|
||||
hour = 2;
|
||||
}
|
||||
|
||||
Date now = new Date();
|
||||
@@ -184,8 +195,8 @@ public class DynamicIndexController extends BaseController {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("searchReportStartTime", startString);
|
||||
params.put("searchReportEndTime", nowString);
|
||||
params.put("searchBusinessType", 1);
|
||||
//params.put("baseNum", baseNum);
|
||||
params.put("searchBusinessType", 2);
|
||||
params.put("baseNum", baseNum);
|
||||
|
||||
try {
|
||||
String recv = HttpClientUtil.getMsg(url, params, null);
|
||||
@@ -229,7 +240,7 @@ public class DynamicIndexController extends BaseController {
|
||||
* @param hour 取hour小时内的日志数据,默认24小时
|
||||
* @return
|
||||
*/
|
||||
public Object logStat(Integer hour, String serviceIds, Integer baseNum) {
|
||||
public Object logStat(Integer hour, String serviceIds, long baseNum) {
|
||||
String[] _idsArr = serviceIds.split(",");
|
||||
Long[] idsArr = new Long[5];
|
||||
for (int i = 0; i < 5; i++) {
|
||||
@@ -239,7 +250,7 @@ public class DynamicIndexController extends BaseController {
|
||||
List results = new ArrayList<>();
|
||||
|
||||
if (hour == null || hour <= 0) {
|
||||
hour = 24;
|
||||
hour = 2;
|
||||
}
|
||||
|
||||
Date now = new Date();
|
||||
|
||||
@@ -186,7 +186,8 @@ public class DkBehaviorLogController extends BaseController{
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put(name, cfgIndexInfoNoExport);
|
||||
dataMap.put(name, list);
|
||||
|
||||
String timeRange= initLogMap(entry,name);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, name, titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
|
||||
@@ -124,6 +124,8 @@ public class BgpLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("bgp_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("bgp_control", list);
|
||||
String timeRange= initLogMap(log,"bgp_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(types)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "bgp_control", titleList, classMap,
|
||||
|
||||
@@ -7,6 +7,7 @@ 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;
|
||||
@@ -31,6 +32,7 @@ import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.PageLog;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.log.BaseLogEntity;
|
||||
import com.nis.domain.log.NtcBGPLog;
|
||||
import com.nis.domain.log.NtcCollectRadiusLog;
|
||||
import com.nis.domain.log.NtcCollectVoipLog;
|
||||
@@ -140,7 +142,7 @@ public class CollectVoipLogController extends BaseController {
|
||||
url = Constants.LOG_BASE_URL + Constants.NTC_COLLECT_VOIP_LOG;
|
||||
String jsonString = HttpClientUtil.getMsg(url, params, request);
|
||||
|
||||
// GsonBuilder builder = new GsonBuilder();
|
||||
GsonBuilder builder = new GsonBuilder();
|
||||
// builder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() {
|
||||
//
|
||||
// public Date deserialize(JsonElement json, java.lang.reflect.Type typeOfT,
|
||||
@@ -148,8 +150,8 @@ public class CollectVoipLogController extends BaseController {
|
||||
// return new Date(json.getAsJsonPrimitive().getAsLong());
|
||||
// }
|
||||
// });
|
||||
// Gson gson = builder.setDateFormat("yyyy-MM-dd HH:mm:ss").create();
|
||||
Gson gson = new GsonBuilder().create();
|
||||
Gson gson = builder.setDateFormat("yyyy-MM-dd HH:mm:ss").create();
|
||||
// Gson gson = new GsonBuilder().create();
|
||||
// gson泛型支持
|
||||
LogRecvData<NtcCollectVoipLog> fromJson = gson.fromJson(jsonString,
|
||||
new TypeToken<LogRecvData<NtcCollectVoipLog>>() {
|
||||
@@ -278,6 +280,8 @@ public class CollectVoipLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = ",cfg_id,action," + hColumns;
|
||||
noExportMap.put("collect_voip", cfgIndexInfoNoExport);
|
||||
dataMap.put("collect_voip", list);
|
||||
String timeRange= initLogVoipMap(entry,"collect_voip");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "collect_voip", titleList, classMap,
|
||||
@@ -291,6 +295,20 @@ public class CollectVoipLogController extends BaseController {
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
|
||||
public String initLogVoipMap(NtcCollectVoipLog 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.getSearchFoundStartTime();
|
||||
}
|
||||
return logTime;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<NtcCollectVoipLog> getList() {
|
||||
List<NtcCollectVoipLog> list = new ArrayList<NtcCollectVoipLog>();
|
||||
|
||||
@@ -170,7 +170,8 @@ public class DdosLogController extends BaseController{
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("target_ip_protect", cfgIndexInfoNoExport);
|
||||
dataMap.put("target_ip_protect", list);
|
||||
|
||||
String timeRange= initLogMap(log,"target_ip_protect");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "target_ip_protect", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
|
||||
@@ -133,6 +133,8 @@ public class DnsLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("DNS", cfgIndexInfoNoExport);
|
||||
dataMap.put("DNS", list);
|
||||
String timeRange= initLogMap(log,"DNS");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "DNS", titleList, classMap, dataMap,
|
||||
|
||||
@@ -144,6 +144,8 @@ public class FtpLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("ftp_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("ftp_control", list);
|
||||
String timeRange= initLogMap(log,"ftp_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "ftp_control", titleList, classMap,
|
||||
|
||||
@@ -147,8 +147,8 @@ public class HttpKeyLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("http_keyword", cfgIndexInfoNoExport);
|
||||
dataMap.put("http_keyword", list);
|
||||
// String timeRange= initLogMap(log,"http_keyword");
|
||||
// noExportMap.put("timeRange", timeRange);
|
||||
String timeRange= initLogMap(log,"http_keyword");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "http_keyword", titleList, classMap,
|
||||
|
||||
@@ -143,8 +143,8 @@ public class HttpLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("HTTP", cfgIndexInfoNoExport);
|
||||
dataMap.put("HTTP", list);
|
||||
/*String timeRange= initLogMap(log,"HTTP");
|
||||
noExportMap.put("timeRange", timeRange);*/
|
||||
String timeRange= initLogMap(log,"HTTP");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "HTTP", titleList, classMap, dataMap,
|
||||
|
||||
@@ -1,25 +1,18 @@
|
||||
package com.nis.web.controller.log.ntc;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.aspectj.util.FileUtil;
|
||||
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.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
@@ -27,11 +20,8 @@ import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.PageLog;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.log.NtcHttpLog;
|
||||
import com.nis.domain.log.NtcIpLog;
|
||||
import com.nis.domain.log.NtcIpLog;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
@@ -138,7 +128,6 @@ public class IpLogController extends BaseController {
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_IP_LOG;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
List<NtcIpLog> list = new ArrayList<NtcIpLog>();
|
||||
@@ -156,8 +145,8 @@ public class IpLogController extends BaseController {
|
||||
setLogAction(l, serviceList);
|
||||
}
|
||||
|
||||
titleList.add("Ip");
|
||||
classMap.put("Ip", NtcIpLog.class);
|
||||
titleList.add("ip_control");
|
||||
classMap.put("ip_control", NtcIpLog.class);
|
||||
SysUser user = UserUtils.getUser();
|
||||
if (!user.isAdmin()) {
|
||||
hColumns += ",scene_file,";
|
||||
@@ -165,14 +154,15 @@ public class IpLogController extends BaseController {
|
||||
hColumns += ",";
|
||||
}
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("Ip", cfgIndexInfoNoExport);
|
||||
dataMap.put("Ip", list);
|
||||
|
||||
noExportMap.put("ip_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("ip_control", list);
|
||||
String timeRange= initLogMap(log,"ip_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "Ip", titleList, classMap,
|
||||
this._exportCsv(model, request, response, redirectAttributes, "ip_control", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "Ip", titleList, classMap, dataMap,
|
||||
this._export(model, request, response, redirectAttributes, "ip_control", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.web.controller.log.ntc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -12,6 +13,7 @@ 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;
|
||||
@@ -19,13 +21,14 @@ import com.google.gson.reflect.TypeToken;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.PageLog;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.log.IrDnatLog;
|
||||
import com.nis.domain.log.NtcIpsecLog;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/log/ntc/irDnatLogs")
|
||||
@@ -70,4 +73,69 @@ public class IrDnatLogController extends BaseController {
|
||||
return "/log/ntc/irDnatLogList";
|
||||
}
|
||||
|
||||
|
||||
// Ip配置导出
|
||||
@RequestMapping(value = "exportDnat")
|
||||
public void exportIp(@ModelAttribute("log") IrDnatLog log, Model model, String hColumns, String type,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
// ---------------------------
|
||||
List<IrDnatLog> list = new ArrayList<IrDnatLog>();
|
||||
PageLog<IrDnatLog> page = new PageLog<IrDnatLog>(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());
|
||||
initLogSearchValue(log, params);
|
||||
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.IR_DNAT_LOG;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<IrDnatLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<IrDnatLog>>(){}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<IrDnatLog> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
for (IrDnatLog l : list) {
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l,serviceList);
|
||||
}
|
||||
titleList.add("dnat_multiplex");
|
||||
classMap.put("dnat_multiplex", IrDnatLog.class);
|
||||
SysUser user = UserUtils.getUser();
|
||||
if (!user.isAdmin()) {
|
||||
hColumns += ",scene_file,";
|
||||
} else {
|
||||
hColumns += ",";
|
||||
}
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("dnat_multiplex", cfgIndexInfoNoExport);
|
||||
dataMap.put("dnat_multiplex", list);
|
||||
String timeRange= initLogMap(log,"dnat_multiplex");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "dnat_multiplex", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "dnat_multiplex", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("dnat_multiplex export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.web.controller.log.ntc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -12,6 +13,7 @@ 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;
|
||||
@@ -19,13 +21,14 @@ 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.log.IrDnatLog;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.log.IrSnatLog;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/log/ntc/irSnatLogs")
|
||||
@@ -71,4 +74,70 @@ public class IrSnatLogController extends BaseController {
|
||||
return "/log/ntc/irSnatLogList";
|
||||
}
|
||||
|
||||
// Ip配置导出
|
||||
@RequestMapping(value = "exportSnat")
|
||||
public void exportIp(@ModelAttribute("log") IrSnatLog log, Model model, String hColumns, String type,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
// ---------------------------
|
||||
List<IrSnatLog> list = new ArrayList<IrSnatLog>();
|
||||
PageLog<IrSnatLog> page = new PageLog<IrSnatLog>(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());
|
||||
initLogSearchValue(log, params);
|
||||
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.IR_SNAT_LOG;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<IrSnatLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<IrSnatLog>>(){}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<IrSnatLog> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
for (IrSnatLog l : list) {
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l,serviceList);
|
||||
}
|
||||
|
||||
titleList.add("snat_multiplex");
|
||||
classMap.put("snat_multiplex", IrSnatLog.class);
|
||||
SysUser user = UserUtils.getUser();
|
||||
if (!user.isAdmin()) {
|
||||
hColumns += ",scene_file,";
|
||||
} else {
|
||||
hColumns += ",";
|
||||
}
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("snat_multiplex", cfgIndexInfoNoExport);
|
||||
dataMap.put("snat_multiplex", list);
|
||||
String timeRange= initLogMap(log,"snat_multiplex");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "snat_multiplex", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "snat_multiplex", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("snat_multiplex export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -151,6 +151,8 @@ public class MailLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("mail_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("mail_control", list);
|
||||
String timeRange= initLogMap(log,"mail_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "mail_control", titleList, classMap,
|
||||
|
||||
@@ -147,6 +147,8 @@ public class MmAvUrlLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("streaming_media", cfgIndexInfoNoExport);
|
||||
dataMap.put("streaming_media", list);
|
||||
String timeRange= initLogMap(log,"streaming_media");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "streaming_media", titleList, classMap,
|
||||
|
||||
@@ -146,7 +146,8 @@ public class MmFileDigestLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = ",log_uri,direction," + hColumns;
|
||||
noExportMap.put("file_digest_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("file_digest_control", list);
|
||||
|
||||
String timeRange= initLogMap(log,"file_digest_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "file_digest_control", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
|
||||
@@ -169,6 +169,8 @@ public class MmPornAvSampleController extends BaseController {
|
||||
String cfgIndexInfoNoExport=","+hColumns;
|
||||
noExportMap.put("av_sample_video_porn_control",cfgIndexInfoNoExport);
|
||||
dataMap.put("av_sample_video_porn_control",list);
|
||||
String timeRange= initLogMap(log,"av_sample_video_porn_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/*}*/
|
||||
if("csv".equals(type)){
|
||||
this._exportCsv(model, request, response, redirectAttributes,"av_sample_video_porn_control",titleList,classMap,dataMap,noExportMap);
|
||||
|
||||
@@ -127,7 +127,8 @@ public class MmSampleAudioController extends BaseController{
|
||||
String cfgIndexInfoNoExport = ",direction," + hColumns;
|
||||
noExportMap.put("av_sample_audio_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("av_sample_audio_control", list);
|
||||
|
||||
String timeRange= initLogMap(log,"av_sample_audio_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "av_sample_audio_control", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
|
||||
@@ -112,8 +112,8 @@ public class MmSamplePicController extends BaseController{
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l, serviceList);
|
||||
}
|
||||
titleList.add("SamplePic");
|
||||
classMap.put("SamplePic", MmSamplePicLog.class);
|
||||
titleList.add("av_sample_picture_control");
|
||||
classMap.put("av_sample_picture_control", MmSamplePicLog.class);
|
||||
SysUser user = UserUtils.getUser();
|
||||
if (!user.isAdmin()) {
|
||||
hColumns += ",scene_file,";
|
||||
@@ -123,7 +123,8 @@ public class MmSamplePicController extends BaseController{
|
||||
String cfgIndexInfoNoExport = ",direction," + hColumns;
|
||||
noExportMap.put("av_sample_picture_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("av_sample_picture_control", list);
|
||||
|
||||
String timeRange= initLogMap(log,"av_sample_picture_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "av_sample_picture_control", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
|
||||
@@ -123,7 +123,8 @@ public class MmSampleVideoController extends BaseController{
|
||||
String cfgIndexInfoNoExport = ",direction," + hColumns;
|
||||
noExportMap.put("av_sample_video_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("av_sample_video_control", list);
|
||||
|
||||
String timeRange= initLogMap(log,"av_sample_video_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "av_sample_video_control", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
|
||||
@@ -131,6 +131,8 @@ public class MmSampleVoipLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport=","+hColumns;
|
||||
noExportMap.put("av_sample_voip_control",cfgIndexInfoNoExport);
|
||||
dataMap.put("av_sample_voip_control",list);
|
||||
String timeRange= initLogMap(log,"av_sample_voip_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/*}*/
|
||||
if("csv".equals(type)){
|
||||
this._exportCsv(model, request, response, redirectAttributes,"av_sample_voip_control",titleList,classMap,dataMap,noExportMap);
|
||||
|
||||
@@ -142,6 +142,8 @@ public class MmVoipIpLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("av_voip_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("av_voip_control", list);
|
||||
String timeRange= initLogMap(log,"av_voip_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "av_voip_control", titleList, classMap,
|
||||
|
||||
@@ -127,6 +127,9 @@ public class NtcCollectRadiusLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport=",cfg_id,action,"+hColumns;
|
||||
noExportMap.put("radius_log",cfgIndexInfoNoExport);
|
||||
dataMap.put("radius_log",list);
|
||||
String timeRange= initLogMap(log,"radius_log");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
|
||||
/*}*/
|
||||
if("csv".equals(type)){
|
||||
this._exportCsv(model, request, response, redirectAttributes,"radius_log",titleList,classMap,dataMap,noExportMap);
|
||||
|
||||
@@ -180,6 +180,8 @@ public class NtcConnRecordLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = ",cfg_id,action," + hColumns;
|
||||
noExportMap.put("conn_record", cfgIndexInfoNoExport);
|
||||
dataMap.put("conn_record", list);
|
||||
String timeRange= initLogMap(log,"conn_record");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "conn_record", titleList, classMap,
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.PageLog;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.log.DkBehaviorLog;
|
||||
import com.nis.domain.log.MmVoipLog;
|
||||
import com.nis.domain.log.NtcCollectRadiusLog;
|
||||
import com.nis.domain.log.NtcOpenVpnLog;
|
||||
@@ -32,6 +33,7 @@ import com.nis.domain.log.NtcOpenVpnLog;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
@@ -56,14 +58,20 @@ public class OpenVpnLogController extends BaseController{
|
||||
|
||||
PageLog<NtcOpenVpnLog> page = new PageLog<NtcOpenVpnLog>(request, response);
|
||||
Map<String, Object> params=new HashMap<>();
|
||||
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entry.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
if(StringUtil.isEmpty(entry.getAction())){
|
||||
for(int i=0;i<serviceList.size();i++){
|
||||
entry.setAction(serviceList.get(i).getAction());
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
//查询值判断
|
||||
initLogSearchValue(entry,params);
|
||||
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entry.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
String url = "";
|
||||
url = Constants.LOG_BASE_URL+Constants.NTC_OPENVPN_LOG;
|
||||
//url = Constants.LOG_BASE_URL+Constants.NTC_IP_LOG;
|
||||
@@ -104,6 +112,15 @@ public class OpenVpnLogController extends BaseController{
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
//---------------------------
|
||||
PageLog<NtcOpenVpnLog> page = new PageLog<NtcOpenVpnLog>(request, response);
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
if(StringUtil.isEmpty(log.getAction())){
|
||||
for(int i=0;i<serviceList.size();i++){
|
||||
log.setAction(serviceList.get(i).getAction());
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
page.setPageNo(1);
|
||||
page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
@@ -121,23 +138,29 @@ public class OpenVpnLogController extends BaseController{
|
||||
Page<NtcOpenVpnLog> data = fromJson.getData();
|
||||
list= data.getList();
|
||||
}
|
||||
for (NtcOpenVpnLog l : list) {
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l, serviceList);
|
||||
}
|
||||
}
|
||||
titleList.add("openVpn_log");
|
||||
classMap.put("openVpn_log", NtcOpenVpnLog.class);
|
||||
titleList.add("spoofing_ip_policy");
|
||||
classMap.put("spoofing_ip_policy", NtcOpenVpnLog.class);
|
||||
SysUser user =UserUtils.getUser();
|
||||
if (!user.isAdmin()){
|
||||
hColumns+=",scene_file,";
|
||||
}else{
|
||||
hColumns+=",";
|
||||
}
|
||||
String cfgIndexInfoNoExport=",cfg_id,action,"+hColumns;
|
||||
noExportMap.put("openVpn_log",cfgIndexInfoNoExport);
|
||||
dataMap.put("openVpn_log",list);
|
||||
String cfgIndexInfoNoExport=","+hColumns;
|
||||
noExportMap.put("spoofing_ip_policy",cfgIndexInfoNoExport);
|
||||
dataMap.put("spoofing_ip_policy",list);
|
||||
String timeRange= initLogMap(log,"spoofing_ip_policy");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/*}*/
|
||||
if("csv".equals(type)){
|
||||
this._exportCsv(model, request, response, redirectAttributes,"openVpn_log",titleList,classMap,dataMap,noExportMap);
|
||||
this._exportCsv(model, request, response, redirectAttributes,"spoofing_ip_policy",titleList,classMap,dataMap,noExportMap);
|
||||
}else{
|
||||
this._export(model, request, response, redirectAttributes,"openVpn_log",titleList,classMap,dataMap,noExportMap);
|
||||
this._export(model, request, response, redirectAttributes,"spoofing_ip_policy",titleList,classMap,dataMap,noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("openVpn export failed",e);
|
||||
|
||||
@@ -128,6 +128,8 @@ public class P2pLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("p2p_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("p2p_control", list);
|
||||
String timeRange= initLogMap(log,"p2p_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "p2p_control", titleList, classMap,
|
||||
|
||||
@@ -138,6 +138,8 @@ public class SslLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("ssl_control", cfgIndexInfoNoExport);
|
||||
dataMap.put("ssl_control", list);
|
||||
String timeRange= initLogMap(log,"ssl_control");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "ssl_control", titleList, classMap,
|
||||
|
||||
@@ -178,8 +178,8 @@ public class PxyHttpLogController extends BaseController {
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put(pxyName, cfgIndexInfoNoExport);
|
||||
dataMap.put(pxyName, list);
|
||||
/*String timeRange= initLogMap(log,pxyName);
|
||||
noExportMap.put("timeRange", timeRange);*/
|
||||
String timeRange= initLogMap(log,pxyName);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, pxyName, titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
|
||||
@@ -0,0 +1,406 @@
|
||||
package com.nis.web.controller.report;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
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.lang3.StringUtils;
|
||||
import org.joda.time.DateTime;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
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.ResponseBody;
|
||||
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.Page;
|
||||
import com.nis.domain.PageLog;
|
||||
import com.nis.domain.configuration.TaskInfo;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.domain.report.NtcEventMonitorOrBlockReport;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.TimeConstants;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.service.configuration.RequestInfoService;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/eventBlock")
|
||||
public class NtcEventBlockController extends BaseController {
|
||||
|
||||
protected static Logger logger = LoggerFactory.getLogger(NtcEventBlockController.class);
|
||||
|
||||
@Autowired
|
||||
private RequestInfoService requestInfoService;
|
||||
|
||||
/**
|
||||
* EventBlock
|
||||
*
|
||||
* @param log
|
||||
* @param model
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = { "/eventBlockList", "" })
|
||||
public String eventBlockList(@ModelAttribute("log") NtcEventMonitorOrBlockReport log, Model model,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
PageLog<NtcEventMonitorOrBlockReport> page = new PageLog<NtcEventMonitorOrBlockReport>(request, response);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
|
||||
// 判断请求参数
|
||||
String searchReportStartTime = null;
|
||||
String searchReportEndTime = null;
|
||||
String searchTaskStartTime = null;
|
||||
String searchTaskEndTime = null;
|
||||
|
||||
/**
|
||||
* 对统计时间参数进行处理 开始-结束(一周内[7天])
|
||||
*/
|
||||
String[] serachReportTimes = getSerachTimes(log.getSearchReportStartTime(), log.getSearchReportEndTime());
|
||||
searchReportStartTime = serachReportTimes[0];
|
||||
searchReportEndTime = serachReportTimes[1];
|
||||
|
||||
/**
|
||||
* 对报送时间参数进行处理 开始-结束(一周内[7天])
|
||||
*/
|
||||
String[] serachTaskTimes = getSerachTimes(log.getSearchTaskStartTime(), log.getSearchTaskEndTime());
|
||||
searchTaskStartTime = serachTaskTimes[0];
|
||||
searchTaskEndTime = serachTaskTimes[1];
|
||||
|
||||
params.put("searchReportStartTime", searchReportStartTime);
|
||||
params.put("searchReportEndTime", searchReportEndTime);
|
||||
params.put("searchTaskStartTime", searchTaskStartTime);
|
||||
params.put("searchTaskEndTime", searchTaskEndTime);
|
||||
|
||||
if (StringUtils.isNotBlank(log.getTaskIds())) {
|
||||
params.put("taskIds", log.getTaskIds());
|
||||
}
|
||||
|
||||
log.setSearchReportStartTime(searchReportStartTime);
|
||||
log.setSearchReportEndTime(searchReportEndTime);
|
||||
log.setSearchTaskStartTime(searchTaskStartTime);
|
||||
log.setSearchTaskEndTime(searchTaskEndTime);
|
||||
|
||||
params.put("reportType", 1);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_MONITOR_OR_BLOCK_Report;
|
||||
// String url =
|
||||
// "http://192.168.11.56:8888/galaxy-service/service/log/v1/ntcEventsMonitorOrBlock";
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcEventMonitorOrBlockReport> fromJson = gson.fromJson(recv,
|
||||
new TypeToken<LogRecvData<NtcEventMonitorOrBlockReport>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcEventMonitorOrBlockReport> data = fromJson.getData();
|
||||
page.setCount(data.getCount());
|
||||
page.setLast(data.getLast());
|
||||
page.setList(data.getList());
|
||||
model.addAttribute("page", page);
|
||||
// 获取专项列表
|
||||
List<TaskInfo> taskList = requestInfoService.showTask(new TaskInfo());
|
||||
model.addAttribute("taskList", taskList);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("查询失败", e);
|
||||
addMessageLog(model, e.getMessage());
|
||||
}
|
||||
|
||||
return "/report/eventBlockList";
|
||||
}
|
||||
|
||||
// eventMonitorExport
|
||||
@RequestMapping(value = "eventBlockExport")
|
||||
public void eventBlockExport(@ModelAttribute("log") NtcEventMonitorOrBlockReport log, Model model, String hColumns,
|
||||
String type, HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
// ---------------------------
|
||||
PageLog<NtcEventMonitorOrBlockReport> page = new PageLog<NtcEventMonitorOrBlockReport>(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());
|
||||
|
||||
// 判断请求参数
|
||||
String searchReportStartTime = null;
|
||||
String searchReportEndTime = null;
|
||||
String searchTaskStartTime = null;
|
||||
String searchTaskEndTime = null;
|
||||
|
||||
/**
|
||||
* 对统计时间参数进行处理 开始-结束(一周内[7天])
|
||||
*/
|
||||
String[] serachReportTimes = getSerachTimes(log.getSearchReportStartTime(), log.getSearchReportEndTime());
|
||||
searchReportStartTime = serachReportTimes[0];
|
||||
searchReportEndTime = serachReportTimes[1];
|
||||
|
||||
/**
|
||||
* 对报送时间参数进行处理 开始-结束(一周内[7天])
|
||||
*/
|
||||
String[] serachTaskTimes = getSerachTimes(log.getSearchTaskStartTime(), log.getSearchTaskEndTime());
|
||||
searchTaskStartTime = serachTaskTimes[0];
|
||||
searchTaskEndTime = serachTaskTimes[1];
|
||||
|
||||
params.put("searchReportStartTime", searchReportStartTime);
|
||||
params.put("searchReportEndTime", searchReportEndTime);
|
||||
params.put("searchTaskStartTime", searchTaskStartTime);
|
||||
params.put("searchTaskEndTime", searchTaskEndTime);
|
||||
|
||||
if (StringUtils.isNotBlank(log.getTaskIds())) {
|
||||
params.put("taskIds", log.getTaskIds());
|
||||
}
|
||||
|
||||
log.setSearchReportStartTime(searchReportStartTime);
|
||||
log.setSearchReportEndTime(searchReportEndTime);
|
||||
log.setSearchTaskStartTime(searchTaskStartTime);
|
||||
log.setSearchTaskEndTime(searchTaskEndTime);
|
||||
|
||||
params.put("reportType", 1);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_MONITOR_OR_BLOCK_Report;
|
||||
// String url =
|
||||
// "http://192.168.11.56:8888/galaxy-service/service/log/v1/ntcEventsMonitorOrBlock";
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
List<NtcEventMonitorOrBlockReport> list = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcEventMonitorOrBlockReport> fromJson = gson.fromJson(recv,
|
||||
new TypeToken<LogRecvData<NtcEventMonitorOrBlockReport>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcEventMonitorOrBlockReport> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
titleList.add("ntc_event_block_report");
|
||||
classMap.put("ntc_event_block_report", NtcEventMonitorOrBlockReport.class);
|
||||
|
||||
String cfgIndexInfoNoExport = "," + hColumns + ",";
|
||||
noExportMap.put("ntc_event_block_report", cfgIndexInfoNoExport);
|
||||
|
||||
Properties msgProp = getMsgProp();
|
||||
NtcEventMonitorOrBlockReport ntcEventMonitorOrBlockReport = new NtcEventMonitorOrBlockReport();
|
||||
long ipNum = 0;
|
||||
long httpNum = 0;
|
||||
long mailNum = 0;
|
||||
long vedioNum = 0;
|
||||
long agentNum = 0;
|
||||
for (NtcEventMonitorOrBlockReport entity : list) {
|
||||
ipNum += entity.getIpNum();
|
||||
httpNum += entity.getHttpNum();
|
||||
mailNum += entity.getMailNum();
|
||||
vedioNum += entity.getVedioNum();
|
||||
agentNum += entity.getAgentNum();
|
||||
}
|
||||
String report_total = msgProp.getProperty("report_total");
|
||||
ntcEventMonitorOrBlockReport.setIpNum(ipNum);
|
||||
ntcEventMonitorOrBlockReport.setHttpNum(httpNum);
|
||||
ntcEventMonitorOrBlockReport.setMailNum(mailNum);
|
||||
ntcEventMonitorOrBlockReport.setVedioNum(vedioNum);
|
||||
ntcEventMonitorOrBlockReport.setAgentNum(agentNum);
|
||||
ntcEventMonitorOrBlockReport.setTaskIds(report_total);
|
||||
ntcEventMonitorOrBlockReport.setTaskName(" 一 ");
|
||||
ntcEventMonitorOrBlockReport.setTaskTime(" 一 ");
|
||||
ntcEventMonitorOrBlockReport.setReportTime(" 一 ");
|
||||
list.add(ntcEventMonitorOrBlockReport);
|
||||
|
||||
dataMap.put("ntc_event_block_report", list);
|
||||
|
||||
String timeRange = initHttpMap(log, "ntc_event_block_report");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "ntc_event_block_report", titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "ntc_event_block_report", titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("ntc_event_block_report export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
|
||||
public String initHttpMap(NtcEventMonitorOrBlockReport log, String title) {
|
||||
Properties msgProp = getMsgProp();
|
||||
String logTime = msgProp.getProperty(title, title);
|
||||
;
|
||||
if (StringUtils.isNotBlank(log.getSearchReportStartTime())) {
|
||||
logTime += " " + msgProp.getProperty("begin_date") + ":" + log.getSearchReportStartTime();
|
||||
}
|
||||
if (StringUtils.isNotBlank(log.getSearchReportEndTime())) {
|
||||
logTime += " " + msgProp.getProperty("end_date") + ":" + log.getSearchReportEndTime();
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(log.getSearchTaskStartTime())) {
|
||||
logTime += " " + msgProp.getProperty("task_time") + ":" + log.getSearchTaskStartTime();
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(log.getSearchTaskEndTime())) {
|
||||
logTime += " " + msgProp.getProperty("task_time") + ":" + log.getSearchTaskEndTime();
|
||||
}
|
||||
return logTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用来判断界面传来的时间参数是否为空来决定默认值与否
|
||||
*
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
public String[] getSerachTimes(String startTime, String endTime) {
|
||||
String[] times = new String[2];
|
||||
if (StringUtils.isNotBlank(startTime)) {
|
||||
times[0] = startTime;
|
||||
if (StringUtils.isNotBlank(endTime)) {
|
||||
times[1] = endTime;
|
||||
} else {
|
||||
times[1] = getSomeDate(startTime, 7);
|
||||
}
|
||||
} else {
|
||||
if (StringUtils.isNotBlank(endTime)) {
|
||||
times[0] = getSomeDate(endTime, -7);
|
||||
times[1] = endTime;
|
||||
} else {
|
||||
String searchReportEndTime = getCurrentDate();
|
||||
times[0] = getSomeDate(searchReportEndTime, -7);
|
||||
times[1] = searchReportEndTime;
|
||||
}
|
||||
}
|
||||
return times;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对日期Day的加/减
|
||||
*
|
||||
* @param date
|
||||
* @param offset
|
||||
* @return
|
||||
*/
|
||||
public static String getSomeDate(String date, int offset) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date time = null;
|
||||
try {
|
||||
time = format.parse(date);
|
||||
} catch (ParseException e) {
|
||||
logger.error("日期格式转换出现异常,{}", e);
|
||||
}
|
||||
DateTime dateTime = new DateTime(time);
|
||||
return dateTime.plusDays(offset).toString(TimeConstants.YYYY_MM_DD_HH24_MM_SS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到当前时间
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getCurrentDate() {
|
||||
|
||||
DateTime dateTime = DateTime.now();
|
||||
|
||||
return dateTime.toString(TimeConstants.YYYY_MM_DD_HH24_MM_SS);
|
||||
}
|
||||
|
||||
// eventBlockPrint
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "eventBlockPrint")
|
||||
public List<NtcEventMonitorOrBlockReport> eventBlockPrint(@ModelAttribute("log") NtcEventMonitorOrBlockReport log,
|
||||
Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
PageLog<NtcEventMonitorOrBlockReport> page = new PageLog<NtcEventMonitorOrBlockReport>(request, response);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
page.setPageNo(1);
|
||||
page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE);
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
// 判断请求参数
|
||||
String searchReportStartTime = null;
|
||||
String searchReportEndTime = null;
|
||||
String searchTaskStartTime = null;
|
||||
String searchTaskEndTime = null;
|
||||
/**
|
||||
* 对统计时间参数进行处理 开始-结束(一周内[7天])
|
||||
*/
|
||||
String[] serachReportTimes = getSerachTimes(log.getSearchReportStartTime(), log.getSearchReportEndTime());
|
||||
searchReportStartTime = serachReportTimes[0];
|
||||
searchReportEndTime = serachReportTimes[1];
|
||||
/**
|
||||
* 对报送时间参数进行处理 开始-结束(一周内[7天])
|
||||
*/
|
||||
String[] serachTaskTimes = getSerachTimes(log.getSearchTaskStartTime(), log.getSearchTaskEndTime());
|
||||
searchTaskStartTime = serachTaskTimes[0];
|
||||
searchTaskEndTime = serachTaskTimes[1];
|
||||
|
||||
params.put("searchReportStartTime", searchReportStartTime);
|
||||
params.put("searchReportEndTime", searchReportEndTime);
|
||||
params.put("searchTaskStartTime", searchTaskStartTime);
|
||||
params.put("searchTaskEndTime", searchTaskEndTime);
|
||||
|
||||
if (StringUtils.isNotBlank(log.getTaskIds())) {
|
||||
params.put("taskIds", log.getTaskIds());
|
||||
}
|
||||
|
||||
log.setSearchReportStartTime(searchReportStartTime);
|
||||
log.setSearchReportEndTime(searchReportEndTime);
|
||||
log.setSearchTaskStartTime(searchTaskStartTime);
|
||||
log.setSearchTaskEndTime(searchTaskEndTime);
|
||||
|
||||
params.put("reportType", 1);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_MONITOR_OR_BLOCK_Report;
|
||||
// String url =
|
||||
// "http://192.168.11.56:8888/galaxy-service/service/log/v1/ntcEventsMonitorOrBlock";
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
List<NtcEventMonitorOrBlockReport> list = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcEventMonitorOrBlockReport> fromJson = gson.fromJson(recv,
|
||||
new TypeToken<LogRecvData<NtcEventMonitorOrBlockReport>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcEventMonitorOrBlockReport> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
logger.error("ntc_event_block_report print failed", e);
|
||||
addMessage(redirectAttributes, "error", "print_failed");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,396 @@
|
||||
package com.nis.web.controller.report;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
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.lang3.StringUtils;
|
||||
import org.joda.time.DateTime;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
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.ResponseBody;
|
||||
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.Page;
|
||||
import com.nis.domain.PageLog;
|
||||
import com.nis.domain.configuration.TaskInfo;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.domain.report.NtcEventKeyProtectionReport;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.TimeConstants;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.service.configuration.RequestInfoService;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/eventKeyProtection")
|
||||
public class NtcEventKeyProtectionController extends BaseController {
|
||||
|
||||
protected static Logger logger = LoggerFactory.getLogger(NtcEventKeyProtectionController.class);
|
||||
|
||||
@Autowired
|
||||
private RequestInfoService requestInfoService;
|
||||
|
||||
/**
|
||||
* EventBlock
|
||||
*
|
||||
* @param log
|
||||
* @param model
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = { "/eventKeyProtectionList", "" })
|
||||
public String eventKeyProtectionList(@ModelAttribute("log") NtcEventKeyProtectionReport log, Model model,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
PageLog<NtcEventKeyProtectionReport> page = new PageLog<NtcEventKeyProtectionReport>(request, response);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
|
||||
// 判断请求参数
|
||||
String searchReportStartTime = null;
|
||||
String searchReportEndTime = null;
|
||||
String searchTaskStartTime = null;
|
||||
String searchTaskEndTime = null;
|
||||
|
||||
/**
|
||||
* 对统计时间参数进行处理 开始-结束(一周内[7天])
|
||||
*/
|
||||
String[] serachReportTimes = getSerachTimes(log.getSearchReportStartTime(), log.getSearchReportEndTime());
|
||||
searchReportStartTime = serachReportTimes[0];
|
||||
searchReportEndTime = serachReportTimes[1];
|
||||
|
||||
/**
|
||||
* 对报送时间参数进行处理 开始-结束(一周内[7天])
|
||||
*/
|
||||
String[] serachTaskTimes = getSerachTimes(log.getSearchTaskStartTime(), log.getSearchTaskEndTime());
|
||||
searchTaskStartTime = serachTaskTimes[0];
|
||||
searchTaskEndTime = serachTaskTimes[1];
|
||||
|
||||
params.put("searchReportStartTime", searchReportStartTime);
|
||||
params.put("searchReportEndTime", searchReportEndTime);
|
||||
params.put("searchTaskStartTime", searchTaskStartTime);
|
||||
params.put("searchTaskEndTime", searchTaskEndTime);
|
||||
|
||||
if (StringUtils.isNotBlank(log.getTaskIds())) {
|
||||
params.put("taskIds", log.getTaskIds());
|
||||
}
|
||||
|
||||
log.setSearchReportStartTime(searchReportStartTime);
|
||||
log.setSearchReportEndTime(searchReportEndTime);
|
||||
log.setSearchTaskStartTime(searchTaskStartTime);
|
||||
log.setSearchTaskEndTime(searchTaskEndTime);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_KEYPROTECTION_Report;
|
||||
// String url =
|
||||
// "http://192.168.11.56:8888/galaxy-service/service/log/v1/ntcEventKeyProtection";
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcEventKeyProtectionReport> fromJson = gson.fromJson(recv,
|
||||
new TypeToken<LogRecvData<NtcEventKeyProtectionReport>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcEventKeyProtectionReport> data = fromJson.getData();
|
||||
page.setCount(data.getCount());
|
||||
page.setLast(data.getLast());
|
||||
page.setList(data.getList());
|
||||
model.addAttribute("page", page);
|
||||
// 获取专项列表
|
||||
List<TaskInfo> taskList = requestInfoService.showTask(new TaskInfo());
|
||||
model.addAttribute("taskList", taskList);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("查询失败", e);
|
||||
addMessageLog(model, e.getMessage());
|
||||
}
|
||||
|
||||
return "/report/eventKeyProtectionList";
|
||||
}
|
||||
|
||||
// eventMonitorExport
|
||||
@RequestMapping(value = "eventKeyProtectionExport")
|
||||
public void eventKeyProtectionExport(@ModelAttribute("log") NtcEventKeyProtectionReport log, Model model,
|
||||
String hColumns, String type, HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
// ---------------------------
|
||||
PageLog<NtcEventKeyProtectionReport> page = new PageLog<NtcEventKeyProtectionReport>(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());
|
||||
|
||||
// 判断请求参数
|
||||
String searchReportStartTime = null;
|
||||
String searchReportEndTime = null;
|
||||
String searchTaskStartTime = null;
|
||||
String searchTaskEndTime = null;
|
||||
|
||||
/**
|
||||
* 对统计时间参数进行处理 开始-结束(一周内[7天])
|
||||
*/
|
||||
String[] serachReportTimes = getSerachTimes(log.getSearchReportStartTime(), log.getSearchReportEndTime());
|
||||
searchReportStartTime = serachReportTimes[0];
|
||||
searchReportEndTime = serachReportTimes[1];
|
||||
|
||||
/**
|
||||
* 对报送时间参数进行处理 开始-结束(一周内[7天])
|
||||
*/
|
||||
String[] serachTaskTimes = getSerachTimes(log.getSearchTaskStartTime(), log.getSearchTaskEndTime());
|
||||
searchTaskStartTime = serachTaskTimes[0];
|
||||
searchTaskEndTime = serachTaskTimes[1];
|
||||
|
||||
params.put("searchReportStartTime", searchReportStartTime);
|
||||
params.put("searchReportEndTime", searchReportEndTime);
|
||||
params.put("searchTaskStartTime", searchTaskStartTime);
|
||||
params.put("searchTaskEndTime", searchTaskEndTime);
|
||||
|
||||
if (StringUtils.isNotBlank(log.getTaskIds())) {
|
||||
params.put("taskIds", log.getTaskIds());
|
||||
}
|
||||
|
||||
log.setSearchReportStartTime(searchReportStartTime);
|
||||
log.setSearchReportEndTime(searchReportEndTime);
|
||||
log.setSearchTaskStartTime(searchTaskStartTime);
|
||||
log.setSearchTaskEndTime(searchTaskEndTime);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_KEYPROTECTION_Report;
|
||||
// String url =
|
||||
// "http://192.168.11.56:8888/galaxy-service/service/log/v1/ntcEventKeyProtection";
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
List<NtcEventKeyProtectionReport> list = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcEventKeyProtectionReport> fromJson = gson.fromJson(recv,
|
||||
new TypeToken<LogRecvData<NtcEventKeyProtectionReport>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcEventKeyProtectionReport> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
titleList.add("ntc_event_key_protection_report");
|
||||
classMap.put("ntc_event_key_protection_report", NtcEventKeyProtectionReport.class);
|
||||
|
||||
String cfgIndexInfoNoExport = "," + hColumns + ",";
|
||||
noExportMap.put("ntc_event_key_protection_report", cfgIndexInfoNoExport);
|
||||
|
||||
Properties msgProp = getMsgProp();
|
||||
NtcEventKeyProtectionReport ntcEventKeyProtectionReport = new NtcEventKeyProtectionReport();
|
||||
long letterNum = 0;
|
||||
long configNum = 0;
|
||||
long monitorNum = 0;
|
||||
long controlNum = 0;
|
||||
for (NtcEventKeyProtectionReport entity : list) {
|
||||
letterNum += entity.getLetterNum();
|
||||
configNum += entity.getConfigNum();
|
||||
monitorNum += entity.getMonitorNum();
|
||||
controlNum += entity.getControlNum();
|
||||
}
|
||||
String report_total = msgProp.getProperty("report_total");
|
||||
ntcEventKeyProtectionReport.setLetterNum(letterNum);
|
||||
ntcEventKeyProtectionReport.setConfigNum(configNum);
|
||||
ntcEventKeyProtectionReport.setMonitorNum(monitorNum);
|
||||
ntcEventKeyProtectionReport.setControlNum(controlNum);
|
||||
ntcEventKeyProtectionReport.setTaskIds(report_total);
|
||||
ntcEventKeyProtectionReport.setTaskName(" 一 ");
|
||||
ntcEventKeyProtectionReport.setTaskTime(" 一 ");
|
||||
ntcEventKeyProtectionReport.setReportTime(" 一 ");
|
||||
list.add(ntcEventKeyProtectionReport);
|
||||
|
||||
dataMap.put("ntc_event_key_protection_report", list);
|
||||
|
||||
String timeRange = initHttpMap(log, "ntc_event_key_protection_report");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "ntc_event_key_protection_report",
|
||||
titleList, classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "ntc_event_key_protection_report", titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("ntc_event_key_protection_report export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
|
||||
public String initHttpMap(NtcEventKeyProtectionReport log, String title) {
|
||||
Properties msgProp = getMsgProp();
|
||||
String logTime = msgProp.getProperty(title, title);
|
||||
;
|
||||
if (StringUtils.isNotBlank(log.getSearchReportStartTime())) {
|
||||
logTime += " " + msgProp.getProperty("begin_date") + ":" + log.getSearchReportStartTime();
|
||||
}
|
||||
if (StringUtils.isNotBlank(log.getSearchReportEndTime())) {
|
||||
logTime += " " + msgProp.getProperty("end_date") + ":" + log.getSearchReportEndTime();
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(log.getSearchTaskStartTime())) {
|
||||
logTime += " " + msgProp.getProperty("task_time") + ":" + log.getSearchTaskStartTime();
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(log.getSearchTaskEndTime())) {
|
||||
logTime += " " + msgProp.getProperty("task_time") + ":" + log.getSearchTaskEndTime();
|
||||
}
|
||||
return logTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用来判断界面传来的时间参数是否为空来决定默认值与否
|
||||
*
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
public String[] getSerachTimes(String startTime, String endTime) {
|
||||
String[] times = new String[2];
|
||||
if (StringUtils.isNotBlank(startTime)) {
|
||||
times[0] = startTime;
|
||||
if (StringUtils.isNotBlank(endTime)) {
|
||||
times[1] = endTime;
|
||||
} else {
|
||||
times[1] = getSomeDate(startTime, 7);
|
||||
}
|
||||
} else {
|
||||
if (StringUtils.isNotBlank(endTime)) {
|
||||
times[0] = getSomeDate(endTime, -7);
|
||||
times[1] = endTime;
|
||||
} else {
|
||||
String searchReportEndTime = getCurrentDate();
|
||||
times[0] = getSomeDate(searchReportEndTime, -7);
|
||||
times[1] = searchReportEndTime;
|
||||
}
|
||||
}
|
||||
return times;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对日期Day的加/减
|
||||
*
|
||||
* @param date
|
||||
* @param offset
|
||||
* @return
|
||||
*/
|
||||
public static String getSomeDate(String date, int offset) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date time = null;
|
||||
try {
|
||||
time = format.parse(date);
|
||||
} catch (ParseException e) {
|
||||
logger.error("日期格式转换出现异常,{}", e);
|
||||
}
|
||||
DateTime dateTime = new DateTime(time);
|
||||
return dateTime.plusDays(offset).toString(TimeConstants.YYYY_MM_DD_HH24_MM_SS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到当前时间
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getCurrentDate() {
|
||||
|
||||
DateTime dateTime = DateTime.now();
|
||||
|
||||
return dateTime.toString(TimeConstants.YYYY_MM_DD_HH24_MM_SS);
|
||||
}
|
||||
|
||||
//eventKeyProtectionPrint
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "eventKeyProtectionPrint")
|
||||
public List<NtcEventKeyProtectionReport> eventKeyProtectionPrint(@ModelAttribute("log") NtcEventKeyProtectionReport log, Model model,
|
||||
HttpServletRequest request, HttpServletResponse response,RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
PageLog<NtcEventKeyProtectionReport> page = new PageLog<NtcEventKeyProtectionReport>(request, response);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
page.setPageNo(1);
|
||||
page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE);
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
|
||||
// 判断请求参数
|
||||
String searchReportStartTime = null;
|
||||
String searchReportEndTime = null;
|
||||
String searchTaskStartTime = null;
|
||||
String searchTaskEndTime = null;
|
||||
|
||||
/**
|
||||
* 对统计时间参数进行处理 开始-结束(一周内[7天])
|
||||
*/
|
||||
String[] serachReportTimes = getSerachTimes(log.getSearchReportStartTime(), log.getSearchReportEndTime());
|
||||
searchReportStartTime = serachReportTimes[0];
|
||||
searchReportEndTime = serachReportTimes[1];
|
||||
|
||||
/**
|
||||
* 对报送时间参数进行处理 开始-结束(一周内[7天])
|
||||
*/
|
||||
String[] serachTaskTimes = getSerachTimes(log.getSearchTaskStartTime(), log.getSearchTaskEndTime());
|
||||
searchTaskStartTime = serachTaskTimes[0];
|
||||
searchTaskEndTime = serachTaskTimes[1];
|
||||
|
||||
params.put("searchReportStartTime", searchReportStartTime);
|
||||
params.put("searchReportEndTime", searchReportEndTime);
|
||||
params.put("searchTaskStartTime", searchTaskStartTime);
|
||||
params.put("searchTaskEndTime", searchTaskEndTime);
|
||||
|
||||
if (StringUtils.isNotBlank(log.getTaskIds())) {
|
||||
params.put("taskIds", log.getTaskIds());
|
||||
}
|
||||
|
||||
log.setSearchReportStartTime(searchReportStartTime);
|
||||
log.setSearchReportEndTime(searchReportEndTime);
|
||||
log.setSearchTaskStartTime(searchTaskStartTime);
|
||||
log.setSearchTaskEndTime(searchTaskEndTime);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_KEYPROTECTION_Report;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
List<NtcEventKeyProtectionReport> list = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcEventKeyProtectionReport> fromJson = gson.fromJson(recv,
|
||||
new TypeToken<LogRecvData<NtcEventKeyProtectionReport>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcEventKeyProtectionReport> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
logger.error("ntc_event_key_protection_report print failed", e);
|
||||
addMessage(redirectAttributes, "error", "print_failed");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,403 @@
|
||||
package com.nis.web.controller.report;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
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.lang3.StringUtils;
|
||||
import org.joda.time.DateTime;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
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.ResponseBody;
|
||||
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.Page;
|
||||
import com.nis.domain.PageLog;
|
||||
import com.nis.domain.configuration.TaskInfo;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.domain.report.NtcEventMonitorOrBlockReport;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.TimeConstants;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.service.configuration.RequestInfoService;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/eventMonitor")
|
||||
public class NtcEventMonitorController extends BaseController {
|
||||
|
||||
protected static Logger logger = LoggerFactory.getLogger(NtcEventMonitorController.class);
|
||||
|
||||
@Autowired
|
||||
private RequestInfoService requestInfoService;
|
||||
|
||||
/**
|
||||
* EventMonitor
|
||||
*
|
||||
* @param log
|
||||
* @param model
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = { "/eventMonitorList", "" })
|
||||
public String eventMonitorList(@ModelAttribute("log") NtcEventMonitorOrBlockReport log, Model model,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
PageLog<NtcEventMonitorOrBlockReport> page = new PageLog<NtcEventMonitorOrBlockReport>(request, response);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
|
||||
// 判断请求参数
|
||||
String searchReportStartTime = null;
|
||||
String searchReportEndTime = null;
|
||||
String searchTaskStartTime = null;
|
||||
String searchTaskEndTime = null;
|
||||
|
||||
/**
|
||||
* 对统计时间参数进行处理 开始-结束(一周内[7天])
|
||||
*/
|
||||
String[] serachReportTimes = getSerachTimes(log.getSearchReportStartTime(), log.getSearchReportEndTime());
|
||||
searchReportStartTime = serachReportTimes[0];
|
||||
searchReportEndTime = serachReportTimes[1];
|
||||
|
||||
/**
|
||||
* 对报送时间参数进行处理 开始-结束(一周内[7天])
|
||||
*/
|
||||
String[] serachTaskTimes = getSerachTimes(log.getSearchTaskStartTime(), log.getSearchTaskEndTime());
|
||||
searchTaskStartTime = serachTaskTimes[0];
|
||||
searchTaskEndTime = serachTaskTimes[1];
|
||||
|
||||
params.put("searchReportStartTime", searchReportStartTime);
|
||||
params.put("searchReportEndTime", searchReportEndTime);
|
||||
params.put("searchTaskStartTime", searchTaskStartTime);
|
||||
params.put("searchTaskEndTime", searchTaskEndTime);
|
||||
|
||||
if (StringUtils.isNotBlank(log.getTaskIds())) {
|
||||
params.put("taskIds", log.getTaskIds());
|
||||
}
|
||||
|
||||
log.setSearchReportStartTime(searchReportStartTime);
|
||||
log.setSearchReportEndTime(searchReportEndTime);
|
||||
log.setSearchTaskStartTime(searchTaskStartTime);
|
||||
log.setSearchTaskEndTime(searchTaskEndTime);
|
||||
|
||||
params.put("reportType", 2);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_MONITOR_OR_BLOCK_Report;
|
||||
// String url =
|
||||
// "http://192.168.11.56:8888/galaxy-service/service/log/v1/ntcEventsMonitorOrBlock";
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcEventMonitorOrBlockReport> fromJson = gson.fromJson(recv,
|
||||
new TypeToken<LogRecvData<NtcEventMonitorOrBlockReport>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcEventMonitorOrBlockReport> data = fromJson.getData();
|
||||
page.setCount(data.getCount());
|
||||
page.setLast(data.getLast());
|
||||
page.setList(data.getList());
|
||||
model.addAttribute("page", page);
|
||||
List<TaskInfo> taskList = requestInfoService.showTask(new TaskInfo());
|
||||
model.addAttribute("taskList", taskList);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("查询失败", e);
|
||||
addMessageLog(model, e.getMessage());
|
||||
}
|
||||
|
||||
return "/report/eventMonitorList";
|
||||
}
|
||||
|
||||
// eventMonitorExport
|
||||
@RequestMapping(value = "eventMonitorExport")
|
||||
public void eventMonitorExport(@ModelAttribute("log") NtcEventMonitorOrBlockReport log, Model model,
|
||||
String hColumns, String type, HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
// ---------------------------
|
||||
PageLog<NtcEventMonitorOrBlockReport> page = new PageLog<NtcEventMonitorOrBlockReport>(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());
|
||||
|
||||
// 判断请求参数
|
||||
String searchReportStartTime = null;
|
||||
String searchReportEndTime = null;
|
||||
String searchTaskStartTime = null;
|
||||
String searchTaskEndTime = null;
|
||||
|
||||
/**
|
||||
* 对统计时间参数进行处理 开始-结束(一周内[7天])
|
||||
*/
|
||||
String[] serachReportTimes = getSerachTimes(log.getSearchReportStartTime(), log.getSearchReportEndTime());
|
||||
searchReportStartTime = serachReportTimes[0];
|
||||
searchReportEndTime = serachReportTimes[1];
|
||||
|
||||
/**
|
||||
* 对报送时间参数进行处理 开始-结束(一周内[7天])
|
||||
*/
|
||||
String[] serachTaskTimes = getSerachTimes(log.getSearchTaskStartTime(), log.getSearchTaskEndTime());
|
||||
searchTaskStartTime = serachTaskTimes[0];
|
||||
searchTaskEndTime = serachTaskTimes[1];
|
||||
|
||||
params.put("searchReportStartTime", searchReportStartTime);
|
||||
params.put("searchReportEndTime", searchReportEndTime);
|
||||
params.put("searchTaskStartTime", searchTaskStartTime);
|
||||
params.put("searchTaskEndTime", searchTaskEndTime);
|
||||
|
||||
if (StringUtils.isNotBlank(log.getTaskIds())) {
|
||||
params.put("taskIds", log.getTaskIds());
|
||||
}
|
||||
|
||||
log.setSearchReportStartTime(searchReportStartTime);
|
||||
log.setSearchReportEndTime(searchReportEndTime);
|
||||
log.setSearchTaskStartTime(searchTaskStartTime);
|
||||
log.setSearchTaskEndTime(searchTaskEndTime);
|
||||
|
||||
params.put("reportType", 2);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_MONITOR_OR_BLOCK_Report;
|
||||
// String url =
|
||||
// "http://192.168.11.56:8888/galaxy-service/service/log/v1/ntcEventsMonitorOrBlock";
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
List<NtcEventMonitorOrBlockReport> list = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcEventMonitorOrBlockReport> fromJson = gson.fromJson(recv,
|
||||
new TypeToken<LogRecvData<NtcEventMonitorOrBlockReport>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcEventMonitorOrBlockReport> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
//
|
||||
titleList.add("ntc_event_monitor_report");
|
||||
classMap.put("ntc_event_monitor_report", NtcEventMonitorOrBlockReport.class);
|
||||
|
||||
String cfgIndexInfoNoExport = "," + hColumns + ",";
|
||||
noExportMap.put("ntc_event_monitor_report", cfgIndexInfoNoExport);
|
||||
|
||||
Properties msgProp = getMsgProp();
|
||||
NtcEventMonitorOrBlockReport ntcEventMonitorOrBlockReport = new NtcEventMonitorOrBlockReport();
|
||||
long ipNum = 0;
|
||||
long httpNum = 0;
|
||||
long mailNum = 0;
|
||||
long vedioNum = 0;
|
||||
long agentNum = 0;
|
||||
for (NtcEventMonitorOrBlockReport entity : list) {
|
||||
ipNum += entity.getIpNum();
|
||||
httpNum += entity.getHttpNum();
|
||||
mailNum += entity.getMailNum();
|
||||
vedioNum += entity.getVedioNum();
|
||||
agentNum += entity.getAgentNum();
|
||||
}
|
||||
String report_total = msgProp.getProperty("report_total");
|
||||
ntcEventMonitorOrBlockReport.setIpNum(ipNum);
|
||||
ntcEventMonitorOrBlockReport.setHttpNum(httpNum);
|
||||
ntcEventMonitorOrBlockReport.setMailNum(mailNum);
|
||||
ntcEventMonitorOrBlockReport.setVedioNum(vedioNum);
|
||||
ntcEventMonitorOrBlockReport.setAgentNum(agentNum);
|
||||
ntcEventMonitorOrBlockReport.setTaskIds(report_total);
|
||||
ntcEventMonitorOrBlockReport.setTaskName(" 一 ");
|
||||
ntcEventMonitorOrBlockReport.setTaskTime(" 一 ");
|
||||
ntcEventMonitorOrBlockReport.setReportTime(" 一 ");
|
||||
list.add(ntcEventMonitorOrBlockReport);
|
||||
|
||||
dataMap.put("ntc_event_monitor_report", list);
|
||||
|
||||
String timeRange = initHttpMap(log, "ntc_event_monitor_report");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "ntc_event_monitor_report", titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "ntc_event_monitor_report", titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("ntc_event_monitor_report export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
|
||||
public String initHttpMap(NtcEventMonitorOrBlockReport log, String title) {
|
||||
Properties msgProp = getMsgProp();
|
||||
String logTime = msgProp.getProperty(title, title);
|
||||
;
|
||||
if (StringUtils.isNotBlank(log.getSearchReportStartTime())) {
|
||||
logTime += " " + msgProp.getProperty("begin_date") + ":" + log.getSearchReportStartTime();
|
||||
}
|
||||
if (StringUtils.isNotBlank(log.getSearchReportEndTime())) {
|
||||
logTime += " " + msgProp.getProperty("end_date") + ":" + log.getSearchReportEndTime();
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(log.getSearchTaskStartTime())) {
|
||||
logTime += " " + msgProp.getProperty("task_time") + ":" + log.getSearchTaskStartTime();
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(log.getSearchTaskEndTime())) {
|
||||
logTime += " " + msgProp.getProperty("task_time") + ":" + log.getSearchTaskEndTime();
|
||||
}
|
||||
return logTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用来判断界面传来的时间参数是否为空来决定默认值与否
|
||||
*
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
public String[] getSerachTimes(String startTime, String endTime) {
|
||||
String[] times = new String[2];
|
||||
if (StringUtils.isNotBlank(startTime)) {
|
||||
times[0] = startTime;
|
||||
if (StringUtils.isNotBlank(endTime)) {
|
||||
times[1] = endTime;
|
||||
} else {
|
||||
times[1] = getSomeDate(startTime, 7);
|
||||
}
|
||||
} else {
|
||||
if (StringUtils.isNotBlank(endTime)) {
|
||||
times[0] = getSomeDate(endTime, -7);
|
||||
times[1] = endTime;
|
||||
} else {
|
||||
String searchReportEndTime = getCurrentDate();
|
||||
times[0] = getSomeDate(searchReportEndTime, -7);
|
||||
times[1] = searchReportEndTime;
|
||||
}
|
||||
}
|
||||
return times;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对日期Day的加/减
|
||||
*
|
||||
* @param date
|
||||
* @param offset
|
||||
* @return
|
||||
*/
|
||||
public static String getSomeDate(String date, int offset) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date time = null;
|
||||
try {
|
||||
time = format.parse(date);
|
||||
} catch (ParseException e) {
|
||||
logger.error("日期格式转换出现异常,{}", e);
|
||||
}
|
||||
DateTime dateTime = new DateTime(time);
|
||||
return dateTime.plusDays(offset).toString(TimeConstants.YYYY_MM_DD_HH24_MM_SS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到当前时间
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getCurrentDate() {
|
||||
|
||||
DateTime dateTime = DateTime.now();
|
||||
|
||||
return dateTime.toString(TimeConstants.YYYY_MM_DD_HH24_MM_SS);
|
||||
}
|
||||
|
||||
// eventMonitorPrint
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "eventMonitorPrint")
|
||||
public List<NtcEventMonitorOrBlockReport> eventMonitorPrint(@ModelAttribute("log") NtcEventMonitorOrBlockReport log, Model model,
|
||||
HttpServletRequest request, HttpServletResponse response,RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
PageLog<NtcEventMonitorOrBlockReport> page = new PageLog<NtcEventMonitorOrBlockReport>(request, response);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
page.setPageNo(1);
|
||||
page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE);
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
|
||||
// 判断请求参数
|
||||
String searchReportStartTime = null;
|
||||
String searchReportEndTime = null;
|
||||
String searchTaskStartTime = null;
|
||||
String searchTaskEndTime = null;
|
||||
|
||||
/**
|
||||
* 对统计时间参数进行处理 开始-结束(一周内[7天])
|
||||
*/
|
||||
String[] serachReportTimes = getSerachTimes(log.getSearchReportStartTime(), log.getSearchReportEndTime());
|
||||
searchReportStartTime = serachReportTimes[0];
|
||||
searchReportEndTime = serachReportTimes[1];
|
||||
|
||||
/**
|
||||
* 对报送时间参数进行处理 开始-结束(一周内[7天])
|
||||
*/
|
||||
String[] serachTaskTimes = getSerachTimes(log.getSearchTaskStartTime(), log.getSearchTaskEndTime());
|
||||
searchTaskStartTime = serachTaskTimes[0];
|
||||
searchTaskEndTime = serachTaskTimes[1];
|
||||
|
||||
params.put("searchReportStartTime", searchReportStartTime);
|
||||
params.put("searchReportEndTime", searchReportEndTime);
|
||||
params.put("searchTaskStartTime", searchTaskStartTime);
|
||||
params.put("searchTaskEndTime", searchTaskEndTime);
|
||||
|
||||
if (StringUtils.isNotBlank(log.getTaskIds())) {
|
||||
params.put("taskIds", log.getTaskIds());
|
||||
}
|
||||
|
||||
log.setSearchReportStartTime(searchReportStartTime);
|
||||
log.setSearchReportEndTime(searchReportEndTime);
|
||||
log.setSearchTaskStartTime(searchTaskStartTime);
|
||||
log.setSearchTaskEndTime(searchTaskEndTime);
|
||||
|
||||
params.put("reportType", 2);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_EVENT_MONITOR_OR_BLOCK_Report;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
List<NtcEventMonitorOrBlockReport> list = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcEventMonitorOrBlockReport> fromJson = gson.fromJson(recv,
|
||||
new TypeToken<LogRecvData<NtcEventMonitorOrBlockReport>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcEventMonitorOrBlockReport> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
logger.error("ntc_event_monitor_report print failed", e);
|
||||
addMessage(redirectAttributes, "error", "print_failed");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import java.util.Calendar;
|
||||
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;
|
||||
@@ -14,6 +15,7 @@ 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.google.gson.Gson;
|
||||
@@ -22,6 +24,7 @@ import com.google.gson.reflect.TypeToken;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.PageLog;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.log.BaseLogEntity;
|
||||
import com.nis.domain.log.SearchReport;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.domain.report.NtcAsnRecord;
|
||||
@@ -29,6 +32,7 @@ import com.nis.domain.report.NtcIpRangeReport;
|
||||
import com.nis.domain.report.NtcURLReport;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
@@ -37,22 +41,25 @@ import com.nis.web.security.UserUtils;
|
||||
@RequestMapping("${adminPath}/report")
|
||||
public class ReportController extends BaseController {
|
||||
@RequestMapping("/list")
|
||||
public String list(@ModelAttribute("bean") SearchReport bean,Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||
public String list(@ModelAttribute("bean") SearchReport bean, Model model, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
initReportCondition(model, bean);
|
||||
return "/report/list";
|
||||
}
|
||||
//asn
|
||||
@RequestMapping(value = {"/asnConnList", ""})
|
||||
public String asnConnLists(@ModelAttribute("log") NtcAsnRecord log, Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
// asn
|
||||
@RequestMapping(value = { "/asnConnList", "" })
|
||||
public String asnConnLists(@ModelAttribute("log") NtcAsnRecord log, Model model, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
try {
|
||||
PageLog<NtcAsnRecord> page = new PageLog<NtcAsnRecord>(request, response);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
//判断请求参数
|
||||
if(StringUtils.isNotEmpty(log.getSearchAsnType())){
|
||||
// 判断请求参数
|
||||
if (StringUtils.isNotEmpty(log.getSearchAsnType())) {
|
||||
params.put("searchAsnType", log.getSearchAsnType());
|
||||
}else{
|
||||
} else {
|
||||
params.put("searchAsnType", 1);
|
||||
}
|
||||
if (StringUtils.isNotBlank(log.getSearchFoundStartTime())
|
||||
@@ -60,40 +67,43 @@ public class ReportController extends BaseController {
|
||||
params.put("searchFoundStartTime", log.getSearchFoundStartTime());
|
||||
params.put("searchFoundEndTime", log.getSearchFoundEndTime());
|
||||
} else {
|
||||
Calendar time = Calendar.getInstance();
|
||||
String searchEndTime = DateUtils.formatDateTime(time.getTime());
|
||||
time.add(Calendar.HOUR_OF_DAY, -1);
|
||||
String searchStartTime = DateUtils.formatDateTime(time.getTime());
|
||||
|
||||
params.put("searchFoundStartTime", searchStartTime);
|
||||
params.put("searchFoundEndTime", searchEndTime);
|
||||
log.setSearchFoundStartTime(searchStartTime);
|
||||
log.setSearchFoundEndTime(searchEndTime);
|
||||
}
|
||||
if(StringUtils.isNotBlank(log.getAsn())){
|
||||
Calendar time = Calendar.getInstance();
|
||||
String searchEndTime = DateUtils.formatDateTime(time.getTime());
|
||||
time.add(Calendar.HOUR_OF_DAY, -1);
|
||||
String searchStartTime = DateUtils.formatDateTime(time.getTime());
|
||||
|
||||
params.put("searchFoundStartTime", searchStartTime);
|
||||
params.put("searchFoundEndTime", searchEndTime);
|
||||
log.setSearchFoundStartTime(searchStartTime);
|
||||
log.setSearchFoundEndTime(searchEndTime);
|
||||
}
|
||||
if (StringUtils.isNotBlank(log.getAsn())) {
|
||||
params.put("searchAsn", log.getAsn());
|
||||
}
|
||||
String url =Constants.LOG_BASE_URL + Constants.NTC_ASN_RECORD;
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_ASN_RECORD;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
// String recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"ASN通联关系(源,目的)检索成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcAsnRecord\",\"logSource\":0,\"traceCode\":\"2018121609404451375322\",\"data\":"
|
||||
// +"{\"pageNo\":1,\"pageSize\":30,\"count\":66564,\"last\":2219,\"list\":[{\"bps\":\"8.56\",\"pps\":\"0.07\",\"sAsn\":\"9198\",\"dAsn\":\"40545_26836\"},"+
|
||||
// "{\"bps\":\"3.68\",\"pps\":\"0.12\",\"sAsn\":\"9198\",\"dAsn\":\"19506\"},{\"bps\":\"1.77\",\"pps\":\"0.08\",\"sAsn\":\"38266\",\"dAsn\":\"N/A\"},"+
|
||||
// "{\"bps\":\"493.55\",\"pps\":\"0.76\",\"sAsn\":\"30922\",\"dAsn\":\"29555\"},{\"bps\":\"26.63\",\"pps\":\"0.04\",\"sAsn\":\"44546\",\"dAsn\":\"197482\"},"+
|
||||
// "{\"bps\":\"25.43\",\"pps\":\"0.45\",\"sAsn\":\"44391\",\"dAsn\":\"9198\"},{\"bps\":\"52.96\",\"pps\":\"0.08\",\"sAsn\":\"29555\",\"dAsn\":\"14080\"}]}}";
|
||||
//recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"ASN通联关系(源,目的)检索成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcAsnRecord\",\"logSource\":0,\"traceCode\":\"2018121722070122546049\",\"data\":{\"pageNo\":1,\"pageSize\":30,\"count\":24466,\"last\":816,\"list\":[{\"bps\":\"20.21\",\"pps\":\"0.17\",\"asn\":\"6858\"},{\"bps\":\"48662.31\",\"pps\":\"91.27\",\"asn\":\"60476\"},{\"bps\":\"3770.41\",\"pps\":\"5.38\",\"asn\":\"49963\"},{\"bps\":\"1.74\",\"pps\":\"0.01\",\"asn\":\"327892\"},{\"bps\":\"72.96\",\"pps\":\"0.13\",\"asn\":\"20598\"},{\"bps\":\"3.76\",\"pps\":\"0.03\",\"asn\":\"266106\"},{\"bps\":\"889.16\",\"pps\":\"1.28\",\"asn\":\"21928\"},{\"bps\":\"109274.80\",\"pps\":\"160.89\",\"asn\":\"200052\"},{\"bps\":\"3269.08\",\"pps\":\"4.85\",\"asn\":\"196977\"},{\"bps\":\"0.16\",\"pps\":\"0\",\"asn\":\"42643\"},{\"bps\":\"872.50\",\"pps\":\"1.22\",\"asn\":\"35017\"},{\"bps\":\"51079.66\",\"pps\":\"0\",\"asn\":\"57701\"},{\"bps\":\"1.25\",\"pps\":\"0.05\",\"asn\":\"58000\"},{\"bps\":\"0.45\",\"pps\":\"0.02\",\"asn\":\"266022\"},{\"bps\":\"0.16\",\"pps\":\"0\",\"asn\":\"43246\"},{\"bps\":\"5180.62\",\"pps\":\"9.11\",\"asn\":\"57172\"},{\"bps\":\"145.86\",\"pps\":\"0.29\",\"asn\":\"36994\"},{\"bps\":\"31.96\",\"pps\":\"0.06\",\"asn\":\"48536\"},{\"bps\":\"1009.25\",\"pps\":\"1.67\",\"asn\":\"4795\"},{\"bps\":\"0.86\",\"pps\":\"0.02\",\"asn\":\"196924\"},{\"bps\":\"0.5\",\"pps\":\"0\",\"asn\":\"21275\"},{\"bps\":\"13432.03\",\"pps\":\"0.28\",\"asn\":\"198640\"},{\"bps\":\"9.47\",\"pps\":\"0.33\",\"asn\":\"197287\"},{\"bps\":\"5.84\",\"pps\":\"0.02\",\"asn\":\"197155\"},{\"bps\":\"1890.60\",\"pps\":\"2.86\",\"asn\":\"29208\"},{\"bps\":\"18.26\",\"pps\":\"0.37\",\"asn\":\"51078\"},{\"bps\":\"1.53\",\"pps\":\"0.02\",\"asn\":\"5390\"},{\"bps\":\"16074.91\",\"pps\":\"30.44\",\"asn\":\"34974\"},{\"bps\":\"1695.46\",\"pps\":\"2.51\",\"asn\":\"31103\"},{\"bps\":\"42.18\",\"pps\":\"0.24\",\"asn\":\"6407\"}]}}";
|
||||
// String
|
||||
// recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"ASN通联关系(源,目的)检索成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcAsnRecord\",\"logSource\":0,\"traceCode\":\"2018121609404451375322\",\"data\":"
|
||||
// +"{\"pageNo\":1,\"pageSize\":30,\"count\":66564,\"last\":2219,\"list\":[{\"bps\":\"8.56\",\"pps\":\"0.07\",\"sAsn\":\"9198\",\"dAsn\":\"40545_26836\"},"+
|
||||
// "{\"bps\":\"3.68\",\"pps\":\"0.12\",\"sAsn\":\"9198\",\"dAsn\":\"19506\"},{\"bps\":\"1.77\",\"pps\":\"0.08\",\"sAsn\":\"38266\",\"dAsn\":\"N/A\"},"+
|
||||
// "{\"bps\":\"493.55\",\"pps\":\"0.76\",\"sAsn\":\"30922\",\"dAsn\":\"29555\"},{\"bps\":\"26.63\",\"pps\":\"0.04\",\"sAsn\":\"44546\",\"dAsn\":\"197482\"},"+
|
||||
// "{\"bps\":\"25.43\",\"pps\":\"0.45\",\"sAsn\":\"44391\",\"dAsn\":\"9198\"},{\"bps\":\"52.96\",\"pps\":\"0.08\",\"sAsn\":\"29555\",\"dAsn\":\"14080\"}]}}";
|
||||
// recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"ASN通联关系(源,目的)检索成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcAsnRecord\",\"logSource\":0,\"traceCode\":\"2018121722070122546049\",\"data\":{\"pageNo\":1,\"pageSize\":30,\"count\":24466,\"last\":816,\"list\":[{\"bps\":\"20.21\",\"pps\":\"0.17\",\"asn\":\"6858\"},{\"bps\":\"48662.31\",\"pps\":\"91.27\",\"asn\":\"60476\"},{\"bps\":\"3770.41\",\"pps\":\"5.38\",\"asn\":\"49963\"},{\"bps\":\"1.74\",\"pps\":\"0.01\",\"asn\":\"327892\"},{\"bps\":\"72.96\",\"pps\":\"0.13\",\"asn\":\"20598\"},{\"bps\":\"3.76\",\"pps\":\"0.03\",\"asn\":\"266106\"},{\"bps\":\"889.16\",\"pps\":\"1.28\",\"asn\":\"21928\"},{\"bps\":\"109274.80\",\"pps\":\"160.89\",\"asn\":\"200052\"},{\"bps\":\"3269.08\",\"pps\":\"4.85\",\"asn\":\"196977\"},{\"bps\":\"0.16\",\"pps\":\"0\",\"asn\":\"42643\"},{\"bps\":\"872.50\",\"pps\":\"1.22\",\"asn\":\"35017\"},{\"bps\":\"51079.66\",\"pps\":\"0\",\"asn\":\"57701\"},{\"bps\":\"1.25\",\"pps\":\"0.05\",\"asn\":\"58000\"},{\"bps\":\"0.45\",\"pps\":\"0.02\",\"asn\":\"266022\"},{\"bps\":\"0.16\",\"pps\":\"0\",\"asn\":\"43246\"},{\"bps\":\"5180.62\",\"pps\":\"9.11\",\"asn\":\"57172\"},{\"bps\":\"145.86\",\"pps\":\"0.29\",\"asn\":\"36994\"},{\"bps\":\"31.96\",\"pps\":\"0.06\",\"asn\":\"48536\"},{\"bps\":\"1009.25\",\"pps\":\"1.67\",\"asn\":\"4795\"},{\"bps\":\"0.86\",\"pps\":\"0.02\",\"asn\":\"196924\"},{\"bps\":\"0.5\",\"pps\":\"0\",\"asn\":\"21275\"},{\"bps\":\"13432.03\",\"pps\":\"0.28\",\"asn\":\"198640\"},{\"bps\":\"9.47\",\"pps\":\"0.33\",\"asn\":\"197287\"},{\"bps\":\"5.84\",\"pps\":\"0.02\",\"asn\":\"197155\"},{\"bps\":\"1890.60\",\"pps\":\"2.86\",\"asn\":\"29208\"},{\"bps\":\"18.26\",\"pps\":\"0.37\",\"asn\":\"51078\"},{\"bps\":\"1.53\",\"pps\":\"0.02\",\"asn\":\"5390\"},{\"bps\":\"16074.91\",\"pps\":\"30.44\",\"asn\":\"34974\"},{\"bps\":\"1695.46\",\"pps\":\"2.51\",\"asn\":\"31103\"},{\"bps\":\"42.18\",\"pps\":\"0.24\",\"asn\":\"6407\"}]}}";
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcAsnRecord> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcAsnRecord>>(){}.getType());
|
||||
LogRecvData<NtcAsnRecord> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcAsnRecord>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcAsnRecord> data = fromJson.getData();
|
||||
page.setCount(data.getCount());
|
||||
page.setLast(data.getLast());
|
||||
page.setList(data.getList());
|
||||
/*List<NtcCollectRadiusLog> list = page.getList();
|
||||
for (NtcConnRecordLog l : list) {
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l,serviceList);
|
||||
}*/
|
||||
/*
|
||||
* List<NtcCollectRadiusLog> list = page.getList(); for
|
||||
* (NtcConnRecordLog l : list) {
|
||||
* l.setFunctionId(log.getFunctionId());
|
||||
* setLogAction(l,serviceList); }
|
||||
*/
|
||||
model.addAttribute("page", page);
|
||||
}
|
||||
}
|
||||
@@ -101,56 +111,90 @@ public class ReportController extends BaseController {
|
||||
logger.error("查询失败", e);
|
||||
addMessageLog(model, e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
return "/report/asnRecordList";
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
@RequestMapping(value = {"/httpsUrlList", ""})
|
||||
public String httpsUrlLists(@ModelAttribute("log") NtcURLReport log, Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||
@RequestMapping(value = { "/httpsUrlList", "" })
|
||||
public String httpsUrlLists(@ModelAttribute("log") NtcURLReport log, Model model, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
try {
|
||||
PageLog<NtcURLReport> page = new PageLog<NtcURLReport>(request, response);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
//判断请求参数
|
||||
// 判断请求参数
|
||||
if (StringUtils.isNotBlank(log.getSearchReportStartTime())
|
||||
&& StringUtils.isNotBlank(log.getSearchReportEndTime())) {
|
||||
params.put("searchReportStartTime", log.getSearchReportStartTime());
|
||||
params.put("searchReportEndTime", log.getSearchReportEndTime());
|
||||
} else {
|
||||
Calendar time = Calendar.getInstance();
|
||||
String searchEndTime = DateUtils.formatDateTime(time.getTime());
|
||||
time.add(Calendar.HOUR_OF_DAY, -1);
|
||||
String searchStartTime = DateUtils.formatDateTime(time.getTime());
|
||||
|
||||
params.put("searchReportStartTime", searchStartTime);
|
||||
params.put("searchReportEndTime", searchEndTime);
|
||||
log.setSearchReportStartTime(searchStartTime);
|
||||
log.setSearchReportEndTime(searchEndTime);
|
||||
Calendar time = Calendar.getInstance();
|
||||
String searchEndTime = DateUtils.formatDateTime(time.getTime());
|
||||
time.add(Calendar.HOUR_OF_DAY, -1);
|
||||
String searchStartTime = DateUtils.formatDateTime(time.getTime());
|
||||
|
||||
params.put("searchReportStartTime", searchStartTime);
|
||||
params.put("searchReportEndTime", searchEndTime);
|
||||
log.setSearchReportStartTime(searchStartTime);
|
||||
log.setSearchReportEndTime(searchEndTime);
|
||||
}
|
||||
//url参数
|
||||
// url参数
|
||||
if (StringUtils.isNotBlank(log.getSearchUrl())) {
|
||||
params.put("searchUrl", log.getSearchUrl());
|
||||
}
|
||||
String url =Constants.LOG_BASE_URL + Constants.NTC_URL_REPORT;
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_URL_REPORT;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
// String recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"URL统计查询成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcURLReport\",\"logSource\":0,\"traceCode\":\"2018121610374649425419\",\"data\":{\"pageNo\":1,\"pageSize\":30,\"count\":174,\"last\":6,\"list\":[{\"url\":\"142.44.167.226/eventproxy/v1/bulk\",\"urlCount\":1686,\"dataList\":[{\"sum\":1686,\"ipAddr\":\"100.101.129.6\"}]},{\"url\":\"188.0.145.98/YZ/e1cib/dlist?cmd=query\",\"urlCount\":2652,\"dataList\":[{\"sum\":1248,\"ipAddr\":\"188.0.145.98\"},{\"sum\":1404,\"ipAddr\":\"89.218.9.2\"}]},{\"url\":\"cdn7.alpha-ag.ru/1c1233923d1a6/c51e872ab5861be256408f6cafa99ed8/luckypatcher_v7.5.9.apk\",\"urlCount\":882,\"dataList\":[{\"sum\":882,\"ipAddr\":\"100.81.118.193\"}]}]}}";
|
||||
// recv = "{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"URL统计查询成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcURLReport\",\"logSource\":0,\"traceCode\":\"2018121721092486282928\",\"data\":{\"pageNo\":1,\"pageSize\":30,\"count\":11193,\"last\":374,\"list\":[{\"reportTime\":\"2018-12-17 14:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 14:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 14:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 16:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":10},{\"reportTime\":\"2018-12-17 16:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":10},{\"reportTime\":\"2018-12-17 18:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":8},{\"reportTime\":\"2018-12-17 18:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":8},{\"reportTime\":\"2018-12-17 19:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 19:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 19:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 20:00:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 14:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F114274\",\"ipCount\":1,\"connCount\":7},{\"reportTime\":\"2018-12-17 14:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F114274\",\"ipCount\":1,\"connCount\":7},{\"reportTime\":\"2018-12-17 14:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F114274\",\"ipCount\":1,\"connCount\":7},{\"reportTime\":\"2018-12-17 19:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F114274\",\"ipCount\":1,\"connCount\":7},{\"reportTime\":\"2018-12-17 14:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F46507\",\"ipCount\":1,\"connCount\":6},{\"reportTime\":\"2018-12-17 14:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F46507\",\"ipCount\":1,\"connCount\":6},{\"reportTime\":\"2018-12-17 19:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F46507\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 19:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F46507\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 19:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F46507\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17 19:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F50460\",\"ipCount\":1,\"connCount\":8},{\"reportTime\":\"2018-12-16 20:15:00\",\"url\":\"119.29.29.29/d?dn=ww.kyzd0r.com\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-16 21:00:00\",\"url\":\"119.29.29.29/d?dn=ww.kyzd0r.com\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-16 22:30:00\",\"url\":\"119.29.29.29/d?dn=ww.kyzd0r.com\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-16 22:45:00\",\"url\":\"119.29.29.29/d?dn=ww.kyzd0r.com\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-17 14:00:00\",\"url\":\"119.29.29.29/d?dn=ww.kyzd0r.com\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-17 19:45:00\",\"url\":\"185.203.72.28/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-17 15:30:00\",\"url\":\"biboba.ru/\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-17 17:00:00\",\"url\":\"biboba.ru/porno_video/style/img/logo.gif\",\"ipCount\":1,\"connCount\":1},{\"reportTime\":\"2018-12-17 01:15:00\",\"url\":\"bilimsite.kz/\",\"ipCount\":1,\"connCount\":1}]}}";
|
||||
// String
|
||||
// recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"URL统计查询成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcURLReport\",\"logSource\":0,\"traceCode\":\"2018121610374649425419\",\"data\":{\"pageNo\":1,\"pageSize\":30,\"count\":174,\"last\":6,\"list\":[{\"url\":\"142.44.167.226/eventproxy/v1/bulk\",\"urlCount\":1686,\"dataList\":[{\"sum\":1686,\"ipAddr\":\"100.101.129.6\"}]},{\"url\":\"188.0.145.98/YZ/e1cib/dlist?cmd=query\",\"urlCount\":2652,\"dataList\":[{\"sum\":1248,\"ipAddr\":\"188.0.145.98\"},{\"sum\":1404,\"ipAddr\":\"89.218.9.2\"}]},{\"url\":\"cdn7.alpha-ag.ru/1c1233923d1a6/c51e872ab5861be256408f6cafa99ed8/luckypatcher_v7.5.9.apk\",\"urlCount\":882,\"dataList\":[{\"sum\":882,\"ipAddr\":\"100.81.118.193\"}]}]}}";
|
||||
// recv =
|
||||
// "{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"URL统计查询成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcURLReport\",\"logSource\":0,\"traceCode\":\"2018121721092486282928\",\"data\":{\"pageNo\":1,\"pageSize\":30,\"count\":11193,\"last\":374,\"list\":[{\"reportTime\":\"2018-12-17
|
||||
// 14:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17
|
||||
// 14:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17
|
||||
// 14:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17
|
||||
// 16:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":10},{\"reportTime\":\"2018-12-17
|
||||
// 16:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":10},{\"reportTime\":\"2018-12-17
|
||||
// 18:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":8},{\"reportTime\":\"2018-12-17
|
||||
// 18:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":8},{\"reportTime\":\"2018-12-17
|
||||
// 19:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17
|
||||
// 19:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17
|
||||
// 19:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17
|
||||
// 20:00:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17
|
||||
// 14:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F114274\",\"ipCount\":1,\"connCount\":7},{\"reportTime\":\"2018-12-17
|
||||
// 14:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F114274\",\"ipCount\":1,\"connCount\":7},{\"reportTime\":\"2018-12-17
|
||||
// 14:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F114274\",\"ipCount\":1,\"connCount\":7},{\"reportTime\":\"2018-12-17
|
||||
// 19:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F114274\",\"ipCount\":1,\"connCount\":7},{\"reportTime\":\"2018-12-17
|
||||
// 14:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F46507\",\"ipCount\":1,\"connCount\":6},{\"reportTime\":\"2018-12-17
|
||||
// 14:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F46507\",\"ipCount\":1,\"connCount\":6},{\"reportTime\":\"2018-12-17
|
||||
// 19:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F46507\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17
|
||||
// 19:30:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F46507\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17
|
||||
// 19:45:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F46507\",\"ipCount\":1,\"connCount\":9},{\"reportTime\":\"2018-12-17
|
||||
// 19:15:00\",\"url\":\"1.kyzd0r.com/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F50460\",\"ipCount\":1,\"connCount\":8},{\"reportTime\":\"2018-12-16
|
||||
// 20:15:00\",\"url\":\"119.29.29.29/d?dn=ww.kyzd0r.com\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-16
|
||||
// 21:00:00\",\"url\":\"119.29.29.29/d?dn=ww.kyzd0r.com\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-16
|
||||
// 22:30:00\",\"url\":\"119.29.29.29/d?dn=ww.kyzd0r.com\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-16
|
||||
// 22:45:00\",\"url\":\"119.29.29.29/d?dn=ww.kyzd0r.com\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-17
|
||||
// 14:00:00\",\"url\":\"119.29.29.29/d?dn=ww.kyzd0r.com\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-17
|
||||
// 19:45:00\",\"url\":\"185.203.72.28/away?url=http%3A%2F%2Fw.kyzd0r.com%2Fchlen-kluba%2F10159\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-17
|
||||
// 15:30:00\",\"url\":\"biboba.ru/\",\"ipCount\":1,\"connCount\":2},{\"reportTime\":\"2018-12-17
|
||||
// 17:00:00\",\"url\":\"biboba.ru/porno_video/style/img/logo.gif\",\"ipCount\":1,\"connCount\":1},{\"reportTime\":\"2018-12-17
|
||||
// 01:15:00\",\"url\":\"bilimsite.kz/\",\"ipCount\":1,\"connCount\":1}]}}";
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcURLReport> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcURLReport>>(){}.getType());
|
||||
LogRecvData<NtcURLReport> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcURLReport>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcURLReport> data = fromJson.getData();
|
||||
page.setCount(data.getCount());
|
||||
page.setLast(data.getLast());
|
||||
page.setList(data.getList());
|
||||
/*List<NtcCollectRadiusLog> list = page.getList();
|
||||
for (NtcConnRecordLog l : list) {
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l,serviceList);
|
||||
}*/
|
||||
/*
|
||||
* List<NtcCollectRadiusLog> list = page.getList(); for
|
||||
* (NtcConnRecordLog l : list) {
|
||||
* l.setFunctionId(log.getFunctionId());
|
||||
* setLogAction(l,serviceList); }
|
||||
*/
|
||||
model.addAttribute("page", page);
|
||||
}
|
||||
}
|
||||
@@ -158,25 +202,25 @@ public class ReportController extends BaseController {
|
||||
logger.error("查询失败", e);
|
||||
addMessageLog(model, e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
return "/report/urlReportList";
|
||||
}
|
||||
|
||||
|
||||
//IP范围统计
|
||||
@RequestMapping(value = {"/ipRangeList", ""})
|
||||
public String ipRangeLists(@ModelAttribute("log") NtcIpRangeReport log, Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
// IP范围统计
|
||||
@RequestMapping(value = { "/ipRangeList", "" })
|
||||
public String ipRangeLists(@ModelAttribute("log") NtcIpRangeReport log, Model model, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
try {
|
||||
PageLog<NtcIpRangeReport> page = new PageLog<NtcIpRangeReport>(request, response);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
//判断请求参数
|
||||
//查询国家
|
||||
// 判断请求参数
|
||||
// 查询国家
|
||||
if (StringUtils.isNotBlank(log.getSearchCountry())) {
|
||||
params.put("searchCountry", log.getSearchCountry());
|
||||
}
|
||||
//查询开始IP
|
||||
// 查询开始IP
|
||||
if (StringUtils.isNotBlank(log.getSearchIp())) {
|
||||
params.put("searchIp", log.getSearchIp());
|
||||
}
|
||||
@@ -187,24 +231,28 @@ public class ReportController extends BaseController {
|
||||
if (StringUtils.isNotBlank(log.getSearchAreaType())) {
|
||||
params.put("searchDesc", log.getSearchDesc());
|
||||
}
|
||||
|
||||
String url =Constants.LOG_BASE_URL + Constants.NTC_IP_RANGE_REPORT;
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_IP_RANGE_REPORT;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
// String recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"URL统计查询成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcIpRangeReport\",\"logSource\":0,\"traceCode\":\"2018121616062785920271\",\"data\":{\"pageNo\":1,\"pageSize\":30,\"count\":0,\"last\":1,\"list\":[{\"ipStart\":\"192.168.10.121\",\"ipEnd\":\"192.168.10.122\",\"ipStartNum\":3232238201,\"ipEndNum\":3232238202,\"ipSub\":\"255.255.255.252\"}]}}";
|
||||
|
||||
// String
|
||||
// recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"URL统计查询成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcIpRangeReport\",\"logSource\":0,\"traceCode\":\"2018121616062785920271\",\"data\":{\"pageNo\":1,\"pageSize\":30,\"count\":0,\"last\":1,\"list\":[{\"ipStart\":\"192.168.10.121\",\"ipEnd\":\"192.168.10.122\",\"ipStartNum\":3232238201,\"ipEndNum\":3232238202,\"ipSub\":\"255.255.255.252\"}]}}";
|
||||
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcIpRangeReport> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcIpRangeReport>>(){}.getType());
|
||||
LogRecvData<NtcIpRangeReport> fromJson = gson.fromJson(recv,
|
||||
new TypeToken<LogRecvData<NtcIpRangeReport>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcIpRangeReport> data = fromJson.getData();
|
||||
page.setCount(data.getCount());
|
||||
page.setLast(data.getLast());
|
||||
page.setList(data.getList());
|
||||
/*List<NtcCollectRadiusLog> list = page.getList();
|
||||
for (NtcConnRecordLog l : list) {
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l,serviceList);
|
||||
}*/
|
||||
/*
|
||||
* List<NtcCollectRadiusLog> list = page.getList(); for
|
||||
* (NtcConnRecordLog l : list) {
|
||||
* l.setFunctionId(log.getFunctionId());
|
||||
* setLogAction(l,serviceList); }
|
||||
*/
|
||||
model.addAttribute("page", page);
|
||||
}
|
||||
}
|
||||
@@ -212,10 +260,11 @@ public class ReportController extends BaseController {
|
||||
logger.error("查询失败", e);
|
||||
addMessageLog(model, e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
return "/report/ipRangeReportList";
|
||||
}
|
||||
//asnExport
|
||||
|
||||
// asnExport
|
||||
@RequestMapping(value = "asnExport")
|
||||
public void asnExport(@ModelAttribute("log") NtcAsnRecord log, Model model, String hColumns, String type,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
@@ -232,10 +281,10 @@ public class ReportController extends BaseController {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
//判断请求参数
|
||||
if(StringUtils.isNotEmpty(log.getSearchAsnType())){
|
||||
// 判断请求参数
|
||||
if (StringUtils.isNotEmpty(log.getSearchAsnType())) {
|
||||
params.put("searchAsnType", log.getSearchAsnType());
|
||||
}else{
|
||||
} else {
|
||||
params.put("searchAsnType", 1);
|
||||
}
|
||||
if (StringUtils.isNotBlank(log.getSearchFoundStartTime())
|
||||
@@ -243,22 +292,23 @@ public class ReportController extends BaseController {
|
||||
params.put("searchFoundStartTime", log.getSearchFoundStartTime());
|
||||
params.put("searchFoundEndTime", log.getSearchFoundEndTime());
|
||||
} else {
|
||||
Calendar time = Calendar.getInstance();
|
||||
String searchEndTime = DateUtils.formatDateTime(time.getTime());
|
||||
time.add(Calendar.HOUR_OF_DAY, -1);
|
||||
String searchStartTime = DateUtils.formatDateTime(time.getTime());
|
||||
|
||||
params.put("searchFoundStartTime", searchStartTime);
|
||||
params.put("searchFoundEndTime", searchEndTime);
|
||||
log.setSearchFoundStartTime(searchStartTime);
|
||||
log.setSearchFoundEndTime(searchEndTime);
|
||||
Calendar time = Calendar.getInstance();
|
||||
String searchEndTime = DateUtils.formatDateTime(time.getTime());
|
||||
time.add(Calendar.HOUR_OF_DAY, -1);
|
||||
String searchStartTime = DateUtils.formatDateTime(time.getTime());
|
||||
|
||||
params.put("searchFoundStartTime", searchStartTime);
|
||||
params.put("searchFoundEndTime", searchEndTime);
|
||||
log.setSearchFoundStartTime(searchStartTime);
|
||||
log.setSearchFoundEndTime(searchEndTime);
|
||||
}
|
||||
String url =Constants.LOG_BASE_URL + Constants.NTC_ASN_RECORD;
|
||||
// String recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"ASN通联关系(源,目的)检索成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcAsnRecord\",\"logSource\":0,\"traceCode\":\"2018121609404451375322\",\"data\":"
|
||||
// +"{\"pageNo\":1,\"pageSize\":30,\"count\":66564,\"last\":2219,\"list\":[{\"bps\":\"8.56\",\"pps\":\"0.07\",\"sAsn\":\"9198\",\"dAsn\":\"40545_26836\"},"+
|
||||
// "{\"bps\":\"3.68\",\"pps\":\"0.12\",\"sAsn\":\"9198\",\"dAsn\":\"19506\"},{\"bps\":\"1.77\",\"pps\":\"0.08\",\"sAsn\":\"38266\",\"dAsn\":\"N/A\"},"+
|
||||
// "{\"bps\":\"493.55\",\"pps\":\"0.76\",\"sAsn\":\"30922\",\"dAsn\":\"29555\"},{\"bps\":\"26.63\",\"pps\":\"0.04\",\"sAsn\":\"44546\",\"dAsn\":\"197482\"},"+
|
||||
// "{\"bps\":\"25.43\",\"pps\":\"0.45\",\"sAsn\":\"44391\",\"dAsn\":\"9198\"},{\"bps\":\"52.96\",\"pps\":\"0.08\",\"sAsn\":\"29555\",\"dAsn\":\"14080\"}]}}";
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_ASN_RECORD;
|
||||
// String
|
||||
// recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"ASN通联关系(源,目的)检索成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcAsnRecord\",\"logSource\":0,\"traceCode\":\"2018121609404451375322\",\"data\":"
|
||||
// +"{\"pageNo\":1,\"pageSize\":30,\"count\":66564,\"last\":2219,\"list\":[{\"bps\":\"8.56\",\"pps\":\"0.07\",\"sAsn\":\"9198\",\"dAsn\":\"40545_26836\"},"+
|
||||
// "{\"bps\":\"3.68\",\"pps\":\"0.12\",\"sAsn\":\"9198\",\"dAsn\":\"19506\"},{\"bps\":\"1.77\",\"pps\":\"0.08\",\"sAsn\":\"38266\",\"dAsn\":\"N/A\"},"+
|
||||
// "{\"bps\":\"493.55\",\"pps\":\"0.76\",\"sAsn\":\"30922\",\"dAsn\":\"29555\"},{\"bps\":\"26.63\",\"pps\":\"0.04\",\"sAsn\":\"44546\",\"dAsn\":\"197482\"},"+
|
||||
// "{\"bps\":\"25.43\",\"pps\":\"0.45\",\"sAsn\":\"44391\",\"dAsn\":\"9198\"},{\"bps\":\"52.96\",\"pps\":\"0.08\",\"sAsn\":\"29555\",\"dAsn\":\"14080\"}]}}";
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
List<NtcAsnRecord> list = new ArrayList<NtcAsnRecord>();
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
@@ -270,35 +320,59 @@ public class ReportController extends BaseController {
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
//
|
||||
//
|
||||
titleList.add("Ntc_Asn_Record");
|
||||
classMap.put("Ntc_Asn_Record", NtcAsnRecord.class);
|
||||
SysUser user = UserUtils.getUser();
|
||||
hColumns += ",s_asn,d_asn,cfg_id,action,found_time,recv_time,entrance_id,clj_ip,transport_layer_protocol,addr_type,server_ip,"
|
||||
+ "client_ip,server_port,client_port,deviceid,link_id,encap_type,direction,inner_smac,inner_dmac,"
|
||||
+ "stream_type,nest_addr_list,server_locate,client_locate,s_subscribe_id,d_subscribe_id,user_region,scene_file,";
|
||||
|
||||
+ "client_ip,server_port,client_port,deviceid,link_id,encap_type,direction,inner_smac,inner_dmac,"
|
||||
+ "stream_type,nest_addr_list,server_locate,client_locate,s_subscribe_id,d_subscribe_id,user_region,scene_file,";
|
||||
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("Ntc_Asn_Record", cfgIndexInfoNoExport);
|
||||
|
||||
Properties msgProp = getMsgProp();
|
||||
NtcAsnRecord ntcAsnRecord = new NtcAsnRecord();
|
||||
double pps = 0;
|
||||
double bps = 0;
|
||||
for (NtcAsnRecord entity : list) {
|
||||
if (null != entity.getBps() && !"".equals(entity.getBps())) {
|
||||
bps += Double.valueOf(entity.getBps());
|
||||
}
|
||||
if (null != entity.getPps() && !"".equals(entity.getPps())) {
|
||||
pps += Double.valueOf(entity.getPps());
|
||||
}
|
||||
}
|
||||
String report_total = msgProp.getProperty("report_total");
|
||||
ntcAsnRecord.setAsn(report_total);
|
||||
ntcAsnRecord.setBps(String.format("%.2f", bps));
|
||||
ntcAsnRecord.setPps(String.format("%.2f", pps));
|
||||
list.add(ntcAsnRecord);
|
||||
|
||||
dataMap.put("Ntc_Asn_Record", list);
|
||||
|
||||
String timeRange = initLogMap(log, "Ntc_Asn_Record");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "Ntc_Asn_Record", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "Ntc_Asn_Record", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
this._export(model, request, response, redirectAttributes, "Ntc_Asn_Record", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Ntc_Asn_Record export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
|
||||
//ipRangeExport
|
||||
|
||||
// ipRangeExport
|
||||
@RequestMapping(value = "ipRangeExport")
|
||||
public void ipRangeExport(@ModelAttribute("log") NtcIpRangeReport log, Model model, String hColumns, String type,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
HttpServletRequest request, HttpServletResponse response, String seType,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
@@ -312,12 +386,13 @@ public class ReportController extends BaseController {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
//判断请求参数
|
||||
//查询国家
|
||||
log.setSearchAreaType(seType);
|
||||
// 判断请求参数
|
||||
// 查询国家
|
||||
if (StringUtils.isNotBlank(log.getSearchCountry())) {
|
||||
params.put("searchCountry", log.getSearchCountry());
|
||||
}
|
||||
//查询开始IP
|
||||
// 查询开始IP
|
||||
if (StringUtils.isNotBlank(log.getSearchStartIp())) {
|
||||
params.put("searchIp", log.getSearchIp());
|
||||
}
|
||||
@@ -328,123 +403,323 @@ public class ReportController extends BaseController {
|
||||
if (StringUtils.isNotBlank(log.getSearchAreaType())) {
|
||||
params.put("searchDesc", log.getSearchDesc());
|
||||
}
|
||||
|
||||
String url =Constants.LOG_BASE_URL + Constants.NTC_IP_RANGE_REPORT;
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_IP_RANGE_REPORT;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
// String recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"URL统计查询成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcIpRangeReport\",\"logSource\":0,\"traceCode\":\"2018121616062785920271\",\"data\":{\"pageNo\":1,\"pageSize\":30,\"count\":0,\"last\":1,\"list\":[{\"ipStart\":\"192.168.10.121\",\"ipEnd\":\"192.168.10.122\",\"ipStartNum\":3232238201,\"ipEndNum\":3232238202,\"ipSub\":\"255.255.255.252\"}]}}";
|
||||
// String
|
||||
// recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"URL统计查询成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcIpRangeReport\",\"logSource\":0,\"traceCode\":\"2018121616062785920271\",\"data\":{\"pageNo\":1,\"pageSize\":30,\"count\":0,\"last\":1,\"list\":[{\"ipStart\":\"192.168.10.121\",\"ipEnd\":\"192.168.10.122\",\"ipStartNum\":3232238201,\"ipEndNum\":3232238202,\"ipSub\":\"255.255.255.252\"}]}}";
|
||||
List<NtcIpRangeReport> list = new ArrayList<NtcIpRangeReport>();
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcIpRangeReport> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcIpRangeReport>>() {
|
||||
}.getType());
|
||||
LogRecvData<NtcIpRangeReport> fromJson = gson.fromJson(recv,
|
||||
new TypeToken<LogRecvData<NtcIpRangeReport>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcIpRangeReport> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
}
|
||||
titleList.add("Ntc_Ip_Range_Report");
|
||||
classMap.put("Ntc_Ip_Range_Report", NtcIpRangeReport.class);
|
||||
SysUser user = UserUtils.getUser();
|
||||
hColumns += ",s_asn,d_asn,cfg_id,action,found_time,recv_time,entrance_id,clj_ip,transport_layer_protocol,addr_type,server_ip,"
|
||||
+ "client_ip,server_port,client_port,deviceid,link_id,encap_type,direction,inner_smac,inner_dmac,"
|
||||
+ "stream_type,nest_addr_list,server_locate,client_locate,s_asn,d_asn,s_subscribe_id,d_subscribe_id,"
|
||||
+ "user_region,scene_file,";
|
||||
|
||||
+ "client_ip,server_port,client_port,deviceid,link_id,encap_type,direction,inner_smac,inner_dmac,"
|
||||
+ "stream_type,nest_addr_list,server_locate,client_locate,s_asn,d_asn,s_subscribe_id,d_subscribe_id,"
|
||||
+ "user_region,scene_file,";
|
||||
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
|
||||
noExportMap.put("Ntc_Ip_Range_Report", cfgIndexInfoNoExport);
|
||||
dataMap.put("Ntc_Ip_Range_Report", list);
|
||||
|
||||
|
||||
String timeRange = initLogMap(log, "Ntc_Ip_Range_Report");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "Ntc_Ip_Range_Report", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
this._exportCsv(model, request, response, redirectAttributes, "Ntc_Ip_Range_Report", titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "Ntc_Ip_Range_Report", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
this._export(model, request, response, redirectAttributes, "Ntc_Ip_Range_Report", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Ntc_Ip_Range_Report export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
//asnExport
|
||||
@RequestMapping(value = "httpsExport")
|
||||
public void httpsExport(@ModelAttribute("log") NtcURLReport log, Model model, String hColumns, String type,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
// ---------------------------
|
||||
PageLog<NtcURLReport> page = new PageLog<NtcURLReport>(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.getSearchReportStartTime())
|
||||
&& StringUtils.isNotBlank(log.getSearchReportEndTime())) {
|
||||
params.put("searchReportStartTime", log.getSearchReportStartTime());
|
||||
params.put("searchReportEndTime", log.getSearchReportEndTime());
|
||||
} else {
|
||||
Calendar time = Calendar.getInstance();
|
||||
String searchEndTime = DateUtils.formatDateTime(time.getTime());
|
||||
time.add(Calendar.HOUR_OF_DAY, -1);
|
||||
String searchStartTime = DateUtils.formatDateTime(time.getTime());
|
||||
|
||||
params.put("searchReportStartTime", searchStartTime);
|
||||
params.put("searchReportEndTime", searchEndTime);
|
||||
log.setSearchReportStartTime(searchStartTime);
|
||||
log.setSearchReportEndTime(searchEndTime);
|
||||
}
|
||||
//url参数
|
||||
if (StringUtils.isNotBlank(log.getSearchUrl())) {
|
||||
params.put("searchUrl", log.getSearchUrl());
|
||||
}
|
||||
|
||||
String url =Constants.LOG_BASE_URL + Constants.NTC_URL_REPORT;
|
||||
// String recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"ASN通联关系(源,目的)检索成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcAsnRecord\",\"logSource\":0,\"traceCode\":\"2018121609404451375322\",\"data\":"
|
||||
// +"{\"pageNo\":1,\"pageSize\":30,\"count\":66564,\"last\":2219,\"list\":[{\"bps\":\"8.56\",\"pps\":\"0.07\",\"sAsn\":\"9198\",\"dAsn\":\"40545_26836\"},"+
|
||||
// "{\"bps\":\"3.68\",\"pps\":\"0.12\",\"sAsn\":\"9198\",\"dAsn\":\"19506\"},{\"bps\":\"1.77\",\"pps\":\"0.08\",\"sAsn\":\"38266\",\"dAsn\":\"N/A\"},"+
|
||||
// "{\"bps\":\"493.55\",\"pps\":\"0.76\",\"sAsn\":\"30922\",\"dAsn\":\"29555\"},{\"bps\":\"26.63\",\"pps\":\"0.04\",\"sAsn\":\"44546\",\"dAsn\":\"197482\"},"+
|
||||
// "{\"bps\":\"25.43\",\"pps\":\"0.45\",\"sAsn\":\"44391\",\"dAsn\":\"9198\"},{\"bps\":\"52.96\",\"pps\":\"0.08\",\"sAsn\":\"29555\",\"dAsn\":\"14080\"}]}}";
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
List<NtcURLReport> list = new ArrayList<NtcURLReport>();
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcURLReport> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcURLReport>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcURLReport> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
//
|
||||
titleList.add("Ntc_HTTPS_Report");
|
||||
classMap.put("Ntc_HTTPS_Report", NtcURLReport.class);
|
||||
//SysUser user = UserUtils.getUser();
|
||||
/*hColumns += "s_asn,d_asn,cfg_id,action,found_time,recv_time,entrance_id,clj_ip,transport_layer_protocol,addr_type,server_ip,"
|
||||
+ "client_ip,server_port,client_port,deviceid,link_id,encap_type,direction,inner_smac,inner_dmac,"
|
||||
+ "stream_type,nest_addr_list,server_locate,client_locate,s_subscribe_id,d_subscribe_id,user_region,scene_file,";*/
|
||||
hColumns += ",s_asn,d_asn,cfg_id,action,found_time,recv_time,entrance_id,clj_ip,transport_layer_protocol,addr_type,server_ip,"
|
||||
+ "client_ip,server_port,client_port,deviceid,link_id,encap_type,direction,inner_smac,inner_dmac,"
|
||||
+ "stream_type,nest_addr_list,server_locate,client_locate,s_subscribe_id,d_subscribe_id,user_region,scene_file,reportTime,";
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("Ntc_HTTPS_Report", cfgIndexInfoNoExport);
|
||||
dataMap.put("Ntc_HTTPS_Report", list);
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "Ntc_HTTPS_Report", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "Ntc_HTTPS_Report", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Ntc_HTTPS_Report export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
public String initHttpMap(NtcURLReport log, String title) {
|
||||
Properties msgProp = getMsgProp();
|
||||
String logTime = msgProp.getProperty(title, title);
|
||||
;
|
||||
if (log.getSearchReportStartTime() != null) {
|
||||
logTime += " " + msgProp.getProperty("begin_date") + ":" + log.getSearchReportStartTime();
|
||||
}
|
||||
if (log.getSearchReportEndTime() != null) {
|
||||
logTime += " " + msgProp.getProperty("end_date") + ":" + log.getSearchReportEndTime();
|
||||
}
|
||||
return logTime;
|
||||
}
|
||||
|
||||
// asnExport
|
||||
@RequestMapping(value = "httpsExport")
|
||||
public void httpsExport(@ModelAttribute("log") NtcURLReport log, Model model, String hColumns, String type,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
// ---------------------------
|
||||
PageLog<NtcURLReport> page = new PageLog<NtcURLReport>(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.getSearchReportStartTime())
|
||||
&& StringUtils.isNotBlank(log.getSearchReportEndTime())) {
|
||||
params.put("searchReportStartTime", log.getSearchReportStartTime());
|
||||
params.put("searchReportEndTime", log.getSearchReportEndTime());
|
||||
} else {
|
||||
Calendar time = Calendar.getInstance();
|
||||
String searchEndTime = DateUtils.formatDateTime(time.getTime());
|
||||
time.add(Calendar.HOUR_OF_DAY, -1);
|
||||
String searchStartTime = DateUtils.formatDateTime(time.getTime());
|
||||
|
||||
params.put("searchReportStartTime", searchStartTime);
|
||||
params.put("searchReportEndTime", searchEndTime);
|
||||
log.setSearchReportStartTime(searchStartTime);
|
||||
log.setSearchReportEndTime(searchEndTime);
|
||||
}
|
||||
// url参数
|
||||
if (StringUtils.isNotBlank(log.getSearchUrl())) {
|
||||
params.put("searchUrl", log.getSearchUrl());
|
||||
}
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_URL_REPORT;
|
||||
// String
|
||||
// recv="{\"status\":200,\"businessCode\":2001000,\"reason\":\"数据获取操作成功\",\"msg\":\"ASN通联关系(源,目的)检索成功\",\"fromuri\":\"/galaxy-service/service/log/v1/ntcAsnRecord\",\"logSource\":0,\"traceCode\":\"2018121609404451375322\",\"data\":"
|
||||
// +"{\"pageNo\":1,\"pageSize\":30,\"count\":66564,\"last\":2219,\"list\":[{\"bps\":\"8.56\",\"pps\":\"0.07\",\"sAsn\":\"9198\",\"dAsn\":\"40545_26836\"},"+
|
||||
// "{\"bps\":\"3.68\",\"pps\":\"0.12\",\"sAsn\":\"9198\",\"dAsn\":\"19506\"},{\"bps\":\"1.77\",\"pps\":\"0.08\",\"sAsn\":\"38266\",\"dAsn\":\"N/A\"},"+
|
||||
// "{\"bps\":\"493.55\",\"pps\":\"0.76\",\"sAsn\":\"30922\",\"dAsn\":\"29555\"},{\"bps\":\"26.63\",\"pps\":\"0.04\",\"sAsn\":\"44546\",\"dAsn\":\"197482\"},"+
|
||||
// "{\"bps\":\"25.43\",\"pps\":\"0.45\",\"sAsn\":\"44391\",\"dAsn\":\"9198\"},{\"bps\":\"52.96\",\"pps\":\"0.08\",\"sAsn\":\"29555\",\"dAsn\":\"14080\"}]}}";
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
List<NtcURLReport> list = new ArrayList<NtcURLReport>();
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcURLReport> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcURLReport>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcURLReport> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
//
|
||||
titleList.add("Ntc_HTTPS_Report");
|
||||
classMap.put("Ntc_HTTPS_Report", NtcURLReport.class);
|
||||
// SysUser user = UserUtils.getUser();
|
||||
/*
|
||||
* hColumns +=
|
||||
* "s_asn,d_asn,cfg_id,action,found_time,recv_time,entrance_id,clj_ip,transport_layer_protocol,addr_type,server_ip,"
|
||||
* +
|
||||
* "client_ip,server_port,client_port,deviceid,link_id,encap_type,direction,inner_smac,inner_dmac,"
|
||||
* +
|
||||
* "stream_type,nest_addr_list,server_locate,client_locate,s_subscribe_id,d_subscribe_id,user_region,scene_file,";
|
||||
*/
|
||||
hColumns += ",s_asn,d_asn,cfg_id,action,found_time,recv_time,entrance_id,clj_ip,transport_layer_protocol,addr_type,server_ip,"
|
||||
+ "client_ip,server_port,client_port,deviceid,link_id,encap_type,direction,inner_smac,inner_dmac,"
|
||||
+ "stream_type,nest_addr_list,server_locate,client_locate,s_subscribe_id,d_subscribe_id,user_region,scene_file,reportTime,";
|
||||
String cfgIndexInfoNoExport = "," + hColumns;
|
||||
noExportMap.put("Ntc_HTTPS_Report", cfgIndexInfoNoExport);
|
||||
|
||||
Properties msgProp = getMsgProp();
|
||||
NtcURLReport ntcURLReport = new NtcURLReport();
|
||||
long ipCount=0;
|
||||
long connCount=0;
|
||||
for (NtcURLReport entity : list) {
|
||||
ipCount += entity.getIpCount();
|
||||
connCount += entity.getConnCount();
|
||||
}
|
||||
String report_total = msgProp.getProperty("report_total");
|
||||
ntcURLReport.setIpCount(ipCount);
|
||||
ntcURLReport.setConnCount(connCount);
|
||||
ntcURLReport.setUrl(report_total);
|
||||
list.add(ntcURLReport);
|
||||
|
||||
|
||||
dataMap.put("Ntc_HTTPS_Report", list);
|
||||
|
||||
String timeRange = initHttpMap(log, "Ntc_HTTPS_Report");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
|
||||
/* } */
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "Ntc_HTTPS_Report", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "Ntc_HTTPS_Report", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Ntc_HTTPS_Report export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
}
|
||||
// asnPrint
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "asnPrint")
|
||||
public List<NtcAsnRecord> asnPrint(@ModelAttribute("log") NtcAsnRecord log, Model model,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
PageLog<NtcAsnRecord> page = new PageLog<NtcAsnRecord>(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.isNotEmpty(log.getSearchAsnType())) {
|
||||
params.put("searchAsnType", log.getSearchAsnType());
|
||||
} else {
|
||||
params.put("searchAsnType", 1);
|
||||
}
|
||||
if (StringUtils.isNotBlank(log.getSearchFoundStartTime())
|
||||
&& StringUtils.isNotBlank(log.getSearchFoundEndTime())) {
|
||||
params.put("searchFoundStartTime", log.getSearchFoundStartTime());
|
||||
params.put("searchFoundEndTime", log.getSearchFoundEndTime());
|
||||
} else {
|
||||
Calendar time = Calendar.getInstance();
|
||||
String searchEndTime = DateUtils.formatDateTime(time.getTime());
|
||||
time.add(Calendar.HOUR_OF_DAY, -1);
|
||||
String searchStartTime = DateUtils.formatDateTime(time.getTime());
|
||||
|
||||
params.put("searchFoundStartTime", searchStartTime);
|
||||
params.put("searchFoundEndTime", searchEndTime);
|
||||
log.setSearchFoundStartTime(searchStartTime);
|
||||
log.setSearchFoundEndTime(searchEndTime);
|
||||
}
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_ASN_RECORD;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
List<NtcAsnRecord> list = new ArrayList<NtcAsnRecord>();
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcAsnRecord> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcAsnRecord>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcAsnRecord> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
logger.error("Ntc_Asn_Record print failed", e);
|
||||
addMessage(redirectAttributes, "error", "print_failed");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// httpsPrint
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "httpsPrint")
|
||||
public List<NtcURLReport> httpsPrint(@ModelAttribute("log") NtcURLReport log, Model model,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
PageLog<NtcURLReport> page = new PageLog<NtcURLReport>(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.getSearchReportStartTime())
|
||||
&& StringUtils.isNotBlank(log.getSearchReportEndTime())) {
|
||||
params.put("searchReportStartTime", log.getSearchReportStartTime());
|
||||
params.put("searchReportEndTime", log.getSearchReportEndTime());
|
||||
} else {
|
||||
Calendar time = Calendar.getInstance();
|
||||
String searchEndTime = DateUtils.formatDateTime(time.getTime());
|
||||
time.add(Calendar.HOUR_OF_DAY, -1);
|
||||
String searchStartTime = DateUtils.formatDateTime(time.getTime());
|
||||
|
||||
params.put("searchReportStartTime", searchStartTime);
|
||||
params.put("searchReportEndTime", searchEndTime);
|
||||
log.setSearchReportStartTime(searchStartTime);
|
||||
log.setSearchReportEndTime(searchEndTime);
|
||||
}
|
||||
// url参数
|
||||
if (StringUtils.isNotBlank(log.getSearchUrl())) {
|
||||
params.put("searchUrl", log.getSearchUrl());
|
||||
}
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_URL_REPORT;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
List<NtcURLReport> list = new ArrayList<NtcURLReport>();
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcURLReport> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcURLReport>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcURLReport> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
logger.error("Ntc_HTTPS_Report print failed", e);
|
||||
addMessage(redirectAttributes, "error", "print_failed");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// ipRangePrint
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "ipRangePrint")
|
||||
public List<NtcIpRangeReport> ipRangePrint(@ModelAttribute("log") NtcIpRangeReport log, Model model,
|
||||
HttpServletRequest request, HttpServletResponse response, String seType,RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
PageLog<NtcIpRangeReport> page = new PageLog<NtcIpRangeReport>(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());
|
||||
log.setSearchAreaType(seType);
|
||||
// 判断请求参数
|
||||
// 查询国家
|
||||
if (StringUtils.isNotBlank(log.getSearchCountry())) {
|
||||
params.put("searchCountry", log.getSearchCountry());
|
||||
}
|
||||
// 查询开始IP
|
||||
if (StringUtils.isNotBlank(log.getSearchStartIp())) {
|
||||
params.put("searchIp", log.getSearchIp());
|
||||
}
|
||||
//
|
||||
if (StringUtils.isNotBlank(log.getSearchAreaType())) {
|
||||
params.put("searchType", log.getSearchAreaType());
|
||||
}
|
||||
if (StringUtils.isNotBlank(log.getSearchAreaType())) {
|
||||
params.put("searchDesc", log.getSearchDesc());
|
||||
}
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_IP_RANGE_REPORT;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
List<NtcIpRangeReport> list = new ArrayList<NtcIpRangeReport>();
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcIpRangeReport> fromJson = gson.fromJson(recv,
|
||||
new TypeToken<LogRecvData<NtcIpRangeReport>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcIpRangeReport> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
logger.error("Ntc_Ip_Range_Report print failed", e);
|
||||
addMessage(redirectAttributes, "error", "print_failed");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.nis.web.controller.specific;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
@@ -23,12 +25,19 @@ import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.specific.SpecificServiceCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigDictUtils;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.dao.dashboard.codedic.CodeResult;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@Controller
|
||||
@@ -490,4 +499,117 @@ public class SpecificServiceCfgController extends BaseController {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Specific配置导出
|
||||
@RequestMapping(value = "exportSpec")
|
||||
public void exportDict(String itType, SpecificServiceCfg specificServiceCfg, Model model, HttpServletRequest request,
|
||||
HttpServletResponse response, String ids, RedirectAttributes redirectAttributes, String exType,
|
||||
String hColumns) {
|
||||
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<SpecificServiceCfg> list = Lists.newArrayList();
|
||||
//处理数据
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
list = specificServiceCfgService.findBySpecificServiceCfg(ids);
|
||||
} else {
|
||||
if(specificServiceCfg.getCfgType()==null){
|
||||
specificServiceCfg.setCfgType(1);
|
||||
}
|
||||
Page<SpecificServiceCfg> pageCondition = new Page<SpecificServiceCfg>(request, response);
|
||||
pageCondition.setPageNo(1);
|
||||
pageCondition.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
List<SpecificServiceCfg> allList = specificServiceCfgService.findAllSpecificServiceCfg(specificServiceCfg,pageCondition.getOrderBy());
|
||||
Page<SpecificServiceCfg> page = specificServiceCfgService.findTopPage(pageCondition, specificServiceCfg);
|
||||
// 删除顶层数据、取出id
|
||||
List<Integer> intList = Lists.newArrayList();
|
||||
for (int i = allList.size() - 1; i >= 0; i--) {
|
||||
SpecificServiceCfg ss = allList.get(i);
|
||||
if ((ss != null && intList.contains(ss.getSpecServiceId())) || (ss != null && ss.getParent().getSpecServiceId() == 0)) {
|
||||
allList.remove(ss);
|
||||
}
|
||||
}
|
||||
allList.addAll(page.getList());
|
||||
SpecificServiceCfg.sortList(list, allList, 0, true);
|
||||
SpecificServiceCfg.addChildrenSeq(list, 0);
|
||||
}
|
||||
List<SysDataDictionaryItem> app=DictUtils.getDictList("APP_BUSINESS_TYPE");
|
||||
List<SysDataDictionaryItem> tunnel=DictUtils.getDictList("TUNNEL_BEHAV_BUSINESS_TYPE");
|
||||
List<SysDataDictionaryItem> basic=DictUtils.getDictList("BASIC_PROTOCOL_BUSINESS_TYPE");
|
||||
Properties msgProp = getMsgProp();
|
||||
for (SpecificServiceCfg spec : list) {
|
||||
if (!StringUtils.isEmpty(spec.getBusinessType())) {
|
||||
if (spec.getCfgType() == 1) {
|
||||
spec.setBusinessType(getName(spec.getBusinessType(),app,msgProp));
|
||||
} else if (spec.getCfgType() == 2) {
|
||||
spec.setBusinessType(getName(spec.getBusinessType(),tunnel,msgProp));
|
||||
} else if (spec.getCfgType() == 3) {
|
||||
spec.setBusinessType(getName(spec.getBusinessType(),basic,msgProp));
|
||||
}
|
||||
}
|
||||
}
|
||||
String dictName = "specific_service_cfg";
|
||||
titleList.add(dictName);
|
||||
classMap.put(dictName, SpecificServiceCfg.class);
|
||||
String cfgIndexInfoNoExport = "";
|
||||
if (specificServiceCfg.getCfgType() != null) {
|
||||
if (specificServiceCfg.getCfgType() == 2) {
|
||||
cfgIndexInfoNoExport = ",&app_code:tunnel_code-app_name:tunnel_name-app_desc:tunnel_desc-";
|
||||
} else if (specificServiceCfg.getCfgType() == 3) {
|
||||
cfgIndexInfoNoExport = ",&app_code:protocol_code-app_name:protocol_name-app_desc:protocol_desc-";
|
||||
}
|
||||
}
|
||||
if (specificServiceCfg.getBeginDate() == null) {
|
||||
cfgIndexInfoNoExport = ",operate_time," + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(hColumns)) {
|
||||
cfgIndexInfoNoExport = "," + hColumns + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
noExportMap.put(dictName, cfgIndexInfoNoExport);
|
||||
dataMap.put(dictName, list);
|
||||
String timeRange = initDictMap(specificServiceCfg, dictName,msgProp);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(exType)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, dictName, titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, dictName, titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("dict white export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String getName(String id,List<SysDataDictionaryItem> list,Properties msgProp){
|
||||
String name=id;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if(id.equals(list.get(i).getItemCode())){
|
||||
name=msgProp.getProperty(list.get(i).getItemValue(),list.get(i).getItemValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public String initDictMap(SpecificServiceCfg cfg, String dictName,Properties msgProp) {
|
||||
String titleTime =msgProp.getProperty(dictName,dictName) ;
|
||||
if (cfg.getBeginDate() != null) {
|
||||
titleTime += " " + msgProp.getProperty("operate_time") + ":" + DateUtils.formatDateTime(cfg.getBeginDate());
|
||||
if (cfg.getEndDate() != null) {
|
||||
titleTime += "—" + DateUtils.formatDateTime(cfg.getEndDate());
|
||||
} else {
|
||||
titleTime += "—" + DateUtils.getDateTime();
|
||||
}
|
||||
}
|
||||
return titleTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user