@Component
public class ProductHesitationUtil {
public static Map<String,ProductInfo> productMap = null;
@Autowired
private ProductionWrapServiceV20 productionWrapServiceV20;
private static ProductHesitationUtil utils;
@PostConstruct
public void init(){
utils = this;
utils.productionWrapServiceV20 = this.productionWrapServiceV20;
}
//添加可以产品化的产品信息
public static Map<String,ProductInfo> putProductInfo(){
Map<String,String> companyProductMap = new HashMap<String, String>();
companyProductMap.put("AM","JM");
companyProductMap.put("PE","KT");
for(Map.Entry<String,String> entry : companyProductMap.entrySet()){
String category = entry.getKey();
String company = entry.getValue();
Set<MiProductCategory> categories = new HashSet<MiProductCategory>();
categories.add(MiProductCategory.getByCode(category));
Set<DisplayType> displayTypes = new HashSet<DisplayType>();
displayTypes.add(DisplayType.Down);
displayTypes.add(DisplayType.Up);
List<Production> listWrapper = utils.productionWrapServiceV20.getProductionsByCategoryDisplayType(categories, displayTypes);
if(listWrapper != null){
for(Production production : listWrapper){
ProductInfo productInfo = new ProductInfo();
productInfo.setProductCode(production.getProductionCode());
productInfo.setProductName(production.getName());
productInfo.setHesitationPeriod(0);
productInfo.setProductChannel(company);
productMap.put(production.getProductionCode(), productInfo);
}
}
}
return productMap;
}