mirror of
https://gitee.com/freshday/radar.git
synced 2026-03-22 04:37:16 +08:00
opts: code refactor.
feihu wang
This commit is contained in:
@@ -13,5 +13,5 @@ public class CryptUtilTest {
|
||||
String str = CryptUtils.sha("123456", "admin").toUpperCase();
|
||||
System.out.println(str);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -224,55 +224,42 @@ public class DataListsServiceImpl implements DataListsService, SubscribeHandle {
|
||||
public void init() {
|
||||
cacheService.subscribeDataList(this);
|
||||
new Thread(() ->{
|
||||
|
||||
List<ModelVO> modelList = modelService.listModel(null);
|
||||
// 加载系统数据名单列表
|
||||
Map<String, Object> sysDataListMap = new HashMap<>();
|
||||
Map<String, Object> sysDataListMap = new HashMap<>(32);
|
||||
List<DataListsVO> sysList = dataListDal.listDataLists(0L, null);
|
||||
for (DataListsVO dataListVO : sysList) {
|
||||
Map<String, String> dataListRecords = new HashMap<String, String>();
|
||||
// record list
|
||||
List<DataListRecordVO> recordVOList = dataListDal.listDataRecord(dataListVO.getId());
|
||||
if (recordVOList != null) {
|
||||
for (DataListRecordVO record : recordVOList) {
|
||||
dataListRecords.put(record.getDataRecord(), "");
|
||||
}
|
||||
}
|
||||
sysDataListMap.put(dataListVO.getName(), dataListRecords);
|
||||
}
|
||||
|
||||
|
||||
buildList2Map(sysDataListMap, sysList);
|
||||
for (ModelVO model : modelList) {
|
||||
Map<String, Object> dataListMap = new HashMap<>();
|
||||
Map<String, Object> dataListMap = new HashMap<>(32);
|
||||
// datalist list
|
||||
List<DataListsVO> dataLists = dataListDal.listDataLists(model.getId(), null);
|
||||
if (dataLists != null) {
|
||||
for (DataListsVO dataListVO : dataLists) {
|
||||
Map<String, String> dataListRecords = new HashMap<>();
|
||||
// record list
|
||||
List<DataListRecordVO> recordVOList = dataListDal.listDataRecord(dataListVO.getId());
|
||||
if (recordVOList != null) {
|
||||
for (DataListRecordVO record : recordVOList) {
|
||||
dataListRecords.put(record.getDataRecord(), "");
|
||||
}
|
||||
}
|
||||
dataListMap.put(dataListVO.getName(), dataListRecords);
|
||||
|
||||
}
|
||||
buildList2Map(dataListMap, dataLists);
|
||||
}
|
||||
|
||||
|
||||
// add sys data list
|
||||
dataListMap.putAll(sysDataListMap);
|
||||
dataListRecordCacheMap.put(model.getId(), dataListMap);
|
||||
}
|
||||
|
||||
logger.info("data list has loaded.");
|
||||
|
||||
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void buildList2Map(Map<String, Object> dataListMap, List<DataListsVO> dataLists) {
|
||||
for (DataListsVO dataListVO : dataLists) {
|
||||
Map<String, String> dataListRecords = new HashMap<>();
|
||||
// record list
|
||||
List<DataListRecordVO> recordVOList = dataListDal.listDataRecord(dataListVO.getId());
|
||||
if (recordVOList != null) {
|
||||
for (DataListRecordVO record : recordVOList) {
|
||||
dataListRecords.put(record.getDataRecord(), "");
|
||||
}
|
||||
}
|
||||
dataListMap.put(dataListVO.getName(), dataListRecords);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getDataListMap(Long modelId) {
|
||||
Map<String, Object> listMap = dataListRecordCacheMap.get(modelId);
|
||||
|
||||
Reference in New Issue
Block a user