From 6ca23797c5221b37b18247c7a610da70a05913a9 Mon Sep 17 00:00:00 2001 From: value <z1292839451@163.com> Date: 星期二, 23 四月 2024 01:35:28 +0800 Subject: [PATCH] 功能调整 --- inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java | 59 ++++++++++++++++++++++++----------------------------------- 1 files changed, 24 insertions(+), 35 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 b3eda3a..2990f06 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 @@ -165,7 +165,7 @@ 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); + map.put("u", userId + ""); } else { map.put("u", insValue.get("u")); } @@ -190,14 +190,23 @@ 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") + ""); - } catch (Exception ignored) { - result.setEquipValue(null); + if (jo.get("equipValue") != null) { + JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("equipValue"))); + List<Map<String, Object>> ev = new ArrayList<>(); + for (Object o : jsonArray2) { + JSONObject equipValue = JSON.parseObject(JSON.toJSONString(o)); + Map<String, Object> map = new HashMap<>(); + map.put("v", JSON.parseObject(JSON.toJSONString(equipValue.get("v"))).get("v")); + ev.add(map); + } + result.setEquipValue(JSON.toJSONString(ev)); } - JSONObject insResult = JSON.parseObject(JSON.toJSONString(jo.get("insResult"))); - insProduct.setInsResult(Integer.parseInt(JSON.parseObject(JSON.toJSONString(insResult.get("v"))).get("v") + "")); + try { + JSONObject insResult = JSON.parseObject(JSON.toJSONString(jo.get("insResult"))); + String ir = JSON.parseObject(JSON.toJSONString(insResult.get("v"))).get("v") + ""; + insProduct.setInsResult(Integer.parseInt(ir)); + } catch (Exception e) { + } if (BeanUtil.isEmpty(result.getId())) { result.setCreateUser(userId); result.setUpdateUser(userId); @@ -496,33 +505,9 @@ 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<>(); 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)) { - 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())) { - tableData.add(o); - r = Integer.parseInt(o.get("r") + ""); - continue; - } - } - if (tableData.size() > 0) { - if ((Integer.parseInt(o.get("r") + "") == r + 1 || Integer.parseInt(o.get("r") + "") == r) && !(o.get("v") + "").equals("{\"ht\":\"0\"}")) { - r = Integer.parseInt(o.get("r") + ""); - tableData.add(o); - } else { - break; - } - } - } - }*/ product.setTemplate(cellData); product.setStyle(style); } @@ -533,9 +518,13 @@ public int submitPlan(Integer orderId, String laboratory) { List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId).select(InsSample::getId)); List<Integer> ids = insSamples.stream().map(a -> a.getId()).collect(Collectors.toList()); - List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().in(InsProduct::getInsSampleId, ids).eq(InsProduct::getSonLaboratory, laboratory).isNotNull(InsProduct::getInsResult)); - if (insProducts.size() == 0) { - return 0; + List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().in(InsProduct::getInsSampleId, ids).eq(InsProduct::getSonLaboratory, laboratory).eq(InsProduct::getState, 1).isNull(InsProduct::getInsResult)); + if (insProducts.size() > 0) { + String str = ""; + for (InsProduct product : insProducts) { + str += product.getInspectionItem()+product.getInspectionItemSubclass()+"锛�"; + } + throw new ErrorException("浠ヤ笅鏄湭妫�楠岀殑椤圭洰锛�"+str); } insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate().eq(InsOrderState::getInsOrderId, orderId).eq(InsOrderState::getLaboratory, laboratory).set(InsOrderState::getInsTime, LocalDateTime.now()).set(InsOrderState::getInsState, 3)); return 1; -- Gitblit v1.9.3