zss
2024-08-09 bc3313efa51f00e128b6d9483becfd71df4e659d
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
@@ -3,7 +3,6 @@
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Console;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@@ -22,10 +21,11 @@
import com.deepoove.poi.data.*;
import com.deepoove.poi.data.style.*;
import com.deepoove.poi.util.TableTools;
import com.deepoove.poi.xwpf.WidthScalePattern;
import com.yuanchu.mom.common.GetLook;
import com.yuanchu.mom.common.PrintChina;
import com.yuanchu.mom.dto.*;
import com.yuanchu.mom.dto.ExcelDto;
import com.yuanchu.mom.dto.InsOrderPlanDTO;
import com.yuanchu.mom.dto.SampleProductDto;
import com.yuanchu.mom.exception.ErrorException;
import com.yuanchu.mom.mapper.*;
import com.yuanchu.mom.pojo.*;
@@ -33,27 +33,24 @@
import com.yuanchu.mom.utils.JackSonUtil;
import com.yuanchu.mom.utils.MatrixToImageWriter;
import com.yuanchu.mom.utils.QueryWrappers;
import com.yuanchu.mom.vo.InsOrderPlanTaskSwitchVo;
import com.yuanchu.mom.vo.InsOrderPlanVO;
import com.yuanchu.mom.vo.ProductVo;
import com.yuanchu.mom.vo.SampleVo;
import com.yuanchu.mom.utils.RedisUtil;
import com.yuanchu.mom.vo.*;
import org.apache.commons.io.IOUtils;
import org.apache.poi.xwpf.usermodel.*;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblWidth;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTblWidth;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.*;
import java.math.BigInteger;
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;
@@ -83,6 +80,10 @@
    private InsOrderStateMapper insOrderStateMapper;
    @Resource
    private InsProductMapper insProductMapper;
    @Resource
    private ShiftTimeMapper shiftTimeMapper;
    @Resource
    private PerformanceShiftMapper performanceShiftMapper;
    @Value("${wordUrl}")
    private String wordUrl;
@@ -104,6 +105,9 @@
    @Resource
    AuxiliaryOutputWorkingHoursMapper auxiliaryOutputWorkingHoursMapper;
    @Resource
    AuxiliaryOutputWorkingHoursService auxiliaryOutputWorkingHoursService;
    @Resource
    private InformationNotificationService informationNotificationService;
@@ -137,11 +141,29 @@
        Map<String, Object> map = new HashMap<>();
        map.put("head", PrintChina.printChina(InsOrderPlanVO.class));
        Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId(null);
        Integer userId = map1.get("userId");
        if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId())) {
            insOrderPlanDTO.setUserId(userId.longValue());
        User user = userMapper.selectById(map1.get("userId"));//当前登录的人
        //获取当前人所属实验室id
        String departLimsId = user.getDepartLimsId();
        String laboratory = null;
        if (ObjectUtils.isNotEmpty(departLimsId) && !departLimsId.equals("")) {
            String[] split = departLimsId.split(",");
            //查询对应架构名称(通信实验室,电力实验室,检测办)
            String departLims = baseMapper.seldepLimsId(Integer.parseInt(split[split.length - 1]));
            if (departLims.contains("实验室")) {
                laboratory = departLims;
            }
        }
        IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId);
        String userName = null;
        Integer userId = null;
        if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId())) {
            userId = map1.get("userId");
            userName = userMapper.selectById(map1.get("userId")).getName();
            insOrderPlanDTO.setUserId(null);
        }
        String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//试验室
        insOrderPlanDTO.setSonLaboratory(null);
        IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userName, sonLaboratory, laboratory);
        map.put("body", insOrderPage);
        return map;
    }
@@ -152,14 +174,29 @@
        map.put("head", PrintChina.printChina(InsOrderPlanTaskSwitchVo.class));
        Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId(null);
        Integer userId = map1.get("userId");
        User user = userMapper.selectById(map1.get("userId"));//当前登录的人
        //获取当前人所属实验室id
        String departLimsId = user.getDepartLimsId();
        String laboratory = null;
        if (ObjectUtils.isNotEmpty(departLimsId) && !departLimsId.equals("")) {
            String[] split = departLimsId.split(",");
            //查询对应架构名称(通信实验室,电力实验室,检测办)
            String departLims = baseMapper.seldepLimsId(Integer.parseInt(split[split.length - 1]));
            if (departLims.contains("实验室")) {
                laboratory = departLims;
            }
        }
        if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId())) {
            insOrderPlanDTO.setUserId(userId.longValue());
        }
        IPage<InsOrderPlanTaskSwitchVo> insOrderPage = insSampleMapper.inspectionOrderDetailsTaskSwitching(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId);
        String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//试验室
        IPage<InsOrderPlanTaskSwitchVo> insOrderPage = insSampleMapper.inspectionOrderDetailsTaskSwitching(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId, sonLaboratory, laboratory);
        map.put("body", insOrderPage);
        return map;
    }
    //认领任务
    @Override
    public boolean claimInsOrderPlan(InsOrderPlanDTO entity) {
        if (Objects.isNull(entity)) {
@@ -167,7 +204,7 @@
        }
        Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId(null);
        Integer userId = map1.get("userId");
        InsSampleUser insSampleUser = new InsSampleUser(entity.getInsSampleId().intValue(), userId, 1);
        InsSampleUser insSampleUser = new InsSampleUser(entity.getInsSampleId().intValue(), userId, 0, entity.getSonLaboratory());
        return insSampleUserMapper.insert(insSampleUser) > 0;
    }
@@ -192,18 +229,32 @@
    }
    @Override
    public List<InsProduct> getInsProduct(Integer id, Integer type, String laboratory) {
    public List<InsProduct> getInsProduct(Integer id, Integer type, String laboratory, HttpServletRequest request) {
        List<InsProduct> insProducts = new ArrayList<>();
        switch (type) {
            case 0:
                //样品
                insProducts = insSampleMapper.getInsProduct1(id, laboratory);
                break;
            case 1:
                //光纤带
                insProducts = insSampleMapper.getInsProduct2(id);
                break;
            case 2:
                //光纤
                insProducts = insSampleMapper.getInsProduct3(id);
                break;
            case 3:
                //套管
                insProducts = insSampleMapper.getInsProduct4(id);
                break;
        }
        //如果是大样品下的项目为空,那么查询第一个光纤的项目
        if (ObjectUtils.isEmpty(insProducts) && type==0){
            //查询第一个光纤的id
            List<InsFiber> insFibers = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().eq(InsFiber::getInsBushingId, insBushingMapper.selectList(Wrappers.<InsBushing>lambdaQuery().eq(InsBushing::getInsSampleId, id)).get(0).getId()));
            insProducts = insSampleMapper.getInsProduct3(insFibers.get(0).getId());
        }
        Set<Integer> set = new HashSet<>();
        Map<Integer, String> map2 = new HashMap<>();
@@ -217,7 +268,11 @@
        List<String> collect = new ArrayList<>();
        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).eq(InsProduct::getState, 1).eq(InsProduct::getInsResult, 0));
        List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
                .in(InsProduct::getInsSampleId, ids)
                .eq(InsProduct::getSonLaboratory, laboratory)
                .eq(InsProduct::getState, 1)
                .eq(InsProduct::getInsResult, 0));
        if (insProducts.size() > 0) {
            collect = insProducts.stream().map(insProduct -> {
                return insProduct.getInspectionItem() + "-" + insProduct.getInspectionItemSubclass();
@@ -279,22 +334,69 @@
        List<InsBushing> insBushings = insBushingMapper.selectList(Wrappers.<InsBushing>lambdaQuery().eq(InsBushing::getInsSampleId, sampleId));
        List<InsFibers> fibers = new ArrayList<>();
        List<InsFiber> fiber = new ArrayList<>();
        List<InsBushing> bush = new ArrayList<>();
        for (InsBushing insBushing : insBushings) {
            //再查询出所有的光纤带
            List<InsFibers> insFibers = insFibersMapper.selectList(Wrappers.<InsFibers>lambdaQuery().eq(InsFibers::getInsBushingId, insBushing.getId()));
            List<InsFiber> insFiberList = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().eq(InsFiber::getInsBushingId, insBushing.getId()));
            if (CollectionUtils.isNotEmpty(insFibers)) {
                for (InsFibers insFiber : insFibers) {
                    List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsFibersId, insFiber.getId()));
                    List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult)
                            .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm != 2).collect(Collectors.toList());
                    if (insProducts.size() == collect.size()) {
                        insFiber.setState(1);//已检验
                    } else {
                        insFiber.setState(0);//未检验
                    }
                }
                fibers.addAll(insFibers);
                //查出光纤带下所有的光纤
                List<InsFiber> fiberList = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().in(InsFiber::getInsFibersId, insFibers.stream().map(InsFibers::getId).collect(Collectors.toList())));
                for (InsFiber insFiber : fiberList) {
                    List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsFiberId, insFiber.getId()));
                    List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult)
                            .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm != 2).collect(Collectors.toList());
                    if (insProducts.size() == collect.size()) {
                        insFiber.setState(1);//已检验
                    } else {
                        insFiber.setState(0);//未检验
                    }
                }
                fiber.addAll(fiberList);
            } else {
                //如果套管下没有光纤带就只有光纤了
                List<InsFiber> insFiberList = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().eq(InsFiber::getInsBushingId, insBushing.getId()));
            }
            //如果套管下没有光纤带就只有光纤了
            else if (CollectionUtils.isNotEmpty(insFiberList)) {
                for (InsFiber insFiber : insFiberList) {
                    List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsFiberId, insFiber.getId()));
                    List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult)
                            .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm != 2).collect(Collectors.toList());
                    if (insProducts.size() == collect.size()) {
                        insFiber.setState(1);//已检验
                    } else {
                        insFiber.setState(0);//未检验
                    }
                }
                fiber.addAll(insFiberList);
            }
            //如果光纤带和光纤都没有就只有套管(松套管)
            else {
                List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
                        .eq(InsProduct::getInsBushId, insBushing.getId()));
                List<Integer> collect = insProducts.stream()
                        .map(InsProduct::getInsResult)
                        .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm != 2).collect(Collectors.toList());
                if (insProducts.size() == collect.size()) {
                    insBushing.setState(1);//已检验
                } else {
                    insBushing.setState(0);//未检验
                }
                bush.add(insBushing);
            }
        }
        map.put("光纤带", fibers);
        map.put("光纤", fiber);
        map.put("套管", bush);
        return map;
    }
