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);
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
WHERE rn = 1
</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>

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
public List<SchBaseVehiclematerialgroup> selectMaterialPathIsEmpty() {
return this.list(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
.isNull(SchBaseVehiclematerialgroup::getMaterial_path));
public List<String> selectMaterialPathIsEmpty() {
List<String> materials = vehiclematerialgroupMapper.selectMaterialPathByIsEmpty();
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;
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<SchBaseVehiclematerialgroup> schBaseVehiclematerialgroups = iSchBaseVehiclematerialgroupService.selectMaterialPathIsEmpty();
if(StrUtil.isEmpty(materialUrl)){
List<String> 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<String> 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;
}

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;
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", "暂停", "暂停"),
;

Loading…
Cancel
Save