fix: 修复点位管理
This commit is contained in:
@@ -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.point.service.dao.SchBasePoint;
|
||||||
import org.nl.wms.sch.region.service.dao.SchBaseRegion;
|
import org.nl.wms.sch.region.service.dao.SchBaseRegion;
|
||||||
import org.nl.wms.sch.region.service.dao.mapper.SchBaseRegionMapper;
|
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.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -66,25 +67,15 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
|||||||
String pointStatus = point.getPoint_status(); // 点位状态
|
String pointStatus = point.getPoint_status(); // 点位状态
|
||||||
String pointType = point.getPoint_type(); // 点位类型
|
String pointType = point.getPoint_type(); // 点位类型
|
||||||
SchBaseRegion regionObj = regionMapper.selectById(point.getRegion_code());
|
SchBaseRegion regionObj = regionMapper.selectById(point.getRegion_code());
|
||||||
if (ObjectUtil.isNotEmpty(pointStatus)) {
|
if (ObjectUtil.isNotEmpty(regionObj)) {
|
||||||
JSONObject statusArr = new JSONObject();
|
if (ObjectUtil.isNotEmpty(pointStatus) && ObjectUtil.isNotEmpty(regionObj.getPoint_status_explain())) {
|
||||||
String[] split = regionObj.getPoint_status_explain().split(",");
|
// 设置
|
||||||
for ( int j = 0; j < split.length; j++) {
|
point.setPoint_status_name(PointUtil.getStatusOrTypeName(regionObj.getPoint_status_explain(), pointStatus));
|
||||||
String[] status = split[j].split("-");
|
|
||||||
statusArr.put(status[0], status[1]);
|
|
||||||
}
|
}
|
||||||
// 设置
|
if (ObjectUtil.isNotEmpty(pointType) && ObjectUtil.isNotEmpty(regionObj.getPoint_type_explain())) {
|
||||||
point.setPoint_status_name(statusArr.getString(pointStatus));
|
// 设置
|
||||||
}
|
point.setPoint_type_name(PointUtil.getStatusOrTypeName(regionObj.getPoint_type_explain(), pointType));
|
||||||
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]);
|
|
||||||
}
|
}
|
||||||
// 设置
|
|
||||||
point.setPoint_type_name(typeArr.getString(pointType));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return pages;
|
return pages;
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user