jiazx0107@163.com
2023-05-17 620eab6cca2bc9ef9ea6d3067a0a5ba1deadbd1c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
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);
    }
 
}