| | |
| | | |
| | | 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; |
| | |
| | | |
| | | HashMap<Integer, List<List<HashMap<String, Object>>>> dataMap = mapExcelUtils.readExcel(filePath); |
| | | HashMap<Integer, List<StationObjModel>> deviceStationMap = new HashMap<>(); |
| | | HashMap<Integer, List<StationObjModel>> barcodeStationMap = new HashMap<>(); |
| | | HashMap<Integer, List<StationObjModel>> inStationMap = new HashMap<>(); |
| | | HashMap<Integer, List<StationObjModel>> outStationMap = new HashMap<>(); |
| | | HashMap<Integer, List<StationObjModel>> runBlockReassignStationMap = new HashMap<>(); |
| | | |
| | | for (Map.Entry<Integer, List<List<HashMap<String, Object>>>> entry : dataMap.entrySet()) { |
| | | Integer lev = entry.getKey(); |
| | |
| | | List<StationObjModel> stationList = deviceStationMap.getOrDefault(deviceNo, new ArrayList<>()); |
| | | stationList.add(stationObjModel); |
| | | deviceStationMap.put(deviceNo, stationList); |
| | | |
| | | Integer isBarcodeStation = value.getInteger("isBarcodeStation"); |
| | | if (isBarcodeStation != null && isBarcodeStation == 1) { |
| | | List<StationObjModel> barcodeStationList = barcodeStationMap.getOrDefault(deviceNo, new ArrayList<>()); |
| | | barcodeStationList.add(stationObjModel); |
| | | barcodeStationMap.put(deviceNo, barcodeStationList); |
| | | } |
| | | |
| | | Integer isInStation = value.getInteger("isInStation"); |
| | | if (isInStation != null && isInStation == 1) { |
| | | StationObjModel inStationModel = new StationObjModel(); |
| | | StationObjModel barcodeStation = new StationObjModel(); |
| | | inStationModel.setDeviceNo(deviceNo); |
| | | inStationModel.setStationId(value.getInteger("stationId")); |
| | | inStationModel.setBarcodeStation(barcodeStation); |
| | | |
| | | barcodeStation.setDeviceNo(value.getInteger("barcodeStationDeviceNo")); |
| | | barcodeStation.setStationId(value.getInteger("barcodeStation")); |
| | | |
| | | List<StationObjModel> inStationList = inStationMap.getOrDefault(deviceNo, new ArrayList<>()); |
| | | inStationList.add(inStationModel); |
| | | inStationMap.put(deviceNo, inStationList); |
| | | } |
| | | |
| | | Integer isOutStation = value.getInteger("isOutStation"); |
| | | if (isOutStation != null && isOutStation == 1) { |
| | | List<StationObjModel> outStationList = outStationMap.getOrDefault(deviceNo, new ArrayList<>()); |
| | | outStationList.add(stationObjModel); |
| | | outStationMap.put(deviceNo, outStationList); |
| | | } |
| | | |
| | | Integer runBlockReassign = value.getInteger("runBlockReassign"); |
| | | if (runBlockReassign != null && runBlockReassign == 1) { |
| | | List<StationObjModel> runBlockReassignStationList = runBlockReassignStationMap.getOrDefault(deviceNo, new ArrayList<>()); |
| | | runBlockReassignStationList.add(stationObjModel); |
| | | runBlockReassignStationMap.put(deviceNo, runBlockReassignStationList); |
| | | } |
| | | }else if (nodeType.equals("RGB(0,176,240)")) { |
| | | //RGV |
| | | nodeData.put("type", "rgv"); |
| | |
| | | basDevp.setCreateTime(new Date()); |
| | | basDevp.setStatus(1); |
| | | } |
| | | basDevp.setStationList(JSON.toJSONString(stationList)); |
| | | |
| | | List<StationObjModel> barcodeStationList = barcodeStationMap.get(deviceNo); |
| | | List<StationObjModel> inStationList = inStationMap.get(deviceNo); |
| | | List<StationObjModel> outStationList = outStationMap.get(deviceNo); |
| | | List<StationObjModel> runBlockReassignStationList = runBlockReassignStationMap.get(deviceNo); |
| | | |
| | | if (barcodeStationList != null) { |
| | | basDevp.setBarcodeStationList(JSON.toJSONString(barcodeStationList, SerializerFeature.DisableCircularReferenceDetect)); |
| | | } |
| | | |
| | | if (inStationList != null) { |
| | | basDevp.setInStationList(JSON.toJSONString(inStationList, SerializerFeature.DisableCircularReferenceDetect)); |
| | | } |
| | | |
| | | if (outStationList != null) { |
| | | basDevp.setOutStationList(JSON.toJSONString(outStationList, SerializerFeature.DisableCircularReferenceDetect)); |
| | | } |
| | | |
| | | if (runBlockReassignStationList != null) { |
| | | basDevp.setRunBlockReassignLocStationList(JSON.toJSONString(runBlockReassignStationList, SerializerFeature.DisableCircularReferenceDetect)); |
| | | } |
| | | |
| | | basDevp.setStationList(JSON.toJSONString(stationList, SerializerFeature.DisableCircularReferenceDetect)); |
| | | basDevp.setUpdateTime(new Date()); |
| | | basDevpService.insertOrUpdate(basDevp); |
| | | |