From d59198dda60c6009b801930acd67faad89d128d9 Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期四, 31 七月 2025 09:21:58 +0800
Subject: [PATCH] 三保工单定时任务

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/job/ThirdMaintenanceOrderLockedJob.java                |   70 +++++++
 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentExtendServiceImpl.java |   24 ++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/job/ThirdMaintenanceOrderExpiredJob.java               |   77 +++-----
 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentServiceImpl.java       |   10 +
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamThirdMaintenanceRequest.java                |   14 +
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamThirdMaintenanceOrderServiceImpl.java  |   35 +++
 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamThirdMaintenanceOrderDetail.java      |   13 +
 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentMapper.xml               |   21 ++
 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentExtendService.java         |   10 +
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/job/TechnicalStatusEvaluationGenerateJob.java          |    4 
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamMaintenanceStandardServiceImpl.java    |   10 +
 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentMapper.java                  |    7 
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamThirdMaintenanceOrderService.java          |   15 +
 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentService.java               |    5 
 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/MaintenanceStatusEnum.java             |    8 
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamMaintenanceStandardService.java            |    8 
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/job/ThirdMaintenanceOrderGenerateJob.java              |  207 ++++++++++++++--------
 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/ThirdMaintenanceStatusEnum.java        |    1 
 18 files changed, 415 insertions(+), 124 deletions(-)

diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/MaintenanceStatusEnum.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/MaintenanceStatusEnum.java
new file mode 100644
index 0000000..37039a6
--- /dev/null
+++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/MaintenanceStatusEnum.java
@@ -0,0 +1,8 @@
+package org.jeecg.modules.eam.constant;
+
+public enum MaintenanceStatusEnum {
+    QUALIFIED, //鍚堟牸
+    RESTRICTED, //闄愮敤
+    PROHIBITED, //绂佺敤
+    ;
+}
diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/ThirdMaintenanceStatusEnum.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/ThirdMaintenanceStatusEnum.java
index a14be14..1332d43 100644
--- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/ThirdMaintenanceStatusEnum.java
+++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/ThirdMaintenanceStatusEnum.java
@@ -18,6 +18,7 @@
     CHANGE, // 鍙樻洿涓�
     CANCEL,// 宸插彇娑�
     ABOLISH, //宸蹭綔搴�
+    EXPIRED, //宸茶繃鏈�
     ;
 
     public static ThirdMaintenanceStatusEnum getInstance(String code) {
diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamThirdMaintenanceOrderDetail.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamThirdMaintenanceOrderDetail.java
index 6e6eafb..116d450 100644
--- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamThirdMaintenanceOrderDetail.java
+++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamThirdMaintenanceOrderDetail.java
@@ -1,7 +1,5 @@
 package org.jeecg.modules.eam.entity;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
@@ -111,4 +109,15 @@
     @Excel(name = "绗簩娆℃楠屽紓甯�", width = 15)
     @ApiModelProperty(value = "绗簩娆℃楠屽紓甯�")
     private String secondInspectException;
+
+    public EamThirdMaintenanceOrderDetail() {
+    }
+
+    public EamThirdMaintenanceOrderDetail(EamMaintenanceStandardDetail detail) {
+        this.itemCode = detail.getItemCode();
+        this.itemPart = detail.getItemPart();
+        this.itemName = detail.getItemName();
+        this.itemDemand = detail.getItemDemand();
+    }
+
 }
diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentMapper.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentMapper.java
index af98f14..30d1106 100644
--- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentMapper.java
+++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentMapper.java
@@ -1,6 +1,7 @@
 package org.jeecg.modules.eam.mapper;
 
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Constants;
@@ -53,4 +54,10 @@
      */
     List<EamEquipment> selectTechnicalEquipmentList(@Param(Constants.WRAPPER) Wrapper<EamEquipment> queryWrapper);
 
+    /**
+     * 鑾峰彇鍙敓鎴愪笁淇濆伐鍗曠殑璁惧鍒楄〃
+     * @return
+     */
+    List<EamEquipment> selectThreeMaintenanceEquipmentList(@Param(Constants.WRAPPER) Wrapper<EamEquipment> queryWrapper);
+
 }
diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentMapper.xml b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentMapper.xml
index c6a96e2..bea93b0 100644
--- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentMapper.xml
+++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentMapper.xml
@@ -53,8 +53,25 @@
                ext.technology_check_period,
                ext.latest_technology_check,
                ext.next_technology_check,
-               ext.technology_genarate_flag,
-               ext.third_maintenance_genarate_flag
+               ext.technology_generate_flag,
+               ext.third_maintenance_generate_flag
+        from eam_equipment e
+        left join eam_equipment_extend ext
+        on e.id = ext.id
+        ${ew.customSqlSegment}
+    </select>
+
+    <select id="selectThreeMaintenanceEquipmentList" resultType="org.jeecg.modules.eam.entity.EamEquipment">
+        select e.*,
+               ext.latest_third_maintenance,
+               ext.next_third_maintenance,
+               ext.technology_status,
+               ext.third_maintenance_period,
+               ext.technology_check_period,
+               ext.latest_technology_check,
+               ext.next_technology_check,
+               ext.technology_generate_flag,
+               ext.third_maintenance_generate_flag
         from eam_equipment e
         left join eam_equipment_extend ext
         on e.id = ext.id
diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentExtendService.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentExtendService.java
index 098f1eb..ab9ce90 100644
--- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentExtendService.java
+++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentExtendService.java
@@ -37,4 +37,14 @@
      * @return
      */
     boolean updateTechnologyParam(String equipmentId, String status, Date evaluationDate, String technologyGenerateFlag);
+
+    /**
+     * 鏇存柊璁惧涓変繚鍙婁繚鍏绘棩鏈�
+     * @param equipmentId 璁惧ID
+     * @param status 淇濆吇鐘舵��
+     * @param evaluationDate 涓変繚鏃ユ湡
+     * @param thirdMaintenanceGenerateFlag 涓変繚宸ュ崟鐢熸垚鏍囪瘑
+     * @return
+     */
+    boolean updateThirdMaintenanceParam(String equipmentId, String status, Date evaluationDate, String thirdMaintenanceGenerateFlag);
 }
diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentService.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentService.java
index 5c28bbc..a10838d 100644
--- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentService.java
+++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentService.java
@@ -77,4 +77,9 @@
      * 鑾峰彇鍙敓鎴愭妧鏈壌瀹氬伐鍗曠殑璁惧鍒楄〃
      */
     List<EamEquipment> selectTechnicalEquipmentList();
+
+    /**
+     * 鑾峰彇鍙敓鎴愪笁淇濆伐鍗曠殑璁惧鍒楄〃
+     */
+    List<EamEquipment> selectThreeMaintenanceEquipmentList();
 }
diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentExtendServiceImpl.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentExtendServiceImpl.java
index 98dce3f..a876b22 100644
--- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentExtendServiceImpl.java
+++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentExtendServiceImpl.java
@@ -74,4 +74,28 @@
         }
         return this.getBaseMapper().updateById(entity) > 0;
     }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean updateThirdMaintenanceParam(String equipmentId, String status, Date evaluationDate, String thirdMaintenanceGenerateFlag) {
+        if (StringUtils.isBlank(status) && StringUtils.isBlank(thirdMaintenanceGenerateFlag) && evaluationDate == null) {
+            return false;
+        }
+        EamEquipmentExtend entity = this.getBaseMapper().selectById(equipmentId);
+        UpdateWrapper<EamEquipmentExtend> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.eq("id", equipmentId);
+        if (StringUtils.isNotBlank(status)) {
+            entity.setMaintenanceStatus(status);
+        }
+        if (StringUtils.isNotBlank(thirdMaintenanceGenerateFlag)) {
+            entity.setThirdMaintenanceGenerateFlag(thirdMaintenanceGenerateFlag);
+        }
+        if (evaluationDate != null) {
+            entity.setLatestThirdMaintenance(evaluationDate);
+            if (entity.getThirdMaintenancePeriod() != null) {
+                entity.setNextThirdMaintenance(DateUtils.addYear(entity.getLatestThirdMaintenance(), entity.getThirdMaintenancePeriod()));
+            }
+        }
+        return this.getBaseMapper().updateById(entity) > 0;
+    }
 }
diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentServiceImpl.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentServiceImpl.java
index 5dbd7b1..20b1c9b 100644
--- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentServiceImpl.java
+++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentServiceImpl.java
@@ -417,6 +417,16 @@
         return this.getBaseMapper().selectTechnicalEquipmentList(queryWrapper);
     }
 
+    @Override
+    public List<EamEquipment> selectThreeMaintenanceEquipmentList() {
+        QueryWrapper<EamEquipment> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("e.del_flag", CommonConstant.DEL_FLAG_0);
+        queryWrapper.ne("ext.maintenance_status", MaintenanceStatusEnum.PROHIBITED.name());
+        queryWrapper.isNotNull("ext.third_maintenance_period");
+        queryWrapper.isNotNull("ext.next_third_maintenance");
+        return this.getBaseMapper().selectThreeMaintenanceEquipmentList(queryWrapper);
+    }
+
     /**
      * 鑾峰彇鎵�鏈夌殑浜х嚎id锛堝寘鍚墍鏈変笂绾э級
      */
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/job/TechnicalStatusEvaluationGenerateJob.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/job/TechnicalStatusEvaluationGenerateJob.java
index e712bce..2fd2aab 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/job/TechnicalStatusEvaluationGenerateJob.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/job/TechnicalStatusEvaluationGenerateJob.java
@@ -106,11 +106,11 @@
         //鑾峰彇璁惧鍒楄〃
         List<EamEquipment> equipmentList = equipmentService.selectTechnicalEquipmentList();
         if (CollectionUtil.isEmpty(equipmentList)) {
-            log.warn("娌℃湁闇�瑕佺敓鎴愭妧鏈姸鎬侀壌瀹氬伐鍗曞緱璁惧锛佹棩鏈燂細{}", DateUtils.date2Str(DateUtils.date_sdf.get()));
+            log.warn("娌℃湁闇�瑕佺敓鎴愭妧鏈姸鎬侀壌瀹氬伐鍗曠殑璁惧锛佹棩鏈燂細{}", DateUtils.date2Str(DateUtils.date_sdf.get()));
             quartzLog.setIsSuccess(-1);
             long endTime = System.currentTimeMillis();
             quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime)));
-            quartzLog.setExceptionDetail("娌℃湁闇�瑕佺敓鎴愭妧鏈姸鎬侀壌瀹氬伐鍗曞緱璁惧锛屾棩鏈燂細" + DateUtils.date2Str(DateUtils.date_sdf.get()));
+            quartzLog.setExceptionDetail("娌℃湁闇�瑕佺敓鎴愭妧鏈姸鎬侀壌瀹氬伐鍗曠殑璁惧锛屾棩鏈燂細" + DateUtils.date2Str(DateUtils.date_sdf.get()));
             sysQuartzLogService.save(quartzLog);
             return;
         }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/job/ThirdMaintenanceOrderExpiredJob.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/job/ThirdMaintenanceOrderExpiredJob.java
index ca32b0f..f19168d 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/job/ThirdMaintenanceOrderExpiredJob.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/job/ThirdMaintenanceOrderExpiredJob.java
@@ -2,17 +2,12 @@
 
 import cn.hutool.core.collection.CollectionUtil;
 import lombok.extern.slf4j.Slf4j;
-import org.jeecg.modules.eam.constant.SecondMaintenanceStatusEnum;
+import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.eam.constant.ThirdMaintenanceStatusEnum;
-import org.jeecg.modules.eam.constant.WeekMaintenanceStatusEnum;
-import org.jeecg.modules.eam.entity.EamSecondMaintenanceOrder;
+import org.jeecg.modules.eam.entity.EamEquipmentExtend;
 import org.jeecg.modules.eam.entity.EamThirdMaintenanceOrder;
