| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.serializer.SerializerFeature; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.core.common.DateUtils; |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.entity.BasMap; |
| | |
| | | @RequestMapping(value = "/basMap/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") String id) { |
| | | return R.ok(basMapService.selectById(String.valueOf(id))); |
| | | return R.ok(basMapService.getById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basMap/list/auth") |
| | |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam(required = false)String condition, |
| | | @RequestParam Map<String, Object> param){ |
| | | EntityWrapper<BasMap> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<BasMap> wrapper = new QueryWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | allLike(BasMap.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | wrapper.orderBy("lev"); |
| | | return R.ok(basMapService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(true, "asc".equals(orderByType), humpToLine(orderByField));} |
| | | wrapper.orderBy(true, true, "lev"); |
| | | return R.ok(basMapService.page(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | private <T> void convert(Map<String, Object> map, QueryWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | |
| | | @RequestMapping(value = "/basMap/add/auth") |
| | | @ManagerAuth |
| | | public R add(BasMap basMap) { |
| | | basMapService.insert(basMap); |
| | | basMapService.save(basMap); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Integer[] ids){ |
| | | for (Integer id : ids){ |
| | | basMapService.deleteById(id); |
| | | basMapService.removeById(id); |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | @RequestMapping(value = "/basMap/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | EntityWrapper<BasMap> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<BasMap> wrapper = new QueryWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("basMap")); |
| | | convert(map, wrapper); |
| | | List<BasMap> list = basMapService.selectList(wrapper); |
| | | List<BasMap> list = basMapService.list(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basMapQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<BasMap> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<BasMap> wrapper = new QueryWrapper<>(); |
| | | wrapper.like("id", condition); |
| | | Page<BasMap> page = basMapService.selectPage(new Page<>(0, 10), wrapper); |
| | | Page<BasMap> page = basMapService.page(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (BasMap basMap : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | @RequestMapping(value = "/basMap/check/column/auth") |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<BasMap> wrapper = new EntityWrapper<BasMap>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != basMapService.selectOne(wrapper)){ |
| | | QueryWrapper<BasMap> wrapper = new QueryWrapper<BasMap>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != basMapService.getOne(wrapper)){ |
| | | return R.parse(BaseRes.REPEAT).add(getComment(BasMap.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | @GetMapping("/basMap/lev/{lev}/auth") |
| | | @ManagerAuth |
| | | public R getByLev(@PathVariable("lev") Integer lev) { |
| | | BasMap basMap = basMapService.selectOne(new EntityWrapper<BasMap>().eq("lev", lev)); |
| | | BasMap basMap = basMapService.getOne(new QueryWrapper<BasMap>().eq("lev", lev)); |
| | | if (basMap == null){ |
| | | return R.error("地图不存在"); |
| | | } |
| | |
| | | HashMap<Integer, List<StationObjModel>> outStationMap = new HashMap<>(); |
| | | HashMap<Integer, List<StationObjModel>> runBlockReassignStationMap = new HashMap<>(); |
| | | HashMap<Integer, List<StationObjModel>> isOutOrderStationMap = new HashMap<>(); |
| | | HashMap<Integer, List<StationObjModel>> isLiftTransferStationMap = new HashMap<>(); |
| | | |
| | | for (Map.Entry<Integer, List<List<HashMap<String, Object>>>> entry : dataMap.entrySet()) { |
| | | Integer lev = entry.getKey(); |
| | |
| | | isOutOrderStationList.add(stationObjModel); |
| | | isOutOrderStationMap.put(deviceNo, isOutOrderStationList); |
| | | } |
| | | |
| | | Integer isLiftTransfer = value.getInteger("isLiftTransfer"); |
| | | if (isLiftTransfer != null && isLiftTransfer == 1) { |
| | | List<StationObjModel> isLiftTransferStationList = isLiftTransferStationMap.getOrDefault(deviceNo, new ArrayList<>()); |
| | | isLiftTransferStationList.add(stationObjModel); |
| | | isLiftTransferStationMap.put(deviceNo, isLiftTransferStationList); |
| | | } |
| | | } else if (nodeType.equals("rgv")) { |
| | | //RGV |
| | | nodeData.put("type", "rgv"); |
| | |
| | | dataList.add(arrayList); |
| | | } |
| | | |
| | | BasMap basMap = basMapService.selectOne(new EntityWrapper<BasMap>().eq("lev", lev)); |
| | | BasMap basMap = basMapService.getOne(new QueryWrapper<BasMap>().eq("lev", lev)); |
| | | if (basMap == null) { |
| | | basMap = new BasMap(); |
| | | } |
| | |
| | | basMap.setCreateTime(new Date()); |
| | | basMap.setUpdateTime(new Date()); |
| | | basMap.setLev(lev); |
| | | basMapService.insertOrUpdate(basMap); |
| | | basMapService.saveOrUpdate(basMap); |
| | | } |
| | | |
| | | basStationService.delete(new EntityWrapper<>()); |
| | | basStationService.remove(new QueryWrapper<>()); |
| | | |
| | | deviceStationMap.forEach((deviceNo, stationList) -> { |
| | | BasDevp basDevp = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("devp_no", deviceNo)); |
| | | BasDevp basDevp = basDevpService.getOne(new QueryWrapper<BasDevp>().eq("devp_no", deviceNo)); |
| | | if (basDevp == null) { |
| | | basDevp = new BasDevp(); |
| | | basDevp.setDevpNo(deviceNo); |
| | |
| | | List<StationObjModel> outStationList = outStationMap.get(deviceNo); |
| | | List<StationObjModel> runBlockReassignStationList = runBlockReassignStationMap.get(deviceNo); |
| | | List<StationObjModel> isOutOrderStationList = isOutOrderStationMap.get(deviceNo); |
| | | List<StationObjModel> isLiftTransferStationList = isLiftTransferStationMap.get(deviceNo); |
| | | |
| | | if (barcodeStationList != null) { |
| | | basDevp.setBarcodeStationList(JSON.toJSONString(barcodeStationList, SerializerFeature.DisableCircularReferenceDetect)); |
| | |
| | | basDevp.setIsOutOrderList(JSON.toJSONString(isOutOrderStationList, SerializerFeature.DisableCircularReferenceDetect)); |
| | | } |
| | | |
| | | if (isLiftTransferStationList != null) { |
| | | basDevp.setIsLiftTransferList(JSON.toJSONString(isLiftTransferStationList, SerializerFeature.DisableCircularReferenceDetect)); |
| | | } |
| | | |
| | | basDevp.setStationList(JSON.toJSONString(stationList, SerializerFeature.DisableCircularReferenceDetect)); |
| | | basDevp.setUpdateTime(new Date()); |
| | | basDevpService.insertOrUpdate(basDevp); |
| | | basDevpService.saveOrUpdate(basDevp); |
| | | |
| | | DeviceConfig deviceConfig = deviceConfigService.selectOne(new EntityWrapper<DeviceConfig>().eq("device_no", deviceNo).eq("device_type", String.valueOf(SlaveType.Devp))); |
| | | DeviceConfig deviceConfig = deviceConfigService.getOne(new QueryWrapper<DeviceConfig>().eq("device_no", deviceNo).eq("device_type", String.valueOf(SlaveType.Devp))); |
| | | if (deviceConfig != null) { |
| | | deviceConfig.setFakeInitStatus(JSON.toJSONString(stationList)); |
| | | deviceConfigService.updateById(deviceConfig); |
| | |
| | | basStation.setStationLev(stationObjModel.getStationLev()); |
| | | basStation.setCreateTime(new Date()); |
| | | basStation.setStatus(1); |
| | | basStationService.insert(basStation); |
| | | basStationService.save(basStation); |
| | | } |
| | | }); |
| | | } catch (Exception e) { |