zss
2024-08-03 e78cc56f04556a1d3d54f0db830ba9f16eb28a58
检验下单待检撤销+删除检验值结论还在
已修改10个文件
257 ■■■■ 文件已修改
inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderController.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/mapper/InsProductMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/pojo/InsOrder.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/pojo/InsProduct.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/InsProductService.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java 90 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsProductServiceImpl.java 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/mapper/InsOrderMapper.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/mapper/InsProductMapper.xml 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/mapper/InsSampleMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderController.java
@@ -11,6 +11,7 @@
import com.yuanchu.mom.dto.SampleProductDto2;
import com.yuanchu.mom.pojo.InsOrder;
import com.yuanchu.mom.pojo.InsOrderTemplate;
import com.yuanchu.mom.pojo.InsProduct;
import com.yuanchu.mom.service.InsOrderService;
import com.yuanchu.mom.service.InsOrderTemplateService;
import com.yuanchu.mom.service.InsProductService;
@@ -161,11 +162,29 @@
        return Result.success();
    }
    //待检的撤销
    //待检的撤销的查询待检项目
    @ValueAuth
    @PostMapping("/selectNoProducts")
    public Result<?> selectNoProducts(@RequestBody Map<String, Object> data,Integer orderId ,String ids) throws Exception {
        Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class);
        InsProduct insProduct = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), InsProduct.class);
        return Result.success(insProductService.selectNoProducts(page, insProduct,orderId,ids));
    }
    @ApiOperation(value = "待检的撤销")
    @PutMapping("/updateInspected")
    @ValueAuth
    public Result<?> updateInspected(Integer id){
        insProductService.updateInspected(id);
    public Result<?> updateInspected(Integer orderId,String ids){
        insProductService.updateInspected(orderId,ids);
        return Result.success();
    }
    @ValueClassify("检验下单")
    @ApiOperation(value = "审核待检撤销")
    @PostMapping("/checkUpdate")
    public Result<?> checkUpdate(Integer orderId,Integer state){
        insProductService.checkUpdate(orderId,state);
        return Result.success();
    }
inspect-server/src/main/java/com/yuanchu/mom/mapper/InsProductMapper.java
@@ -1,5 +1,8 @@
package com.yuanchu.mom.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.mom.dto.ProductResultDto2;
import com.yuanchu.mom.pojo.InsProduct;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -25,6 +28,8 @@
    int updateInspected(@Param("id") Integer id);
    List<InsProduct> selectFiberInsProduct(List<Integer> ids, String laboratory);
    IPage<InsProduct> selectNoProducts(Page page, Integer orderId);
}
inspect-server/src/main/java/com/yuanchu/mom/pojo/InsOrder.java
@@ -215,4 +215,11 @@
    @ValueTableShow(value = 15, name = "委托人")
    private String prepareUser;
    @ApiModelProperty("是否审核撤销")
    private Integer isRevocation;
    @ApiModelProperty("审核撤销的项目id")
    private String revocationInsProductIds;
}
inspect-server/src/main/java/com/yuanchu/mom/pojo/InsProduct.java
@@ -3,6 +3,7 @@
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yuanchu.mom.annotation.ValueTableShow;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -26,9 +27,14 @@
    @TableId(type = IdType.AUTO)
    private Integer id;
    @ValueTableShow(value = 1, name = "样品编号")
    @TableField(exist = false,select = false)
    private String sampleCode;
    /**
     * 检验项
     */
    @ValueTableShow(value = 2, name = "检验项")
    private String inspectionItem;
    private String inspectionItemEn;
@@ -45,6 +51,7 @@
    /**
     * 检验项子类
     */
    @ValueTableShow(value = 2, name = "检验项子类")
    private String inspectionItemSubclass;
    private String inspectionItemSubclassEn;
@@ -62,16 +69,19 @@
    /**
     * 样品分类
     */
    @ValueTableShow(value = 3, name = "样品分类")
    private String sampleType;
    /**
     * 样品
     */
    @ValueTableShow(value = 4, name = "样品")
    private String sample;
    /**
     * 型号
     */
    @ValueTableShow(value = 5, name = "型号")
    private String model;
    private String methodS;
