From b9a2701c047181f266dcb4bd75cc4a214462acc4 Mon Sep 17 00:00:00 2001 From: yanps Date: Tue, 26 Nov 2024 17:43:36 +0800 Subject: [PATCH] =?UTF-8?q?opt:=20=E7=89=A9=E6=96=99=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ISchBaseVehiclematerialgroupService.java | 2 +- .../SchBaseVehiclematerialgroupMapper.java | 2 ++ .../SchBaseVehiclematerialgroupMapper.xml | 5 ++++ ...chBaseVehiclematerialgroupServiceImpl.java | 6 ++--- .../sch/task_manage/AutoQueryFilePath.java | 25 ++++++++++--------- .../sch/task_manage/task/core/TaskStatus.java | 2 +- 6 files changed, 25 insertions(+), 17 deletions(-) diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/ISchBaseVehiclematerialgroupService.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/ISchBaseVehiclematerialgroupService.java index 82e131e..d998eae 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/ISchBaseVehiclematerialgroupService.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/ISchBaseVehiclematerialgroupService.java @@ -98,7 +98,7 @@ public interface ISchBaseVehiclematerialgroupService extends IService selectMaterialPathIsEmpty(); + List selectMaterialPathIsEmpty(); /** * 查询物料图片路径 diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.java index 7ca7cb8..2ec8d0f 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.java @@ -27,4 +27,6 @@ public interface SchBaseVehiclematerialgroupMapper extends BaseMapper selectMaterialByVehicleCode(String vehicle_code); IPage selectAllByPage(IPage page, @Param("query") SchBaseVehiclematerialgroupQuery query); + + List selectMaterialPathByIsEmpty(); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.xml b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.xml index 614f62e..04cad17 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.xml +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.xml @@ -106,4 +106,9 @@ FROM RankedVehicles WHERE rn = 1 + diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java index 8e8f08d..22c4bf4 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java @@ -225,9 +225,9 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl selectMaterialPathIsEmpty() { - return this.list(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) - .isNull(SchBaseVehiclematerialgroup::getMaterial_path)); + public List selectMaterialPathIsEmpty() { + List materials = vehiclematerialgroupMapper.selectMaterialPathByIsEmpty(); + return materials; } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AutoQueryFilePath.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AutoQueryFilePath.java index f0ee663..b59de42 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AutoQueryFilePath.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AutoQueryFilePath.java @@ -1,6 +1,8 @@ package org.nl.wms.sch.task_manage; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import lombok.SneakyThrows; @@ -36,18 +38,16 @@ public class AutoQueryFilePath { @SneakyThrows public void run() { - List schBaseVehiclematerialgroups = iSchBaseVehiclematerialgroupService.selectMaterialPathIsEmpty(); - if(StrUtil.isEmpty(materialUrl)){ + List materials = iSchBaseVehiclematerialgroupService.selectMaterialPathIsEmpty(); + if(StrUtil.isEmpty(materialUrl)) { Param byCode = sysParamService.findByCode(GeneralDefinition.MATERIAL_URL); materialUrl = byCode.getValue(); directory = new File(materialUrl); } - if (StrUtil.isNotEmpty(materialUrl)) { - schBaseVehiclematerialgroups.stream().forEach(schBaseVehiclematerialgroup -> { - if (directory.exists() && directory.isDirectory()) { - selectMaterialPath(directory, schBaseVehiclematerialgroup); - } - }); + if (ObjectUtil.isNotEmpty(directory) && CollUtil.isNotEmpty(materials)) { + if (directory.exists() && directory.isDirectory()) { + selectMaterialPath(directory, materials); + } } } @@ -55,19 +55,20 @@ public class AutoQueryFilePath { /** * 查找物料图片路径 */ - public void selectMaterialPath(File directory,SchBaseVehiclematerialgroup schBaseVehiclematerialgroup) { + public void selectMaterialPath(File directory,List materials) { File[] files = directory.listFiles(); if (files != null) { for (File file : files) { if (file.isDirectory()) { - selectMaterialPath(file,schBaseVehiclematerialgroup); - } else if (file.isFile() && file.getName().substring(0, file.getName().lastIndexOf('.')).equals(schBaseVehiclematerialgroup.getMaterial_id())) { + selectMaterialPath(file,materials); + } else if (file.isFile() && CollUtil.contains(materials, file.getName().substring(0, file.getName().lastIndexOf('.')))) { + String material = file.getName().substring(0, file.getName().lastIndexOf('.')); File parentFile = file.getParentFile(); if(parentFile != null) { String name = parentFile.getName(); if (StrUtil.isNotEmpty(name)) { iSchBaseVehiclematerialgroupService.update(Wrappers.lambdaUpdate(SchBaseVehiclematerialgroup.class) - .eq(SchBaseVehiclematerialgroup::getGroup_id, schBaseVehiclematerialgroup.getGroup_id()) + .eq(SchBaseVehiclematerialgroup::getMaterial_id, material) .set(SchBaseVehiclematerialgroup::getMaterial_path, parentFile.getPath() + "\\" + name + "_large.png")); break; } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/core/TaskStatus.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/core/TaskStatus.java index ef866c8..3772e46 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/core/TaskStatus.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/core/TaskStatus.java @@ -1,6 +1,7 @@ package org.nl.wms.sch.task_manage.task.core; public enum TaskStatus { + TIMEOUT("0", "暂停", "暂停"), APPLY("1", "申请", "申请"), CREATED("2", "创建完成", "创建完成"), ISSUED("3", "下发", "下发"), @@ -8,7 +9,6 @@ public enum TaskStatus { FINISHED("5", "完成", "完成"), CANCELED("6", "已取消", "已取消"), UNFINISHED("7", "未完成", "未完成"), - TIMEOUT("8", "暂停", "暂停"), ;