From e7652ccba51bca69f1a8da50b959b694544267f8 Mon Sep 17 00:00:00 2001 From: zhuo <2089219845@qq.com> Date: 星期四, 27 二月 2025 11:08:25 +0800 Subject: [PATCH] 检验任务查询回调 --- inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 109 insertions(+), 5 deletions(-) diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java index c33bb08..c1f9c46 100644 --- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java +++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java @@ -34,7 +34,6 @@ import com.ruoyi.common.constant.InsOrderTypeConstants; import com.ruoyi.common.core.domain.entity.Custom; import com.ruoyi.common.core.domain.entity.InformationNotification; -import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.domain.entity.User; import com.ruoyi.common.utils.*; import com.ruoyi.framework.exception.ErrorException; @@ -56,6 +55,7 @@ import com.ruoyi.system.service.InformationNotificationService; import org.apache.commons.lang3.StringUtils; import org.apache.poi.xwpf.usermodel.*; +import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Value; import org.springframework.mock.web.MockMultipartFile; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @@ -591,8 +591,27 @@ return insSampleUserMapper.insert(insSampleUser); } + /** + * 鏌ヨ妯℃澘鍐呭 + * @param order + * @param insProducts + */ private void getTemplateThing(InsOrder order, List<InsProduct> insProducts) { Set<Integer> set = new HashSet<>(); + // 妫�楠岄」鍒嗙被+妫�楠岄」+妫�楠屽瓙椤圭殑鎷兼帴 +// List<String> itemNameList = insProducts.stream().map(insProduct -> { +// String itemName = ""; +// if (StringUtils.isNotBlank(insProduct.getInspectionItemClass())) { +// itemName += insProduct.getInspectionItemClass().trim(); +// } +// if (StringUtils.isNotBlank(insProduct.getInspectionItem())) { +// itemName += insProduct.getInspectionItem().trim(); +// } +// if (StringUtils.isNotBlank(insProduct.getInspectionItemSubclass())) { +// itemName += insProduct.getInspectionItemSubclass().trim(); +// } +// return itemName; +// }).collect(Collectors.toList()); // 鏌ヨ璁㈠崟鐘舵�佸垽鏂槸鍚︽槸鏌ュ巻鍙叉ā鏉� if (order.getIsFirstSubmit() != null && order.getIsFirstSubmit().equals(1)) { InsOrderState insOrderState = insOrderStateMapper.selectOne(Wrappers.<InsOrderState>lambdaQuery() @@ -612,8 +631,9 @@ .eq(InsOrderStandardTemplate::getInsOrderId, order.getId())); thing = one.getThing(); if (StrUtil.isNotEmpty(thing)) { - 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"))); + thing = GZipUtil.uncompress(thing); + JSONObject sheet = JSON.parseObject(thing).getJSONArray("data").getJSONObject(0); + JSONObject config = sheet.getJSONObject("config"); List<JSONObject> cellData = JSON.parseArray(JSON.toJSONString(sheet.get("celldata")), JSONObject.class); Map<String, Object> style = new HashMap<>(); style.put("rowlen", config.get("rowlen")); @@ -636,8 +656,8 @@ thing = standardTemplateService.getStandTempThingById(product.getTemplateId()); } if (StrUtil.isNotEmpty(thing)) { - 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"))); + JSONObject sheet = JSON.parseObject(thing).getJSONArray("data").getJSONObject(0); + JSONObject config = sheet.getJSONObject("config"); List<JSONObject> cellData = JSON.parseArray(JSON.toJSONString(sheet.get("celldata")), JSONObject.class); Map<String, Object> style = new HashMap<>(); style.put("rowlen", config.get("rowlen")); @@ -649,6 +669,90 @@ } } + /** + * todo: 娓呴櫎娌℃湁浣跨敤鐨勬楠岄」 + * @param sheet + * @param itemNameList + */ + private static void eliminateItem(JSONObject sheet, List<String> itemNameList) { + // 鑾峰彇鍒� 妫�楠岄」鍒嗙被+妫�楠岄」+妫�楠屽瓙椤圭殑鎷兼帴,濡傛灉妯℃澘閲岀殑淇℃伅璺熸帴鍙h繑鍥炵殑妫�楠岄」淇℃伅鑳藉鍖归厤鍒欏睍绀哄嚭鏉� + + // 寰幆琛屾暟鍒ゆ柇鏄惁 + JSONArray dataListJSONArray = sheet.getJSONArray("data"); + + // 娣诲姞鍧愭爣map + Map<String, String> coordinatesMap = new HashMap<>(); + + // 闇�瑕佺Щ闄ょ殑绱㈠紩 + List<Integer> deleteIndex = new ArrayList<>(); + // 寰幆鍒� + for (int r = 0; r < dataListJSONArray.size(); r++) { + JSONArray dataList = dataListJSONArray.getJSONArray(r); + // 寰幆琛� + String itemName = ""; + // 鍒ゆ柇鏄惁鏄剧ず + boolean isShow = false; + + for (int c = 0; c < dataList.size(); c++) { + // 鏌ヨ鎵规敞 + JSONObject jsonObject = dataList.getJSONObject(c); + try { + if (jsonObject.getJSONObject("ps").getString("value").equals("妫�楠岄」鍒嗙被")) { + String value = jsonObject.getString("v").trim(); + itemName += value; + // 娣诲姞鍧愭爣 + String coordinates = coordinatesJoint(r, c); + coordinatesMap.put(coordinates, value); + isShow = true; + } else if (jsonObject.getJSONObject("ps").getString("value").equals("妫�楠岄」")) { + String value = jsonObject.getString("v").trim(); + itemName += value; + // 娣诲姞鍧愭爣 + String coordinates = coordinatesJoint(r, c); + coordinatesMap.put(coordinates, value); + isShow = true; + } else if (jsonObject.getJSONObject("ps").getString("value").equals("妫�楠屽瓙椤�")) { + String value = jsonObject.getString("v").trim(); + itemName += value; + // 娣诲姞鍧愭爣 + String coordinates = coordinatesJoint(r, c); + coordinatesMap.put(coordinates, value); + isShow = true; + } + } catch (Exception e) { + // 鍒ゆ柇鏄惁鏈塵c鍚堝苟鍗曞厓鏍� + if (jsonObject != null && jsonObject.getJSONObject("mc") != null) { + // 鏌ヨ鍧愭爣杩涜娣诲姞 + String value = coordinatesMap.get(coordinatesJoint(jsonObject.getJSONObject("mc").getInteger("r"), jsonObject.getJSONObject("mc").getInteger("c"))); + if (StringUtils.isNotBlank(value) && !itemName.contains(value)) { + itemName += value; + } + } + } + } + // 鍒ゆ柇璇ヨ鍗曟槸鍚︽湁鏀规楠岄」, 娌℃湁鍓旈櫎 + if (isShow) { + if (!itemNameList.contains(itemName)) { + dataListJSONArray.remove(r); + r--; + } + } + } + } + + + /** + * 鍧愭爣鎷兼帴 + * @param r 妯潗鏍� + * @param c 绾靛潗鏍� + * @return + */ + private static String coordinatesJoint(int r, int c) { + String coordinates = ""; + coordinates = "r:" + r + ",c:" + c; + return coordinates; + } + @Override @Transactional(rollbackFor = Exception.class) public int submitPlan(Integer orderId, String laboratory, Integer verifyUser, String entrustCode) { -- Gitblit v1.9.3