报表服务接口通信功能提交,待接口完成后调整
This commit is contained in:
@@ -20,12 +20,12 @@ import net.sf.json.JSONObject;
|
||||
* @version V1.0
|
||||
*/
|
||||
public class RestfulResult {
|
||||
private Integer status=0;
|
||||
private Integer businessCode=0;
|
||||
private String reason="";
|
||||
private String msg="";
|
||||
protected Integer status=0;
|
||||
protected Integer businessCode=0;
|
||||
protected String reason="";
|
||||
protected String msg="";
|
||||
private String traceCode="";
|
||||
private String fromuri="";
|
||||
protected String fromuri="";
|
||||
public RestfulResult(){
|
||||
|
||||
}
|
||||
|
||||
127
src/main/java/com/nis/domain/log/ReportResultLog.java
Normal file
127
src/main/java/com/nis/domain/log/ReportResultLog.java
Normal file
@@ -0,0 +1,127 @@
|
||||
/**
|
||||
*@Title: ReportResultLog.java
|
||||
*@Package com.nis.domain.log
|
||||
*@Description TODO
|
||||
*@author dell
|
||||
*@date 2018年6月11日 下午2:04:09
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.domain.log;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.nis.domain.BaseEntity;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.RestfulResult;
|
||||
|
||||
/**
|
||||
* @ClassName: ReportResultLog.java
|
||||
* @Description: TODO
|
||||
* @author (wx)
|
||||
* @date 2018年6月11日 下午2:04:09
|
||||
* @version V1.0
|
||||
*/
|
||||
public class ReportResultLog extends RestfulResult{
|
||||
private Integer logSource;
|
||||
private List<Page<ReportLog>> data;
|
||||
/**
|
||||
* logSource
|
||||
* @return logSource
|
||||
*/
|
||||
|
||||
public Integer getLogSource() {
|
||||
return logSource;
|
||||
}
|
||||
/**
|
||||
* @param logSource the logSource to set
|
||||
*/
|
||||
public void setLogSource(Integer logSource) {
|
||||
this.logSource = logSource;
|
||||
}
|
||||
/**
|
||||
* data
|
||||
* @return data
|
||||
*/
|
||||
|
||||
public List<Page<ReportLog>> getData() {
|
||||
return data;
|
||||
}
|
||||
/**
|
||||
* @param data the data to set
|
||||
*/
|
||||
public void setData(List<Page<ReportLog>> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
}
|
||||
class ReportLog extends BaseEntity<ReportLog>{
|
||||
/**
|
||||
* @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么)
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
private static final long serialVersionUID = 7079305499220977782L;
|
||||
private Long configId;
|
||||
private Long sum;
|
||||
private Integer service;
|
||||
private Date statTime;
|
||||
/**
|
||||
* configId
|
||||
* @return configId
|
||||
*/
|
||||
|
||||
public Long getConfigId() {
|
||||
return configId;
|
||||
}
|
||||
/**
|
||||
* @param configId the configId to set
|
||||
*/
|
||||
public void setConfigId(Long configId) {
|
||||
this.configId = configId;
|
||||
}
|
||||
/**
|
||||
* sum
|
||||
* @return sum
|
||||
*/
|
||||
|
||||
public Long getSum() {
|
||||
return sum;
|
||||
}
|
||||
/**
|
||||
* @param sum the sum to set
|
||||
*/
|
||||
public void setSum(Long sum) {
|
||||
this.sum = sum;
|
||||
}
|
||||
/**
|
||||
* service
|
||||
* @return service
|
||||
*/
|
||||
|
||||
public Integer getService() {
|
||||
return service;
|
||||
}
|
||||
/**
|
||||
* @param service the service to set
|
||||
*/
|
||||
public void setService(Integer service) {
|
||||
this.service = service;
|
||||
}
|
||||
/**
|
||||
* statTime
|
||||
* @return statTime
|
||||
*/
|
||||
|
||||
public Date getStatTime() {
|
||||
return statTime;
|
||||
}
|
||||
/**
|
||||
* @param statTime the statTime to set
|
||||
*/
|
||||
public void setStatTime(Date statTime) {
|
||||
this.statTime = statTime;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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