-import org.jeecg.modules.eam.service.IEamSecondMaintenanceOrderService;
+import org.jeecg.modules.eam.service.IEamEquipmentExtendService;
 import org.jeecg.modules.eam.service.IEamThirdMaintenanceOrderService;
-import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness;
-import org.jeecg.modules.flowable.apithird.business.service.IFlowMyBusinessService;
-import org.jeecg.modules.flowable.service.IFlowTaskService;
-import org.jeecg.common.util.ThrowableUtil;
 import org.jeecg.modules.quartz.entity.QuartzJob;
 import org.jeecg.modules.quartz.entity.SysQuartzLog;
 import org.jeecg.modules.quartz.service.IQuartzJobService;
@@ -24,25 +19,26 @@
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.time.LocalDate;
 import java.util.Date;
 import java.util.List;
 
+/**
+ * @Author: Lius
+ * @CreateTime: 2025-07-29
+ * @Description: 涓変繚宸ュ崟杩囨湡
+ */
 @Component
 @Slf4j
 public class ThirdMaintenanceOrderExpiredJob implements Job {
 
     @Autowired
     private IEamThirdMaintenanceOrderService eamThirdMaintenanceOrderService;
-
-    @Autowired
-    private IFlowMyBusinessService flowMyBusinessService;
-    @Autowired
-    private IFlowTaskService flowTaskService;
     @Autowired
     private ISysQuartzLogService sysQuartzLogService;
     @Autowired
     private IQuartzJobService quartzJobService;
+    @Autowired
+    private IEamEquipmentExtendService equipmentExtendService;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -55,41 +51,32 @@
             quartzLog.setJobId(byJobClassName.get(0).getId());
         }
         long startTime = System.currentTimeMillis();
-        LocalDate now = LocalDate.now();
-        try {
-
-            List<EamThirdMaintenanceOrder> unCompleteOrderList = eamThirdMaintenanceOrderService.lambdaQuery()
-                    .lt(EamThirdMaintenanceOrder::getMaintenanceDate, now.toString())
-                    .in(EamThirdMaintenanceOrder::getMaintenanceStatus, ThirdMaintenanceStatusEnum.WAIT_MAINTENANCE, ThirdMaintenanceStatusEnum.UNDER_MAINTENANCE)
-                    .orderByDesc(EamThirdMaintenanceOrder::getMaintenanceDate)
-                    .list();
-
-            if (CollectionUtil.isEmpty(unCompleteOrderList)) {
-                //娌℃湁闇�瑕佸鐞嗙殑鏁版嵁
-                return;
-            }
-            for (EamThirdMaintenanceOrder order : unCompleteOrderList) {
-                if (ThirdMaintenanceStatusEnum.WAIT_MAINTENANCE.name().equals(order.getMaintenanceStatus())) {
-                    order.setMaintenanceStatus(ThirdMaintenanceStatusEnum.ABOLISH.name());
-                } else if (ThirdMaintenanceStatusEnum.UNDER_MAINTENANCE.name().equals(order.getMaintenanceStatus())) {
-                    //宸茬粡琚帴鍗� 浣嗘湭鎵ц瀹屾垚
-                    order.setMaintenanceStatus(ThirdMaintenanceStatusEnum.ABOLISH.name());
-                    //寮哄埗缁撴潫娴佺▼ 鍒犻櫎鐢ㄦ埛鐨勬寰呭姙浠诲姟
-                    FlowMyBusiness flowMyBusiness = flowMyBusinessService.selectByDataId(order.getId());
-                    if (flowMyBusiness != null) {
-                        flowTaskService.end(flowMyBusiness.getProcessInstanceId(), "杩囨湡鍒犻櫎");
-                    }
-                }
-            }
-            eamThirdMaintenanceOrderService.updateBatchById(unCompleteOrderList);
+        List<EamThirdMaintenanceOrder> list = eamThirdMaintenanceOrderService.selectUnCompletedThirdMaintenanceOrderList();
+        if (CollectionUtil.isEmpty(list)) {
+            log.info("娌℃湁闇�瑕佽繃鏈熺殑宸ュ崟锛佹棩鏈燂細{}", DateUtils.date2Str(DateUtils.date_sdf.get()));
             quartzLog.setIsSuccess(0);
-        } catch (Exception e) {
-            log.error("涓変繚杩囨湡鎵ц瀹氭椂浠诲姟澶辫触锛寋}", e.getMessage(), e);
-            quartzLog.setIsSuccess(-1);
-            quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e));
+            long endTime = System.currentTimeMillis();
+            quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime)));
+            quartzLog.setExceptionDetail("娌℃湁闇�瑕佽繃鏈熺殑宸ュ崟锛屾棩鏈燂細" + DateUtils.date2Str(DateUtils.date_sdf.get()));
+            sysQuartzLogService.save(quartzLog);
+            return;
         }
+        int expiredCount = 0;
+        for (EamThirdMaintenanceOrder order : list) {
+            EamEquipmentExtend extend = equipmentExtendService.getById(order.getEquipmentId());
+            if (extend == null) {
+                log.error("璁惧淇℃伅涓嶅瓨鍦紝璇锋鏌ワ紒 璁惧ID锛歿}, 鏃ユ湡锛歿}", order.getEquipmentId(), DateUtils.date2Str(DateUtils.date_sdf.get()));
+                continue;
+            }
+            if (ThirdMaintenanceStatusEnum.WAIT_MAINTENANCE.name().equals(order.getMaintenanceStatus()) || ThirdMaintenanceStatusEnum.FREEZE.name().equals(order.getMaintenanceStatus())) {
+                order.setMaintenanceStatus(ThirdMaintenanceStatusEnum.EXPIRED.name());
+                eamThirdMaintenanceOrderService.updateById(order);
+            }
+        }
+        quartzLog.setIsSuccess(0);
         long endTime = System.currentTimeMillis();
         quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime)));
