From c296b7d0c412429d29ad24bd34aa9def65045085 Mon Sep 17 00:00:00 2001
From: chenrui <1187576398@qq.com>
Date: 星期四, 10 四月 2025 17:17:09 +0800
Subject: [PATCH] 成品下单检验新增字段

---
 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java |  574 ++++++++++++++++++++++++++++++--------------------------
 1 files changed, 305 insertions(+), 269 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..7008c60 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
@@ -2,8 +2,6 @@
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
@@ -32,9 +30,9 @@
 import com.ruoyi.basic.service.StandardTemplateService;
 import com.ruoyi.common.constant.DictDataConstants;
 import com.ruoyi.common.constant.InsOrderTypeConstants;
+import com.ruoyi.common.constant.MenuJumpPathConstants;
 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;
@@ -45,18 +43,21 @@
 import com.ruoyi.inspect.util.HackLoopTableRenderPolicy;
 import com.ruoyi.inspect.vo.InsOrderPlanTaskSwitchVo;
 import com.ruoyi.inspect.vo.InsOrderPlanVO;
-import com.ruoyi.performance.mapper.AuxiliaryOutputWorkingHoursMapper;
 import com.ruoyi.performance.mapper.PerformanceShiftMapper;
 import com.ruoyi.performance.mapper.ShiftTimeMapper;
 import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHours;
+import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHoursTemporary;
 import com.ruoyi.performance.service.AuxiliaryOutputWorkingHoursService;
+import com.ruoyi.performance.service.AuxiliaryOutputWorkingHoursTemporaryService;
 import com.ruoyi.system.mapper.CustomMapper;
 import com.ruoyi.system.mapper.UserMapper;
 import com.ruoyi.system.service.ISysDictTypeService;
 import com.ruoyi.system.service.InformationNotificationService;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.xwpf.usermodel.*;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.io.ClassPathResource;
 import org.springframework.mock.web.MockMultipartFile;
 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import org.springframework.stereotype.Service;
@@ -69,13 +70,10 @@
 import java.math.RoundingMode;
 import java.nio.file.Files;
 import java.nio.file.Paths;
-import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
-import java.time.LocalTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
-import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicReference;
@@ -102,14 +100,9 @@
     private InsOrderStateMapper insOrderStateMapper;
     @Resource
     private InsProductMapper insProductMapper;
-    @Resource
-    private ShiftTimeMapper shiftTimeMapper;
-    @Resource
-    private PerformanceShiftMapper performanceShiftMapper;
+
     @Value("${wordUrl}")
     private String wordUrl;
-    @Value("${twoCode}")
-    private String twoCode;
     @Resource
     private InsReportMapper insReportMapper;
     @Resource
@@ -117,11 +110,9 @@
     @Resource
     private InsProductUserMapper insProductUserMapper;
     @Resource
-    private InsUnPassService insUnPassService;
-    @Resource
-    private AuxiliaryOutputWorkingHoursMapper auxiliaryOutputWorkingHoursMapper;
-    @Resource
     private AuxiliaryOutputWorkingHoursService auxiliaryOutputWorkingHoursService;
+    @Resource
+    private AuxiliaryOutputWorkingHoursTemporaryService auxiliaryOutputWorkingHoursTemporaryService;
     @Resource
     private InformationNotificationService informationNotificationService;
     @Resource
@@ -130,7 +121,6 @@
     private CustomMapper customMapper;
     @Value("${file.path}")
     private String imgUrl;
-
     @Resource
     private InsOrderFileMapper insOrderFileMapper;
     @Resource
@@ -149,8 +139,7 @@
     private InsOrderFactoryVerifyMapper insOrderFactoryVerifyMapper;
     @Resource
     private InsOrderFactoryVerifyItemService insOrderFactoryVerifyItemService;
-    @Value("${file.licenseUrl}")
-    private String licenseUrl;
+
     @Resource
     private SpotCheckQuarterItemMapper spotCheckQuarterItemMapper;
     @Resource
@@ -161,32 +150,25 @@
     private InsOrderDeviceRecordService insOrderDeviceRecordService;
     @Resource
     private ISysDictTypeService iSysDictTypeService;
-
+    @Resource
+    private InsOrderRatesService insOrderRatesService;
 
     @Override
     public IPage<InsOrderPlanVO> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) {
-        // todo: 浠呯湅鑷繁鎴栬�呭疄楠屽
-        //鑾峰彇褰撳墠浜烘墍灞炲疄楠屽id
-
-        String laboratory = null;
-
-        String userName = null;
-        Integer userId = null;
-        if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId())) {
-            userId = SecurityUtils.getUserId().intValue();
-            userName = userMapper.selectById(userId).getName();
+        // 妫�娴嬬鐞嗕汉鍛樺叏鏌ワ紝闈炴娴嬬鐞嗕汉鍛樺彧鏌ョ湅鑷繁鐨�
+        InsOrderPlanQueryDto insOrderPlanQueryDto = new InsOrderPlanQueryDto();
+        insOrderPlanQueryDto.setCheckUserFlag(SecurityUtils.hasRole("inspector"));
+        insOrderPlanQueryDto.setTestAdminFlag(SecurityUtils.hasRole("testadmin"));
+        // 鍒ゆ柇鏄惁瑙﹀彂鍙煡鐪嬭嚜宸�
+        if(null != insOrderPlanDTO.getUserId()){
+            insOrderPlanQueryDto.setViewMySelfFlag(true);
             insOrderPlanDTO.setUserId(null);
         }
-        Integer isCheck = insOrderPlanDTO.getIsCheck();
+        insOrderPlanQueryDto.setIsCheck(insOrderPlanDTO.getIsCheck());
         insOrderPlanDTO.setIsCheck(null);
-        String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//璇曢獙瀹�
+        insOrderPlanQueryDto.setUserId(SecurityUtils.getUserId().intValue());
         IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder(page,
-                QueryWrappers.queryWrappers(insOrderPlanDTO),
-                userName,
-                userId,
-                sonLaboratory,
-                laboratory,
-                isCheck);
+                QueryWrappers.queryWrappers(insOrderPlanDTO),insOrderPlanQueryDto);
         return insOrderPage;
     }
 
