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 { /** * 图片的封装规则:仓库编码.img.png --照片 * 图片的封装规则:分库编码.img.png --默认照片 */ private Map mapImg; /** * 根据仓库列表和所在分库编码获取当前仓库类的通风配置图片 * * @param depotList * @param deptId * @return */ public Map getGasImg(List depotList, String deptId) { Map result = new HashMap<>(); Map all = this.getMapImg(); if (null == depotList || null == all) return result; GasImg temp; for (Depot d : depotList) { temp = all.get(d.getId()); if (null == temp) { temp = all.get(deptId); } result.put(d.getId(), temp); } return result; } }