用户管理模块

1、调整页面字段查询及优化页面
2、增加cgi 接口请求
调整http url检索条件
This commit is contained in:
leijun
2018-11-28 19:06:14 +08:00
parent 1fcc9fbbac
commit 7ab1a38131
7 changed files with 259 additions and 219 deletions

View File

@@ -373,4 +373,53 @@ public class HttpClientUtil {
//
// }
/**
* CGI get 获取消息
* @param destUrl 业务地址
* @param params 参数列表
* @return 查询结果数据json
*/
public static String getCGI(String destUrl, Map<String, Object> params, HttpServletRequest req) throws IOException {
String result = null;
Response response=null;
String url = "";
try {
URIBuilder uriBuilder = new URIBuilder(destUrl);
if(params!=null) {
for (String param : params.keySet()) {
if(!StringUtil.isBlank(param)&&params.get(param)!=null) {
uriBuilder.addParameter(param, params.get(param).toString());
}
}
}
System.err.println(uriBuilder);
url=uriBuilder.toString();
//创建连接
WebTarget wt = ClientUtil.getWebTarger(url);
logger.info("getMsg url:"+url);
//获取响应结果
Builder header = wt.request(MediaType.APPLICATION_JSON).header("Content-Type", MediaType.APPLICATION_JSON);
response= header.get();
int status = response.getStatus();
if (status == HttpStatus.SC_OK) {
result= response.readEntity(String.class);
result = galaxyMessageFormat(result);
logger.info("获取消息成功,相应内容如下: " + result);
} else {
logger.error("获取消息失败,相应内容如下: " + result);
throw new MaatConvertException(status+"");
}
} catch (Exception e) {
e.printStackTrace();
logger.error("获取消息失败,相应内容如下: " + result);
logger.error("获取消息失败 ", e);
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:");
}finally {
if (response != null) {
response.close();
}
}
return result;
}
}