jiazx0107@163.com
2023-05-27 b667644b1a9f93583b4bb2d508c570c65aa3497b
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
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;
    }
}