From 75cca9bd19cc7fad3744c82dcfdc3c56a98694f6 Mon Sep 17 00:00:00 2001
From: Crunchy <3114200645@qq.com>
Date: 星期三, 08 五月 2024 11:26:41 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java | 48 ++++++++++++++++++++++++++++++++++++++----------
1 files changed, 38 insertions(+), 10 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 83c2394..fb20396 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
@@ -6,6 +6,7 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -141,7 +142,6 @@
}
@Override
- @Transactional(rollbackFor = Exception.class)
public void saveInsContext(Map<String, Object> insContext) {
Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId");
CompletableFuture.supplyAsync(() -> {
@@ -173,7 +173,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 +184,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.equals("")?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 +242,32 @@
}
insSampleMapper.updateById(insSample);
});
- return null;
+ return insContext.keySet().stream().findFirst().orElse(null);
}).thenAccept(res -> {
+ if(res!=null){
+ int pId = Integer.parseInt(res.replaceAll("\\D+", ""));
+ InsProduct insProduct = insProductMapper.selectById(pId);
+ // 閫氳繃pId 鑾峰彇褰撳墠鏍锋湰id
+ int sampleId = insProductMapper.selectById(pId).getInsSampleId();
+ // 閫氳繃鏍锋湰id鑾峰彇璁㈠崟id
+ int orderId = insSampleMapper.selectById(sampleId).getInsOrderId();
+ // 閫氳繃璁㈠崟id鏌ユ壘鎵�鏈夋牱鏈琲d
+ List<Integer> sampleIds = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId)).stream().map(InsSample::getId).collect(Collectors.toList());
+ // 閫氳繃妫�鏌ユ瘡涓�涓牱鏈琲d鏌ュ埌灞炰簬妫�楠岄」缁撹 is null鐨勬暟閲�
+ Long count = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery().in(InsProduct::getInsSampleId, sampleIds).isNull(InsProduct::getInsResult).eq(InsProduct::getSonLaboratory, insProduct.getSonLaboratory()));
+ // is null鐨勬暟閲忎负0鏄皢璁㈠崟鐘舵�佽〃鐨勭姸鎬佹敼涓哄凡妫�楠�
+ List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().in(InsProduct::getInsSampleId, sampleIds).isNull(InsProduct::getInsResult).eq(InsProduct::getSonLaboratory, insProduct.getSonLaboratory()));
+ insProducts.forEach(insProduct1 -> {
+ System.out.println(insProduct1.getInsResult());
+ System.out.println(insProduct1.getId());
+ });
+ if (count == 0) {
+ insOrderStateMapper.update(new InsOrderState(), Wrappers.<InsOrderState>lambdaUpdate()
+ .eq(InsOrderState::getInsOrderId, orderId)
+ .eq(InsOrderState::getLaboratory, insProduct.getSonLaboratory())
+ .set(InsOrderState::getInsState, 2));
+ }
+ }
}).exceptionally(e -> {
e.printStackTrace();
return null;
@@ -379,6 +406,7 @@
if ("鍙傛暟".equals(v.get("v"))) delSet.add(jo1.get("c") + "");
}
}
+ // TODO: 2024/5/5 涓嬪垪寰幆缂哄皯word鍚堝苟鍗曞厓鏍肩殑鎿嶄綔
for (int i = 0; i < temp.size(); i++) {
JSONObject jo1 = temp.get(i);
TextRenderData textRenderData = new TextRenderData();
@@ -526,8 +554,7 @@
tables.forEach(table -> {
table.put("tableSize", tables.size() + 1);
});
-// List<Map<String, String>> deviceList = insOrderMapper.selectDeviceList(deviceSet);
- List<Map<String, String>> deviceList = new ArrayList<>();
+ List<Map<String, String>> deviceList = insOrderMapper.selectDeviceList(deviceSet);
Map<String, String> codeStr = new HashMap<>();
codeStr.put("鎶ュ憡缂栧彿", insReport.getCode());
codeStr.put("鏍峰搧鍚嶇О", insOrder.getSample());
@@ -591,7 +618,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());
@@ -604,6 +631,7 @@
style.put("columnlen", config.get("columnlen"));
product.setTemplate(cellData);
product.setStyle(style);
+ product.setTemplateName(standardTemplateService.getStandTempNameById(product.getTemplateId()));
}
}
}
--
Gitblit v1.9.3