@@ -79,6 +89,7 @@
    /**
     * 子实验室
     */
    @ValueTableShow(value = 6, name = "试验室")
    private String sonLaboratory;
    /**
@@ -137,7 +148,7 @@
    private String method;
    /**
     * 预计时间(天)
     * 预计时间(h)
     */
    private Integer manDay;
@@ -149,11 +160,13 @@
    /**
     * 要求值
     */
    @ValueTableShow(value = 7, name = "要求值")
    private String ask;
    /**
     * 要求描述
     */
    @ValueTableShow(value = 8, name = "要求描述")
    private String tell;
    /**
inspect-server/src/main/java/com/yuanchu/mom/service/InsProductService.java
@@ -1,8 +1,11 @@
package com.yuanchu.mom.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.mom.dto.InsProductDto;
import com.yuanchu.mom.pojo.InsProduct;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.Map;
/**
* @author Administrator
@@ -13,8 +16,11 @@
    int selectOrderManDay(Integer orderId);
    int updateInspected(Integer id);
    int updateInspected(Integer id,String ids);
    boolean write(InsProductDto insProductDto);
    Map<String,Object> selectNoProducts(Page page, InsProduct insProduct,Integer orderId,String ids);
    void checkUpdate(Integer orderId,Integer state);
}
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
@@ -135,6 +135,7 @@
    @Resource
    private InsOrderFileMapper insOrderFileMapper;
    @Override
    public Map<String, Object> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) {
        Map<String, Object> map = new HashMap<>();
@@ -153,13 +154,13 @@
                laboratory = departLims;
            }
        }
        Integer userId =null;
        if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId()) ) {
        Integer userId = null;
        if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId())) {
            userId = map1.get("userId");
            insOrderPlanDTO.setUserId(userId.longValue());
        }
        String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//试验室
        IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId,sonLaboratory,laboratory);
        IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId, sonLaboratory, laboratory);
        map.put("body", insOrderPage);
        return map;
    }
@@ -187,7 +188,7 @@
            insOrderPlanDTO.setUserId(userId.longValue());
        }
        String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//试验室
        IPage<InsOrderPlanTaskSwitchVo> insOrderPage = insSampleMapper.inspectionOrderDetailsTaskSwitching(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId,sonLaboratory,laboratory);
        IPage<InsOrderPlanTaskSwitchVo> insOrderPage = insSampleMapper.inspectionOrderDetailsTaskSwitching(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId, sonLaboratory, laboratory);
        map.put("body", insOrderPage);
        return map;
    }
@@ -200,7 +201,7 @@
        }
        Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId(null);
        Integer userId = map1.get("userId");
        InsSampleUser insSampleUser = new InsSampleUser(entity.getInsSampleId().intValue(), userId, 1,entity.getSonLaboratory());
        InsSampleUser insSampleUser = new InsSampleUser(entity.getInsSampleId().intValue(), userId, 1, entity.getSonLaboratory());
        return insSampleUserMapper.insert(insSampleUser) > 0;
    }
@@ -251,7 +252,7 @@
    private List<InsProduct> getDeviceMessage(List<InsProduct> insProducts, HttpServletRequest request) {
        String ipAddress = request.getRemoteAddr();
        // 防止回环地址变为IPv6
        String ip =  ipAddress.equals("0:0:0:0:0:0:0:1") ? "127.0.0.1" : ipAddress;
        String ip = ipAddress.equals("0:0:0:0:0:0:0:1") ? "127.0.0.1" : ipAddress;
        insProducts.forEach(i -> {
            Map<String, Object> devices = baseMapper.getDeviceMessage(ip, i.getInspectionItem(), i.getInspectionItemSubclass(), i.getSampleType());
            if (ObjectUtils.isNotEmpty(devices) && ObjectUtils.isNotEmpty(devices.get("file_type")) && ObjectUtils.isNotEmpty(devices.get("collect_url"))) {
@@ -275,6 +276,7 @@
        });
        return insProducts;
    }
    @Override
    public List<String> checkSubmitPlan(Integer orderId, String laboratory) {
        List<String> collect = new ArrayList<>();
@@ -353,9 +355,9 @@
                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)).collect(Collectors.toList());
                    if (insProducts.size()==collect.size()) {
                    if (insProducts.size() == collect.size()) {
                        insFiber.setState(1);//已检验
                    }else {
                    } else {
                        insFiber.setState(0);//未检验
                    }
                }
@@ -365,9 +367,9 @@
                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)).collect(Collectors.toList());
                    if (insProducts.size()==collect.size()) {
                    if (insProducts.size() == collect.size()) {
                        insFiber.setState(1);//已检验
                    }else {
                    } else {
                        insFiber.setState(0);//未检验
                    }
                }
@@ -378,9 +380,9 @@
                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)).collect(Collectors.toList());
                    if (insProducts.size()==collect.size()) {
                    if (insProducts.size() == collect.size()) {
                        insFiber.setState(1);//已检验
                    }else {
                    } else {
                        insFiber.setState(0);//未检验
                    }
                }
@@ -403,7 +405,7 @@
        //先查出这个样品下有哪些管色标,光纤带,光纤色标
        //先查出套管
        List<InsBushing> insBushings = insBushingMapper.selectList(Wrappers.<InsBushing>lambdaQuery().eq(InsBushing::getInsSampleId, sampleId));
        if (insBushings.size()>0) {
        if (insBushings.size() > 0) {
            //通信--温度循环
            for (InsBushing insBushing : insBushings) {
                //再查询出所有的光纤带
@@ -430,13 +432,13 @@
                                    insProduct.setInsProductResult(insProductResult);
                                }
                                //求同等条件下1次循环20度常温的计算值
                                InsProductResult insProductResult1 = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId,insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery()
                                        .eq(InsProduct::getInsSampleId,sampleId)
                                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("[]")) {
                                        .eq(InsProduct::getInsFiberId, fiber.getId())).getId()));
                                if (ObjectUtils.isNotEmpty(insProductResult1) && !insProductResult1.getComValue().equals("[]")) {
                                    insProduct.setComplue(insProductResult1.getComValue().split(":")[1].split("\"")[1]);
                                }
                                productVo.setInsProduct(insProduct);
@@ -444,8 +446,7 @@
                            }
                        }
                    }
                }
                else {
                } else {
                    //如果套管下没有光纤带就只有光纤了
                    List<InsFiber> insFiberList = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().eq(InsFiber::getInsBushingId, insBushing.getId()));
                    for (InsFiber fiber : insFiberList) {
@@ -463,12 +464,12 @@
                            productVo.setBushColor(fiber.getBushColor());
                            insProduct.setInsProductResult(insProductResult);
                            //求同等条件下1次循环20度常温的计算值
                            InsProductResult insProductResult1 = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId,insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery()
                                    .eq(InsProduct::getInsSampleId,sampleId)
                            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() ));
                                    .eq(InsProduct::getInsFiberId, fiber.getId())).getId()));
                            if (ObjectUtils.isNotEmpty(insProductResult1) && !insProductResult1.getComValue().equals("[]")) {
                                insProduct.setComplue(insProductResult1.getComValue().split(":")[1].split("\"")[1]);
                            }
@@ -479,8 +480,7 @@
                }
            }
            productVos = productVos.stream().sorted(Comparator.comparing(productVo -> productVo.getInsProduct().getInspectionItemClass())).collect(Collectors.toList());
        }
        else {
        } else {
            //电力--热循环和温升试验
            List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
                    .eq(InsProduct::getInsSampleId, sampleId)
@@ -564,6 +564,7 @@
                        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")));
@@ -592,6 +593,7 @@
                    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);
@@ -616,9 +618,9 @@
                PerformanceShift performanceShift = performanceShiftMapper.selectOne(Wrappers.<PerformanceShift>lambdaQuery()
                        .eq(PerformanceShift::getUserId, userId)
                        .eq(PerformanceShift::getWorkTime, today));
                if (ObjectUtils.isNotEmpty(performanceShift)){
                if (ObjectUtils.isNotEmpty(performanceShift)) {
                    ShiftTime shiftTime = shiftTimeMapper.selectOne(Wrappers.<ShiftTime>lambdaQuery().eq(ShiftTime::getShift, performanceShift.getShift()));
                    if (ObjectUtils.isNotEmpty(shiftTime)){
                    if (ObjectUtils.isNotEmpty(shiftTime)) {
                        DateTimeFormatter forma = DateTimeFormatter.ofPattern("HH:mm");
                        LocalTime now = LocalTime.now();
                        LocalTime startTime = LocalTime.parse(shiftTime.getStartTime(), forma);
@@ -644,7 +646,7 @@
                                .eq(AuxiliaryOutputWorkingHours::getInspectionItem, insProduct.getInspectionItem())
                                .eq(AuxiliaryOutputWorkingHours::getInspectionItemSubclass, insProduct.getInspectionItemSubclass())
                                .eq(AuxiliaryOutputWorkingHours::getOrderNo, insOrder.getEntrustCode()));
                        if (ObjectUtils.isNotEmpty(insProduct.getManHour())&& ObjectUtils.isEmpty(count2) && ObjectUtils.isEmpty(count1)) {
                        if (ObjectUtils.isNotEmpty(insProduct.getManHour()) && ObjectUtils.isEmpty(count2) && ObjectUtils.isEmpty(count1)) {
                            AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHours();
                            if (isWithinRange) {
                                //在时间内就是正常上班
@@ -654,7 +656,7 @@
                                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.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");
@@ -672,7 +674,7 @@
                                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.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");
@@ -734,7 +736,7 @@
    //交接
    @Override
    public int upPlanUser(Integer userId, Integer orderId,String sonLaboratory) {
    public int upPlanUser(Integer userId, Integer orderId, String sonLaboratory) {
        InsSampleUser insSampleUser = new InsSampleUser();
        insSampleUser.setUserId(userId);
        insSampleUser.setInsSampleId(orderId);
@@ -1118,8 +1120,8 @@
                    if (i % number == 0) {
                        List<RowRenderData> rows = new ArrayList<>();
                        //表格的行数 × √ ✖ ✔
                        long count1 = size-(index-1)*number < number ? size-(index-1)*number + 3 : number + 3;
                        for (int j = 0; j <count1 ; 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);
@@ -1161,8 +1163,7 @@
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    }
                                }
                                else if (j == 1) {
                                } else if (j == 1) {
                                    //第二行
                                    if (k == 0) {
                                        //第一列
@@ -1205,8 +1206,7 @@
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    }
                                }
                                else if (j == count1-1) {
                                } else if (j == count1 - 1) {
                                    //最后一行
                                    if (k == 0 || k == 1) {
                                        //前两列
@@ -1224,8 +1224,7 @@
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    }
                                }
                                else {
                                } else {
                                    if (k == 0) {
                                        //第一列
                                        textRenderData.setText((j - 1) + "");
@@ -1593,7 +1592,7 @@
                    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;
                        int count2 = sampleList.size() - (index41 - 1) * 16 < 16 ? (int) (sampleList.size() - (index41 - 1) * 16 + 1) : 17;
                        //表格的行数
                        for (int j = 0; j < count2; j++) {
                            RowRenderData rowRenderData = new RowRenderData();
@@ -1649,8 +1648,7 @@
                                        cellRenderData.setParagraphs(paragraphRenderDataList);
                                        cells.add(cellRenderData);
                                    }
                                }
                                else {
                                } else {
                                    if (k == 0) {
                                        //第一列
                                        textRenderData.setText(sampleList.get(0).getModel() + "∑44");
@@ -1789,7 +1787,7 @@
            } catch (Exception e) {
                throw new ErrorException("找不到检验人的签名");
            }
            if (ObjectUtils.isEmpty(signatureUrl)  || signatureUrl.equals("")) {
            if (ObjectUtils.isEmpty(signatureUrl) || signatureUrl.equals("")) {
                throw new ErrorException("找不到检验人的签名");
            }
            //Custom custom = customMapper.selectById(user.get("company"));
@@ -3479,8 +3477,7 @@
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        else {
        } else {
            //复核不通过将把复核的负责人去掉
            Integer id = insSampleUserMapper.selectOne(Wrappers.<InsSampleUser>lambdaQuery().eq(InsSampleUser::getInsSampleId, orderId).orderByDesc(InsSampleUser::getId).last("limit 1")).getId();
            insSampleUserMapper.deleteById(id);
@@ -3548,7 +3545,7 @@
                    insProductMapper.updateById(product);
                }
                //如果是热循环或者是温升试验
                else if (product.getInspectionItem().equals("热循环") || product.getInspectionItem().equals("温升试验")){
                else if (product.getInspectionItem().equals("热循环") || product.getInspectionItem().equals("温升试验")) {
                    //查询这些项目下的其他检验项目是否全部检验
                    List<InsProduct> insProductList = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
                            .eq(InsProduct::getInsSampleId, product.getInsSampleId())
@@ -3564,8 +3561,7 @@
                        product.setInsResult(1);
                    }
                    insProductMapper.updateById(product);
                }
                else {
                } else {
                    count++;
                    str += "<br/>" + count + ":" + product.getInspectionItem() + " " + product.getInspectionItemSubclass() + "<br/>";
                }
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsProductServiceImpl.java
@@ -1,14 +1,27 @@
package com.yuanchu.mom.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.mom.common.PrintChina;
import com.yuanchu.mom.dto.InsProductDto;
import com.yuanchu.mom.exception.ErrorException;
import com.yuanchu.mom.mapper.InsOrderMapper;
import com.yuanchu.mom.mapper.InsProductMapper;
import com.yuanchu.mom.mapper.InsSampleMapper;
import com.yuanchu.mom.pojo.InsOrder;
import com.yuanchu.mom.pojo.InsProduct;
import com.yuanchu.mom.pojo.InsSample;
import com.yuanchu.mom.service.InsProductService;
import com.yuanchu.mom.utils.QueryWrappers;
import com.yuanchu.mom.vo.InsOrderPlanVO;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
@Service
@AllArgsConstructor
@@ -17,26 +30,86 @@
    private InsProductMapper insProductMapper;
    private InsOrderMapper insOrderMapper;
    private InsSampleMapper insSampleMapper;
    @Override
    public int selectOrderManDay(Integer orderId) {
        return insProductMapper.selectOrderManDay(orderId);
    }
    @Override
    public int updateInspected(Integer id) {
        insProductMapper.updateInspected(id);
        return 0;
    public int updateInspected(Integer id, String ids) {
        InsOrder insOrder = new InsOrder();
        insOrder.setId(id);
        insOrder.setIsRevocation(1);//需要审核
        insOrder.setRevocationInsProductIds(ids);
        return insOrderMapper.updateById(insOrder);
    }
    @Override
    public boolean write(InsProductDto insProductDto) {
        List<InsProduct> insProducts = baseMapper.selectBatchIds(insProductDto.getIds());
        for (InsProduct insProduct : insProducts) {
           insProduct.setTemperature(insProductDto.getTemperature());
           insProduct.setHumidity(insProductDto.getHumidity());
            insProduct.setTemperature(insProductDto.getTemperature());
            insProduct.setHumidity(insProductDto.getHumidity());
        }
        return updateBatchById(insProducts);
    }
    //查询待检项目
    @Override
    public Map<String, Object> selectNoProducts(Page page, InsProduct insProduct, Integer orderId, String ids) {
        Map<String, Object> map = new HashMap<>();
        map.put("head", PrintChina.printChina(InsProduct.class));
        IPage<InsProduct> insProductIPage = baseMapper.selectNoProducts(page, orderId);
        if (ObjectUtils.isNotEmpty(ids)) {
            List<Integer> collect = Arrays.asList(ids.split(",")).stream()
                    .map(Integer::parseInt)
                    .collect(Collectors.toList());
            List<InsProduct> products = insProductIPage.getRecords().stream().filter(record -> collect.contains(record.getId())).collect(Collectors.toList());
            insProductIPage.setRecords(products);
        }
        map.put("body", insProductIPage);
        return map;
    }
    //审核待检撤销
    @Override
    public void checkUpdate(Integer orderId, Integer state) {
        InsOrder insOrder = insOrderMapper.selectById(orderId);
        if (state == 1) {
            List<String> list = new ArrayList<>();
            try {
                list = Arrays.asList(insOrder.getRevocationInsProductIds().split(","));
            } catch (Exception e) {
                throw new ErrorException("还没有选择应该要撤销的检验项目");
            }
            List<Integer> ids = list.stream()
                    .map(Integer::parseInt)
                    .collect(Collectors.toList());
            List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId));
            List<Integer> collect = insSamples.stream().map(InsSample::getId).collect(Collectors.toList());
            List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getState, 1).in(InsProduct::getInsSampleId, collect));
            if (insProducts.stream().map(InsProduct::getId).collect(Collectors.toList()).equals(ids)) {
                //如果该检验单下的所有项目全部都撤销,那么这个单子也需要撤销
                insOrder.setState(3);
            } else {
                List<InsProduct> products = insProductMapper.selectBatchIds(ids);
                //首先根据选择的项目id进行撤销项目
                updateBatchById(products.stream().map(insProduct -> {
                    insProduct.setState(0);
                    return insProduct;
                }).collect(Collectors.toList()));
            }
            //insProductMapper.updateInspected(id);
        }
        //不通过
        insOrder.setIsRevocation(0);
        insOrderMapper.updateById(insOrder);
    }
}
inspect-server/src/main/resources/mapper/InsOrderMapper.xml
@@ -19,6 +19,8 @@
        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
        <result property="updateUser" column="update_user" jdbcType="INTEGER"/>
        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
        <result property="revocationInsProductIds" column="revocation_ins_product_ids" />
        <result property="isRevocation" column="is_revocation" />
    </resultMap>
    <resultMap id="OrderThingDto" type="com.yuanchu.mom.dto.OrderThingDto">
inspect-server/src/main/resources/mapper/InsProductMapper.xml
@@ -3,7 +3,6 @@
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yuanchu.mom.mapper.InsProductMapper">
    <resultMap id="BaseResultMap" type="com.yuanchu.mom.pojo.InsProduct">
        <id property="id" column="id" jdbcType="INTEGER"/>
        <result property="inspectionItem" column="inspection_item" jdbcType="VARCHAR"/>
@@ -78,7 +77,7 @@
               io.entrust_code,
               ipr.update_time,
               ip.ins_result,
               u.name updateUserName
               u.name         updateUserName
        from ins_product ip
                 left join ins_product_result ipr on ip.id = ipr.ins_product_id
                 left join ins_sample isa on isa.id = ip.ins_sample_id
@@ -86,7 +85,7 @@
                 left join user u on u.id = ipr.update_user
        where ip.ins_sample_id = #{sampleId}
          and ip.ins_result is not null
        and template_id is not null
          and template_id is not null
    </select>
    <select id="selectFiberInsProduct" resultType="com.yuanchu.mom.pojo.InsProduct">
        select * from ins_product
@@ -99,4 +98,13 @@
            #{item}
        </foreach>
    </select>
    <select id="selectNoProducts" resultType="com.yuanchu.mom.pojo.InsProduct">
        select *
        from (select ip.*, sample_code
              from ins_product ip
                       left join ins_sample is2 on ip.ins_sample_id = is2.id
              where ip.ins_result is null
                and state = 1
                and is2.ins_order_id = #{orderId}) A
    </select>
</mapper>
inspect-server/src/main/resources/mapper/InsSampleMapper.xml
@@ -27,7 +27,7 @@
    <select id="findInsSampleAndOrder" resultType="com.yuanchu.mom.vo.InsOrderPlanVO">
        select * from(select * from(
        SELECT
        a.*,ios.ins_state,ios.verify_tell,isu2.order_user_id,<!--(ios.verify_user = #{userId})--> verify_user
        a.*,ios.ins_state,ios.verify_tell,isu2.order_user_id,verify_user
        FROM
        (
        SELECT
@@ -45,7 +45,7 @@
        FROM
        ins_order io
        LEFT JOIN ins_sample isa ON isa.ins_order_id = io.id
        LEFT JOIN ( <!--SELECT * FROM ins_sample_user GROUP BY ins_sample_id, user_id -->
        LEFT JOIN (
        SELECT *
        FROM ins_sample_user u
        WHERE son_laboratory=#{sonLaboratory} and (ins_sample_id, id) IN (
@@ -60,7 +60,6 @@
        LEFT JOIN user ON isu.user_id = user.id
        WHERE
        io.state = 1
        # AND io.ins_state != 5
        and send_time is not null
        <if test="userId !=null and userId!=''">
            and (isu.user_id = #{userId} OR isu.user_id is NULL )
@@ -81,7 +80,6 @@
        ) isu2 on
        isu2.ins_sample_id = a.id
        ORDER BY
        <!--a.user_id DESC,-->
        a.type DESC,
        a.id
        ) b