+        quartzLog.setExceptionDetail("杩囨湡浜唟" + expiredCount + "}涓伐鍗曪紝杩樻湁{" + (list.size() - expiredCount) + "}涓伐鍗曟鍦ㄦ墽琛屼腑锛岀鐢ㄤ簡{" + list.size() + "}鍙拌澶�, 鏃ユ湡锛�" + DateUtils.date2Str(DateUtils.date_sdf.get()));
         sysQuartzLogService.save(quartzLog);
     }
 
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/job/ThirdMaintenanceOrderGenerateJob.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/job/ThirdMaintenanceOrderGenerateJob.java
index 2241c37..ad65df1 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/job/ThirdMaintenanceOrderGenerateJob.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/job/ThirdMaintenanceOrderGenerateJob.java
@@ -2,21 +2,21 @@
 
 import cn.hutool.core.collection.CollectionUtil;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.util.DateUtils;
-import org.jeecg.common.util.ThrowableUtil;
 import org.jeecg.modules.eam.constant.BusinessCodeConst;
 import org.jeecg.modules.eam.constant.MaintenanceCategoryEnum;
 import org.jeecg.modules.eam.constant.OrderCreationMethodEnum;
 import org.jeecg.modules.eam.entity.*;
 import org.jeecg.modules.eam.request.EamThirdMaintenanceRequest;
-import org.jeecg.modules.eam.service.IEamMaintenanceStandardDetailService;
-import org.jeecg.modules.eam.service.IEamMaintenanceStandardService;
-import org.jeecg.modules.eam.service.IEamThirdMaintenanceOrderService;
+import org.jeecg.modules.eam.service.*;
 import org.jeecg.modules.quartz.entity.QuartzJob;
 import org.jeecg.modules.quartz.entity.SysQuartzLog;
 import org.jeecg.modules.quartz.service.IQuartzJobService;
 import org.jeecg.modules.quartz.service.ISysQuartzLogService;
+import org.jeecg.modules.system.entity.SysParams;
 import org.jeecg.modules.system.service.ISysBusinessCodeRuleService;
+import org.jeecg.modules.system.service.ISysParamsService;
 import org.quartz.Job;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
@@ -25,14 +25,24 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import java.time.LocalDate;
-import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
 
+/**
+ * @Author: Lius
+ * @CreateTime: 2025-07-29
+ * @Description: 涓変繚宸ュ崟閿佸畾
+ */
 @Component
 @Slf4j
 public class ThirdMaintenanceOrderGenerateJob implements Job {
 
+    @Autowired
+    private IEamEquipmentService equipmentService;
+    @Autowired
+    private ISysParamsService paramsService;
     @Autowired
     private IEamThirdMaintenanceOrderService eamThirdMaintenanceOrderService;
     @Autowired
@@ -45,6 +55,8 @@
     private ISysQuartzLogService sysQuartzLogService;
     @Autowired
     private IQuartzJobService quartzJobService;
+    @Autowired
+    private IEamEquipmentExtendService equipmentExtendService;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -58,81 +70,130 @@
             quartzLog.setJobId(byJobClassName.get(0).getId());
         }
         long startTime = System.currentTimeMillis();
-        /**
-         * 鑾峰彇 閰嶇疆浜� 涓変繚鏍囧噯鐨� 淇℃伅
-         */
-        List<EamMaintenanceStandard> standardList = eamMaintenanceStandardService.queryListByCategory(MaintenanceCategoryEnum.THIRD_MAINTENANCE.name());
-        if (CollectionUtil.isEmpty(standardList)) {
-            log.warn("娌℃湁閰嶇疆浠讳綍涓変繚鏍囧噯锛屼换鍔$粨鏉�");
+        //鑾峰彇涓変繚绯荤粺閰嶇疆鍙傛暟
+        SysParams threeYearMaintOrderPreGenerationDaysParam = paramsService.getSysPramBySettingKey("three_year_maint_order_pre_generation_days");
+        if (threeYearMaintOrderPreGenerationDaysParam == null) {
+            log.error("鏈厤缃�3~4骞存湡鎻愬墠鐢熸垚宸ュ崟鐨勭郴缁熷弬鏁帮紝鏃ユ湡锛歿}", DateUtils.date2Str(DateUtils.date_sdf.get()));
+            quartzLog.setIsSuccess(-1);
+            long endTime = System.currentTimeMillis();
+            quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime)));
+            quartzLog.setExceptionDetail("鏈厤缃�3~4骞存湡鎻愬墠鐢熸垚宸ュ崟鐨勭郴缁熷弬鏁帮紝鏃ユ湡锛�" + DateUtils.date2Str(DateUtils.date_sdf.get()));
+            sysQuartzLogService.save(quartzLog);
             return;
         }
