| | |
| | | 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 com.iailab.module.data.common.enums.ItemTypeEnum; |
| | | import com.iailab.module.data.ind.collection.handler.AtomItemHandler; |
| | | import com.iailab.module.data.ind.collection.handler.CalItemHandler; |
| | | import com.iailab.module.data.ind.collection.handler.DerItemHandler; |
| | | import com.iailab.module.data.ind.item.entity.IndItemEntity; |
| | | import com.iailab.module.data.ind.item.service.IndItemService; |
| | | import com.iailab.module.data.ind.item.vo.IndItemValueVO; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import javax.annotation.Resource; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年05月25日 |
| | | * @createTime 2024年10月04日 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class IndItemCollector { |
| | | |
| | | @Resource |
| | | @Autowired |
| | | private IndItemService indItemService; |
| | | |
| | | @Resource |
| | | private AtomItemHandle atomItemHandle; |
| | | @Autowired |
| | | private AtomItemHandler atomItemHandler; |
| | | |
| | | @Resource |
| | | private CalItemHandle calItemHandle; |
| | | @Autowired |
| | | private DerItemHandler derItemHandler; |
| | | |
| | | @Autowired |
| | | private CalItemHandler calItemHandler; |
| | | |
| | | public Map<String, List<IndItemValueDTO>> getValueList(List<String> itemNos) { |
| | | Map<String, List<IndItemValueDTO>> result = new HashMap<>(); |
| | | if (CollectionUtils.isEmpty(itemNos)) { |
| | | public List<IndItemValueVO> queryValue(String itemNo) { |
| | | List<IndItemValueVO> result = new ArrayList<IndItemValueVO>(); |
| | | IndItemEntity indItem = indItemService.getInfoByNo(itemNo); |
| | | if (indItem == null) { |
| | | 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(); |
| | | ItemTypeEnum itemType = ItemTypeEnum.getEumByCode(indItem.getItemType()); |
| | | switch (itemType) { |
| | | case ATOM: |
| | | result = atomItemHandler.queryValue(indItem.getId()); |
| | | break; |
| | | case DER: |
| | | result = derItemHandler.queryValue(indItem.getId()); |
| | | break; |
| | | case CAL: |
| | | result = calItemHandler.queryValue(itemNo); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | 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)) { |
| | | public List<IndItemValueVO> queryValue(String itemNo, Date startTime, Date endTime) { |
| | | List<IndItemValueVO> result = new ArrayList<IndItemValueVO>(); |
| | | IndItemEntity indItem = indItemService.getInfoByNo(itemNo); |
| | | if (indItem == null) { |
| | | 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(); |
| | | ItemTypeEnum itemType = ItemTypeEnum.getEumByCode(indItem.getItemType()); |
| | | switch (itemType) { |
| | | case ATOM: |
| | | result = atomItemHandler.queryValue(indItem.getId()); |
| | | break; |
| | | case DER: |
| | | result = derItemHandler.queryValue(itemNo, startTime, endTime); |
| | | break; |
| | | case CAL: |
| | | result = calItemHandler.queryValue(itemNo, startTime, endTime); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return result; |
| | | } |