@@ -309,14 +411,51 @@
        //先查出这个样品下有哪些管色标,光纤带,光纤色标
        //先查出套管
        List<InsBushing> insBushings = insBushingMapper.selectList(Wrappers.<InsBushing>lambdaQuery().eq(InsBushing::getInsSampleId, sampleId));
        for (InsBushing insBushing : insBushings) {
            //再查询出所有的光纤带
            List<InsFibers> insFibers = insFibersMapper.selectList(Wrappers.<InsFibers>lambdaQuery().eq(InsFibers::getInsBushingId, insBushing.getId()));
            if (CollectionUtils.isNotEmpty(insFibers)) {
                for (InsFibers insFiber : insFibers) {
                    //查出光纤带下所有的光纤
                    List<InsFiber> fiberList = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().eq(InsFiber::getInsFibersId, insFiber.getId()));
                    for (InsFiber fiber : fiberList) {
        if (insBushings.size() > 0) {
            //通信--温度循环
            for (InsBushing insBushing : insBushings) {
                //再查询出所有的光纤带
                List<InsFibers> insFibers = insFibersMapper.selectList(Wrappers.<InsFibers>lambdaQuery().eq(InsFibers::getInsBushingId, insBushing.getId()));
                if (CollectionUtils.isNotEmpty(insFibers)) {
                    for (InsFibers insFiber : insFibers) {
                        //查出光纤带下所有的光纤
                        List<InsFiber> fiberList = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().eq(InsFiber::getInsFibersId, insFiber.getId()));
                        for (InsFiber fiber : fiberList) {
                            //再根据关联的光纤配置的id和循环次数和温度和样品id进行查询检验项目
                            List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
                                    .eq(InsProduct::getInsSampleId, sampleId)
                                    .eq(InsProduct::getInspectionItem, inspectionItem)
                                    .eq(InsProduct::getInspectionItemSubclass, inspectionItemSubclass)
                                    .eq(InsProduct::getInsFiberId, fiber.getId()));
                            for (InsProduct insProduct : insProducts) {
                                InsProductResult insProductResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery()
                                        .eq(InsProductResult::getInsProductId, insProduct.getId()));
                                ProductVo productVo = new ProductVo();
                                productVo.setCode(insFiber.getCode());
                                productVo.setColor(fiber.getColor());
                                productVo.setBushColor(insBushing.getColor());
                                if (ObjectUtils.isNotEmpty(insProductResult)) {
                                    insProduct.setInsProductResult(insProductResult);
                                }
                                //求同等条件下1次循环20度常温的计算值
                                InsProductResult insProductResult1 = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery()
                                        .eq(InsProduct::getInsSampleId, sampleId)
                                        .eq(InsProduct::getInspectionItem, "1")
                                        .eq(InsProduct::getInspectionItemSubclass, "20℃(常温)")
                                        .eq(InsProduct::getInspectionItemClass, insProduct.getInspectionItemClass())
                                        .eq(InsProduct::getInsFiberId, fiber.getId())).getId()));
                                if (ObjectUtils.isNotEmpty(insProductResult1) && !insProductResult1.getComValue().equals("[]")) {
                                    insProduct.setComplue(insProductResult1.getComValue().split(":")[1].split("\"")[1]);
                                }
                                productVo.setInsProduct(insProduct);
                                productVos.add(productVo);
                            }
                        }
                    }
                } else {
                    //如果套管下没有光纤带就只有光纤了
                    List<InsFiber> insFiberList = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().eq(InsFiber::getInsBushingId, insBushing.getId()));
                    for (InsFiber fiber : insFiberList) {
                        //再根据关联的光纤配置的id和循环次数和温度和样品id进行查询检验项目
                        List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
                                .eq(InsProduct::getInsSampleId, sampleId)
@@ -326,42 +465,51 @@
                        for (InsProduct insProduct : insProducts) {
                            InsProductResult insProductResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProduct.getId()));
                            ProductVo productVo = new ProductVo();
                            productVo.setCode(insFiber.getCode());
                            productVo.setCode("-");
                            productVo.setColor(fiber.getColor());
                            productVo.setBushColor(fiber.getBushColor());
                            if (ObjectUtils.isNotEmpty(insProductResult)) {
                                insProduct.setInsProductResult(insProductResult);
                            insProduct.setInsProductResult(insProductResult);
                            //求同等条件下1次循环20度常温的计算值
                            InsProductResult insProductResult1 = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery()
                                    .eq(InsProduct::getInsSampleId, sampleId)
                                    .eq(InsProduct::getInspectionItem, "1")
                                    .eq(InsProduct::getInspectionItemSubclass, "20℃(常温)")
                                    .eq(InsProduct::getInspectionItemClass, insProduct.getInspectionItemClass())
                                    .eq(InsProduct::getInsFiberId, fiber.getId())).getId()));
                            if (ObjectUtils.isNotEmpty(insProductResult1) && !insProductResult1.getComValue().equals("[]")) {
                                insProduct.setComplue(insProductResult1.getComValue().split(":")[1].split("\"")[1]);
                            }
                            productVo.setInsProduct(insProduct);
                            productVos.add(productVo);
                        }
                    }
                }
            } else {
                //如果套管下没有光纤带就只有光纤了
                List<InsFiber> insFiberList = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().eq(InsFiber::getInsBushingId, insBushing.getId()));
                for (InsFiber fiber : insFiberList) {
                    //再根据关联的光纤配置的id和循环次数和温度和样品id进行查询检验项目
                    List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
                            .eq(InsProduct::getInsSampleId, sampleId)
                            .eq(InsProduct::getInspectionItem, inspectionItem)
                            .eq(InsProduct::getInspectionItemSubclass, inspectionItemSubclass)
                            .eq(InsProduct::getInsFiberId, fiber.getId()));
                    for (InsProduct insProduct : insProducts) {
                        InsProductResult insProductResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProduct.getId()));
                        ProductVo productVo = new ProductVo();
                        productVo.setCode("/");
                        productVo.setColor(fiber.getColor());
                        productVo.setBushColor(fiber.getBushColor());
                        insProduct.setInsProductResult(insProductResult);
                        productVo.setInsProduct(insProduct);
                        productVos.add(productVo);
                    }
            }
            productVos = productVos.stream().sorted(Comparator.comparing(productVo -> productVo.getInsProduct().getInspectionItemClass())).collect(Collectors.toList());
        } else {
            //电力--热循环和温升试验
            List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
                    .eq(InsProduct::getInsSampleId, sampleId)
                    .eq(InsProduct::getInspectionItem, inspectionItem));
            for (InsProduct insProduct : insProducts) {
                InsProductResult insProductResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProduct.getId()));
                ProductVo productVo = new ProductVo();
                if (ObjectUtils.isNotEmpty(insProductResult)) {
                    insProduct.setInsProductResult(insProductResult);
                }
                productVo.setInsProduct(insProduct);
                productVos.add(productVo);
            }
        }
        map.put("productVos", productVos);
        return map;
    }
    @Override
    public List<String> upPlanUser2(Integer orderId) {
        List<Integer> sampleId = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId)).stream().map(InsSample::getId).collect(Collectors.toList());
        List<String> sonLaboratory = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getState, 1).in(InsProduct::getInsSampleId, sampleId)).stream().map(InsProduct::getSonLaboratory).distinct().collect(Collectors.toList());
        return sonLaboratory;
    }