-        //褰撳墠鏃ユ湡
-        LocalDate now = LocalDate.now();
-        try {
-            for (EamMaintenanceStandard standard : standardList) {
-                if (standard.getMaintenancePeriod() == null || standard.getMaintenancePeriod() < 1) {
-                    log.error("涓変繚鏍囧噯鍛ㄦ湡璁剧疆閿欒锛岃鍏堥厤缃爣鍑嗗懆鏈�, standard:{}", standard);
-                    continue;
-                }
-                if (standard.getInitialDate() == null) {
-                    //璁剧疆鍒濆鏃ユ湡涓哄墠涓�澶�
-                    standard.setInitialDate(DateUtils.localDateToDate(now.minusDays(1)));
-                }
-//                LocalDate generateDate = DateUtils.dateToLocalDate(standard.getInitialDate());
-//                if (standard.getLastGenerateTime() != null) {
-//                    generateDate = DateUtils.dateToLocalDate(standard.getLastGenerateTime());
-//                }
-                //鍔犲懆鏈�
-//                do {
-//                    //鍒濆鏃ユ湡璁剧疆鐨勬瘮杈冩棭锛屾垨浠诲姟闀挎椂闂存病鎵ц锛屽繀椤诲懆鏈熷埌浠婂ぉ鎵嶄細鐢熸垚宸ュ崟
-//                    generateDate = generateDate.plusDays(standard.getMaintenancePeriod());
-//                } while (now.isAfter(generateDate));
-//                if(!now.isEqual(generateDate)) {
-//                    //杩樻湭鍒扮敓鎴愭棩鏈燂紝璺宠繃鎵ц
-//                    continue;
-//                }
-                //鑾峰彇淇濆吇椤规槑缁�
-                List<EamMaintenanceStandardDetail> standardDetailList = eamMaintenanceStandardDetailService.selectByStandardId(standard.getId());
-                if(CollectionUtil.isEmpty(standardDetailList)) {
-                    log.error("涓変繚鏍囧噯娌℃湁淇濆吇鏄庣粏锛岃鍏堥厤缃繚鍏绘槑缁�, standard:{}", standard);
-                    continue;
-                }
-
-                //寮�濮嬬敓鎴�
-                EamThirdMaintenanceRequest request = new EamThirdMaintenanceRequest();
-                request.setEquipmentId(standard.getEquipmentId());
-                request.setStandardId(standard.getId());
-//                request.setMaintenanceDate(DateUtils.localDateToDate(generateDate));
-                String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.THIRD_MAINTENANCE_CODE_RULE);
-                request.setOrderNum(codeSeq);
-                request.setCreationMethod(OrderCreationMethodEnum.AUTO.name());
-
-                List<EamThirdMaintenanceOrderDetail> tableDetailList = new ArrayList<>();
-                for (EamMaintenanceStandardDetail msd : standardDetailList) {
-                    EamThirdMaintenanceOrderDetail tod = new EamThirdMaintenanceOrderDetail();
-                    tod.setItemCode(msd.getItemCode());
-                    tod.setItemName(msd.getItemName());
-                    tod.setItemDemand(msd.getItemDemand());
-                    tod.setItemPart(msd.getItemPart());
-                    tableDetailList.add(tod);
-                }
-//                List<EamThirdMaintenanceOrderDetail> collect = standardDetailList.stream().map(EamThirdMaintenanceOrderDetail::new).collect(Collectors.toList());
-                request.setTableDetailList(tableDetailList);
-                
-                eamThirdMaintenanceOrderService.addMaintenance(request);
-
-//                standard.setLastGenerateTime(new Date());
-                eamMaintenanceStandardService.updateById(standard);
-            }
-            quartzLog.setIsSuccess(0);
-        } catch (Exception e) {
-            log.error("涓変繚鐢熸垚鎵ц瀹氭椂浠诲姟澶辫触锛寋}", e.getMessage(), e);
+        int threeYearMaintOrderPreGenerationDays = Integer.parseInt(threeYearMaintOrderPreGenerationDaysParam.getSettingValue());
+        SysParams oneYearMaintOrderPreGenerationDaysParam = paramsService.getSysPramBySettingKey("one_year_maint_order_pre_generation_days");
+        if (oneYearMaintOrderPreGenerationDaysParam == null) {
+            log.error("鏈厤缃�3~4骞存湡鎻愬墠鐢熸垚宸ュ崟鐨勭郴缁熷弬鏁帮紝鏃ユ湡锛歿}", DateUtils.date2Str(DateUtils.date_sdf.get()));
             quartzLog.setIsSuccess(-1);
-            quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e));
+            long endTime = System.currentTimeMillis();
+            quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime)));
+            quartzLog.setExceptionDetail("鏈厤缃�3~4骞存湡鎻愬墠鐢熸垚宸ュ崟鐨勭郴缁熷弬鏁帮紝鏃ユ湡锛�" + DateUtils.date2Str(DateUtils.date_sdf.get()));
+            sysQuartzLogService.save(quartzLog);
+            return;
         }
