Pārlūkot izejas kodu

待约检设备列表

xuzhancheng 3 nedēļas atpakaļ
vecāks
revīzija
1e3aaf1d21
13 mainītis faili ar 1800 papildinājumiem un 181 dzēšanām
  1. 16 3
      tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/controller/admin/planscheduling/PlanSchedulingController.java
  2. 162 0
      tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/controller/admin/planscheduling/vo/EquipBoilerPageRespVO.java
  3. 162 0
      tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/controller/admin/planscheduling/vo/EquipPipePageRespVO.java
  4. 118 0
      tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/controller/admin/planscheduling/vo/PendingInspectionEquipReqVO.java
  5. 21 128
      tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/dal/mysql/appointmentconfirmorder/AppointmentConfirmOrderMapper.java
  6. 14 0
      tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/dal/mysql/equipboiler/EquipBoilerMapper.java
  7. 12 0
      tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/dal/mysql/equippipe/EquipPipeMapper.java
  8. 35 32
      tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/service/appointmentconfirmorder/AppointmentConfirmOrderServiceImpl.java
  9. 12 3
      tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/service/planscheduling/PlanSchedulingService.java
  10. 331 14
      tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/service/planscheduling/PlanSchedulingServiceImpl.java
  11. 182 1
      tz-module-pressure2/tz-module-pressure2-biz/src/main/resources/mapper/appointmentconfirmorder/AppointmentConfirmOrderMapper.xml
  12. 362 0
      tz-module-pressure2/tz-module-pressure2-biz/src/main/resources/mapper/equipboiler/EquipBoilerMapper.xml
  13. 373 0
      tz-module-pressure2/tz-module-pressure2-biz/src/main/resources/mapper/equippipe/EquipPipeMapper.xml

+ 16 - 3
tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/controller/admin/planscheduling/PlanSchedulingController.java

@@ -3,7 +3,6 @@ package cn.start.tz.module.pressure2.controller.admin.planscheduling;
 
 import cn.start.tz.framework.common.pojo.CommonResult;
 import cn.start.tz.framework.common.pojo.PageResult;
-import cn.start.tz.framework.security.core.util.SecurityFrameworkUtils;
 import cn.start.tz.module.pressure2.controller.admin.planscheduling.vo.*;
 import cn.start.tz.module.pressure2.service.planscheduling.PlanSchedulingService;
 import io.swagger.v3.oas.annotations.Operation;
@@ -13,8 +12,6 @@ import jakarta.validation.Valid;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.List;
-
 import static cn.start.tz.framework.common.pojo.CommonResult.success;
 
 @Tag(name = "管理后台-计划排期")
@@ -151,4 +148,20 @@ public class PlanSchedulingController {
     public CommonResult<PageResult<PlanSchedulingRespVO>> frontDesk(@Valid PlanSchedulingPageVO pageReqVO) {
         return success(planSchedulingService.frontDesk(pageReqVO));
     }
+    /**
+     *   排期列表  查询
+     * */
+    @GetMapping("/pending-inspection-page/boiler")
+    @Operation(summary = "设备前台约检分页")
+    public CommonResult<PageResult<EquipBoilerPageRespVO>> pendingInspectionPageBoiler(@Valid PendingInspectionEquipReqVO pageReqVO) {
+        return success(planSchedulingService.pendingInspectionPageBoiler(pageReqVO));
+    }
+    /**
+     *   排期列表  查询
+     * */
+    @GetMapping("/pending-inspection-page/pipe")
+    @Operation(summary = "设备前台约检分页")
+    public CommonResult<PageResult<EquipPipePageRespVO>> pendingInspectionPagePipe(@Valid PendingInspectionEquipReqVO pageReqVO) {
+        return success(planSchedulingService.pendingInspectionPagePipe(pageReqVO));
+    }
 }

+ 162 - 0
tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/controller/admin/planscheduling/vo/EquipBoilerPageRespVO.java

