(1)实时报表reportTime字段修改为字符串格式
(2)实时报表回传结果解析不再使用Gson,gson会将long转为double
This commit is contained in:
@@ -8,8 +8,6 @@
|
||||
*/
|
||||
package com.nis.domain.report;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.nis.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
@@ -19,7 +17,7 @@ import com.nis.domain.BaseEntity;
|
||||
* @date 2018年7月5日 上午11:12:48
|
||||
* @version V1.0
|
||||
*/
|
||||
public class BaseReport<T> extends BaseEntity<T> {
|
||||
public class BaseReport<T> extends BaseEntity<T>{
|
||||
/**
|
||||
* @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么)
|
||||
*
|
||||
@@ -29,7 +27,7 @@ public class BaseReport<T> extends BaseEntity<T> {
|
||||
private static final long serialVersionUID = -6190203013788730697L;
|
||||
protected Long sum;
|
||||
protected Integer service;
|
||||
protected Date reportTime;
|
||||
protected String reportTime;
|
||||
/**
|
||||
* sum
|
||||
* @return sum
|
||||
@@ -63,13 +61,13 @@ public class BaseReport<T> extends BaseEntity<T> {
|
||||
* @return reportTime
|
||||
*/
|
||||
|
||||
public Date getReportTime() {
|
||||
public String getReportTime() {
|
||||
return reportTime;
|
||||
}
|
||||
/**
|
||||
* @param reportTime the reportTime to set
|
||||
*/
|
||||
public void setReportTime(Date reportTime) {
|
||||
public void setReportTime(String reportTime) {
|
||||
this.reportTime = reportTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,38 +8,8 @@
|
||||
*/
|
||||
package com.nis.domain.report;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Type;
|
||||
import java.net.URI;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.ws.rs.client.Client;
|
||||
import javax.ws.rs.client.Invocation.Builder;
|
||||
import javax.ws.rs.client.WebTarget;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.UriBuilder;
|
||||
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.RestfulResult;
|
||||
import com.nis.domain.log.SearchReport;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.util.httpclient.ClientUtil;
|
||||
|
||||
/**
|
||||
* @ClassName: ReportResultLog.java
|
||||
@@ -48,9 +18,9 @@ import com.nis.util.httpclient.ClientUtil;
|
||||
* @date 2018年6月11日 下午2:04:09
|
||||
* @version V1.0
|
||||
*/
|
||||
public class ReportResult<T extends BaseReport> extends RestfulResult{
|
||||
public class ReportResult extends RestfulResult{
|
||||
private Integer logSource;
|
||||
private Page<T> data;
|
||||
private Page data;
|
||||
/**
|
||||
* logSource
|
||||
* @return logSource
|
||||
@@ -70,63 +40,13 @@ public class ReportResult<T extends BaseReport> extends RestfulResult{
|
||||
* @return data
|
||||
*/
|
||||
|
||||
public Page<T> getData() {
|
||||
public Page getData() {
|
||||
return data;
|
||||
}
|
||||
/**
|
||||
* @param data the data to set
|
||||
*/
|
||||
public void setData(Page<T> data) {
|
||||
public void setData(Page data) {
|
||||
this.data = data;
|
||||
}
|
||||
public String getReport(String reportUrl, SearchReport searchCondition) throws MaatConvertException, UnsupportedEncodingException{
|
||||
// if(StringUtils.isBlank(searchCondition.getSearchService())){
|
||||
// throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||
// }
|
||||
String result = null;
|
||||
ReportResult<T> bean = null;
|
||||
UriBuilder builder=UriBuilder.fromPath(reportUrl);
|
||||
builder.queryParam("searchBusinessType",searchCondition.getSearchBusinessType());
|
||||
if(StringUtils.isNotBlank(searchCondition.getSearchService())) {
|
||||
builder.queryParam("searchService",searchCondition.getSearchService());
|
||||
}
|
||||
if(searchCondition.getSearchCondition()!=null){
|
||||
for(Entry<String, Object> e:searchCondition.getSearchCondition().entrySet()){
|
||||
builder.queryParam(e.getKey(),e.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
if(StringUtils.isNotBlank(searchCondition.getSearchReportStartTime())){
|
||||
builder.queryParam("searchReportStartTime",searchCondition.getSearchReportStartTime());
|
||||
}
|
||||
if(StringUtils.isNotBlank(searchCondition.getSearchReportEndTime())){
|
||||
builder.queryParam("searchReportEndTime",searchCondition.getSearchReportEndTime());
|
||||
}
|
||||
if(searchCondition.getPageNo()!=null){
|
||||
builder.queryParam("pageNo",searchCondition.getPageNo());
|
||||
}
|
||||
if(searchCondition.getPageSize()!=null){
|
||||
builder.queryParam("pageSize",searchCondition.getPageSize());
|
||||
}
|
||||
if(StringUtils.isNotBlank(searchCondition.getOrderBy())){
|
||||
builder.queryParam("orderBy",searchCondition.getOrderBy());
|
||||
}
|
||||
if(StringUtils.isNotBlank(searchCondition.getFields())){
|
||||
builder.queryParam("fields",searchCondition.getFields());
|
||||
}
|
||||
URI uri=builder.build();
|
||||
//创建连接
|
||||
ClientUtil.initClient();
|
||||
Client client=ClientUtil.getClient();
|
||||
WebTarget wt = client.target(uri);
|
||||
Builder header = wt.request();
|
||||
Response response= header.get();
|
||||
if( response.getStatus() == 200){
|
||||
result= response.readEntity(String.class);
|
||||
|
||||
}else{
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user