package com.iailab.module.data.ind.collection; import com.iailab.module.data.ind.collection.handler.AtomItemHandle; import com.iailab.module.data.ind.service.IndItemService; import com.iailab.module.data.ind.collection.handler.AtomItemHandle; import com.iailab.module.data.ind.service.IndItemService; import com.iailab.module.data.ind.collection.handler.AtomItemHandle; import com.iailab.module.data.ind.collection.handler.CalItemHandle; import com.iailab.module.data.ind.dto.IndItemDTO; import com.iailab.module.data.ind.dto.IndItemValueDTO; import com.iailab.module.data.ind.service.IndItemService; import com.iailab.module.data.ind.collection.handler.AtomItemHandle; import com.iailab.module.data.ind.service.IndItemService; import lombok.extern.slf4j.Slf4j; import javax.annotation.Resource; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author PanZhibao * @Description * @createTime 2024年05月25日 */ @Slf4j @Component public class IndItemCollector { @Resource private IndItemService indItemService; @Resource private AtomItemHandle atomItemHandle; @Resource private CalItemHandle calItemHandle; public Map> getValueList(List itemNos) { Map> result = new HashMap<>(); if (CollectionUtils.isEmpty(itemNos)) { return result; } try { List atomList = indItemService.getItemAtom(itemNos); atomList.forEach(item -> { result.put(item.getItemNo(), atomItemHandle.getItemSourceValue(item.getItemNo())); }); List calList = indItemService.getItemCal(itemNos); calList.forEach(item -> { result.put(item.getItemNo(), calItemHandle.getItemCalValue(item.getItemNo())); }); } catch (Exception ex) { ex.printStackTrace(); } return result; } public Map> getValueListRange(List itemNos, String start, String end) { Map> result = new HashMap<>(); if (CollectionUtils.isEmpty(itemNos)) { return result; } try { List atomList = indItemService.getItemAtom(itemNos); atomList.forEach(item -> { result.put(item.getItemNo(), atomItemHandle.getItemSourceValue(item.getItemNo(), start, end)); }); List calList = indItemService.getItemCal(itemNos); calList.forEach(item -> { result.put(item.getItemNo(), calItemHandle.getItemCalValue(item.getItemNo(), start, end)); }); } catch (Exception ex) { ex.printStackTrace(); } return result; } }