+        int oneYearMaintOrderPreGenerationDays = Integer.parseInt(oneYearMaintOrderPreGenerationDaysParam.getSettingValue());
+        SysParams threeYearMaintOrderPreLockDaysParam = paramsService.getSysPramBySettingKey("three_year_maint_order_pre_lock_days");
+        if (threeYearMaintOrderPreLockDaysParam == null) {
+            log.error("鏈厤缃�3~4骞存湡鎻愬墠閿佸畾宸ュ崟鐨勭郴缁熷弬鏁帮紝鏃ユ湡锛歿}", DateUtils.date2Str(DateUtils.date_sdf.get()));
+            quartzLog.setIsSuccess(-1);
+            long endTime = System.currentTimeMillis();
+            quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime)));
+            quartzLog.setExceptionDetail("鏈厤缃�3~4骞存湡鎻愬墠閿佸畾宸ュ崟鐨勭郴缁熷弬鏁帮紝鏃ユ湡锛�" + DateUtils.date2Str(DateUtils.date_sdf.get()));
+            sysQuartzLogService.save(quartzLog);
+            return;
+        }
+        int threeYearMaintOrderPreLockDays = Integer.parseInt(threeYearMaintOrderPreLockDaysParam.getSettingValue());
+        SysParams oneYearMaintOrderPreLockDaysParam = paramsService.getSysPramBySettingKey("one_year_maint_order_pre_lock_days");
+        if (oneYearMaintOrderPreLockDaysParam == null) {
+            log.error("鏈厤缃�1骞存湡鎻愬墠閿佸畾宸ュ崟鐨勭郴缁熷弬鏁帮紝鏃ユ湡锛歿}", DateUtils.date2Str(DateUtils.date_sdf.get()));
+            quartzLog.setIsSuccess(-1);
+            long endTime = System.currentTimeMillis();
+            quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime)));
+            quartzLog.setExceptionDetail("鏈厤缃�1骞存湡鎻愬墠閿佸畾宸ュ崟鐨勭郴缁熷弬鏁帮紝鏃ユ湡锛�" + DateUtils.date2Str(DateUtils.date_sdf.get()));
+            sysQuartzLogService.save(quartzLog);
+            return;
+        }
+        int oneYearMaintOrderPreLockDays = Integer.parseInt(oneYearMaintOrderPreLockDaysParam.getSettingValue());
+
+        //鑾峰彇璁惧鍒楄〃
+        List<EamEquipment> equipmentList = equipmentService.selectThreeMaintenanceEquipmentList();
+        if (CollectionUtil.isEmpty(equipmentList)) {
+            log.warn("娌℃湁闇�瑕佺敓鎴愪笁淇濆伐鍗曠殑璁惧锛佹棩鏈燂細{}", DateUtils.date2Str(DateUtils.date_sdf.get()));
+            quartzLog.setIsSuccess(-1);
+            long endTime = System.currentTimeMillis();
+            quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime)));
+            quartzLog.setExceptionDetail("娌℃湁闇�瑕佺敓鎴愪笁淇濆伐鍗曠殑璁惧锛屾棩鏈燂細" + DateUtils.date2Str(DateUtils.date_sdf.get()));
+            sysQuartzLogService.save(quartzLog);
+            return;
+        }
+        AtomicInteger successCount = new AtomicInteger(0);
+        AtomicInteger failCount = new AtomicInteger(0);
+        StringBuilder sb = new StringBuilder();
+        for (EamEquipment eamEquipment : equipmentList) {
+            //鍒ゆ柇鏄惁涓�1骞寸殑涓変繚鍛ㄦ湡
+            if (eamEquipment.getThirdMaintenancePeriod() == 1) {
+                //1骞存湡
+                generateThirdMaintenanceOrder(oneYearMaintOrderPreGenerationDays, oneYearMaintOrderPreLockDays, eamEquipment, successCount, failCount, sb);
+            } else if (eamEquipment.getThirdMaintenancePeriod() == 3 || eamEquipment.getThirdMaintenancePeriod() == 4) {
+                //3~4骞存湡
+                generateThirdMaintenanceOrder(threeYearMaintOrderPreGenerationDays, threeYearMaintOrderPreLockDays, eamEquipment, successCount, failCount, sb);
+            }
+        }
+        quartzLog.setIsSuccess(0);
+        if (failCount.get() > 0) {
+            quartzLog.setIsSuccess(-1);
+        }
+        sb.append("涓変繚宸ュ崟鐢熸垚锛氥�愭垚鍔燂細").append(successCount.get()).append("锛屽け璐ワ細").append(failCount.get()).append("銆�");
+        quartzLog.setExceptionDetail(sb.toString());
         long endTime = System.currentTimeMillis();
         quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime)));
         sysQuartzLogService.save(quartzLog);
 
     }
+
+    private void generateThirdMaintenanceOrder(int orderPreGenerationDays, int orderPreLockDays, EamEquipment equipment, AtomicInteger successCount, AtomicInteger failCount, StringBuilder sb) {
+        LocalDate nextThirdMaintenanceDate = DateUtils.dateToLocalDate(equipment.getNextThirdMaintenance());
+        LocalDate generateDate = nextThirdMaintenanceDate.minusDays(orderPreGenerationDays);
+        LocalDate lockDate = nextThirdMaintenanceDate.minusDays(orderPreLockDays);
+        if (!LocalDate.now().isBefore(generateDate) && !CommonConstant.STATUS_1.equals(equipment.getThirdMaintenanceGenerateFlag())) {
+            //璁$畻褰撳ぉ闇�瑕佺敓鎴�
+            EamMaintenanceStandard standard = eamMaintenanceStandardService.queryByEquipmentIdAndCategory(equipment.getId(), MaintenanceCategoryEnum.THIRD_MAINTENANCE.name());
+            if (standard == null) {
+                log.warn("璁惧锛歿}锛屾湭閰嶇疆涓夌骇淇濆吇瑙勮寖锛屾棤娉曠敓鎴愪笁淇濆伐鍗曪紒鏃ユ湡锛歿}", equipment.getEquipmentCode(), DateUtils.date2Str(DateUtils.date_sdf.get()));
+                failCount.incrementAndGet();
+                sb.append("璁惧锛�").append(equipment.getEquipmentCode()).append("锛屾湭閰嶇疆涓夌骇淇濆吇瑙勮寖锛屾棤娉曠敓鎴愪笁淇濆伐鍗曪紒");
+                return;
+            }
+            List<EamMaintenanceStandardDetail> eamMaintenanceStandardDetailList = eamMaintenanceStandardDetailService.selectByStandardId(standard.getId());
+            if (CollectionUtil.isEmpty(eamMaintenanceStandardDetailList)) {
+                log.warn("璁惧锛歿}锛屾湭閰嶇疆涓夌骇淇濆吇瑙勮寖鏄庣粏锛屾棤娉曠敓鎴愪笁淇濆伐鍗曪紒鏃ユ湡锛歿}", equipment.getEquipmentCode(), DateUtils.date2Str(DateUtils.date_sdf.get()));
+                failCount.incrementAndGet();
+                sb.append("璁惧锛�").append(equipment.getEquipmentCode()).append("锛屾湭閰嶇疆涓夌骇淇濆吇瑙勮寖鏄庣粏锛屾棤娉曠敓鎴愪笁淇濆伐鍗曪紒");
+                return;
+            }
+            EamThirdMaintenanceRequest request = new EamThirdMaintenanceRequest();
+            String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.THIRD_MAINTENANCE_CODE_RULE);
+            request.setOrderNum(codeSeq);
+            request.setEquipmentId(equipment.getId());
+            request.setStandardId(standard.getId());
+            request.setMaintenanceDate(generateDate.toString());
+            request.setFreezeOrderDate(DateUtils.localDateToDate(lockDate));
+            request.setOrderExpirationDate(equipment.getNextThirdMaintenance());
+            request.setCreationMethod(OrderCreationMethodEnum.AUTO.name());
+            List<EamThirdMaintenanceOrderDetail> tableDetailList = eamMaintenanceStandardDetailList.stream().map(EamThirdMaintenanceOrderDetail::new).collect(Collectors.toList());
+            request.setTableDetailList(tableDetailList);
+            try {
+                eamThirdMaintenanceOrderService.addMaintenance(request);
+                successCount.incrementAndGet();
+                //鏇存柊鎵╁睍琛ㄤ腑鐨勭敓鎴愭爣璇�
+                equipmentExtendService.updateThirdMaintenanceParam(equipment.getId(), null, null, CommonConstant.STATUS_1);
+            } catch (Exception e) {
+                log.error("璁惧锛歿}锛岀敓鎴愪笁淇濆伐鍗曞け璐ワ紝鍘熷洜锛歿}", equipment.getEquipmentCode(), e.getMessage(), e);
+                failCount.incrementAndGet();
+                sb.append("璁惧锛�").append(equipment.getEquipmentCode()).append("锛岀敓鎴愪笁淇濆伐鍗曞け璐ワ紝鍘熷洜锛�").append(e.getMessage()).append("锛�");
+            }
+
+        }
+    }
 }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/job/ThirdMaintenanceOrderLockedJob.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/job/ThirdMaintenanceOrderLockedJob.java
