提交 fde15867 authored 作者: zhoushaopan's avatar zhoushaopan

feat(装备模块): 去除定时更新缓存的接口

去除定时更新缓存的接口
上级 6173549f
...@@ -258,7 +258,9 @@ public class DeviceLibraryController { ...@@ -258,7 +258,9 @@ public class DeviceLibraryController {
//形态 //形态
// Boolean hasTypeDim = deviceLibrarySelectVo.getTypeDim()!=null; // Boolean hasTypeDim = deviceLibrarySelectVo.getTypeDim()!=null;
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ); SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
List<DeviceLibrary> resultList = deviceLibraryService.getCoreDevicePage(deviceLibrarySelectVo).stream().filter(deviceLibrary-> !deviceLibrary.getLifeStatus().equals(DeviceLifeStatus.DESTROYED.id)).collect(Collectors.toList()); List<DeviceLibrary> resultList = deviceLibraryService.getCoreDevicePage(deviceLibrarySelectVo).stream().filter(
deviceLibrary-> !deviceLibrary.getLifeStatus().equals(DeviceLifeStatus.DESTROYED.id))
.collect(Collectors.toList());
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("resultList",resultList); map.put("resultList",resultList);
if (hasModelDim||hasLifeStatusDim||hasLocationUnitDim||hasNameDim||hasOwnUnitDim||hasSeqDim) { if (hasModelDim||hasLifeStatusDim||hasLocationUnitDim||hasNameDim||hasOwnUnitDim||hasSeqDim) {
...@@ -457,14 +459,11 @@ public class DeviceLibraryController { ...@@ -457,14 +459,11 @@ public class DeviceLibraryController {
Boolean hasTypeDim = deviceLibrarySelectVo.getTypeDim() != null; Boolean hasTypeDim = deviceLibrarySelectVo.getTypeDim() != null;
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
List<DeviceLibrary> resultList = deviceLibraryService.getList(deviceLibrarySelectVo);
map.put("resultList",resultList);
// List<DeviceLibrary> resultList = new ArrayList<>();
// resultList = deviceLibraryService.getAlldevList(deviceLibrarySelectVo);
// List<DeviceLibrary> resultList = deviceLibraryService.getList(deviceLibrarySelectVo); // List<DeviceLibrary> resultList = deviceLibraryService.getList(deviceLibrarySelectVo);
// map.put("resultList",resultList);
resultList.forEach(DeviceLibrary::setConfigName); List<DeviceLibrary> resultList = new ArrayList<>();
resultList = deviceLibraryService.getAlldevList(deviceLibrarySelectVo);
resultList.forEach(DeviceLibrary::setConfigNameForCache);
if (hasModelDim||hasLifeStatusDim||hasLocationUnitDim||hasNameDim||hasOwnUnitDim||hasSeqDim) { if (hasModelDim||hasLifeStatusDim||hasLocationUnitDim||hasNameDim||hasOwnUnitDim||hasSeqDim) {
resultList = resultList.stream().filter(deviceLibrary -> { resultList = resultList.stream().filter(deviceLibrary -> {
Boolean containModelDim = !hasModelDim||deviceLibrary.getModel().contains(deviceLibrarySelectVo.getModelDim()); Boolean containModelDim = !hasModelDim||deviceLibrary.getModel().contains(deviceLibrarySelectVo.getModelDim());
......
...@@ -488,7 +488,7 @@ public interface DeviceLibraryService { ...@@ -488,7 +488,7 @@ public interface DeviceLibraryService {
/** /**
* 获取所有装备的集合 * 获取所有装备的集合
* @param deviceLibrarySelectVo 查询装备的vo * @param deviceLibrarySelectVo 查询装备的vo
* @return 所有装备 * @return 所有装备 做缓存
*/ */
List<DeviceLibrary> getAlldevList(DeviceLibrarySelectVo deviceLibrarySelectVo); List<DeviceLibrary> getAlldevList(DeviceLibrarySelectVo deviceLibrarySelectVo);
......
...@@ -1088,9 +1088,6 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -1088,9 +1088,6 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
status.contains(deviceLibrary.getLifeStatus())) status.contains(deviceLibrary.getLifeStatus()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
// DeviceLibraryCacheSelectVo deviceLibraryCacheSelectVo = new DeviceLibraryCacheSelectVo();
// BeanUtils.copyProperties(deviceLibrarySelectVo,deviceLibraryCacheSelectVo);
List<DeviceLibrary> list = null; List<DeviceLibrary> list = null;
try { try {
long l = System.currentTimeMillis(); long l = System.currentTimeMillis();
......
...@@ -336,6 +336,21 @@ public class DeviceLibrary implements Serializable { ...@@ -336,6 +336,21 @@ public class DeviceLibrary implements Serializable {
return this; return this;
} }
public DeviceLibrary setConfigNameForCache(){
ConfigCache configCache = SpringUtils.getBean("initConfigCache");
if (configCache != null) {
setSecretLevelName(configCache.getSecretLevelMap().get(this.secretLevel)==null?"-":configCache.getSecretLevelMap().get(this.secretLevel));
setLifeStatusName(configCache.getLifeStatusMap().get(this.lifeStatus)==null?"-":configCache.getLifeStatusMap().get(this.lifeStatus));
setMatchingRangeName(configCache.getMatchingRangeMap().get(this.matchingRange)==null?"-":configCache.getMatchingRangeMap().get(this.matchingRange));
setInvisibleRangeName(configCache.getInvisibleRangeMap().get(this.invisibleRange)==null?"-":configCache.getInvisibleRangeMap().get(this.invisibleRange));
setTypeName(configCache.getStyleMap().get(this.type)==null?"-":configCache.getStyleMap().get(this.type));
setStorageTypeName(configCache.getStorageTypeMap().get(this.storageType)==null?"-":configCache.getStorageTypeMap().get(this.storageType));
setAllotTypeName(configCache.getAllotTypeMap().get(this.allotType)==null?"-":configCache.getAllotTypeMap().get(this.allotType));
childs.clear();
}
return this;
}
// public LifeStatusVo getLifeStatusVo(){ // public LifeStatusVo getLifeStatusVo(){
// return new LifeStatusVo(this.lifeStatus,this.lifeStatusName); // return new LifeStatusVo(this.lifeStatus,this.lifeStatusName);
// } // }
......
package com.tykj.dev.device.library.task; //package com.tykj.dev.device.library.task;
//
import com.tykj.dev.device.library.service.DeviceLibraryCacheService; //import com.tykj.dev.device.library.service.DeviceLibraryCacheService;
import lombok.extern.slf4j.Slf4j; //import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled; //import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; //import org.springframework.stereotype.Service;
//
/** ///**
* @author zjm // * @author zjm
* @version 1.0.0 // * @version 1.0.0
* @ClassName TrainTask.java // * @ClassName TrainTask.java
* @Description 培训定时任务 主要是 判断报名截止以及培训开始、培训结束 // * @Description 培训定时任务 主要是 判断报名截止以及培训开始、培训结束
* @createTime 2020年08月17日 23:20:00 // * @createTime 2020年08月17日 23:20:00
*/ // */
@Service //@Service
@Slf4j //@Slf4j
public class DevideTask { //public class DevideTask {
@Autowired // @Autowired
DeviceLibraryCacheService deviceLibraryCacheService; // DeviceLibraryCacheService deviceLibraryCacheService;
//
@Scheduled(cron = "30 * * * * ? ") // @Scheduled(cron = "30 * * * * ? ")
private void signUpDeadline() { // private void signUpDeadline() {
log.info("定时device更新缓存开始"); // log.info("定时device更新缓存开始");
deviceLibraryCacheService.deletAllDeviceLibraryList(); // deviceLibraryCacheService.deletAllDeviceLibraryList();
deviceLibraryCacheService.getAllDeviceLibraryList(); // deviceLibraryCacheService.getAllDeviceLibraryList();
log.info("定时device更新缓存结束"); // log.info("定时device更新缓存结束");
} // }
} //}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论