89536a3b40beed6619d02306bcfc3c96b3c3ec9c..61f34419e094f2363276d614a960b379cc456482
2025-05-20 zhuo
业务代码合并
61f344 对比 | 目录
2025-05-20 zhuo
其他功能合并
112d96 对比 | 目录
已修改97个文件
已添加10个文件
1674 ■■■■ 文件已修改
basic-server/src/main/java/com/ruoyi/basic/controller/CapacityScopeController.java 244 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/mapper/StructureItemParameterMapper.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/pojo/StructureItemParameter.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/StructureItemParameterService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/impl/StructureItemParameterServiceImpl.java 272 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-device/src/main/java/com/ruoyi/device/mapper/DeviceMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceAcceptanceServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceAccidentReportServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceBreakdownMaintenanceServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceCalibrationPlanServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceExaminePlanServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceExamineRecordContrastServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceExamineRecordServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceExternalApplyServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceImpowerServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceInspectionRecordServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceMaintenanceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceMaintenancePlanServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceRecordServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceScrappedServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceServiceImpl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceStateServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceTraceabilityManagementServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-device/src/main/java/com/ruoyi/device/task/DeviceRecordSchedule.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-device/src/main/resources/mapper/DeviceMapper.xml 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-manage/src/main/java/com/ruoyi/manage/schedule/ManageRecordTotalSchedule.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ClientSatisfactionServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/InternalCheckServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/InternalCorrectServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/InternalImplementServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/InternalMeetingServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/InternalPlanServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/InternalReportServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageControlPlanListServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageMeetingServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageRecordAuditServiceImpl.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageRecordCancelServiceImpl.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageRecordCheckServiceImpl.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageRecordIntervalsServiceImpl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageRecordIntervalsTotalServiceImpl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageRecordIssueRecycleServiceImpl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageRecordTotalServiceImpl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageReviewProgramServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageReviewReportServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageRiskAssessmentResultsServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-personnel/src/main/java/com/ruoyi/personnel/service/impl/PersonBasicInfoServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-personnel/src/main/java/com/ruoyi/personnel/service/impl/PersonCommunicationAbilityServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-personnel/src/main/java/com/ruoyi/personnel/service/impl/PersonJobResponsibilitiesServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-personnel/src/main/java/com/ruoyi/personnel/service/impl/PersonPersonnelCapacityServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-personnel/src/main/java/com/ruoyi/personnel/service/impl/PersonPostAuthorizationRecordServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-personnel/src/main/java/com/ruoyi/personnel/service/impl/PersonTrainingRecordServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-personnel/src/main/java/com/ruoyi/personnel/service/impl/PersonTrainingServiceImpl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-personnel/src/main/java/com/ruoyi/personnel/task/PersonTrainingSchedule.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/java/com/ruoyi/process/controller/ProcessReportController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/java/com/ruoyi/process/controller/QualitySuperviseManagementReviewController.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/java/com/ruoyi/process/dto/ProcessDealDto.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/java/com/ruoyi/process/dto/ProcessReportDto.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/java/com/ruoyi/process/mapper/ProcessDealMapper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/java/com/ruoyi/process/mapper/ProcessOrderDeviceMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/java/com/ruoyi/process/mapper/ProcessReportMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/java/com/ruoyi/process/mapper/QualitySuperviseManagementReviewMapper.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/java/com/ruoyi/process/pojo/ProcessDeal.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/java/com/ruoyi/process/pojo/ProcessReport.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/java/com/ruoyi/process/pojo/QualitySuperviseManagementReview.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/java/com/ruoyi/process/service/ProcessReportService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/java/com/ruoyi/process/service/QualitySuperviseManagementReviewService.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/java/com/ruoyi/process/service/impl/InconsistentDistributionServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/java/com/ruoyi/process/service/impl/InspectionOrderServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/java/com/ruoyi/process/service/impl/ProcessMethodVerifyServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/java/com/ruoyi/process/service/impl/ProcessReportServiceImpl.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/java/com/ruoyi/process/service/impl/ProcessSampleServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/java/com/ruoyi/process/service/impl/ProcessTotaldealServiceImpl.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/java/com/ruoyi/process/service/impl/QualityMonitorServiceImpl.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/java/com/ruoyi/process/service/impl/QualitySuperviseManagementReviewServiceImpl.java 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/java/com/ruoyi/process/service/impl/QualitySuperviseServiceImpl.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/java/com/ruoyi/process/task/QualitySuperviseSchedule.java 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/resources/mapper/ProcessDealMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/resources/mapper/ProcessReportMapper.xml 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/resources/mapper/QualitySuperviseManagementReviewMapper.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/resources/static/report-deal.docx 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/resources/static/sample-deal.docx 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/resources/static/supervise-management-eview.docx 补丁 | 查看 | 原始文档 | blame | 历史
cnas-process/src/main/resources/static/supervision-detail-record.docx 补丁 | 查看 | 原始文档 | blame | 历史
cnas-require/src/main/java/com/ruoyi/require/service/impl/FeCalibrationScheduleServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-require/src/main/java/com/ruoyi/require/service/impl/FeIlluminationServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-require/src/main/java/com/ruoyi/require/service/impl/FePowerStableServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-require/src/main/java/com/ruoyi/require/service/impl/FeTempHumDateServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-require/src/main/java/com/ruoyi/require/service/impl/ForeignRegisterServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-require/src/main/java/com/ruoyi/require/service/impl/InternalWastesServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-require/src/main/java/com/ruoyi/require/task/FeTempHumDateSchedule.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderPlanController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleProductDto.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/dto/SaveInsContextDto.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderMapper.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderPlanService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/FinishProductSpotCheckServiceImpl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java 63 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java 187 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/mapper/InsOrderMapper.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/static/report-template.docx 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/SignatureImageUtil.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/WxCpUtils.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/resources/ttf/signature.ttf 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/controller/CapacityScopeController.java
@@ -1,41 +1,26 @@
package com.ruoyi.basic.controller;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.poi.excel.ExcelUtil;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.system.service.ISysDictTypeService;
import com.ruoyi.basic.dto.PageTestObjectDto;
import com.ruoyi.basic.dto.ProductDTO1;
import com.ruoyi.basic.excel.StructureTestObjectData;
import com.ruoyi.basic.excel.StructureTestObjectListener;
import com.ruoyi.basic.pojo.Product;
import com.ruoyi.basic.pojo.StandardTemplate;
import com.ruoyi.basic.pojo.StructureItemParameter;
import com.ruoyi.basic.pojo.StructureTestObject;
import com.ruoyi.basic.service.CapacityScopeService;
import com.ruoyi.basic.service.ProductService;
import com.ruoyi.basic.service.StandardTemplateService;
import com.ruoyi.basic.service.StructureItemParameterService;
import com.ruoyi.common.core.domain.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
/**
 * æ£€éªŒé¡¹ç›®å‚æ•°(StructureItemParameter)表控制层
@@ -55,9 +40,6 @@
    private StructureItemParameterService structureItemParameterService;
    private ISysDictTypeService dictTypeService;
    private StandardTemplateService standardTemplateService;
    @ApiOperation(value = "获取项目检验参数列表")
    @GetMapping("/selectItemParameterList")
@@ -154,229 +136,7 @@
    @PostMapping("/importEquipData")
    @Transactional
    public Result importEquipData(@RequestParam("file") MultipartFile file) throws Exception {
        InputStream inputStream = file.getInputStream();
        List<StructureItemParameter> lists = new ArrayList<>();
        AtomicReference<String> sample = new AtomicReference<>();
        ExcelUtil.readBySax(inputStream, -1, (i, l, list1) -> {
            if (l == 1) {
                sample.set(list1.get(1) + "");
            }
            if (l >= 1) {
                StructureItemParameter str = new StructureItemParameter();
                // æµ‹è¯•对象
                if (list1.get(1) == null) {
                    str.setSample(null);
                } else {
                    String brand = (String) list1.get(1);
                    StringBuilder builder = new StringBuilder();
                    builder.append("[");
                    // äº§å“
                    if (ObjectUtil.isNotEmpty(list1.get(2))) {
                        String production = (String) list1.get(2);
                        if (!production.contains(";")) {
                            builder.append(String.format("[\"%s\",\"%s\"]", brand, production));
                        } else {
                            Arrays.stream(production.split(";")).forEach(item -> {
                                builder.append(String.format("[\"%s\",\"%s\"],", brand, item));
                            });
                            builder.deleteCharAt(builder.length() - 1);
                        }
                    } else {
                        builder.append("[");
                        builder.append(String.format("\"%s\"", brand));
                        builder.append("]");
                    }
                    builder.append("]");
                    str.setSample(builder.toString());
                }
                // æ£€éªŒé¡¹
                str.setInspectionItem(list1.get(4).toString().trim());
                // æ£€éªŒé¡¹è‹±æ–‡
                if (list1.get(5) != null) {
                    str.setInspectionItemEn(list1.get(5).toString());
                }
                // æ£€éªŒå­é¡¹
                if (list1.get(6) == null) {
                    str.setInspectionItemSubclass(null);
                } else {
                    str.setInspectionItemSubclass(list1.get(6).toString().trim());
                }
                // æ£€éªŒå­é¡¹è‹±æ–‡
                if (list1.get(7) == null) {
                    str.setInspectionItemSubclassEn(null);
                } else {
                    str.setInspectionItemSubclassEn(String.valueOf(list1.get(7).toString()));
                }
                // æ£€éªŒé¡¹åˆ†ç±»
                if (list1.get(22) != null && list1.get(22) != "") {
                    str.setInspectionItemClass(list1.get(22).toString().trim());
                } else {
                    str.setInspectionItemClass(null);
                }
                // æ£€éªŒé¡¹åˆ†ç±»è‹±æ–‡
                if (list1.get(23) != null && list1.get(23) != "") {
                    str.setInspectionItemClassEn(list1.get(23) + "");
                } else {
                    str.setInspectionItemClassEn(null);
                }
                LambdaQueryWrapper<StructureItemParameter> wrapper = Wrappers.lambdaQuery(StructureItemParameter.class)
                        .eq(StructureItemParameter::getInspectionItem, str.getInspectionItem())
                        .eq(StructureItemParameter::getSample, str.getSample())
                        .last("limit 1");
                // åˆ¤æ–­æ˜¯å¦æœ‰æ£€éªŒé¡¹ç±»åž‹
                if (ObjectUtils.isNotEmpty(str.getInspectionItemClass())) {
                    wrapper.eq(StructureItemParameter::getInspectionItemClass, str.getInspectionItemClass());
                }
                // åˆ¤æ–­æ˜¯å¦æœ‰æ£€éªŒå­é¡¹
                if (ObjectUtils.isNotEmpty(str.getInspectionItemSubclass())) {
                    wrapper.eq(StructureItemParameter::getInspectionItemSubclass, str.getInspectionItemSubclass());
                }
                StructureItemParameter db_str = structureItemParameterService.getOne(wrapper);
                if (ObjectUtils.isNotEmpty(db_str)) {
                    str.setId(db_str.getId());
                }
                // æ–¹æ³•名称
                if (list1.get(8) == null) {
                    str.setMethod(null);
                } else {
                    StringBuffer buffer = new StringBuffer();
                    String input = list1.get(8).toString();
                    buffer.append("[");
                    String[] values = input.split(";");
                    for (String value : values) {
                        buffer.append("\"").append(value.trim()).append("\",");
                    }
                    buffer.deleteCharAt(buffer.length() - 1);
                    buffer.append("]");
                    str.setMethod(buffer.toString());
                }
                // è¯•验室
                if (list1.get(9) == null) {
                    str.setSonLaboratory(null);
                } else {
                    str.setSonLaboratory(list1.get(9).toString());
                }
                // è®¡é‡å•位
                if (list1.get(10) == null) {
                    str.setUnit(null);
                } else {
                    str.setUnit(list1.get(10).toString());
                }
                // è¦æ±‚值
                if (list1.get(11) == null) {
                    str.setAskTell(null);
                } else {
                    str.setAskTell(list1.get(11).toString());
                }
                // è¦æ±‚描述
                if (list1.get(12) == null) {
                    str.setAsk(null);
                } else {
                    str.setAsk(list1.get(12).toString());
                }
                // å•ä»·
                if (list1.get(13) == null) {
                    str.setPrice(null);
                } else {
                    str.setPrice(list1.get(13) + "");
                }
                // å·¥æ—¶ç³»æ•°
                if (list1.get(14) == null) {
                    str.setManHour(null);
                } else {
                    str.setManHour(Double.valueOf(list1.get(14).toString()));
                }
                // å·¥æ—¶åˆ†ç»„
                if (list1.get(15) == null) {
                    str.setManHourGroup(null);
                } else {
                    str.setManHourGroup(list1.get(15).toString());
                }
                // é¢„计完成时间
                if (list1.get(16) == null) {
                    str.setManDay(null);
                } else {
                    str.setManDay(Integer.valueOf(list1.get(16).toString()));
                }
                // æ•°æ®ç±»åž‹
                String jy;
                if (list1.get(17).toString().equals("非采集类型")) {
                    jy = "0";
                } else {
                    jy = "1";
                }
                str.setInspectionItemType(jy);
                // æ£€éªŒé¡¹ç±»åž‹
                String validateValueType = list1.get(18).toString();
                if (ObjectUtils.isNotEmpty(validateValueType)) {
                    List<SysDictData> enums = dictTypeService.selectDictDataByName("检验值类型")
                            .stream().filter(sysDictData -> sysDictData.getDictLabel().equals(validateValueType)).collect(Collectors.toList());
                    str.setInspectionValueType(enums.get(0).getDictValue());
                }
                int bsm;
                //特殊标识
                if (list1.get(19).toString().equals("否")) {
                    bsm = 0;
                } else {
                    bsm = 1;
                }
                str.setBsm(bsm + "");
                // æ•°å­—å­—å…¸
                if (list1.get(20) != null) {
                    str.setDic(list1.get(20) + "");
                } else {
                    str.setDic(null);
                }
                // åŽŸå§‹è®°å½•æ¨¡æ¿
                StandardTemplate standTempIdByName = standardTemplateService.getStandTempIdByName(String.valueOf(list1.get(21)));
                if (standTempIdByName != null) {
                    str.setTemplateId(standTempIdByName.getId());
                } else {
                    str.setTemplateId(null);
                }
                try {
                    if (list1.get(24) != null) {
                        str.setLaboratory(list1.get(24) + "");
                    }
                } catch (Exception e) {
                }
                // æ¡ä»¶
                if (list1.get(25) == null) {
                    str.setRadiusList(null);
                } else {
                    StringBuffer buffer = new StringBuffer();
                    String input = list1.get(25).toString();
                    buffer.append("[");
                    String[] values = input.split(";");
                    for (String value : values) {
                        buffer.append("\"").append(value.trim()).append("\",");
                    }
                    buffer.deleteCharAt(buffer.length() - 1);
                    buffer.append("]");
                    str.setRadiusList(buffer.toString());
                }
                //收费标准
                if (list1.get(26) == null) {
                    str.setRates(null);
                } else {
                    str.setRates(list1.get(26) + "");
                }
                lists.add(str);
            }
        });
//        structureItemParameterService.removeNoSample(sample.get());
        // å¦‚果数据库里面的数据存在那么就执行更新拷贝操作
        try {
            structureItemParameterService.saveOrUpdateBatch(lists);
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("服务端报错");
        }
        structureItemParameterService.importEquipData(file);
        return Result.success();
    }
basic-server/src/main/java/com/ruoyi/basic/mapper/StructureItemParameterMapper.java
@@ -25,6 +25,12 @@
    List<TestItemDto> getItemTree();
    int removeNoSample(@Param("sample") String sample);
    /**
     * æŸ¥è¯¢è®¾å¤‡ä¿¡æ¯
     * @param managementNumberList
     * @return
     */
    List<Integer> selectDeviceIdsByNumber(@Param("managementNumberList") List<String> managementNumberList);
}
basic-server/src/main/java/com/ruoyi/basic/pojo/StructureItemParameter.java
@@ -120,5 +120,8 @@
    @ApiModelProperty(value = "设备id")
    private String deviceIds;
    @ApiModelProperty(value = "抽检类型, 1:月度, 2:季度, 3:年度")
    private String spotCheckType;
}
basic-server/src/main/java/com/ruoyi/basic/service/StructureItemParameterService.java
@@ -2,7 +2,15 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.pojo.StructureItemParameter;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
public interface StructureItemParameterService extends IService<StructureItemParameter> {
    void removeNoSample(String sample);
    /**
     * å¯¼å…¥æ£€éªŒé¡¹ç›®
     * @param file
     */
    void importEquipData(MultipartFile file) throws IOException;
}
basic-server/src/main/java/com/ruoyi/basic/service/impl/StructureItemParameterServiceImpl.java
@@ -1,14 +1,34 @@
package com.ruoyi.basic.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.poi.excel.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.basic.mapper.StructureItemParameterMapper;
import com.ruoyi.basic.pojo.StandardTemplate;
import com.ruoyi.basic.pojo.StructureItemParameter;
import com.ruoyi.basic.service.StandardTemplateService;
import com.ruoyi.basic.service.StructureItemParameterService;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.system.service.ISysDictTypeService;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@Service
@AllArgsConstructor
@@ -16,9 +36,257 @@
    @Resource
    private StructureItemParameterMapper structureItemParameterMapper;
    @Resource
    private ISysDictTypeService dictTypeService;
    @Resource
    private StandardTemplateService standardTemplateService;
    /**
     *
     * @param file
     */
    @Override
    public void removeNoSample(String sample) {
        structureItemParameterMapper.removeNoSample("\""+sample+"\"");
    public void importEquipData(MultipartFile file) throws IOException {
        InputStream inputStream = file.getInputStream();
        List<StructureItemParameter> lists = new ArrayList<>();
        AtomicReference<String> sample = new AtomicReference<>();
        ExcelUtil.readBySax(inputStream, -1, (i, l, list1) -> {
            if (l == 1) {
                sample.set(list1.get(1) + "");
            }
            if (l >= 1) {
                StructureItemParameter str = new StructureItemParameter();
                // æµ‹è¯•对象
                if (list1.get(1) == null) {
                    str.setSample(null);
                } else {
                    String brand = (String) list1.get(1);
                    StringBuilder builder = new StringBuilder();
                    builder.append("[");
                    // äº§å“
                    if (ObjectUtil.isNotEmpty(list1.get(2))) {
                        String production = (String) list1.get(2);
                        if (!production.contains(";")) {
                            builder.append(String.format("[\"%s\",\"%s\"]", brand, production));
                        } else {
                            Arrays.stream(production.split(";")).forEach(item -> {
                                builder.append(String.format("[\"%s\",\"%s\"],", brand, item));
                            });
                            builder.deleteCharAt(builder.length() - 1);
                        }
                    } else {
                        builder.append("[");
                        builder.append(String.format("\"%s\"", brand));
                        builder.append("]");
                    }
                    builder.append("]");
                    str.setSample(builder.toString());
                }
                // æ£€éªŒé¡¹
                str.setInspectionItem(list1.get(4).toString().trim());
                // æ£€éªŒé¡¹è‹±æ–‡
                if (list1.get(5) != null) {
                    str.setInspectionItemEn(list1.get(5).toString());
                }
                // æ£€éªŒå­é¡¹
                if (list1.get(6) == null) {
                    str.setInspectionItemSubclass(null);
                } else {
                    str.setInspectionItemSubclass(list1.get(6).toString().trim());
                }
                // æ£€éªŒå­é¡¹è‹±æ–‡
                if (list1.get(7) == null) {
                    str.setInspectionItemSubclassEn(null);
                } else {
                    str.setInspectionItemSubclassEn(String.valueOf(list1.get(7).toString()));
                }
                // æ£€éªŒé¡¹åˆ†ç±»
                if (list1.get(22) != null && list1.get(22) != "") {
                    str.setInspectionItemClass(list1.get(22).toString().trim());
                } else {
                    str.setInspectionItemClass(null);
                }
                // æ£€éªŒé¡¹åˆ†ç±»è‹±æ–‡
                if (list1.get(23) != null && list1.get(23) != "") {
                    str.setInspectionItemClassEn(list1.get(23) + "");
                } else {
                    str.setInspectionItemClassEn(null);
                }
                LambdaQueryWrapper<StructureItemParameter> wrapper = Wrappers.lambdaQuery(StructureItemParameter.class)
                        .eq(StructureItemParameter::getInspectionItem, str.getInspectionItem())
                        .eq(StructureItemParameter::getSample, str.getSample())
                        .last("limit 1");
                // åˆ¤æ–­æ˜¯å¦æœ‰æ£€éªŒé¡¹ç±»åž‹
                if (ObjectUtils.isNotEmpty(str.getInspectionItemClass())) {
                    wrapper.eq(StructureItemParameter::getInspectionItemClass, str.getInspectionItemClass());
                }
                // åˆ¤æ–­æ˜¯å¦æœ‰æ£€éªŒå­é¡¹
                if (ObjectUtils.isNotEmpty(str.getInspectionItemSubclass())) {
                    wrapper.eq(StructureItemParameter::getInspectionItemSubclass, str.getInspectionItemSubclass());
                }
                StructureItemParameter db_str = this.getOne(wrapper);
                if (ObjectUtils.isNotEmpty(db_str)) {
                    str.setId(db_str.getId());
                }
                // æ–¹æ³•名称
                if (list1.get(8) == null) {
                    str.setMethod(null);
                } else {
                    StringBuffer buffer = new StringBuffer();
                    String input = list1.get(8).toString();
                    buffer.append("[");
                    String[] values = input.split(";");
                    for (String value : values) {
                        buffer.append("\"").append(value.trim()).append("\",");
                    }
                    buffer.deleteCharAt(buffer.length() - 1);
                    buffer.append("]");
                    str.setMethod(buffer.toString());
                }
                // è¯•验室
                if (list1.get(9) == null) {
                    str.setSonLaboratory(null);
                } else {
                    str.setSonLaboratory(list1.get(9).toString());
                }
                // è®¡é‡å•位
                if (list1.get(10) == null) {
                    str.setUnit(null);
                } else {
                    str.setUnit(list1.get(10).toString());
                }
                // è¦æ±‚值
                if (list1.get(11) == null) {
                    str.setAskTell(null);
                } else {
                    str.setAskTell(list1.get(11).toString());
                }
                // è¦æ±‚描述
                if (list1.get(12) == null) {
                    str.setAsk(null);
                } else {
                    str.setAsk(list1.get(12).toString());
                }
                // å•ä»·
                if (list1.get(13) == null) {
                    str.setPrice(null);
                } else {
                    str.setPrice(list1.get(13) + "");
                }
                // å·¥æ—¶ç³»æ•°
                if (list1.get(14) == null) {
                    str.setManHour(null);
                } else {
                    str.setManHour(Double.valueOf(list1.get(14).toString()));
                }
                // å·¥æ—¶åˆ†ç»„
                if (list1.get(15) == null) {
                    str.setManHourGroup(null);
                } else {
                    str.setManHourGroup(list1.get(15).toString());
                }
                // é¢„计完成时间
                if (list1.get(16) == null) {
                    str.setManDay(null);
                } else {
                    str.setManDay(Integer.valueOf(list1.get(16).toString()));
                }
                // æ•°æ®ç±»åž‹
                String jy;
                if (list1.get(17).toString().equals("非采集类型")) {
                    jy = "0";
                } else {
                    jy = "1";
                    // ç»‘定设备
                    if (list1.get(28) == null) {
                        str.setRates(null);
                    } else {
                        // æŸ¥è¯¢è®¾å¤‡ä¿¡æ¯
                        List<String> managementNumberList = StrUtil.split(list1.get(28).toString(), ';');
                        if (CollectionUtils.isNotEmpty(managementNumberList)) {
                            List<Integer> deviceIds = structureItemParameterMapper.selectDeviceIdsByNumber(managementNumberList);
                            if (CollectionUtils.isNotEmpty(deviceIds)) {
                                str.setDeviceIds(CollUtil.join(deviceIds, ","));
                            }
                        }
                    }
                }
                str.setInspectionItemType(jy);
                // æ£€éªŒé¡¹ç±»åž‹
                String validateValueType = list1.get(18).toString();
                if (ObjectUtils.isNotEmpty(validateValueType)) {
                    List<SysDictData> enums = dictTypeService.selectDictDataByName("检验值类型")
                            .stream().filter(sysDictData -> sysDictData.getDictLabel().equals(validateValueType)).collect(Collectors.toList());
                    str.setInspectionValueType(enums.get(0).getDictValue());
                }
                int bsm;
                //特殊标识
                if (list1.get(19).toString().equals("否")) {
                    bsm = 0;
                } else {
                    bsm = 1;
                }
                str.setBsm(bsm + "");
                // æ•°å­—å­—å…¸
                if (list1.get(20) != null) {
                    str.setDic(list1.get(20) + "");
                } else {
                    str.setDic(null);
                }
                // åŽŸå§‹è®°å½•æ¨¡æ¿
                StandardTemplate standTempIdByName = standardTemplateService.getStandTempIdByName(String.valueOf(list1.get(21)));
                if (standTempIdByName != null) {
                    str.setTemplateId(standTempIdByName.getId());
                } else {
                    str.setTemplateId(null);
                }
                try {
                    if (list1.get(24) != null) {
                        str.setLaboratory(list1.get(24) + "");
                    }
                } catch (Exception e) {
                }
                // æ¡ä»¶
                if (list1.get(25) == null) {
                    str.setRadiusList(null);
                } else {
                    StringBuffer buffer = new StringBuffer();
                    String input = list1.get(25).toString();
                    buffer.append("[");
                    String[] values = input.split(";");
                    for (String value : values) {
                        buffer.append("\"").append(value.trim()).append("\",");
                    }
                    buffer.deleteCharAt(buffer.length() - 1);
                    buffer.append("]");
                    str.setRadiusList(buffer.toString());
                }
                //收费标准
                if (list1.get(26) == null) {
                    str.setRates(null);
                } else {
                    str.setRates(list1.get(26) + "");
                }
                // æŠ½æ ·ç±»åž‹
                String spotCheckType = list1.get(27).toString();
                if (ObjectUtils.isNotEmpty(spotCheckType)) {
                    List<SysDictData> enums = dictTypeService.selectDictDataByName("抽检类型")
                            .stream().filter(sysDictData -> sysDictData.getDictLabel().equals(spotCheckType)).collect(Collectors.toList());
                    str.setSpotCheckType(enums.get(0).getDictValue());
                }
                lists.add(str);
            }
        });
        try {
            this.saveOrUpdateBatch(lists);
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("服务端报错");
        }
    }
}
basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml
@@ -3,11 +3,7 @@
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.basic.mapper.StructureItemParameterMapper">
    <delete id="removeNoSample">
        delete
        from structure_item_parameter
        where sample like concat('%', #{sample}, '%')
    </delete>
    <select id="selectItemParameterList" resultType="com.ruoyi.basic.pojo.StructureItemParameter">
        select * from (select A.id,
        inspection_item,
@@ -41,7 +37,8 @@
        code,
        radius_list,
        rates,
        device_ids
        device_ids,
        spot_check_type
        from (select *,
        CASE
        WHEN INSTR(sample, ',') > 0 THEN
@@ -109,6 +106,13 @@
        from structure_test_object sto
                 left join product p on p.object_id = sto.id
    </select>
    <select id="selectDeviceIdsByNumber" resultType="java.lang.Integer">
        select id from device
        where management_number in
        <foreach item="item" collection="managementNumberList" open="(" separator="),(" close=")">
            #{item}
        </foreach>
    </select>
    <resultMap id="itemDto" type="com.ruoyi.basic.dto.TestItemDto">
        <result column="sId" property="id"/>
cnas-device/src/main/java/com/ruoyi/device/mapper/DeviceMapper.java
@@ -36,5 +36,11 @@
    List<Map<String, Object>> treeDevice(@Param("deviceName") String deviceName);
    DeviceDto selectDeviceByCode(Integer id);
    /**
     * æŸ¥è¯¢åˆ°è¾¾æ ¡å‡†æœ‰æ•ˆæœŸçš„设备-提前5天
     * @return
     */
    List<Device> selectOverdueDevice();
}
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceAcceptanceServiceImpl.java
@@ -151,6 +151,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceAccidentReportServiceImpl.java
@@ -181,6 +181,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceBreakdownMaintenanceServiceImpl.java
@@ -144,6 +144,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceCalibrationPlanServiceImpl.java
@@ -301,6 +301,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceExaminePlanServiceImpl.java
@@ -304,6 +304,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceExamineRecordContrastServiceImpl.java
@@ -185,6 +185,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceExamineRecordServiceImpl.java
@@ -229,6 +229,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceExternalApplyServiceImpl.java
@@ -153,6 +153,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceImpowerServiceImpl.java
@@ -290,6 +290,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceInspectionRecordServiceImpl.java
@@ -215,6 +215,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceMaintenanceImpl.java
@@ -135,6 +135,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceMaintenancePlanServiceImpl.java
@@ -196,6 +196,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceRecordServiceImpl.java
@@ -138,6 +138,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceScrappedServiceImpl.java
@@ -170,6 +170,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceServiceImpl.java
@@ -353,6 +353,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
@@ -488,6 +489,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceStateServiceImpl.java
@@ -151,6 +151,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceTraceabilityManagementServiceImpl.java
@@ -281,6 +281,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-device/src/main/java/com/ruoyi/device/task/DeviceRecordSchedule.java
@@ -3,7 +3,9 @@
import com.ruoyi.common.core.domain.entity.User;
import com.ruoyi.common.utils.WxCpUtils;
import com.ruoyi.device.dto.DeviceRecordDto;
import com.ruoyi.device.mapper.DeviceMapper;
import com.ruoyi.device.mapper.DeviceRecordMapper;
import com.ruoyi.device.pojo.Device;
import com.ruoyi.device.pojo.DeviceRecord;
import com.ruoyi.system.mapper.UserMapper;
import org.springframework.scheduling.annotation.Scheduled;
@@ -20,6 +22,9 @@
 */
@Component
public class DeviceRecordSchedule {
    @Resource
    private DeviceMapper deviceMapper;
    @Resource
    private DeviceRecordMapper deviceRecordMapper;
    @Resource
@@ -31,7 +36,7 @@
     * æé†’填写设备使用记录
     */
//    @Scheduled(cron = "0/5 * * * * *")
    @Scheduled(cron = "0 0 9 * * 6") // æ¯å‘¨å…­æ‰§è¡Œä¸€æ¬¡
//    @Scheduled(cron = "0 0 9 * * 6") // æ¯å‘¨å…­æ‰§è¡Œä¸€æ¬¡
    public void task1() {
        // æŸ¥è¯¢æœªå¡«å†™çš„设备使用记录
        List<DeviceRecordDto> deviceRecords = deviceRecordMapper.selectNotFilled();
@@ -58,8 +63,41 @@
            });
        });
    }
    /**
     * æ¯å¤©9点执行一次 é™¤äº†æ˜ŸæœŸå¤©
     * åˆ¤æ–­æ˜¯å¦æœ‰è®¾å¤‡åˆ°è¾¾æ ¡å‡†æœ‰æ•ˆæœŸ
     */