@@ -235,17 +217,19 @@
 
         // 鏌ヨ鍘傚瀵嗗害
         String supplierDensity = "";
-        SampleProductDto sampleProductDto = list.get(0);
+        if (CollectionUtils.isNotEmpty(list)) {
+            SampleProductDto sampleProductDto = list.get(0);
 
-        // 鍒ゆ柇鏈夋病鏈夌粦瀹氬瀷鍙�
-        String modelValue = insSampleMapper.selectSupplierDensityModel(sampleProductDto.getSample(),
-                order.getProduction(),
-                sampleProductDto.getModel());
-        if (StringUtils.isNotBlank(modelValue)) {
-            supplierDensity = modelValue;
-        } else {
-            supplierDensity = insSampleMapper.selectSupplierDensity(sampleProductDto.getSample(),
-                    order.getProduction());
+            // 鍒ゆ柇鏈夋病鏈夌粦瀹氬瀷鍙�
+            String modelValue = insSampleMapper.selectSupplierDensityModel(sampleProductDto.getSample(),
+                    order.getProduction(),
+                    sampleProductDto.getModel());
+            if (StringUtils.isNotBlank(modelValue)) {
+                supplierDensity = modelValue;
+            } else {
+                supplierDensity = insSampleMapper.selectSupplierDensity(sampleProductDto.getSample(),
+                        order.getProduction());
+            }
         }
         map.put("supplierDensity", supplierDensity);
         return map;
@@ -368,7 +352,7 @@
         insContext.forEach((k, v) -> {
             JSONObject jo = JSON.parseObject(JSON.toJSONString(v));
             InsProduct insProduct = new InsProduct();
-            insProduct.setId(Integer.parseInt(k));
+            insProduct.setId(Long.valueOf(Integer.parseInt(k)));
             InsProduct product = insProductMapper.selectById(insProduct.getId());
             if (currentTable.equals(product.getTemplateId()) && currentSampleId.equals(product.getInsSampleId())) {
                 List<InsProductResult> oldResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery()
@@ -455,6 +439,30 @@
                     }
                     newResult.setEquipName(JSON.toJSONString(ev));
                 }
+                //娴嬭瘯寮�濮嬫椂闂�
+                if (jo.get("testStartTime") != null) {
+                    JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("testStartTime")));
+                    List<Map<String, Object>> ev = new ArrayList<>();
+                    for (Object o : jsonArray2) {
+                        JSONObject testStartTimeValue = JSON.parseObject(JSON.toJSONString(o));
+                        Map<String, Object> map = new HashMap<>();
+                        map.put("v", JSON.parseObject(JSON.toJSONString(testStartTimeValue.get("v"))).get("v"));
+                        ev.add(map);
+                    }
+                    newResult.setTestStartTime(JSON.toJSONString(ev));
+                }
+                //娴嬭瘯缁撴潫鏃堕棿
+                if (jo.get("testEndTime") != null) {
+                    JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("testEndTime")));
+                    List<Map<String, Object>> ev = new ArrayList<>();
+                    for (Object o : jsonArray2) {
+                        JSONObject testEndTimeValue = JSON.parseObject(JSON.toJSONString(o));
+                        Map<String, Object> map = new HashMap<>();
+                        map.put("v", JSON.parseObject(JSON.toJSONString(testEndTimeValue.get("v"))).get("v"));
+                        ev.add(map);
+                    }
+                    newResult.setTestEndTime(JSON.toJSONString(ev));
+                }
                 //缁撹
                 try {
                     JSONObject insResult = JSON.parseObject(JSON.toJSONString(jo.get("insResult")));
@@ -475,7 +483,7 @@
 
                 insProduct.setUpdateUser(userId);
                 insProductMapper.updateById(insProduct);
-                insProductUserMapper.insert(new InsProductUser(null, userId, LocalDateTime.now(), insProduct.getId()));
+                insProductUserMapper.insert(new InsProductUser(null, userId, LocalDateTime.now(), Math.toIntExact(insProduct.getId())));
 
                 insSample.setInsState(1);
                 Long l = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery()
@@ -500,13 +508,6 @@
                     }
                 }
 
