报表服务接口通信功能提交,待接口完成后调整
This commit is contained in:
@@ -20,6 +20,7 @@ import org.glassfish.jersey.media.multipart.FormDataMultiPart;
|
||||
import org.glassfish.jersey.media.multipart.file.FileDataBodyPart;
|
||||
|
||||
import com.jcraft.jsch.Logger;
|
||||
import com.nis.domain.log.ReportResultLog;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.domain.maat.ToMaatResult.ResponseData;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
@@ -291,6 +292,49 @@ public class ConfigServiceUtil {
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* getReport(配置日志总量统计查询)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param type 1- 配置命中总量业务2- 配置报表业务
|
||||
* @param ids
|
||||
* @param serviceIds
|
||||
* @param searchReportStartTime
|
||||
* @param searchReportEndTime
|
||||
* @return
|
||||
* @throws MaatConvertException
|
||||
*ReportResultLog
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static ReportResultLog getReport(int type,String ids,String serviceIds,String searchReportStartTime,String searchReportEndTime) throws MaatConvertException{
|
||||
if(StringUtils.isBlank(ids)||StringUtils.isBlank(serviceIds)){
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||
}
|
||||
String result = null;
|
||||
ReportResultLog bean = null;
|
||||
StringBuffer url=new StringBuffer(Constants.SERVICE_URL+Constants.NTC_PZ_REPORT+"?");
|
||||
url.append("searchBusinessType=").append(type)
|
||||
.append("&searchService=").append(serviceIds).append("&searchCfgId=").append(ids);
|
||||
if(StringUtils.isNotBlank(searchReportStartTime)){
|
||||
url.append("&searchReportStartTime=").append(searchReportStartTime);
|
||||
}
|
||||
if(StringUtils.isNotBlank(searchReportEndTime)){
|
||||
url.append("&searchReportEndTime=").append(searchReportEndTime);
|
||||
}
|
||||
//创建连接
|
||||
WebTarget wt = ClientUtil.getWebTarger(url.toString());
|
||||
Builder header = wt.request(MediaType.APPLICATION_JSON);
|
||||
Response response= header.get();
|
||||
if( response.getStatus() == 200){
|
||||
result= response.readEntity(String.class);
|
||||
JSONObject resObject = JSONObject.fromObject(result);
|
||||
bean = (ReportResultLog) JSONObject.toBean(resObject,ReportResultLog.class);
|
||||
}else{
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
// getId(1,1);
|
||||
|
||||
@@ -291,6 +291,10 @@ public final class Constants {
|
||||
public static final String NTC_OPENVPN_LOG = Configurations.getStringProperty("ntcOpenvpnLog","");
|
||||
public static final String NTC_IPSEC_LOG = Configurations.getStringProperty("ntcIpsecLog","");
|
||||
public static final String NTC_SSH_LOG = Configurations.getStringProperty("ntcSshLog","");
|
||||
//报表类型,1- 配置命中总量业务
|
||||
public static final Integer BUSINESSTYPE_CONFIG=Configurations.getIntProperty("businesstype_config", 1);
|
||||
//报表类型,2- 配置报表业务
|
||||
public static final Integer BUSINESSTYPE_REPORT=Configurations.getIntProperty("businesstype_report", 2);
|
||||
//默认日志查询时长(ms)
|
||||
public static final Integer LOG_TIME_RANGE = Configurations.getIntProperty("log_time_range", 300000);
|
||||
/**请求头参数*/
|
||||
|
||||
Reference in New Issue
Block a user