提交 | 用户 | 时间
|
cf757d
|
1 |
package com.iailab.module.data.ind.collection; |
潘 |
2 |
|
|
3 |
import com.iailab.module.data.common.enums.ItemTypeEnum; |
|
4 |
import com.iailab.module.data.ind.collection.handler.AtomItemHandler; |
|
5 |
import com.iailab.module.data.ind.collection.handler.CalItemHandler; |
|
6 |
import com.iailab.module.data.ind.collection.handler.DerItemHandler; |
|
7 |
import com.iailab.module.data.ind.item.entity.IndItemEntity; |
|
8 |
import com.iailab.module.data.ind.item.service.IndItemService; |
|
9 |
import com.iailab.module.data.ind.item.vo.IndItemValueVO; |
|
10 |
import lombok.extern.slf4j.Slf4j; |
|
11 |
import org.springframework.beans.factory.annotation.Autowired; |
|
12 |
import org.springframework.stereotype.Component; |
|
13 |
|
|
14 |
import java.util.ArrayList; |
|
15 |
import java.util.Date; |
|
16 |
import java.util.List; |
|
17 |
|
|
18 |
/** |
|
19 |
* @author PanZhibao |
|
20 |
* @Description |
|
21 |
* @createTime 2024年10月04日 |
|
22 |
*/ |
|
23 |
@Slf4j |
|
24 |
@Component |
|
25 |
public class IndItemCollector { |
|
26 |
|
|
27 |
@Autowired |
|
28 |
private IndItemService indItemService; |
|
29 |
|
|
30 |
@Autowired |
|
31 |
private AtomItemHandler atomItemHandler; |
|
32 |
|
|
33 |
@Autowired |
|
34 |
private DerItemHandler derItemHandler; |
|
35 |
|
|
36 |
@Autowired |
|
37 |
private CalItemHandler calItemHandler; |
|
38 |
|
|
39 |
public List<IndItemValueVO> queryValue(String itemNo) { |
|
40 |
List<IndItemValueVO> result = new ArrayList<IndItemValueVO>(); |
|
41 |
IndItemEntity indItem = indItemService.getInfoByNo(itemNo); |
|
42 |
if (indItem == null) { |
|
43 |
return result; |
|
44 |
} |
|
45 |
ItemTypeEnum itemType = ItemTypeEnum.getEumByCode(indItem.getItemType()); |
|
46 |
switch (itemType) { |
|
47 |
case ATOM: |
|
48 |
result = atomItemHandler.queryValue(indItem.getId()); |
|
49 |
break; |
|
50 |
case DER: |
5bc3b4
|
51 |
result = derItemHandler.queryValue(indItem.getId()); |
cf757d
|
52 |
break; |
潘 |
53 |
case CAL: |
|
54 |
result = calItemHandler.queryValue(itemNo); |
|
55 |
break; |
|
56 |
default: |
|
57 |
break; |
|
58 |
} |
|
59 |
return result; |
|
60 |
} |
|
61 |
|
|
62 |
public List<IndItemValueVO> queryValue(String itemNo, Date startTime, Date endTime) { |
|
63 |
List<IndItemValueVO> result = new ArrayList<IndItemValueVO>(); |
|
64 |
IndItemEntity indItem = indItemService.getInfoByNo(itemNo); |
|
65 |
if (indItem == null) { |
|
66 |
return result; |
|
67 |
} |
|
68 |
ItemTypeEnum itemType = ItemTypeEnum.getEumByCode(indItem.getItemType()); |
|
69 |
switch (itemType) { |
|
70 |
case ATOM: |
|
71 |
result = atomItemHandler.queryValue(indItem.getId()); |
|
72 |
break; |
|
73 |
case DER: |
|
74 |
result = derItemHandler.queryValue(itemNo, startTime, endTime); |
|
75 |
break; |
|
76 |
case CAL: |
|
77 |
result = calItemHandler.queryValue(itemNo, startTime, endTime); |
|
78 |
break; |
|
79 |
default: |
|
80 |
break; |
|
81 |
} |
|
82 |
return result; |
|
83 |
} |
|
84 |
} |