-                //鏌ヨ妫�楠屽崟淇℃伅
-                // 娣诲姞宸ユ椂
-                InsProduct finalInsProduct = insProductMapper.selectById(product.getId());
-                threadPoolTaskExecutor.execute(() -> {
-                    InsOrder insOrder = insOrderMapper.selectById(insSample.getInsOrderId());
-                    this.addAuxiliary(userId, finalInsProduct, insOrder);
-                });
             }
         });
         String sampleIdStr = insContext.keySet().stream().findFirst().orElse(null);
@@ -591,8 +592,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 +632,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 +657,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,11 +670,95 @@
         }
     }
 
+    /**
+     * 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) {
         InsOrder order = insOrderMapper.selectById(orderId);
-        // 鍒ゆ柇鏄惁鏈夐噸澶嶇紪鍙�, 鏈夐噸澶嶇紪鍙峰仛鎻愰啋
+        // 1. 鍒ゆ柇鏄惁鏈夐噸澶嶇紪鍙�, 鏈夐噸澶嶇紪鍙峰仛鎻愰啋
         Long codeCount = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery()
                 .ne(InsOrder::getState, -1)
                 .ne(InsOrder::getIfsInventoryId, order.getIfsInventoryId())
@@ -662,7 +767,7 @@
             throw new ErrorException("褰撳墠缂栧彿鏈夐噸澶�, 璇峰厛鍘讳慨鏀归噸澶嶇紪鍙�");
         }
 
-        // 鍒ゆ柇璇ヨ鍗曟槸鍚︽槸绗竴娆$敓浜�
+        // 2. 鍒ゆ柇璇ヨ鍗曟槸鍚︽槸绗竴娆$敓浜�(鍚庣画鎶ュ憡鐢熸垚鍙彇绗竴娆℃彁浜ゆ椂闂�)
         if (!(order.getIsFirstSubmit() != null && order.getIsFirstSubmit().equals(1))) {
             insOrderMapper.update(null, Wrappers.<InsOrder>lambdaUpdate()
                     .eq(InsOrder::getId, orderId)
@@ -670,11 +775,12 @@
                     .set(InsOrder::getFirstSubmitDate, LocalDateTime.now()));
         }
 
+        // 3. 鍒ゆ柇鏄惁鏈夋湭妫�椤�
         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<Integer> InsSampleIds = insSamples.stream().map(InsSample::getId).collect(Collectors.toList());
         List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
-                .in(InsProduct::getInsSampleId, ids)
+                .in(InsProduct::getInsSampleId, InsSampleIds)
                 .eq(InsProduct::getSonLaboratory, laboratory)
                 .eq(InsProduct::getState, 1)
                 .and(wrapper -> wrapper
@@ -682,37 +788,37 @@
                         .or()
                         .eq(InsProduct::getInsResult, 2)
                 )
-                .isNull(InsProduct::getInsFiberId)
-                .isNull(InsProduct::getInsFibersId)
                 .ne(InsProduct::getIsBinding, 1));
-        insProducts.addAll(insProductMapper.selectFiberInsProduct(ids, laboratory));
+        insProducts.addAll(insProductMapper.selectFiberInsProduct(InsSampleIds, laboratory));
         if (insProducts.size() > 0) {
             String str = "";
             int count = 0;
             for (InsProduct product : insProducts) {
                 count++;
-                str += "<br/>" + count + "锛�" + product.getInspectionItem() + " " + product.getInspectionItemSubclass() + "<br/>";
-
+                str +=  (count != 0 ? "\n" : "") + count + "锛�" +
+                        product.getInspectionItemClass() + " " +
+                        product.getInspectionItem() + " " +
+                        product.getInspectionItemSubclass();
             }
             if (ObjectUtils.isNotEmpty(str)) {
-                throw new ErrorException("<strong>瀛樺湪寰呮楠岀殑椤圭洰锛�</strong><br/>" + str);
+                throw new ErrorException("瀛樺湪寰呮楠岀殑椤圭洰锛�" + str);
             }
         }
+
+        // 4.淇敼妫�娴嬬粨鏋�
         insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate().eq(InsOrderState::getInsOrderId, orderId)
                 .eq(InsOrderState::getLaboratory, laboratory)
                 .set(InsOrderState::getInsTime, LocalDateTime.now())
                 .set(InsOrderState::getInsState, 3)
                 .set(InsOrderState::getVerifyUser, verifyUser));
 
-        // 鍙戦�佹秷鎭�
+
+        // 5.鍙戦�佹秷鎭�氱煡缁欏鏍镐汉
         // 鏌ヨ褰撳墠浜轰俊鎭�
         Integer userId = SecurityUtils.getUserId().intValue();
         String userName = insProductMapper.selectUserById(userId).get("name");
-
         // 鏌ヨ鍙戦�佷汉淇℃伅
         String sendUserAccount = insProductMapper.selectUserById(verifyUser).get("account");
-
-
         InformationNotification info = new InformationNotification();
         info.setCreateUser(userName);
         info.setMessageType("2");
@@ -721,20 +827,21 @@
         info.setSenderId(userId);
         info.setConsigneeId(verifyUser);
         info.setViewStatus(false);
-        info.setJumpPath("b1-inspect-orderPlan-review");
+        info.setJumpPath(MenuJumpPathConstants.INSPECTION_REVIEW);
         informationNotificationService.addInformationNotification(info);
 
-        //澶嶆牳浜�--妫�楠屽崟鐩稿叧璐熻矗浜�
+        // 6.澶嶆牳浜�--鏂板妫�楠屽崟鐩稿叧璐熻矗浜�
         InsSampleUser insSampleUser = new InsSampleUser();
         insSampleUser.setUserId(verifyUser);
         insSampleUser.setInsSampleId(orderId);
         insSampleUser.setState(1);
         insSampleUser.setSonLaboratory(laboratory);
         insSampleUserMapper.insert(insSampleUser);
-        /*鏍¢獙涓�涓媟esult琛�*/
-        CompletableFuture.supplyAsync(() -> {
-            List<Integer> ips = insProducts.stream().map(InsProduct::getId).distinct().collect(Collectors.toList());
-            for (Integer ip : ips) {
+
+        // 7.鏍¢獙涓�涓媟esult琛�(閬垮厤鍑虹幇澶氫釜妫�楠岄」缁撴灉)
+        threadPoolTaskExecutor.execute(() -> {
+            List<Long> ips = insProducts.stream().map(InsProduct::getId).distinct().collect(Collectors.toList());
+            for (Long ip : ips) {
                 List<InsProductResult> insProductResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery()
                         .eq(InsProductResult::getInsProductId, ip));
                 if (insProductResults.size() > 1) {
@@ -743,88 +850,73 @@
                     }
                 }
             }
-            return null;
         });
 
-        // 鎻愪氦鐢熸垚鎶ュ憡
+        // 8.鎻愪氦鐢熸垚鎶ュ憡
         this.generateReport(orderId);
 
-        // 娣诲姞涓存椂pdf鐢熸垚鍦板潃
+        // 9.娣诲姞涓存椂pdf鐢熸垚鍦板潃
         InsReport report = insReportMapper.selectOne(Wrappers.<InsReport>lambdaQuery()
                 .eq(InsReport::getInsOrderId, orderId));
         String tempUrlPdf = this.wordToPdfTemp(report.getUrl().replace("/word", wordUrl));
         report.setTempUrlPdf("/word/" + tempUrlPdf);
         insReportMapper.updateById(report);
 
-        // 鏌ヨ璁㈠崟
-        InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery()
-                .eq(InsSample::getInsOrderId, orderId)
-                .last("limit 1"));
-        // 鏌ヨ鍘熸潗鏂�
-        IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(order.getIfsInventoryId());
+        // 10.鍘熷璁板綍妯℃澘澶嶅埗(娣诲姞澶囦唤, 閬垮厤淇敼鍘熷妯℃澘褰卞搷鍒板凡缁忓畬鎴愮殑鍗曞瓙)
+        this.templateCopy(orderId, InsSampleIds);
 
