提交 | 用户 | 时间
|
a6de49
|
1 |
package com.iailab.module.data.ind.collection; |
H |
2 |
|
|
3 |
import com.iailab.module.data.ind.collection.handler.AtomItemHandle; |
|
4 |
import com.iailab.module.data.ind.service.IndItemService; |
|
5 |
import com.iailab.module.data.ind.collection.handler.AtomItemHandle; |
|
6 |
import com.iailab.module.data.ind.service.IndItemService; |
|
7 |
import com.iailab.module.data.ind.collection.handler.AtomItemHandle; |
|
8 |
import com.iailab.module.data.ind.collection.handler.CalItemHandle; |
|
9 |
import com.iailab.module.data.ind.dto.IndItemDTO; |
|
10 |
import com.iailab.module.data.ind.dto.IndItemValueDTO; |
|
11 |
import com.iailab.module.data.ind.service.IndItemService; |
|
12 |
import com.iailab.module.data.ind.collection.handler.AtomItemHandle; |
|
13 |
import com.iailab.module.data.ind.service.IndItemService; |
|
14 |
import lombok.extern.slf4j.Slf4j; |
|
15 |
import javax.annotation.Resource; |
|
16 |
import org.springframework.stereotype.Component; |
|
17 |
import org.springframework.util.CollectionUtils; |
|
18 |
|
|
19 |
import java.util.HashMap; |
|
20 |
import java.util.List; |
|
21 |
import java.util.Map; |
|
22 |
|
|
23 |
/** |
|
24 |
* @author PanZhibao |
|
25 |
* @Description |
|
26 |
* @createTime 2024年05月25日 |
|
27 |
*/ |
|
28 |
@Slf4j |
|
29 |
@Component |
|
30 |
public class IndItemCollector { |
|
31 |
|
|
32 |
@Resource |
|
33 |
private IndItemService indItemService; |
|
34 |
|
|
35 |
@Resource |
|
36 |
private AtomItemHandle atomItemHandle; |
|
37 |
|
|
38 |
@Resource |
|
39 |
private CalItemHandle calItemHandle; |
|
40 |
|
|
41 |
|
|
42 |
public Map<String, List<IndItemValueDTO>> getValueList(List<String> itemNos) { |
|
43 |
Map<String, List<IndItemValueDTO>> result = new HashMap<>(); |
|
44 |
if (CollectionUtils.isEmpty(itemNos)) { |
|
45 |
return result; |
|
46 |
} |
|
47 |
try { |
|
48 |
List<IndItemDTO> atomList = indItemService.getItemAtom(itemNos); |
|
49 |
atomList.forEach(item -> { |
|
50 |
result.put(item.getItemNo(), atomItemHandle.getItemSourceValue(item.getItemNo())); |
|
51 |
}); |
|
52 |
|
|
53 |
List<IndItemDTO> calList = indItemService.getItemCal(itemNos); |
|
54 |
calList.forEach(item -> { |
|
55 |
result.put(item.getItemNo(), calItemHandle.getItemCalValue(item.getItemNo())); |
|
56 |
}); |
|
57 |
|
|
58 |
} catch (Exception ex) { |
|
59 |
ex.printStackTrace(); |
|
60 |
} |
|
61 |
return result; |
|
62 |
} |
|
63 |
|
|
64 |
public Map<String, List<IndItemValueDTO>> getValueListRange(List<String> itemNos, String start, String end) { |
|
65 |
Map<String, List<IndItemValueDTO>> result = new HashMap<>(); |
|
66 |
if (CollectionUtils.isEmpty(itemNos)) { |
|
67 |
return result; |
|
68 |
} |
|
69 |
try { |
|
70 |
List<IndItemDTO> atomList = indItemService.getItemAtom(itemNos); |
|
71 |
atomList.forEach(item -> { |
|
72 |
result.put(item.getItemNo(), atomItemHandle.getItemSourceValue(item.getItemNo(), start, end)); |
|
73 |
}); |
|
74 |
|
|
75 |
List<IndItemDTO> calList = indItemService.getItemCal(itemNos); |
|
76 |
calList.forEach(item -> { |
|
77 |
result.put(item.getItemNo(), calItemHandle.getItemCalValue(item.getItemNo(), start, end)); |
|
78 |
}); |
|
79 |
|
|
80 |
} catch (Exception ex) { |
|
81 |
ex.printStackTrace(); |
|
82 |
} |
|
83 |
return result; |
|
84 |
} |
|
85 |
} |