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<String, List<IndItemValueDTO>> getValueList(List<String> itemNos) {
|
Map<String, List<IndItemValueDTO>> result = new HashMap<>();
|
if (CollectionUtils.isEmpty(itemNos)) {
|
return result;
|
}
|
try {
|
List<IndItemDTO> atomList = indItemService.getItemAtom(itemNos);
|
atomList.forEach(item -> {
|
result.put(item.getItemNo(), atomItemHandle.getItemSourceValue(item.getItemNo()));
|
});
|
|
List<IndItemDTO> calList = indItemService.getItemCal(itemNos);
|
calList.forEach(item -> {
|
result.put(item.getItemNo(), calItemHandle.getItemCalValue(item.getItemNo()));
|
});
|
|
} catch (Exception ex) {
|
ex.printStackTrace();
|
}
|
return result;
|
}
|
|
public Map<String, List<IndItemValueDTO>> getValueListRange(List<String> itemNos, String start, String end) {
|
Map<String, List<IndItemValueDTO>> result = new HashMap<>();
|
if (CollectionUtils.isEmpty(itemNos)) {
|
return result;
|
}
|
try {
|
List<IndItemDTO> atomList = indItemService.getItemAtom(itemNos);
|
atomList.forEach(item -> {
|
result.put(item.getItemNo(), atomItemHandle.getItemSourceValue(item.getItemNo(), start, end));
|
});
|
|
List<IndItemDTO> calList = indItemService.getItemCal(itemNos);
|
calList.forEach(item -> {
|
result.put(item.getItemNo(), calItemHandle.getItemCalValue(item.getItemNo(), start, end));
|
});
|
|
} catch (Exception ex) {
|
ex.printStackTrace();
|
}
|
return result;
|
}
|
}
|