-        // 鍒犻櫎鍘熸湰妯℃澘
-        insOrderStandardTemplateService.remove(Wrappers.<InsOrderStandardTemplate>lambdaQuery()
-                .eq(InsOrderStandardTemplate::getInsOrderId, orderId));
-        // 澶嶅埗妯℃澘
-        Set<Integer> set = new HashSet<>();
-        List<InsProduct> insProductList = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
-                .in(InsProduct::getInsSampleId, ids)
-                .select(InsProduct::getTemplateId));
-
-        for (InsProduct product : insProductList) {
-            // 鏌ヨ妯℃澘id
-            if (product.getTemplateId() != null && set.add(product.getTemplateId())) {
-                StandardTemplate standardTemplate = standardTemplateService.getById(product.getTemplateId());
-                if (standardTemplate != null) {
-                    InsOrderStandardTemplate insOrderStandardTemplate = new InsOrderStandardTemplate();
-                    insOrderStandardTemplate.setInsOrderId(orderId);
-                    insOrderStandardTemplate.setTemplateId(standardTemplate.getId());
-                    insOrderStandardTemplate.setNumber(standardTemplate.getNumber());
-                    insOrderStandardTemplate.setName(standardTemplate.getName());
-                    insOrderStandardTemplate.setThing(standardTemplate.getThing());
-                    insOrderStandardTemplateService.save(insOrderStandardTemplate);
-                }
-            }
-        }
-
-        // 鎴愬搧鎶芥牱娣诲姞鍚堟牸鐘舵��
+        // 11.鎴愬搧鎶芥牱娣诲姞鍚堟牸鐘舵��
         // 鍒ゆ柇鏄惁鏈夋娊鏍蜂俊鎭�
         if (order.getQuarterItemId() != null) {
             // 鍒ゆ柇鏄惁鏈変笉鍚堟牸
-            Long unqualifiedCount = 0L;
-            if (CollectionUtils.isNotEmpty(insSamples)) {
-                unqualifiedCount = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery()
-                        .in(InsProduct::getInsSampleId, insSamples.stream().map(InsSample::getId).collect(Collectors.toList()))
-                        .eq(InsProduct::getInsResult, 0));
-
-                // 鍒ゆ柇濡傛灉鏈変笉鍚堟牸鐨勬楠岄」, 鍒ゆ柇鏈夋病鏈夋楠岄」澶嶆祴, 澶嶆牳鍚堟牸涔熺畻鍚堟牸閫氳繃
-                if (!unqualifiedCount.equals(0L)) {
-                    List<InsProduct> productList = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
-                            .in(InsProduct::getInsSampleId, insSamples.stream().map(InsSample::getId).collect(Collectors.toList()))
-                            .eq(InsProduct::getInsResult, 0));
-
-                    boolean flag = true;
-                    for (InsProduct insProduct : productList) {
-                        Long unqualifiedProductCount = insUnqualifiedRetestProductMapper.selectCount(Wrappers.<InsUnqualifiedRetestProduct>lambdaQuery()
-                                .eq(InsUnqualifiedRetestProduct::getInsProductId, insProduct.getId())
-                                .ne(InsUnqualifiedRetestProduct::getInsResult, 0));
-                        if (unqualifiedProductCount != 2) {
-                            flag = false;
-                        }
-                    }
-                    if (flag) {
-                        unqualifiedCount = 0L;
-                    }
-                }
-            }
-            spotCheckQuarterItemMapper.update(null, Wrappers.<SpotCheckQuarterItem>lambdaUpdate()
-                    .eq(SpotCheckQuarterItem::getQuarterItemId, order.getQuarterItemId())
-                    .set(SpotCheckQuarterItem::getResult, unqualifiedCount.equals(0L) ? "鍚堟牸" : "涓嶅悎鏍�"));
-
+            this.addProductSpotCheck(insSamples, order);
         }
 
