CZT
2023-10-11 564295458c720206db9b5194b90481b711f4b010
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
package com.ld.igds.weather;
 
import java.util.ArrayList;
import java.util.List;
 
import com.ld.igds.models.WeatherCity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 
import com.bstek.bdf2.core.business.IUser;
import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.annotation.Expose;
import com.bstek.dorado.data.provider.Page;
import com.ld.igds.models.DicTrigger;
import com.ld.igds.models.WeatherConf;
import com.ld.igds.models.WeatherInfo;
import com.ld.igds.util.ContextUtil;
 
/**
 * @author: andy.jia
 * @description:
 * @version:
 * @data:2020年3月13日
 */
@Component
public class WeatherInfoPR {
 
    @Autowired
    private CoreWeatherService weatherService;
 
    /**
     * weatherInfoPR 出入库的系统设备类型
     *
     * @return
     */
    // ${dorado.getDataProvider("weatherInfoPR#triggerSource").getResult()}
    @DataProvider
    public List<DicTrigger> triggerSource() {
        List<DicTrigger> list = new ArrayList<DicTrigger>();
        list.add(new DicTrigger(WeatherUtil.SOURCE_01, "库区气象站"));
        list.add(new DicTrigger(WeatherUtil.SOURCE_01, "外网气象站"));
        return list;
    }
 
    /**
     * weatherInfoPR#getConfData 获取当前人所在的分库下的配置信息
     *
     * @return
     * @throws Exception
     */
    @DataProvider
    public List<WeatherConf> getConfData() throws Exception {
        IUser user = ContextUtil.getLoginUser();
        return weatherService.getConfData(user.getCompanyId(), null);
    }
 
    /**
     * 获取当前用户所在分库下的气象配置信息
     * weatherInfoPR#getConfData2
     *
     * @return
     * @throws Exception
     */
    @DataProvider
    public WeatherConf getConfData2() throws Exception {
        IUser user = ContextUtil.getLoginUser();
        String deptId = ContextUtil.subDeptId(user);
        List<WeatherConf> list = weatherService.getConfData(user.getCompanyId(), deptId);
        if (null == list || list.isEmpty()) return new WeatherConf(user.getCompanyId(), deptId);
        return list.get(0);
    }
 
    /**
     * weatherInfoPR#saveConfData
     *
     * @return
     * @throws Exception
     */
    @Expose
    public String saveConfData(WeatherConf data) {
        return weatherService.saveConf(data);
    }
 
    /**
     * weatherInfoPR#delConf
     *
     * @param data
     * @return
     */
    @Expose
    public String delConf(WeatherConf data) {
        return weatherService.delConf(data);
    }
 
    /**
     * weatherInfoPR#getInfoData
     *
     * @param page
     * @throws Exception
     */
    @DataProvider
    public void getInfoData(Page<WeatherInfo> page) throws Exception {
        weatherService.getInfoData(page);
    }
 
    /**
     * weatherInfoPR#getCity
     *
     * @throws Exception
     */
    @DataProvider
    public void getCity(Page<WeatherCity> page, String key) throws Exception {
        weatherService.pageCity(page, key);
    }
 
 
}