new file mode 100644
index 0000000..39f8fa3
--- /dev/null
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/job/ThirdMaintenanceOrderLockedJob.java
@@ -0,0 +1,70 @@
+package org.jeecg.modules.eam.job;
+
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.eam.constant.ThirdMaintenanceStatusEnum;
+import org.jeecg.modules.eam.entity.EamThirdMaintenanceOrder;
+import org.jeecg.modules.eam.service.IEamThirdMaintenanceOrderService;
+import org.jeecg.modules.quartz.entity.QuartzJob;
+import org.jeecg.modules.quartz.entity.SysQuartzLog;
+import org.jeecg.modules.quartz.service.IQuartzJobService;
+import org.jeecg.modules.quartz.service.ISysQuartzLogService;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Author: Lius
+ * @CreateTime: 2025-07-29
+ * @Description: 涓変繚宸ュ崟閿佸畾
+ */
+@Component
+@Slf4j
+public class ThirdMaintenanceOrderLockedJob implements Job {
+
+    @Autowired
+    private ISysQuartzLogService sysQuartzLogService;
+    @Autowired
+    private IQuartzJobService quartzJobService;
+    @Autowired
+    private IEamThirdMaintenanceOrderService eamThirdMaintenanceOrderService;
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void execute(JobExecutionContext context) throws JobExecutionException {
+        //浠诲姟鏃ュ織
+        SysQuartzLog quartzLog = new SysQuartzLog();
+        quartzLog.setCreateTime(new Date());
+        List<QuartzJob> jobClassName = quartzJobService.findByJobClassName(this.getClass().getName());
+        if (jobClassName != null && !jobClassName.isEmpty()) {
+            quartzLog.setJobId(jobClassName.get(0).getId());
+        }
+        long startTime = System.currentTimeMillis();
+        List<EamThirdMaintenanceOrder> list = eamThirdMaintenanceOrderService.selectWaitMaintenanceOrderList();
+        if (CollectionUtils.isEmpty(list)) {
+            log.info("娌℃湁闇�瑕侀攣瀹氱殑宸ュ崟锛佹棩鏈燂細{}", DateUtils.date2Str(DateUtils.date_sdf.get()));
+            quartzLog.setIsSuccess(0);
+            long endTime = System.currentTimeMillis();
+            quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime)));
+            quartzLog.setExceptionDetail("娌℃湁闇�瑕侀攣瀹氱殑宸ュ崟锛屾棩鏈燂細" + DateUtils.date2Str(DateUtils.date_sdf.get()));
+            sysQuartzLogService.save(quartzLog);
+            return;
+        }
+        for (EamThirdMaintenanceOrder order : list) {
+            order.setMaintenanceStatus(ThirdMaintenanceStatusEnum.FREEZE.name());
+            eamThirdMaintenanceOrderService.updateById(order);
+        }
+        quartzLog.setIsSuccess(0);
+        long endTime = System.currentTimeMillis();
+        quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime)));
+        quartzLog.setExceptionDetail("閿佸畾浜唟" + list.size() + "}鏉″伐鍗曪紝鏃ユ湡锛�" + DateUtils.date2Str(DateUtils.date_sdf.get()));
+        sysQuartzLogService.save(quartzLog);
+    }
+}
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamThirdMaintenanceRequest.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamThirdMaintenanceRequest.java
index 5740874..9faca71 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamThirdMaintenanceRequest.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamThirdMaintenanceRequest.java
@@ -53,6 +53,20 @@
     @DateTimeFormat(pattern = "yyyy-MM-dd")
     private String maintenanceDate;
     /**
+     * 閿佸畾宸ュ崟鏃ユ湡
+     */
+    @ApiModelProperty(value = "閿佸畾宸ュ崟鏃ユ湡;鎻愬墠55澶╅攣瀹氬伐鍗�")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private Date freezeOrderDate;
+    /**
+     * 宸ュ崟杩囨湡鏃ユ湡
+     */
+    @ApiModelProperty(value = "宸ュ崟杩囨湡鏃ユ湡;鍒版湡鏈仛鐩存帴杩囨湡")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private Date orderExpirationDate;
+    /**
      * 缁翠慨浜�
      */
     @ApiModelProperty(value = "缁翠慨浜�")
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamMaintenanceStandardService.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamMaintenanceStandardService.java
index bcb724b..9c0abaa 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamMaintenanceStandardService.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamMaintenanceStandardService.java
@@ -91,4 +91,12 @@
 
 
     Result<?> importMaintenanceStandard(MultipartFile file, String type);