-        // 鍙戦�佷紒涓氬井淇¢�氱煡
+        // 12.娣诲姞宸ユ椂
+        // 鍒犻櫎鍘熸湰璁㈠崟宸ユ椂
+        auxiliaryOutputWorkingHoursService.remove(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery()
+                .eq(AuxiliaryOutputWorkingHours::getOrderId, orderId));
+        // 鏌ヨ宸ユ椂鏆傚瓨
+        List<AuxiliaryOutputWorkingHoursTemporary> hoursTemporaries = auxiliaryOutputWorkingHoursTemporaryService.list(Wrappers.<AuxiliaryOutputWorkingHoursTemporary>lambdaQuery()
+                .eq(AuxiliaryOutputWorkingHoursTemporary::getOrderId, orderId));
+        List<AuxiliaryOutputWorkingHours> outputWorkingHours = hoursTemporaries.stream().map(hoursTemporary -> {
+            AuxiliaryOutputWorkingHours workingHours = new AuxiliaryOutputWorkingHours();
+            BeanUtil.copyProperties(hoursTemporary, workingHours);
+            workingHours.setId(null);
+            return workingHours;
+        }).collect(Collectors.toList());
+        auxiliaryOutputWorkingHoursService.saveBatch(outputWorkingHours);
+
+        // 13.娣诲姞璁㈠崟璐圭敤缁熻淇℃伅
+        List<InsProduct> productList = insProductMapper.selectProductByOrderId(orderId);
+        // 鍒犻櫎鍘熸湰璐圭敤淇℃伅
+        insOrderRatesService.remove(Wrappers.<InsOrderRates>lambdaQuery()
+                .eq(InsOrderRates::getInsOrderId, orderId));
+        List<InsOrderRates> orderRatesList = productList.stream().map(insProduct -> {
+            InsOrderRates insOrderRates = new InsOrderRates();
+            insOrderRates.setInsOrderId(orderId);
+            insOrderRates.setInsSampleId(insProduct.getInsSampleId());
+            insOrderRates.setInsProductId(Math.toIntExact(insProduct.getId()));
+            insOrderRates.setSampleCode(insProduct.getSampleCode());
+            insOrderRates.setEntrustCode(order.getEntrustCode());
+            insOrderRates.setInspectionItemClass(insProduct.getInspectionItemClass());
+            insOrderRates.setInspectionItem(insProduct.getInspectionItem());
+            insOrderRates.setInspectionItemSubclass(insProduct.getInspectionItemSubclass());
+            insOrderRates.setCableTag(insProduct.getCableTag());
+            insOrderRates.setRates(insProduct.getRates());
+            insOrderRates.setManHourGroup(insProduct.getManHourGroup());
+            return insOrderRates;
+        }).collect(Collectors.toList());
+        insOrderRatesService.saveBatch(orderRatesList);
+
+
+        // 14.鍙戦�佷紒涓氬井淇¢�氱煡
+        // 鏌ヨ鍘熸潗鏂�
+        IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(order.getIfsInventoryId());
+        // 鏌ヨ鏍峰搧淇℃伅
+        InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery()
+                .eq(InsSample::getInsOrderId, orderId)
+                .last("limit 1"));
         threadPoolTaskExecutor.execute(() -> {
             String message = "";
             message += "妫�楠屼换鍔″鏍搁�氱煡";
@@ -843,7 +935,7 @@
             }
         });
 
