|
|
@@ -1,8 +1,6 @@
|
|
|
package com.its.op.global;
|
|
|
|
|
|
-import com.its.op.dao.repository.its.vms.TbVmsSymbIfscRepository;
|
|
|
import com.its.op.dao.repository.its.vms.TbVmsSymbLibRepository;
|
|
|
-import com.its.op.entity.its.vms.TbVmsSymbIfsc;
|
|
|
import com.its.op.entity.its.vms.TbVmsSymbLib;
|
|
|
import lombok.Getter;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
@@ -10,22 +8,20 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
-import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
|
@Slf4j
|
|
|
@RequiredArgsConstructor
|
|
|
@Getter
|
|
|
@Component
|
|
|
-public class TbVmsSymbLibManager {
|
|
|
+public class TbVmsSymbLibManager extends AbstractTableManager<Integer, TbVmsSymbLib> {
|
|
|
|
|
|
private final TbVmsSymbLibRepository repo;
|
|
|
- private final TbVmsSymbIfscRepository ifscRepo;
|
|
|
+ //private final TbVmsSymbIfscRepository ifscRepo;
|
|
|
|
|
|
- private static final ConcurrentHashMap<Integer, TbVmsSymbLib> dbMap = new ConcurrentHashMap<>();
|
|
|
- private static final ConcurrentHashMap<Integer, Map<Integer, TbVmsSymbIfsc>> ifscMap = new ConcurrentHashMap<>();
|
|
|
+// private static final ConcurrentHashMap<Integer, TbVmsSymbLib> dbMap = new ConcurrentHashMap<>();
|
|
|
+// private static final ConcurrentHashMap<Integer, Map<Integer, TbVmsSymbIfsc>> ifscMap = new ConcurrentHashMap<>();
|
|
|
|
|
|
@PostConstruct
|
|
|
void init() {
|
|
|
@@ -35,43 +31,38 @@ public class TbVmsSymbLibManager {
|
|
|
public void load() {
|
|
|
List<TbVmsSymbLib> objList = this.repo.findAll();
|
|
|
objList.forEach(obj -> {
|
|
|
- dbMap.put(obj.getSymbLibNmbr(), obj);
|
|
|
+ put(obj.getSymbLibNmbr(), obj);
|
|
|
});
|
|
|
+//
|
|
|
+// List<TbVmsSymbIfsc> ifscList = this.ifscRepo.findAll();
|
|
|
+// ifscList.forEach(obj -> {
|
|
|
+// Map<Integer, TbVmsSymbIfsc> ifscMap = TbVmsSymbLibManager.ifscMap.get(obj.getSymbLibNmbr());
|
|
|
+// if (ifscMap == null) {
|
|
|
+// ifscMap = new HashMap<>();
|
|
|
+// TbVmsSymbLibManager.ifscMap.put(obj.getSymbLibNmbr(), ifscMap);
|
|
|
+// }
|
|
|
+// ifscMap.put(obj.getCellId(), obj);
|
|
|
+// });
|
|
|
+ }
|
|
|
|
|
|
- List<TbVmsSymbIfsc> ifscList = this.ifscRepo.findAll();
|
|
|
- ifscList.forEach(obj -> {
|
|
|
- Map<Integer, TbVmsSymbIfsc> ifscMap = TbVmsSymbLibManager.ifscMap.get(obj.getSymbLibNmbr());
|
|
|
- if (ifscMap == null) {
|
|
|
- ifscMap = new HashMap<>();
|
|
|
- TbVmsSymbLibManager.ifscMap.put(obj.getSymbLibNmbr(), ifscMap);
|
|
|
- }
|
|
|
- ifscMap.put(obj.getCellId(), obj);
|
|
|
+ @Override
|
|
|
+ public List<TbVmsSymbLib> reload() {
|
|
|
+ ConcurrentHashMap<Integer, TbVmsSymbLib> tempMap = new ConcurrentHashMap<>();
|
|
|
+ List<TbVmsSymbLib> objList = this.repo.findAll();
|
|
|
+ objList.forEach(obj -> {
|
|
|
+ tempMap.put(obj.getSymbLibNmbr(), obj);
|
|
|
});
|
|
|
+ return updateMap(tempMap);
|
|
|
}
|
|
|
|
|
|
- public static TbVmsSymbLib get(Integer id) {
|
|
|
- if (id == null) {
|
|
|
- return null;
|
|
|
+ public void refresh(List<TbVmsSymbLib> objList) {
|
|
|
+ if (objList == null) {
|
|
|
+ return;
|
|
|
}
|
|
|
- return dbMap.get(id);
|
|
|
+ ConcurrentHashMap<Integer, TbVmsSymbLib> tempMap = new ConcurrentHashMap<>();
|
|
|
+ objList.forEach(obj -> {
|
|
|
+ tempMap.put(obj.getSymbLibNmbr(), obj);
|
|
|
+ });
|
|
|
+ updateMap(tempMap);
|
|
|
}
|
|
|
-//
|
|
|
-// public static TbVmsSymbIfsc getIfsc(Integer id) {
|
|
|
-// if (id == null) {
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-// Map<Integer, TbVmsSymbIfsc> ifscMap = ifsc.get(id);
|
|
|
-// if (ifscMap != null) {
|
|
|
-// return ifscMap.get(1);
|
|
|
-// }
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-//
|
|
|
-// public static Map<Integer, TbVmsSymbIfsc> getIfscMap(Integer id) {
|
|
|
-// if (id == null) {
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-// return ifsc.get(id);
|
|
|
-// }
|
|
|
-
|
|
|
}
|