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);
|
}
|
|
|
}
|