@@ -373,7 +521,9 @@
                JSONObject jo = JSON.parseObject(JSON.toJSONString(v));
                InsProduct insProduct = new InsProduct();
                insProduct.setId(Integer.parseInt(k));
                List<InsProductResult> results = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProduct.getId()));
                List<InsProductResult> results = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery()
                        .eq(InsProductResult::getInsProductId, insProduct.getId()));
                InsProduct product = insProductMapper.selectById(insProduct.getId());
                InsProductResult result;
                if (CollectionUtils.isEmpty(results)) {
                    result = new InsProductResult();
@@ -381,6 +531,16 @@
                    result = results.get(0);
                }
                result.setInsProductId(Integer.parseInt(k));
                /*校验一下result表*/
                List<InsProductResult> insProductResultss = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery()
                        .eq(InsProductResult::getInsProductId, insProduct.getId()));
                if (insProductResultss.size() > 1) {
                    for (int i = 1; i < insProductResultss.size(); i++) {
                        insProductResultMapper.deleteById(insProductResultss.get(i));
                    }
                }
                //InsProductResult insProductResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, Integer.parseInt(k)));
                //检验值
                if (jo.get("insValue") != null) {
                    JSONArray jsonArray = JSON.parseArray(JSON.toJSONString(jo.get("insValue")));
                    List<Map<String, Object>> iv = new ArrayList<>();
@@ -388,6 +548,9 @@
                        JSONObject insValue = JSON.parseObject(JSON.toJSONString(o));
                        Map<String, Object> map = new HashMap<>();
                        map.put("v", JSON.parseObject(JSON.toJSONString(insValue.get("v"))).get("v"));
                        map.put("r", JSON.toJSONString(insValue.get("r")));
                        map.put("c", JSON.toJSONString(insValue.get("c")));
                        map.put("w", insValue.get("w"));
                        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 + "");
@@ -400,6 +563,7 @@
                    }
                    result.setInsValue(JSON.toJSONString(iv));
                }
                //计算值
                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<>();
@@ -411,6 +575,7 @@
                    }
                    result.setComValue(JSON.toJSONString(cv));
                }
                //最终值
                try {
                    JSONObject resValue = JSON.parseObject(JSON.toJSONString(jo.get("resValue")));
                    if (resValue.get("v") != null) {
@@ -418,7 +583,9 @@
                        insProduct.setLastValue(o.equals("") ? null : (o.toString()));
                    }
                } catch (Exception e) {
                    insProduct.setLastValue("");//''
                }
                //设备编号
                if (jo.get("equipValue") != null) {
                    JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("equipValue")));
                    List<Map<String, Object>> ev = new ArrayList<>();
@@ -430,6 +597,7 @@
                    }
                    result.setEquipValue(JSON.toJSONString(ev));
                }
                //设备名称
                if (jo.get("equipName") != null) {
                    JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("equipName")));
                    List<Map<String, Object>> ev = new ArrayList<>();
@@ -441,11 +609,13 @@
                    }
                    result.setEquipName(JSON.toJSONString(ev));
                }
                //结论
                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) {
                    insProduct.setInsResult(2);//待定
                }
                if (BeanUtil.isEmpty(result.getId())) {
                    result.setCreateUser(userId);
@@ -456,6 +626,54 @@
                    result.setUpdateTime(LocalDateTime.now());
                    insProductResultMapper.updateById(result);
                }
                /*如果是第一次选择设备信息,且还有其余样品也有同一个经验项目,那么所有样品的该项目都用这个设备信息*/
                //先查询是否还有其余样品
                Integer insSampleId = product.getInsSampleId();
                List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, insSampleMapper.selectById(insSampleId).getInsOrderId()));
                //如果有多个样品或者是不是采集类型就同一个设备
                if (insSamples.size() > 1 && !product.getInspectionItemType().equals("1")) {
                    //存在其余样品,查询是否有同一种检验项目
                    for (InsSample sample : insSamples.stream().filter(insSample -> !insSample.getId().equals(insSampleId)).collect(Collectors.toList())) {
                        InsProduct product1 = insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery()
                                .eq(InsProduct::getState, 1)
                                .eq(InsProduct::getInsSampleId, sample.getId())
                                .eq(InsProduct::getInspectionItem, product.getInspectionItem())
                                .eq(InsProduct::getInspectionItemEn, product.getInspectionItemEn())
                                .eq(InsProduct::getInspectionItemSubclass, product.getInspectionItemSubclass())
                                .eq(InsProduct::getInspectionItemSubclassEn, product.getInspectionItemSubclassEn())
                                .eq(InsProduct::getTemplateId, product.getTemplateId())
                                .eq(InsProduct::getStandardMethodListId, product.getStandardMethodListId())
                                .eq(InsProduct::getInsBushId, product.getInsBushId())
                                .eq(InsProduct::getInsFibersId, product.getInsFibersId())
                                .eq(InsProduct::getInsFiberId, product.getInsFiberId())
                        );
                        if (ObjectUtils.isNotEmpty(product1)) {
                            //如果存在项目,查询是否有表
                            InsProductResult productResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery()
                                    .eq(InsProductResult::getInsProductId, product1.getId()));
                            if (ObjectUtils.isEmpty(productResult)) {
                                //没有表新建表
                                productResult = new InsProductResult();
                                productResult.setInsProductId(product1.getId());
                                productResult.setEquipValue(result.getEquipValue());
                                productResult.setEquipName(result.getEquipValue());
                                productResult.setCreateUser(userId);
                                productResult.setUpdateUser(userId);
                                insProductResultMapper.insert(productResult);
                            } else if (ObjectUtils.isEmpty(productResult.getEquipValue())) {
                                //有表判断是否有设备
                                productResult.setEquipValue(result.getEquipValue());
                                productResult.setEquipName(result.getEquipValue());
                                productResult.setUpdateUser(userId);
                                productResult.setUpdateTime(LocalDateTime.now());
                                insProductResultMapper.updateById(productResult);
                            }
                        }
                    }
                }
                insProduct.setUpdateUser(userId);
                insProductMapper.updateById(insProduct);
                insProductUserMapper.insert(new InsProductUser(null, userId, LocalDateTime.now(), insProduct.getId()));
