czt
2025-06-10 694f541f9f4bc51818395be84e5ddf322c8048d8
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
package com.ld.igds.es.view;
 
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
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.es.service.HEsService;
import com.ld.igds.models.Energy;
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年6月4日
 *
 */
@Component
public class EsPR {
 
    @Autowired
    private HEsService esService;
    
    @Autowired
    private SysDeptService sysDeptService;
 
    /**
     * 根据时间获取某天的所有的采集数据,然后以最新的仓库一条数据展示到前端 esPR#listEsMeter
     * 
     * @param param
     * @return
     */
    @DataProvider
    public List<Energy> listEsMeter(Map<String, Object> param) {
        return esService.listEsMeter(param);
    }
 
    /**
     * 分页查询数据
     * 
     * @param param
     * @throws Exception
     */
    @DataProvider
    public void queryData(Page<Energy> page, Map<String, Object> param)
            throws Exception {
        esService.queryData(page, param);
    }
    
    /**
     * 
     * @return
     */
    @DataProvider
    public Map<String,Object> initParam(){
        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.getMonthFirst(new Date());
        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;
    }
 
}