package com.ld.igds.view.service;
|
|
import com.bstek.dorado.annotation.DataProvider;
|
import com.bstek.dorado.annotation.Expose;
|
import com.ld.igds.common.CoreCommonService;
|
import com.ld.igds.common.dto.THDto;
|
import com.ld.igds.models.DepotConf;
|
import com.ld.igds.util.ContextUtil;
|
import com.ld.igds.view.manager.TempManager;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
/**
|
* 温湿度管理
|
*
|
* @author andy.jia
|
*/
|
@Component
|
public class ThService {
|
|
@Autowired
|
private CoreCommonService coreCommonService;
|
|
@Autowired
|
private TempManager tempManager;
|
|
|
/**
|
* 检测所有温湿度信息
|
* <p>
|
* thService#checkThAll
|
*
|
* @return
|
*/
|
@Expose
|
public String checkThAll() {
|
String companyId = ContextUtil.getCompanyId();
|
tempManager.scheduledCheck(companyId);
|
return null;
|
}
|
|
|
/**
|
* thService#getData
|
*
|
* @return
|
*/
|
@DataProvider
|
public List<THDto> getData() {
|
|
List<DepotConf> listConf = coreCommonService.getCacheDepotConf(ContextUtil.getCompanyId());
|
|
if (null == listConf || listConf.isEmpty()) return null;
|
|
|
List<THDto> result = new ArrayList<>();
|
|
THDto thDto;
|
for (DepotConf conf : listConf) {
|
thDto = tempManager.getCacheTH(conf.getCompanyId(), conf.getGrainSer(), conf.getThConf());
|
if (null == thDto) continue;
|
thDto.setDepotId(conf.getDepotId());
|
thDto.setThConf(conf.getThConf());
|
result.add(thDto);
|
}
|
return result;
|
}
|
}
|