-        // ifs绉诲簱
+        // 15.ifs绉诲簱(鍘熸潗鏂欓渶瑕佽繘琛岀Щ搴撴搷浣�) --> 鏈�鍚庢墽琛�,鍥犱负澶辫触鏃犳硶鍥炴粴
         if (ifsInventoryQuantity != null) {
             // 鐧昏妫�楠岀粨鏋�
             // 鍒ゆ柇鏄惁鏈変笉鍚堟牸, 鏈変笉鍚堟牸涓嶈兘绉诲簱
@@ -867,56 +959,30 @@
         return 1;
     }
 
-    public int pxToCm(int px) {
-        return px / 9;
-    }
+    private void templateCopy(Integer orderId, List<Integer> ids) {
+        // 鍒犻櫎鍘熸湰妯℃澘
+        insOrderStandardTemplateService.remove(Wrappers.<InsOrderStandardTemplate>lambdaQuery()
+                .eq(InsOrderStandardTemplate::getInsOrderId, orderId));
+        // 澶嶅埗妯℃澘
+        Set<Integer> set = new HashSet<>();
+        List<InsProduct> insProductList = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
+                .in(InsProduct::getInsSampleId, ids)
+                .select(InsProduct::getTemplateId));
 
-    // 鑾峰彇涓や釜localDateTime鐨勬瘡涓�澶�
-    public static List<LocalDateTime> getLocalDateTimesBetween(LocalDateTime start, LocalDateTime end) {
-        List<LocalDateTime> localDateTimes = new ArrayList<>();
-        LocalDate currentDate = start.toLocalDate();
-        LocalDateTime currentLocalDateTime = start;
-        while (!currentDate.isAfter(end.toLocalDate())) {
-            localDateTimes.add(currentLocalDateTime);
-            currentLocalDateTime = currentLocalDateTime.plusDays(1);
-            currentDate = currentDate.plusDays(1);
-        }
-        return localDateTimes;
-    }
-
-    public static String getWeek(String dayStr) {
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        try {
-            Date date = sdf.parse(dayStr);
-            Calendar calendar = Calendar.getInstance();
-            calendar.setTime(date);
-            int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
-            int day = calendar.get(Calendar.DAY_OF_MONTH);
-            return getWeekDay(dayOfWeek);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return null;
-    }
-
-    public static String getWeekDay(int dayOfWeek) {
-        switch (dayOfWeek) {
-            case Calendar.MONDAY:
-                return "鍛ㄤ竴";
-            case Calendar.TUESDAY:
-                return "鍛ㄤ簩";
-            case Calendar.WEDNESDAY:
-                return "鍛ㄤ笁";
-            case Calendar.THURSDAY:
-                return "鍛ㄥ洓";
-            case Calendar.FRIDAY:
-                return "鍛ㄤ簲";
-            case Calendar.SATURDAY:
-                return "鍛ㄥ叚";
-            case Calendar.SUNDAY:
-                return "鍛ㄦ棩";
-            default:
-                return "鏈煡";
+        for (InsProduct product : insProductList) {
+            // 鏌ヨ妯℃澘id
+            if (product.getTemplateId() != null && set.add(product.getTemplateId())) {
+                StandardTemplate standardTemplate = standardTemplateService.getById(product.getTemplateId());
+                if (standardTemplate != null) {
+                    InsOrderStandardTemplate insOrderStandardTemplate = new InsOrderStandardTemplate();
+                    insOrderStandardTemplate.setInsOrderId(orderId);
+                    insOrderStandardTemplate.setTemplateId(standardTemplate.getId());
+                    insOrderStandardTemplate.setNumber(standardTemplate.getNumber());
+                    insOrderStandardTemplate.setName(standardTemplate.getName());
+                    insOrderStandardTemplate.setThing(standardTemplate.getThing());
+                    insOrderStandardTemplateService.save(insOrderStandardTemplate);
+                }
+            }
         }
     }
 
@@ -1055,7 +1121,6 @@
      * @param orderId
      */
     private void generateReport(Integer orderId) {
-        List<InsUnPass> insUnPasses = new ArrayList<>();
         /*鏍峰搧涓嬬殑椤圭洰鍙鏈変竴涓」鐩笉鍚堟牸鍒欐楠岀粨鏋滀负0,鍚﹀垯涓�1*/
         //杩欓噷鐨刬nsSamples鏄鍗曚笅鐨勬墍鏈夋牱鍝佸寘鎷�("/")
         List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId));
@@ -1071,25 +1136,7 @@
                 insSample.setInsResult(1);
             }
             insSampleMapper.updateById(insSample);
-            /*澶嶆牳閫氳繃鍚庯紝灏嗕笉鍚堟牸鐨勯」鐩俊鎭坊鍔犲埌ins_un_pass琛ㄤ腑*/
-            for (InsProduct insProduct : insProducts) {
-                if (insProduct.getInsResult() == 0) {
-                    InsUnPass insUnPass = new InsUnPass();
-                    insUnPass.setId(null);
-                    insUnPass.setModel(insSample.getModel());
-                    insUnPass.setSample(insSample.getSample());
-                    insUnPass.setInspectionItem(insProduct.getInspectionItem());
-                    insUnPass.setInspectionItemSubclass(insProduct.getInspectionItemSubclass());
-                    insUnPass.setLastValue(insProduct.getLastValue());
-                    insUnPass.setEntrustCode(insOrderMapper.selectById(orderId).getEntrustCode());
-                    List<Integer> userIds = insProductUserMapper.selectList(Wrappers.<InsProductUser>lambdaQuery().eq(InsProductUser::getInsProductId, insProduct.getId())).stream().map(InsProductUser::getCreateUser).distinct().collect(Collectors.toList());
-                    String name = userMapper.selectBatchIds(userIds).stream().map(User::getName).collect(Collectors.joining(","));
-                    insUnPass.setName(name);
-                    insUnPasses.add(insUnPass);
-                }
-            }
         }
