From 36b1e0df911a72aa483944685ada722192ff04c8 Mon Sep 17 00:00:00 2001
From: value <z1292839451@163.com>
Date: 星期日, 05 五月 2024 19:18:37 +0800
Subject: [PATCH] 标准库增加区间设置功能

---
 inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 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 ae0bf3d..144fbff 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
@@ -141,7 +141,6 @@
     }
 
     @Override
-    @Transactional(rollbackFor = Exception.class)
     public void saveInsContext(Map<String, Object> insContext) {
         Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId");
         CompletableFuture.supplyAsync(() -> {
@@ -173,7 +172,7 @@
                     }
                     result.setInsValue(JSON.toJSONString(iv));
                 }
-                if (jo.get("comValue") != null) {
+                if (jo.get("comValue") != null && !Objects.equals(jo.get("comValue"), "")) {
                     JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("comValue")));
                     List<Map<String, Object>> cv = new ArrayList<>();
                     for (Object o : jsonArray2) {
@@ -184,10 +183,13 @@
                     }
                     result.setComValue(JSON.toJSONString(cv));
                 }
-                JSONObject resValue = JSON.parseObject(JSON.toJSONString(jo.get("resValue")));
-                if (resValue.get("v") != null) {
-                    insProduct.setLastValue(JSON.parseObject(JSON.toJSONString(resValue.get("v"))).get("v") + "");
-                }
+                try {
+                    JSONObject resValue = JSON.parseObject(JSON.toJSONString(jo.get("resValue")));
+                    if (resValue.get("v") != null) {
+                        Object o = JSON.parseObject(JSON.toJSONString(resValue.get("v"))).get("v");
+                        insProduct.setLastValue(o==null?null:(o + ""));
+                    }
+                }catch (Exception e){}
                 if (jo.get("equipValue") != null) {
                     JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("equipValue")));
                     List<Map<String, Object>> ev = new ArrayList<>();
@@ -239,8 +241,14 @@
                 }
                 insSampleMapper.updateById(insSample);
             });
-            return null;
+            return insContext.keySet().stream().findFirst().orElse(null);
         }).thenAccept(res -> {
+            if(res!=null){
+                int pId = Integer.parseInt(res.replaceAll("\\D+", ""));
+                // TODO: 2024/5/4 闇�瑕侀�氳繃pid鑾峰彇妫�楠屽崟褰撳墠璇曢獙瀹ゆ墍鏈夐」鐩槸鍚︽湁妫�楠岀粨鏋滃悗杩涜鍒ゆ柇妫�楠屽崟鏄惁鏇存敼鎴愨�滃凡妫�鈥濈姸鎬�
+//                InsProduct insProduct = insProductMapper.selectById(pId);
+//                insSampleMapper.selectList(Wrappers.<>)
+            }
         }).exceptionally(e -> {
             e.printStackTrace();
             return null;
@@ -590,7 +598,7 @@
                 product.setTemplate(new ArrayList<>());
                 continue;
             }
-            if (set.add(product.getTemplateId())) {
+            if (product.getTemplateId() != null && set.add(product.getTemplateId())) {
                 map2.put(product.getTemplateId(), standardTemplateService.getStandTempThingById(product.getTemplateId()) + "");
             }
             String thing = map2.get(product.getTemplateId());
@@ -603,6 +611,7 @@
                 style.put("columnlen", config.get("columnlen"));
                 product.setTemplate(cellData);
                 product.setStyle(style);
+                product.setTemplateName(standardTemplateService.getStandTempNameById(product.getTemplateId()));
             }
         }
     }

--
Gitblit v1.9.3