@@ -0,0 +1,162 @@
+package cn.start.tz.module.pressure2.controller.admin.planscheduling.vo;
+
+import cn.start.tz.framework.excel.core.annotations.DictFormat;
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDate;
+
+@Schema(description = "管理后台 - 容器设备分页 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class EquipBoilerPageRespVO {
+
+    @Schema(description = "容器设备id", requiredMode = Schema.RequiredMode.REQUIRED)
+    private String id;
+
+    @Schema(description = "设备类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
+    @DictFormat("system_equip_container_type")
+    private String type;
+
+    @Schema(description = "单位代码", requiredMode = Schema.RequiredMode.REQUIRED)
+    private String unitCode;
+
+    @Schema(description = "区域", requiredMode = Schema.RequiredMode.REQUIRED)
+    private Integer equipDistrict;
+
+    @Schema(description = "设备所在街道", requiredMode = Schema.RequiredMode.REQUIRED)
+    private Integer equipStreet;
+
+    @Schema(description = "设备所在街道名称", requiredMode = Schema.RequiredMode.REQUIRED)
+    private String equipStreetName;
+
+    @Schema(description = "运行状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
+    @DictFormat("system_equip_container_status")
+    private String status;
+
+    @Schema(description = "容器归类", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
+    @DictFormat("system_equip_container_equip_type")
+    private String equipType;
+
+    @Schema(description = "投入使用日期")
+    private String useDate;
+
+    @Schema(description = "部门id")
+    private String deptId;
+
+    @Schema(description = "行政区域类型(all/gz)全国/广州")
+    private String areaType;
+
+    @Schema(description = "社会统一信用代码")
+    private String socialCreditCode;
+
+    @Schema(description = "单位id")
+    private String unitId;
+
+    @Schema(description = "下次年度检查日期")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private LocalDate nextYearCheckDate;
+
+    @Schema(description = "检验部门名称")
+    private String checkDeptName;
+
+    @Schema(description = "设备品种")
+    private String equipCategory;
+
+    @Schema(description = "设备地址")
+    private String equipAddress;
+
+    @Schema(description = "最新任务单ID")
+    private String taskOrderId;
+
+    @Schema(description = "最新任务单状态")
+    private Integer taskStatus;
+
+    @JsonFormat
+    private LocalDate makeDate;
+
+    @Schema(description = "是否超年限")
+    private Boolean isExceedTimeLimit;
+
+    @Schema(description = "使用单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "广丰陶瓷厂")
+    @ExcelProperty("使用单位")
+    private String unitName;
+
+    @Schema(description = "区域", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("区域")
+    private String equipDistrictName;
+
+    @Schema(description = "联系人")
+    @ExcelProperty("联系人")
+    private String contact;
+
+    @Schema(description = "联系人电话")
+    @ExcelProperty("联系人电话")
+    private String contactPhone;
+
+    @Schema(description = "检验性质(100=定检,200=年检,300=超年限)", example = "2")
+    private Integer checkType;
+
+    @Schema(description = "检验性质中文")
+    @ExcelProperty("检验性质")
+    private String checkTypeStr;
+
+    @Schema(description = "是否存在待处理的约检确认单")
+    private Boolean hasPendingAppointment;
+
+    @Schema(description = "约检日期")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private LocalDate appointmentDate;
+
+    @Schema(description = "检验日期")
+    @ExcelProperty("检验日期")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private LocalDate nextCheckDate;
+
+    @Schema(description = "部门名称")
+    @ExcelProperty("部门名称")
+    private String deptName;
+
+    @Schema(description = "设备注册代码", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("设备注册代码")
+    private String equipCode;
+
+    @Schema(description = "产品编号")
+    @ExcelProperty("产品编号")
+    private String productNo;
+
+    @Schema(description = "使用证编号")
+    @ExcelProperty("使用证编号")
+    private String useRegisterNo;
+
+    @Schema(description = "容器名称")
+    @ExcelProperty("容器名称")
+    private String equipName;
+
+    @Schema(description = "容积")
+    @ExcelProperty("容积")
+    private String equipVolume;
+
+    @Schema(description = "使用年限")
+    @ExcelProperty("使用年限")
+    private String useYears;
+
+    @Schema(description = "设计使用年限")
+    @ExcelProperty("设计使用年限")
+    private Integer designUseYears;
+
+    @Schema(description = "是否为拒检状态")
+    private Boolean isRefused;
+
+    @Schema(description = "拒检类型(100=客户拒检, 200=拒检审核, 300=拒绝定检)")
+    private Integer refuseType;
+
+    @Schema(description = "拒检状态(100=待审核, 200=已拒绝, 300=已通过)")
+    private Integer refuseStatus;
+
+    @Schema(description = "是否存在待审核的启用申请")
+    private Boolean hasPendingEnableAudit;
+}

+ 162 - 0
tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/controller/admin/planscheduling/vo/EquipPipePageRespVO.java

@@ -0,0 +1,162 @@
+package cn.start.tz.module.pressure2.controller.admin.planscheduling.vo;
+
+import cn.start.tz.framework.excel.core.annotations.DictFormat;
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDate;
+
+@Schema(description = "管理后台 - 容器设备分页 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class EquipPipePageRespVO {
+
+    @Schema(description = "容器设备id", requiredMode = Schema.RequiredMode.REQUIRED)
+    private String id;
+
+    @Schema(description = "设备类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
+    @DictFormat("system_equip_container_type")
+    private String type;
+
+    @Schema(description = "单位代码", requiredMode = Schema.RequiredMode.REQUIRED)
+    private String unitCode;
+
+    @Schema(description = "区域", requiredMode = Schema.RequiredMode.REQUIRED)
+    private Integer equipDistrict;
+
+    @Schema(description = "设备所在街道", requiredMode = Schema.RequiredMode.REQUIRED)
+    private Integer equipStreet;
+
+    @Schema(description = "设备所在街道名称", requiredMode = Schema.RequiredMode.REQUIRED)
+    private String equipStreetName;
+
+    @Schema(description = "运行状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
+    @DictFormat("system_equip_container_status")
+    private String status;
+
+    @Schema(description = "容器归类", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
+    @DictFormat("system_equip_container_equip_type")
+    private String equipType;
+
+    @Schema(description = "投入使用日期")
+    private String useDate;
+
+    @Schema(description = "部门id")
+    private String deptId;
+
+    @Schema(description = "行政区域类型(all/gz)全国/广州")
+    private String areaType;
+
+    @Schema(description = "社会统一信用代码")
+    private String socialCreditCode;
+
+    @Schema(description = "单位id")
+    private String unitId;
+
+    @Schema(description = "下次年度检查日期")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private LocalDate nextYearCheckDate;
+
+    @Schema(description = "检验部门名称")
+    private String checkDeptName;
+
+    @Schema(description = "设备品种")
+    private String equipCategory;
+
+    @Schema(description = "设备地址")
+    private String equipAddress;
+
+    @Schema(description = "最新任务单ID")
+    private String taskOrderId;
+
+    @Schema(description = "最新任务单状态")
+    private Integer taskStatus;
+
+    @JsonFormat
+    private LocalDate makeDate;
+
+    @Schema(description = "是否超年限")
+    private Boolean isExceedTimeLimit;
+
+    @Schema(description = "使用单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "广丰陶瓷厂")
+    @ExcelProperty("使用单位")
+    private String unitName;
+
+    @Schema(description = "区域", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("区域")
+    private String equipDistrictName;
+
+    @Schema(description = "联系人")
+    @ExcelProperty("联系人")
+    private String contact;
+
+    @Schema(description = "联系人电话")
+    @ExcelProperty("联系人电话")
+    private String contactPhone;
+
+    @Schema(description = "检验性质(100=定检,200=年检,300=超年限)", example = "2")
+    private Integer checkType;
+
+    @Schema(description = "检验性质中文")
+    @ExcelProperty("检验性质")
+    private String checkTypeStr;
+
+    @Schema(description = "是否存在待处理的约检确认单")
+    private Boolean hasPendingAppointment;
+
+    @Schema(description = "约检日期")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private LocalDate appointmentDate;
+
+    @Schema(description = "检验日期")
+    @ExcelProperty("检验日期")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private LocalDate nextCheckDate;
+
+    @Schema(description = "部门名称")
+    @ExcelProperty("部门名称")
+    private String deptName;
+
+    @Schema(description = "设备注册代码", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("设备注册代码")
+    private String equipCode;
+
+    @Schema(description = "产品编号")
+    @ExcelProperty("产品编号")
+    private String productNo;
+
+    @Schema(description = "使用证编号")
+    @ExcelProperty("使用证编号")
+    private String useRegisterNo;
+
+    @Schema(description = "容器名称")
+    @ExcelProperty("容器名称")
+    private String equipName;
+
+    @Schema(description = "容积")
+    @ExcelProperty("容积")
+    private String equipVolume;
+
+    @Schema(description = "使用年限")
+    @ExcelProperty("使用年限")
+    private String useYears;
+
+    @Schema(description = "设计使用年限")
+    @ExcelProperty("设计使用年限")
+    private Integer designUseYears;
+
+    @Schema(description = "是否为拒检状态")
+    private Boolean isRefused;
+
+    @Schema(description = "拒检类型(100=客户拒检, 200=拒检审核, 300=拒绝定检)")
+    private Integer refuseType;
+
+    @Schema(description = "拒检状态(100=待审核, 200=已拒绝, 300=已通过)")
+    private Integer refuseStatus;
+
+    @Schema(description = "是否存在待审核的启用申请")
+    private Boolean hasPendingEnableAudit;
+}

+ 118 - 0
tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/controller/admin/planscheduling/vo/PendingInspectionEquipReqVO.java

@@ -0,0 +1,118 @@
+package cn.start.tz.module.pressure2.controller.admin.planscheduling.vo;
+
+import cn.start.tz.framework.common.pojo.PageParam;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDate;
+import java.util.List;
+
+import static cn.start.tz.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
+
+@Schema(description = "管理后台 - 容器设备分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class PendingInspectionEquipReqVO extends PageParam {
+
+    @Schema(description = "设备类型", example = "2")
+    private String type;
+
+    @Schema(description = "单位代码")
+    private String unitCode;
+
+    @Schema(description = "设备ID列表")
+    private List<String> ids;
+
+    @Schema(description = "单位ID")
+    private String unitId;
+
+    @Schema(description = "内部编号")
+    private String unitInnerNo;
+
+    @Schema(description = "单位名称", example = "广丰陶瓷厂")
+    private String unitName;
+
+    @Schema(description = "行政区域")
+    private Integer equipDistrict;
+
+    @Schema(description = "是否显示无区域的设备")
+    private Boolean showNoDistrict = false;
+
+    @Schema(description = "街道")
+    private Integer equipStreet;
+
+    @Schema(description = "运行状态", example = "100")
+    private String status;
+
+    @Schema(description = "运行状态列表")
+    private List<String> statusList;
+
+    @Schema(description = "设备代码")
+    private String equipCode;
+
+    @Schema(description = "容器归类", example = "2")
+    private String equipType;
+
+    @Schema(description = "使用登记证编号")
+    private String useRegisterNo;
+
+//    @Schema(description = "投入使用日期")
+//    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+//    private LocalDate[] useDate;
+
+    @Schema(description = "行政区域类型(all/gz)全国/广州")
+    private String areaType;
+
+    private String contactId;
+
+    private String productNo;
+
+    private String equipName;
+
+    private String equipmentType;
+
+    private String contactPhone;
+
+    @Schema(description = "检验日期")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
+    private List<LocalDate> checkDate;
+
+    @Schema(description = "行政区域列表")
+    private List<Integer> equipDistricts;
+
+    @Schema(description = "关联部门")
+    private String deptId;
+
+    @Schema(description = "定检时间-开始时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
+    private LocalDate checkDateStart;
+
+    @Schema(description = "定检时间-结束时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
+    private LocalDate checkDateEnd;
+
+    @Schema(description = "说明")
+    private String instruction;
+
+    @Schema(description = "是否超年限")
+    private Boolean isExceedTimeLimit;
+
+    @Schema(description = "检验性质(锅炉:100=内部检验,200=外部检验,300=耐压检验; 管道:100=定期检验,200=年度检查)")
+    private Integer checkType;
+
+    @Schema(description = "是否显示无下次检验日期的设备")
+    private Boolean showNoCheckDate = false;
+
+    @Schema(description = "是否已拒检")
+    private Boolean isRefused;
+
+    @Schema(description = "设备类型列表")
+    private List<String> equipTypeList;
+
+    @Schema(description = "设备类型")
+    private String equipMainType;
+}

+ 21 - 128
tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/dal/mysql/appointmentconfirmorder/AppointmentConfirmOrderMapper.java

@@ -1,18 +1,8 @@
 package cn.start.tz.module.pressure2.dal.mysql.appointmentconfirmorder;
 
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.start.tz.framework.common.pojo.PageResult;
 import cn.start.tz.framework.mybatis.core.mapper.BaseMapperX;
-import cn.start.tz.framework.mybatis.core.query.MPJLambdaWrapperX;
 import cn.start.tz.module.pressure2.controller.admin.appointmentconfirmorder.vo.*;
 import cn.start.tz.module.pressure2.dal.dataobject.appointmentconfirmorder.AppointmentConfirmOrderDO;
-import cn.start.tz.module.pressure2.dal.dataobject.boilerappointmentconfirmorderitem.BoilerAppointmentConfirmOrderItemDO;
-import cn.start.tz.module.pressure2.dal.dataobject.equipboiler.EquipBoilerDO;
-import cn.start.tz.module.pressure2.dal.dataobject.equipboilerscheduling.EquipBoilerSchedulingRecordDO;
-import cn.start.tz.module.pressure2.dal.dataobject.equipcontainer.EquipContainerDO;
-import cn.start.tz.module.pressure2.dal.dataobject.pipeappointmentconfirmorderitem.PipeAppointmentConfirmOrderItemDO;
-import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Update;
@@ -29,125 +19,9 @@ import java.util.List;
 
 public interface AppointmentConfirmOrderMapper extends BaseMapperX<AppointmentConfirmOrderDO> {
 
-    default PageResult<AppointmentConfirmOrderRespVO> selectPage(AppointmentConfirmOrderPageReqVO reqVO) {
-        MPJLambdaWrapperX<AppointmentConfirmOrderDO> recordDOMPJLambdaWrapper = new MPJLambdaWrapperX<>();
+    List<AppointmentConfirmOrderRespVO> selectPage(@Param("reqVO") AppointmentConfirmOrderPageReqVO reqVO);
 
-        recordDOMPJLambdaWrapper = (MPJLambdaWrapperX<AppointmentConfirmOrderDO>) recordDOMPJLambdaWrapper.
-                selectAll(AppointmentConfirmOrderDO.class).
-                selectAs(EquipBoilerSchedulingRecordDO::getCreateTime, AppointmentConfirmOrderRespVO::getSchedulingTime);
-        
-        // 根据设备主类型动态构建查询
-        if (reqVO.getEquipMainType() == 200) {
-            // 锅炉设备
-            recordDOMPJLambdaWrapper
-                    .selectCount(BoilerAppointmentConfirmOrderItemDO::getEquipId, "equipNum")
-                    .leftJoin(BoilerAppointmentConfirmOrderItemDO.class, BoilerAppointmentConfirmOrderItemDO::getOrderId, AppointmentConfirmOrderDO::getId)
-                    .leftJoin(EquipBoilerDO.class, EquipBoilerDO::getId, BoilerAppointmentConfirmOrderItemDO::getEquipId)
-                    .leftJoin(EquipBoilerSchedulingRecordDO.class, EquipBoilerSchedulingRecordDO::getId, AppointmentConfirmOrderDO::getSchedulingId);
-        } else if (reqVO.getEquipMainType() == 300) {
-            // 压力管道设备
-            recordDOMPJLambdaWrapper
-                    .selectCount(PipeAppointmentConfirmOrderItemDO::getEquipId, "equipNum")
-                    .leftJoin(PipeAppointmentConfirmOrderItemDO.class, PipeAppointmentConfirmOrderItemDO::getOrderId, AppointmentConfirmOrderDO::getId)
-                    .leftJoin(EquipBoilerSchedulingRecordDO.class, EquipBoilerSchedulingRecordDO::getId, AppointmentConfirmOrderDO::getSchedulingId);
-        } else {
-            // 其他类型(如容器等)
-            recordDOMPJLambdaWrapper
-                    .leftJoin(EquipContainerDO.class, EquipContainerDO::getId, AppointmentConfirmOrderDO::getId)
-                    .leftJoin(EquipBoilerSchedulingRecordDO.class, EquipBoilerSchedulingRecordDO::getId, AppointmentConfirmOrderDO::getSchedulingId);
-        }
-        
-        recordDOMPJLambdaWrapper
-                .groupBy(AppointmentConfirmOrderDO::getId)
-                .orderByDesc(AppointmentConfirmOrderDO::getCreateTime);
-
-        // 条件
-        recordDOMPJLambdaWrapper.eqIfPresent(AppointmentConfirmOrderDO::getUnitCode, reqVO.getUnitCode())
-                .likeIfPresent(AppointmentConfirmOrderDO::getUnitName, reqVO.getUnitName())
-                .likeIfPresent(AppointmentConfirmOrderDO::getUnitAddress, reqVO.getUnitAddress())
-                .likeIfPresent(AppointmentConfirmOrderDO::getAppointmentNo, reqVO.getAppointmentNo())
-                .eqIfPresent(AppointmentConfirmOrderDO::getCheckType, reqVO.getCheckType())
-                .eqIfPresent(AppointmentConfirmOrderDO::getEquipType, reqVO.getEquipType())
-                .eqIfPresent(AppointmentConfirmOrderDO::getEquipStreet, reqVO.getEquipStreet())
-                .eqIfPresent(AppointmentConfirmOrderDO::getEquipDistrict, reqVO.getEquipDistrict())
-                .betweenIfPresent(AppointmentConfirmOrderDO::getAppointmentDate, reqVO.getAppointmentDate())
-                .eqIfPresent(AppointmentConfirmOrderDO::getUnitContact, reqVO.getUnitContact())
-                .eqIfPresent(AppointmentConfirmOrderDO::getUnitPhone, reqVO.getUnitPhone())
-                //.eqIfPresent(AppointmentConfirmOrderDO::getStatus, reqVO.getStatus())
-                .betweenIfPresent(AppointmentConfirmOrderDO::getCreateTime, reqVO.getCreateTime())
-                .eqIfPresent(AppointmentConfirmOrderDO::getMobile, reqVO.getMobile())
-                .eqIfPresent(AppointmentConfirmOrderDO::getZipCode, reqVO.getZipCode())
-                .eqIfPresent(AppointmentConfirmOrderDO::getRemark, reqVO.getRemark())
-                .eqIfPresent(AppointmentConfirmOrderDO::getEmail, reqVO.getEmail())
-                .eqIfPresent(AppointmentConfirmOrderDO::getDeptId, reqVO.getDeptId())
-                .eqIfPresent(AppointmentConfirmOrderDO::getOperator, reqVO.getOperator())
-                .eqIfPresent(AppointmentConfirmOrderDO::getIsAttach, reqVO.getIsAttach())
-                .eqIfPresent(AppointmentConfirmOrderDO::getSendType, reqVO.getSendType())
-                .eqIfPresent(AppointmentConfirmOrderDO::getVehicle, reqVO.getVehicle())
-                .eqIfPresent(AppointmentConfirmOrderDO::getFeeType, reqVO.getFeeType())
-                .eqIfPresent(AppointmentConfirmOrderDO::getAcceptType, reqVO.getAcceptType())
-                .eqIfPresent(AppointmentConfirmOrderDO::getActualAmount, reqVO.getActualAmount())
-                .eqIfPresent(AppointmentConfirmOrderDO::getServiceAmount, reqVO.getServiceAmount())
-                .eqIfPresent(AppointmentConfirmOrderDO::getShouldAmount, reqVO.getShouldAmount())
-                .eqIfPresent(AppointmentConfirmOrderDO::getReduceFee, reqVO.getReduceFee())
-                .likeIfPresent(AppointmentConfirmOrderDO::getUseUnitName, reqVO.getUseUnitName())
-                .eqIfPresent(AppointmentConfirmOrderDO::getEquipMainType, reqVO.getEquipMainType())
-                .eqIfPresent(AppointmentConfirmOrderDO::getCreateAcceptOrder, reqVO.getCreateAcceptOrder());
-        if (reqVO.getAppointmentDate() != null && reqVO.getAppointmentDate().length >= 2) {
-            List<LocalDate> appointmentDate = List.of(reqVO.getAppointmentDate());
-            System.out.println("date:" + appointmentDate.get(0).toString());
-            recordDOMPJLambdaWrapper.between(AppointmentConfirmOrderDO::getAppointmentDate,
-                    appointmentDate.get(0), appointmentDate.get(1));
-        }
-
-        if (reqVO.getWarningDay() != null && reqVO.getWarningDay().length >= 2) {
-            recordDOMPJLambdaWrapper.apply("(case when APPOINTMENT_DATE - WARNING_DATE >0 then APPOINTMENT_DATE - WARNING_DATE else 0 end) between {0} and {1}",
-                    reqVO.getWarningDay()[0], reqVO.getWarningDay()[1]);
-        }
-
-        if (StringUtils.isNotEmpty(reqVO.getContactPhone())) {
-            // 根据设备类型动态添加联系人电话查询条件
-            if (reqVO.getEquipMainType() == 200) {
-                recordDOMPJLambdaWrapper.eq(EquipBoilerDO::getContactPhone, reqVO.getContactPhone());
-            }
-            // 其他类型根据需要添加
-        }
-
-        if (reqVO.getEquipNum() != null) {
-            // 根据设备类型动态生成HAVING条件
-            if (reqVO.getEquipMainType() == 200) {
-                recordDOMPJLambdaWrapper.having("COUNT(t1.equip_id) = {0}", reqVO.getEquipNum());
-            } else if (reqVO.getEquipMainType() == 300) {
-                recordDOMPJLambdaWrapper.having("COUNT(t1.equip_id) = {0}", reqVO.getEquipNum());
-            }
-        }
-
-        if (reqVO.getStatus() != null && !reqVO.getStatus().isEmpty()) {
-            recordDOMPJLambdaWrapper.in(AppointmentConfirmOrderDO::getStatus, reqVO.getStatus());
-        }
-
-        if (reqVO.getNotStatus() != null) {
-            recordDOMPJLambdaWrapper.ne(AppointmentConfirmOrderDO::getStatus, reqVO.getNotStatus());
-        }
-
-        if (StrUtil.isNotEmpty(reqVO.getEquipCode())) {
-            // 根据设备类型动态添加设备代码查询条件
-            if (reqVO.getEquipMainType() == 200) {
-                recordDOMPJLambdaWrapper.like(EquipBoilerDO::getEquipCode, reqVO.getEquipCode());
-            } else if (reqVO.getEquipMainType() == 300) {
-                // 压力管道可能没有equipCode字段,需要根据实际情况调整
-                // 如果需要查询,可能需要通过PipeAppointmentConfirmOrderItemDO关联
-            } else {
-                recordDOMPJLambdaWrapper.like(EquipContainerDO::getEquipCode, reqVO.getEquipCode());
-            }
-        }
-
-        if (CollUtil.isNotEmpty(reqVO.getIds())) {
-            recordDOMPJLambdaWrapper.in(AppointmentConfirmOrderDO::getId, reqVO.getIds());
-        }
-
-        return selectJoinPage(reqVO, AppointmentConfirmOrderRespVO.class, recordDOMPJLambdaWrapper);
-    }
+    Long selectPageCount(@Param("reqVO") AppointmentConfirmOrderPageReqVO reqVO);
 
     @Update("update PRESSURE_APPOINTMENT_CONFIRM_ORDER set WARNING_DATE = APPOINTMENT_DATE - #{warningDay} where status = 100 and deleted=0")
     void updateWarningDate(@Param("warningDay") Integer warningDay);
@@ -155,4 +29,23 @@ public interface AppointmentConfirmOrderMapper extends BaseMapperX<AppointmentCo
     @Update("update PRESSURE_APPOINTMENT_CONFIRM_ORDER set APPOINTMENT_DATE = #{planDate} where status = 100 and deleted=0 and SCHEDULING_ID = #{schedulingId}")
     void updatePlanDate(@Param("schedulingId") String schedulingId,@Param("planDate") LocalDate planDate);
 
+    /**
+     * 查询设备的约检确认单(通过设备ID和检验类型)
+     * 使用 MyBatis Plus 实现,支持锅炉和管道两种设备类型
+     *
+     * @param equipId 设备ID
+     * @param checkType 检验类型
+     * @return 约检确认单信息
+     */
+    AppointmentConfirmOrderDO selectByEquipIdAndCheckTypeBoiler(@Param("equipId") String equipId, @Param("checkType") Integer checkType);
+  /**
+     * 查询设备的约检确认单(通过设备ID和检验类型)
+     * 使用 MyBatis Plus 实现,支持锅炉和管道两种设备类型
+     *
+     * @param equipId 设备ID
+     * @param checkType 检验类型
+     * @return 约检确认单信息
+     */
+    AppointmentConfirmOrderDO selectByEquipIdAndCheckTypePipe(@Param("equipId") String equipId, @Param("checkType") Integer checkType);
+
 }

+ 14 - 0
tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/dal/mysql/equipboiler/EquipBoilerMapper.java

@@ -16,6 +16,10 @@ import cn.start.tz.module.pressure2.dal.dataobject.equipboiler.EquipBoilerDO;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import org.apache.ibatis.annotations.Mapper;
 import cn.start.tz.module.pressure2.controller.admin.equipboiler.vo.*;
+import cn.start.tz.module.pressure2.controller.admin.planscheduling.vo.EquipBoilerPageRespVO;
+import cn.start.tz.module.pressure2.controller.admin.planscheduling.vo.PendingInspectionEquipReqVO;
+
+import java.util.List;
 
 /**
  * 锅炉设备 Mapper
@@ -25,6 +29,16 @@ import cn.start.tz.module.pressure2.controller.admin.equipboiler.vo.*;
 @Mapper
 public interface EquipBoilerMapper extends BaseMapperX<EquipBoilerDO> {
 
+    /**
+     * 查询待约检锅炉设备分页
+     */
+    List<EquipBoilerPageRespVO> selectPendingInspectionBoilerPage(PendingInspectionEquipReqVO reqVO);
+
+    /**
+     * 查询待约检锅炉设备总数
+     */
+    Long selectPendingInspectionBoilerCount(PendingInspectionEquipReqVO reqVO);
+
     default PageResult<EquipBoilerDO> selectPage(EquipBoilerPageReqVO reqVO) {
         return selectPage(reqVO, new LambdaQueryWrapperX<EquipBoilerDO>()
                 .eqIfPresent(EquipBoilerDO::getAreaType, reqVO.getAreaType())

+ 12 - 0
tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/dal/mysql/equippipe/EquipPipeMapper.java

@@ -21,6 +21,8 @@ import cn.start.tz.module.system.api.dept.dto.DeptRespDTO;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import org.apache.ibatis.annotations.Mapper;
 import cn.start.tz.module.pressure2.controller.admin.equippipe.vo.*;
+import cn.start.tz.module.pressure2.controller.admin.planscheduling.vo.EquipPipePageRespVO;
+import cn.start.tz.module.pressure2.controller.admin.planscheduling.vo.PendingInspectionEquipReqVO;
 
 /**
  * 管道设备 Mapper
@@ -30,6 +32,16 @@ import cn.start.tz.module.pressure2.controller.admin.equippipe.vo.*;
 @Mapper
 public interface EquipPipeMapper extends BaseMapperX<EquipPipeDO> {
 
+    /**
+     * 查询待约检管道设备分页
+     */
+    List<EquipPipePageRespVO> selectPendingInspectionPipePage(PendingInspectionEquipReqVO reqVO);
+
+    /**
+     * 查询待约检管道设备总数
+     */
+    Long selectPendingInspectionPipeCount(PendingInspectionEquipReqVO reqVO);
+
     default PageResult<EquipPipeDO> selectPage(EquipPipePageReqVO reqVO) {
         return selectPage(reqVO, new LambdaQueryWrapperX<EquipPipeDO>()
                 .likeIfPresent(EquipPipeDO::getUnitName, reqVO.getUnitName())

+ 35 - 32
tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/service/appointmentconfirmorder/AppointmentConfirmOrderServiceImpl.java

@@ -303,12 +303,10 @@ public class AppointmentConfirmOrderServiceImpl implements AppointmentConfirmOrd
     private TemplateSendLogApi templateSendLogApi;
 
     @Override
-    public PageResult<AppointmentConfirmOrderRespVO> getAppointmentConfirmOrderPage(AppointmentConfirmOrderPageReqVO pageReqVO) {
-        PageResult<AppointmentConfirmOrderRespVO> tmpResult = appointmentConfirmOrderMapper.selectPage(pageReqVO);
-
-        PageResult<AppointmentConfirmOrderRespVO> pageResult = BeanUtils.toBean(tmpResult, AppointmentConfirmOrderRespVO.class);
-
-        List<AppointmentConfirmOrderRespVO> list = pageResult.getList();
+    public PageResult<AppointmentConfirmOrderRespVO> getAppointmentConfirmOrderPage(AppointmentConfirmOrderPageReqVO pageReqVO){
+        PageResult<AppointmentConfirmOrderRespVO> pageResult = new PageResult<>();
+        List<AppointmentConfirmOrderRespVO> list = appointmentConfirmOrderMapper.selectPage(pageReqVO);
+        pageResult.setTotal(appointmentConfirmOrderMapper.selectPageCount(pageReqVO));
         if (CollUtil.isNotEmpty(list)) {
             List<String> deptIds = list.stream().map(AppointmentConfirmOrderRespVO::getDeptId).filter(Objects::nonNull).toList();
             Map<String, DeptRespDTO> deptMap = new HashMap<>();
@@ -325,37 +323,42 @@ public class AppointmentConfirmOrderServiceImpl implements AppointmentConfirmOrd
             TemplateSendLogDto templateSendLogDto = new TemplateSendLogDto();
             templateSendLogDto.setBusinessIds(respVOIds);
             templateSendLogDto.setBusinessType(0);
-            List<TemplateSendLogRespDto> templateSendLogList = templateSendLogApi.getTemplateSendLog(templateSendLogDto).getCheckedData();
-            list.forEach((item) -> {
-                Area area = AreaUtils.getArea(item.getEquipStreet());
-                if (area != null) {
-                    item.setEquipStreetName(area.getName());
-                }
 
-                area = AreaUtils.getArea(item.getEquipDistrict());
-                if (area != null) {
-                    item.setEquipDistrictName(area.getName());
-                }
+            try{
+                List<TemplateSendLogRespDto> templateSendLogList = templateSendLogApi.getTemplateSendLog(templateSendLogDto).getCheckedData();
+                list.forEach((item) -> {
+                    Area area = AreaUtils.getArea(item.getEquipStreet());
+                    if (area != null) {
+                        item.setEquipStreetName(area.getName());
+                    }
 
-                if (item.getWarningDate() != null) {
-                    LocalDate now = LocalDate.now();
-                    long betweenDay = ChronoUnit.DAYS.between(now, item.getWarningDate());
-                    if (betweenDay < 0) {
-                        betweenDay = 0;
+                    area = AreaUtils.getArea(item.getEquipDistrict());
+                    if (area != null) {
+                        item.setEquipDistrictName(area.getName());
                     }
-                    item.setWarningDay(Integer.valueOf(betweenDay + ""));
-                }
 
-                if (CollUtil.isNotEmpty(templateSendLogList)) {
-                    List<TemplateSendLogRespDto> list1 = templateSendLogList.stream().filter(x -> x.getBusinessId().equals(item.getId()))
-                            .sorted(Comparator.comparing(TemplateSendLogRespDto::getCreateTime, Comparator.reverseOrder()))
-                            .toList();
-                    item.setTempSendNum(list1.size());
-                    if (CollUtil.isNotEmpty(list1)) {
-                        item.setTempSendStatus(list1.get(0).getStatus());
+                    if (item.getWarningDate() != null) {
+                        LocalDate now = LocalDate.now();
+                        long betweenDay = ChronoUnit.DAYS.between(now, item.getWarningDate());
+                        if (betweenDay < 0) {
+                            betweenDay = 0;
+                        }
+                        item.setWarningDay(Integer.valueOf(betweenDay + ""));
                     }
-                }
-            });
+
+                    if (CollUtil.isNotEmpty(templateSendLogList)) {
+                        List<TemplateSendLogRespDto> list1 = templateSendLogList.stream().filter(x -> x.getBusinessId().equals(item.getId()))
+                                .sorted(Comparator.comparing(TemplateSendLogRespDto::getCreateTime, Comparator.reverseOrder()))
+                                .toList();
+                        item.setTempSendNum(list1.size());
+                        if (CollUtil.isNotEmpty(list1)) {
+                            item.setTempSendStatus(list1.get(0).getStatus());
+                        }
+                    }
+                });
+            } catch (Exception e) {
+                log.error("获取公众号模版发送信息 失败",e);
+            }
         }
         pageResult.setList(list);
         return pageResult;

+ 12 - 3
tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/service/planscheduling/PlanSchedulingService.java

@@ -2,12 +2,9 @@ package cn.start.tz.module.pressure2.service.planscheduling;
 
 
 import cn.start.tz.framework.common.pojo.PageResult;
-import cn.start.tz.module.pressure2.controller.admin.appointmentconfirmorder.vo.AppointmentSubmitVO;
 import cn.start.tz.module.pressure2.controller.admin.planscheduling.vo.*;
 import jakarta.validation.Valid;
 
-import java.util.List;
-
 public interface PlanSchedulingService {
 
 //    PlanSchedulingPageRespVO getPlanSchedulingPage(PlanSchedulingPageVO pageReqVO);
@@ -38,4 +35,16 @@ public interface PlanSchedulingService {
      * @return 结果
      */
     PageResult<PlanSchedulingRespVO> frontDesk(@Valid PlanSchedulingPageVO pageReqVO);
+    /**
+     * 设备前台约检分页
+     * @param pageReqVO 参数
+     * @return 结果
+     */
+    PageResult<EquipBoilerPageRespVO> pendingInspectionPageBoiler(@Valid PendingInspectionEquipReqVO pageReqVO);
+    /**
+     * 设备前台约检分页
+     * @param pageReqVO 参数
+     * @return 结果
+     */
+    PageResult<EquipPipePageRespVO> pendingInspectionPagePipe(@Valid PendingInspectionEquipReqVO pageReqVO);
 }

+ 331 - 14
tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/service/planscheduling/PlanSchedulingServiceImpl.java

@@ -2,18 +2,23 @@ package cn.start.tz.module.pressure2.service.planscheduling;
 
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
 import cn.start.tz.framework.common.pojo.PageResult;
 import cn.start.tz.framework.ip.core.Area;
 import cn.start.tz.framework.ip.core.utils.AreaUtils;
-import cn.start.tz.module.pressure2.controller.admin.planscheduling.vo.PlanSchedulingPageVO;
-import cn.start.tz.module.pressure2.controller.admin.planscheduling.vo.PlanSchedulingRespVO;
-import cn.start.tz.module.pressure2.dal.dataobject.equipboiler.EquipBoilerDO;
-import cn.start.tz.module.pressure2.dal.dataobject.equippipe.EquipPipeDO;
+import cn.start.tz.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.start.tz.module.pressure2.controller.admin.planscheduling.vo.*;
+import cn.start.tz.module.pressure2.dal.dataobject.acceptorder.AcceptOrderDO;
+import cn.start.tz.module.pressure2.dal.dataobject.appointmentconfirmorder.AppointmentConfirmOrderDO;
+import cn.start.tz.module.pressure2.dal.mysql.acceptorder.AcceptOrderMapper;
+import cn.start.tz.module.pressure2.dal.mysql.appointmentconfirmorder.AppointmentConfirmOrderMapper;
 import cn.start.tz.module.pressure2.dal.mysql.equipboiler.EquipBoilerMapper;
 import cn.start.tz.module.pressure2.dal.mysql.equippipe.EquipPipeMapper;
 import cn.start.tz.module.system.api.clientunit.ClientUnitApi;
 import cn.start.tz.module.system.api.clientunit.dto.ClientUnitDTO;
 import cn.start.tz.module.system.api.clientunit.dto.ClientUnitPageDTO;
+import cn.start.tz.module.system.api.dept.DeptApi;
+import cn.start.tz.module.system.api.dept.dto.DeptRespDTO;
 import cn.start.tz.module.system.api.dict.DictDataApi;
 import cn.start.tz.module.system.api.dict.dto.DictDataRespDTO;
 import jakarta.annotation.Resource;
@@ -21,6 +26,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.validation.annotation.Validated;
 
+import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -37,6 +43,16 @@ public class PlanSchedulingServiceImpl implements PlanSchedulingService {
 
     @Resource
     private DictDataApi dictDataApi;
+
+    @Resource
+    private DeptApi deptApi;
+
+    @Resource
+    private AppointmentConfirmOrderMapper appointmentConfirmOrderMapper;
+
+
+    @Resource
+    private AcceptOrderMapper acceptOrderMapper;
 //
 //    @Resource
 //    private EquipContainerSchedulingMapper equipContainerSchedulingMapper;
@@ -53,7 +69,7 @@ public class PlanSchedulingServiceImpl implements PlanSchedulingService {
 //    @Resource
 //    private AppointmentConfirmOrderMapper appointmentConfirmOrderMapper;
 
-//    @Resource
+    //    @Resource
 //    private AppointmentConfirmOrderItemMapper appointmentConfirmOrderItemMapper;
 //
 //    @Resource
@@ -1131,17 +1147,18 @@ public class PlanSchedulingServiceImpl implements PlanSchedulingService {
 
     /**
      * 设备前台约检分页
+     *
      * @param pageReqVO 参数
      * @return 结果
      */
     @Override
-    public  PageResult<PlanSchedulingRespVO> frontDesk(PlanSchedulingPageVO pageReqVO) {
+    public PageResult<PlanSchedulingRespVO> frontDesk(PlanSchedulingPageVO pageReqVO) {
         //构建查询参数
         PageResult<PlanSchedulingRespVO> buildQueryParam = frontDeskQueryParam(pageReqVO);
         if (Objects.nonNull(buildQueryParam)) {
             return buildQueryParam;
         }
-        
+
         // 获取字典数据
         Map<String, String> boilerTypeMap = new HashMap<>();
         Map<String, String> pipeCategoryMap = new HashMap<>();
@@ -1159,7 +1176,7 @@ public class PlanSchedulingServiceImpl implements PlanSchedulingService {
         } catch (Exception e) {
             // 忽略字典获取异常
         }
-        
+
         // 根据不同的设备类型获取数据
         PageResult<PlanSchedulingRespVO> planSchedulingRespVOPageResult = switch (pageReqVO.getEquipMainType()) {
             // 锅炉设备
@@ -1179,23 +1196,23 @@ public class PlanSchedulingServiceImpl implements PlanSchedulingService {
             clientUnitPageDTO.setIds(unitIds);
             clientUnits = clientUnitApi.getUnit(clientUnitPageDTO).getData();
         }
-        
+
         DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
 
         for (PlanSchedulingRespVO planSchedulingRespVO : planSchedulingRespVOPageResult.getList()) {
             Area area = AreaUtils.getArea(planSchedulingRespVO.getEquipStreet());
-            if(area != null){
+            if (area != null) {
                 planSchedulingRespVO.setEquipStreetName(area.getName());
             }
 
             area = AreaUtils.getArea(planSchedulingRespVO.getEquipDistrict());
-            if(area != null){
+            if (area != null) {
                 planSchedulingRespVO.setEquipDistrictName(area.getName());
             }
 
             //获取单位信息
             if (CollUtil.isNotEmpty(clientUnits)) {
-                List<ClientUnitDTO> finalList = clientUnits.stream().filter(x -> x.getId().equals(planSchedulingRespVO.getUnitId())   ).toList();
+                List<ClientUnitDTO> finalList = clientUnits.stream().filter(x -> x.getId().equals(planSchedulingRespVO.getUnitId())).toList();
                 if (CollUtil.isNotEmpty(finalList)) {
                     ClientUnitDTO clientUnitDTO = finalList.get(0);
                     planSchedulingRespVO.setIsExempt(clientUnitDTO.getIsExempt());
@@ -1209,7 +1226,7 @@ public class PlanSchedulingServiceImpl implements PlanSchedulingService {
                     }
                 }
             }
-            
+
             // 处理锅炉特有字段
             if (Objects.equals(pageReqVO.getEquipMainType(), 200)) {
                 // 转换设备分类为名称
@@ -1217,7 +1234,7 @@ public class PlanSchedulingServiceImpl implements PlanSchedulingService {
                     planSchedulingRespVO.setEquipTypeName(boilerTypeMap.getOrDefault(planSchedulingRespVO.getType(), planSchedulingRespVO.getType()));
                 }
             }
-            
+
             // 处理管道特有字段
             if (Objects.equals(pageReqVO.getEquipMainType(), 300)) {
                 // 转换管道类别为名称
@@ -1229,6 +1246,306 @@ public class PlanSchedulingServiceImpl implements PlanSchedulingService {
         return planSchedulingRespVOPageResult;
     }
 
+    @Override
+    public PageResult<EquipBoilerPageRespVO> pendingInspectionPageBoiler(PendingInspectionEquipReqVO pageReqVO) {
+        // 查询总数
+        Long total = equipBoilerMapper.selectPendingInspectionBoilerCount(pageReqVO);
+
+        if (total == null || total == 0) {
+            return new PageResult<>(Collections.emptyList(), 0L);
+        }
+
+        // 查询列表数据
+        List<EquipBoilerPageRespVO> list = equipBoilerMapper.selectPendingInspectionBoilerPage(pageReqVO);
+
+        if (CollUtil.isEmpty(list)) {
+            return new PageResult<>(Collections.emptyList(), total);
+        }
+
+        // 查询单位信息并填充
+        Set<String> unitIds = list.stream()
+                .map(EquipBoilerPageRespVO::getUnitId)
+                .filter(StrUtil::isNotEmpty)
+                .collect(Collectors.toSet());
+
+        Map<String, List<ClientUnitDTO>> unitMap = new HashMap<>();
+        if (CollUtil.isNotEmpty(unitIds)) {
+            // 分批查询,避免URL过长
+            List<ClientUnitDTO> unitDTOList = new ArrayList<>();
+            List<String> unitIdList = new ArrayList<>(unitIds);
+            int batchSize = 100; // 每批最多100个ID
+            for (int i = 0; i < unitIdList.size(); i += batchSize) {
+                int end = Math.min(i + batchSize, unitIdList.size());
+                List<String> batchIds = unitIdList.subList(i, end);
+                unitDTOList.addAll(clientUnitApi.getClientUnitList(batchIds).getCheckedData());
+            }
+            unitMap = unitDTOList.stream()
+                    .collect(Collectors.groupingBy(ClientUnitDTO::getId));
+        }
+
+        // 查询部门信息并填充
+        Set<String> deptIds = list.stream()
+                .map(EquipBoilerPageRespVO::getDeptId)
+                .filter(StrUtil::isNotEmpty)
+                .collect(Collectors.toSet());
+
+        Map<String, DeptRespDTO> deptMap = new HashMap<>();
+        if (CollUtil.isNotEmpty(deptIds)) {
+            deptMap = deptApi.getDeptMap(deptIds);
+        }
+
+        // 填充附加信息
+        Map<String, List<ClientUnitDTO>> finalUnitMap = unitMap;
+        Map<String, DeptRespDTO> finalDeptMap = deptMap;
+        list.forEach(item -> {
+            // 设置区域名称
+            if (item.getEquipDistrict() != null) {
+                // 区域信息
+                if (Integer.valueOf(440116).equals(item.getEquipDistrict())) {
+                    // 萝岗区改为黄埔区
+                    item.setEquipDistrict(440112);
+                } else if (Integer.valueOf(440183).equals(item.getEquipDistrict())) {
+                    // 增城市改为增城区
+                    item.setEquipDistrict(440117);
+                } else if (Integer.valueOf(440184).equals(item.getEquipDistrict())) {
+                    // 从化市改为从化区
+                    item.setEquipDistrict(440118);
+                }
+                item.setEquipDistrictName(AreaUtils.getArea(item.getEquipDistrict()).getName());
+            }
+
+            if (item.getEquipStreet() != null) {
+                item.setEquipStreetName(AreaUtils.getArea(item.getEquipStreet()).getName());
+            }
+
+            // 设置单位信息
+            if (CollUtil.isNotEmpty(finalUnitMap.get(item.getUnitId()))) {
+                item.setSocialCreditCode(finalUnitMap.get(item.getUnitId()).get(0).getSocialCreditCode());
+            }
+
+            // 设置检验部门名称
+            if (item.getDeptId() != null && finalDeptMap.containsKey(item.getDeptId())) {
+                item.setCheckDeptName(finalDeptMap.get(item.getDeptId()).getName());
+                // 同时设置部门名称
+                item.setDeptName(finalDeptMap.get(item.getDeptId()).getName());
+            }
+
+            // 查询约检确认单和受理单状态,并获取约检日期
+            checkPendingBoilerAppointment(item, item.getCheckType());
+        });
+
+        // 手动组装 PageResult
+        return new PageResult<>(list, total);
+    }
+
+    @Override
+    public PageResult<EquipPipePageRespVO> pendingInspectionPagePipe(PendingInspectionEquipReqVO pageReqVO) {
+        // 查询总数
+        Long total = equipPipeMapper.selectPendingInspectionPipeCount(pageReqVO);
+
+        if (total == null || total == 0) {
+            return new PageResult<>(Collections.emptyList(), 0L);
+        }
+
+        // 查询列表数据
+        List<EquipPipePageRespVO> list = equipPipeMapper.selectPendingInspectionPipePage(pageReqVO);
+
+        if (CollUtil.isEmpty(list)) {
+            return new PageResult<>(Collections.emptyList(), total);
+        }
+
+        // 查询单位信息并填充
+        Set<String> unitIds = list.stream()
+                .map(EquipPipePageRespVO::getUnitId)
+                .filter(StrUtil::isNotEmpty)
+                .collect(Collectors.toSet());
+
+        Map<String, List<ClientUnitDTO>> unitMap = new HashMap<>();
+        if (CollUtil.isNotEmpty(unitIds)) {
+            // 分批查询,避免URL过长
+            List<ClientUnitDTO> unitDTOList = new ArrayList<>();
+            List<String> unitIdList = new ArrayList<>(unitIds);
+            int batchSize = 100; // 每批最多100个ID
+            for (int i = 0; i < unitIdList.size(); i += batchSize) {
+                int end = Math.min(i + batchSize, unitIdList.size());
+                List<String> batchIds = unitIdList.subList(i, end);
+                unitDTOList.addAll(clientUnitApi.getClientUnitList(batchIds).getCheckedData());
+            }
+            unitMap = unitDTOList.stream()
+                    .collect(Collectors.groupingBy(ClientUnitDTO::getId));
+        }
+
+        // 查询部门信息并填充
+        Set<String> deptIds = list.stream()
+                .map(EquipPipePageRespVO::getDeptId)
+                .filter(StrUtil::isNotEmpty)
+                .collect(Collectors.toSet());
+
+        Map<String, DeptRespDTO> deptMap = new HashMap<>();
+        if (CollUtil.isNotEmpty(deptIds)) {
+            deptMap = deptApi.getDeptMap(deptIds);
+        }
+
+        // 填充附加信息(Pipe)
+        Map<String, List<ClientUnitDTO>> finalUnitMap = unitMap;
+        Map<String, DeptRespDTO> finalDeptMap = deptMap;
+        list.forEach(item -> {
+            // 设置区域名称
+            if (item.getEquipDistrict() != null) {
+                // 区域信息
+                if (Integer.valueOf(440116).equals(item.getEquipDistrict())) {
+                    // 萝岗区改为黄埔区
+                    item.setEquipDistrict(440112);
+                } else if (Integer.valueOf(440183).equals(item.getEquipDistrict())) {
+                    // 增城市改为增城区
+                    item.setEquipDistrict(440117);
+                } else if (Integer.valueOf(440184).equals(item.getEquipDistrict())) {
+                    // 从化市改为从化区
+                    item.setEquipDistrict(440118);
+                }
+                item.setEquipDistrictName(AreaUtils.getArea(item.getEquipDistrict()).getName());
+            }
+
+            if (item.getEquipStreet() != null) {
+                item.setEquipStreetName(AreaUtils.getArea(item.getEquipStreet()).getName());
+            }
+
+            // 设置单位信息
+            if (CollUtil.isNotEmpty(finalUnitMap.get(item.getUnitId()))) {
+                item.setSocialCreditCode(finalUnitMap.get(item.getUnitId()).get(0).getSocialCreditCode());
+            }
+
+            // 设置检验部门名称
+            if (item.getDeptId() != null && finalDeptMap.containsKey(item.getDeptId())) {
+                item.setCheckDeptName(finalDeptMap.get(item.getDeptId()).getName());
+                // 同时设置部门名称
+                item.setDeptName(finalDeptMap.get(item.getDeptId()).getName());
+            }
+
+
+            // 查询约检确认单和受理单状态,并获取约检日期
+            checkPendingPipeAppointment(item, item.getCheckType());
+        });
+
+        // 手动组装 PageResult
+        return new PageResult<>(list, total);
+    }
+
+    /**
+     * 检查设备是否存在待处理的约检确认单,并设置约检日期
+     * 判断逻辑:
+     * 1. 查询设备是否存在约检确认单(通过设备ID和检验类型)
+     * 2. 如果存在约检确认单,先检查约检确认单本身的状态:
+     * - 500(已作废)→ 设置hasPendingAppointment=false,并设置约检日期
+     * 3. 如果约检确认单未作废,查看 createAcceptOrder 字段判断是否已创建受理单
+     * 4. 如果未创建受理单,设置hasPendingAppointment=true,并设置约检日期
+     * 5. 如果已创建受理单,查询该设备的受理单状态:
+     * - 100(待确认)→ 设置hasPendingAppointment=true,并设置约检日期
+     * - 200(已确认/审核通过)→ 设置hasPendingAppointment=false,并设置约检日期
+     * - 400(作废)→ 设置hasPendingAppointment=false,并设置约检日期
+     *
+     * @param item      设备分页VO对象
+     * @param checkType 检验类型
+     */
+    private void checkPendingPipeAppointment(EquipPipePageRespVO item, Integer checkType) {
+        // 查询设备的约检确认单(通过 LEFT JOIN 关联 item 表)
+        AppointmentConfirmOrderDO appointmentConfirmOrder = appointmentConfirmOrderMapper.selectByEquipIdAndCheckTypeBoiler(item.getId(), checkType);
+
+        // 不存在约检确认单
+        if (appointmentConfirmOrder == null) {
+            item.setHasPendingAppointment(false);
+            item.setAppointmentDate(null);
+            return;
+        }
+
+        // 设置约检日期
+        item.setAppointmentDate(appointmentConfirmOrder.getAppointmentDate());
+
+        // 检查约检确认单的状态,如果已作废(500),直接返回false
+        Integer appointmentStatus = appointmentConfirmOrder.getStatus();
+        if (Integer.valueOf(500).equals(appointmentStatus)) {
+            item.setHasPendingAppointment(false);
+            return;
+        }
+
+        // 检查是否已创建受理单
+        Boolean createAcceptOrder = appointmentConfirmOrder.getCreateAcceptOrder();
+        if (createAcceptOrder == null || !createAcceptOrder) {
+            // 未创建受理单,设置hasPendingAppointment=true(待处理)
+            item.setHasPendingAppointment(true);
+            return;
+        }
+
+        LambdaQueryWrapperX<AcceptOrderDO> queryWrapperX = new LambdaQueryWrapperX<>();
+        queryWrapperX.eq(AcceptOrderDO::getAppointmentId, appointmentConfirmOrder.getId())
+                .orderByDesc(AcceptOrderDO::getCreateTime)
+                .last("LIMIT 1");
+        AcceptOrderDO latestAcceptOrder = acceptOrderMapper.selectOne(queryWrapperX);
+
+        // 不存在受理单
+        if (latestAcceptOrder == null) {
+            item.setHasPendingAppointment(true);
+            return;
+        }
+        item.setAppointmentDate(latestAcceptOrder.getAppointmentDate());
+        // 判断受理单状态
+        Integer status = latestAcceptOrder.getStatus();
+        // 100(待确认)→ 设置hasPendingAppointment=true
+        // 200(已确认/审核通过)→ 设置hasPendingAppointment=false
+        // 400(作废)→ 设置hasPendingAppointment=false
+        item.setHasPendingAppointment(Integer.valueOf(100).equals(status));
+    }
+
+    private void checkPendingBoilerAppointment(EquipBoilerPageRespVO item, Integer checkType) {
+        // 查询设备的约检确认单(通过 LEFT JOIN 关联 item 表)
+        AppointmentConfirmOrderDO appointmentConfirmOrder = appointmentConfirmOrderMapper.selectByEquipIdAndCheckTypePipe(item.getId(), checkType);
+
+        // 不存在约检确认单
+        if (appointmentConfirmOrder == null) {
+            item.setHasPendingAppointment(false);
+            item.setAppointmentDate(null);
+            return;
+        }
+
+        // 设置约检日期
+        item.setAppointmentDate(appointmentConfirmOrder.getAppointmentDate());
+
+        // 检查约检确认单的状态,如果已作废(500),直接返回false
+        Integer appointmentStatus = appointmentConfirmOrder.getStatus();
+        if (Integer.valueOf(500).equals(appointmentStatus)) {
+            item.setHasPendingAppointment(false);
+            return;
+        }
+
+        // 检查是否已创建受理单
+        Boolean createAcceptOrder = appointmentConfirmOrder.getCreateAcceptOrder();
+        if (createAcceptOrder == null || !createAcceptOrder) {
+            // 未创建受理单,设置hasPendingAppointment=true(待处理)
+            item.setHasPendingAppointment(true);
+            return;
+        }
+
+        LambdaQueryWrapperX<AcceptOrderDO> queryWrapperX = new LambdaQueryWrapperX<>();
+        queryWrapperX.eq(AcceptOrderDO::getAppointmentId, appointmentConfirmOrder.getId())
+                .orderByDesc(AcceptOrderDO::getCreateTime)
+                .last("LIMIT 1");
+        AcceptOrderDO latestAcceptOrder = acceptOrderMapper.selectOne(queryWrapperX);
+
+        // 不存在受理单
+        if (latestAcceptOrder == null) {
+            item.setHasPendingAppointment(true);
+            return;
+        }
+        item.setAppointmentDate(latestAcceptOrder.getAppointmentDate());
+        // 判断受理单状态
+        Integer status = latestAcceptOrder.getStatus();
+        // 100(待确认)→ 设置hasPendingAppointment=true
+        // 200(已确认/审核通过)→ 设置hasPendingAppointment=false
+        // 400(作废)→ 设置hasPendingAppointment=false
+        item.setHasPendingAppointment(Integer.valueOf(100).equals(status));
+    }
+
+
     private PageResult<PlanSchedulingRespVO> frontDeskQueryParam(PlanSchedulingPageVO pageReqVO) {
         //根据统一社会信用代码查询
         if (StringUtils.isNotBlank(pageReqVO.getSocialCreditCode())) {

+ 182 - 1
tz-module-pressure2/tz-module-pressure2-biz/src/main/resources/mapper/appointmentconfirmorder/AppointmentConfirmOrderMapper.xml

@@ -1,6 +1,6 @@
 <?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="cn.start.tz.module.pressure.dal.mysql.appointmentconfirmorder.AppointmentConfirmOrderMapper">
+<mapper namespace="cn.start.tz.module.pressure2.dal.mysql.appointmentconfirmorder.AppointmentConfirmOrderMapper">
 
     <!--
         一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
@@ -9,4 +9,185 @@
         文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
      -->
 
+
+    <select id="selectByEquipIdAndCheckTypeBoiler"
+            resultType="cn.start.tz.module.pressure2.dal.dataobject.appointmentconfirmorder.AppointmentConfirmOrderDO">
+        SELECT DISTINCT
+        aco.*
+        FROM pressure_appointment_confirm_order aco
+        LEFT JOIN PRESSURE2_BOILER_APPOINTMENT_CONFIRM_ORDER_ITEM acoi ON acoi.order_id = aco.id
+        WHERE aco.deleted = 0
+        AND acoi.deleted = 0
+        AND acoi.equip_id = #{equipId}
+        AND aco.check_type = #{checkType}
+        ORDER BY aco.create_time DESC
+        LIMIT 1
+    </select>
+    <select id="selectByEquipIdAndCheckTypePipe"
+            resultType="cn.start.tz.module.pressure2.dal.dataobject.appointmentconfirmorder.AppointmentConfirmOrderDO">
+        SELECT DISTINCT
+        aco.*
+        FROM pressure_appointment_confirm_order aco
+        LEFT JOIN PRESSURE2_PIPE_APPOINTMENT_CONFIRM_ORDER_ITEM acoi ON acoi.order_id = aco.id
+        WHERE aco.deleted = 0
+        AND acoi.deleted = 0
+        AND acoi.equip_id = #{equipId}
+        AND aco.check_type = #{checkType}
+        ORDER BY aco.create_time DESC
+        LIMIT 1
+    </select>
+
+    <select id="selectPage" resultType="cn.start.tz.module.pressure2.controller.admin.appointmentconfirmorder.vo.AppointmentConfirmOrderRespVO">
+        SELECT * FROM (
+            SELECT aco.*,
+                   COALESCE(ebs.create_time, eps.create_time) AS scheduling_time,
+                   aco.equip_num_boiler AS equip_num
+            FROM pressure_appointment_confirm_order aco
+            LEFT JOIN pressure2_boiler_appointment_confirm_order_item baci ON baci.order_id = aco.id AND baci.deleted = 0
+            LEFT JOIN pressure2_equip_boiler eb ON eb.id = baci.equip_id AND eb.deleted = 0
+            LEFT JOIN pressure2_equip_boiler_scheduling ebs ON ebs.id = aco.scheduling_id AND ebs.deleted = 0
+            LEFT JOIN pressure2_pipe_appointment_confirm_order_item paci ON paci.order_id = aco.id AND paci.deleted = 0
+            LEFT JOIN pressure2_pipe_appointment_confirm_order_item_detail pacid ON pacid.order_id = aco.id AND pacid.deleted = 0
+            LEFT JOIN pressure2_equip_pipe ep ON ep.id = paci.equip_id AND ep.deleted = 0
+            LEFT JOIN pressure2_equip_pipe_detail epd ON epd.id = pacid.equip_id AND epd.deleted = 0
+            LEFT JOIN pressure2_equip_pipe_scheduling eps ON eps.id = aco.scheduling_id AND eps.deleted = 0
+            <where>
+                aco.deleted = 0
+                <if test="reqVO.unitCode != null and reqVO.unitCode != ''">AND aco.unit_code = #{reqVO.unitCode}</if>
+                <if test="reqVO.unitName != null and reqVO.unitName != ''">AND aco.unit_name LIKE CONCAT('%', #{reqVO.unitName}, '%')</if>
+                <if test="reqVO.unitAddress != null and reqVO.unitAddress != ''">AND aco.unit_address LIKE CONCAT('%', #{reqVO.unitAddress}, '%')</if>
+                <if test="reqVO.appointmentNo != null and reqVO.appointmentNo != ''">AND aco.appointment_no LIKE CONCAT('%', #{reqVO.appointmentNo}, '%')</if>
+                <if test="reqVO.checkType != null">AND aco.check_type = #{reqVO.checkType}</if>
+                <if test="reqVO.equipType != null">AND aco.equip_type = #{reqVO.equipType}</if>
+                <if test="reqVO.equipStreet != null">AND aco.equip_street = #{reqVO.equipStreet}</if>
+                <if test="reqVO.equipDistrict != null">AND aco.equip_district = #{reqVO.equipDistrict}</if>
+                <if test="reqVO.appointmentDate != null and reqVO.appointmentDate.length >= 2">
+                    AND aco.appointment_date BETWEEN #{reqVO.appointmentDate[0]} AND #{reqVO.appointmentDate[1]}
+                </if>
+                <if test="reqVO.warningDay != null and reqVO.warningDay.length >= 2">
+                    AND (CASE WHEN aco.appointment_date - aco.warning_date > 0 THEN aco.appointment_date - aco.warning_date ELSE 0 END) BETWEEN #{reqVO.warningDay[0]} AND #{reqVO.warningDay[1]}
+                </if>
+                <if test="reqVO.unitContact != null and reqVO.unitContact != ''">AND aco.unit_contact = #{reqVO.unitContact}</if>
+                <if test="reqVO.unitPhone != null and reqVO.unitPhone != ''">AND aco.unit_phone = #{reqVO.unitPhone}</if>
+                <if test="reqVO.createTime != null and reqVO.createTime.length >= 2">
+                    AND aco.create_time BETWEEN #{reqVO.createTime[0]} AND #{reqVO.createTime[1]}
+                </if>
+                <if test="reqVO.mobile != null and reqVO.mobile != ''">AND aco.mobile = #{reqVO.mobile}</if>
+                <if test="reqVO.zipCode != null and reqVO.zipCode != ''">AND aco.zip_code = #{reqVO.zipCode}</if>
+                <if test="reqVO.remark != null and reqVO.remark != ''">AND aco.remark = #{reqVO.remark}</if>
+                <if test="reqVO.email != null and reqVO.email != ''">AND aco.email = #{reqVO.email}</if>
+                <if test="reqVO.deptId != null and reqVO.deptId != ''">AND aco.dept_id = #{reqVO.deptId}</if>
+                <if test="reqVO.operator != null and reqVO.operator != ''">AND aco.operator = #{reqVO.operator}</if>
+                <if test="reqVO.isAttach != null">AND aco.is_attach = #{reqVO.isAttach}</if>
+                <if test="reqVO.sendType != null">AND aco.send_type = #{reqVO.sendType}</if>
+                <if test="reqVO.vehicle != null">AND aco.vehicle = #{reqVO.vehicle}</if>
+                <if test="reqVO.feeType != null">AND aco.fee_type = #{reqVO.feeType}</if>
+                <if test="reqVO.acceptType != null">AND aco.accept_type = #{reqVO.acceptType}</if>
+                <if test="reqVO.actualAmount != null">AND aco.actual_amount = #{reqVO.actualAmount}</if>
+                <if test="reqVO.serviceAmount != null">AND aco.service_amount = #{reqVO.serviceAmount}</if>
+                <if test="reqVO.shouldAmount != null">AND aco.should_amount = #{reqVO.shouldAmount}</if>
+                <if test="reqVO.reduceFee != null">AND aco.reduce_fee = #{reqVO.reduceFee}</if>
+                <if test="reqVO.equipMainType != null">AND aco.equip_main_type = #{reqVO.equipMainType}</if>
+                <if test="reqVO.useUnitSocialCreditCode != null and reqVO.useUnitSocialCreditCode != ''">AND aco.use_unit_social_credit_code = #{reqVO.useUnitSocialCreditCode}</if>
+                <if test="reqVO.useUnitName != null and reqVO.useUnitName != ''">AND aco.use_unit_name LIKE CONCAT('%', #{reqVO.useUnitName}, '%')</if>
+                <if test="reqVO.createAcceptOrder != null">AND aco.create_accept_order = #{reqVO.createAcceptOrder}</if>
+                <if test="reqVO.equipCode != null and reqVO.equipCode != ''">
+                    AND (eb.equip_code LIKE CONCAT('%', #{reqVO.equipCode}, '%') OR epd.pipe_reg_code LIKE CONCAT('%', #{reqVO.equipCode}, '%'))
+                </if>
+                <if test="reqVO.contactPhone != null and reqVO.contactPhone != ''">
+                    AND (eb.contact_phone = #{reqVO.contactPhone} OR ep.contact_phone = #{reqVO.contactPhone})
+                </if>
+                <if test="reqVO.status != null and reqVO.status.size() > 0">
+                    AND aco.status IN
+                    <foreach collection="reqVO.status" item="item" open="(" separator="," close=")">#{item}</foreach>
+                </if>
+                <if test="reqVO.notStatus != null">AND aco.status != #{reqVO.notStatus}</if>
+                <if test="reqVO.ids != null and reqVO.ids.size() > 0">
+                    AND aco.id IN
+                    <foreach collection="reqVO.ids" item="item" open="(" separator="," close=")">#{item}</foreach>
+                </if>
+            </where>
+            GROUP BY aco.id
+            <if test="reqVO.equipNum != null">
+                HAVING COUNT(baci.equip_id) = #{reqVO.equipNum}
+            </if>
+            ORDER BY aco.create_time DESC
+        ) tmp
+        OFFSET ${(reqVO.pageNo - 1) * reqVO.pageSize} ROWS FETCH NEXT #{reqVO.pageSize} ROWS ONLY
+    </select>
+
+    <select id="selectPageCount" resultType="java.lang.Long">
+        SELECT COUNT(1) FROM (
+            SELECT aco.id
+            FROM pressure_appointment_confirm_order aco
+            LEFT JOIN pressure2_boiler_appointment_confirm_order_item baci ON baci.order_id = aco.id AND baci.deleted = 0
+            LEFT JOIN pressure2_equip_boiler eb ON eb.id = baci.equip_id AND eb.deleted = 0
+            LEFT JOIN pressure2_equip_boiler_scheduling ebs ON ebs.id = aco.scheduling_id AND ebs.deleted = 0
+            LEFT JOIN pressure2_pipe_appointment_confirm_order_item paci ON paci.order_id = aco.id AND paci.deleted = 0
+            LEFT JOIN pressure2_pipe_appointment_confirm_order_item_detail pacid ON pacid.order_id = aco.id AND pacid.deleted = 0
+            LEFT JOIN pressure2_equip_pipe ep ON ep.id = paci.equip_id AND ep.deleted = 0
+            LEFT JOIN pressure2_equip_pipe_detail epd ON epd.id = pacid.equip_id AND epd.deleted = 0
+            LEFT JOIN pressure2_equip_pipe_scheduling eps ON eps.id = aco.scheduling_id AND eps.deleted = 0
+            <where>
+                aco.deleted = 0
+                <if test="reqVO.unitCode != null and reqVO.unitCode != ''">AND aco.unit_code = #{reqVO.unitCode}</if>
+                <if test="reqVO.unitName != null and reqVO.unitName != ''">AND aco.unit_name LIKE CONCAT('%', #{reqVO.unitName}, '%')</if>
+                <if test="reqVO.unitAddress != null and reqVO.unitAddress != ''">AND aco.unit_address LIKE CONCAT('%', #{reqVO.unitAddress}, '%')</if>
+                <if test="reqVO.appointmentNo != null and reqVO.appointmentNo != ''">AND aco.appointment_no LIKE CONCAT('%', #{reqVO.appointmentNo}, '%')</if>
+                <if test="reqVO.checkType != null">AND aco.check_type = #{reqVO.checkType}</if>
+                <if test="reqVO.equipType != null">AND aco.equip_type = #{reqVO.equipType}</if>
+                <if test="reqVO.equipStreet != null">AND aco.equip_street = #{reqVO.equipStreet}</if>
+                <if test="reqVO.equipDistrict != null">AND aco.equip_district = #{reqVO.equipDistrict}</if>
+                <if test="reqVO.appointmentDate != null and reqVO.appointmentDate.length >= 2">
+                    AND aco.appointment_date BETWEEN #{reqVO.appointmentDate[0]} AND #{reqVO.appointmentDate[1]}
+                </if>
+                <if test="reqVO.warningDay != null and reqVO.warningDay.length >= 2">
+                    AND (CASE WHEN aco.appointment_date - aco.warning_date > 0 THEN aco.appointment_date - aco.warning_date ELSE 0 END) BETWEEN #{reqVO.warningDay[0]} AND #{reqVO.warningDay[1]}
+                </if>
+                <if test="reqVO.unitContact != null and reqVO.unitContact != ''">AND aco.unit_contact = #{reqVO.unitContact}</if>
+                <if test="reqVO.unitPhone != null and reqVO.unitPhone != ''">AND aco.unit_phone = #{reqVO.unitPhone}</if>
+                <if test="reqVO.createTime != null and reqVO.createTime.length >= 2">
+                    AND aco.create_time BETWEEN #{reqVO.createTime[0]} AND #{reqVO.createTime[1]}
+                </if>
+                <if test="reqVO.mobile != null and reqVO.mobile != ''">AND aco.mobile = #{reqVO.mobile}</if>
+                <if test="reqVO.zipCode != null and reqVO.zipCode != ''">AND aco.zip_code = #{reqVO.zipCode}</if>
+                <if test="reqVO.remark != null and reqVO.remark != ''">AND aco.remark = #{reqVO.remark}</if>
+                <if test="reqVO.email != null and reqVO.email != ''">AND aco.email = #{reqVO.email}</if>
+                <if test="reqVO.deptId != null and reqVO.deptId != ''">AND aco.dept_id = #{reqVO.deptId}</if>
+                <if test="reqVO.operator != null and reqVO.operator != ''">AND aco.operator = #{reqVO.operator}</if>
+                <if test="reqVO.isAttach != null">AND aco.is_attach = #{reqVO.isAttach}</if>
+                <if test="reqVO.sendType != null">AND aco.send_type = #{reqVO.sendType}</if>
+                <if test="reqVO.vehicle != null">AND aco.vehicle = #{reqVO.vehicle}</if>
+                <if test="reqVO.feeType != null">AND aco.fee_type = #{reqVO.feeType}</if>
+                <if test="reqVO.acceptType != null">AND aco.accept_type = #{reqVO.acceptType}</if>
+                <if test="reqVO.actualAmount != null">AND aco.actual_amount = #{reqVO.actualAmount}</if>
+                <if test="reqVO.serviceAmount != null">AND aco.service_amount = #{reqVO.serviceAmount}</if>
+                <if test="reqVO.shouldAmount != null">AND aco.should_amount = #{reqVO.shouldAmount}</if>
+                <if test="reqVO.reduceFee != null">AND aco.reduce_fee = #{reqVO.reduceFee}</if>
+                <if test="reqVO.equipMainType != null">AND aco.equip_main_type = #{reqVO.equipMainType}</if>
+                <if test="reqVO.useUnitSocialCreditCode != null and reqVO.useUnitSocialCreditCode != ''">AND aco.use_unit_social_credit_code = #{reqVO.useUnitSocialCreditCode}</if>
+                <if test="reqVO.useUnitName != null and reqVO.useUnitName != ''">AND aco.use_unit_name LIKE CONCAT('%', #{reqVO.useUnitName}, '%')</if>
+                <if test="reqVO.createAcceptOrder != null">AND aco.create_accept_order = #{reqVO.createAcceptOrder}</if>
+                <if test="reqVO.equipCode != null and reqVO.equipCode != ''">
+                    AND (eb.equip_code LIKE CONCAT('%', #{reqVO.equipCode}, '%') OR epd.pipe_reg_code LIKE CONCAT('%', #{reqVO.equipCode}, '%'))
+                </if>
+                <if test="reqVO.contactPhone != null and reqVO.contactPhone != ''">
+                    AND (eb.contact_phone = #{reqVO.contactPhone} OR ep.contact_phone = #{reqVO.contactPhone})
+                </if>
+                <if test="reqVO.status != null and reqVO.status.size() > 0">
+                    AND aco.status IN
+                    <foreach collection="reqVO.status" item="item" open="(" separator="," close=")">#{item}</foreach>
+                </if>
+                <if test="reqVO.notStatus != null">AND aco.status != #{reqVO.notStatus}</if>
+                <if test="reqVO.ids != null and reqVO.ids.size() > 0">
+                    AND aco.id IN
+                    <foreach collection="reqVO.ids" item="item" open="(" separator="," close=")">#{item}</foreach>
+                </if>
+            </where>
+            GROUP BY aco.id
+            <if test="reqVO.equipNum != null">
+                HAVING COUNT(baci.equip_id) = #{reqVO.equipNum}
+            </if>
+        ) cnt
+    </select>
 </mapper>

+ 362 - 0
tz-module-pressure2/tz-module-pressure2-biz/src/main/resources/mapper/equipboiler/EquipBoilerMapper.xml

@@ -326,4 +326,366 @@
     <select id="selectDetailsById">
         select * from PRESSURE2_EQUIP_BOILER where ID = #{id}
     </select>
+
+    <select id="selectPendingInspectionBoilerPage"
+            resultType="cn.start.tz.module.pressure2.controller.admin.planscheduling.vo.EquipBoilerPageRespVO">
+        SELECT
+            eb.id,
+            eb.type,
+            eb.type as equip_type,
+            eb.unit_code,
+            eb.unit_id,
+            eb.unit_name,
+            eb.unit_address,
+            eb.equip_district,
+            eb.equip_street,
+            eb.status,
+            eb.equip_code,
+            eb.equip_name,
+            eb.use_register_no,
+            eb.product_code,
+            eb.contact,
+            eb.contact_phone,
+            eb.related_department as dept_id,
+            eb.use_time as use_date,
+            eb.made_time as make_date,
+            eb.area_type,
+            eb.boiler_address as equip_address,
+            eb.sbpzcode as equip_category,
+            CASE
+                WHEN #{checkType} = 100 THEN eb.next_in_check_date
+                WHEN #{checkType} = 200 THEN eb.next_out_check_date
+                WHEN #{checkType} = 300 THEN eb.next_pressure_check_date
+            END AS next_check_date,
+            eb.next_out_check_date as next_year_check_date,
+            eb.max_continue_evapor as equip_volume,
+            eb.factory_code as product_no,
+            lto.task_order_id,
+            lto.task_status,
+            CASE WHEN lrfi.refuse_id IS NOT NULL THEN 1 ELSE 0 END AS is_refused,
+            COALESCE(lrfi.check_type, 100) AS refuse_type,
+            CASE
+                WHEN lrfi.refuse_id IS NOT NULL THEN
+                    CASE
+                        WHEN lrfi.is_submit = 0 THEN 100
+                        WHEN lrfi.is_submit = 1 AND lrfi.status = 100 THEN 200
+                        WHEN lrfi.is_submit = 1 AND lrfi.status = 200 THEN 300
+                        WHEN lrfi.is_submit = 1 AND lrfi.status = 300 THEN 300
+                        ELSE 100
+                    END
+                ELSE NULL
+            END AS refuse_status,
+            #{checkType} AS check_type,
+            CASE
+                WHEN #{checkType} = 100 THEN '内部检验'
+                WHEN #{checkType} = 200 THEN '外部检验'
+                WHEN #{checkType} = 300 THEN '耐压检验'
+            END AS check_type_str
+        FROM PRESSURE2_EQUIP_BOILER eb
+
+        LEFT JOIN (
+            SELECT
+                toi.equip_id,
+                to1.id AS task_order_id,
+                to1.task_status,
+                ROW_NUMBER() OVER (PARTITION BY toi.equip_id ORDER BY to1.create_time DESC) AS rn
+            FROM PRESSURE2_BOILER_TASK_ORDER_ITEM toi
+            INNER JOIN pressure_task_order to1 ON to1.id = toi.order_id
+            WHERE to1.deleted = 0
+                AND toi.deleted = 0
+                AND to1.check_type = #{checkType}
+        ) lto ON lto.equip_id = eb.id AND lto.rn = 1
+
+        LEFT JOIN (
+            SELECT
+                roi.id AS refuse_id,
+                roi.equip_id,
+                roi.check_type,
+                roi.is_submit,
+                roi.status,
+                roi.report_city_status,
+                ROW_NUMBER() OVER (PARTITION BY roi.equip_id ORDER BY roi.create_time DESC) AS rn
+            FROM PRESSURE2_APPOINTMENT_CONFIRM_ORDER_REFUSE_ITEM roi
+            WHERE roi.deleted = 0
+                AND roi.check_type = #{checkType}
+        ) lrfi ON lrfi.equip_id = eb.id AND lrfi.rn = 1
+
+        <where>
+            eb.deleted = 0
+            AND eb.use_register_no is not null
+            AND eb.use_register_no not in ('未办证', '未领证')
+            AND eb.use_register_no != ''
+
+            <choose>
+                <when test="checkType == 100">
+                    AND (
+                        eb.next_in_check_date BETWEEN #{checkDateStart} AND #{checkDateEnd}
+                        <if test="showNoCheckDate != null and showNoCheckDate">
+                        OR eb.next_in_check_date IS NULL
+                        </if>
+                    )
+                </when>
+                <when test="checkType == 200">
+                    AND (
+                        eb.next_out_check_date BETWEEN #{checkDateStart} AND #{checkDateEnd}
+                        <if test="showNoCheckDate != null and showNoCheckDate">
+                        OR eb.next_out_check_date IS NULL
+                        </if>
+                    )
+                </when>
+                <when test="checkType == 300">
+                    AND (
+                        eb.next_pressure_check_date BETWEEN #{checkDateStart} AND #{checkDateEnd}
+                        <if test="showNoCheckDate != null and showNoCheckDate">
+                        OR eb.next_pressure_check_date IS NULL
+                        </if>
+                    )
+                </when>
+            </choose>
+
+            AND (lto.task_order_id IS NULL OR lto.task_status IN (800, 200))
+            AND NOT (
+                lrfi.refuse_id IS NOT NULL
+                AND lrfi.is_submit = 1
+                AND lrfi.status = 200
+                AND lrfi.report_city_status = 200
+            )
+
+            <if test="ids != null and ids.size() > 0">
+                AND eb.id IN
+                <foreach collection="ids" item="id" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+            <if test="type != null and type != ''">
+                AND eb.type = #{type}
+            </if>
+            <if test="productNo != null and productNo != ''">
+                AND eb.product_code LIKE CONCAT('%', #{productNo}, '%')
+            </if>
+            <if test="contactPhone != null and contactPhone != ''">
+                AND eb.contact_phone LIKE CONCAT('%', #{contactPhone}, '%')
+            </if>
+            <if test="unitCode != null and unitCode != ''">
+                AND eb.unit_code = #{unitCode}
+            </if>
+            <if test="unitId != null and unitId != ''">
+                AND eb.unit_id = #{unitId}
+            </if>
+            <if test="unitName != null and unitName != ''">
+                AND eb.unit_name LIKE CONCAT('%', #{unitName}, '%')
+            </if>
+            <if test="equipDistrict != null">
+                AND eb.equip_district = #{equipDistrict}
+            </if>
+            <if test="equipDistricts != null and equipDistricts.size() > 0">
+                AND eb.equip_district IN
+                <foreach collection="equipDistricts" item="district" open="(" separator="," close=")">
+                    #{district}
+                </foreach>
+            </if>
+            <if test="showNoDistrict == null or !showNoDistrict">
+                AND eb.equip_district IS NOT NULL
+            </if>
+            <if test="equipStreet != null">
+                AND eb.equip_street = #{equipStreet}
+            </if>
+            <if test="status != null and status != ''">
+                AND eb.status = #{status}
+            </if>
+            <if test="statusList != null and statusList.size() > 0">
+                AND eb.status IN
+                <foreach collection="statusList" item="listItem" open="(" separator="," close=")">
+                    #{listItem}
+                </foreach>
+            </if>
+            <if test="equipCode != null and equipCode != ''">
+                AND eb.equip_code LIKE CONCAT('%', #{equipCode}, '%')
+            </if>
+            <if test="equipType != null and equipType != ''">
+                AND eb.type = #{equipType}
+            </if>
+            <if test="equipTypeList != null and equipTypeList.size() > 0">
+                AND eb.type IN
+                <foreach collection="equipTypeList" item="listItem" open="(" separator="," close=")">
+                    #{listItem}
+                </foreach>
+            </if>
+            <if test="useRegisterNo != null and useRegisterNo != ''">
+                AND eb.use_register_no LIKE CONCAT('%', #{useRegisterNo}, '%')
+            </if>
+            <if test="deptId != null and deptId != ''">
+                AND eb.related_department = #{deptId}
+            </if>
+
+            <if test="isRefused != null">
+                <choose>
+                    <when test="isRefused">
+                        AND lrfi.refuse_id IS NOT NULL
+                    </when>
+                    <otherwise>
+                        AND lrfi.refuse_id IS NULL
+                    </otherwise>
+                </choose>
+            </if>
+        </where>
+        ORDER BY
+        CASE #{checkType}
+            WHEN 100 THEN eb.next_in_check_date
+            WHEN 200 THEN eb.next_out_check_date
+            WHEN 300 THEN eb.next_pressure_check_date
+        END ASC NULLS LAST
+        OFFSET ${(pageNo - 1) * pageSize} ROWS FETCH NEXT #{pageSize} ROWS ONLY
+    </select>
+
+    <select id="selectPendingInspectionBoilerCount" resultType="java.lang.Long">
+        SELECT COUNT(1)
+        FROM PRESSURE2_EQUIP_BOILER eb
+
+        LEFT JOIN (
+            SELECT
+                toi.equip_id,
+                to1.id AS task_order_id,
+                to1.task_status,
+                ROW_NUMBER() OVER (PARTITION BY toi.equip_id ORDER BY to1.create_time DESC) AS rn
+            FROM PRESSURE2_BOILER_TASK_ORDER_ITEM toi
+            INNER JOIN pressure_task_order to1 ON to1.id = toi.order_id
+            WHERE to1.deleted = 0
+                AND toi.deleted = 0
+                AND to1.check_type = #{checkType}
+        ) lto ON lto.equip_id = eb.id AND lto.rn = 1
+
+        LEFT JOIN (
+            SELECT
+                roi.id AS refuse_id,
+                roi.equip_id,
+                roi.check_type,
+                roi.is_submit,
+                roi.status,
+                roi.report_city_status,
+                ROW_NUMBER() OVER (PARTITION BY roi.equip_id ORDER BY roi.create_time DESC) AS rn
+            FROM PRESSURE2_APPOINTMENT_CONFIRM_ORDER_REFUSE_ITEM roi
+            WHERE roi.deleted = 0
+                AND roi.check_type = #{checkType}
+        ) lrfi ON lrfi.equip_id = eb.id AND lrfi.rn = 1
+
+        <where>
+            eb.deleted = 0
+            AND eb.use_register_no is not null
+            AND eb.use_register_no not in ('未办证', '未领证')
+            AND eb.use_register_no != ''
+
+            <choose>
+                <when test="checkType == 100">
+                    AND (
+                        eb.next_in_check_date BETWEEN #{checkDateStart} AND #{checkDateEnd}
+                        <if test="showNoCheckDate != null and showNoCheckDate">
+                        OR eb.next_in_check_date IS NULL
+                        </if>
+                    )
+                </when>
+                <when test="checkType == 200">
+                    AND (
+                        eb.next_out_check_date BETWEEN #{checkDateStart} AND #{checkDateEnd}
+                        <if test="showNoCheckDate != null and showNoCheckDate">
+                        OR eb.next_out_check_date IS NULL
+                        </if>
+                    )
+                </when>
+                <when test="checkType == 300">
+                    AND (
+                        eb.next_pressure_check_date BETWEEN #{checkDateStart} AND #{checkDateEnd}
+                        <if test="showNoCheckDate != null and showNoCheckDate">
+                        OR eb.next_pressure_check_date IS NULL
+                        </if>
+                    )
+                </when>
+            </choose>
+
+            AND (lto.task_order_id IS NULL OR lto.task_status IN (800, 200))
+            AND NOT (
+                lrfi.refuse_id IS NOT NULL
+                AND lrfi.is_submit = 1
+                AND lrfi.status = 200
+                AND lrfi.report_city_status = 200
+            )
+
+            <if test="ids != null and ids.size() > 0">
+                AND eb.id IN
+                <foreach collection="ids" item="id" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+            <if test="type != null and type != ''">
+                AND eb.type = #{type}
+            </if>
+            <if test="productNo != null and productNo != ''">
+                AND eb.product_code LIKE CONCAT('%', #{productNo}, '%')
+            </if>
+            <if test="contactPhone != null and contactPhone != ''">
+                AND eb.contact_phone LIKE CONCAT('%', #{contactPhone}, '%')
+            </if>
+            <if test="unitCode != null and unitCode != ''">
+                AND eb.unit_code = #{unitCode}
+            </if>
+            <if test="unitId != null and unitId != ''">
+                AND eb.unit_id = #{unitId}
+            </if>
+            <if test="unitName != null and unitName != ''">
+                AND eb.unit_name LIKE CONCAT('%', #{unitName}, '%')
+            </if>
+            <if test="equipDistrict != null">
+                AND eb.equip_district = #{equipDistrict}
+            </if>
+            <if test="equipDistricts != null and equipDistricts.size() > 0">
+                AND eb.equip_district IN
+                <foreach collection="equipDistricts" item="district" open="(" separator="," close=")">
+                    #{district}
+                </foreach>
+            </if>
+            <if test="showNoDistrict == null or !showNoDistrict">
+                AND eb.equip_district IS NOT NULL
+            </if>
+            <if test="equipStreet != null">
+                AND eb.equip_street = #{equipStreet}
+            </if>
+            <if test="status != null and status != ''">
+                AND eb.status = #{status}
+            </if>
+            <if test="statusList != null and statusList.size() > 0">
+                AND eb.status IN
+                <foreach collection="statusList" item="listItem" open="(" separator="," close=")">
+                    #{listItem}
+                </foreach>
+            </if>
+            <if test="equipCode != null and equipCode != ''">
+                AND eb.equip_code LIKE CONCAT('%', #{equipCode}, '%')
+            </if>
+            <if test="equipType != null and equipType != ''">
+                AND eb.type = #{equipType}
+            </if>
+            <if test="equipTypeList != null and equipTypeList.size() > 0">
+                AND eb.type IN
+                <foreach collection="equipTypeList" item="listItem" open="(" separator="," close=")">
+                    #{listItem}
+                </foreach>
+            </if>
+            <if test="useRegisterNo != null and useRegisterNo != ''">
+                AND eb.use_register_no LIKE CONCAT('%', #{useRegisterNo}, '%')
+            </if>
+            <if test="deptId != null and deptId != ''">
+                AND eb.related_department = #{deptId}
+            </if>
+            <if test="isRefused != null">
+                <choose>
+                    <when test="isRefused">
+                        AND lrfi.refuse_id IS NOT NULL
+                    </when>
+                    <otherwise>
+                        AND lrfi.refuse_id IS NULL
+                    </otherwise>
+                </choose>
+            </if>
+        </where>
+    </select>
 </mapper>

+ 373 - 0
tz-module-pressure2/tz-module-pressure2-biz/src/main/resources/mapper/equippipe/EquipPipeMapper.xml

@@ -312,4 +312,377 @@
         </where>
         ) a
     </select>
+
+    <select id="selectPendingInspectionPipePage"
+            resultType="cn.start.tz.module.pressure2.controller.admin.planscheduling.vo.EquipPipePageRespVO">
+        SELECT
+            ep.id,
+            ep.unit_code,
+            ep.unit_id,
+            ep.unit_name,
+            ep.unit_address,
+            ep.equip_district,
+            ep.equip_street,
+            ep.use_status as status,
+            ep.project_no as equip_code,
+            ep.project_name as equip_name,
+            ep.certificate_no as use_register_no,
+            ep.contact,
+            ep.contact_phone,
+            ep.relation_dept as dept_id,
+            ep.use_date,
+            ep.pipe_address as equip_address,
+            ep.pipe_category as equip_type,
+            ep.next_legal_check_date as next_check_date,
+            ep.next_year_check_date as next_year_check_date,
+            ep.pipe_length_total as equip_volume,
+
+            lto.task_order_id,
+            lto.task_status,
+            CASE WHEN lrfi.refuse_id IS NOT NULL OR lyrfi.refuse_id IS NOT NULL THEN 1 ELSE 0 END AS is_refused,
+            COALESCE(lrfi.check_type, lyrfi.check_type, 100) AS refuse_type,
+            CASE
+                WHEN lrfi.refuse_id IS NOT NULL THEN
+                    CASE
+                        WHEN lrfi.is_submit = 0 THEN 100
+                        WHEN lrfi.is_submit = 1 AND lrfi.status = 100 THEN 200
+                        WHEN lrfi.is_submit = 1 AND lrfi.status = 200 THEN 300
+                        WHEN lrfi.is_submit = 1 AND lrfi.status = 300 THEN 300
+                        ELSE 100
+                    END
+                WHEN lyrfi.refuse_id IS NOT NULL THEN
+                    CASE
+                        WHEN lyrfi.report_city_status = 100 THEN 100
+                        WHEN lyrfi.report_city_status = 200 AND lyrfi.status = 200 THEN 300
+                        ELSE 100
+                    END
+                ELSE NULL
+            END AS refuse_status,
+            #{checkType} AS check_type,
+            CASE
+                WHEN #{checkType} = 100 THEN '定期检验'
+                WHEN #{checkType} = 200 THEN '年度检查'
+            END AS check_type_str
+        FROM PRESSURE2_EQUIP_PIPE ep
+
+        LEFT JOIN (
+            SELECT
+                toi.equip_id,
+                to1.id AS task_order_id,
+                to1.task_status,
+                ROW_NUMBER() OVER (PARTITION BY toi.equip_id ORDER BY to1.create_time DESC) AS rn
+            FROM PRESSURE2_PIPE_TASK_ORDER_ITEM toi
+            INNER JOIN pressure_task_order to1 ON to1.id = toi.order_id
+            WHERE to1.deleted = 0
+                AND toi.deleted = 0
+                AND to1.check_type = #{checkType}
+        ) lto ON lto.equip_id = ep.id AND lto.rn = 1
+
+        LEFT JOIN (
+            SELECT
+                roi.id AS refuse_id,
+                roi.equip_id,
+                roi.check_type,
+                roi.is_submit,
+                roi.status,
+                roi.report_city_status,
+                ROW_NUMBER() OVER (PARTITION BY roi.equip_id ORDER BY roi.create_time DESC) AS rn
+            FROM PRESSURE2_APPOINTMENT_CONFIRM_ORDER_REFUSE_ITEM roi
+            WHERE roi.deleted = 0
+                AND roi.check_type = #{checkType}
+        ) lrfi ON lrfi.equip_id = ep.id AND lrfi.rn = 1
+
+        LEFT JOIN (
+            SELECT
+                ryi.id AS refuse_id,
+                ryi.equip_id,
+                200 AS check_type,
+                ryi.report_city_status,
+                ryi.status,
+                ROW_NUMBER() OVER (PARTITION BY ryi.equip_id ORDER BY ryi.create_time DESC) AS rn
+            FROM PRESSURE2_APPOINTMENT_CONFIRM_REFUSE_YEAR_ITEM ryi
+            WHERE ryi.deleted = 0
+        ) lyrfi ON lyrfi.equip_id = ep.id AND lyrfi.rn = 1
+
+        <where>
+            ep.deleted = 0
+            AND ep.is_effective != '否'
+
+            <choose>
+                <when test="checkType == 100">
+                    AND (
+                        ep.next_legal_check_date BETWEEN #{checkDateStart} AND #{checkDateEnd}
+                        <if test="showNoCheckDate != null and showNoCheckDate">
+                        OR ep.next_legal_check_date IS NULL
+                        </if>
+                    )
+                </when>
+                <when test="checkType == 200">
+                    AND (
+                        ep.next_year_check_date BETWEEN #{checkDateStart} AND #{checkDateEnd}
+                        <if test="showNoCheckDate != null and showNoCheckDate">
+                        OR ep.next_year_check_date IS NULL
+                        </if>
+                    )
+                </when>
+            </choose>
+
+            AND (lto.task_order_id IS NULL OR lto.task_status IN (800, 200))
+            AND NOT (
+                lrfi.refuse_id IS NOT NULL
+                AND lrfi.is_submit = 1
+                AND lrfi.status = 200
+                AND lrfi.report_city_status = 200
+                AND lrfi.check_type = #{checkType}
+            )
+            <if test="checkType == 200">
+                AND NOT (
+                    lyrfi.refuse_id IS NOT NULL
+                    AND lyrfi.report_city_status = 200
+                    AND lyrfi.status = 200
+                )
+            </if>
+
+            <if test="ids != null and ids.size() > 0">
+                AND ep.id IN
+                <foreach collection="ids" item="id" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+            <if test="productNo != null and productNo != ''">
+                AND ep.project_no LIKE CONCAT('%', #{productNo}, '%')
+            </if>
+            <if test="contactPhone != null and contactPhone != ''">
+                AND ep.contact_phone LIKE CONCAT('%', #{contactPhone}, '%')
+            </if>
+            <if test="unitCode != null and unitCode != ''">
+                AND ep.unit_code = #{unitCode}
+            </if>
+            <if test="unitId != null and unitId != ''">
+                AND ep.unit_id = #{unitId}
+            </if>
+            <if test="unitName != null and unitName != ''">
+                AND ep.unit_name LIKE CONCAT('%', #{unitName}, '%')
+            </if>
+            <if test="equipDistrict != null">
+                AND ep.equip_district = #{equipDistrict}
+            </if>
+            <if test="equipDistricts != null and equipDistricts.size() > 0">
+                AND ep.equip_district IN
+                <foreach collection="equipDistricts" item="district" open="(" separator="," close=")">
+                    #{district}
+                </foreach>
+            </if>
+            <if test="showNoDistrict == null or !showNoDistrict">
+                AND ep.equip_district IS NOT NULL
+            </if>
+            <if test="equipStreet != null">
+                AND ep.equip_street = #{equipStreet}
+            </if>
+            <if test="status != null and status != ''">
+                AND ep.use_status = #{status}
+            </if>
+            <if test="statusList != null and statusList.size() > 0">
+                AND ep.use_status IN
+                <foreach collection="statusList" item="listItem" open="(" separator="," close=")">
+                    #{listItem}
+                </foreach>
+            </if>
+            <if test="equipCode != null and equipCode != ''">
+                AND ep.project_no LIKE CONCAT('%', #{equipCode}, '%')
+            </if>
+            <if test="equipType != null and equipType != ''">
+                AND ep.pipe_category = #{equipType}
+            </if>
+            <if test="equipTypeList != null and equipTypeList.size() > 0">
+                AND ep.pipe_category IN
+                <foreach collection="equipTypeList" item="listItem" open="(" separator="," close=")">
+                    #{listItem}
+                </foreach>
+            </if>
+            <if test="useRegisterNo != null and useRegisterNo != ''">
+                AND ep.certificate_no LIKE CONCAT('%', #{useRegisterNo}, '%')
+            </if>
+            <if test="deptId != null and deptId != ''">
+                AND ep.relation_dept = #{deptId}
+            </if>
+
+            <if test="isRefused != null">
+                <choose>
+                    <when test="isRefused">
+                        AND (lrfi.refuse_id IS NOT NULL OR lyrfi.refuse_id IS NOT NULL)
+                    </when>
+                    <otherwise>
+                        AND (lrfi.refuse_id IS NULL AND lyrfi.refuse_id IS NULL)
+                    </otherwise>
+                </choose>
+            </if>
+        </where>
+        ORDER BY
+        CASE #{checkType}
+            WHEN 100 THEN ep.next_legal_check_date
+            WHEN 200 THEN ep.next_year_check_date
+        END ASC NULLS LAST
+        OFFSET ${(pageNo - 1) * pageSize} ROWS FETCH NEXT #{pageSize} ROWS ONLY
+    </select>
+
+    <select id="selectPendingInspectionPipeCount" resultType="java.lang.Long">
+        SELECT COUNT(1)
+        FROM PRESSURE2_EQUIP_PIPE ep
+
+        LEFT JOIN (
+            SELECT
+                toi.equip_id,
+                to1.id AS task_order_id,
+                to1.task_status,
+                ROW_NUMBER() OVER (PARTITION BY toi.equip_id ORDER BY to1.create_time DESC) AS rn
+            FROM PRESSURE2_PIPE_TASK_ORDER_ITEM toi
+            INNER JOIN pressure_task_order to1 ON to1.id = toi.order_id
+            WHERE to1.deleted = 0
+                AND toi.deleted = 0
+                AND to1.check_type = #{checkType}
+        ) lto ON lto.equip_id = ep.id AND lto.rn = 1
+
+        LEFT JOIN (
+            SELECT
+                roi.id AS refuse_id,
+                roi.equip_id,
+                roi.check_type,
+                roi.is_submit,
+                roi.status,
+                roi.report_city_status,
+                ROW_NUMBER() OVER (PARTITION BY roi.equip_id ORDER BY roi.create_time DESC) AS rn
+            FROM PRESSURE2_APPOINTMENT_CONFIRM_ORDER_REFUSE_ITEM roi
+            WHERE roi.deleted = 0
+                AND roi.check_type = #{checkType}
+        ) lrfi ON lrfi.equip_id = ep.id AND lrfi.rn = 1
+
+        LEFT JOIN (
+            SELECT
+                ryi.id AS refuse_id,
+                ryi.equip_id,
+                200 AS check_type,
+                ryi.report_city_status,
+                ryi.status,
+                ROW_NUMBER() OVER (PARTITION BY ryi.equip_id ORDER BY ryi.create_time DESC) AS rn
+            FROM PRESSURE2_APPOINTMENT_CONFIRM_REFUSE_YEAR_ITEM ryi
+            WHERE ryi.deleted = 0
+        ) lyrfi ON lyrfi.equip_id = ep.id AND lyrfi.rn = 1
+
+        <where>
+            ep.deleted = 0
+            AND ep.is_effective != '否'
+
+            <choose>
+                <when test="checkType == 100">
+                    AND (
+                        ep.next_legal_check_date BETWEEN #{checkDateStart} AND #{checkDateEnd}
+                        <if test="showNoCheckDate != null and showNoCheckDate">
+                        OR ep.next_legal_check_date IS NULL
+                        </if>
+                    )
+                </when>
+                <when test="checkType == 200">
+                    AND (
+                        ep.next_year_check_date BETWEEN #{checkDateStart} AND #{checkDateEnd}
+                        <if test="showNoCheckDate != null and showNoCheckDate">
+                        OR ep.next_year_check_date IS NULL
+                        </if>
+                    )
+                </when>
+            </choose>
+
+            AND (lto.task_order_id IS NULL OR lto.task_status IN (800, 200))
+            AND NOT (
+                lrfi.refuse_id IS NOT NULL
+                AND lrfi.is_submit = 1
+                AND lrfi.status = 200
+                AND lrfi.report_city_status = 200
+                AND lrfi.check_type = #{checkType}
+            )
+            <if test="checkType == 200">
+                AND NOT (
+                    lyrfi.refuse_id IS NOT NULL
+                    AND lyrfi.report_city_status = 200
+                    AND lyrfi.status = 200
+                )
+            </if>
+
+            <if test="ids != null and ids.size() > 0">
+                AND ep.id IN
+                <foreach collection="ids" item="id" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+            <if test="productNo != null and productNo != ''">
+                AND ep.project_no LIKE CONCAT('%', #{productNo}, '%')
+            </if>
+            <if test="contactPhone != null and contactPhone != ''">
+                AND ep.contact_phone LIKE CONCAT('%', #{contactPhone}, '%')
+            </if>
+            <if test="unitCode != null and unitCode != ''">
+                AND ep.unit_code = #{unitCode}
+            </if>
+            <if test="unitId != null and unitId != ''">
+                AND ep.unit_id = #{unitId}
+            </if>
+            <if test="unitName != null and unitName != ''">
+                AND ep.unit_name LIKE CONCAT('%', #{unitName}, '%')
+            </if>
+            <if test="equipDistrict != null">
+                AND ep.equip_district = #{equipDistrict}
+            </if>
+            <if test="equipDistricts != null and equipDistricts.size() > 0">
+                AND ep.equip_district IN
+                <foreach collection="equipDistricts" item="district" open="(" separator="," close=")">
+                    #{district}
+                </foreach>
+            </if>
+            <if test="showNoDistrict == null or !showNoDistrict">
+                AND ep.equip_district IS NOT NULL
+            </if>
+            <if test="equipStreet != null">
+                AND ep.equip_street = #{equipStreet}
+            </if>
+            <if test="status != null and status != ''">
+                AND ep.use_status = #{status}
+            </if>
+            <if test="statusList != null and statusList.size() > 0">
+                AND ep.use_status IN
+                <foreach collection="statusList" item="listItem" open="(" separator="," close=")">
+                    #{listItem}
+                </foreach>
+            </if>
+            <if test="equipCode != null and equipCode != ''">
+                AND ep.project_no LIKE CONCAT('%', #{equipCode}, '%')
+            </if>
+            <if test="equipType != null and equipType != ''">
+                AND ep.pipe_category = #{equipType}
+            </if>
+            <if test="equipTypeList != null and equipTypeList.size() > 0">
+                AND ep.pipe_category IN
+                <foreach collection="equipTypeList" item="listItem" open="(" separator="," close=")">
+                    #{listItem}
+                </foreach>
+            </if>
+            <if test="useRegisterNo != null and useRegisterNo != ''">
+                AND ep.certificate_no LIKE CONCAT('%', #{useRegisterNo}, '%')
+            </if>
+            <if test="deptId != null and deptId != ''">
+                AND ep.relation_dept = #{deptId}
+            </if>
+
+            <if test="isRefused != null">
+                <choose>
+                    <when test="isRefused">
+                        AND (lrfi.refuse_id IS NOT NULL OR lyrfi.refuse_id IS NOT NULL)
+                    </when>
+                    <otherwise>
+                        AND (lrfi.refuse_id IS NULL AND lyrfi.refuse_id IS NULL)
+                    </otherwise>
+                </choose>
+            </if>
+        </where>
+    </select>
+
 </mapper>