新建package report,所有报表的pojo放入其中

This commit is contained in:
wangxin
2018-07-10 09:30:56 +08:00
parent bdc2a88d5b
commit 7b915cb717
12 changed files with 35 additions and 37 deletions

View File

@@ -1,75 +0,0 @@
/**
*@Title: BaseReportLog.java
*@Package com.nis.domain.log
*@Description TODO
*@author dell
*@date 2018年7月5日 上午11:12:48
*@version 版本号
*/
package com.nis.domain.log;
import java.util.Date;
import com.nis.domain.BaseEntity;
/**
* @ClassName: BaseReportLog.java
* @Description: 报表接口返回的公共字段
* @author (wx)
* @date 2018年7月5日 上午11:12:48
* @version V1.0
*/
public class BaseReportLog<T> extends BaseEntity<T> {
/**
* @Fields serialVersionUID:TODO用一句话描述这个变量表示什么
*
* @since 1.0.0
*/
private static final long serialVersionUID = -6190203013788730697L;
protected Long sum;
protected Integer service;
protected Date reportTime;
/**
* 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;
}
/**
* reportTime
* @return reportTime
*/
public Date getReportTime() {
return reportTime;
}
/**
* @param reportTime the reportTime to set
*/
public void setReportTime(Date reportTime) {
this.reportTime = reportTime;
}
}

View File

@@ -1,43 +0,0 @@
/**
*@Title: NtcServiceReportLog.java
*@Package com.nis.domain.log
*@Description TODO
*@author dell
*@date 2018年7月9日 上午8:57:01
*@version 版本号
*/
package com.nis.domain.log;
/**
* @ClassName: NtcServiceReportLog.java
* @Description: TODO
* @author (dell)
* @date 2018年7月9日 上午8:57:01
* @version V1.0
*/
public class NtcLwhhReportLog extends BaseReportLog<NtcLwhhReportLog> {
/**
* @Fields serialVersionUID:TODO用一句话描述这个变量表示什么
*
* @since 1.0.0
*/
private static final long serialVersionUID = 2245672277797057001L;
private Integer lwhh;
/**
* lwhh
* @return lwhh
*/
public Integer getLwhh() {
return lwhh;
}
/**
* @param lwhh the lwhh to set
*/
public void setLwhh(Integer lwhh) {
this.lwhh = lwhh;
}
}

View File

@@ -1,28 +0,0 @@
/**
*@Title: NtcServiceReportLog.java
*@Package com.nis.domain.log
*@Description TODO
*@author dell
*@date 2018年7月9日 上午8:57:01
*@version 版本号
*/
package com.nis.domain.log;
/**
* @ClassName: NtcServiceReportLog.java
* @Description: TODO
* @author (dell)
* @date 2018年7月9日 上午8:57:01
* @version V1.0
*/
public class NtcServiceReportLog extends BaseReportLog<NtcServiceReportLog> {
/**
* @Fields serialVersionUID:TODO用一句话描述这个变量表示什么
*
* @since 1.0.0
*/
private static final long serialVersionUID = 5574384523786886920L;
}

View File

@@ -1,43 +0,0 @@
/**
*@Title: NtcServiceReportLog.java
*@Package com.nis.domain.log
*@Description TODO
*@author dell
*@date 2018年7月9日 上午8:57:01
*@version 版本号
*/
package com.nis.domain.log;
/**
* @ClassName: NtcServiceReportLog.java
* @Description: TODO
* @author (dell)
* @date 2018年7月9日 上午8:57:01
* @version V1.0
*/
public class NtcTagReportLog extends BaseReportLog<NtcTagReportLog> {
/**
* @Fields serialVersionUID:TODO用一句话描述这个变量表示什么
*
* @since 1.0.0
*/
private static final long serialVersionUID = 2245672277797057001L;
private Integer tag;
/**
* tag
* @return tag
*/
public Integer getTag() {
return tag;
}
/**
* @param tag the tag to set
*/
public void setTag(Integer tag) {
this.tag = tag;
}
}

View File

@@ -1,89 +0,0 @@
/**
*@Title: ReportLog.java
*@Package com.nis.domain.log
*@Description TODO
*@author dell
*@date 2018年6月13日 下午2:21:04
*@version 版本号
*/
package com.nis.domain.log;
import java.util.Date;
/**
* @ClassName: ReportLog.java
* @Description: TODO
* @author (dell)
* @date 2018年6月13日 下午2:21:04
* @version V1.0
*/
public class ReportLog extends BaseReportLog<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;
}
}

View File

@@ -1,116 +0,0 @@
/**
*@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.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Map.Entry;
import javax.ws.rs.client.Invocation.Builder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.nis.domain.Page;
import com.nis.domain.RestfulResult;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.StringUtils;
import com.nis.util.httpclient.ClientUtil;
/**
* @ClassName: ReportResultLog.java
* @Description: TODO
* @author (wx)
* @date 2018年6月11日 下午2:04:09
* @version V1.0
*/
public class ReportResultLog<T extends BaseReportLog> extends RestfulResult{
private Integer logSource;
private Page<T> 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 Page<T> getData() {
return data;
}
/**
* @param data the data to set
*/
public void setData(Page<T> data) {
this.data = data;
}
public ReportResultLog<T> 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;
ReportResultLog<T> bean = null;
StringBuffer url=new StringBuffer(reportUrl);
url.append("searchBusinessType=").append(searchCondition.getSearchBusinessType())
.append("&searchService=").append(searchCondition.getSearchService());
if(searchCondition.getSearchCondition()!=null){
for(Entry<String, Object> e:searchCondition.getSearchCondition().entrySet()){
url.append("&").append(e.getKey()).append("=").append((String)e.getValue());
}
}
if(StringUtils.isNotBlank(searchCondition.getSearchReportStartTime())){
url.append("&searchReportStartTime=").append(searchCondition.getSearchReportStartTime());
}
if(StringUtils.isNotBlank(searchCondition.getSearchReportEndTime())){
url.append("&searchReportEndTime=").append(searchCondition.getSearchReportEndTime());
}
if(searchCondition.getPageNo()!=null){
url.append("&pageNo=").append(searchCondition.getPageNo());
}
if(searchCondition.getPageSize()!=null){
url.append("&pageSize=").append(searchCondition.getPageSize());
}
if(StringUtils.isNotBlank(searchCondition.getOrderBy())){
url.append("&orderBy=").append(searchCondition.getOrderBy());
}
if(StringUtils.isNotBlank(searchCondition.getFields())){
url.append("&fields=").append(searchCondition.getFields());
}
//创建连接
WebTarget wt = ClientUtil.getWebTarger(URLEncoder.encode(url.toString(),"UTF-8"));
Builder header = wt.request(MediaType.APPLICATION_JSON);
Response response= header.get();
if( response.getStatus() == 200){
result= response.readEntity(String.class);
Gson gson=Constants.gsonbuilder.create();
bean = gson.fromJson(result, new TypeToken<ReportResultLog<T>>(){
private static final long serialVersionUID = 7963055764864141968L;}.getType());
}else{
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
}
return bean;
}
public static void main(String[] args) {
}
}