zhuo
2025-04-01 cb3ec598dc18e66b70a2cc9f7181c8be5bcf6e57
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
@@ -117,8 +117,6 @@
    @Resource
    private AuxiliaryOutputWorkingHoursService auxiliaryOutputWorkingHoursService;
    @Resource
    private AuxiliaryOutputWorkingHoursTemporaryService auxiliaryOutputWorkingHoursTemporaryService;
    @Resource
    private AuxiliaryOutputWorkingHoursMapper auxiliaryOutputWorkingHoursMapper;
    @Resource
    private InformationNotificationService informationNotificationService;
@@ -955,7 +953,7 @@
            // 查询ifs信息获取获取前10个供应商一样的, 检验项一样信息
            threadPoolTaskExecutor.execute(() -> {
                // 添加分析数据
                addAnalysis(productList, ifsInventoryQuantity, order);
                addAnalysis(productList, ifsInventoryQuantity, order, userName);
            });
@@ -983,13 +981,13 @@
     * @param ifsInventoryQuantity
     * @param order
     */
    private void addAnalysis(List<InsProduct> productList, IfsInventoryQuantity ifsInventoryQuantity, InsOrder order) {
    private void addAnalysis(List<InsProduct> productList, IfsInventoryQuantity ifsInventoryQuantity, InsOrder order, String userName) {
        for (InsProduct insProduct : productList) {
            // todo: 暂时判断是否是老化
            if (insProduct.getInspectionItem().contains("老化") && insProduct.getInsResult().equals(1)) {
            // 判断是否是数值类型
            if (insProduct.getInspectionValueType().equals("1") && insProduct.getInsResult().equals(1)) {
                List<InsProductDeviationWarningDetail> insProductAnalysisDtoList = insProductMapper.selectAnalysis(insProduct, ifsInventoryQuantity.getSupplierName());
                if (insProductAnalysisDtoList.size() < 10) {
                if (insProductAnalysisDtoList.size() < 5) {
                    continue;
                }
@@ -1026,6 +1024,7 @@
                        deviationWarningDetail.setSampleCode(insProduct.getSampleCode());
                        deviationWarningDetail.setSupplierName(ifsInventoryQuantity.getSupplierName());
                        deviationWarningDetail.setTestValue(insProduct.getLastValue());
                        deviationWarningDetail.setDetectionTime(insProduct.getCreateTime());
                        deviationWarningDetail.setIsIssue(1);
                        insProductAnalysisDtoList.add(deviationWarningDetail);
@@ -1037,22 +1036,26 @@
                        insProductDeviationWarningDetailService.saveBatch(insProductAnalysisDtoList);
                        //发送企业微信消息通知  检验项预警预警通知
                        try {
                            String message = "";
                            message += "检验项预警预警通知";
                            message += "\n委托编号: " + order.getEntrustCode();
                            message += "\n样品名称: " + order.getSample();
                            message += "\n规格型号: " + order.getPartDetail();
                            message += "\n批次号: " + ifsInventoryQuantity.getUpdateBatchNo();
                            message += "\n供应商名称: " + ifsInventoryQuantity.getSupplierName();
                            message += "\n检验项: " + insProduct.getInspectionItem() + insProduct.getInspectionItemSubclass();
                            message += "\n偏差超过了 10%";
                            // 发送给提交人
                            WxCpUtils.inform(userName, message, null);
//                    String message = "";
//                    message += "检验任务复核通知";
//                    message += "\n提交人: " + userName;
//                    message += "\n委托编号: " + order.getEntrustCode();
//                    message += "\n样品名称: " + insSample.getModel();
//                    message += "\n规格型号: " + order.getPartDetail();
//                    if (ifsInventoryQuantity != null) {
//                        message += "\n批次号: " + ifsInventoryQuantity.getUpdateBatchNo();
//                    }
//                    //发送企业微信消息通知  提交复核
//                    try {
//                        WxCpUtils.inform(sendUserAccount, message, null);
//                    } catch (Exception e) {
//                        throw new RuntimeException(e);
//                    }
                            // todo: 发送给检测中心主任(固定死)
                            WxCpUtils.inform("ZT-004704", message, null);
                        } catch (Exception e) {
                            e.printStackTrace();
                            log.error("偏差预警企业微信通知报错");
                        }
                    }
                }
            }
@@ -4449,16 +4452,16 @@
            return;
        }
        //首先判断当前人的当前时间是否是排班时间内,如果不是就是加班
        LocalDateTime today = LocalDateTime.of(LocalDate.now(), LocalTime.MIDNIGHT);
        //校验如果这个人这个检测项目已经添加过了
        List<AuxiliaryOutputWorkingHours> count2s = auxiliaryOutputWorkingHoursMapper.selectList(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery()
                .eq(AuxiliaryOutputWorkingHours::getCheck, userId)
                .eq(AuxiliaryOutputWorkingHours::getInsProductId, insProduct.getId()));
        if (CollectionUtils.isNotEmpty(count2s)) {
            auxiliaryOutputWorkingHoursMapper.deleteBatchIds(count2s.stream().map(auxiliaryOutputWorkingHours -> auxiliaryOutputWorkingHours.getId()).collect(Collectors.toList()));
            for (AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours : count2s) {
                auxiliaryOutputWorkingHours.setCheck(userId);//检测人
        }
            auxiliaryOutputWorkingHoursService.updateBatchById(count2s);
        } else {
        if (ObjectUtils.isNotEmpty(insProduct.getManHour()) && StringUtils.isNotBlank(insProduct.getLastValue())) {
            AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHours();
            auxiliaryOutputWorkingHours.setInspectionItemClass(insProduct.getInspectionItemClass());//检测项分类
@@ -4487,6 +4490,7 @@
        }
    }
    }
    public static String getWeek(String dayStr) {