修复bug:

1.区域阻断范围字段导出数据与界面上显示不一致,界面上显示全部、导出的excel字段显示为否
2.界面上存在日志总量字段,导出的数据中不存在
3.导出数据包含字段blacklist option,界面上不存在
This commit is contained in:
wangwenrui
2019-01-14 10:52:06 +08:00
parent 3fb8d8c6f2
commit e7c7a4b960
17 changed files with 692 additions and 18 deletions

View File

@@ -566,6 +566,64 @@ public class ConfigServiceUtil {
}
return result;
}
/**
*
* getReport(配置日志总量统计查询)
* (这里描述这个方法适用条件 可选)
* @param type 1- 配置命中总量业务2- 配置报表业务
* @param ids
* @param serviceIds
* @param searchReportStartTime
* @param searchReportEndTime
* @param connTimeOut httpclient 连接超时时间
* @param readTimeOut httpclient 读取超时时间
* @return
* @throws MaatConvertException
*/
public static String getReport(int type,String ids,String serviceIds,String searchReportStartTime,String searchReportEndTime,Integer connTimeOut,Integer readTimeOut) throws MaatConvertException{
String result = null;
Response response=null;
try {
if(StringUtils.isBlank(ids)||StringUtils.isBlank(serviceIds)){
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
UriBuilder builder=UriBuilder.fromPath(Constants.LOG_BASE_URL+Constants.NTC_PZ_REPORT);
builder.queryParam("searchBusinessType",type);
builder.queryParam("searchService",serviceIds);
builder.queryParam("searchCfgId",ids);
if(StringUtils.isNotBlank(searchReportStartTime)) {
builder.queryParam("searchReportStartTime",searchReportStartTime);
}
if(StringUtils.isNotBlank(searchReportEndTime)) {
builder.queryParam("searchReportEndTime",searchReportEndTime);
}
URI uri=builder.build();
//创建连接
ClientUtil.initClient(connTimeOut,readTimeOut);
Client client=ClientUtil.getClient();
WebTarget wt = client.target(uri);
logger.info("getReport url:"+uri.toString());
Builder header = wt.request();
try {
response= header.get();
} catch (Exception e) {
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
if(response !=null && response.getStatus() == 200){
result= response.readEntity(String.class);
}else{
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
}
} catch (Exception e) {
throw e;
} finally {
if (response != null) {
response.close();
}
}
return result;
}
public static String getReport(String reportUrl, SearchReport searchCondition) throws MaatConvertException{
// if(StringUtils.isBlank(searchCondition.getSearchService())){
// throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");

View File

@@ -2189,8 +2189,8 @@ public class ExportExcel {
}
}
// If is dict, get dict label
String valStr=val==null?"":val.toString();
if (StringUtils.isNotBlank(ef.dictType())){
String valStr=val==null?"":val.toString();
if("type".equals(ef.dictType()) || "attribute".equals(ef.dictType())
|| "label".equals(ef.dictType())){
// Get basic info
@@ -2203,6 +2203,16 @@ public class ExportExcel {
}
}
if(ef.title().equals("whether_area_block")&&!StringUtil.isEmpty(val)){
Integer whetherAreaBlock=Integer.parseInt(valStr);
if(whetherAreaBlock.equals(0)){
val = msgProp.getProperty("all","all");
}else if(whetherAreaBlock.equals(1)){
val = msgProp.getProperty("selective","selective");
}else{
val ="";
}
}
if(ef.title().equals("is_hex") && !StringUtil.isEmpty(val)){
Integer isHex=Integer.parseInt(val.toString());
if(isHex.equals(0) || isHex.equals(2)){

View File

@@ -66,6 +66,33 @@ public class ClientUtil {
}
}
/**
* @param connTimeOut 连接超时时间
* @param readTimeOut 读取超时时间
*/
public static void initClient(Integer connTimeOut,Integer readTimeOut){
try{
if(client==null){
PoolingHttpClientConnectionManager pcm = new PoolingHttpClientConnectionManager();
pcm.setDefaultSocketConfig( SocketConfig.custom(). setSoTimeout(Constants.POOLCM_SOCKET_TIMEOUT). build());
pcm.setMaxTotal(Constants.HTTP_MAX_CONNECTION); pcm.setDefaultMaxPerRoute(Constants.DEFAULT_MAX_PERROUTE);
ClientConfig clientConfig = new ClientConfig();
clientConfig.property(ClientProperties.CONNECT_TIMEOUT, connTimeOut);//连接超时时间
clientConfig.property(ClientProperties.READ_TIMEOUT, readTimeOut);//读取超时时间
clientConfig.property(ApacheClientProperties.CONNECTION_MANAGER, pcm);
clientConfig.register(ClientRequestHeaderFilter.class);//请求过滤器自动添加header信息
clientConfig.register(JacksonFeature.class);//json支持
clientConfig.register(MultiPartFeature.class);//文件上传支持
client = ClientBuilder.newClient(clientConfig);
logger.info("客户端初始化成功");
}
}catch (Exception e) {
logger.error("初始化客户端失败,请检查证书是否正确!",e);
System.exit(1);//程序退出
}
}
/**
*path 以https://或http:// 开始不做处理否则在path前加上 Constants.BASE_URL + Constants.VERSION
* @param path