| | |
| | | throw new CoolException("楼层不能为空"); |
| | | } |
| | | Date now = updateTime == null ? new Date() : updateTime; |
| | | BasMap basMap = this.getOne(new QueryWrapper<BasMap>().select("id", "data").eq("lev", lev)); |
| | | boolean existingMap = basMap != null; |
| | | BasMap basMap = this.getOne(new QueryWrapper<BasMap>().select("id").eq("lev", lev)); |
| | | if (basMap == null) { |
| | | basMap = insertLightMap(lev, now); |
| | | } |
| | | |
| | | if (existingMap) { |
| | | updateLastDataOnly(basMap.getId(), basMap.getData()); |
| | | } |
| | | updateDataOnly(basMap.getId(), data, now); |
| | | updateOriginDataOnly(basMap.getId(), originData); |
| | | } |
| | |
| | | throw new CoolException("地图基础信息保存失败"); |
| | | } |
| | | return insertMap; |
| | | } |
| | | |
| | | private void updateLastDataOnly(Integer id, String lastData) { |
| | | UpdateWrapper<BasMap> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.eq("id", id) |
| | | .set("last_data", lastData); |
| | | if (!this.update(updateWrapper)) { |
| | | throw new CoolException("地图历史数据保存失败"); |
| | | } |
| | | } |
| | | |
| | | private void updateDataOnly(Integer id, String data, Date updateTime) { |