From 1fa4310f3a865b557569584702a047631b0967e4 Mon Sep 17 00:00:00 2001 From: Junjie <xjj@123> Date: 星期二, 26 三月 2024 14:00:25 +0800 Subject: [PATCH] # --- zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/service/MapService.java | 33 +++++++++++---------------------- 1 files changed, 11 insertions(+), 22 deletions(-) diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/service/MapService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/service/MapService.java index 0ec2113..0da5f5a 100644 --- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/service/MapService.java +++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/service/MapService.java @@ -14,6 +14,7 @@ import org.springframework.stereotype.Service; import java.util.Date; +import java.util.Optional; /** * Created by vincent on 3/15/2024 @@ -26,26 +27,19 @@ @Autowired private DictService dictService; - public MapDataParam getMapData(MapQueryParam param, Long userId) { + public String getMapFloorList(Long userId) { + String floorKey = "map-floor-list"; + Dict dict = dictService.getOne(new LambdaQueryWrapper<Dict>().eq(Dict::getFlag, floorKey)); + return Optional.ofNullable(dict).map(Dict::getValue).orElse(null); + } + public String getMapData(MapQueryParam param, Long userId) { String mapKey = getMapKey(param.getFloor()); Dict dict = dictService.getOne(new LambdaQueryWrapper<Dict>().eq(Dict::getFlag, mapKey)); - if (Cools.isEmpty(dict)) { - return null; - } else { - return JSON.parseObject(dict.getValue(), MapDataParam.class) ; - } - - -// User user = userService.getById(userId); -// if (Cools.isEmpty(user.getMemo())) { -// return new MapDataParam(); -// } -// return JSON.parseObject(user.getMemo(), MapDataParam.class); + return Optional.ofNullable(dict).map(Dict::getValue).orElse(null); } public void saveMapData(MapDataParam param, Long userId) { - String mapKey = getMapKey(param.getFloor()); Dict dict = dictService.getOne(new LambdaQueryWrapper<Dict>().eq(Dict::getFlag, mapKey)); if (Cools.isEmpty(dict)) { @@ -54,25 +48,20 @@ dict.setFlag(mapKey); dict.setType(DictType.JSON.flag); dict.setValue(JSON.toJSONString(param.getItemList())); + dict.setCreateBy(userId); + dict.setUpdateBy(userId); if (!dictService.save(dict)) { throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇�"); } } else { dict.setValue(JSON.toJSONString(param.getItemList())); dict.setUpdateTime(new Date()); + dict.setUpdateBy(userId); if (!dictService.updateById(dict)) { throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇�"); } } - -// -// User user = userService.getById(userId); -// user.setMemo(JSON.toJSONString(param)); -// if (!userService.updateById(user)) { -// throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇�"); -// } } - private String getMapKey(Integer floor) { if (null != floor) { -- Gitblit v1.9.1