Browse Source

opt: 物料图片展示优化

master
yanps 2 months ago
parent
commit
b9a2701c04
  1. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/ISchBaseVehiclematerialgroupService.java
  2. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.java
  3. 5
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.xml
  4. 6
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java
  5. 25
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AutoQueryFilePath.java
  6. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/core/TaskStatus.java

2
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<SchBaseVeh
/** /**
* 查询物料路径是空的 * 查询物料路径是空的
*/ */
List<SchBaseVehiclematerialgroup> selectMaterialPathIsEmpty(); List<String> selectMaterialPathIsEmpty();
/** /**
* 查询物料图片路径 * 查询物料图片路径

2
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<SchBaseVeh
List<Map> selectMaterialByVehicleCode(String vehicle_code); List<Map> selectMaterialByVehicleCode(String vehicle_code);
IPage<SchBaseVehiclematerialgroup> selectAllByPage(IPage<SchBaseVehiclematerialgroup> page, @Param("query") SchBaseVehiclematerialgroupQuery query); IPage<SchBaseVehiclematerialgroup> selectAllByPage(IPage<SchBaseVehiclematerialgroup> page, @Param("query") SchBaseVehiclematerialgroupQuery query);
List<String> selectMaterialPathByIsEmpty();
} }

5
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.xml

@ -106,4 +106,9 @@
FROM RankedVehicles FROM RankedVehicles
WHERE rn = 1 WHERE rn = 1
</select> </select>
<select id="selectMaterialPathByIsEmpty" resultType="java.lang.String">
SELECT DISTINCT sbv.material_id
FROM sch_base_vehiclematerialgroup sbv
WHERE sbv.material_path is null
</select>
</mapper> </mapper>

6
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<SchBaseV
} }
@Override @Override
public List<SchBaseVehiclematerialgroup> selectMaterialPathIsEmpty() { public List<String> selectMaterialPathIsEmpty() {
return this.list(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) List<String> materials = vehiclematerialgroupMapper.selectMaterialPathByIsEmpty();
.isNull(SchBaseVehiclematerialgroup::getMaterial_path)); return materials;
} }

25
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; package org.nl.wms.sch.task_manage;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.SneakyThrows; import lombok.SneakyThrows;
@ -36,18 +38,16 @@ public class AutoQueryFilePath {
@SneakyThrows @SneakyThrows
public void run() { public void run() {
List<SchBaseVehiclematerialgroup> schBaseVehiclematerialgroups = iSchBaseVehiclematerialgroupService.selectMaterialPathIsEmpty(); List<String> materials = iSchBaseVehiclematerialgroupService.selectMaterialPathIsEmpty();
if(StrUtil.isEmpty(materialUrl)){ if(StrUtil.isEmpty(materialUrl)) {
Param byCode = sysParamService.findByCode(GeneralDefinition.MATERIAL_URL); Param byCode = sysParamService.findByCode(GeneralDefinition.MATERIAL_URL);
materialUrl = byCode.getValue(); materialUrl = byCode.getValue();
directory = new File(materialUrl); directory = new File(materialUrl);
} }
if (StrUtil.isNotEmpty(materialUrl)) { if (ObjectUtil.isNotEmpty(directory) && CollUtil.isNotEmpty(materials)) {
schBaseVehiclematerialgroups.stream().forEach(schBaseVehiclematerialgroup -> { if (directory.exists() && directory.isDirectory()) {
if (directory.exists() && directory.isDirectory()) { selectMaterialPath(directory, materials);
selectMaterialPath(directory, schBaseVehiclematerialgroup); }
}
});
} }
} }
@ -55,19 +55,20 @@ public class AutoQueryFilePath {
/** /**
* 查找物料图片路径 * 查找物料图片路径
*/ */
public void selectMaterialPath(File directory,SchBaseVehiclematerialgroup schBaseVehiclematerialgroup) { public void selectMaterialPath(File directory,List<String> materials) {
File[] files = directory.listFiles(); File[] files = directory.listFiles();
if (files != null) { if (files != null) {
for (File file : files) { for (File file : files) {
if (file.isDirectory()) { if (file.isDirectory()) {
selectMaterialPath(file,schBaseVehiclematerialgroup); selectMaterialPath(file,materials);
} else if (file.isFile() && file.getName().substring(0, file.getName().lastIndexOf('.')).equals(schBaseVehiclematerialgroup.getMaterial_id())) { } 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(); File parentFile = file.getParentFile();
if(parentFile != null) { if(parentFile != null) {
String name = parentFile.getName(); String name = parentFile.getName();
if (StrUtil.isNotEmpty(name)) { if (StrUtil.isNotEmpty(name)) {
iSchBaseVehiclematerialgroupService.update(Wrappers.lambdaUpdate(SchBaseVehiclematerialgroup.class) 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")); .set(SchBaseVehiclematerialgroup::getMaterial_path, parentFile.getPath() + "\\" + name + "_large.png"));
break; break;
} }

2
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; package org.nl.wms.sch.task_manage.task.core;
public enum TaskStatus { public enum TaskStatus {
TIMEOUT("0", "暂停", "暂停"),
APPLY("1", "申请", "申请"), APPLY("1", "申请", "申请"),
CREATED("2", "创建完成", "创建完成"), CREATED("2", "创建完成", "创建完成"),
ISSUED("3", "下发", "下发"), ISSUED("3", "下发", "下发"),
@ -8,7 +9,6 @@ public enum TaskStatus {
FINISHED("5", "完成", "完成"), FINISHED("5", "完成", "完成"),
CANCELED("6", "已取消", "已取消"), CANCELED("6", "已取消", "已取消"),
UNFINISHED("7", "未完成", "未完成"), UNFINISHED("7", "未完成", "未完成"),
TIMEOUT("8", "暂停", "暂停"),
; ;

Loading…
Cancel
Save