@@ -465,28 +683,99 @@
                //查询检验单信息
                InsOrder insOrder = insOrderMapper.selectById(insSampleMapper.selectById(insProduct.getInsSampleId()).getInsOrderId());
                //校验如果这个人这个检测项目已经添加过了则不需要再新增
                Long count = auxiliaryOutputWorkingHoursMapper.selectCount(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery()
                        .eq(AuxiliaryOutputWorkingHours::getCheck, userId)
                        .eq(AuxiliaryOutputWorkingHours::getInspectProject, insProduct.getInspectionItemSubclass() + insProduct.getInspectionItem())
                        .eq(AuxiliaryOutputWorkingHours::getOrderNo, insOrder.getEntrustCode()));
                if (count == 0 && ObjectUtils.isNotEmpty(insProduct.getManHour())) {
                    //添加每个人的产量工时
                    AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHours();
                    auxiliaryOutputWorkingHours.setInspectProject(insProduct.getInspectionItemSubclass() + insProduct.getInspectionItem());//检测项目
                    auxiliaryOutputWorkingHours.setOrderNo(insOrder.getEntrustCode());//非加班委托单号
                    auxiliaryOutputWorkingHours.setWorkTime(insProduct.getManHour());//非加班工时
                    auxiliaryOutputWorkingHours.setAmount(1);//非加班数量
                    auxiliaryOutputWorkingHours.setOutputWorkTime(insProduct.getManHour());//产量工时
                    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);//检测人
                    auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours);
                //首先判断当前人的当前时间是否是排班时间内,如果不是就是加班
                LocalDateTime today = LocalDateTime.of(LocalDate.now(), LocalTime.MIDNIGHT);
                PerformanceShift performanceShift = performanceShiftMapper.selectOne(Wrappers.<PerformanceShift>lambdaQuery()
                        .eq(PerformanceShift::getUserId, userId)
                        .eq(PerformanceShift::getWorkTime, today));
                if (ObjectUtils.isNotEmpty(performanceShift)) {
                    ShiftTime shiftTime = shiftTimeMapper.selectOne(Wrappers.<ShiftTime>lambdaQuery().eq(ShiftTime::getShift, performanceShift.getShift()));
                    if (ObjectUtils.isNotEmpty(shiftTime)) {
                        DateTimeFormatter forma = DateTimeFormatter.ofPattern("HH:mm");
                        LocalTime now = LocalTime.now();
                        LocalTime startTime = LocalTime.parse(shiftTime.getStartTime(), forma);
                        LocalTime endTime = LocalTime.parse(shiftTime.getEndTime(), forma);
                        // 检查当前时间是否在范围内(包括边界)
                        boolean isWithinRange;
                        if (endTime.isAfter(startTime)) {
                            // 不跨天的情况
                            isWithinRange = !now.isBefore(startTime) && !now.isAfter(endTime);
                        } else {
                            // 跨天的情况
                            isWithinRange = !now.isBefore(startTime) || !now.isAfter(endTime);
                        }
                        //加班
                        List<AuxiliaryOutputWorkingHours> count1s = auxiliaryOutputWorkingHoursMapper.selectList(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery()
                                .eq(AuxiliaryOutputWorkingHours::getCheck, userId)
                                .eq(AuxiliaryOutputWorkingHours::getInspectionItem, insProduct.getInspectionItem())
                                .eq(AuxiliaryOutputWorkingHours::getInspectionItemSubclass, insProduct.getInspectionItemSubclass())
                                .eq(AuxiliaryOutputWorkingHours::getOvertimeOrderNo, insOrder.getEntrustCode())
                                .eq(AuxiliaryOutputWorkingHours::getSample, insSampleMapper.selectById(insProduct.getInsSampleId()).getSampleCode()));
                        if (count1s.size() > 1) {
                            for (int i = 1; i < count1s.size(); i++) {
                                auxiliaryOutputWorkingHoursMapper.deleteById(count1s.get(i));
                            }
                        }
                        //非加班
                        List<AuxiliaryOutputWorkingHours> count2s = auxiliaryOutputWorkingHoursMapper.selectList(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery()
                                .eq(AuxiliaryOutputWorkingHours::getCheck, userId)
                                .eq(AuxiliaryOutputWorkingHours::getInspectionItem, insProduct.getInspectionItem())
                                .eq(AuxiliaryOutputWorkingHours::getInspectionItemSubclass, insProduct.getInspectionItemSubclass())
                                .eq(AuxiliaryOutputWorkingHours::getOrderNo, insOrder.getEntrustCode())
                                .eq(AuxiliaryOutputWorkingHours::getSample, insSampleMapper.selectById(insProduct.getInsSampleId()).getSampleCode()));
                        if (count2s.size() > 1) {
                            for (int i = 1; i < count2s.size(); i++) {
                                auxiliaryOutputWorkingHoursMapper.deleteById(count2s.get(i));
                            }
                        }
                        if (ObjectUtils.isNotEmpty(insProduct.getManHour()) && CollectionUtils.isEmpty(count2s) && CollectionUtils.isEmpty(count1s)) {
                            AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHours();
                            if (isWithinRange) {
                                //在时间内就是正常上班
                                auxiliaryOutputWorkingHours.setInspectionItem(insProduct.getInspectionItem());//检测父项
                                auxiliaryOutputWorkingHours.setInspectionItemSubclass(insProduct.getInspectionItemSubclass());//检测子项
                                auxiliaryOutputWorkingHours.setSample(insSampleMapper.selectById(insProduct.getInsSampleId()).getSampleCode());//样品编号
                                auxiliaryOutputWorkingHours.setOrderNo(insOrder.getEntrustCode());//非加班委托单号
                                auxiliaryOutputWorkingHours.setWorkTime(insProduct.getManHour());//非加班工时
                                auxiliaryOutputWorkingHours.setAmount(1);//非加班数量
                                auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime()) ? auxiliaryOutputWorkingHours.getOvertimeWorkTime() : 0) + (ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime()) ? auxiliaryOutputWorkingHours.getWorkTime() : 0));//产量工时
                                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);//检测人
                            } else {
                                //加班
                                auxiliaryOutputWorkingHours.setInspectionItem(insProduct.getInspectionItem());//检测父项
                                auxiliaryOutputWorkingHours.setInspectionItemSubclass(insProduct.getInspectionItemSubclass());//检测子项
                                auxiliaryOutputWorkingHours.setSample(insSampleMapper.selectById(insProduct.getInsSampleId()).getSampleCode());//样品编号
                                auxiliaryOutputWorkingHours.setOvertimeOrderNo(insOrder.getEntrustCode());//加班委托单号
                                auxiliaryOutputWorkingHours.setOvertimeWorkTime(insProduct.getManHour());//加班工时
                                auxiliaryOutputWorkingHours.setOvertimeAmount(1);//加班数量
                                auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime()) ? auxiliaryOutputWorkingHours.getOvertimeWorkTime() : 0) + (ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime()) ? auxiliaryOutputWorkingHours.getWorkTime() : 0));//产量工时
                                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);//检测人
                            }
                            try {
                                if (CollectionUtils.isEmpty(insProductResultss) && !result.getInsValue().equals("[]") || (CollectionUtils.isNotEmpty(insProductResultss) && !insProductResultss.get(0).getInsValue().equals(result.getInsValue()) && !insProductResultss.get(0).getInsValue().equals("[]"))) {
                                    auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours);
                                }
                            }catch (Exception e){
                                System.out.println("工时新增不成功!!!");
                            }
                        }
                    }
                }
                InsSample insSample = insSampleMapper.selectById(insProductMapper.selectById(insProduct.getId()).getInsSampleId());
@@ -494,15 +783,23 @@
                Long l = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery()
                        .eq(InsProduct::getInsSampleId, insSample.getId()));
                Long l1 = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery()
                        .eq(InsProduct::getInsSampleId, insSample.getId()).isNotNull(InsProduct::getInsResult));
                        .eq(InsProduct::getInsSampleId, insSample.getId())
                        .and(wrapper -> wrapper
                                .isNotNull(InsProduct::getInsResult)
                                .or()
                                .ne(InsProduct::getInsResult, 2)
                        ));
                if (l == l1) {
                    insSample.setInsState(2);
                }
                insSampleMapper.updateById(insSample);
                /*校验一下result表*/
                List<InsProductResult> insProductResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProduct.getId()).orderByDesc(InsProductResult::getId));
                List<InsProductResult> insProductResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery()
                        .eq(InsProductResult::getInsProductId, insProduct.getId()));
                if (insProductResults.size() > 1) {
                    insProductResultMapper.deleteById(insProductResults.get(0));
                    for (int i = 1; i < insProductResults.size(); i++) {
                        insProductResultMapper.deleteById(insProductResults.get(i));
                    }
                }
            });
            return insContext.keySet().stream().findFirst().orElse(null);
