fix: 修复点位管理

This commit is contained in:
2023-05-17 10:36:49 +08:00
parent 4a948353a1
commit 9795450e50
2 changed files with 36 additions and 17 deletions

View File

@@ -17,6 +17,7 @@ import org.nl.wms.sch.point.service.dao.mapper.SchBasePointMapper;
import org.nl.wms.sch.point.service.dao.SchBasePoint;
import org.nl.wms.sch.region.service.dao.SchBaseRegion;
import org.nl.wms.sch.region.service.dao.mapper.SchBaseRegionMapper;
import org.nl.wms.utils.PointUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -66,25 +67,15 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
String pointStatus = point.getPoint_status(); // 点位状态
String pointType = point.getPoint_type(); // 点位类型
SchBaseRegion regionObj = regionMapper.selectById(point.getRegion_code());
if (ObjectUtil.isNotEmpty(pointStatus)) {
JSONObject statusArr = new JSONObject();
String[] split = regionObj.getPoint_status_explain().split("");
for ( int j = 0; j < split.length; j++) {
String[] status = split[j].split("-");
statusArr.put(status[0], status[1]);
if (ObjectUtil.isNotEmpty(regionObj)) {
if (ObjectUtil.isNotEmpty(pointStatus) && ObjectUtil.isNotEmpty(regionObj.getPoint_status_explain())) {
// 设置
point.setPoint_status_name(PointUtil.getStatusOrTypeName(regionObj.getPoint_status_explain(), pointStatus));
}
// 设置
point.setPoint_status_name(statusArr.getString(pointStatus));
}
if (ObjectUtil.isNotEmpty(pointType)) {
JSONObject typeArr = new JSONObject();
String[] split = regionObj.getPoint_type_explain().split("");
for ( int j = 0; j < split.length; j++) {
String[] types = split[j].split("-");
typeArr.put(types[0], types[1]);
if (ObjectUtil.isNotEmpty(pointType) && ObjectUtil.isNotEmpty(regionObj.getPoint_type_explain())) {
// 设置
point.setPoint_type_name(PointUtil.getStatusOrTypeName(regionObj.getPoint_type_explain(), pointType));
}
// 设置
point.setPoint_type_name(typeArr.getString(pointType));
}
});
return pages;

View File

@@ -0,0 +1,28 @@
package org.nl.wms.utils;
import com.alibaba.fastjson.JSONObject;
/**
* @Author: lyd
* @Description: 点位工具类
* @Date: 2023/5/17
*/
public class PointUtil {
/**
* 获取状态名或者类型名
* @param explain
* @param label
* @return
*/
public static String getStatusOrTypeName(String explain, String label) {
JSONObject statusArr = new JSONObject();
String[] split = explain.split("");
for ( int j = 0; j < split.length; j++) {
String[] status = split[j].split("-");
statusArr.put(status[0], status[1]);
}
// 设置
return statusArr.getString(label);
}
}