提交 | 用户 | 时间
|
7fd198
|
1 |
package com.iailab.module.model.mdk.factory; |
潘 |
2 |
|
a4891a
|
3 |
import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; |
7fd198
|
4 |
import com.iailab.module.model.mcs.pre.entity.MmItemTypeEntity; |
潘 |
5 |
import com.iailab.module.model.mcs.pre.service.MmItemOutputService; |
|
6 |
import com.iailab.module.model.mcs.pre.service.MmItemTypeService; |
|
7 |
import com.iailab.module.model.mcs.pre.service.MmPredictItemService; |
|
8 |
import com.iailab.module.model.mdk.vo.ItemVO; |
|
9 |
import com.iailab.module.model.mdk.vo.MergeItemVO; |
|
10 |
import org.springframework.beans.factory.annotation.Autowired; |
|
11 |
import org.springframework.stereotype.Component; |
|
12 |
|
|
13 |
import java.util.HashMap; |
|
14 |
import java.util.List; |
|
15 |
import java.util.Map; |
|
16 |
|
|
17 |
/** |
|
18 |
* 创建预测项对象的工厂 |
|
19 |
*/ |
|
20 |
@Component |
|
21 |
public class ItemEntityFactory { |
|
22 |
private HashMap<String, ItemVO> ItemVOHashMap = new HashMap<>(); |
|
23 |
private Map<String, MmItemTypeEntity> itemTypeMap = new HashMap<>(); |
|
24 |
private Map<String, MergeItemVO> mergeItemMap = new HashMap<>(); |
|
25 |
private Map<String, ItemVO> itemNoEntityMap = new HashMap<>(); |
a4891a
|
26 |
private Map<String, List<MmItemOutputEntity>> itemOutPutItemMap = new HashMap<>(); |
7fd198
|
27 |
|
潘 |
28 |
@Autowired |
|
29 |
private MmPredictItemService mmPredictItemService; |
|
30 |
|
|
31 |
@Autowired |
|
32 |
private MmItemOutputService mmItemOutputService; |
|
33 |
|
|
34 |
@Autowired |
|
35 |
private MmItemTypeService mmItemTypeService; |
|
36 |
|
|
37 |
/** |
|
38 |
* 1.根据ITEMID,获取模型对应的MERGEITEM实体 |
|
39 |
* |
|
40 |
* @param itemId |
|
41 |
* @return |
|
42 |
*/ |
|
43 |
public MergeItemVO getMergeItem(String itemId) { |
|
44 |
MergeItemVO mergeItemVO = mmPredictItemService.getMergeItemByItemId(itemId); |
|
45 |
if (!mergeItemMap.containsKey(itemId)) { |
|
46 |
if (mergeItemVO != null) { |
|
47 |
mergeItemMap.put(itemId, mergeItemVO); |
|
48 |
} else { |
|
49 |
return null; |
|
50 |
} |
|
51 |
} |
|
52 |
return mergeItemVO; |
|
53 |
} |
|
54 |
|
|
55 |
/** |
|
56 |
* 2.根据ITEMNO,获取模型对应的ITEM实体 |
|
57 |
* |
|
58 |
* @param itemNo |
|
59 |
* @return |
|
60 |
*/ |
|
61 |
public ItemVO getItemByItemNo(String itemNo) { |
|
62 |
ItemVO ItemVO = mmPredictItemService.getItemByItemNo(itemNo); |
|
63 |
if (!itemNoEntityMap.containsKey(itemNo)) { |
|
64 |
if (ItemVO != null) { |
|
65 |
itemNoEntityMap.put(itemNo, ItemVO); |
|
66 |
} else { |
|
67 |
return null; |
|
68 |
} |
|
69 |
} |
|
70 |
return ItemVO; |
|
71 |
} |
|
72 |
|
|
73 |
/** |
|
74 |
* 3.根据ITEMID,获取模型对应的ITEM实体 |
|
75 |
* |
|
76 |
* @param itemId |
|
77 |
* @return |
|
78 |
*/ |
|
79 |
public ItemVO getItemById(String itemId) { |
|
80 |
ItemVO ItemVO = mmPredictItemService.getItemById(itemId); |
|
81 |
if (!ItemVOHashMap.containsKey(itemId)) { |
|
82 |
if (ItemVO != null) { |
|
83 |
ItemVOHashMap.put(itemId, ItemVO); |
|
84 |
} else { |
|
85 |
return null; |
|
86 |
} |
|
87 |
} |
|
88 |
return ItemVO; |
|
89 |
} |
|
90 |
|
|
91 |
/** |
|
92 |
* 4. 根据ITEMID,获取模型对应的ITEMOUTPUT实体 |
|
93 |
* |
|
94 |
* @param itemId |
|
95 |
* @return |
|
96 |
*/ |
a4891a
|
97 |
public List<com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity> getOutPutByItemId(String itemId) { |
潘 |
98 |
List<com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity> list = mmItemOutputService.getByItemid(itemId); |
7fd198
|
99 |
if (!itemOutPutItemMap.containsKey(itemId)) { |
潘 |
100 |
if (list != null) { |
|
101 |
itemOutPutItemMap.put(itemId, list); |
|
102 |
} else { |
|
103 |
return null; |
|
104 |
} |
|
105 |
} |
|
106 |
return list; |
|
107 |
} |
|
108 |
|
|
109 |
} |