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

feat(系统配置): 新增了库房存放位置

新增了一个map去存放库房
上级 b859b659
...@@ -7,8 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; ...@@ -7,8 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
* @author huangxiahao * @author huangxiahao
*/ */
@SpringBootApplication(scanBasePackages = { @SpringBootApplication(scanBasePackages = {
"com.tykj.dev.config", "com.tykj.dev.*"
"com.tykj.dev.misc"
} }
) )
public class ConfigApplication { public class ConfigApplication {
......
...@@ -30,6 +30,9 @@ public class ConfigCache { ...@@ -30,6 +30,9 @@ public class ConfigCache {
private Map<Integer, String> positionMap; private Map<Integer, String> positionMap;
private Map<Integer, String> storageLocationMap;
public ConfigCache(List<SystemConfig> systemConfigs){ public ConfigCache(List<SystemConfig> systemConfigs){
this.lifeStatusMap = systemConfigs.stream().filter(systemConfig -> "lifeStatus".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel)); this.lifeStatusMap = systemConfigs.stream().filter(systemConfig -> "lifeStatus".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.matchingRangeMap = systemConfigs.stream().filter(systemConfig -> "matchingRange".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel)); this.matchingRangeMap = systemConfigs.stream().filter(systemConfig -> "matchingRange".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
...@@ -41,6 +44,8 @@ public class ConfigCache { ...@@ -41,6 +44,8 @@ public class ConfigCache {
this.natureMap = systemConfigs.stream().filter(systemConfig -> "nature".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel)); this.natureMap = systemConfigs.stream().filter(systemConfig -> "nature".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.positionMap = systemConfigs.stream().filter(systemConfig -> "position".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel)); this.positionMap = systemConfigs.stream().filter(systemConfig -> "position".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.allotTypeMap = systemConfigs.stream().filter(systemConfig -> "allotType".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel)); this.allotTypeMap = systemConfigs.stream().filter(systemConfig -> "allotType".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.storageLocationMap = systemConfigs.stream().filter(systemConfig -> "storageLocation".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
} }
public Map<Integer, String> getMatchingRangeMap() { public Map<Integer, String> getMatchingRangeMap() {
...@@ -83,6 +88,11 @@ public class ConfigCache { ...@@ -83,6 +88,11 @@ public class ConfigCache {
return allotTypeMap; return allotTypeMap;
} }
public Map<Integer, String> getStorageLocationMap() {
return storageLocationMap;
}
public ConfigCache refresh(List<SystemConfig> systemConfigs){ public ConfigCache refresh(List<SystemConfig> systemConfigs){
this.lifeStatusMap = systemConfigs.stream().filter(systemConfig -> "lifeStatus".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel)); this.lifeStatusMap = systemConfigs.stream().filter(systemConfig -> "lifeStatus".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.matchingRangeMap = systemConfigs.stream().filter(systemConfig -> "matchingRange".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel)); this.matchingRangeMap = systemConfigs.stream().filter(systemConfig -> "matchingRange".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
...@@ -94,6 +104,7 @@ public class ConfigCache { ...@@ -94,6 +104,7 @@ public class ConfigCache {
this.natureMap = systemConfigs.stream().filter(systemConfig -> "nature".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel)); this.natureMap = systemConfigs.stream().filter(systemConfig -> "nature".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.positionMap = systemConfigs.stream().filter(systemConfig -> "position".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel)); this.positionMap = systemConfigs.stream().filter(systemConfig -> "position".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.allotTypeMap = systemConfigs.stream().filter(systemConfig -> "allotType".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel)); this.allotTypeMap = systemConfigs.stream().filter(systemConfig -> "allotType".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.storageLocationMap = systemConfigs.stream().filter(systemConfig -> "storageLocation".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
return this; return this;
} }
} }
...@@ -2,6 +2,8 @@ package com.tykj.dev.config.service; ...@@ -2,6 +2,8 @@ package com.tykj.dev.config.service;
import com.tykj.dev.config.domin.SystemConfig; import com.tykj.dev.config.domin.SystemConfig;
import java.util.Map;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -16,4 +18,6 @@ public interface SystemConfigService { ...@@ -16,4 +18,6 @@ public interface SystemConfigService {
Integer getMaxValue(String englishName); Integer getMaxValue(String englishName);
SystemConfig getOne(Integer id); SystemConfig getOne(Integer id);
Map<Integer, String> getStorageLocationMap();
} }
...@@ -9,6 +9,7 @@ import org.springframework.stereotype.Service; ...@@ -9,6 +9,7 @@ import org.springframework.stereotype.Service;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map;
@Service @Service
public class SystemConfigServiceImpl implements SystemConfigService { public class SystemConfigServiceImpl implements SystemConfigService {
...@@ -53,4 +54,10 @@ public class SystemConfigServiceImpl implements SystemConfigService { ...@@ -53,4 +54,10 @@ public class SystemConfigServiceImpl implements SystemConfigService {
public SystemConfig getOne(Integer id) { public SystemConfig getOne(Integer id) {
return systemConfigDao.findById(id).get(); return systemConfigDao.findById(id).get();
} }
@Override
public Map<Integer, String> getStorageLocationMap() {
return configCache.getStorageLocationMap();
}
} }
...@@ -815,15 +815,16 @@ public class DeviceLibraryController { ...@@ -815,15 +815,16 @@ public class DeviceLibraryController {
List<DeviceLibrary> byIds = deviceLibraryService.findByIds(deviceSelectIdsVo.getIds()); List<DeviceLibrary> byIds = deviceLibraryService.findByIds(deviceSelectIdsVo.getIds());
byIds.forEach(DeviceLibrary::setConfigName); byIds.forEach(DeviceLibrary::setConfigName);
//key为所属单位
Map<String, List<DeviceLibrary>> map = byIds.stream().collect(Collectors.groupingBy(DeviceLibrary::getOwnUnit)); Map<String, List<DeviceLibrary>> map = byIds.stream().collect(Collectors.groupingBy(DeviceLibrary::getOwnUnit));
List<DeviceNewVo> deviceNewVoList = new ArrayList<>(); List<DeviceNewVo> deviceNewVoList = new ArrayList<>();
map.forEach((k,v)->{ map.forEach((k,v)->{
DeviceNewVo deviceNewVo = new DeviceNewVo(v.get(0).getModel(), v.get(0).getName(), DeviceNewVo deviceNewVo = new DeviceNewVo(v.get(0).getModel(), v.get(0).getName(),
v.get(0).getMatchingRangeName(), v.get(0).getTypeName(), v.get(0).getMatchingRangeName(), v.get(0).getTypeName(),
v.size(),k,DeviceModelSort.toUnitSort(k),v.stream().map(DeviceLibrary::getId).collect(Collectors.toList())); v.size(),k,DeviceModelSort.toUnitSort(k),v.stream().map(DeviceLibrary::getId).collect(Collectors.toList()));
deviceNewVoList.add(deviceNewVo); deviceNewVoList.add(deviceNewVo);
}); });
//实现按照组织架构排序
deviceNewVoList.sort(Comparator.comparing(DeviceNewVo::getLevel)); deviceNewVoList.sort(Comparator.comparing(DeviceNewVo::getLevel));
return deviceNewVoList; return deviceNewVoList;
} }
...@@ -833,7 +834,6 @@ public class DeviceLibraryController { ...@@ -833,7 +834,6 @@ public class DeviceLibraryController {
*/ */
@GetMapping("/setNumber") @GetMapping("/setNumber")
public List<DeviceLibrary> setNumber(){ public List<DeviceLibrary> setNumber(){
List<DeviceLibrary> allListAndParent = getAllListAndParent(); List<DeviceLibrary> allListAndParent = getAllListAndParent();
AtomicInteger sortNum = new AtomicInteger(); AtomicInteger sortNum = new AtomicInteger();
return setOrderNumber(sortNum, allListAndParent); return setOrderNumber(sortNum, allListAndParent);
......
...@@ -791,5 +791,9 @@ public class StorageBillController { ...@@ -791,5 +791,9 @@ public class StorageBillController {
/** /**
* 根据任务id 查询单据 * 根据任务id 查询单据
*/ */
// public Map<> @ApiOperation("根据任务id获取单据集合")
@GetMapping("/getFileList")
public ResponseEntity getFiles(Integer taskId){
return ResponseEntity.ok(storageBillService.getFileList(taskId));
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论