//    @Scheduled(cron = "0/5 * * * * *")
//    @Scheduled(cron = "0 0 9 * * 1-6") // æ¯å¤©9点执行一次 é™¤äº†æ˜ŸæœŸå¤©
    public void task2() {
        // æŸ¥è¯¢åˆ°è¾¾æ ¡å‡†æœ‰æ•ˆæœŸçš„设备-提前5天
        List<Device> deviceList = deviceMapper.selectOverdueDevice();
        Map<Integer, List<Device>> userPersonIdMap = deviceList.stream().collect(Collectors.groupingBy(Device::getEquipmentManager));
        userPersonIdMap.forEach((userId, recordList) -> {
            threadPoolTaskExecutor.execute(() -> {
                // ä¼ä¸šå¾®ä¿¡é€šçŸ¥å¡«å†™è®¾å¤‡ä½¿ç”¨è®°å½•
                User user = userMapper.selectById(userId);
                String message = "";
                message += "设备使用记录未填写提醒通知";
                for (Device deviceRecord : recordList) {
                    message += "\n设备名称编号: " + deviceRecord.getDeviceName() + "-" + deviceRecord.getManagementNumber();
                    message += "\n委托编号: " + deviceRecord.getSampleCode();
                    message += "\n";
                }
                message += "\n请去填写设备使用记录";
                //发送企业微信消息通知
                try {
                    WxCpUtils.inform(user.getAccount(), message, null);
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            });
        });
    }
}
cnas-device/src/main/resources/mapper/DeviceMapper.xml
@@ -142,6 +142,7 @@
    <resultMap id="deviceNameMap" type="map">
        <result property="value" column="id"/>
        <result property="label" column="device_name"/>
        <result property="activationDate" column="activation_date"/>
        <result property="managementNumber" column="management_number"/>
    </resultMap>
