对比新文件 |
| | |
| | | package com.iailab.module.data.ind.collection; |
| | | |
| | | 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 org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年10月04日 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class IndItemCollector { |
| | | |
| | | @Autowired |
| | | private IndItemService indItemService; |
| | | |
| | | @Autowired |
| | | private AtomItemHandler atomItemHandler; |
| | | |
| | | @Autowired |
| | | private DerItemHandler derItemHandler; |
| | | |
| | | @Autowired |
| | | private CalItemHandler calItemHandler; |
| | | |
| | | public List<IndItemValueVO> queryValue(String itemNo) { |
| | | List<IndItemValueVO> result = new ArrayList<IndItemValueVO>(); |
| | | IndItemEntity indItem = indItemService.getInfoByNo(itemNo); |
| | | if (indItem == null) { |
| | | return result; |
| | | } |
| | | 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 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; |
| | | } |
| | | 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; |
| | | } |
| | | } |