From 562926922386bb24070ea27eb5a27193c41e996b Mon Sep 17 00:00:00 2001 From: zss <zss@example.com> Date: 星期四, 18 四月 2024 14:46:50 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java | 61 +++++++++++++++++------------- 1 files changed, 35 insertions(+), 26 deletions(-) diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java index 85b7357..12d2730 100644 --- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java +++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java @@ -154,31 +154,39 @@ result = new InsProductResult(); } result.setInsProductId(Integer.parseInt(k)); - JSONArray jsonArray = JSON.parseArray(JSON.toJSONString(jo.get("insValue"))); - List<Map<String, Object>> iv = new ArrayList<>(); - for (Object o : jsonArray) { - JSONObject insValue = JSON.parseObject(JSON.toJSONString(o)); - Map<String, Object> map = new HashMap<>(); - map.put("v", JSON.parseObject(JSON.toJSONString(insValue.get("v"))).get("v")); - if ((insValue.get("u") == null || insValue.get("u").equals("")) && StrUtil.isNotEmpty(JSON.parseObject(JSON.toJSONString(insValue.get("v"))).get("v").toString())) { - map.put("u", userId); - } else { - map.put("u", insValue.get("u")); + if(jo.get("insValue") != null){ + JSONArray jsonArray = JSON.parseArray(JSON.toJSONString(jo.get("insValue"))); + List<Map<String, Object>> iv = new ArrayList<>(); + for (Object o : jsonArray) { + JSONObject insValue = JSON.parseObject(JSON.toJSONString(o)); + Map<String, Object> map = new HashMap<>(); + map.put("v", JSON.parseObject(JSON.toJSONString(insValue.get("v"))).get("v")); + try { + if ((insValue.get("u") == null || insValue.get("u").equals("")) && StrUtil.isNotEmpty(JSON.parseObject(JSON.toJSONString(insValue.get("v"))).get("v").toString())) { + map.put("u", userId); + } else { + map.put("u", insValue.get("u")); + } + iv.add(map); + }catch (Exception e){} } - iv.add(map); + result.setInsValue(JSON.toJSONString(iv)); } - result.setInsValue(JSON.toJSONString(iv)); - JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("comValue"))); - List<Map<String, Object>> cv = new ArrayList<>(); - for (Object o : jsonArray2) { - JSONObject comValue = JSON.parseObject(JSON.toJSONString(o)); - Map<String, Object> map = new HashMap<>(); - map.put("v", JSON.parseObject(JSON.toJSONString(comValue.get("v"))).get("v")); - cv.add(map); + if(jo.get("comValue") != null){ + JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("comValue"))); + List<Map<String, Object>> cv = new ArrayList<>(); + for (Object o : jsonArray2) { + JSONObject comValue = JSON.parseObject(JSON.toJSONString(o)); + Map<String, Object> map = new HashMap<>(); + map.put("v", JSON.parseObject(JSON.toJSONString(comValue.get("v"))).get("v")); + cv.add(map); + } + result.setComValue(JSON.toJSONString(cv)); } - result.setComValue(JSON.toJSONString(cv)); JSONObject resValue = JSON.parseObject(JSON.toJSONString(jo.get("resValue"))); - insProduct.setLastValue(JSON.parseObject(JSON.toJSONString(resValue.get("v"))).get("v") + ""); + if(resValue.get("v")!=null){ + insProduct.setLastValue(JSON.parseObject(JSON.toJSONString(resValue.get("v"))).get("v") + ""); + } JSONObject equipValue = JSON.parseObject(JSON.toJSONString(jo.get("equipValue"))); try { result.setEquipValue(JSON.parseObject(JSON.toJSONString(equipValue.get("v"))).get("v") + ""); @@ -479,14 +487,15 @@ JSONObject sheet = JSON.parseObject(JSON.toJSONString(JSON.parseArray(JSON.toJSONString(JSON.parseObject(thing).get("data"))).get(0))); JSONObject config = JSON.parseObject(JSON.toJSONString(sheet.get("config"))); List<JSONObject> cellData = JSON.parseArray(JSON.toJSONString(sheet.get("celldata")), JSONObject.class); - List<JSONObject> tableData = new ArrayList<>(); +// List<JSONObject> tableData = new ArrayList<>(); Map<String, Object> style = new HashMap<>(); style.put("rowlen", config.get("rowlen")); style.put("columnlen", config.get("columnlen")); - int r = -1; - if (BeanUtil.isNotEmpty(cellData)) { +// int r = -1; + /*if (BeanUtil.isNotEmpty(cellData)) { for (JSONObject o : cellData) { JSONObject v = JSON.parseObject(JSON.toJSONString(o.get("v"))); + tableData.add(o); if (BeanUtil.isNotEmpty(v.get("ps"))) { JSONObject ps = JSON.parseObject(JSON.toJSONString(v.get("ps"))); if (ps.get("value").equals("妫�楠岄」") && v.get("v").equals(product.getInspectionItem())) { @@ -504,8 +513,8 @@ } } } - } - product.setTemplate(tableData); + }*/ + product.setTemplate(cellData); product.setStyle(style); } } -- Gitblit v1.9.3