点位导入

main
HUOJIN\92525 2024-08-05 10:17:48 +08:00
parent 9a83966d1d
commit 1d5f822612
5 changed files with 15 additions and 35 deletions

View File

@ -98,18 +98,6 @@ public class Point extends BaseEntity implements Serializable {
@ApiModelProperty(value = "热度")
private Double heat;
@Column(name = "`rows`")
@ApiModelProperty(value = "层")
private int rows = 0;
@Column(name = "`col`")
@ApiModelProperty(value = "列")
private int col = 0;
@Column(name = "`line`")
@ApiModelProperty(value = "排")
private int line = 0;
@Column(name = "`item_height`")
@ApiModelProperty(value = "高度")
private Double itemHeight=0d;

View File

@ -32,6 +32,6 @@ public interface AreaRepository extends JpaRepository<Area, Long>, JpaSpecificat
@Query(" from Area a where a.code = :code and a.enabled = true ")
Area findByCode(String code);
@Query(" from Area a where a.code in :areaCodes and a.enabled = true ")
@Query(" from Area a where (a.code in :areaCodes or a.name in :areaCodes ) and a.enabled = true ")
List<Area> findByCodes(Set areaCodes);
}

View File

@ -100,15 +100,15 @@ public class PointController {
List<Map<String, Object>> readAll = reader.readAll();
try {
Set<String> pointCodes = new HashSet<>();//点位集合
Set<String> areaCodes = new HashSet<>();//库区集合
Set<String> areaNames = new HashSet<>();//库区集合
for (Map<String, Object> record : readAll) {
String pointCode = record.get("编码").toString().trim();
String areaCode = record.get("库区").toString().trim();
String areaName = record.get("库区").toString().trim();
if (!StringUtils.isEmpty(pointCode)) {
pointCodes.add(pointCode);
}
if (!StringUtils.isEmpty(areaCode)) {
areaCodes.add(areaCode);
if (!StringUtils.isEmpty(areaName)) {
areaNames.add(areaName);
}
}
@ -117,17 +117,18 @@ public class PointController {
Map<String, Point> existingPoint = pointService.findByCodes(pointCodes);
//查找数据库中存在的库区
List<Area> areaList = areaService.findByCodes(areaCodes);
Set<String> newAreaCodes = areaList.stream().map(Area::getCode).collect(Collectors.toSet());
List<Area> areaList = areaService.findByCodes(areaNames);
Set<String> newAreaNames = areaList.stream().map(Area::getName).collect(Collectors.toSet());
// 取areaCodes和newAreaCodes的差集说明有不存在的库区
Set<String> diffItemCodes = areaCodes.stream().filter(code -> !newAreaCodes.contains(code)).collect(Collectors.toSet());
Set<String> diffAreaNames = areaNames.stream().filter(name -> !newAreaNames.contains(name)).collect(Collectors.toSet());
if (!diffItemCodes.isEmpty()) {
throw new IllegalArgumentException("WMS不存在的库区集合,请维护:" + diffItemCodes);
if (!diffAreaNames.isEmpty()) {
throw new IllegalArgumentException("WMS不存在的库区集合,请维护:" + diffAreaNames);
}
Map<String, Area> existingArea = areaList.stream().collect(Collectors.toMap(Area::getCode, Area -> Area));
Map<String, Area> existingArea = areaList.stream().collect(Collectors.toMap(Area::getName, Area -> Area));
List<Point> pointsToCreate = new ArrayList<>();//新增点位集合
List<Point> pointsToUpdate = new ArrayList<>();//修改点位集合

View File

@ -58,13 +58,13 @@ public class PointDto implements Serializable {
/** 仓库ID */
private DeptSmallDto dept;
/** 坐标X */
/** */
private Double posX;
/** 坐标Y */
/** */
private Double posY;
/** 坐标Z */
/** */
private Double posZ;
/** 类型 */
@ -72,12 +72,6 @@ public class PointDto implements Serializable {
/** 热度 */
private Double heat;
/** 列 */
private int col;
/** 排 */
private int line;
/** 层 */
private int rows;
/** 高度 */
private Double itemHeight=0d;

View File

@ -108,9 +108,6 @@ public class PointServiceImpl implements PointService {
map.put("坐标X", point.getPosX());
map.put("坐标Y", point.getPosY());
map.put("坐标Z", point.getPosZ());
map.put("层", point.getRows());
map.put("列", point.getCol());
map.put("排", point.getLine());
map.put("类型", point.getType());
map.put("热度", point.getHeat());
map.put("创建人", point.getCreateBy());