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

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

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