From bd9653797c2db1071c894ba88451174d65df575c Mon Sep 17 00:00:00 2001 From: admin <15939171744@163.com> Date: 星期三, 03 七月 2024 16:09:26 +0800 Subject: [PATCH] - --- jcdm-main/src/main/java/com/jcdm/main/restful/qingYan/service/ExternalInterface.java | 61 ++++++++++++++++-------------- 1 files changed, 33 insertions(+), 28 deletions(-) diff --git a/jcdm-main/src/main/java/com/jcdm/main/restful/qingYan/service/ExternalInterface.java b/jcdm-main/src/main/java/com/jcdm/main/restful/qingYan/service/ExternalInterface.java index 271854f..e245abd 100644 --- a/jcdm-main/src/main/java/com/jcdm/main/restful/qingYan/service/ExternalInterface.java +++ b/jcdm-main/src/main/java/com/jcdm/main/restful/qingYan/service/ExternalInterface.java @@ -177,36 +177,41 @@ * 鎺ユ敹鐢佃姱鏁版嵁 */ @PostMapping("/receivingBatteryCellData") - public void receivingBatteryCellData(@RequestBody CellDataVo cellDataVo) throws JsonProcessingException { - ObjectMapper objectMapper = new ObjectMapper(); - JSONObject jsonObject = new JSONObject(cellDataVo); - String cellListString = jsonObject.getStr("cellList"); - JsonNode cellListNode = objectMapper.readValue(cellListString, JsonNode.class); - List<DaCellData> daCellDataList = new ArrayList<>(); - for (JsonNode jsonNode : cellListNode) { - String cellCheckListString = jsonNode.path("cellCheckList").toString(); - JsonNode cellCheckListNode = objectMapper.readValue(cellCheckListString, JsonNode.class); - for (JsonNode checkNode : cellCheckListNode) { - DaCellData daCellData = new DaCellData(); - daCellData.setSiteCode(jsonObject.getStr("siteCode")); - daCellData.setModuleSerial(jsonObject.getStr("moduleSerial")); - daCellData.setModuleModel(jsonObject.getStr("moduleModel")); - daCellData.setAbModule(jsonObject.getStr("ABModule")); - daCellData.setPackageNo(jsonObject.getStr("packageNo")); - daCellData.setSupplierModuleBarcode(jsonObject.getStr("supplierModuleBarcode")); - daCellData.setCustomerModuleBarcode(jsonObject.getStr("customerModuleBarcode")); - daCellData.setCellSerial(jsonNode.path("cellSerial").toString().replaceAll("\"", "")); - daCellData.setCellModel(jsonNode.path("cellModel").toString().replaceAll("\"", "")); - daCellData.setGbCellCode(jsonNode.path("GBCellCode").toString().replaceAll("\"", "")); - daCellData.setGbModuleCode(jsonNode.path("GBModuleCode").toString().replaceAll("\"", "")); - daCellData.setCellItem(checkNode.path("cellItem").toString().replaceAll("\"", "")); - daCellData.setCellValue(checkNode.path("cellValue").toString().replaceAll("\"", "")); - daCellData.setCreateUser("宸ュ巶MES"); - daCellData.setCreateTime(new Date()); - daCellDataList.add(daCellData); + public AjaxResult receivingBatteryCellData(@RequestBody CellDataVo cellDataVo){ + try { + ObjectMapper objectMapper = new ObjectMapper(); + JSONObject jsonObject = new JSONObject(cellDataVo); + String cellListString = jsonObject.getStr("cellList"); + JsonNode cellListNode = objectMapper.readValue(cellListString, JsonNode.class); + List<DaCellData> daCellDataList = new ArrayList<>(); + for (JsonNode jsonNode : cellListNode) { + String cellCheckListString = jsonNode.path("cellCheckList").toString(); + JsonNode cellCheckListNode = objectMapper.readValue(cellCheckListString, JsonNode.class); + for (JsonNode checkNode : cellCheckListNode) { + DaCellData daCellData = new DaCellData(); + daCellData.setSiteCode(jsonObject.getStr("siteCode")); + daCellData.setModuleSerial(jsonObject.getStr("moduleSerial")); + daCellData.setModuleModel(jsonObject.getStr("moduleModel")); + daCellData.setAbModule(jsonObject.getStr("ABModule")); + daCellData.setPackageNo(jsonObject.getStr("packageNo")); + daCellData.setSupplierModuleBarcode(jsonObject.getStr("supplierModuleBarcode")); + daCellData.setCustomerModuleBarcode(jsonObject.getStr("customerModuleBarcode")); + daCellData.setCellSerial(jsonNode.path("cellSerial").toString().replaceAll("\"", "")); + daCellData.setCellModel(jsonNode.path("cellModel").toString().replaceAll("\"", "")); + daCellData.setGbCellCode(jsonNode.path("GBCellCode").toString().replaceAll("\"", "")); + daCellData.setGbModuleCode(jsonNode.path("GBModuleCode").toString().replaceAll("\"", "")); + daCellData.setCellItem(checkNode.path("cellItem").toString().replaceAll("\"", "")); + daCellData.setCellValue(checkNode.path("cellValue").toString().replaceAll("\"", "")); + daCellData.setCreateUser("宸ュ巶MES"); + daCellData.setCreateTime(new Date()); + daCellDataList.add(daCellData); + } } + daCellDataService.insertBatch(daCellDataList); + return AjaxResult.success("API璋冪敤鎴愬姛"); + }catch (Exception e){ + return AjaxResult.error("API璋冪敤澶辫触"); } - daCellDataService.insertBatch(daCellDataList); } } -- Gitblit v1.9.3