asn相关功能修改

This commit is contained in:
duandongmei
2019-01-16 13:55:12 +06:00
parent cc0b7dc86c
commit 616a80555d
8 changed files with 346 additions and 49 deletions

View File

@@ -356,7 +356,7 @@ public class ConfigServiceUtil {
}else if(type==2){
url = url+Constants.CALLBACK_CFG;
}else if(type==3) {
url = url+Constants.GROUP_REUSE_SOURCES;
url = url+Constants.DELETE_COMMON_REIGON;
}
//创建连接
WebTarget wt = ClientUtil.getWebTarger(url);
@@ -400,9 +400,9 @@ public class ConfigServiceUtil {
url = url+Constants.MAAT_CFG;
}else if(type==2){
url = url+Constants.CALLBACK_CFG;
}else if(type==3) {
}/*else if(type==3) {
url = url+Constants.GROUP_REUSE_SOURCES;
}
}*/
logger.info("put url:"+url);
//创建连接
try {
@@ -463,26 +463,43 @@ public class ConfigServiceUtil {
return bean;
}
/**
* 分组复用域配置新增
* 分组复用域配置新增,修改,删除
* @param params
* @return
* @throws MaatConvertException
*/
public static ToMaatResult postGroupReuseSources(String params) throws MaatConvertException{
public static ToMaatResult auditCommonGroupRegionSources(String params,Integer action) throws MaatConvertException{
ToMaatResult bean = null;
Response response=null;
try {
logger.warn("postGroupReuseSources start");
long start=System.currentTimeMillis();
String result = null;
String url = Constants.SERVICE_URL+Constants.GROUP_REUSE_SOURCES;
String url = "";
if(action.equals(Constants.OPACTION_POST)){
url=Constants.SERVICE_URL+Constants.ADD_COMMON_REGION;
}
if(action.equals(Constants.OPACTION_PUT)){
url=Constants.SERVICE_URL+Constants.UPDATE_COMMON_REIGON;
}
if(action.equals(Constants.OPACTION_DELETE)){
url=Constants.SERVICE_URL+Constants.DELETE_COMMON_REIGON;
}
//创建连接
WebTarget wt = ClientUtil.getWebTarger(url);
logger.info("postGroupReuseSources url:"+url);
logger.info("auditCommonGroupRegionSources url:"+url);
//获取响应结果
Builder header = wt.request(MediaType.APPLICATION_JSON).header("Content-Type", MediaType.APPLICATION_JSON);
try {
response= header.post(Entity.entity(params, MediaType.APPLICATION_JSON));
if(action.equals(Constants.OPACTION_POST)){
response= header.post(Entity.entity(params, MediaType.APPLICATION_JSON));
}
if(action.equals(Constants.OPACTION_PUT)){
response= header.put(Entity.entity(params, MediaType.APPLICATION_JSON));
}
if(action.equals(Constants.OPACTION_DELETE)){
response= header.put(Entity.entity(params, MediaType.APPLICATION_JSON));
}
if(response != null) {
result=response.readEntity(String.class);
}
@@ -498,7 +515,7 @@ public class ConfigServiceUtil {
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
}
long end=System.currentTimeMillis();
logger.warn("postGroupReuseSources end,cost:"+(end-start));
logger.warn("auditCommonGroupRegionSources end,cost:"+(end-start));
} catch (Exception e) {
throw e;
} finally {
@@ -508,6 +525,7 @@ public class ConfigServiceUtil {
}
return bean;
}
/**
*
* getReport(配置日志总量统计查询)
@@ -566,6 +584,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\"/>");