@@ -516,8 +813,17 @@
                int orderId = insSampleMapper.selectById(sampleId).getInsOrderId();
                // 通过订单id查找所有样本id
                List<Integer> sampleIds = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId)).stream().map(InsSample::getId).collect(Collectors.toList());
                // 通过检查每一个样本id查到属于检验项结论 is null的数量
                Long count = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery().in(InsProduct::getInsSampleId, sampleIds).isNull(InsProduct::getInsResult).eq(InsProduct::getSonLaboratory, insProduct.getSonLaboratory()).eq(InsProduct::getState, 1));
                // 通过检查每一个样本id查到属于检验项结论 is null 或者 =2 的数量
                Long count = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery()
                        .in(InsProduct::getInsSampleId, sampleIds)
                        .and(wrapper -> wrapper
                                .isNull(InsProduct::getInsResult)
                                .or()
                                .eq(InsProduct::getInsResult, 2)
                        )
                        //.isNull(InsProduct::getInsResult)
                        .eq(InsProduct::getSonLaboratory, insProduct.getSonLaboratory())
                        .eq(InsProduct::getState, 1));
                if (count == 0) {
                    insOrderStateMapper.update(new InsOrderState(), Wrappers.<InsOrderState>lambdaUpdate()
                            .eq(InsOrderState::getInsOrderId, orderId)
@@ -531,12 +837,14 @@
        });
    }
    //交接
    @Override
    public int upPlanUser(Integer userId, Integer orderId) {
    public int upPlanUser(Integer userId, Integer orderId, String sonLaboratory) {
        InsSampleUser insSampleUser = new InsSampleUser();
        insSampleUser.setUserId(userId);
        insSampleUser.setInsSampleId(orderId);
        insSampleUser.setState(0);
        insSampleUser.setSonLaboratory(sonLaboratory);
        return insSampleUserMapper.insert(insSampleUser);
    }
@@ -738,8 +1046,48 @@
                                        textRenderData.setText("√");
                                        break;
                                    case 0:
                                        resultCh.set(resultCh.get() + "、" + p.getInspectionItem() + (Objects.equals(p.getInspectionItemSubclass(), "") ? "" : " " + p.getInspectionItemSubclass()));
                                        resultEn.set(resultEn.get() + "、" + p.getInspectionItemEn() + ((Objects.equals(p.getInspectionItemSubclassEn(), "") || Objects.equals(p.getInspectionItemSubclassEn(), null)) ? "" : " " + p.getInspectionItemSubclassEn()));
                                        String current = resultCh.get();
                                        // 使用 Set 来保持唯一项
                                        Set<String> uniqueItems = new HashSet<>();
                                        if (!current.isEmpty()) {
                                            // 分割当前字符串并加入到 Set 中
                                            String[] items = current.split("、");
                                            for (String item : items) {
                                                if (!item.isEmpty()) {
                                                    uniqueItems.add(item);
                                                }
                                            }
                                        }
                                        // 处理新数据
                                        String newItem = p.getInspectionItem() +
                                                (Objects.equals(p.getInspectionItemSubclass(), "") ? "" : " " + p.getInspectionItemSubclass());
                                        uniqueItems.add(newItem);
                                        // 连接唯一项并更新 AtomicReference
                                        String result = String.join("、", uniqueItems);
                                        resultCh.set(result);
                                        //resultCh.set(resultCh.get() + "、" + p.getInspectionItem() + (Objects.equals(p.getInspectionItemSubclass(), "") ? "" : " " + p.getInspectionItemSubclass()));
                                        String current1 = resultEn.get();
                                        // 使用 Set 来保持唯一项
                                        Set<String> uniqueItems1 = new HashSet<>();
                                        if (!current1.isEmpty()) {
                                            // 分割当前字符串并加入到 Set 中
                                            String[] items = current1.split("、");
                                            for (String item : items) {
                                                if (!item.isEmpty()) {
                                                    uniqueItems1.add(item);
                                                }
                                            }
                                        }
                                        // 处理新数据
                                        String newItem1 = p.getInspectionItemEn() +
                                                ((Objects.equals(p.getInspectionItemSubclassEn(), "") || Objects.equals(p.getInspectionItemSubclassEn(), null)) ? "" : " " + p.getInspectionItemSubclassEn());
                                        uniqueItems1.add(newItem1);
                                        // 连接唯一项并更新 AtomicReference
                                        String result1 = String.join("、", uniqueItems1);
                                        resultEn.set(result1);
                                        //resultEn.set(resultEn.get() + "、" + p.getInspectionItemEn() + ((Objects.equals(p.getInspectionItemSubclassEn(), "") || Objects.equals(p.getInspectionItemSubclassEn(), null)) ? "" : " " + p.getInspectionItemSubclassEn()));
                                        textRenderData.setText("×");
                                        break;
                                    default:
@@ -790,8 +1138,19 @@
                                        textRenderData.setText("✔");
                                        break;
                                    case 0:
                                        resultCh.set(resultCh.get() + "、" + p.getInspectionItem() + (p.getInspectionItemSubclass().equals("") ? "" : " " + p.getInspectionItemSubclass()));
                                        resultEn.set(resultEn.get() + "、" + p.getInspectionItemEn() + ((Objects.equals(p.getInspectionItemSubclassEn(), "") || Objects.equals(p.getInspectionItemSubclassEn(), null)) ? "" : " " + p.getInspectionItemSubclassEn()));
                                        Set<String> uniqueItems1 = new HashSet<>();
                                        Set<String> uniqueItems2 = new HashSet<>();
                                        String item1 = p.getInspectionItem() + (p.getInspectionItemSubclass().equals("") ? "" : " " + p.getInspectionItemSubclass());
                                        if (uniqueItems1.add(item1)) {
                                            resultCh.set(resultCh.get() + "、" + item1);
                                        }
                                        //resultCh.set(resultCh.get() + "、" + p.getInspectionItem() + (p.getInspectionItemSubclass().equals("") ? "" : " " + p.getInspectionItemSubclass()));
                                        String item2 = p.getInspectionItemEn() + ((Objects.equals(p.getInspectionItemSubclassEn(), "") || Objects.equals(p.getInspectionItemSubclassEn(), null)) ? "" : " " + p.getInspectionItemSubclassEn());
                                        if (uniqueItems2.add(item2)) {
                                            resultEn.set(resultEn.get() + "、" + item2);
                                        }
                                        //resultEn.set(resultEn.get() + "、" + );
                                        textRenderData.setText("✖");
                                        break;
                                    default:
@@ -808,7 +1167,7 @@
                                textRenderData.setText(v.get("v") == null ? "" : v.get("v") + "");
                            }
                        } else {
                            textRenderData.setText(v.get("v") == null ? "" : v.get("v") + "");
                            textRenderData.setText(v.get("v") == null ? "" : v.get("v") + "∑" + jo1.get("mc"));
                        }
                        if (jo1.get("mc") != null) {
                            textRenderData.setText(textRenderData.getText() + "∑" + jo1.get("mc"));
@@ -914,8 +1273,9 @@
                for (long i = 0; i < size; i++) {
                    if (i % number == 0) {
                        List<RowRenderData> rows = new ArrayList<>();
                        //表格的行数  √ ✖ ✔
                        for (int j = 0; j < number + 3; j++) {
                        //表格的行数 × √ ✖ ✔
                        long count1 = size - (index - 1) * number < number ? size - (index - 1) * number + 3 : number + 3;
                        for (int j = 0; j < count1; j++) {
                            RowRenderData rowRenderData = new RowRenderData();
                            RowStyle rowStyle = new RowStyle();
                            rowStyle.setHeight(40);
@@ -957,9 +1317,7 @@
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    }
                                }
                                else if (j == 1) {
                                } else if (j == 1) {
                                    //第二行
                                    if (k == 0) {
                                        //第一列
@@ -1002,8 +1360,7 @@
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    }
                                }
                                else if (j == number + 2) {
                                } else if (j == count1 - 1) {
                                    //最后一行
                                    if (k == 0 || k == 1) {
                                        //前两列
@@ -1014,15 +1371,14 @@
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    } else {
                                        textRenderData.setText("“✔”表示项目合格,“✖”表示项目不合格@“✔”indicates test Item is qualified,“✖”indicates test Item is unqualified∑19");
                                        textRenderData.setText("“√”表示项目合格,“×”表示项目不合格@“√”indicates test Item is qualified,“×”indicates test Item is unqualified∑19");
                                        renderData.add(textRenderData);
                                        paragraphRenderData.setContents(renderData);
                                        paragraphRenderDataList.add(paragraphRenderData);
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    }
                                }
                                else {
                                } else {
                                    if (k == 0) {
                                        //第一列
                                        textRenderData.setText((j - 1) + "");
@@ -1031,10 +1387,14 @@
                                        paragraphRenderDataList.add(paragraphRenderData);
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    }
                                    else if (k == 1) {
                                    } else if (k == 1) {
                                        //第二列
                                        String insProduct = filteredProducts.get((int) ((j - 2) + 10 * (index - 1)));
                                        String insProduct;
                                        try {
                                            insProduct = filteredProducts.get((int) ((j - 2) + 10 * (index - 1)));
                                        } catch (Exception e) {
                                            continue;
                                        }
                                        String[] split = insProduct.split(",");
                                        if (ObjectUtils.isEmpty(split[1]) || split[1].equals("")) {
                                            textRenderData.setText(split[0]);
@@ -1046,11 +1406,15 @@
                                        paragraphRenderDataList.add(paragraphRenderData);
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    }
                                    else if (k == 2) {
                                    } else if (k == 2) {
                                        //第三列
                                        //先判断检验项是否有子类
                                        String insProduct = filteredProducts.get((int) ((j - 2) + 10 * (index - 1)));
                                        String insProduct;
                                        try {
                                            insProduct = filteredProducts.get((int) ((j - 2) + 10 * (index - 1)));
                                        } catch (Exception e) {
                                            continue;
                                        }
                                        String[] split = insProduct.split(",");
                                        if (ObjectUtils.isEmpty(split[2]) || split[2].equals("")) {
                                            //如果没有子类
@@ -1069,11 +1433,15 @@
                                        paragraphRenderDataList.add(paragraphRenderData);
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    }
                                    else if (k == 3) {
                                    } else if (k == 3) {
                                        //第四列
                                        //先判断检验项是否有子类
                                        String insProduct = filteredProducts.get((int) ((j - 2) + 10 * (index - 1)));
                                        String insProduct;
                                        try {
                                            insProduct = filteredProducts.get((int) ((j - 2) + 10 * (index - 1)));
                                        } catch (Exception e) {
                                            continue;
                                        }
                                        String[] split = insProduct.split(",");
                                        if (ObjectUtils.isEmpty(split[2]) || split[2].equals("")) {
                                            //如果没有子类
@@ -1087,10 +1455,14 @@
                                        paragraphRenderDataList.add(paragraphRenderData);
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    }
                                    else if (k == 4) {
                                    } else if (k == 4) {
                                        //第五列
                                        String insProduct = filteredProducts.get((int) ((j - 2) + 10 * (index - 1)));
                                        String insProduct;
                                        try {
                                            insProduct = filteredProducts.get((int) ((j - 2) + 10 * (index - 1)));
                                        } catch (Exception e) {
                                            continue;
                                        }
                                        String[] split = insProduct.split(",");
                                        //查询所有样品该检验项的检验结果(最终值)
                                        List<InsProduct> products = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
@@ -1105,16 +1477,20 @@
                                        Optional<String> min = products.stream().map(InsProduct::getLastValue)
                                                .filter(value -> !value.isEmpty())
                                                .min(String::compareTo);
                                        textRenderData.setText(min+"-"+max);//检验结果
                                        textRenderData.setText(min.get() + "-" + max.get());//检验结果
                                        renderData.add(textRenderData);
                                        paragraphRenderData.setContents(renderData);
                                        paragraphRenderDataList.add(paragraphRenderData);
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    }
                                    else {
                                    } else {
                                        //最后一列
                                        String insProduct = filteredProducts.get((int) ((j - 2) + 10 * (index - 1)));
                                        String insProduct;
                                        try {
                                            insProduct = filteredProducts.get((int) ((j - 2) + 10 * (index - 1)));
                                        } catch (Exception e) {
                                            continue;
                                        }
                                        String[] split = insProduct.split(",");
                                        //查询所有样品该检验项的检验结论(ins_result)
                                        List<InsProduct> products = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
@@ -1125,10 +1501,10 @@
                                        List<Integer> result = products.stream().map(InsProduct::getInsResult).distinct().collect(Collectors.toList());
                                        if (result.size() == 1 && result.contains(1)) {
                                            //合格
                                            textRenderData.setText("✔");
                                        }else {
                                            textRenderData.setText("√");
                                        } else {
                                            //不合格
                                            textRenderData.setText("✖");
                                            textRenderData.setText("×");
                                        }
                                        renderData.add(textRenderData);
                                        paragraphRenderData.setContents(renderData);
@@ -1152,7 +1528,7 @@
                          }
                          System.out.println("");*/
                            if (row.getCells().size() != countSize) {
                                throw new ErrorException("每行单元格不相等");
                                throw new ErrorException("每行单元格不相等1");
                            }
                        }
                        TableStyle tableStyle = new TableStyle();
@@ -1178,7 +1554,7 @@
                long index4 = 1;
                //检验报告报告(当检验项目超过7个新建表)
                for (long j = 0; j < size; j++) {
                    if (j%number2==0){
                    if (j % number2 == 0) {
                        List<RowRenderData> rows = new ArrayList<>();
                        //表格的行数(根据样品数量来)
                        for (int i = 0; i < samples.size() + 2; i++) {
@@ -1204,9 +1580,9 @@
                                style.setFontFamily("宋体");
                                style.setColor("000000");
                                textRenderData.setStyle(style);
                                if (i==0){
                                if (i == 0) {
                                    //第一行
                                    if (k==0){
                                    if (k == 0) {
                                        //第一列
                                        textRenderData.setText("样品编号@Sample number∑30");
                                        renderData.add(textRenderData);
@@ -1214,22 +1590,26 @@
                                        paragraphRenderDataList.add(paragraphRenderData);
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    }
                                    else {
                                    } else {
                                        //第二列
                                        String product = filteredProducts.get((int) ((k - 1) + (index4 - 1) * 7));
                                        String product;
                                        try {
                                            product = filteredProducts.get((int) ((k - 1) + (index4 - 1) * 7));
                                        } catch (Exception e) {
                                            continue;
                                        }
                                        String[] split = product.split(",");
                                        if (ObjectUtils.isEmpty(split[2])||split[2].equals("")){
                                            if (ObjectUtils.isEmpty(split[1]) || split[1].equals("")){
                                                textRenderData.setText(split[0]+"∑3"+k);
                                            }else {
                                                textRenderData.setText(split[0]+"@"+split[1]+"∑3"+k);
                                        if (ObjectUtils.isEmpty(split[2]) || split[2].equals("")) {
                                            if (ObjectUtils.isEmpty(split[1]) || split[1].equals("")) {
                                                textRenderData.setText(split[0] + "∑3" + k);
                                            } else {
                                                textRenderData.setText(split[0] + "@" + split[1] + "∑3" + k);
                                            }
                                        }else {
                                            if (ObjectUtils.isEmpty(split[1]) || split[1].equals("")){
                                        } else {
                                            if (ObjectUtils.isEmpty(split[1]) || split[1].equals("")) {
                                                textRenderData.setText(split[0]);
                                            }else {
                                                textRenderData.setText(split[0]+"@"+split[1]);
                                            } else {
                                                textRenderData.setText(split[0] + "@" + split[1]);
                                            }
                                        }
                                        renderData.add(textRenderData);
@@ -1238,10 +1618,9 @@
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    }
                                }
                                else if (i==1){
                                } else if (i == 1) {
                                    //第二行
                                    if (k==0){
                                    if (k == 0) {
                                        //第一列
                                        textRenderData.setText("样品编号@Sample number∑30");
                                        renderData.add(textRenderData);
@@ -1249,22 +1628,26 @@
                                        paragraphRenderDataList.add(paragraphRenderData);
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    }
                                    else {
                                    } else {
                                        //第二列
                                        String product = filteredProducts.get((int) ((k - 1) + (index4 - 1) * 7));
                                        String product;
                                        try {
                                            product = filteredProducts.get((int) ((k - 1) + (index4 - 1) * 7));
                                        } catch (Exception e) {
                                            continue;
                                        }
                                        String[] split = product.split(",");
                                        if (ObjectUtils.isEmpty(split[2])||split[2].equals("")){
                                            if (ObjectUtils.isEmpty(split[1]) || split[1].equals("")){
                                                textRenderData.setText(split[0]+"∑3"+k);
                                            }else {
                                                textRenderData.setText(split[0]+"@"+split[1]+"∑3"+k);
                                        if (ObjectUtils.isEmpty(split[2]) || split[2].equals("")) {
                                            if (ObjectUtils.isEmpty(split[1]) || split[1].equals("")) {
                                                textRenderData.setText(split[0] + "∑3" + k);
                                            } else {
                                                textRenderData.setText(split[0] + "@" + split[1] + "∑3" + k);
                                            }
                                        }else {
                                            if (ObjectUtils.isEmpty(split[3]) || split[3].equals("")){
                                        } else {
                                            if (ObjectUtils.isEmpty(split[3]) || split[3].equals("")) {
                                                textRenderData.setText(split[2]);
                                            }else {
                                                textRenderData.setText(split[2]+"@"+split[3]);
                                            } else {
                                                textRenderData.setText(split[2] + "@" + split[3]);
                                            }
                                        }
                                        renderData.add(textRenderData);
@@ -1273,27 +1656,30 @@
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    }
                                }
                                else {
                                    if (k==0){
                                } else {
                                    if (k == 0) {
                                        //第一列
                                        textRenderData.setText(samples.get(i-2).getSampleCode());
                                        textRenderData.setText(samples.get(i - 2).getSampleCode());
                                        renderData.add(textRenderData);
                                        paragraphRenderData.setContents(renderData);
                                        paragraphRenderDataList.add(paragraphRenderData);
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    }
                                    else {
                                    } else {
                                        //根据样品编号和项目去查询最终值
                                        String product = filteredProducts.get((int) ((k - 1) + (index4 - 1) * 7));
                                        String product;
                                        try {
                                            product = filteredProducts.get((int) ((k - 1) + (index4 - 1) * 7));
                                        } catch (Exception e) {
                                            continue;
                                        }
                                        String[] split = product.split(",");
                                        InsProduct insProduct = insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery()
                                                .eq(InsProduct::getState, 1)
                                                .eq(InsProduct::getInsSampleId, samples.get(i - 2).getId())
                                                .eq(InsProduct::getInspectionItem, split[0])
                                                .eq(InsProduct::getInspectionItemSubclass, split[2]));
                                        if (ObjectUtils.isEmpty(insProduct)){
                                        if (ObjectUtils.isEmpty(insProduct)) {
                                            //可能根据正常的样品编号和光纤接头损耗的项目查不到对应的项目,则需要根据"/"来查
                                            List<InsSample> sampleList = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().like(InsSample::getSampleCode, samples.get(i - 2).getSampleCode()));
                                            List<InsProduct> products = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
@@ -1301,7 +1687,7 @@
                                                    .in(InsProduct::getInsSampleId, sampleList.stream().map(InsSample::getId).collect(Collectors.toList()))
                                                    .eq(InsProduct::getInspectionItem, split[0])
                                                    .eq(InsProduct::getInspectionItemSubclass, split[2]));
                                            insProduct=products.get(0);
                                            insProduct = products.get(0);
                                        }
                                        textRenderData.setText(insProduct.getLastValue());
                                        renderData.add(textRenderData);
@@ -1327,7 +1713,7 @@
                                }
                                System.out.println("");*/
                            if (row.getCells().size() != countSize) {
                                throw new ErrorException("每行单元格不相等");
                                throw new ErrorException("每行单元格不相等2");
                            }
                        }
                        TableStyle tableStyle = new TableStyle();
@@ -1355,12 +1741,14 @@
                List<InsSample> sampleList = insSamples.stream().filter(insSample -> insSample.getSampleCode().contains("/")).collect(Collectors.toList());
                //过滤出光纤接头损耗的检验项目
                List<String> strings = filteredProducts.stream().filter(s -> s.contains("光纤接头损耗")).distinct().collect(Collectors.toList());
                long index41 = 1;
                for (int i = 0; i < sampleList.size(); i++) {
                    if (i%16==0){
                    if (i % 16 == 0) {
                        //样品数量超过16需要新增表格
                        List<RowRenderData> rows = new ArrayList<>();
                        int count2 = sampleList.size() - (index41 - 1) * 16 < 16 ? (int) (sampleList.size() - (index41 - 1) * 16 + 1) : 17;
                        //表格的行数
                        for (int j = 0; j < 17; j++) {
                        for (int j = 0; j < count2; j++) {
                            RowRenderData rowRenderData = new RowRenderData();
                            RowStyle rowStyle = new RowStyle();
                            rowStyle.setHeight(40);
@@ -1383,9 +1771,9 @@
                                style.setFontFamily("宋体");
                                style.setColor("000000");
                                textRenderData.setStyle(style);
                                if (j==0){
                                if (j == 0) {
                                    //第一行
                                    if (k==0){
                                    if (k == 0) {
                                        //第一列
                                        textRenderData.setText("光纤类型@Fiber type");
                                        renderData.add(textRenderData);
@@ -1393,7 +1781,7 @@
                                        paragraphRenderDataList.add(paragraphRenderData);
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    }else if (k==1 || k==2){
                                    } else if (k == 1 || k == 2) {
                                        //第二 三列
                                        textRenderData.setText("样品编号@Sample number");
                                        renderData.add(textRenderData);
@@ -1401,12 +1789,12 @@
                                        paragraphRenderDataList.add(paragraphRenderData);
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    }else {
                                    } else {
                                        String[] split = strings.get(k - 3).split(",");
                                        if (ObjectUtils.isEmpty(split[3])|| split[3].equals("")){
                                        if (ObjectUtils.isEmpty(split[3]) || split[3].equals("")) {
                                            textRenderData.setText(split[2]);
                                        }else {
                                            textRenderData.setText(split[2]+"@"+split[3]);
                                        } else {
                                            textRenderData.setText(split[2] + "@" + split[3]);
                                        }
                                        renderData.add(textRenderData);
                                        paragraphRenderData.setContents(renderData);
@@ -1414,36 +1802,32 @@
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    }
                                }
                                else {
                                    if (k==0){
                                } else {
                                    if (k == 0) {
                                        //第一列
                                        textRenderData.setText(sampleList.get(0).getSampleCode()+"∑44");
                                        textRenderData.setText(sampleList.get(0).getModel() + "∑44");
                                        renderData.add(textRenderData);
                                        paragraphRenderData.setContents(renderData);
                                        paragraphRenderDataList.add(paragraphRenderData);
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    }
                                    else if (k==1){
                                    } else if (k == 1) {
                                        //第二列
                                        textRenderData.setText(sampleList.get(j-1).getSampleCode().split("/")[0]);
                                        textRenderData.setText(sampleList.get(j - 1).getSampleCode().split("/")[0]);
                                        renderData.add(textRenderData);
                                        paragraphRenderData.setContents(renderData);
                                        paragraphRenderDataList.add(paragraphRenderData);
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    }
                                    else if (k==2){
                                    } else if (k == 2) {
                                        //第三列
                                        textRenderData.setText(sampleList.get(j-1).getSampleCode().split("/")[1]);
                                        textRenderData.setText(sampleList.get(j - 1).getSampleCode().split("/")[1]);
                                        renderData.add(textRenderData);
                                        paragraphRenderData.setContents(renderData);
                                        paragraphRenderDataList.add(paragraphRenderData);
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    }
                                    else {
                                    } else {
                                        //根据对应的样品编号和检验项目查询对应数据(最终值)
                                        String[] split = strings.get(k - 3).split(",");
                                        InsProduct insProduct = insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery()
@@ -1474,7 +1858,7 @@
                                }
                                System.out.println("");*/
                            if (row.getCells().size() != countSize) {
                                throw new ErrorException("每行单元格不相等");
                                throw new ErrorException("每行单元格不相等3");
                            }
                        }
                        TableStyle tableStyle = new TableStyle();
@@ -1492,9 +1876,10 @@
                        Map<String, Object> table = new HashMap<>();
                        table.put("table4", tableRenderData);
                        table.put("report", insReport);
                        table.put("index4", index4+1);
                        table.put("index4", index4 + 1);
                        tables4.add(table);
                        index4++;
                        index41++;
                    }
                }
                tables4.forEach(table4 -> {
@@ -1554,6 +1939,9 @@
            try {
                signatureUrl = userMapper.selectById(userId).getSignatureUrl();
            } catch (Exception e) {
                throw new ErrorException("找不到检验人的签名");
            }
            if (ObjectUtils.isEmpty(signatureUrl) || signatureUrl.equals("")) {
                throw new ErrorException("找不到检验人的签名");
            }
            //Custom custom = customMapper.selectById(user.get("company"));
@@ -1762,7 +2150,7 @@
                                }
                                System.out.println("");*/
                                if (row.getCells().size() != countSize) {
                                    throw new ErrorException("每行单元格不相等");
                                    throw new ErrorException("每行单元格不相等4");
                                }
                            }
                            TableStyle tableStyle = new TableStyle();
@@ -2200,8 +2588,7 @@
                                if (rowRenderData.getCells().size() != 0) {
                                    rows.add(rowRenderData);
                                }
                            }
                            else {
                            } else {
                                //如果有多次循环
                                if (i == 0) {
                                    //第一次循环的列数,那么列数包括20℃常温(2 * (size-nm.size()) -nm.size()+1)
@@ -3044,7 +3431,7 @@
                            }
                            System.out.println("");*/
                            if (row.getCells().size() != countSize) {
                                throw new ErrorException("每行单元格不相等");
                                throw new ErrorException("每行单元格不相等5");
                            }
                        }
                        TableStyle tableStyle = new TableStyle();
@@ -3119,7 +3506,7 @@
                        put("createTime", now.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日")));
                        put("createTimeEn", monthNames[now.getMonthValue() - 1] + " " + now.getDayOfMonth() + ", " + now.getYear());
                        put("insTime", insOrder.getInsTime().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日")));
                        put("insTimeEn", monthNames[insOrder.getInsTime().getMonthValue() - 1] + " " + now.getDayOfMonth() + ", " + now.getYear());
                        put("insTimeEn", monthNames[insOrder.getInsTime().getMonthValue() - 1] + " " + insOrder.getInsTime().getDayOfMonth() + ", " + insOrder.getInsTime().getYear());
                        put("writeUrl", null);
                        put("insUrl", Pictures.ofLocal(imgUrl + "/" + signatureUrl).create());
                        put("images", images);
@@ -3244,6 +3631,10 @@
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        } else {
            //复核不通过将把复核的负责人去掉
            Integer id = insSampleUserMapper.selectOne(Wrappers.<InsSampleUser>lambdaQuery().eq(InsSampleUser::getInsSampleId, orderId).orderByDesc(InsSampleUser::getId).last("limit 1")).getId();
            insSampleUserMapper.deleteById(id);
        }
        return 1;
    }
@@ -3260,7 +3651,6 @@
                map2.put(product.getTemplateId(), standardTemplateService.getStandTempThingById(product.getTemplateId()) + "");
                thing = map2.get(product.getTemplateId());
            }
//            thing = map2.get(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")));
@@ -3276,10 +3666,20 @@
    }
    @Override
    public int submitPlan(Integer orderId, String laboratory, Integer verifyUser) {
    public int submitPlan(Integer orderId, String laboratory, Integer verifyUser, String entrustCode) {
        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).eq(InsProduct::getState, 1).isNull(InsProduct::getInsResult).isNull(InsProduct::getInsFiberId).isNull(InsProduct::getInsFibersId));
        List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
                .in(InsProduct::getInsSampleId, ids)
                .eq(InsProduct::getSonLaboratory, laboratory)
                .eq(InsProduct::getState, 1)
                .and(wrapper -> wrapper
                        .isNull(InsProduct::getInsResult)
                        .or()
                        .eq(InsProduct::getInsResult, 2)
                )
                .isNull(InsProduct::getInsFiberId)
                .isNull(InsProduct::getInsFibersId));
        insProducts.addAll(insProductMapper.selectFiberInsProduct(ids, laboratory));
        if (insProducts.size() > 0) {
            String str = "";
@@ -3290,6 +3690,24 @@
                    //查询那些循环温度的检验项目的结论是否全部检验
                    List<InsProduct> insProductList = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsSampleId, product.getInsSampleId())
                            .isNotNull(InsProduct::getInsFiberId).like(InsProduct::getInspectionItemSubclass, "℃"));
                    List<Integer> collect = insProductList.stream().filter(insProduct -> insProduct.getInsResult() != null).map(InsProduct::getInsResult).collect(Collectors.toList());
                    List<Integer> tt = new ArrayList<>();
                    tt.add(1);
                    if (collect.contains(0)) {
                        product.setLastValue("不合格");
                        product.setInsResult(0);
                    } else if (collect.size() == insProductList.size() && collect.stream().distinct().collect(Collectors.toList()).containsAll(tt)) {
                        product.setLastValue("合格");
                        product.setInsResult(1);
                    }
                    insProductMapper.updateById(product);
                }
                //如果是热循环或者是温升试验
                else if (product.getInspectionItem().equals("热循环") || product.getInspectionItem().equals("温升试验")) {
                    //查询这些项目下的其他检验项目是否全部检验
                    List<InsProduct> insProductList = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
                            .eq(InsProduct::getInsSampleId, product.getInsSampleId())
                            .like(InsProduct::getInspectionItemSubclass, "温度"));
                    List<Integer> collect = insProductList.stream().filter(insProduct -> insProduct.getInsResult() != null).map(InsProduct::getInsResult).collect(Collectors.toList());
                    List<Integer> tt = new ArrayList<>();
                    tt.add(1);
@@ -3322,18 +3740,30 @@
        info.setViewStatus(false);
        info.setJumpPath("b1-inspect-order-plan");
        informationNotificationService.addInformationNotification(info);
        upPlanUser(verifyUser, orderId);
        //复核人--检验单相关负责人
        InsSampleUser insSampleUser = new InsSampleUser();
        insSampleUser.setUserId(verifyUser);
        insSampleUser.setInsSampleId(orderId);
        insSampleUser.setState(1);
        insSampleUser.setSonLaboratory(laboratory);
        insSampleUserMapper.insert(insSampleUser);
        /*校验一下result表*/
        CompletableFuture.supplyAsync(() -> {
            List<Integer> ips = insProducts.stream().map(InsProduct::getId).distinct().collect(Collectors.toList());
            for (Integer ip : ips) {
                List<InsProductResult> insProductResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, ip).orderByDesc(InsProductResult::getId));
                List<InsProductResult> insProductResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery()
                        .eq(InsProductResult::getInsProductId, ip));
                if (insProductResults.size() > 1) {
                    insProductResultMapper.deleteById(insProductResults.get(0));
                    for (int i = 1; i < insProductResults.size(); i++) {
                        insProductResultMapper.deleteById(insProductResults.get(i));
                    }
                }
            }
            return null;
        });
        // 删除数采采集次数
        String key = "frequency" + ":" + entrustCode + ":*";
        RedisUtil.delsLike(key);
        return 1;
    }
@@ -3362,7 +3792,7 @@
            calendar.setTime(date);
            int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
            int day = calendar.get(Calendar.DAY_OF_MONTH);
            return day + " " + getWeekDay(dayOfWeek);
            return getWeekDay(dayOfWeek);
        } catch (Exception e) {
            e.printStackTrace();
        }