package com.ld.igds.gas.view;
|
|
import java.util.Date;
|
import java.util.HashMap;
|
import java.util.Map;
|
|
import com.bstek.dorado.annotation.DataResolver;
|
import com.bstek.dorado.annotation.Expose;
|
import com.ld.igds.models.Gas;
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
|
import com.bstek.bdf2.core.model.DefaultDept;
|
import com.bstek.dorado.annotation.DataProvider;
|
import com.bstek.dorado.data.provider.Page;
|
import com.ld.igds.gas.dto.GasData;
|
import com.ld.igds.gas.service.HGasDataService;
|
import com.ld.igds.sys.service.SysDeptService;
|
import com.ld.igds.util.ContextUtil;
|
import com.ld.igds.util.DateUtil;
|
|
/**
|
*
|
* @author: andy.jia
|
* @description:
|
* @version:
|
* @data:2020年1月16日
|
*
|
*/
|
@Component
|
public class GasDataPR {
|
|
@Autowired
|
private HGasDataService gasDataService;
|
|
@Autowired
|
private SysDeptService sysDeptService;
|
|
/**
|
* gasDataPR#getQuery 根据报表类型,获取默认查询信息,比如表头信息等
|
*
|
* @param type
|
* @return
|
*/
|
@DataProvider
|
public Map<String, Object> getQuery(String type) {
|
Map<String, Object> result = new HashMap<String, Object>();
|
|
DefaultDept subDept = sysDeptService.getSubDept(null,null);
|
result.put("title", "气体检测数据");
|
if (null != subDept) {
|
result.put("title", subDept.getName() + "气体检测数据");
|
result.put("deptId", subDept.getId());
|
}
|
|
result.put("end", new Date());
|
Date start = DateUtil.getNewByDay(new Date(), -90);
|
result.put("start", start);
|
|
result.put("timeDesc",
|
DateFormatUtils.format(start, "yyyy-MM-dd") + " 截至:"
|
+ DateFormatUtils.format(new Date(), "yyyy-MM-dd"));
|
|
result.put("createUser", ContextUtil.getLoginUserCName());
|
return result;
|
}
|
|
/**
|
* gasDataPR#getDataReport
|
* 根据条件分页获取数据信息
|
* @param page
|
* @param parameter
|
* @throws Exception
|
*/
|
@DataProvider
|
public void getDataReport(Page<GasData> page,Map<String,Object> parameter)throws Exception{
|
gasDataService.getDataReport(page,parameter);
|
}
|
|
|
|
|
/**
|
* gasDataPR#pageData
|
*
|
* @param page
|
* @param param
|
* @throws Exception
|
*/
|
@DataProvider
|
public void pageData(Page<Gas> page, Map<String, Object> param)
|
throws Exception {
|
gasDataService.pageData(page, param);
|
}
|
|
/**
|
* gasDataPR#saveData
|
*
|
* @param data
|
*/
|
@DataResolver
|
public void saveData(Gas data) {
|
gasDataService.saveData(data);
|
}
|
|
/**
|
* gasDataPR#delData
|
*
|
* @param data
|
* @return
|
*/
|
@Expose
|
public String delData(Gas data) {
|
return gasDataService.delData(data);
|
}
|
|
}
|