CZT
2023-10-24 f27f3ea5055888f7f1c797d0fd7fb26a2013c89c
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
package com.ld.igds.data;
 
import com.ld.igds.models.Depot;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
/**
 * @author: andy.jia
 * @description: 系统配置的气体检测各个仓库使用的图片
 * @date:2019.05.02
 **/
@Component
@PropertySource("classpath:gas-conf.properties")
@ConfigurationProperties(prefix = "gas")
@Data
public class ConfigGasImg {
 
    /**
     * gas.mapImg.5318_001.img=5318_001.png
     * 图片的封装规则:gas.mapImg.companyId_仓库编码.img.png --照片
     * 图片的封装规则:gas.mapImg.companyId_分库编码.img.png --默认照片
     */
    private Map<String, GasImg> mapImg;
 
 
    /**
     * 根据仓库列表和所在分库编码获取当前仓库类的通风配置图片
     *
     * @param depotList
     * @param deptId
     * @return
     */
    public Map<String, GasImg> getGasImg(List<Depot> depotList, String deptId) {
        Map<String, GasImg> result = new HashMap<>();
        Map<String, GasImg> all = this.getMapImg();
        if (null == depotList || null == all) return result;
        String companyId = depotList.get(0).getCompanyId();
        GasImg temp;
        for (Depot d : depotList) {
            //先从配置中获取
            temp = all.get(companyId + "_" + d.getId());
 
            if (null == temp) {
                temp = all.get(deptId);
            }
 
            result.put(d.getId(), temp);
        }
        return result;
    }
 
 
 
 
}