提交 c13c58d5 authored 作者: 邓砥奕's avatar 邓砥奕

更新

上级 920d18a9
package com.tykj.dev.device.allot.controller; package com.tykj.dev.device.allot.controller;
import com.tykj.dev.config.cache.ConfigCache;
import com.tykj.dev.config.swagger.AutoDocument; import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.allot.service.AllotBackBillService; import com.tykj.dev.device.allot.service.AllotBackBillService;
import com.tykj.dev.device.allot.service.AllotBillService; import com.tykj.dev.device.allot.service.AllotBillService;
...@@ -105,6 +106,9 @@ public class AllotBillController { ...@@ -105,6 +106,9 @@ public class AllotBillController {
@Autowired @Autowired
private UserPublicService userService; private UserPublicService userService;
@Autowired
private ConfigCache configCache;
@ApiOperation(value = "导入二维码获取配发装备", notes = "可以通过这个接口导入二维码获取配发装备") @ApiOperation(value = "导入二维码获取配发装备", notes = "可以通过这个接口导入二维码获取配发装备")
@PostMapping(value = "/load") @PostMapping(value = "/load")
public ResponseEntity loadDevice(@RequestBody RfidVo rfidVo) { public ResponseEntity loadDevice(@RequestBody RfidVo rfidVo) {
...@@ -197,10 +201,20 @@ public class AllotBillController { ...@@ -197,10 +201,20 @@ public class AllotBillController {
//改变装备状态 //改变装备状态
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id); DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
if (allotBillSaveVo.getAllotType() == 2){ if (allotBillSaveVo.getAllotType() == 2){
if (deviceLibraryEntity.getAllotType()!=2){
deviceLibraryEntity.setAllotType(2);
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "将配发类型由" + deviceLibraryEntity.getAllotTypeName() + "改为"+configCache.getAllotTypeMap().get(2), fileVoList);
deviceLogService.addLog(deviceLogDto);
}
deviceLibraryEntity.setLifeStatus(3); deviceLibraryEntity.setLifeStatus(3);
deviceLibraryEntity.setManageStatus(0); deviceLibraryEntity.setManageStatus(0);
} }
else { else {
if (deviceLibraryEntity.getAllotType()!=1){
deviceLibraryEntity.setAllotType(1);
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "将配发类型由" + deviceLibraryEntity.getAllotTypeName() + "改为"+configCache.getAllotTypeMap().get(1), fileVoList);
deviceLogService.addLog(deviceLogDto);
}
deviceLibraryEntity.setLocationUnit(allotBillSaveVo.getReceiveUnit()); deviceLibraryEntity.setLocationUnit(allotBillSaveVo.getReceiveUnit());
deviceLibraryEntity.setOwnUnit(allotBillSaveVo.getReceiveUnit()); deviceLibraryEntity.setOwnUnit(allotBillSaveVo.getReceiveUnit());
} }
......
...@@ -81,6 +81,7 @@ public class AllotBillSelectController { ...@@ -81,6 +81,7 @@ public class AllotBillSelectController {
} }
allotBillEntity.setSendFileList(FilesUtil.stringFileToList(allotBillEntity.getSendFiles())); allotBillEntity.setSendFileList(FilesUtil.stringFileToList(allotBillEntity.getSendFiles()));
allotBillEntity.setReplyFileList(FilesUtil.stringFileToList(allotBillEntity.getReplyFiles())); allotBillEntity.setReplyFileList(FilesUtil.stringFileToList(allotBillEntity.getReplyFiles()));
allotBillEntity.setApplyFileList(FilesUtil.stringFileToList(allotBillEntity.getApplyFiles()));
if (allotBillEntity.getScriptJson()!=null){ if (allotBillEntity.getScriptJson()!=null){
allotBillEntity.setScripts(JacksonUtil.readValue(allotBillEntity.getScriptJson(),new TypeReference<List<ScriptSaveVo>>() {})); allotBillEntity.setScripts(JacksonUtil.readValue(allotBillEntity.getScriptJson(),new TypeReference<List<ScriptSaveVo>>() {}));
} }
...@@ -113,6 +114,7 @@ public class AllotBillSelectController { ...@@ -113,6 +114,7 @@ public class AllotBillSelectController {
} }
allotBillEntity.setSendFileList(FilesUtil.stringFileToList(allotBillEntity.getSendFiles())); allotBillEntity.setSendFileList(FilesUtil.stringFileToList(allotBillEntity.getSendFiles()));
allotBillEntity.setReplyFileList(FilesUtil.stringFileToList(allotBillEntity.getReplyFiles())); allotBillEntity.setReplyFileList(FilesUtil.stringFileToList(allotBillEntity.getReplyFiles()));
allotBillEntity.setApplyFileList(FilesUtil.stringFileToList(allotBillEntity.getApplyFiles()));
if (allotBillEntity.getScriptJson()!=null){ if (allotBillEntity.getScriptJson()!=null){
allotBillEntity.setScripts(JacksonUtil.readValue(allotBillEntity.getScriptJson(),new TypeReference<List<ScriptSaveVo>>() {})); allotBillEntity.setScripts(JacksonUtil.readValue(allotBillEntity.getScriptJson(),new TypeReference<List<ScriptSaveVo>>() {}));
} }
......
...@@ -84,7 +84,7 @@ public class AllotBillSaveVo { ...@@ -84,7 +84,7 @@ public class AllotBillSaveVo {
private String agent; private String agent;
@NotNull(message = "allotType不能为空") @NotNull(message = "allotType不能为空")
@ApiModelProperty(value = "入库类型") @ApiModelProperty(value = "配发类型")
private Integer allotType; private Integer allotType;
@ApiModelProperty(value = "申请文号附件名") @ApiModelProperty(value = "申请文号附件名")
......
package com.tykj.dev.config.base;
import com.tykj.dev.config.domin.SystemConfig;
import lombok.AllArgsConstructor;
/**
* @author dengdiyi
* 配发类型枚举
*/
@AllArgsConstructor
public enum AllotType {
/**
* 横向
*/
HORIZONTAL(1, "省直属横向"),
/**
* 纵向
*/
VERTICAL(2, "省对下纵向");
public Integer id;
public String name;
public SystemConfig toDo(){
SystemConfig systemConfig = new SystemConfig();
systemConfig.setValue(id);
systemConfig.setLabel(name);
systemConfig.setChineseName("配发类型");
systemConfig.setEnglishName("allotType");
return systemConfig;
}
}
...@@ -16,6 +16,8 @@ public class ConfigCache { ...@@ -16,6 +16,8 @@ public class ConfigCache {
private Map<Integer, String> storageTypeMap; private Map<Integer, String> storageTypeMap;
private Map<Integer, String> allotTypeMap;
private Map<Integer, String> applyTypeMap; private Map<Integer, String> applyTypeMap;
private Map<Integer, String> invisibleRangeMap; private Map<Integer, String> invisibleRangeMap;
...@@ -38,6 +40,7 @@ public class ConfigCache { ...@@ -38,6 +40,7 @@ public class ConfigCache {
this.styleMap = systemConfigs.stream().filter(systemConfig -> "style".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel)); this.styleMap = systemConfigs.stream().filter(systemConfig -> "style".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.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));
} }
public Map<Integer, String> getMatchingRangeMap() { public Map<Integer, String> getMatchingRangeMap() {
...@@ -76,6 +79,10 @@ public class ConfigCache { ...@@ -76,6 +79,10 @@ public class ConfigCache {
return positionMap; return positionMap;
} }
public Map<Integer, String> getAllotTypeMap() {
return allotTypeMap;
}
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));
...@@ -86,6 +93,7 @@ public class ConfigCache { ...@@ -86,6 +93,7 @@ public class ConfigCache {
this.styleMap = systemConfigs.stream().filter(systemConfig -> "style".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel)); this.styleMap = systemConfigs.stream().filter(systemConfig -> "style".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.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));
return this; return this;
} }
} }
...@@ -38,6 +38,9 @@ public class SystemConfigRun implements CommandLineRunner { ...@@ -38,6 +38,9 @@ public class SystemConfigRun implements CommandLineRunner {
for (StorageType d:StorageType.values()) { for (StorageType d:StorageType.values()) {
systemConfigDao.save(d.toDo()); systemConfigDao.save(d.toDo());
} }
for (AllotType d:AllotType.values()) {
systemConfigDao.save(d.toDo());
}
for (DeviceApplyType d:DeviceApplyType.values()) { for (DeviceApplyType d:DeviceApplyType.values()) {
systemConfigDao.save(d.toDo()); systemConfigDao.save(d.toDo());
} }
......
...@@ -306,7 +306,6 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -306,7 +306,6 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
@Override @Override
public List<DeviceLibrary> getList(DeviceLibrarySelectVo deviceLibrarySelectVo) { public List<DeviceLibrary> getList(DeviceLibrarySelectVo deviceLibrarySelectVo) {
List<DeviceLibrary> deviceLibraryEntities = deviceLibraryDao.findAll(getSelectSpecification(deviceLibrarySelectVo));
//返回父子结构 //返回父子结构
// Map<Integer, DeviceLibrary> nodeCollect = // Map<Integer, DeviceLibrary> nodeCollect =
// deviceLibraryEntities.stream().collect(Collectors.toMap(DeviceLibrary::getId, deviceLibraryEntity -> deviceLibraryEntity)); // deviceLibraryEntities.stream().collect(Collectors.toMap(DeviceLibrary::getId, deviceLibraryEntity -> deviceLibraryEntity));
...@@ -316,11 +315,11 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -316,11 +315,11 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
// deviceLibraryEntity -> Optional.ofNullable(nodeCollect.get(deviceLibraryEntity.getPartParentId())), // deviceLibraryEntity -> Optional.ofNullable(nodeCollect.get(deviceLibraryEntity.getPartParentId())),
// DeviceLibrary::addChildNode // DeviceLibrary::addChildNode
// ); // );
return deviceLibraryEntities.stream().sorted(Comparator.comparing(DeviceLibrary::getLifeStatus,Comparator.nullsLast(Integer::compareTo))).collect(Collectors.toList()); return deviceLibraryDao.findAll(getSelectSpecification(deviceLibrarySelectVo),deviceLibrarySelectVo.getPageable().getSort());
} }
public List<DeviceLibrary> getList2(DeviceLibrarySelectVo deviceLibrarySelectVo) { public List<DeviceLibrary> getList2(DeviceLibrarySelectVo deviceLibrarySelectVo) {
List<DeviceLibrary> deviceLibraryEntities = deviceLibraryDao.findAll(getSelectSpecification6(deviceLibrarySelectVo)); List<DeviceLibrary> deviceLibraryEntities = deviceLibraryDao.findAll(getSelectSpecification6(deviceLibrarySelectVo),deviceLibrarySelectVo.getPageable().getSort());
//返回父子结构 //返回父子结构
Map<Integer, DeviceLibrary> nodeCollect = Map<Integer, DeviceLibrary> nodeCollect =
deviceLibraryEntities.stream().collect(Collectors.toMap(DeviceLibrary::getId, deviceLibraryEntity -> deviceLibraryEntity)); deviceLibraryEntities.stream().collect(Collectors.toMap(DeviceLibrary::getId, deviceLibraryEntity -> deviceLibraryEntity));
...@@ -333,7 +332,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -333,7 +332,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
} }
public List<DeviceLibrary> getList3(DeviceLibrarySelectVo deviceLibrarySelectVo, String name) { public List<DeviceLibrary> getList3(DeviceLibrarySelectVo deviceLibrarySelectVo, String name) {
List<DeviceLibrary> deviceLibraryEntities = deviceLibraryDao.findAll(getSelectSpecification2(deviceLibrarySelectVo, name)); List<DeviceLibrary> deviceLibraryEntities = deviceLibraryDao.findAll(getSelectSpecification2(deviceLibrarySelectVo, name),deviceLibrarySelectVo.getPageable().getSort());
//返回父子结构 //返回父子结构
Map<Integer, DeviceLibrary> nodeCollect = Map<Integer, DeviceLibrary> nodeCollect =
deviceLibraryEntities.stream().collect(Collectors.toMap(DeviceLibrary::getId, deviceLibraryEntity -> deviceLibraryEntity)); deviceLibraryEntities.stream().collect(Collectors.toMap(DeviceLibrary::getId, deviceLibraryEntity -> deviceLibraryEntity));
...@@ -481,7 +480,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -481,7 +480,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
@Override @Override
public List<DeviceLibrary> getAllList(DeviceLibrarySelectVo deviceLibrarySelectVo) { public List<DeviceLibrary> getAllList(DeviceLibrarySelectVo deviceLibrarySelectVo) {
return deviceLibraryDao.findAll(getSelectSpecification4(deviceLibrarySelectVo)); return deviceLibraryDao.findAll(getSelectSpecification4(deviceLibrarySelectVo),deviceLibrarySelectVo.getPageable().getSort());
} }
@Override @Override
......
...@@ -127,6 +127,9 @@ public class DeviceLibrary { ...@@ -127,6 +127,9 @@ public class DeviceLibrary {
*/ */
@ApiModelProperty(value = "入库类型,1-横向,2-纵向") @ApiModelProperty(value = "入库类型,1-横向,2-纵向")
private Integer storageType; private Integer storageType;
@ApiModelProperty(value = "配发类型,1-横向,2-纵向")
private Integer allotType;
/** /**
* 管理状态,0-不再所属单位,1-在所属单位 * 管理状态,0-不再所属单位,1-在所属单位
*/ */
...@@ -251,6 +254,10 @@ public class DeviceLibrary { ...@@ -251,6 +254,10 @@ public class DeviceLibrary {
@Transient @Transient
private String storageTypeName; private String storageTypeName;
@ApiModelProperty(value = "配发类型")
@Transient
private String allotTypeName;
public void addChildNode(DeviceLibrary deviceLibraryEntity) { public void addChildNode(DeviceLibrary deviceLibraryEntity) {
childs.add(deviceLibraryEntity); childs.add(deviceLibraryEntity);
} }
...@@ -271,6 +278,7 @@ public class DeviceLibrary { ...@@ -271,6 +278,7 @@ public class DeviceLibrary {
setInvisibleRangeName(configCache.getInvisibleRangeMap().get(this.invisibleRange)==null?"-":configCache.getInvisibleRangeMap().get(this.invisibleRange)); setInvisibleRangeName(configCache.getInvisibleRangeMap().get(this.invisibleRange)==null?"-":configCache.getInvisibleRangeMap().get(this.invisibleRange));
setTypeName(configCache.getStyleMap().get(this.type)==null?"-":configCache.getStyleMap().get(this.type)); setTypeName(configCache.getStyleMap().get(this.type)==null?"-":configCache.getStyleMap().get(this.type));
setStorageTypeName(configCache.getStorageTypeMap().get(this.storageType)==null?"-":configCache.getStorageTypeMap().get(this.storageType)); setStorageTypeName(configCache.getStorageTypeMap().get(this.storageType)==null?"-":configCache.getStorageTypeMap().get(this.storageType));
setAllotTypeName(configCache.getAllotTypeMap().get(this.allotType)==null?"-":configCache.getAllotTypeMap().get(this.allotType));
} }
return this; return this;
} }
......
...@@ -41,6 +41,9 @@ public class DeviceLibrarySaveVo { ...@@ -41,6 +41,9 @@ public class DeviceLibrarySaveVo {
@ApiModelProperty(value = "入库类型,1-横向,2-纵向") @ApiModelProperty(value = "入库类型,1-横向,2-纵向")
private Integer storageType; private Integer storageType;
@ApiModelProperty(value = "配发类型,1-横向,2-纵向")
private Integer allotType;
@NotNull(message = "manageStatus不能为空") @NotNull(message = "manageStatus不能为空")
@ApiModelProperty(value = "管理状态,0-不再所属单位,1-在所属单位") @ApiModelProperty(value = "管理状态,0-不再所属单位,1-在所属单位")
private Integer manageStatus; private Integer manageStatus;
......
...@@ -27,6 +27,8 @@ public class DeviceVo { ...@@ -27,6 +27,8 @@ public class DeviceVo {
private Integer secretLevel; private Integer secretLevel;
private Integer allotType;
/** /**
* 型号 * 型号
*/ */
...@@ -81,5 +83,7 @@ public class DeviceVo { ...@@ -81,5 +83,7 @@ public class DeviceVo {
@ApiModelProperty(value = "入库类型") @ApiModelProperty(value = "入库类型")
private String storageTypeName; private String storageTypeName;
private String allotTypeName;
private List<DeviceLibrary> childs; private List<DeviceLibrary> childs;
} }
...@@ -32,6 +32,10 @@ public class Script { ...@@ -32,6 +32,10 @@ public class Script {
@ApiModelProperty(value = "可见范围") @ApiModelProperty(value = "可见范围")
private String invisibleRange; private String invisibleRange;
private String allotType;
private Integer allotTypeNum;
@ApiModelProperty(value = "数量") @ApiModelProperty(value = "数量")
private Integer num; private Integer num;
......
...@@ -30,6 +30,9 @@ public class ScriptSaveVo { ...@@ -30,6 +30,9 @@ public class ScriptSaveVo {
@ApiModelProperty(value = "可见范围") @ApiModelProperty(value = "可见范围")
private String invisibleRange; private String invisibleRange;
@ApiModelProperty(value = "配发类型")
private String allotType;
@ApiModelProperty(value = "数量") @ApiModelProperty(value = "数量")
private Integer num; private Integer num;
......
...@@ -67,7 +67,7 @@ public class CustomPage { ...@@ -67,7 +67,7 @@ public class CustomPage {
public PageRequest getPageable() { public PageRequest getPageable() {
if (orders.size() != 0) { if (orders.size() != 0) {
List<Sort.Order> orders = new ArrayList<>(); List<Sort.Order> orders = new ArrayList<>();
this.orders.stream().forEach(item -> { this.orders.forEach(item -> {
if ("ASC".equals(item.getDirection())) { if ("ASC".equals(item.getDirection())) {
orders.add(new Sort.Order(Sort.Direction.ASC, item.getCoulmn())); orders.add(new Sort.Order(Sort.Direction.ASC, item.getCoulmn()));
} }
......
...@@ -40,4 +40,13 @@ public class PageUtil { ...@@ -40,4 +40,13 @@ public class PageUtil {
} }
} }
} }
// public static <T> List<Comparator<T>> getSortComparator(List<T> list, List<CustomOrder> customOrders){
// if (customOrders!=null&&customOrders.size()>0){
//
// }
// else {
// return new ArrayList<>();
// }
// }
} }
...@@ -41,6 +41,12 @@ public class PackingLibraryController { ...@@ -41,6 +41,12 @@ public class PackingLibraryController {
@Autowired @Autowired
DeviceLibraryService deviceLibraryService; DeviceLibraryService deviceLibraryService;
@ApiOperation(value = "获取装备单据显示", notes = "获取装备单据显示")
@PostMapping("/getAllotScript")
public ResponseEntity getAllotScript(@RequestBody List<Integer> ids){
return ResponseEntity.ok(packingLibraryService.getDevcieAllotScript(ids));
}
@ApiOperation(value = "获取装备单据显示", notes = "获取装备单据显示") @ApiOperation(value = "获取装备单据显示", notes = "获取装备单据显示")
@PostMapping("/getScript") @PostMapping("/getScript")
public ResponseEntity setRecord(@RequestBody List<Integer> ids){ public ResponseEntity setRecord(@RequestBody List<Integer> ids){
......
...@@ -108,6 +108,8 @@ public interface PackingLibraryService { ...@@ -108,6 +108,8 @@ public interface PackingLibraryService {
List<Script> getDevcieScript(List<Integer> ids); List<Script> getDevcieScript(List<Integer> ids);
List<Script> getDevcieAllotScript(List<Integer> ids);
/** /**
* @param packingId 列装id * @param packingId 列装id
* @param num 配发数量 * @param num 配发数量
......
...@@ -328,6 +328,50 @@ public class PackingLibraryServiceImpl implements PackingLibraryService { ...@@ -328,6 +328,50 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
return scriptList; return scriptList;
} }
@Override
public List<Script> getDevcieAllotScript(List<Integer> ids) {
Map<Integer,DeviceLibrary> deviceLibraryMap = deviceLibraryService.getAllDeviceMap();
List<Script> scripts = new ArrayList<>();
List<DeviceLibrary> deviceLibraries = new ArrayList<>();
ids.forEach(integer -> deviceLibraries.add(deviceLibraryMap.get(integer)));
Map<String, List<DeviceLibrary>> map = deviceLibraries.stream().collect(groupingBy(deviceLibrary -> deviceLibrary.getPackingId()+"Ǵ"+deviceLibrary.getAllotTypeName()));
for (String s:map.keySet()){
String[] strings = s.split("Ǵ");
if (strings.length==2) {
Integer packingId = Integer.valueOf(strings[0]);
String allotType = strings[1];
List<DeviceLibrary> deviceLibraryList = map.get(s);
PackingLibrary packingLibrary = getOne(packingId);
Script script = new Script();
script.setId(packingId);
script.setPartParentId(packingLibrary.getPartParentId());
script.setInvisibleRange(packingLibrary.getInvisibleRangeName());
script.setModel(packingLibrary.getModel());
script.setName(packingLibrary.getName());
script.setSecretLevel(packingLibrary.getSecretLevelName());
script.setType(packingLibrary.getTypeName());
script.setNum(deviceLibraryList.size());
script.setAllotType(allotType);
script.setAllotTypeNum(deviceLibraryList.get(0).getAllotType());
script.setSeqNumber(StringSplitUtil.stringListToString(DeviceSeqUtil.getContinuousSeqs(deviceLibraryList.stream().map(DeviceLibrary::getSeqNumber).collect(Collectors.toList()))));
scripts.add(script);
}
}
Map<Integer, Script> nodeCollect =
scripts.stream().collect(Collectors.toMap(Script::getId, script -> script));
List<Script> scriptList = new ArrayList<>();
List<Script> conList = GetTreeUtils.parseTreeFromDown(
scripts,
Script::getId,
script -> Optional.ofNullable(nodeCollect.get(script.getPartParentId())),
Script::addChildNode
);
for (Script s:conList) {
addScript(scriptList,s);
}
return scriptList;
}
private void addScript(List<Script> scripts,Script script){ private void addScript(List<Script> scripts,Script script){
scripts.add(script); scripts.add(script);
if (script.getChilds()!=null&&script.getChilds().size()>0){ if (script.getChilds()!=null&&script.getChilds().size()>0){
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论