+
+    /**
+     * 鏌ヨ淇濆吇绫诲瀷涓嬫甯哥殑淇濆吇鏍囧噯
+     * @param equipmentId 璁惧缂栧彿
+     * @param maintenanceCategory 淇濆吇绫诲瀷
+     * @return
+     */
+    EamMaintenanceStandard queryByEquipmentIdAndCategory(String equipmentId, String maintenanceCategory);
 }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamThirdMaintenanceOrderService.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamThirdMaintenanceOrderService.java
index 23870f9..d257494 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamThirdMaintenanceOrderService.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamThirdMaintenanceOrderService.java
@@ -8,6 +8,8 @@
 import org.jeecg.modules.eam.request.EamThirdMaintenanceQuery;
 import org.jeecg.modules.eam.request.EamThirdMaintenanceRequest;
 
+import java.util.List;
+
 /**
  * @Description: 璁惧涓夌骇淇濆吇
  * @Author: jeecg-boot
@@ -66,4 +68,17 @@
      * @return
      */
     boolean updateMaintenanceStatus(String orderId, String maintenanceStatus);
+
+    /**
+     * 鑾峰彇寰呬繚鍏荤殑宸ュ崟锛岄攣瀹氬鐞嗕娇鐢�
+     * @return
+     */
+    List<EamThirdMaintenanceOrder> selectWaitMaintenanceOrderList();
+
+    /**
+     * 鑾峰彇鏈畬鎴愮殑宸ュ崟淇℃伅锛岃繃鏈熷鐞嗕娇鐢�
+     * @return
+     */
+    List<EamThirdMaintenanceOrder> selectUnCompletedThirdMaintenanceOrderList();
+
 }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamMaintenanceStandardServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamMaintenanceStandardServiceImpl.java
index 96338b7..111e961 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamMaintenanceStandardServiceImpl.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamMaintenanceStandardServiceImpl.java
@@ -323,6 +323,16 @@
         return eamMaintenanceStandardMapper.selectList(queryWrapper);
     }
 
+    @Override
+    public EamMaintenanceStandard queryByEquipmentIdAndCategory(String equipmentId, String maintenanceCategory) {
+        LambdaQueryWrapper<EamMaintenanceStandard> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(EamMaintenanceStandard::getDelFlag, CommonConstant.DEL_FLAG_0);
+        queryWrapper.eq(EamMaintenanceStandard::getMaintenanceCategory, maintenanceCategory);
+        queryWrapper.eq(EamMaintenanceStandard::getStandardStatus, MaintenanceStandardStatusEnum.START.name());
+        queryWrapper.eq(EamMaintenanceStandard::getEquipmentId, equipmentId);
+        return eamMaintenanceStandardMapper.selectOne(queryWrapper);
+    }
+
 
     /*娴佺▼涓氬姟浠g爜--------------------------寮�濮�*/
 
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamThirdMaintenanceOrderServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamThirdMaintenanceOrderServiceImpl.java
index fd1686d..a24b6e6 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamThirdMaintenanceOrderServiceImpl.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamThirdMaintenanceOrderServiceImpl.java
@@ -46,6 +46,7 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.time.LocalDate;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -341,6 +342,7 @@
 
     /**
      * 鏌ヨ涓変繚宸ュ崟鍩烘湰淇℃伅
+     *
      * @param id
      * @return
      */
@@ -371,6 +373,39 @@
         return update > 0;
     }
 
+    @Override
+    public List<EamThirdMaintenanceOrder> selectWaitMaintenanceOrderList() {
+        LambdaQueryWrapper<EamThirdMaintenanceOrder> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(EamThirdMaintenanceOrder::getMaintenanceStatus, ThirdMaintenanceStatusEnum.WAIT_MAINTENANCE.name());
+        queryWrapper.isNotNull(EamThirdMaintenanceOrder::getFreezeOrderDate);
+        queryWrapper.eq(EamThirdMaintenanceOrder::getDelFlag, CommonConstant.DEL_FLAG_0);
+        LocalDate localDate = LocalDate.now();
+        queryWrapper.lt(EamThirdMaintenanceOrder::getFreezeOrderDate, localDate.toString());
+        return this.getBaseMapper().selectList(queryWrapper);
+    }
+
+    @Override
+    public List<EamThirdMaintenanceOrder> selectUnCompletedThirdMaintenanceOrderList() {
+        LambdaQueryWrapper<EamThirdMaintenanceOrder> queryWrapper = new LambdaQueryWrapper<>();
+        List<String> statusList = Arrays.asList(ThirdMaintenanceStatusEnum.WAIT_MAINTENANCE.name(),
+                ThirdMaintenanceStatusEnum.UNDER_MAINTENANCE.name(),
+                ThirdMaintenanceStatusEnum.WAIT_CHECK.name(),
+                ThirdMaintenanceStatusEnum.UNDER_FIRST_ACCEPTANCE.name(),
+                ThirdMaintenanceStatusEnum.UNDER_SECOND_ACCEPTANCE.name(),
+                ThirdMaintenanceStatusEnum.OPERATOR_SIGNATURE.name(),
+                ThirdMaintenanceStatusEnum.REPAIRMAN_SIGNATURE.name(),
+                ThirdMaintenanceStatusEnum.REPAIR_MANAGER_SIGNATURE.name(),
+                ThirdMaintenanceStatusEnum.INSPECTOR_SIGNATURE.name(),
+                ThirdMaintenanceStatusEnum.FREEZE.name()
+        );
+        queryWrapper.in(EamThirdMaintenanceOrder::getMaintenanceStatus, statusList);
+        queryWrapper.isNotNull(EamThirdMaintenanceOrder::getOrderExpirationDate);
+        queryWrapper.eq(EamThirdMaintenanceOrder::getDelFlag, CommonConstant.DEL_FLAG_0);
+        LocalDate localDate = LocalDate.now();
+        queryWrapper.lt(EamThirdMaintenanceOrder::getOrderExpirationDate, localDate.toString());
+        return this.getBaseMapper().selectList(queryWrapper);
+    }
+
     /**
      * 璁剧疆娴佺▼鍙橀噺
      */

--
Gitblit v1.9.3