-        insUnPassService.saveBatch(insUnPasses);
         InsOrder insOrder = insOrderMapper.selectById(orderId);
         // 鎶芥鍙樻垚濮旀墭妫�楠�
         if (insOrder.getOrderType().equals(InsOrderTypeConstants.SPOT_CHECK)) {
@@ -1511,7 +1558,8 @@
         // 妫�娴嬩緷鎹�
         Set<String> standardMethod = new HashSet<>();
         StringBuilder standardMethod2 = new StringBuilder();
-        standardMethod.add(baseMapper.getStandardMethodCode(insSample.getStandardMethodListId()));
+        // TODO 妫�楠岀殑瀵硅薄鐨勬楠屾爣鍑嗙敱涓�涓涓� 鏁版嵁绫诲瀷鐢眎nt鍙樺瓧绗︿覆 闇�瑕侀噸鍐欏啓杩欏潡閫昏緫
+//        standardMethod.add(baseMapper.getStandardMethodCode(insSample.getStandardMethodListId()));
         for (String s : standardMethod) {
             standardMethod2.append("銆�").append(s);
         }
@@ -2055,7 +2103,9 @@
         samples.forEach(a -> {
             Map<Integer, String> map2 = new HashMap<>();
             models.add(a.getModel());
-            String standardMethodCode = baseMapper.getStandardMethodCode(a.getStandardMethodListId());
+            // TODO 妫�楠岀殑瀵硅薄鐨勬楠屾爣鍑嗙敱涓�涓涓� 鏁版嵁绫诲瀷鐢眎nt鍙樺瓧绗︿覆 闇�瑕侀噸鍐欏啓杩欏潡閫昏緫
+//            String standardMethodCode = baseMapper.getStandardMethodCode(a.getStandardMethodListId());
+            String standardMethodCode = "";
             if (StrUtil.isNotBlank(a.getSpecialStandardMethod())) {
                 standardMethodCode = standardMethodCode + "+" + a.getSpecialStandardMethod();
             }
@@ -4001,7 +4051,7 @@
     }
 
     /**
-     * 淇濆瓨鍏冩闃块噷杩涜揣楠岃瘉鍘熷璁板綍
+     * *****淇濆瓨鍏冩闃块噷杩涜揣楠岃瘉鍘熷璁板綍*****
      * @param insOrderId 璁㈠崟Id
      * @param examineUserId  澶嶆牳浜篒d
      * @param writeUserId  妫�楠屽憳Id
@@ -4151,7 +4201,7 @@
 
 
     /**
-     * 鏍煎紡鍖栬繘鍘傞獙璇佸唴瀹�
+     * ***鏍煎紡鍖栬繘鍘傞獙璇佸唴瀹�****
      * @param basicType
      * @return
      */
@@ -4180,7 +4230,7 @@
     }
 
     /**
-     * word杞崲pdf
+     * ***word杞崲pdf***
      * @param path
      * @return
      */
@@ -4197,11 +4247,10 @@
         FileOutputStream os = null;
         try {
             //鍑瘉 涓嶇劧鍒囨崲鍚庢湁姘村嵃
-            InputStream is = Files.newInputStream(new File(licenseUrl).toPath());
+            InputStream is = new ClassPathResource("/lib/license.xml").getInputStream();
             License license = new License();
             license.setLicense(is);
             if (!license.getIsLicensed()) {
-                System.out.println("License楠岃瘉涓嶉�氳繃...");
                 return null;
             }
             //鐢熸垚涓�涓┖鐨凱DF鏂囦欢
@@ -4229,53 +4278,40 @@
     }
 
     /**
-     * 娣诲姞宸ユ椂
-     * @param userId
-     * @param insProduct
-     * @param insOrder
+     * *****淇敼鎴愬搧鎶芥牱鐘舵��******
+     * @param insSamples
+     * @param order
      */
-    private synchronized void addAuxiliary(Integer userId, InsProduct insProduct, InsOrder insOrder) {
-        if (insProduct.getIsBinding().equals(1)) {
-            return;
+    private void addProductSpotCheck(List<InsSample> insSamples, InsOrder order) {
+        Long unqualifiedCount = 0L;
+        if (CollectionUtils.isNotEmpty(insSamples)) {
+            unqualifiedCount = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery()
+                    .in(InsProduct::getInsSampleId, insSamples.stream().map(InsSample::getId).collect(Collectors.toList()))
+                    .eq(InsProduct::getInsResult, 0));
+
+            // 鍒ゆ柇濡傛灉鏈変笉鍚堟牸鐨勬楠岄」, 鍒ゆ柇鏈夋病鏈夋楠岄」澶嶆祴, 澶嶆牳鍚堟牸涔熺畻鍚堟牸閫氳繃
+            if (!unqualifiedCount.equals(0L)) {
+                List<InsProduct> productList = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
+                        .in(InsProduct::getInsSampleId, insSamples.stream().map(InsSample::getId).collect(Collectors.toList()))
+                        .eq(InsProduct::getInsResult, 0));
+
+                boolean flag = true;
+                for (InsProduct insProduct : productList) {
+                    Long unqualifiedProductCount = insUnqualifiedRetestProductMapper.selectCount(Wrappers.<InsUnqualifiedRetestProduct>lambdaQuery()
+                            .eq(InsUnqualifiedRetestProduct::getInsProductId, insProduct.getId())
+                            .ne(InsUnqualifiedRetestProduct::getInsResult, 0));
+                    if (unqualifiedProductCount != 2) {
+                        flag = false;
+                    }
+                }
+                if (flag) {
+                    unqualifiedCount = 0L;
+                }
+            }
         }
-
-        //棣栧厛鍒ゆ柇褰撳墠浜虹殑褰撳墠鏃堕棿鏄惁鏄帓鐝椂闂村唴,濡傛灉涓嶆槸灏辨槸鍔犵彮
-        LocalDateTime today = LocalDateTime.of(LocalDate.now(), LocalTime.MIDNIGHT);
-
-        //鏍¢獙濡傛灉杩欎釜浜鸿繖涓娴嬮」鐩凡缁忔坊鍔犺繃浜�
-        List<AuxiliaryOutputWorkingHours> count2s = auxiliaryOutputWorkingHoursMapper.selectList(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery()
-                .eq(AuxiliaryOutputWorkingHours::getCheck, userId)
-                .eq(AuxiliaryOutputWorkingHours::getInsProductId, insProduct.getId()));
-        if (CollectionUtils.isNotEmpty(count2s)) {
-            auxiliaryOutputWorkingHoursMapper.deleteBatchIds(count2s.stream().map(auxiliaryOutputWorkingHours -> auxiliaryOutputWorkingHours.getId()).collect(Collectors.toList()));
-        }
-        if (ObjectUtils.isNotEmpty(insProduct.getManHour()) && StringUtils.isNotBlank(insProduct.getLastValue())) {
-            AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHours();
-            auxiliaryOutputWorkingHours.setInspectionItemClass(insProduct.getInspectionItemClass());//妫�娴嬮」鍒嗙被
-            auxiliaryOutputWorkingHours.setInspectionItem(insProduct.getInspectionItem());//妫�娴嬬埗椤�
-            auxiliaryOutputWorkingHours.setInspectionItemSubclass(insProduct.getInspectionItemSubclass());//妫�娴嬪瓙椤�
-            auxiliaryOutputWorkingHours.setSample(insSampleMapper.selectById(insProduct.getInsSampleId()).getSampleCode());//鏍峰搧缂栧彿
-            auxiliaryOutputWorkingHours.setOrderId(insOrder.getId());//璁㈠崟id
-            auxiliaryOutputWorkingHours.setOrderNo(insOrder.getEntrustCode());//闈炲姞鐝鎵樺崟鍙�
-            auxiliaryOutputWorkingHours.setWorkTime(insProduct.getManHour());//闈炲姞鐝伐鏃�
-            auxiliaryOutputWorkingHours.setAmount(1);//闈炲姞鐝暟閲�
-            auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime()) ? auxiliaryOutputWorkingHours.getOvertimeWorkTime() : BigDecimal.ZERO).add(ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime()) ? auxiliaryOutputWorkingHours.getWorkTime() : BigDecimal.ZERO));//浜ч噺宸ユ椂
-            auxiliaryOutputWorkingHours.setManHourGroup(insProduct.getManHourGroup());//宸ユ椂鍒嗙粍
-            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-            DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-            auxiliaryOutputWorkingHours.setDateTime(LocalDateTime.now().toLocalDate().atStartOfDay().format(formatters));//鏃ユ湡
-            LocalDateTime localDateTime = LocalDateTime.now();
-            DateTime parse = DateUtil.parse(localDateTime.format(formatter));
-            auxiliaryOutputWorkingHours.setWeekDay(getWeek(localDateTime.format(formatters)));//鏄熸湡
-            auxiliaryOutputWorkingHours.setWeek(String.valueOf(DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1))));//鍛ㄦ
-            auxiliaryOutputWorkingHours.setCheck(userId);//妫�娴嬩汉
-            auxiliaryOutputWorkingHours.setPrice(insProduct.getPrice());//鍗曚环
-            auxiliaryOutputWorkingHours.setSampleId(insProduct.getInsSampleId());//鏍峰搧id
-            auxiliaryOutputWorkingHours.setInsProductId(insProduct.getId());//妫�楠岄」id
-
-            auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours);
-
-        }
+        spotCheckQuarterItemMapper.update(null, Wrappers.<SpotCheckQuarterItem>lambdaUpdate()
+                .eq(SpotCheckQuarterItem::getQuarterItemId, order.getQuarterItemId())
+                .set(SpotCheckQuarterItem::getResult, unqualifiedCount.equals(0L) ? "鍚堟牸" : "涓嶅悎鏍�"));
     }
 
 }

--
Gitblit v1.9.3