@@ -152,7 +153,8 @@
        case when d.storage_point is null || d.storage_point ='' then '其他' else d.storage_point end as storage_point,
        d.device_name,
        d.management_number,
        null as value
        null as value,
        d.activation_date
        from device d
        LEFT JOIN laboratory l ON l.id = d.subordinate_departments_id
        <where>
@@ -160,7 +162,6 @@
                and device_name like concat('%',#{deviceName},'%')
            </if>
        </where>
        order by l.laboratory_name desc, d.storage_point desc
    </select>
    <select id="selectDeviceByCode" resultType="com.ruoyi.device.dto.DeviceDto">
@@ -181,4 +182,15 @@
                 u1.name,
                 u2.name
    </select>
    <!-- æŸ¥è¯¢åˆ°è¾¾æ ¡å‡†æœ‰æ•ˆæœŸçš„设备-提前5天 -->
    <select id="selectOverdueDevice" resultType="com.ruoyi.device.pojo.Device">
        SELECT *
        FROM device
        WHERE
        -- ç­›é€‰å‡º activation_date åœ¨å½“前日期前五天内的数据
        activation_date BETWEEN now() AND now() + INTERVAL 5 DAY
        -- ç­›é€‰å‡º activation_date å·²ç»è¶…过当前日期的数据
        OR activation_date &lt; now()
    </select>
</mapper>
cnas-manage/src/main/java/com/ruoyi/manage/schedule/ManageRecordTotalSchedule.java
@@ -20,7 +20,7 @@
    @Resource
    private ManageRecordIntervalsTotalService manageRecordIntervalsTotalService;
    @Scheduled(cron = "0 0 2 1 1 ?") //每年1月1号2点
//    @Scheduled(cron = "0 0 2 1 1 ?") //每年1月1号2点
    public void manageRecordTotal() {
        ManageRecordTotal manageRecordTotal = new ManageRecordTotal();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ClientSatisfactionServiceImpl.java
@@ -161,6 +161,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/InternalCheckServiceImpl.java
@@ -221,6 +221,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/InternalCorrectServiceImpl.java
@@ -310,6 +310,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/InternalImplementServiceImpl.java
@@ -54,7 +54,7 @@
    @Resource
    private InternalImplementDetailService internalImplementDetailService;
    @Resource
    private UserMapper userMapper;
    @Value("${file.path}")
@@ -228,6 +228,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/InternalMeetingServiceImpl.java
@@ -191,6 +191,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/InternalPlanServiceImpl.java
@@ -248,6 +248,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/InternalReportServiceImpl.java
@@ -155,6 +155,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageControlPlanListServiceImpl.java
@@ -120,6 +120,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageMeetingServiceImpl.java
@@ -38,7 +38,7 @@
 * æœåŠ¡å®žçŽ°ç±»
 * </p>
 *
 * @author
 * @author
 * @since 2024-11-11 09:33:47
 */
@Service
@@ -152,6 +152,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageRecordAuditServiceImpl.java
@@ -43,7 +43,7 @@
 * æ–‡ä»¶ä¿®è®¢ç”³è¯·å®¡æ‰¹è®°å½• æœåŠ¡å®žçŽ°ç±»
 * </p>
 *
 * @author
 * @author
 * @since 2024-11-14 10:29:18
 */
@Service
@@ -155,6 +155,8 @@
            OutputStream outputStream = new FileOutputStream(file);
            IOUtils.copy(inputStream, outputStream);
            url = file.getAbsolutePath();
            inputStream.close();
            outputStream.close();
        } catch (FileNotFoundException e) {
            throw new ErrorException("找不到模板文件");
        } catch (IOException e) {
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageRecordCancelServiceImpl.java
@@ -46,7 +46,7 @@
 * ä½œåºŸæ–‡ä»¶é”€é­‚记录 æœåŠ¡å®žçŽ°ç±»
 * </p>
 *
 * @author
 * @author
 * @since 2024-11-13 01:27:22
 */
@Service
@@ -90,6 +90,8 @@
            OutputStream outputStream = new FileOutputStream(file);
            IOUtils.copy(inputStream, outputStream);
            url = file.getAbsolutePath();
            inputStream.close();
            outputStream.close();
        } catch (FileNotFoundException e) {
            throw new ErrorException("找不到模板文件");
        } catch (IOException e) {
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageRecordCheckServiceImpl.java
@@ -48,7 +48,7 @@
 * æ–‡ä»¶å®¡æ‰¹è®°å½•(含修订后再次审批记录) æœåŠ¡å®žçŽ°ç±»
 * </p>
 *
 * @author
 * @author
 * @since 2024-11-12 02:31:36
 */
@Service
@@ -100,6 +100,8 @@
            OutputStream outputStream = new FileOutputStream(file);
            IOUtils.copy(inputStream, outputStream);
            url = file.getAbsolutePath();
            inputStream.close();
            outputStream.close();
        } catch (FileNotFoundException e) {
            throw new ErrorException("找不到模板文件");
        } catch (IOException e) {
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageRecordIntervalsServiceImpl.java
@@ -76,6 +76,8 @@
            OutputStream outputStream = new FileOutputStream(file);
            IOUtils.copy(inputStream, outputStream);
            url = file.getAbsolutePath();
            inputStream.close();
            outputStream.close();
        } catch (FileNotFoundException e) {
            throw new ErrorException("找不到模板文件");
        } catch (IOException e) {
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageRecordIntervalsTotalServiceImpl.java
@@ -130,6 +130,8 @@
            OutputStream outputStream = new FileOutputStream(file);
            IOUtils.copy(inputStream, outputStream);
            url = file.getAbsolutePath();
            inputStream.close();
            outputStream.close();
        } catch (FileNotFoundException e) {
            throw new ErrorException("找不到模板文件");
        } catch (IOException e) {
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageRecordIssueRecycleServiceImpl.java
@@ -78,6 +78,8 @@
            OutputStream outputStream = new FileOutputStream(file);
            IOUtils.copy(inputStream, outputStream);
            url = file.getAbsolutePath();
            inputStream.close();
            outputStream.close();
        } catch (FileNotFoundException e) {
            throw new ErrorException("找不到模板文件");
        } catch (IOException e) {
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageRecordTotalServiceImpl.java
@@ -131,6 +131,8 @@
            OutputStream outputStream = new FileOutputStream(file);
            IOUtils.copy(inputStream, outputStream);
            url = file.getAbsolutePath();
            inputStream.close();
            outputStream.close();
        } catch (FileNotFoundException e) {
            throw new ErrorException("找不到模板文件");
        } catch (IOException e) {
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageReviewProgramServiceImpl.java
@@ -107,6 +107,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageReviewReportServiceImpl.java
@@ -33,7 +33,7 @@
 * ç®¡ç†è¯„审报告 æœåŠ¡å®žçŽ°ç±»
 * </p>
 *
 * @author
 * @author
 * @since 2024-11-12 04:44:39
 */
@Service
@@ -128,6 +128,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-manage/src/main/java/com/ruoyi/manage/service/impl/ManageRiskAssessmentResultsServiceImpl.java
@@ -115,6 +115,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-personnel/src/main/java/com/ruoyi/personnel/service/impl/PersonBasicInfoServiceImpl.java
@@ -246,6 +246,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-personnel/src/main/java/com/ruoyi/personnel/service/impl/PersonCommunicationAbilityServiceImpl.java
@@ -105,6 +105,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-personnel/src/main/java/com/ruoyi/personnel/service/impl/PersonJobResponsibilitiesServiceImpl.java
@@ -105,6 +105,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-personnel/src/main/java/com/ruoyi/personnel/service/impl/PersonPersonnelCapacityServiceImpl.java
@@ -39,7 +39,7 @@
 * äººå‘˜èƒ½åŠ› æœåŠ¡å®žçŽ°ç±»
 * </p>
 *
 * @author
 * @author
 * @since 2024-10-10 11:26:18
 */
@Service
@@ -103,6 +103,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-personnel/src/main/java/com/ruoyi/personnel/service/impl/PersonPostAuthorizationRecordServiceImpl.java
@@ -31,7 +31,7 @@
 * ä»»èŒæŽˆæƒè®°å½• æœåŠ¡å®žçŽ°ç±»
 * </p>
 *
 * @author
 * @author
 * @since 2024-10-09 10:48:17
 */
@Service
@@ -123,6 +123,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-personnel/src/main/java/com/ruoyi/personnel/service/impl/PersonTrainingRecordServiceImpl.java
@@ -117,6 +117,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-personnel/src/main/java/com/ruoyi/personnel/service/impl/PersonTrainingServiceImpl.java
@@ -288,6 +288,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
@@ -364,6 +365,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-personnel/src/main/java/com/ruoyi/personnel/task/PersonTrainingSchedule.java
@@ -28,10 +28,10 @@
    private ThreadPoolTaskExecutor threadPoolTaskExecutor;
    /**
     * æé†’填写设备使用记录
     * æé†’填写人员培训记录
     */
//    @Scheduled(cron = "0/5 * * * * *")
    @Scheduled(cron = "0 0 9 1 * *") // æ¯æœˆä¸€å·æ‰§è¡Œ
//    @Scheduled(cron = "0 0 9 1,15 * *") // æ¯æœˆä¸€å·æ‰§è¡Œ
    public void task1() {
        // æŸ¥è¯¢å½“月培训计划
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.M");
cnas-process/src/main/java/com/ruoyi/process/controller/ProcessReportController.java
@@ -34,7 +34,7 @@
    @ApiOperation(value = "查询检验报告发放登记列表")
    @GetMapping("/pageProcessReport")
    public Result pageProcessReport(ProcessReport processReport , Page page) {
    public Result pageProcessReport(ProcessReportDto processReport , Page page) {
        return Result.success(processReportService.pageProcessReport(page, processReport));
    }
@@ -64,11 +64,8 @@
    @ApiOperation(value = "导出检验报告发放登记表")
    @GetMapping("/exportProcessReport")
    public void exportProcessReport(String ids, HttpServletResponse response) {
        List<Integer> list = Arrays.stream(ids.split(","))
                .map(Integer::parseInt)
                .collect(Collectors.toList());
        processReportService.exportProcessReport(list, response);
    public void exportProcessReport(ProcessReportDto dto, HttpServletResponse response) {
        processReportService.exportProcessReport(dto, response);
    }
}
cnas-process/src/main/java/com/ruoyi/process/controller/QualitySuperviseManagementReviewController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,71 @@
package com.ruoyi.process.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.process.pojo.QualitySupervise;
import com.ruoyi.process.pojo.QualitySuperviseManagementReview;
import com.ruoyi.process.service.QualitySuperviseManagementReviewService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
/**
 * <p>
 * è´¨é‡ç›‘督管理评审输入材料 å‰ç«¯æŽ§åˆ¶å™¨
 * </p>
 *
 * @author
 * @since 2025-05-07 10:46:11
 */
@RestController
@RequestMapping("/managementReview")
@Api(tags = "质量监督管理评审输入材料")
@AllArgsConstructor
public class QualitySuperviseManagementReviewController {
    private QualitySuperviseManagementReviewService qualitySuperviseManagementReviewService;
    /**
     * åˆ†é¡µæŸ¥è¯¢
     * @return
     */
    @ApiOperation(value = "分页查询")
    @GetMapping("/pageManagementReview")
    public Result<IPage<QualitySuperviseManagementReview>> pageManagementReview(QualitySuperviseManagementReview managementReview, Page page) {
        return Result.success(qualitySuperviseManagementReviewService.pageManagementReview(page, managementReview));
    }
    /**
     * æ–°å¢žæˆ–修改
     * @return
     */
    @ApiOperation(value = "新增或修改")
    @PostMapping("/saveOrUpdateManagementReview")
    public Result saveOrUpdateManagementReview(@RequestBody QualitySuperviseManagementReview managementReview) {
        return Result.success(qualitySuperviseManagementReviewService.saveOrUpdate(managementReview));
    }
    /**
     * åˆ é™¤
     * @return
     */
    @ApiOperation(value = "删除")
    @DeleteMapping("/deleteManagementReview")
    public Result deleteManagementReview(Integer managementReviewId) {
        return Result.success(qualitySuperviseManagementReviewService.removeById(managementReviewId));
    }
    /**
     * å¯¼å‡º
     * @return
     */
    @ApiOperation(value = "导出")
    @GetMapping("/exportManagementReview")
    public void exportManagementReview(Integer managementReviewId,HttpServletResponse response) {
        qualitySuperviseManagementReviewService.exportManagementReview(managementReviewId, response);
    }
}
cnas-process/src/main/java/com/ruoyi/process/dto/ProcessDealDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
package com.ruoyi.process.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.ruoyi.process.pojo.ProcessDeal;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @Author zhuo
 * @Date 2025/4/23
 */
@Data
public class ProcessDealDto extends ProcessDeal {
    @ApiModelProperty("序号")
    private String indexs;
    @ApiModelProperty("时间")
    private String dealTimeStr;
}
cnas-process/src/main/java/com/ruoyi/process/dto/ProcessReportDto.java
@@ -1,12 +1,30 @@
package com.ruoyi.process.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.deepoove.poi.data.PictureRenderData;
import com.ruoyi.process.pojo.ProcessReport;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
//导出
public class ProcessReportDto {
public class ProcessReportDto extends ProcessReport {
    private List<Integer> ids;
    @ApiModelProperty("发送人姓名")
    private String sendUserName;
    @ApiModelProperty("发送人地址")
    private String sendUserUrl;
    @ApiModelProperty("发送人签名")
    private PictureRenderData sendUserRender;
    @ApiModelProperty("签收签名")
    private PictureRenderData signatoryRender;
}
cnas-process/src/main/java/com/ruoyi/process/mapper/ProcessDealMapper.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.process.dto.ProcessDealDto;
import com.ruoyi.process.pojo.ProcessDeal;
import org.apache.ibatis.annotations.Param;
@@ -21,6 +22,6 @@
    IPage<ProcessDeal> pageProcessDeal(Page page, @Param("ew") QueryWrapper<ProcessDeal> queryWrappers);
    List<ProcessDeal> selectDeal(@Param("id") Integer id);
    List<ProcessDealDto> selectDeal(@Param("id") Integer id);
}
cnas-process/src/main/java/com/ruoyi/process/mapper/ProcessOrderDeviceMapper.java
@@ -21,7 +21,7 @@
    Set<String> selectDeviceNumber(@Param("inspectionOrderId") Integer inspectionOrderId);
    List<Integer> selectDeviceIdsByNumbers(@Param("orderDeviceNumbers") Set<String> orderDeviceNumbers);
    List<Integer> selectDeviceIdsByNumbers(@Param("deviceNumbers") Set<String> deviceNumbers);
    IPage<ProcessOrderDevice> deviceRecordPage(@Param("deviceId") Integer deviceId, @Param("page") Page page, @Param("sampleCode") String sampleCode, @Param("managementNumber") String managementNumber);
}
cnas-process/src/main/java/com/ruoyi/process/mapper/ProcessReportMapper.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.process.dto.ProcessReportDto;
import com.ruoyi.process.pojo.ProcessReport;
import org.apache.ibatis.annotations.Param;
@@ -19,7 +20,7 @@
 */
public interface ProcessReportMapper extends BaseMapper<ProcessReport> {
    IPage<ProcessReport> pageProcessReport(Page page, @Param("ew") QueryWrapper<ProcessReport> queryWrappers);
    IPage<ProcessReportDto> pageProcessReport(Page page, @Param("ew") QueryWrapper<ProcessReportDto> queryWrappers);
    List<ProcessReport> getIds(@Param("ids") List<Integer> ids);
    List<ProcessReportDto> exportProcessReport();
}
cnas-process/src/main/java/com/ruoyi/process/mapper/QualitySuperviseManagementReviewMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,26 @@
package com.ruoyi.process.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.ruoyi.process.pojo.QualitySuperviseManagementReview;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/**
 * <p>
 * è´¨é‡ç›‘督管理评审输入材料 Mapper æŽ¥å£
 * </p>
 *
 * @author
 * @since 2025-05-07 10:46:11
 */
public interface QualitySuperviseManagementReviewMapper extends BaseMapper<QualitySuperviseManagementReview> {
    /**
     * åˆ†é¡µæŸ¥è¯¢
     * @param page
     * @return
     */
    IPage<QualitySuperviseManagementReview> pageManagementReview(@Param("page") Page page, @Param("ew") QueryWrapper<QualitySuperviseManagementReview> ew);
}
cnas-process/src/main/java/com/ruoyi/process/pojo/ProcessDeal.java
@@ -65,8 +65,4 @@
    @ApiModelProperty("关联的样品接收id")
    private Integer processSampleId;
    @ApiModelProperty("序号")
    @TableField(select = false,exist = false)
    private String indexs;
}
cnas-process/src/main/java/com/ruoyi/process/pojo/ProcessReport.java
@@ -54,19 +54,8 @@
    @ApiModelProperty("发送人")
    private Integer sendUser;
    @TableField(select = false,exist = false)
    private String sendUserName;
    @ApiModelProperty("签收人")
    private String signatory;
    @TableField(select = false,exist = false)
    private String signatoryUrl;
    @TableField(select = false,exist = false)
    private String signatoryName;
    @ApiModelProperty("备注")
    private String remark;
cnas-process/src/main/java/com/ruoyi/process/pojo/QualitySuperviseManagementReview.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,63 @@
package com.ruoyi.process.pojo;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
/**
 * <p>
 * è´¨é‡ç›‘督管理评审输入材料
 * </p>
 *
 * @author
 * @since 2025-05-07 10:46:11
 */
@Getter
@Setter
@TableName("cnas_quality_supervise_management_review")
@ApiModel(value = "QualitySuperviseManagementReview对象", description = "质量监督管理评审输入材料")
public class QualitySuperviseManagementReview implements Serializable {
    @TableId(value = "management_review_id", type = IdType.AUTO)
    private Integer managementReviewId;
    @ApiModelProperty("文件名称")
    private String fileName;
    @ApiModelProperty("计划内容")
    private String implementationContent;
    @ApiModelProperty("动态内容")
    private String dynamicContent;
    @ApiModelProperty("监督人")
    private String supervisor;
    @ApiModelProperty("质量评审日期")
    private LocalDate superviseDate;
    @ApiModelProperty("创建人")
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;
    @ApiModelProperty("修改人")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty("修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
}
cnas-process/src/main/java/com/ruoyi/process/service/ProcessReportService.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.process.dto.ProcessReportDto;
import com.ruoyi.process.pojo.ProcessReport;
import javax.servlet.http.HttpServletResponse;
@@ -19,7 +20,7 @@
 */
public interface ProcessReportService extends IService<ProcessReport> {
    IPage<ProcessReport> pageProcessReport(Page page, ProcessReport processReport);
    IPage<ProcessReportDto> pageProcessReport(Page page, ProcessReportDto processReport);
    void exportProcessReport(List<Integer> ids, HttpServletResponse response);
    void exportProcessReport(ProcessReportDto dto, HttpServletResponse response);
}
cnas-process/src/main/java/com/ruoyi/process/service/QualitySuperviseManagementReviewService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,34 @@
package com.ruoyi.process.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.process.pojo.QualitySuperviseManagementReview;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.servlet.http.HttpServletResponse;
/**
 * <p>
 * è´¨é‡ç›‘督管理评审输入材料 æœåŠ¡ç±»
 * </p>
 *
 * @author
 * @since 2025-05-07 10:46:11
 */
public interface QualitySuperviseManagementReviewService extends IService<QualitySuperviseManagementReview> {
    /**
     * åˆ†é¡µæŸ¥è¯¢
     * @param page
     * @param managementReview
     * @return
     */
    IPage<QualitySuperviseManagementReview> pageManagementReview(Page page, QualitySuperviseManagementReview managementReview);
    /**
     * å¯¼å‡º
     * @param managementReviewId
     * @param response
     */
    void exportManagementReview(Integer managementReviewId, HttpServletResponse response);
}
cnas-process/src/main/java/com/ruoyi/process/service/impl/InconsistentDistributionServiceImpl.java
@@ -221,6 +221,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-process/src/main/java/com/ruoyi/process/service/impl/InspectionOrderServiceImpl.java
@@ -401,6 +401,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-process/src/main/java/com/ruoyi/process/service/impl/ProcessMethodVerifyServiceImpl.java
@@ -345,6 +345,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-process/src/main/java/com/ruoyi/process/service/impl/ProcessReportServiceImpl.java
@@ -3,6 +3,7 @@
import cn.hutool.core.lang.UUID;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.deepoove.poi.XWPFTemplate;
@@ -13,14 +14,15 @@
import com.ruoyi.common.core.domain.entity.User;
import com.ruoyi.common.utils.QueryWrappers;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.SignatureImageUtil;
import com.ruoyi.framework.exception.ErrorException;
import com.ruoyi.inspect.util.HackLoopTableRenderPolicy;
import com.ruoyi.process.dto.ProcessReportDto;
import com.ruoyi.process.mapper.ProcessReportMapper;
import com.ruoyi.process.pojo.ProcessReport;
import com.ruoyi.process.service.ProcessReportService;
import com.ruoyi.system.mapper.UserMapper;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xwpf.usermodel.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@@ -52,45 +54,32 @@
    @Resource
    private ProcessReportMapper processReportMapper;
    @Value("${wordUrl}")
    private String wordUrl;
    @Value("${file.path}")
    private String imgUrl;
    @Resource
    private UserMapper userMapper;
    @Override
    public IPage<ProcessReport> pageProcessReport(Page page, ProcessReport processReport) {
        //todo ä»…看我
        IPage<ProcessReport> processReportIPage = processReportMapper.pageProcessReport(page, QueryWrappers.queryWrappers(processReport));
//        for (ProcessReport record : processReportIPage.getRecords()) {
//            List<String> name = new ArrayList<>();
//            for (String s : record.getSignatory().split(",")) {
//                User user = userMapper.selectById(Integer.parseInt(s));
//                name.add(user.getName());
//            }
//            String signatoryName = name.stream().collect(Collectors.joining(","));
//            record.setSignatoryName(signatoryName);
//        }
    public IPage<ProcessReportDto> pageProcessReport(Page page, ProcessReportDto processReport) {
        IPage<ProcessReportDto> processReportIPage = processReportMapper.pageProcessReport(page, QueryWrappers.queryWrappers(processReport));
        return processReportIPage;
    }
    @Override
    public void exportProcessReport(List<Integer> ids, HttpServletResponse response) {
        List<ProcessReport> processReports = processReportMapper.getIds(ids);
//        for (ProcessReport record : processReports) {
//            List<String> name = new ArrayList<>();
//            if(StringUtils.isNotBlank(record.getSignatory())){
//                for (String s : record.getSignatory().split(",")) {
//                    User user = userMapper.selectById(Integer.parseInt(s));
//                    name.add(user.getName());
//                }
//                String signatoryName = name.stream().collect(Collectors.joining(","));
//                record.setSignatoryName(signatoryName);
//            }
//        }
    public void exportProcessReport(ProcessReportDto dto, HttpServletResponse response) {
        List<ProcessReportDto> processReports = processReportMapper.exportProcessReport();
        for (ProcessReportDto processReport : processReports) {
            // å‘送人生成签名图片
            processReport.setSendUserRender(StringUtils.isNotBlank(processReport.getSendUserUrl())
                    ? Pictures.ofLocal(imgUrl + "/" + processReport.getSendUserUrl()).create() : null);
            // ç­¾æ”¶äººç”Ÿæˆå›¾ç‰‡
            processReport.setSignatoryRender(StringUtils.isNotBlank(processReport.getSignatory())
                    ? Pictures.ofStream(SignatureImageUtil.saveImageToFile(processReport.getSignatory())).create() : null);
        }
        // èŽ·å–è·¯å¾„
        InputStream inputStream = this.getClass().getResourceAsStream("/static/report-deal.docx");
        Configure configure = Configure.builder()
@@ -110,6 +99,8 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-process/src/main/java/com/ruoyi/process/service/impl/ProcessSampleServiceImpl.java
@@ -61,6 +61,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-process/src/main/java/com/ruoyi/process/service/impl/ProcessTotaldealServiceImpl.java
@@ -17,6 +17,7 @@
import com.ruoyi.framework.exception.ErrorException;
import com.ruoyi.inspect.util.HackLoopTableRenderPolicy;
import com.ruoyi.inspect.util.UserUtils;
import com.ruoyi.process.dto.ProcessDealDto;
import com.ruoyi.process.mapper.InspectionOrderMapper;
import com.ruoyi.process.mapper.ProcessDealMapper;
import com.ruoyi.process.mapper.ProcessSampleMapper;
@@ -185,7 +186,7 @@
    @Override
    public void exportProcessTotaldeal(Integer id, HttpServletResponse response) {
        List<ProcessDeal> sampleDealDtos = processDealMapper.selectDeal(id);
        List<ProcessDealDto> sampleDealDtos = processDealMapper.selectDeal(id);
        ProcessTotaldeal processTotaldeal = processTotaldealMapper.selectById(id);
        // èŽ·å–è·¯å¾„
@@ -210,6 +211,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-process/src/main/java/com/ruoyi/process/service/impl/QualityMonitorServiceImpl.java
@@ -373,6 +373,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
@@ -519,6 +520,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
@@ -732,6 +734,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
@@ -751,11 +754,9 @@
        if (qualityMonitorDetailsId == null) {
            throw new ErrorException("缺少监控详情id");
        }
        QualityMonitorDetails qualityMonitorDetails = qualityMonitorDetailsService.getOne(Wrappers.<QualityMonitorDetails>lambdaUpdate()
                .eq(QualityMonitorDetails::getQualityMonitorDetailsId, qualityMonitorDetailsId));
        LocalDateTime now = LocalDateTime.now();
        Integer userId =SecurityUtils.getUserId().intValue();
        String contentType = file.getContentType();
        String urlString;
        String pathName;
        try {
@@ -768,10 +769,13 @@
            urlString = realpath + "/" + pathName;
            file.transferTo(new File(urlString));
            wordInsertUrl(new HashMap<String, Object>() {{
                put("writeUrl", UserUtils.getFinalUserSignatureUrl(userId));
                put("writeDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(now)).create());
            }}, wordUrl + "/" + pathName.replace("/word", wordUrl));
            // åˆ¤æ–­æ˜¯å¦æ˜¯pdf
            if (!contentType.contains("pdf")) {
                wordInsertUrl(new HashMap<String, Object>() {{
                    put("writeUrl", UserUtils.getFinalUserSignatureUrl(userId));
                    put("writeDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(now)).create());
                }}, wordUrl + "/" + pathName.replace("/word", wordUrl));
            }
            qualityMonitorDetailsService.update(Wrappers.<QualityMonitorDetails>lambdaUpdate()
                    .eq(QualityMonitorDetails::getQualityMonitorDetailsId, qualityMonitorDetailsId)
@@ -807,7 +811,7 @@
        // æ·»åŠ æ‰¹å‡†äºº
        QualityMonitorDetails details = qualityMonitorDetailsMapper.selectById(qualityMonitorDetails.getQualityMonitorDetailsId());
        if (StringUtils.isNotBlank(details.getFinishReportUrl())) {
        if (StringUtils.isNotBlank(details.getFinishReportUrl()) && !details.getFinishReportUrl().contains(".pdf")) {
            wordInsertUrl(new HashMap<String, Object>() {{
                put("ratifyUrl", UserUtils.getFinalUserSignatureUrl(userId));
                put("ratifyDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(now)).create());
cnas-process/src/main/java/com/ruoyi/process/service/impl/QualitySuperviseManagementReviewServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,86 @@
package com.ruoyi.process.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.config.ConfigureBuilder;
import com.deepoove.poi.data.Pictures;
import com.ruoyi.common.utils.QueryWrappers;
import com.ruoyi.framework.exception.ErrorException;
import com.ruoyi.process.dto.QualitySuperviseDetailsCorrectDto;
import com.ruoyi.process.pojo.QualitySuperviseDetailsCorrect;
import com.ruoyi.process.pojo.QualitySuperviseManagementReview;
import com.ruoyi.process.mapper.QualitySuperviseManagementReviewMapper;
import com.ruoyi.process.service.QualitySuperviseManagementReviewService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
/**
 * <p>
 * è´¨é‡ç›‘督管理评审输入材料 æœåŠ¡å®žçŽ°ç±»
 * </p>
 *
 * @author
 * @since 2025-05-07 10:46:11
 */
@Service
public class QualitySuperviseManagementReviewServiceImpl extends ServiceImpl<QualitySuperviseManagementReviewMapper, QualitySuperviseManagementReview> implements QualitySuperviseManagementReviewService {
    /**
     * åˆ†é¡µæŸ¥è¯¢
     * @param page
     * @param managementReview
     * @return
     */
    @Override
    public IPage<QualitySuperviseManagementReview> pageManagementReview(Page page, QualitySuperviseManagementReview managementReview) {
        return baseMapper.pageManagementReview(page, QueryWrappers.queryWrappers(managementReview));
    }
    /**
     * å¯¼å‡º
     * @param managementReviewId
     * @param response
     */
    @Override
    public void exportManagementReview(Integer managementReviewId, HttpServletResponse response) {
        QualitySuperviseManagementReview managementReview = baseMapper.selectById(managementReviewId);
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyå¹´MM月dd日");
        // èŽ·å–è·¯å¾„
        InputStream inputStream = this.getClass().getResourceAsStream("/static/supervise-management-eview.docx");
        ConfigureBuilder builder = Configure.builder();
        builder.useSpringEL(true);
        XWPFTemplate template = XWPFTemplate.compile(inputStream, builder.build()).render(
                new HashMap<String, Object>() {{
                    put("managementReview", managementReview);
                    put("superviseDateStr", managementReview.getSuperviseDate() == null ? null : managementReview.getSuperviseDate().format(formatter));
                }});
        try {
            response.setContentType("application/msword");
            String fileName = URLEncoder.encode(
                    managementReview.getFileName(), "UTF-8");
            response.setHeader("Content-disposition",
                    "attachment;filename=" + fileName + ".docx");
            OutputStream os = response.getOutputStream();
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
        }
    }
}
cnas-process/src/main/java/com/ruoyi/process/service/impl/QualitySuperviseServiceImpl.java
@@ -335,6 +335,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
@@ -524,25 +525,25 @@
    public void exportSuperviseDetailRecord(Integer superviseDetailsId, HttpServletResponse response) {
        QualitySuperviseDetailsRecord recordDto = qualitySuperviseDetailsRecordMapper.selectSuperviseDetailRecord(superviseDetailsId);
        //获取技术负责人的签名地址
        String ratifyUrl = null;
        if (recordDto.getRatifyUserId() != null) {
            ratifyUrl = userMapper.selectById(recordDto.getRatifyUserId()).getSignatureUrl();
            if (StringUtils.isBlank(ratifyUrl)) {
                throw new ErrorException("找不到技术负责人的签名");
            }
        // æŸ¥è¯¢æ£€æµ‹äººå‘˜
        User tserUser = new User();
        if (StringUtils.isNotBlank(recordDto.getTestMember())) {
            tserUser = userMapper.selectOne(Wrappers.<User>lambdaQuery()
                    .eq(User::getName, recordDto.getTestMember())
                    .last("limit 1"));
        }
        // èŽ·å–è·¯å¾„
        InputStream inputStream = this.getClass().getResourceAsStream("/static/supervision-detail-record.docx");
        ConfigureBuilder builder = Configure.builder();
        builder.useSpringEL(true);
        String finalRatifyUrl = ratifyUrl;
        User finalTserUser = tserUser;
        XWPFTemplate template = XWPFTemplate.compile(inputStream, builder.build()).render(
                new HashMap<String, Object>() {{
                    put("supervision", recordDto);
                    put("testMemberUrl", UserUtils.getFinalUserSignatureUrl(finalTserUser.getId()));
                    put("supervisoruUrl", UserUtils.getFinalUserSignatureUrl(recordDto.getSupervisor()));
                    put("technicalDirectorUrl", StringUtils.isNotBlank(finalRatifyUrl) ? Pictures.ofLocal(imgUrl + "/" + finalRatifyUrl).create() : null);
                    put("technicalDirectorUrl", UserUtils.getFinalUserSignatureUrl(recordDto.getRatifyUserId()));
                    put("technicalDirectorDateUrl", recordDto.getRatifyTime() != null ?
                            Pictures.ofStream(DateImageUtil.createDateImage(recordDto.getRatifyTime())).create() : null);
                }});
@@ -557,6 +558,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
@@ -875,6 +877,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
@@ -1253,6 +1256,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-process/src/main/java/com/ruoyi/process/task/QualitySuperviseSchedule.java
@@ -1,23 +1,33 @@
package com.ruoyi.process.task;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.core.domain.entity.User;
import com.ruoyi.common.utils.WxCpUtils;
import com.ruoyi.process.mapper.QualitySuperviseDetailsMapper;
import com.ruoyi.process.mapper.QualitySuperviseDetailsRecordMapper;
import com.ruoyi.process.mapper.QualitySuperviseManagementReviewMapper;
import com.ruoyi.process.pojo.QualitySuperviseDetails;
import com.ruoyi.process.pojo.QualitySuperviseDetailsRecord;
import com.ruoyi.process.pojo.QualitySuperviseManagementReview;
import com.ruoyi.system.mapper.UserMapper;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * åŸ¹è®­è®¡åˆ’使用提醒记录提醒
 * è´¨é‡ç›‘督填写提醒
 */
@Component
public class QualitySuperviseSchedule {
@@ -27,12 +37,16 @@
    private UserMapper userMapper;
    @Resource
    private ThreadPoolTaskExecutor threadPoolTaskExecutor;
    @Resource
    private QualitySuperviseManagementReviewMapper qualitySuperviseManagementReviewMapper;
    @Resource
    private QualitySuperviseDetailsRecordMapper qualitySuperviseDetailsRecordMapper;
    /**
     * æé†’填写设备使用记录
     * è´¨é‡ç›‘督填写提醒
     */
//    @Scheduled(cron = "0/5 * * * * *")
    @Scheduled(cron = "0 0 9 1 * *") // æ¯æœˆ1号执行
//    @Scheduled(cron = "0 0 9 1 * *") // æ¯æœˆ1号执行
    public void task1() {
        // æŸ¥è¯¢å½“月监督计划
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.M");
@@ -63,4 +77,66 @@
        }
    }
    /**
     * æ¯æœˆ28号自动生成质量监督总结
     */
//    @Scheduled(cron = "0/5 * * * * *")
//    @Scheduled(cron = "0 0 9 28 * *") // æ¯æœˆ28号执行
    public void task2() {
        LocalDateTime now = LocalDateTime.now();
        // æŸ¥è¯¢å½“月监督计划
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.M");
        String format = now.format(formatter);
        List<QualitySuperviseDetails> qualitySuperviseDetails = qualitySuperviseDetailsMapper.selectList(Wrappers.<QualitySuperviseDetails>lambdaQuery()
                .eq(QualitySuperviseDetails::getSuperviseTime, format));
        // æ ¹æ®å®šæœŸç›‘督和动态监督区分
        Map<String, List<QualitySuperviseDetails>> superviseReasonMap = qualitySuperviseDetails.stream().collect(Collectors.groupingBy(QualitySuperviseDetails::getSuperviseReason));
        // èŽ·å–å½“æœˆæ—¥æœŸ
        DateTimeFormatter formatter2 = DateTimeFormatter.ofPattern("yyyyå¹´MM月");
        String format2 = now.format(formatter2);
        // èŽ·å–è®¡åˆ’å†…å®¹
        String implementationSupervisee = "";
                List<QualitySuperviseDetails> implementationList = superviseReasonMap.get("定期监督");
        if (CollectionUtils.isNotEmpty(implementationList)) {
            // èŽ·å–å®šæœŸç›‘ç£äººå‘˜ä¿¡æ¯
            List<String> collect = implementationList.stream().map(QualitySuperviseDetails::getSupervisee).collect(Collectors.toList());
            implementationSupervisee = CollUtil.join(collect, ",");
        }
        String implementationContent = "工作中严格按照年度质量监督工作计划进行执行。{}对{}进行一次定期监督。在监督过程中,没有发现不符合的现象。检验员能熟练的按照规定的要求进行设备的操作,对于标准能熟记,所使用的设备均在校准周期内,能清楚完整的的记录原始数据并出具报告;在试验环境方面,能够严格的按照标准执行。";
        String formatImplementationContent = StrUtil.format(implementationContent, format2, implementationSupervisee);
        //获取动态内容
        String dynamicSupervisee = "";
        List<QualitySuperviseDetails> dynamicList = superviseReasonMap.get("动态监督");
        if (CollectionUtils.isNotEmpty(dynamicList)) {
            List<String> collect = dynamicList.stream()
                    .map(details ->  StrUtil.format("对{}动态监督1次在监督过程中", details.getSupervisee())).collect(Collectors.toList());
            dynamicSupervisee = CollUtil.join(collect, ";");
        }
        String dynamicContent = "在保证质量监督计划的同时,也坚持按照领导要求加强不定期监督动作。{}份{},没有发现不符合的现象。检验员能熟练的按照规定的要求进行设备的操作,对于标准能熟记,所使用的设备均在校准周期内,能清楚完整的的记录原始数据并出具报告;在试验环境方面,能够严格的按照标准执行。";
        String formatdynamicContent = StrUtil.format(dynamicContent, format2, dynamicSupervisee);
        // èŽ·å–ç›‘ç£å‘˜ä¿¡æ¯
        QualitySuperviseDetails superviseDetails = qualitySuperviseDetails.get(0);
        QualitySuperviseDetailsRecord detailsRecord = qualitySuperviseDetailsRecordMapper.selectOne(Wrappers.<QualitySuperviseDetailsRecord>lambdaQuery()
                .eq(QualitySuperviseDetailsRecord::getSuperviseDetailsId, superviseDetails.getSuperviseDetailsId())
                .last("limit 1"));
        String supervisor = detailsRecord.getSupervisor();
        // åˆ›å»ºè¯„审对象
        QualitySuperviseManagementReview managementReview = new QualitySuperviseManagementReview();
        String yearDate = now.format(DateTimeFormatter.ofPattern("yyyyå¹´"));
        String monthDate = now.format(DateTimeFormatter.ofPattern("MM月"));
        managementReview.setFileName(StrUtil.format("{}管理评审输入材料({})_{}", yearDate, supervisor, monthDate));
        managementReview.setImplementationContent(formatImplementationContent);
        managementReview.setDynamicContent(formatdynamicContent);
        managementReview.setSupervisor(supervisor);
        managementReview.setSuperviseDate(LocalDate.now());
        qualitySuperviseManagementReviewMapper.insert(managementReview);
    }
}
cnas-process/src/main/resources/mapper/ProcessDealMapper.xml
@@ -24,7 +24,7 @@
        </if>
    </select>
    <select id="selectDeal" resultType="com.ruoyi.process.pojo.ProcessDeal">
    <select id="selectDeal" resultType="com.ruoyi.process.dto.ProcessDealDto">
        select ROW_NUMBER() OVER (ORDER BY id) AS indexs,
               id,
               sample_name,
@@ -32,7 +32,7 @@
               sample_supplier,
               num,
               deal_method,
               deal_time
               DATE_FORMAT(deal_time, '%Y-%m-%d') dealTimeStr
        from cnas_process_deal
        where totaldeal_id = #{id}
    </select>
cnas-process/src/main/resources/mapper/ProcessReportMapper.xml
@@ -18,7 +18,7 @@
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
    </resultMap>
    <select id="pageProcessReport" resultType="com.ruoyi.process.pojo.ProcessReport">
    <select id="pageProcessReport" resultType="com.ruoyi.process.dto.ProcessReportDto">
        select * from (select cpr.* ,
        u1.name sendUserName
        from cnas_process_report cpr
@@ -27,16 +27,11 @@
            ${ew.customSqlSegment}
        </if>
    </select>
    <select id="getIds" resultType="com.ruoyi.process.pojo.ProcessReport">
    <select id="exportProcessReport" resultType="com.ruoyi.process.dto.ProcessReportDto">
        select ROW_NUMBER() OVER (ORDER BY cpr.id) AS indexs,
        cpr.* ,
        u1.name sendUserName
        u1.signature_url sendUserUrl
        from cnas_process_report cpr
        left join user u1 on send_user=u1.id
        where 1=1
        and cpr.id in
        <foreach collection="ids" separator="," item="id" open="(" close=")">
            #{id}
        </foreach>
    </select>
</mapper>
cnas-process/src/main/resources/mapper/QualitySuperviseManagementReviewMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.process.mapper.QualitySuperviseManagementReviewMapper">
    <select id="pageManagementReview" resultType="com.ruoyi.process.pojo.QualitySuperviseManagementReview">
        select *
        from cnas_quality_supervise_management_review
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
    </select>
</mapper>
cnas-process/src/main/resources/static/report-deal.docx
Binary files differ
cnas-process/src/main/resources/static/sample-deal.docx
Binary files differ
cnas-process/src/main/resources/static/supervise-management-eview.docx
Binary files differ
cnas-process/src/main/resources/static/supervision-detail-record.docx
Binary files differ
cnas-require/src/main/java/com/ruoyi/require/service/impl/FeCalibrationScheduleServiceImpl.java
@@ -50,7 +50,6 @@
        Configure configure = Configure.builder()
                .bind("feCalibrationSchedule", new HackLoopTableRenderPolicy())
                .build();
        FeCalibrationSchedule feCalibrationSchedule = size > 0 ? feCalibrationSchedules.get(0) : null;
        XWPFTemplate template = XWPFTemplate.compile(inputStream, configure).render(
                new HashMap<String, Object>() {{
                    put("feCalibrationSchedule", feCalibrationSchedules);
@@ -67,6 +66,8 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-require/src/main/java/com/ruoyi/require/service/impl/FeIlluminationServiceImpl.java
@@ -36,7 +36,7 @@
 * è®¾æ–½å’ŒçŽ¯å¢ƒæ¡ä»¶-设施和环境条件要求-照度记录表 æœåŠ¡å®žçŽ°ç±»
 * </p>
 *
 * @author
 * @author
 * @since 2024-11-07 04:15:57
 */
@Service
@@ -115,6 +115,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-require/src/main/java/com/ruoyi/require/service/impl/FePowerStableServiceImpl.java
@@ -115,6 +115,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-require/src/main/java/com/ruoyi/require/service/impl/FeTempHumDateServiceImpl.java
@@ -121,6 +121,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-require/src/main/java/com/ruoyi/require/service/impl/ForeignRegisterServiceImpl.java
@@ -93,6 +93,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-require/src/main/java/com/ruoyi/require/service/impl/InternalWastesServiceImpl.java
@@ -159,6 +159,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
cnas-require/src/main/java/com/ruoyi/require/task/FeTempHumDateSchedule.java
@@ -86,7 +86,7 @@
     * èŽ·å–æ¸©åº¦æ¹¿åº¦
     */
//    @Scheduled(cron = "0/5 * * * * *")
    @Scheduled(cron = "0 0 9 * * 1-6") // æ¯å¤©9点执行一次 é™¤äº†æ˜ŸæœŸå¤©
//    @Scheduled(cron = "0 0 9 * * 1-6") // æ¯å¤©9点执行一次 é™¤äº†æ˜ŸæœŸå¤©
    public void task1() {
        checkLaboratoriesSchedule();
        // æ ¹æ®æ—¶é—´é™åºï¼ŒèŽ·å–åˆ°æœ€æ–°çš„ä¸€æ¡æ•°æ®
@@ -183,7 +183,7 @@
     * èŽ·å–æ¸©åº¦æ¹¿åº¦
     */
//    @Scheduled(cron = "0/5 * * * * *")
    @Scheduled(cron = "0 0 14 * * 1-5") // æ¯å¤©14点执行一次 é™¤äº†æ˜ŸæœŸå…­å’Œæ˜ŸæœŸå¤©
//    @Scheduled(cron = "0 0 14 * * 1-5") // æ¯å¤©14点执行一次 é™¤äº†æ˜ŸæœŸå…­å’Œæ˜ŸæœŸå¤©
    public void task2() {
        // æ£€æŸ¥å®žéªŒå®¤æ˜¯å¦æœ‰ä»»åŠ¡ å¦‚果没有新增任务
@@ -295,7 +295,7 @@
     * èŽ·å–æ¸©åº¦æ¹¿åº¦
     */
//    @Scheduled(cron = "0/5 * * * * *")
    @Scheduled(cron = "0 0 9 * * 7") //
//    @Scheduled(cron = "0 0 9 * * 7") //
    public void task3() {
        checkLaboratoriesSchedule();
@@ -338,7 +338,7 @@
     *
     */
//    @Scheduled(cron = "0/5 * * * * *")
    @Scheduled(cron = "0 0 16 * * 1-6") // æ¯å¤©15点执行一次 é™¤äº†æ˜ŸæœŸå¤©
//    @Scheduled(cron = "0 0 16 * * 1-6") // æ¯å¤©15点执行一次 é™¤äº†æ˜ŸæœŸå¤©
    public void affirmTempHum() {
        // æŸ¥è¯¢æœ‰æ—¥æœŸä½†æ˜¯æœªå¡«å†™åå­—çš„
        List<FeTempHumRecordDto> feTempHumRecordList = feTempHumRecordMapper.selectNoaffirm(LocalDate.now());
inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderController.java
@@ -267,4 +267,10 @@
        return Result.success();
    }
    @ApiOperation(value = "查询当前时间是否没有该检测项的抽样计划")
    @PostMapping("/judgeNotSpotCheckOrder")
    public Result<?> judgeNotSpotCheckOrder(@RequestBody InsPlaceOrderDto insPlaceOrderDto) {
        return insOrderService.judgeNotSpotCheckOrder(insPlaceOrderDto.getSampleList(), insPlaceOrderDto.getInsOrder());
    }
}
inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderPlanController.java
@@ -114,8 +114,7 @@
    @ApiOperation(value = "保存检验内容")
    @PostMapping("/saveInsContext")
    public Result<?> saveInsContext(@RequestBody SaveInsContextDto saveInsContextDto) {
        Map<String, Object> param2 = JSON.parseObject(saveInsContextDto.getParam(), Map.class);
        insOrderPlanService.saveInsContext(param2, saveInsContextDto.getCurrentTable(), saveInsContextDto.getSampleId(), saveInsContextDto.getOrderId(), saveInsContextDto.getSonLaboratory());
        insOrderPlanService.saveInsContext(saveInsContextDto);
        return Result.success();
    }
@@ -244,7 +243,8 @@
    @GetMapping("/getBindingProductByProductId")
    public Result<List<InsProduct>> getBindingProductByProductId(Integer productId) {
        return Result.success(insProductService.list(Wrappers.<InsProduct>lambdaQuery()
                .eq(InsProduct::getBindingProductId, productId)));
                .eq(InsProduct::getBindingProductId, productId)
                .orderByAsc(InsProduct::getSort)));
    }
inspect-server/src/main/java/com/ruoyi/inspect/dto/SampleProductDto.java
@@ -13,8 +13,6 @@
    @ApiModelProperty("检验项目")
    private List<InsProduct> insProduct;
//    private List<BushingDto> bushing;
    @ApiModelProperty("子样品配置")
    private List<SampleProductDto> childSampleList;
@@ -23,8 +21,6 @@
    @ApiModelProperty("辅助线芯配置")
    private InsulatingDto auxiliaryWireCore;
//    private SheathDto sheath;
    @ApiModelProperty("检验人")
    private String checkName;
inspect-server/src/main/java/com/ruoyi/inspect/dto/SaveInsContextDto.java
@@ -1,19 +1,29 @@
package com.ruoyi.inspect.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * ä¿å­˜æ¨¡æ¿ä¼ å‚
 */
@Data
//保存检验内容传参
public class SaveInsContextDto {
    //模板内容
    @ApiModelProperty("模板内容")
    private String param;
    //当前模板id
    @ApiModelProperty("当前模板id")
    private Integer currentTable;
    //当前样品id
    @ApiModelProperty("当前样品id")
    private Integer sampleId;
    //当前订单id
    @ApiModelProperty("当前订单id")
    private Integer orderId;
    //子试验室
    @ApiModelProperty("子试验室")
    private String sonLaboratory;
    @ApiModelProperty("是否没有检验值")
    private Integer isNoTestValue;
}
inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderMapper.java
@@ -5,7 +5,6 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.basic.pojo.StructureTestObject;
import com.ruoyi.inspect.dto.CostStatisticsDto;
import com.ruoyi.inspect.dto.SampleOrderDto;
import com.ruoyi.inspect.dto.SampleProductDto2;
import com.ruoyi.inspect.dto.SampleProductExportDto;
@@ -136,4 +135,13 @@
     * @return
     */
    List<SampleOrderDto> getInsOrderExportByIds(@Param("orderIds") List<String> orderIds);
    /**
     * æŸ¥è¯¢å½“前时间是否有该检测项的抽样计划订单
     * @param itmeId    æ ·å“Id
     * @param startTime å¼€å§‹æ—¶é—´
     * @param endTime   ç»“束时间
     * @return
     */
    Integer selectNotSpotCheckOrder(@Param("itmeId") Integer itmeId, @Param("startTime") String startTime, @Param("endTime") String endTime);
}
inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderPlanService.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.inspect.dto.InsOrderPlanDTO;
import com.ruoyi.inspect.dto.InsOrderPlanProductDto;
import com.ruoyi.inspect.dto.SaveInsContextDto;
import com.ruoyi.inspect.pojo.InsOrderFactoryVerify;
import com.ruoyi.inspect.pojo.InsOrderFile;
import com.ruoyi.inspect.pojo.InsProduct;
@@ -25,7 +26,7 @@
    boolean claimInsOrderPlan(InsOrderPlanDTO entity);
    void saveInsContext(Map<String, Object> insContext,Integer currentTable,Integer sampleId,Integer orderId,String sonLaboratory);
    void saveInsContext(SaveInsContextDto saveInsContextDto);
    Map<String, Object> doInsOrder(Integer id, String laboratory);
inspect-server/src/main/java/com/ruoyi/inspect/service/InsOrderService.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.pojo.StandardProductList;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.inspect.pojo.InsOrder;
import com.ruoyi.inspect.pojo.InsSample;
import com.ruoyi.inspect.pojo.InsUnqualifiedRetestProduct;
@@ -114,4 +115,12 @@
     * @param insSample
     */
    void updateSampleModel(InsSample insSample);
    /**
     * æŸ¥è¯¢å½“前时间是否没有该检测项的抽样计划
     * @param sampleList
     * @param insOrder
     * @return
     */
    Result judgeNotSpotCheckOrder(List<SampleProductDto> sampleList, InsOrder insOrder);
}
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/FinishProductSpotCheckServiceImpl.java
@@ -476,6 +476,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("导出失败");
@@ -669,6 +670,7 @@
            template.write(os);
            os.flush();
            os.close();
            inputStream.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
@@ -361,15 +361,16 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void saveInsContext(Map<String, Object> insContext, Integer currentTable, Integer currentSampleId, Integer orderId, String sonLaboratory) {
    public void saveInsContext(SaveInsContextDto saveInsContextDto) {
        Map<String, Object> insContext = JSON.parseObject(saveInsContextDto.getParam(), Map.class);
        Integer userId = SecurityUtils.getUserId().intValue();
        InsSample insSample = insSampleMapper.selectById(currentSampleId);
        InsSample insSample = insSampleMapper.selectById(saveInsContextDto.getSampleId());
        insContext.forEach((k, v) -> {
            JSONObject jo = JSON.parseObject(JSON.toJSONString(v));
            InsProduct insProduct = new InsProduct();
            insProduct.setId(Integer.parseInt(k));
            InsProduct product = insProductMapper.selectById(insProduct.getId());
            if (currentTable.equals(product.getTemplateId()) && currentSampleId.equals(product.getInsSampleId())) {
            if (saveInsContextDto.getCurrentTable().equals(product.getTemplateId()) && saveInsContextDto.getSampleId().equals(product.getInsSampleId())) {
                List<InsProductResult> oldResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery()
                        .eq(InsProductResult::getInsProductId, insProduct.getId()));
                InsProductResult newResult = new InsProductResult();
@@ -502,22 +503,31 @@
                // æ·»åŠ å·¥æ—¶
                // åˆ¤æ–­æ˜¯å¦åªæ˜¯å‚与计算值, å‚与计算值实际没有填写
                if (StringUtils.isNotBlank(newResult.getInsValue()) && !newResult.getInsValue().equals("[]")) {
                    InsProduct finalInsProduct = insProductMapper.selectById(product.getId());
                    threadPoolTaskExecutor.execute(() -> {
                        InsProduct finalInsProduct = insProductMapper.selectById(product.getId());
                        InsOrder insOrder = insOrderMapper.selectById(insSample.getInsOrderId());
                        this.addAuxiliary(userId, finalInsProduct, insOrder);
                    });
                } else {
                    // åˆ¤æ–­æ˜¯å¦æ˜¯æ²¡æœ‰æ£€éªŒå€¼çš„内容
                    if (saveInsContextDto.getIsNoTestValue() != null && saveInsContextDto.getIsNoTestValue() == 1) {
                        threadPoolTaskExecutor.execute(() -> {
                            InsProduct finalInsProduct = insProductMapper.selectById(product.getId());
                            InsOrder insOrder = insOrderMapper.selectById(insSample.getInsOrderId());
                            this.addAuxiliary(userId, finalInsProduct, insOrder);
                        });
                    }
                }
            }
        });
        String sampleIdStr = insContext.keySet().stream().findFirst().orElse(null);
        if (sampleIdStr != null) {
            int count = insProductMapper.selectInsProductCountByOrderId(orderId);
            int count = insProductMapper.selectInsProductCountByOrderId(saveInsContextDto.getOrderId());
            if (count == 0) {
                insOrderStateMapper.update(new InsOrderState(), Wrappers.<InsOrderState>lambdaUpdate()
                        .eq(InsOrderState::getInsOrderId, orderId)
                        .eq(InsOrderState::getLaboratory, sonLaboratory)
                        .eq(InsOrderState::getInsOrderId, saveInsContextDto.getOrderId())
                        .eq(InsOrderState::getLaboratory, saveInsContextDto.getSonLaboratory())
                        .set(InsOrderState::getInsState, 2));
            }
        }
@@ -605,20 +615,6 @@
     */
    private void getTemplateThing(InsOrder order, List<InsProduct> insProducts) {
        Set<Integer> set = new HashSet<>();
        // æ£€éªŒé¡¹åˆ†ç±»+检验项+检验子项的拼接
//        List<String> itemNameList = insProducts.stream().map(insProduct -> {
//            String itemName = "";
//            if (StringUtils.isNotBlank(insProduct.getInspectionItemClass())) {
//                itemName += insProduct.getInspectionItemClass().trim();
//            }
//            if (StringUtils.isNotBlank(insProduct.getInspectionItem())) {
//                itemName += insProduct.getInspectionItem().trim();
//            }
//            if (StringUtils.isNotBlank(insProduct.getInspectionItemSubclass())) {
//                itemName += insProduct.getInspectionItemSubclass().trim();
//            }
//            return itemName;
//        }).collect(Collectors.toList());
        // æŸ¥è¯¢è®¢å•状态判断是否是查历史模板
        if (order.getIsFirstSubmit() != null && order.getIsFirstSubmit().equals(1)) {
            InsOrderState insOrderState = insOrderStateMapper.selectOne(Wrappers.<InsOrderState>lambdaQuery()
@@ -822,10 +818,9 @@
        // 5.发送消息通知给复核人
        // æŸ¥è¯¢å½“前人信息
        Integer userId = SecurityUtils.getUserId().intValue();
        Map<String, String> userMap = insProductMapper.selectUserById(verifyUser);
        String userName = userMap.get("name");
        String userName = insProductMapper.selectUserById(userId).get("name");
        // æŸ¥è¯¢å‘送人信息
        String sendUserAccount = userMap.get("account");
        String sendUserAccount = insProductMapper.selectUserById(verifyUser).get("account");
        InformationNotification info = new InformationNotification();
        info.setCreateUser(userName);
        info.setMessageType("2");
@@ -967,13 +962,13 @@
     * @param ifsInventoryQuantity
     * @param order
     */
    private void addAnalysis(List<InsProduct> productList, IfsInventoryQuantity ifsInventoryQuantity, InsOrder order, String userName) {
    private void addAnalysis(List<InsProduct> productList, IfsInventoryQuantity ifsInventoryQuantity, InsOrder order, String sendUserAccount) {
        for (InsProduct insProduct : productList) {
            // åˆ¤æ–­æ˜¯å¦æ˜¯æ•°å€¼ç±»åž‹
            if (insProduct.getInspectionValueType().equals("1") && insProduct.getInsResult().equals(1)) {
                List<InsProductDeviationWarningDetail> insProductAnalysisDtoList = insProductMapper.selectAnalysis(insProduct, ifsInventoryQuantity.getSupplierName());
                if (insProductAnalysisDtoList.size() < 5) {
                if (insProductAnalysisDtoList.size() < 10) {
                    continue;
                }
@@ -1034,10 +1029,10 @@
                            message += "\n检验项: " + insProduct.getInspectionItem() + insProduct.getInspectionItemSubclass();
                            message += "\n偏差超过了 10%";
                            // å‘送给提交人
                            WxCpUtils.inform(userName, message, null);
                            // todo: å‘送给检测中心主任(固定死)
                            WxCpUtils.inform("ZT-004704", message, null);
//                            WxCpUtils.inform(sendUserAccount, message, null);
//
//                            // todo: å‘送给检测中心主任(固定死)
//                            WxCpUtils.inform("ZT-004704", message, null);
                        } catch (Exception e) {
                            e.printStackTrace();
                            log.error("偏差预警企业微信通知报错");
@@ -2015,7 +2010,7 @@
            insReportMapper.delete(Wrappers.<InsReport>lambdaQuery()
                    .eq(InsReport::getInsOrderId, insOrder.getId()));
            insReportMapper.insert(insReport);
            inputStream.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
@@ -2568,6 +2563,7 @@
            insReportMapper.delete(Wrappers.<InsReport>lambdaQuery()
                    .eq(InsReport::getInsOrderId, insOrder.getId()));
            insReportMapper.insert(insReport);
            inputStream.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
@@ -4242,6 +4238,11 @@
        // ä¿å­˜åˆ°é™„件里面
        uploadFile(insOrderId, multipartFile);
        try {
            inputStream.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java
@@ -13,15 +13,18 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper;
import com.ruoyi.basic.mapper.StandardProductListMapper;
import com.ruoyi.basic.mapper.StructureItemParameterMapper;
import com.ruoyi.basic.pojo.IfsInventoryQuantity;
import com.ruoyi.basic.pojo.StandardProductList;
import com.ruoyi.basic.pojo.StructureItemParameter;
import com.ruoyi.basic.pojo.StructureTestObject;
import com.ruoyi.common.constant.InsOrderTypeConstants;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.common.core.domain.entity.User;
import com.ruoyi.common.numgen.NumberGenerator;
import com.ruoyi.common.utils.*;
@@ -35,8 +38,6 @@
import com.ruoyi.inspect.service.InsProductService;
import com.ruoyi.inspect.service.InsSampleService;
import com.ruoyi.inspect.vo.InsOrderPrintingVo;
import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHoursTemporary;
import com.ruoyi.performance.service.AuxiliaryOutputWorkingHoursTemporaryService;
import com.ruoyi.system.mapper.UserMapper;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
@@ -82,14 +83,13 @@
    private IfsApiUtils ifsApiUtils;
    private SpotCheckQuarterItemMapper spotCheckQuarterItemMapper;
    private StandardProductListMapper standardProductListMapper;
    private AuxiliaryOutputWorkingHoursTemporaryService auxiliaryOutputWorkingHoursTemporaryService;
    private StructureItemParameterMapper structureItemParameterMapper;
    //获取检验下单数据
    @Override
    public IPage<SampleOrderDto> selectInsOrderParameter(IPage<InsOrder> page, SampleOrderDto sampleOrderDto) {
        //todo: åªçœ‹æˆ‘判断全部,个人,组织的权限
        String laboratory = null;
        // åˆ¤æ–­æ˜¯å¦æ˜¯å…¨éƒ¨
        String isOrderAll = null;
@@ -155,53 +155,9 @@
            spotCheckQuarterItemMapper.updateById(spotCheckQuarterItem);
        }
        // åˆ›å»ºå·¥æ—¶æš‚å­˜
        // ç¼“存样品id, ç¼–号map
//        addWorkingHoursTemporary(userId, insSamples, ids, order);
        return 1;
    }
    /**
     * åˆ›å»ºå·¥æ—¶æš‚å­˜
     * @param userId
     * @param insSamples
     * @param ids
     * @param order
     */
    private void addWorkingHoursTemporary(Integer userId, List<InsSample> insSamples, List<Integer> ids, InsOrder order) {
        Map<Integer, String> sampleMap = insSamples.stream().collect(Collectors.toMap(InsSample::getId, InsSample::getSampleCode));
        List<InsProduct> insProductList = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
                .in(InsProduct::getInsSampleId, ids)
                .eq(InsProduct::getState, 1));
        List<AuxiliaryOutputWorkingHoursTemporary> outputWorkingHours = insProductList.stream().map(insProduct -> {
            AuxiliaryOutputWorkingHoursTemporary auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHoursTemporary();
            auxiliaryOutputWorkingHours.setInspectionItemClass(insProduct.getInspectionItemClass());//检测项分类
            auxiliaryOutputWorkingHours.setInspectionItem(insProduct.getInspectionItem());//检测父项
            auxiliaryOutputWorkingHours.setInspectionItemSubclass(insProduct.getInspectionItemSubclass());//检测子项
            auxiliaryOutputWorkingHours.setSample(sampleMap.get(insProduct.getInsSampleId()));//样品编号
            auxiliaryOutputWorkingHours.setOrderId(order.getId());//订单id
            auxiliaryOutputWorkingHours.setOrderNo(order.getEntrustCode());//非加班委托单号
            auxiliaryOutputWorkingHours.setWorkTime(insProduct.getManHour());//非加班工时
            auxiliaryOutputWorkingHours.setAmount(1);//非加班数量
            auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime()) ? auxiliaryOutputWorkingHours.getOvertimeWorkTime() : BigDecimal.ZERO).add(ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime()) ? auxiliaryOutputWorkingHours.getWorkTime() : BigDecimal.ZERO));//产量工时
            auxiliaryOutputWorkingHours.setManHourGroup(insProduct.getManHourGroup());//工时分组
            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
            DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
            auxiliaryOutputWorkingHours.setDateTime(LocalDateTime.now().toLocalDate().atStartOfDay().format(formatters));//日期
            LocalDateTime localDateTime = LocalDateTime.now();
            DateTime parse = DateUtil.parse(localDateTime.format(formatter));
            auxiliaryOutputWorkingHours.setWeekDay(getWeek(localDateTime.format(formatters)));//星期
            auxiliaryOutputWorkingHours.setWeek(String.valueOf(DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1))));//周次
            auxiliaryOutputWorkingHours.setCheck(userId);//检测人
            auxiliaryOutputWorkingHours.setPrice(insProduct.getPrice());//单价
            auxiliaryOutputWorkingHours.setSampleId(insProduct.getInsSampleId());//样品id
            auxiliaryOutputWorkingHours.setInsProductId(insProduct.getId());//检验项id
            return auxiliaryOutputWorkingHours;
        }).collect(Collectors.toList());
        auxiliaryOutputWorkingHoursTemporaryService.saveBatch(outputWorkingHours);
    }
    public static String getWeek(String dayStr) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -237,6 +193,19 @@
            default:
                return "未知";
        }
    }
    // å¦‚果你使用 Java 8+,也可以用 Stream API ç®€åŒ–代码:
    public List<StandardProductList> findMissingItemsWithStream(List<StandardProductList> standardList,
                                                                List<InsProduct> insList) {
        Set<Integer> insIds = insList.stream()
                .map(InsProduct::getStructureItemParameterId)
                .collect(Collectors.toSet());
        return standardList.stream()
                .filter(product -> !insIds.contains(product.getStructureItemParameterId()))
                .collect(Collectors.toList());
    }
    @Override
@@ -906,6 +875,10 @@
        // ä¿®æ”¹æ£€éªŒé¡¹
        for (SampleProductDto sampleProductDto : insOrderUpdateDto.getSampleProduct()) {
            insSampleService.update(Wrappers.<InsSample>lambdaUpdate()
                    .eq(InsSample::getId, sampleProductDto.getId())
                    .set(InsSample::getSpecialStandardMethod, sampleProductDto.getSpecialStandardMethod()));
            insProductService.updateBatchById(sampleProductDto.getInsProduct());
        }
@@ -1057,6 +1030,122 @@
                .set(InsSample::getModel, insSample.getModel()));
    }
    /**
     * æŸ¥è¯¢å½“前时间是否没有该检测项的抽样计划
     * @param sampleList
     * @param insOrder
     * @return
     */
    @Override
    public Result judgeNotSpotCheckOrder(List<SampleProductDto> sampleList, InsOrder insOrder) {
        // todo: ä¸‹å•判断抽样计划的唯一性
        if (insOrder.getQuarterItemId() != null) {
            Long quarterItemCount = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery()
                    .eq(InsOrder::getQuarterItemId, insOrder.getQuarterItemId())
                    .notIn(InsOrder::getState, -1 ,2 ,3));
            if (quarterItemCount > 0) {
                throw new ErrorException("该抽样计划已被绑定过");
            }
        }
        // åˆ¤æ–­æ˜¯å¦æ˜¯æŠ½æ ·æ£€æµ‹
        if (insOrder.getOrderType().equals(InsOrderTypeConstants.SPOT_CHECK)) {
            Set<String> monthMessageSet = new HashSet<>();
            Set<String> quarterMessageSet = new HashSet<>();
            Set<String> yearMessageSet = new HashSet<>();
            String formatTime = "yyyy-MM-dd HH:mm:ss";
            // æŸ¥è¯¢å½“前所有样品的检验项
            for (SampleProductDto sampleProductDto : sampleList) {
                List<StandardProductList> standardProductList = getProductTreeBySampleId(sampleProductDto.getId());
                Set<Integer> insIds = sampleProductDto.getInsProduct().stream()
                        .map(InsProduct::getStructureItemParameterId)
                        .collect(Collectors.toSet());
                List<StandardProductList> productLists = standardProductList.stream()
                        .filter(product -> !insIds.contains(product.getStructureItemParameterId()))
                        .collect(Collectors.toList());
                // æŸ¥è¯¢æ£€éªŒé¡¹åŸºç¡€è¡¨, æŸ¥è¯¢æ˜¯å¦æœ‰æœˆåº¦, å­£åº¦, å¹´åº¦çš„æ£€éªŒé¡¹
                List<StructureItemParameter> itemParameterList = structureItemParameterMapper.selectList(Wrappers.<StructureItemParameter>lambdaQuery()
                        .in(StructureItemParameter::getId, productLists.stream().map(StandardProductList::getStructureItemParameterId).collect(Collectors.toList())));
                for (StructureItemParameter item : itemParameterList) {
                    if (StringUtils.isNotBlank(item.getSpotCheckType())) {
                        switch (item.getSpotCheckType()) {
                            case "1": // æœˆåº¦
                                // æŸ¥è¯¢å½“月是否有该检测项的抽样计划
                                // å½“月开始时间
                                DateTime monthStart = DateUtil.beginOfMonth(DateUtil.date());
                                String monthStartTime = monthStart.toString(formatTime);
                                // å½“月结束时间
                                DateTime monthEnd = DateUtil.endOfMonth(DateUtil.date());
                                String monthEndTime = monthEnd.toString(formatTime);
                                Integer count = insOrderMapper.selectNotSpotCheckOrder(item.getId(), monthStartTime, monthEndTime);
                                if (count == 0) {
                                    String monthMessage = item.getInspectionItemClass() +
                                            item.getInspectionItem() +
                                            item.getInspectionItemSubclass();
                                    monthMessageSet.add(monthMessage);
                                }
                                break;
                            case "2": // å­£åº¦
                                DateTime quarterStart = DateUtil.beginOfQuarter(DateUtil.date());
                                String quarterStartTime = quarterStart.toString(formatTime);
                                // å½“月结束时间
                                DateTime quarterEnd = DateUtil.endOfQuarter(DateUtil.date());
                                String quarterEndTime = quarterEnd.toString(formatTime);
                                Integer quarterCount = insOrderMapper.selectNotSpotCheckOrder(item.getId(), quarterStartTime, quarterEndTime);
                                if (quarterCount == 0) {
                                    String quarterMessage = item.getInspectionItemClass() +
                                            item.getInspectionItem() +
                                            item.getInspectionItemSubclass();
                                    quarterMessageSet.add(quarterMessage);
                                }
                                break;
                            case "3": // å¹´åº¦
                                DateTime yearStart = DateUtil.beginOfQuarter(DateUtil.date());
                                String yearStartTime = yearStart.toString(formatTime);
                                // å½“月结束时间
                                DateTime yearEnd = DateUtil.endOfQuarter(DateUtil.date());
                                String yearEndTime = yearEnd.toString(formatTime);
                                Integer yearCount = insOrderMapper.selectNotSpotCheckOrder(item.getId(), yearStartTime, yearEndTime);
                                if (yearCount == 0) {
                                    String yearMessage = item.getInspectionItemClass() +
                                            item.getInspectionItem() +
                                            item.getInspectionItemSubclass();
                                    yearMessageSet.add(yearMessage);
                                }
                                break;
                        }
                    }
                }
            }
            String message = "";
            if (CollectionUtils.isNotEmpty(monthMessageSet)) {
                message += StrUtil.format("<p>检验项<span style=\"color: red\">{}</span>当月还未进行抽样检测, è¯·æŸ¥çœ‹æ˜¯å¦éœ€è¦æ·»åŠ å½“å‰æ£€éªŒé¡¹</p>", CollUtil.join(monthMessageSet, ", "));
            }
            if (CollectionUtils.isNotEmpty(quarterMessageSet)) {
                message += StrUtil.format("<p>检验项<span style=\"color: red\">{}</span>当前季度还未进行抽样检测, è¯·çœ‹æ˜¯å¦éœ€è¦æ·»åŠ å½“å‰æ£€éªŒé¡¹</p>", CollUtil.join(quarterMessageSet, ", "));
            }
            if (CollectionUtils.isNotEmpty(yearMessageSet)) {
                message += StrUtil.format("<p>检验项<span style=\"color: red\">{}</span>今年还未进行抽样检测, è¯·çœ‹æ˜¯å¦éœ€è¦æ·»åŠ å½“å‰æ£€éªŒé¡¹</p>", CollUtil.join(yearMessageSet, ", "));
            }
            if (StringUtils.isNotBlank(message)) {
                return Result.success(false, message);
            }
        }
        return Result.success(true);
    }
}
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductServiceImpl.java
@@ -135,7 +135,8 @@
            product.setTemplate(null);
            product.setStyle(null);
            return product;
        }).collect(Collectors.toList());
        }).sorted((o1, o2) -> (o1.getSort() == null ? 0 : o1.getSort())
                - (o2.getSort() == null ? 0 : o2.getSort())).collect(Collectors.toList());
        return insProducts;
    }
inspect-server/src/main/resources/mapper/InsOrderMapper.xml
@@ -455,4 +455,18 @@
        GROUP BY io.id,type
        order by type desc,io.id desc
    </select>
    <!-- æŸ¥è¯¢å½“前时间是否有该检测项的抽样计划订单 -->
    <select id="selectNotSpotCheckOrder" resultType="java.lang.Integer">
        select count(*)
        from (select io.id
              from ins_product ip
                       left join ins_sample is2 on is2.id = ip.ins_sample_id
                       left join ins_order io on io.id = is2.ins_order_id
                       left join spot_check_quarter_item scqi on scqi.quarter_item_id = io.quarter_item_id
              where io.quarter_item_id is not null
                and scqi.spot_check_time between #{startTime} and #{endTime}
                and ip.structure_item_parameter_id = #{itmeId}
              group by io.id) a
    </select>
</mapper>
inspect-server/src/main/resources/static/report-template.docx
Binary files differ
ruoyi-common/src/main/java/com/ruoyi/common/utils/SignatureImageUtil.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,66 @@
package com.ruoyi.common.utils;
import org.springframework.core.io.ClassPathResource;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.font.FontRenderContext;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.*;
/**
 * @Author zhuo
 * @Date 2025/5/7
 */
public class SignatureImageUtil {
    /**
     * æ ¹æ®ä¸­æ–‡å¯¼å‡ºç­¾åå›¾ç‰‡
     * @param text
     * @return
     * @throws IOException
     * @throws FontFormatException
     */
    public static InputStream saveImageToFile(String text){
        // èŽ·å–å­—ä½“åº“
        Font font = null;
        try (InputStream is = new ClassPathResource("/ttf/signature.ttf").getInputStream()) {
            font = Font.createFont(Font.TRUETYPE_FONT, is).deriveFont(50f);
        } catch (FontFormatException | IOException e) {
            throw new RuntimeException(e);
        }
        int width = 100; // å›¾ç‰‡çš„宽度
        int height = 50; // å›¾ç‰‡çš„高度
        BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
        Graphics2D g2d = image.createGraphics();
        g2d.setFont(font);
        // è®¾ç½®æ–‡å­—颜色为黑色
        g2d.setColor(Color.black);
        // è®¾ç½®æ–‡å­—在图片中的位置
        FontRenderContext context = g2d.getFontRenderContext();
        Rectangle2D bounds = font.getStringBounds(text, context);
        double x = (width - bounds.getWidth()) / 2;
        double y = (height - bounds.getHeight()) / 2;
        double ascent = -bounds.getY();
        double baseY = y + ascent;
        g2d.drawString(text, (int) x, (int) baseY);
        g2d.dispose();
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        try {
            ImageIO.write(image, "png", os);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return new ByteArrayInputStream(os.toByteArray());
    }
}
ruoyi-common/src/main/java/com/ruoyi/common/utils/WxCpUtils.java
@@ -93,7 +93,7 @@
    }
    /**
     * todo:推送群消息
     * æŽ¨é€ç¾¤æ¶ˆæ¯
     *
     * @param webHook ä¼ä¸šå¾®ä¿¡æœºå™¨äººåœ°å€
     * @param content æ•°æ®
ruoyi-common/src/main/resources/ttf/signature.ttf
Binary files differ