Browse Source

Merge remote-tracking branch 'origin/master'

wanglt 2 weeks ago
parent
commit
c41f9c1e52

+ 12 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/controller/GxtRepairOrderController.java

@@ -506,4 +506,16 @@ public class GxtRepairOrderController extends BaseController
     {
         return toAjax(gxtRepairOrderService.returnGxtRepairOrder(gxtRepairOrder));
     }
+
+    /**
+     * 添加参与人员
+     */
+    @PreAuthorize("@ss.hasPermi('gxt:repairOrder:suspend')")
+    @Log(title = "维修工单", businessType = BusinessType.UPDATE)
+    @PutMapping("/addPerson")
+    @ApiOperation("添加参与人员")
+    public AjaxResult addPerson(@RequestBody GxtRepairOrder gxtRepairOrder)
+    {
+        return toAjax(gxtRepairOrderService.addPerson(gxtRepairOrder));
+    }
 }

+ 10 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/domain/OrderScoreInfo.java

@@ -302,6 +302,8 @@ public class OrderScoreInfo {
     /** 标识当前用户是否在工单人员列表中 */
     private Boolean isCurrentUserInOrder;
 
+    private Integer overStopStatus;
+
     public Integer getOrderType() {
         return orderType;
     }
@@ -1023,4 +1025,12 @@ public class OrderScoreInfo {
     public void setReviewRatingTime(Date reviewRatingTime) {
         this.reviewRatingTime = reviewRatingTime;
     }
+
+    public Integer getOverStopStatus() {
+        return overStopStatus;
+    }
+
+    public void setOverStopStatus(Integer overStopStatus) {
+        this.overStopStatus = overStopStatus;
+    }
 }

+ 171 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/mapper/slave/GxtOrderMapper.java

@@ -0,0 +1,171 @@
+package com.ygtx.gxt.mapper.slave;
+
+import com.ygtx.common.annotation.DataSource;
+import com.ygtx.common.enums.DataSourceType;
+import com.ygtx.gxt.domain.GxtOrderData;
+import com.ygtx.gxt.domain.GxtRepairOrder;
+import com.ygtx.gxt.domain.GxtUserScore;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 维修工单Mapper接口
+ *
+ * @author ouyj
+ * @date 2025-10-30
+ */
+@Mapper
+@DataSource(DataSourceType.SLAVE)
+public interface GxtOrderMapper
+{
+    /**
+     * 查询维修工单
+     *
+     * @param id 维修工单主键
+     * @return 维修工单
+     */
+    public GxtRepairOrder selectGxtRepairOrderById(Long id);
+
+    /**
+     * 查询维修工单列表
+     *
+     * @param gxtRepairOrder 维修工单
+     * @return 维修工单集合
+     */
+    public List<GxtRepairOrder> selectGxtRepairOrderList(GxtRepairOrder gxtRepairOrder);
+
+    public List<GxtRepairOrder> selectGxtRepairOrderListByMonth(GxtRepairOrder gxtRepairOrder);
+
+    /**
+     * 查询用于自动结单的维修工单列表
+     * 查询状态为assigned或to_finish且接单时间、停机时间、恢复运行时间不为空的工单
+     *
+     * @param gxtRepairOrder 维修工单
+     * @return 维修工单集合
+     */
+    public List<GxtRepairOrder> selectGxtRepairOrderListForAutoFinalize(GxtRepairOrder gxtRepairOrder);
+
+    /**
+     * 新增维修工单
+     *
+     * @param gxtRepairOrder 维修工单
+     * @return 结果
+     */
+    public int insertGxtRepairOrder(GxtRepairOrder gxtRepairOrder);
+
+    /**
+     * 修改维修工单
+     *
+     * @param gxtRepairOrder 维修工单
+     * @return 结果
+     */
+    public int updateGxtRepairOrder(GxtRepairOrder gxtRepairOrder);
+
+    /**
+     * 删除维修工单
+     *
+     * @param id 维修工单主键
+     * @return 结果
+     */
+    public int deleteGxtRepairOrderById(Long id);
+
+    /**
+     * 批量删除维修工单
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteGxtRepairOrderByIds(Long[] ids);
+
+    /**
+     * 根据工单编码查询维修工单
+     *
+     * @param workOrderProjectNo 工单编码
+     * @return 维修工单
+     */
+    public GxtRepairOrder selectGxtRepairOrderByWorkOrderProjectNo(String workOrderProjectNo);
+
+    /**
+     * 查询维修工单列表(无权限过滤)
+     *
+     * @param gxtRepairOrder 维修工单
+     * @return 维修工单集合
+     */
+    public List<GxtRepairOrder> selectGxtRepairOrderListNoPermi(GxtRepairOrder gxtRepairOrder);
+
+    /**
+     * 根据ID查询维修工单及人员信息
+     *
+     * @param id 维修工单主键
+     * @return 维修工单
+     */
+    public GxtRepairOrder selectRepairOrderWithPersonById(Long id);
+
+    public GxtOrderData selectHomePageData(@Param("userId") Long userId,@Param("monthPeriod") String monthPeriod);
+
+    public GxtOrderData selectGSTJ(@Param("userId") Long userId,@Param("monthPeriod") String monthPeriod);
+
+    public List<GxtUserScore> selectHomePageRank(GxtUserScore gxtUserScore);
+    
+    /**
+     * 查询设备最近的维修工单
+     *
+     * @return 维修工单集合
+     */
+    public List<GxtRepairOrder> selectLatestGxtRepairOrderByDeviceId(@Param("pcsDeviceId") Long pcsDeviceId, @Param("limit") Integer limit);
+
+    public List<GxtRepairOrder> selectGxtRepairOrderByDeviceIdWithCondition(@Param("pcsDeviceId") Long pcsDeviceId,
+        @Param("workOrderStatus") String workOrderStatus,
+        @Param("excludeStatus") boolean excludeStatus,
+        @Param("orderByField") String orderByField,
+        @Param("limit") Integer limit,
+        @Param("excludeRepairMethod2") Boolean excludeRepairMethod2);
+
+    /**
+     * 查询需要扣分的维修工单列表(已完成或已归档,复运时间不为空,且未被扣过分的工单)
+     *
+     * @return 维修工单集合
+     */
+    public List<GxtRepairOrder> selectGxtRepairOrderListForDeduction();
+    
+    /**
+     * 查询待结单的维修工单列表(用于扣分处理)
+     * 判定条件:当前存在状态为"待结单"的维修工单
+     *
+     * @return 待结单维修工单集合
+     */
+    public List<GxtRepairOrder> selectPendingRepairOrdersForDeduction();
+    
+
+    
+    /**
+     * 查询指定时间之后的有效维修工单(用于奖励计算)
+     * 
+     * @param equipmentId 设备ID
+     * @param lastBreakTime 最近中断时间
+     * @return 有效维修工单集合
+     */
+    public List<GxtRepairOrder> selectValidRepairOrdersAfterBreak(@Param("equipmentId") Long equipmentId, @Param("lastBreakTime") java.util.Date lastBreakTime);
+    
+    /**
+     * 按occurTime倒序查询满足处理方式条件的维修工单
+     * 条件:处理方式为正常维修"1"或复位启机"2"且人工复位"1",且occurTime不为空
+     * 
+     * @param equipmentId 设备ID
+     * @return 满足条件的维修工单集合
+     */
+    public List<GxtRepairOrder> selectRepairOrdersByOccurTime(@Param("equipmentId") Long equipmentId);
+    
+    /**
+     * 按restartTime倒序查询满足处理方式条件的维修工单
+     * 条件:处理方式为正常维修"1"或复位启机"2"且人工复位"1",且restartTime不为空
+     * 
+     * @param equipmentId 设备ID
+     * @return 满足条件的维修工单集合
+     */
+    public List<GxtRepairOrder> selectRepairOrdersByRestartTime(@Param("equipmentId") Long equipmentId);
+    
+
+}

+ 7 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/service/IGxtRepairOrderService.java

@@ -313,4 +313,11 @@ public interface IGxtRepairOrderService
     public void completePendingOrderDeductionData(GxtRepairOrder repairOrder);
 
     public List<GxtUserScore> getCompanyRankingList();
+
+    /**
+     * 添加维修工单人员
+     * @param gxtRepairOrder
+     * @return
+     */
+    public int addPerson(GxtRepairOrder gxtRepairOrder);
 }

+ 51 - 1
ygtx-gxt/src/main/java/com/ygtx/gxt/service/impl/GxtRepairOrderServiceImpl.java

@@ -1015,7 +1015,6 @@ public class GxtRepairOrderServiceImpl implements IGxtRepairOrderService
                     GxtRepairOrderPerson person = new GxtRepairOrderPerson();
                     person.setUserId(sysUser.getUserId());
                     person.setIsLeader(1);
-                    person.setUserId(sysUser.getUserId());
                     person.setUserName(sysUser.getUserName());
                     person.setNickName(sysUser.getNickName());
                     person.setOrderId(gxtRepairOrder.getId());
@@ -2833,6 +2832,57 @@ public class GxtRepairOrderServiceImpl implements IGxtRepairOrderService
         }
     }
 
+    @Override
+    @Transactional
+    public int addPerson(GxtRepairOrder gxtRepairOrder) {
+//        GxtRepairOrder oldOrder = gxtRepairOrderMapper.selectGxtRepairOrderById(gxtRepairOrder.getId());
+        gxtRepairOrder.setOverStopStatus(2);
+        int result = gxtRepairOrderMapper.updateGxtRepairOrder(gxtRepairOrder);
+        if (result > 0) {
+            // 删除旧的工作成员
+            gxtRepairOrderPersonMapper.deleteGxtRepairOrderPersonByOrderId(gxtRepairOrder.getId());
+            // 修改工作负责人
+            if(StringUtils.isNotEmpty(gxtRepairOrder.getTeamLeaderName())){
+                GxtRepairOrderPerson person = new GxtRepairOrderPerson();
+                person.setIsLeader(1);
+                person.setUserId(gxtRepairOrder.getTeamLeaderId());
+                person.setNickName(gxtRepairOrder.getTeamLeaderName());
+                person.setOrderId(gxtRepairOrder.getId());
+                person.setOrderCode(gxtRepairOrder.getWorkOrderProjectNo());
+                person.setStatus(1);
+                person.setCreateBy(SecurityUtils.getUsername());
+                person.setCreateTime(DateUtils.getNowDate());
+                gxtRepairOrderPersonMapper.insertGxtRepairOrderPerson(person);
+
+            }
+            // 添加新工作成员
+            if(gxtRepairOrder.getRepairOrderPersonList() != null && !gxtRepairOrder.getRepairOrderPersonList().isEmpty()){
+                for (GxtRepairOrderPerson person : gxtRepairOrder.getRepairOrderPersonList())
+                {
+                    SysUser sysUser = new SysUser();
+                    sysUser.setUserName(person.getUserName());
+                    sysUser.setNickName(person.getNickName());
+                    List<SysUser> sysUserList = sysUserService.selectUserListNoDataScope(sysUser);
+                    if (sysUserList.size() > 0) {
+                        sysUser = sysUserList.get(0);
+                    } else {
+                        throw new ServiceException("工作班成员'" + person.getNickName() + "'在系统中不存在,请检查");
+                    }
+                    person.setUserId(sysUser.getUserId());
+                    person.setOrderId(gxtRepairOrder.getId());
+                    person.setOrderCode(gxtRepairOrder.getWorkOrderProjectNo());
+                    person.setIsLeader(0);
+                    person.setStatus(1);
+                    person.setCreateBy(SecurityUtils.getUsername());
+                    person.setCreateTime(DateUtils.getNowDate());
+                    gxtRepairOrderPersonMapper.insertGxtRepairOrderPerson(person);
+                }
+            }
+        }
+
+        return result;
+    }
+
     public void completePendingOrderDeductionDataV0(GxtRepairOrder repairOrder) {
         // 查询当前工单对应的GxtOrderScoreDetail且状态为1的数据(挂起状态)
         GxtOrderScoreDetail queryDetail = new GxtOrderScoreDetail();

+ 5 - 2
ygtx-gxt/src/main/resources/mapper/gxt/GxtOrderMineMapper.xml

@@ -57,6 +57,7 @@
         <result property="createTime"    column="create_time"    />
         <result property="updateTime"    column="update_time"    />
         <result property="orderEntryType"    column="order_entry_type"    />
+        <result property="overStopStatus"    column="over_stop_status"    />
     </resultMap>
 
     <select id="selectUnionOrderList" resultMap="OrderScoreInfoResult">
@@ -111,7 +112,8 @@
                 final_coefficient as final_coefficient,
                 create_time as create_time,
                 update_time as update_time,
-                null as order_entry_type
+                null as order_entry_type,
+                over_stop_status as over_stop_status
             FROM gxt_repair_order t
             <where>
                 <if test="repairOrder.params.keyword != null and repairOrder.params.keyword != ''">
@@ -201,7 +203,8 @@
                 final_coefficient as final_coefficient,
                 create_time as create_time,
                 update_time as update_time,
-                order_entry_type as order_entry_type
+                order_entry_type as order_entry_type,
+                null as over_stop_status
             FROM gxt_work_order t
             <where>
                 <if test="workOrder.params.keyword != null and workOrder.params.keyword != ''">

+ 1109 - 0
ygtx-gxt/src/main/resources/mapper/gxt/slave/GxtOrderMapper.xml

@@ -0,0 +1,1109 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ygtx.gxt.mapper.slave.GxtOrderMapper">
+    
+    <resultMap type="GxtRepairOrder" id="GxtRepairOrderResult">
+        <result property="id"    column="id"    />
+        <result property="workOrderProjectNo"    column="work_order_project_no"    />
+        <result property="workOrderStatus"    column="work_order_status"    />
+        <result property="gxtCenterId"    column="gxt_center_id"    />
+        <result property="gxtCenter"    column="gxt_center"    />
+        <result property="pcsStationId"    column="pcs_station_id"    />
+        <result property="pcsStationName"    column="pcs_station_name"    />
+        <result property="pcsDeviceId"    column="pcs_device_id"    />
+        <result property="pcsDeviceName"    column="pcs_device_name"    />
+        <result property="brand"    column="brand"    />
+        <result property="model"    column="model"    />
+        <result property="faultCode"    column="fault_code"    />
+        <result property="faultDesc"    column="fault_desc"    />
+        <result property="assignTime"    column="assign_time"    />
+        <result property="assignUserId"    column="assign_user_id"    />
+        <result property="assignUserName"    column="assign_user_name"    />
+        <result property="acceptTime"    column="accept_time"    />
+        <result property="acceptUserId"    column="accept_user_id"    />
+        <result property="acceptUserName"    column="accept_user_name"    />
+        <result property="realStartTime"    column="real_start_time"    />
+        <result property="realEndTime"    column="real_end_time"    />
+        <result property="teamLeaderId"    column="team_leader_id"    />
+        <result property="teamLeaderName"    column="team_leader_name"    />
+        <result property="workGroupMemberId"    column="work_group_member_id"    />
+        <result property="workGroupMemberName"    column="work_group_member_name"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+        <result property="content"    column="content"    />
+        <result property="planHour"    column="plan_hour"    />
+        <result property="priorityType"    column="priority_type"    />
+        <result property="score"    column="score"    />
+        <result property="reviewContent"    column="review_content"    />
+        <result property="maintenanceType"    column="maintenance_type"    />
+        <result property="occurTime"    column="occur_time"    />
+        <result property="faultBarcode"    column="fault_barcode"    />
+        <result property="suspendReason"    column="suspend_reason"    />
+        <result property="suspendDescription"    column="suspend_description"    />
+        <result property="approvalStatus"    column="approval_status"    />
+        <result property="rejectionReason"    column="rejection_reason"    />
+        <result property="modifyReason"    column="modify_reason"    />
+        <result property="finalizationRemark"    column="finalization_remark"    />
+        <result property="relatedOrderCode"    column="related_order_code"    />
+        <result property="relatedOrderContent"    column="related_order_content"    />
+        <result property="misOrderNo"    column="mis_order_no"    />
+        <result property="restartTime"    column="restart_time"    />
+        <result property="scoringStatus"    column="scoring_status"    />
+        <result property="pcsStationPid"    column="pcs_station_pid"    />
+        <result property="attachmentUrls"    column="attachment_urls"    />
+        <result property="reviewScoreNum"    column="review_score_num"    />
+        <result property="finalCoefficient"    column="final_coefficient"    />
+        <result property="orderType"    column="order_type"    />
+        <result property="orderEntryType"    column="order_entry_type"    />
+        <result property="repairMethod"    column="repair_method"    />
+        <result property="resetMethod"    column="reset_method"    />
+        <result property="invalidReason"    column="invalid_reason"    />
+        <result property="returnType"    column="return_type"    />
+        <result property="returnReason"    column="return_reason"    />
+        <result property="feedbackReason"    column="feedback_reason"    />
+        <result property="confirmStatus"    column="confirm_status"    />
+        <result property="wwryNum"    column="wwry_num"    />
+        <result property="wlryNum"    column="wlry_num"    />
+        <result property="workArea"    column="work_area"    />
+        <result property="infoEntry"    column="info_entry"    />
+        <result property="realFailureReason"    column="real_failure_reason"    />
+        <result property="lostPower"    column="lost_power"    />
+        <result property="workPermitNum"    column="work_permit_num"    />
+        <result property="finalizeMethod"    column="finalize_method"    />
+        <result property="appealUserName"    column="appeal_user_name"    />
+        <result property="appealUserId"    column="appeal_user_id"    />
+        <result property="appealTime"    column="appeal_time"    />
+        <result property="appealReason"    column="appeal_reason"    />
+        <result property="suspendExplain"    column="suspend_explain"    />
+        <result property="orderAttachment"    column="order_attachment"    />
+        <result property="extraWork"    column="extra_work"    />
+        <result property="acceptReturnType"    column="accept_return_type"    />
+        <result property="acceptReturnReason"    column="accept_return_reason"    />
+        <result property="scoreReturnReason"    column="score_return_reason"    />
+        <result property="overStopStatus"    column="over_stop_status"    />
+        <result property="leader"    column="leader"    />
+        <result property="userId"    column="user_id" />
+    </resultMap>
+
+    <resultMap type="GxtRepairOrder" id="GxtRepairOrderWithPersonResult" extends="GxtRepairOrderResult">
+        <collection property="repairOrderPersonList" ofType="com.ygtx.gxt.domain.GxtRepairOrderPerson">
+            <result property="id" column="person_id"/>
+            <result property="userId" column="person_user_id"/>
+            <result property="nickName" column="person_nick_name"/>
+            <result property="orderId" column="person_order_id"/>
+            <result property="orderCode" column="person_order_code"/>
+            <result property="status" column="person_status"/>
+            <result property="selfScore" column="person_self_score"/>
+            <result property="reviewScore" column="person_review_score"/>
+            <result property="finalScore" column="person_final_score"/>
+            <result property="isLeader" column="person_is_leader"/>
+            <result property="extraScore" column="person_extra_score"/>
+            <result property="totalScore" column="person_total_score"/>
+        </collection>
+    </resultMap>
+
+    <resultMap type="GxtOrderData" id="GxtOrderDataResult">
+        <result property="userId"    column="user_id" />
+        <result property="workOrderNum"    column="workOrderNum" />
+        <result property="workOrderNumLast"    column="workOrderNumLast" />
+        <result property="repairOrderNum"    column="repairOrderNum" />
+        <result property="repairRestartOrderNum"    column="repairRestartOrderNum" />
+        <result property="repairOrderNumLast"    column="repairOrderNumLast" />
+        <result property="wxgs"    column="wxgs" />
+        <result property="wxgsLast"    column="wxgs_last" />
+        <result property="wbgs"    column="wbgs" />
+        <result property="wbgsLast"    column="wbgs_last" />
+        <result property="score"    column="score" />
+        <result property="scoreLast"    column="score_last" />
+        <result property="pcsWorkOrderNum"    column="pcsWorkOrderNum" />
+        <result property="centerWorkOrderNum"    column="centerWorkOrderNum" />
+        <result property="companyWorkOrderNum"    column="companyWorkOrderNum" />
+        <result property="pcsRepairOrderNum"    column="pcsRepairOrderNum" />
+        <result property="pcsRepairRestartOrderNum"    column="pcsRepairRestartOrderNum" />
+        <result property="centerRepairOrderNum"    column="centerRepairOrderNum" />
+        <result property="centerRepairRestartOrderNum"    column="centerRepairRestartOrderNum" />
+        <result property="companyRepairOrderNum"    column="companyRepairOrderNum" />
+        <result property="companyRepairRestartOrderNum"    column="companyRepairRestartOrderNum" />
+    </resultMap>
+
+    <resultMap type="GxtUserScore" id="GxtUserScoreResult">
+        <result property="monthPeriod" column="month_period"/>
+        <result property="userId" column="user_id"/>
+        <result property="userName" column="user_name"/>
+        <result property="nickName" column="nick_name"/>
+        <result property="deptId" column="dept_id"/>
+        <result property="deptName" column="dept_name"/>
+        <result property="finalScore" column="final_score"/>
+        <result property="centerId" column="center_id"/>
+        <result property="center" column="center"/>
+        <result property="companyName" column="companyName"/>
+        <result property="permission" column="permission"/>
+    </resultMap>
+
+    <sql id="selectGxtRepairOrderVo">
+        select id, work_order_project_no, work_order_status, gxt_center_id, gxt_center, pcs_station_id, pcs_station_name, pcs_device_id,
+               pcs_device_name, brand, model, fault_code, fault_desc, assign_time, assign_user_id, assign_user_name, accept_time,
+               accept_user_id, accept_user_name, real_start_time, real_end_time, team_leader_id, team_leader_name, work_group_member_id,
+               work_group_member_name, t.create_by, t.create_time, t.update_by, t.update_time, t.remark, content, plan_hour, priority_type, score,
+               review_content, maintenance_type, occur_time, fault_barcode, suspend_reason, suspend_description, approval_status,
+               rejection_reason, modify_reason, finalization_remark, related_order_code, related_order_content, mis_order_no, restart_time,
+               scoring_status, pcs_station_pid, attachment_urls, review_score_num, final_coefficient, order_type, repair_method, reset_method, invalid_reason, return_type, return_reason, feedback_reason, confirm_status,
+                wwry_num, wlry_num, work_area, info_entry, real_failure_reason, lost_power, work_permit_num, finalize_method, appeal_user_name, appeal_user_id, appeal_time, appeal_reason, suspend_explain, order_entry_type, order_attachment, extra_work, accept_return_type, accept_return_reason, score_return_reason, over_stop_status
+        from gxt_repair_order t
+        left join sys_user u on u.user_name = t.create_by
+        left join sys_dept d on u.dept_id = d.dept_id
+    </sql>
+
+    <select id="selectGxtRepairOrderList" parameterType="GxtRepairOrder" resultMap="GxtRepairOrderResult">
+        <include refid="selectGxtRepairOrderVo"/>
+        <where>  
+            <if test="workOrderProjectNo != null  and workOrderProjectNo != ''"> and work_order_project_no like concat('%',  #{workOrderProjectNo}, '%')</if>
+            <if test="workOrderStatus != null  and workOrderStatus != ''"> and work_order_status = #{workOrderStatus}</if>
+            <if test="gxtCenterId != null "> and gxt_center_id = #{gxtCenterId}</if>
+            <if test="gxtCenter != null  and gxtCenter != ''"> and gxt_center = #{gxtCenter}</if>
+            <if test="pcsStationId != null "> and pcs_station_id = #{pcsStationId}</if>
+            <if test="pcsStationName != null  and pcsStationName != ''"> and pcs_station_name = #{pcsStationName} </if>
+            <if test="pcsDeviceId != null "> and pcs_device_id = #{pcsDeviceId}</if>
+            <if test="pcsDeviceName != null  and pcsDeviceName != ''"> and pcs_device_name like concat('%', #{pcsDeviceName}, '%')</if>
+            <if test="brand != null  and brand != ''"> and brand = #{brand}</if>
+            <if test="model != null  and model != ''"> and model = #{model}</if>
+            <if test="faultCode != null  and faultCode != ''"> and fault_code like concat('%', #{faultCode}, '%')</if>
+            <if test="faultDesc != null  and faultDesc != ''"> and fault_desc = #{faultDesc}</if>
+            <if test="assignTime != null "> and assign_time = #{assignTime}</if>
+            <if test="assignUserId != null "> and assign_user_id = #{assignUserId}</if>
+            <if test="assignUserName != null  and assignUserName != ''"> and assign_user_name like concat('%', #{assignUserName}, '%')</if>
+            <if test="acceptTime != null "> and accept_time = #{acceptTime}</if>
+            <if test="acceptUserId != null "> and accept_user_id = #{acceptUserId}</if>
+            <if test="acceptUserName != null  and acceptUserName != ''"> and accept_user_name like concat('%', #{acceptUserName}, '%')</if>
+            <if test="realStartTime != null "> and real_start_time = #{realStartTime}</if>
+            <if test="realEndTime != null "> and real_end_time = #{realEndTime}</if>
+            <if test="teamLeaderId != null "> and team_leader_id = #{teamLeaderId}</if>
+            <if test="teamLeaderName != null  and teamLeaderName != ''"> and team_leader_name like concat('%', #{teamLeaderName}, '%')</if>
+            <if test="workGroupMemberId != null "> and work_group_member_id = #{workGroupMemberId}</if>
+            <if test="workGroupMemberName != null  and workGroupMemberName != ''"> and work_group_member_name like concat('%', #{workGroupMemberName}, '%')</if>
+            <if test="content != null  and content != ''"> and content = #{content}</if>
+            <if test="planHour != null "> and plan_hour = #{planHour}</if>
+            <if test="priorityType != null "> and priority_type = #{priorityType}</if>
+            <if test="score != null "> and score = #{score}</if>
+            <if test="reviewContent != null  and reviewContent != ''"> and review_content = #{reviewContent}</if>
+            <if test="maintenanceType != null  and maintenanceType != ''"> and maintenance_type = #{maintenanceType}</if>
+            <if test="occurTime != null "> and occur_time = #{occurTime}</if>
+            <if test="faultBarcode != null  and faultBarcode != ''"> and fault_barcode = #{faultBarcode}</if>
+            <if test="suspendReason != null  and suspendReason != ''"> and suspend_reason = #{suspendReason}</if>
+            <if test="suspendDescription != null  and suspendDescription != ''"> and suspend_description = #{suspendDescription}</if>
+            <if test="approvalStatus != null  and approvalStatus != ''"> and approval_status = #{approvalStatus}</if>
+            <if test="rejectionReason != null  and rejectionReason != ''"> and rejection_reason = #{rejectionReason}</if>
+            <if test="modifyReason != null  and modifyReason != ''"> and modify_reason = #{modifyReason}</if>
+            <if test="finalizationRemark != null  and finalizationRemark != ''"> and finalization_remark = #{finalizationRemark}</if>
+            <if test="relatedOrderCode != null  and relatedOrderCode != ''"> and related_order_code = #{relatedOrderCode}</if>
+            <if test="relatedOrderContent != null  and relatedOrderContent != ''"> and related_order_content = #{relatedOrderContent}</if>
+            <if test="misOrderNo != null  and misOrderNo != ''"> and mis_order_no = #{misOrderNo}</if>
+            <if test="restartTime != null "> and restart_time = #{restartTime}</if>
+            <if test="scoringStatus != null "> and scoring_status = #{scoringStatus}</if>
+            <if test="pcsStationPid != null "> and pcs_station_pid = #{pcsStationPid}</if>
+            <if test="attachmentUrls != null  and attachmentUrls != ''"> and attachment_urls = #{attachmentUrls}</if>
+            <if test="reviewScoreNum != null "> and review_score_num = #{reviewScoreNum}</if>
+            <if test="finalCoefficient != null "> and final_coefficient = #{finalCoefficient}</if>
+            <if test="orderType != null "> and order_type = #{orderType}</if>
+            <if test="repairMethod != null  and repairMethod != ''"> and repair_method = #{repairMethod}</if>
+            <if test="resetMethod != null  and resetMethod != ''"> and reset_method = #{resetMethod}</if>
+            <if test="returnType != null  and returnType != ''"> and return_type = #{returnType}</if>
+            <if test="returnReason != null  and returnReason != ''"> and return_reason = #{returnReason}</if>
+            <if test="outTimeParam != null"> and DATE_SUB(NOW(), INTERVAL #{outTimeParam} MINUTE) > t.update_time </if>
+            <if test="wwryNum != null"> and wwry_num = #{wwryNum}</if>
+            <if test="wlryNum != null"> and wlry_num = #{wlryNum}</if>
+            <if test="workArea != null  and workArea != ''"> and work_area = #{workArea}</if>
+            <if test="infoEntry != null  and infoEntry != ''"> and info_entry = #{infoEntry}</if>
+            <if test="realFailureReason != null  and realFailureReason != ''"> and real_failure_reason = #{realFailureReason}</if>
+            <if test="lostPower != null"> and lost_power = #{lostPower}</if>
+            <if test="workPermitNum != null and workPermitNum != ''"> and work_permit_num = #{workPermitNum}</if>
+            <if test="beginOccurTime != null and beginOccurTime != ''"> and date_format(occur_time,'%y%m%d') &gt;= date_format(#{beginOccurTime},'%y%m%d')</if>
+            <if test="endOccurTime != null and endOccurTime != ''"> and date_format(occur_time,'%y%m%d') &lt;= date_format(#{endOccurTime},'%y%m%d')</if>
+
+            <!-- 业务特定数据权限过滤条件 -->
+            <if test="params.businessDataScope != null and params.businessDataScope != ''">
+                ${params.businessDataScope}
+            </if>
+            <!-- 限制待下发工单只能创建人本部门查看 -->
+            <if test="params.currentUser != null and params.currentUser != ''">
+                and ((t.work_order_status != 'to_issue' and t.work_order_status != 'accept_return') or t.create_by in
+                    (select user_name from sys_user t1
+                     left join sys_dept t2 on t1.dept_id = t2.dept_id
+                     where t2.dept_id = (select dept_id from sys_user where user_name = #{params.currentUser,jdbcType=VARCHAR} and del_flag='0')))
+            </if>
+        </where>
+        order by create_time desc
+    </select>
+
+    <select id="selectGxtRepairOrderListByMonth" parameterType="GxtRepairOrder" resultMap="GxtRepairOrderResult">
+        SELECT
+        t.*
+        FROM
+        gxt_repair_order t
+        <if test="userId != null">LEFT JOIN gxt_repair_order_person p ON p.order_id = t.id</if>
+        <where>
+            <if test="userId != null"> and p.user_id=#{userId}</if>
+            <if test="workOrderStatus != null  and workOrderStatus != ''"> and work_order_status IN ('completed','archived')</if>
+            <if test="pcsStationPid != null "> and pcs_station_pid = #{pcsStationPid}</if>
+            <if test="maintenanceType != null and maintenanceType != ''"> and maintenance_type = #{maintenanceType}</if>
+            <if test="monthPeriod != null"> and DATE_FORMAT(occur_time, '%Y-%m') = #{monthPeriod}</if>
+            <if test="params.businessDataScope != null and params.businessDataScope != ''">
+                ${params.businessDataScope}
+            </if>
+        </where>
+        order by t.occur_time desc
+    </select>
+    
+    <select id="selectGxtRepairOrderById" parameterType="Long" resultMap="GxtRepairOrderResult">
+        <include refid="selectGxtRepairOrderVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertGxtRepairOrder" parameterType="GxtRepairOrder" useGeneratedKeys="true" keyProperty="id">
+        insert into gxt_repair_order
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="workOrderProjectNo != null and workOrderProjectNo != ''">work_order_project_no,</if>
+            <if test="workOrderStatus != null">work_order_status,</if>
+            <if test="gxtCenterId != null">gxt_center_id,</if>
+            <if test="gxtCenter != null">gxt_center,</if>
+            <if test="pcsStationId != null">pcs_station_id,</if>
+            <if test="pcsStationName != null">pcs_station_name,</if>
+            <if test="pcsDeviceId != null">pcs_device_id,</if>
+            <if test="pcsDeviceName != null">pcs_device_name,</if>
+            <if test="brand != null">brand,</if>
+            <if test="model != null">model,</if>
+            <if test="faultCode != null">fault_code,</if>
+            <if test="faultDesc != null">fault_desc,</if>
+            <if test="assignTime != null">assign_time,</if>
+            <if test="assignUserId != null">assign_user_id,</if>
+            <if test="assignUserName != null">assign_user_name,</if>
+            <if test="acceptTime != null">accept_time,</if>
+            <if test="acceptUserId != null">accept_user_id,</if>
+            <if test="acceptUserName != null">accept_user_name,</if>
+            <if test="realStartTime != null">real_start_time,</if>
+            <if test="realEndTime != null">real_end_time,</if>
+            <if test="teamLeaderId != null">team_leader_id,</if>
+            <if test="teamLeaderName != null">team_leader_name,</if>
+            <if test="workGroupMemberId != null">work_group_member_id,</if>
+            <if test="workGroupMemberName != null">work_group_member_name,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="remark != null">remark,</if>
+            <if test="content != null">content,</if>
+            <if test="planHour != null">plan_hour,</if>
+            <if test="priorityType != null">priority_type,</if>
+            <if test="score != null">score,</if>
+            <if test="reviewContent != null">review_content,</if>
+            <if test="maintenanceType != null and maintenanceType != ''">maintenance_type,</if>
+            <if test="occurTime != null">occur_time,</if>
+            <if test="faultBarcode != null">fault_barcode,</if>
+            <if test="suspendReason != null">suspend_reason,</if>
+            <if test="suspendDescription != null">suspend_description,</if>
+            <if test="approvalStatus != null">approval_status,</if>
+            <if test="rejectionReason != null">rejection_reason,</if>
+            <if test="modifyReason != null">modify_reason,</if>
+            <if test="finalizationRemark != null">finalization_remark,</if>
+            <if test="relatedOrderCode != null">related_order_code,</if>
+            <if test="relatedOrderContent != null">related_order_content,</if>
+            <if test="misOrderNo != null">mis_order_no,</if>
+            <if test="restartTime != null">restart_time,</if>
+            <if test="scoringStatus != null">scoring_status,</if>
+            <if test="pcsStationPid != null">pcs_station_pid,</if>
+            <if test="attachmentUrls != null and attachmentUrls != ''">attachment_urls,</if>
+            <if test="reviewScoreNum != null">review_score_num,</if>
+            <if test="finalCoefficient != null">final_coefficient,</if>
+            <if test="orderType != null">order_type,</if>
+            <if test="repairMethod != null and repairMethod != ''">repair_method,</if>
+            <if test="resetMethod != null and resetMethod != ''">reset_method,</if>
+            <if test="invalidReason != null and invalidReason != ''">invalid_reason,</if>
+            <if test="returnType != null and returnType != ''">return_type,</if>
+            <if test="returnReason != null and returnReason != ''">return_reason,</if>
+            <if test="feedbackReason != null and feedbackReason != ''">feedback_reason,</if>
+            <if test="confirmStatus != null">confirm_status,</if>
+            <if test="wwryNum != null">wwry_num,</if>
+            <if test="wlryNum != null">wlry_num,</if>
+            <if test="workArea != null and workArea != ''">work_area,</if>
+            <if test="infoEntry != null and infoEntry != ''">info_entry,</if>
+            <if test="realFailureReason != null and realFailureReason != ''">real_failure_reason,</if>
+            <if test="lostPower != null">lost_power,</if>
+            <if test="workPermitNum != null and workPermitNum != ''">work_permit_num,</if>
+            <if test="appealUserName != null and appealUserName != ''">appeal_user_name,</if>
+            <if test="appealUserId != null">appeal_user_id,</if>
+            <if test="appealTime != null">appeal_time,</if>
+            <if test="appealReason != null and appealReason != ''">appeal_reason,</if>
+            <if test="suspendExplain != null and suspendExplain != ''">suspend_explain,</if>
+            <if test="orderEntryType != null and orderEntryType != ''">order_entry_type,</if>
+            <if test="orderAttachment != null and orderAttachment != ''">order_attachment,</if>
+            <if test="extraWork != null and extraWork != ''">extra_work,</if>
+            <if test="acceptReturnType != null and acceptReturnType != ''">accept_return_type,</if>
+            <if test="acceptReturnReason != null and acceptReturnReason != ''">accept_return_reason,</if>
+            <if test="scoreReturnReason != null and scoreReturnReason != ''">score_return_reason,</if>
+            <if test="finalizeMethod != null and finalizeMethod != ''">finalize_method,</if>
+            <if test="overStopStatus != null">over_stop_status,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="workOrderProjectNo != null and workOrderProjectNo != ''">#{workOrderProjectNo},</if>
+            <if test="workOrderStatus != null">#{workOrderStatus},</if>
+            <if test="gxtCenterId != null">#{gxtCenterId},</if>
+            <if test="gxtCenter != null">#{gxtCenter},</if>
+            <if test="pcsStationId != null">#{pcsStationId},</if>
+            <if test="pcsStationName != null">#{pcsStationName},</if>
+            <if test="pcsDeviceId != null">#{pcsDeviceId},</if>
+            <if test="pcsDeviceName != null">#{pcsDeviceName},</if>
+            <if test="brand != null">#{brand},</if>
+            <if test="model != null">#{model},</if>
+            <if test="faultCode != null">#{faultCode},</if>
+            <if test="faultDesc != null">#{faultDesc},</if>
+            <if test="assignTime != null">#{assignTime},</if>
+            <if test="assignUserId != null">#{assignUserId},</if>
+            <if test="assignUserName != null">#{assignUserName},</if>
+            <if test="acceptTime != null">#{acceptTime},</if>
+            <if test="acceptUserId != null">#{acceptUserId},</if>
+            <if test="acceptUserName != null">#{acceptUserName},</if>
+            <if test="realStartTime != null">#{realStartTime},</if>
+            <if test="realEndTime != null">#{realEndTime},</if>
+            <if test="teamLeaderId != null">#{teamLeaderId},</if>
+            <if test="teamLeaderName != null">#{teamLeaderName},</if>
+            <if test="workGroupMemberId != null">#{workGroupMemberId},</if>
+            <if test="workGroupMemberName != null">#{workGroupMemberName},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="remark != null">#{remark},</if>
+            <if test="content != null">#{content},</if>
+            <if test="planHour != null">#{planHour},</if>
+            <if test="priorityType != null">#{priorityType},</if>
+            <if test="score != null">#{score},</if>
+            <if test="reviewContent != null">#{reviewContent},</if>
+            <if test="maintenanceType != null and maintenanceType != ''">#{maintenanceType},</if>
+            <if test="occurTime != null">#{occurTime},</if>
+            <if test="faultBarcode != null">#{faultBarcode},</if>
+            <if test="suspendReason != null">#{suspendReason},</if>
+            <if test="suspendDescription != null">#{suspendDescription},</if>
+            <if test="approvalStatus != null">#{approvalStatus},</if>
+            <if test="rejectionReason != null">#{rejectionReason},</if>
+            <if test="modifyReason != null">#{modifyReason},</if>
+            <if test="finalizationRemark != null">#{finalizationRemark},</if>
+            <if test="relatedOrderCode != null">#{relatedOrderCode},</if>
+            <if test="relatedOrderContent != null">#{relatedOrderContent},</if>
+            <if test="misOrderNo != null">#{misOrderNo},</if>
+            <if test="restartTime != null">#{restartTime},</if>
+            <if test="scoringStatus != null">#{scoringStatus},</if>
+            <if test="pcsStationPid != null">#{pcsStationPid},</if>
+            <if test="attachmentUrls != null and attachmentUrls != ''">#{attachmentUrls},</if>
+            <if test="reviewScoreNum != null">#{reviewScoreNum},</if>
+            <if test="finalCoefficient != null">#{finalCoefficient},</if>
+            <if test="orderType != null">#{orderType},</if>
+            <if test="repairMethod != null and repairMethod != ''">#{repairMethod},</if>
+            <if test="resetMethod != null and resetMethod != ''">#{resetMethod},</if>
+            <if test="invalidReason != null and invalidReason != ''">#{invalidReason},</if>
+            <if test="returnType != null and returnType != ''">#{returnType},</if>
+            <if test="returnReason != null and returnReason != ''">#{returnReason},</if>
+            <if test="feedbackReason != null and feedbackReason != ''">#{feedbackReason},</if>
+            <if test="confirmStatus != null">#{confirmStatus},</if>
+            <if test="wwryNum != null">#{wwryNum},</if>
+            <if test="wlryNum != null">#{wlryNum},</if>
+            <if test="workArea != null and workArea != ''">#{workArea},</if>
+            <if test="infoEntry != null and infoEntry != ''">#{infoEntry},</if>
+            <if test="realFailureReason != null and realFailureReason != ''">#{realFailureReason},</if>
+            <if test="lostPower != null">#{lostPower},</if>
+            <if test="workPermitNum != null and workPermitNum != ''">#{workPermitNum},</if>
+            <if test="appealUserName != null and appealUserName != ''">#{appealUserName},</if>
+            <if test="appealUserId != null">#{appealUserId},</if>
+            <if test="appealTime != null">#{appealTime},</if>
+            <if test="appealReason != null and appealReason != ''">#{appealReason},</if>
+            <if test="suspendExplain != null and suspendExplain != ''">#{suspendExplain},</if>
+            <if test="orderEntryType != null and orderEntryType != ''">#{orderEntryType},</if>
+            <if test="orderAttachment != null and orderAttachment != ''">#{orderAttachment},</if>
+            <if test="extraWork != null and extraWork != ''">#{extraWork},</if>
+            <if test="acceptReturnType != null and acceptReturnType != ''">#{acceptReturnType},</if>
+            <if test="acceptReturnReason != null and acceptReturnReason != ''">#{acceptReturnReason},</if>
+            <if test="scoreReturnReason != null and scoreReturnReason != ''">#{scoreReturnReason},</if>
+            <if test="finalizeMethod != null and finalizeMethod != ''">#{finalizeMethod},</if>
+            <if test="overStopStatus != null">#{overStopStatus},</if>
+        </trim>
+    </insert>
+
+    <update id="updateGxtRepairOrder" parameterType="GxtRepairOrder">
+        update gxt_repair_order
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="workOrderProjectNo != null and workOrderProjectNo != ''">work_order_project_no = #{workOrderProjectNo},</if>
+            <if test="workOrderStatus != null">work_order_status = #{workOrderStatus},</if>
+            <if test="gxtCenterId != null">gxt_center_id = #{gxtCenterId},</if>
+            <if test="gxtCenter != null">gxt_center = #{gxtCenter},</if>
+            <if test="pcsStationId != null">pcs_station_id = #{pcsStationId},</if>
+            <if test="pcsStationName != null">pcs_station_name = #{pcsStationName},</if>
+            <if test="pcsDeviceId != null">pcs_device_id = #{pcsDeviceId},</if>
+            <if test="pcsDeviceName != null">pcs_device_name = #{pcsDeviceName},</if>
+            <if test="brand != null">brand = #{brand},</if>
+            <if test="model != null">model = #{model},</if>
+            <if test="faultCode != null">fault_code = #{faultCode},</if>
+            <if test="faultDesc != null">fault_desc = #{faultDesc},</if>
+            <if test="assignTime != null">assign_time = #{assignTime},</if>
+            <if test="assignUserId != null">assign_user_id = #{assignUserId},</if>
+            <if test="assignUserName != null">assign_user_name = #{assignUserName},</if>
+            <if test="acceptTime != null">accept_time = #{acceptTime},</if>
+            <if test="acceptUserId != null">accept_user_id = #{acceptUserId},</if>
+            <if test="acceptUserName != null">accept_user_name = #{acceptUserName},</if>
+            <if test="realStartTime != null">real_start_time = #{realStartTime},</if>
+            <if test="realEndTime != null">real_end_time = #{realEndTime},</if>
+            <if test="teamLeaderId != null">team_leader_id = #{teamLeaderId},</if>
+            <if test="teamLeaderName != null">team_leader_name = #{teamLeaderName},</if>
+            <if test="workGroupMemberId != null">work_group_member_id = #{workGroupMemberId},</if>
+            <if test="workGroupMemberName != null">work_group_member_name = #{workGroupMemberName},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="remark != null">remark = #{remark},</if>
+            <if test="content != null">content = #{content},</if>
+            <if test="planHour != null">plan_hour = #{planHour},</if>
+            <if test="priorityType != null">priority_type = #{priorityType},</if>
+            <if test="score != null">score = #{score},</if>
+            <if test="reviewContent != null">review_content = #{reviewContent},</if>
+            <if test="maintenanceType != null and maintenanceType != ''">maintenance_type = #{maintenanceType},</if>
+            <if test="occurTime != null">occur_time = #{occurTime},</if>
+            <if test="faultBarcode != null">fault_barcode = #{faultBarcode},</if>
+            <if test="suspendReason != null">suspend_reason = #{suspendReason},</if>
+            <if test="suspendDescription != null">suspend_description = #{suspendDescription},</if>
+            <if test="approvalStatus != null">approval_status = #{approvalStatus},</if>
+            <if test="rejectionReason != null">rejection_reason = #{rejectionReason},</if>
+            <if test="modifyReason != null">modify_reason = #{modifyReason},</if>
+            <if test="finalizationRemark != null">finalization_remark = #{finalizationRemark},</if>
+            <if test="relatedOrderCode != null">related_order_code = #{relatedOrderCode},</if>
+            <if test="relatedOrderContent != null">related_order_content = #{relatedOrderContent},</if>
+            <if test="misOrderNo != null">mis_order_no = #{misOrderNo},</if>
+            <if test="restartTime != null">restart_time = #{restartTime},</if>
+            <if test="scoringStatus != null">scoring_status = #{scoringStatus},</if>
+            <if test="pcsStationPid != null">pcs_station_pid = #{pcsStationPid},</if>
+            <if test="attachmentUrls != null and attachmentUrls != ''">attachment_urls = #{attachmentUrls},</if>
+            <if test="reviewScoreNum != null">review_score_num = #{reviewScoreNum},</if>
+            <if test="finalCoefficient != null">final_coefficient = #{finalCoefficient},</if>
+            <if test="orderType != null">order_type = #{orderType},</if>
+            <if test="repairMethod != null and repairMethod != ''">repair_method = #{repairMethod},</if>
+            <if test="resetMethod != null and resetMethod != ''">reset_method = #{resetMethod},</if>
+            <if test="invalidReason != null and invalidReason != ''">invalid_reason = #{invalidReason},</if>
+            <if test="returnType != null and returnType != ''">return_type = #{returnType},</if>
+            <if test="workOrderStatus != null and workOrderStatus == 'return'">
+                return_reason = #{returnReason},
+            </if>
+            <if test="feedbackReason != null and feedbackReason != ''">feedback_reason = #{feedbackReason},</if>
+            <if test="confirmStatus != null">confirm_status = #{confirmStatus},</if>
+            <if test="wwryNum != null">wwry_num = #{wwryNum},</if>
+            <if test="wlryNum != null">wlry_num = #{wlryNum},</if>
+            <if test="workArea != null and workArea != ''">work_area = #{workArea},</if>
+            <if test="infoEntry != null and infoEntry != ''">info_entry = #{infoEntry},</if>
+            <if test="realFailureReason != null and realFailureReason != ''">real_failure_reason = #{realFailureReason},</if>
+            <if test="lostPower != null">lost_power = #{lostPower},</if>
+            <if test="workPermitNum != null and workPermitNum != ''">work_permit_num = #{workPermitNum},</if>
+            <if test="appealUserName != null and appealUserName != ''">appeal_user_name = #{appealUserName},</if>
+            <if test="appealUserId != null">appeal_user_id = #{appealUserId},</if>
+            <if test="appealTime != null">appeal_time = #{appealTime},</if>
+            <if test="appealReason != null and appealReason != ''">appeal_reason = #{appealReason},</if>
+            <if test="suspendExplain != null and suspendExplain != ''">suspend_explain = #{suspendExplain},</if>
+            <if test="orderEntryType != null and orderEntryType != ''">order_entry_type = #{orderEntryType},</if>
+            <if test="orderAttachment != null and orderAttachment != ''">order_attachment = #{orderAttachment},</if>
+            <if test="extraWork != null and extraWork != ''">extra_work = #{extraWork},</if>
+            <if test="acceptReturnType != null and acceptReturnType != ''">accept_return_type = #{acceptReturnType},</if>
+            <if test="workOrderStatus != null and workOrderStatus == 'accept_return'">
+                accept_return_reason = #{acceptReturnReason},
+            </if>
+            <if test="scoreReturnReason != null and scoreReturnReason != ''">score_return_reason = #{scoreReturnReason},</if>
+            <if test="finalizeMethod != null and finalizeMethod != ''">finalize_method = #{finalizeMethod},</if>
+            <if test="overStopStatus != null">over_stop_status = #{overStopStatus},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteGxtRepairOrderById" parameterType="Long">
+        delete from gxt_repair_order where id = #{id}
+    </delete>
+
+    <delete id="deleteGxtRepairOrderByIds" parameterType="String">
+        delete from gxt_repair_order where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+    <select id="selectGxtRepairOrderListForAutoFinalize" parameterType="GxtRepairOrder" resultMap="GxtRepairOrderResult">
+        <include refid="selectGxtRepairOrderVo"/>
+        <where>
+            <if test="workOrderStatus != null and workOrderStatus != ''"> and work_order_status in
+                <foreach collection="workOrderStatus.split(',')" item="status" open="(" close=")" separator=",">
+                    #{status}
+                </foreach>
+            </if>
+            and accept_time is not null
+            and occur_time is not null
+            and restart_time is not null
+        </where>
+        order by create_time desc
+    </select>
+
+    <select id="selectGxtRepairOrderByWorkOrderProjectNo" parameterType="String" resultMap="GxtRepairOrderResult">
+        <include refid="selectGxtRepairOrderVo"/>
+        where work_order_project_no = #{workOrderProjectNo}
+    </select>
+
+    <select id="selectGxtRepairOrderListNoPermi" parameterType="GxtRepairOrder" resultMap="GxtRepairOrderResult">
+        <include refid="selectGxtRepairOrderVo"/>
+        <where>
+            <if test="workOrderProjectNo != null  and workOrderProjectNo != ''"> and work_order_project_no = #{workOrderProjectNo}</if>
+            <if test="workOrderStatus != null  and workOrderStatus != ''"> and work_order_status = #{workOrderStatus}</if>
+            <if test="gxtCenterId != null "> and gxt_center_id = #{gxtCenterId}</if>
+            <if test="gxtCenter != null  and gxtCenter != ''"> and gxt_center = #{gxtCenter}</if>
+            <if test="pcsStationId != null "> and pcs_station_id = #{pcsStationId}</if>
+            <if test="pcsStationName != null  and pcsStationName != ''"> and pcs_station_name = #{pcsStationName} </if>
+            <if test="pcsDeviceId != null "> and pcs_device_id = #{pcsDeviceId}</if>
+            <if test="pcsDeviceName != null  and pcsDeviceName != ''"> and pcs_device_name like concat('%', #{pcsDeviceName}, '%')</if>
+            <if test="brand != null  and brand != ''"> and brand = #{brand}</if>
+            <if test="model != null  and model != ''"> and model = #{model}</if>
+            <if test="faultCode != null  and faultCode != ''"> and fault_code like concat('%', #{faultCode}, '%')</if>
+            <if test="faultDesc != null  and faultDesc != ''"> and fault_desc = #{faultDesc}</if>
+            <if test="assignTime != null "> and assign_time = #{assignTime}</if>
+            <if test="assignUserId != null "> and assign_user_id = #{assignUserId}</if>
+            <if test="assignUserName != null  and assignUserName != ''"> and assign_user_name like concat('%', #{assignUserName}, '%')</if>
+            <if test="acceptTime != null "> and accept_time = #{acceptTime}</if>
+            <if test="acceptUserId != null "> and accept_user_id = #{acceptUserId}</if>
+            <if test="acceptUserName != null  and acceptUserName != ''"> and accept_user_name like concat('%', #{acceptUserName}, '%')</if>
+            <if test="realStartTime != null "> and real_start_time = #{realStartTime}</if>
+            <if test="realEndTime != null "> and real_end_time = #{realEndTime}</if>
+            <if test="teamLeaderId != null "> and team_leader_id = #{teamLeaderId}</if>
+            <if test="teamLeaderName != null  and teamLeaderName != ''"> and team_leader_name like concat('%', #{teamLeaderName}, '%')</if>
+            <if test="workGroupMemberId != null "> and work_group_member_id = #{workGroupMemberId}</if>
+            <if test="workGroupMemberName != null  and workGroupMemberName != ''"> and work_group_member_name like concat('%', #{workGroupMemberName}, '%')</if>
+            <if test="content != null  and content != ''"> and content = #{content}</if>
+            <if test="planHour != null "> and plan_hour = #{planHour}</if>
+            <if test="priorityType != null "> and priority_type = #{priorityType}</if>
+            <if test="score != null "> and score = #{score}</if>
+            <if test="reviewContent != null  and reviewContent != ''"> and review_content = #{reviewContent}</if>
+            <if test="maintenanceType != null  and maintenanceType != ''"> and maintenance_type = #{maintenanceType}</if>
+            <if test="occurTime != null "> and occur_time = #{occurTime}</if>
+            <if test="faultBarcode != null  and faultBarcode != ''"> and fault_barcode = #{faultBarcode}</if>
+            <if test="suspendReason != null  and suspendReason != ''"> and suspend_reason = #{suspendReason}</if>
+            <if test="suspendDescription != null  and suspendDescription != ''"> and suspend_description = #{suspendDescription}</if>
+            <if test="approvalStatus != null  and approvalStatus != ''"> and approval_status = #{approvalStatus}</if>
+            <if test="rejectionReason != null  and rejectionReason != ''"> and rejection_reason = #{rejectionReason}</if>
+            <if test="modifyReason != null  and modifyReason != ''"> and modify_reason = #{modifyReason}</if>
+            <if test="finalizationRemark != null  and finalizationRemark != ''"> and finalization_remark = #{finalizationRemark}</if>
+            <if test="relatedOrderCode != null  and relatedOrderCode != ''"> and related_order_code = #{relatedOrderCode}</if>
+            <if test="relatedOrderContent != null  and relatedOrderContent != ''"> and related_order_content = #{relatedOrderContent}</if>
+            <if test="misOrderNo != null  and misOrderNo != ''"> and mis_order_no = #{misOrderNo}</if>
+            <if test="restartTime != null "> and restart_time = #{restartTime}</if>
+            <if test="scoringStatus != null "> and scoring_status = #{scoringStatus}</if>
+            <if test="pcsStationPid != null "> and pcs_station_pid = #{pcsStationPid}</if>
+            <if test="attachmentUrls != null  and attachmentUrls != ''"> and attachment_urls = #{attachmentUrls}</if>
+            <if test="reviewScoreNum != null "> and review_score_num = #{reviewScoreNum}</if>
+            <if test="repairMethod != null  and repairMethod != ''"> and repair_method = #{repairMethod}</if>
+            <if test="resetMethod != null and resetMethod != ''"> and reset_method = #{resetMethod}</if>
+            <if test="returnType != null  and returnType != ''"> and return_type = #{returnType}</if>
+            <if test="returnReason != null  and returnReason != ''"> and return_reason = #{returnReason}</if>
+            <if test="wwryNum != null"> and wwry_num = #{wwryNum}</if>
+            <if test="wlryNum != null"> and wlry_num = #{wlryNum}</if>
+            <if test="workArea != null  and workArea != ''"> and work_area = #{workArea}</if>
+            <if test="infoEntry != null  and infoEntry != ''"> and info_entry = #{infoEntry}</if>
+            <if test="realFailureReason != null  and realFailureReason != ''"> and real_failure_reason = #{realFailureReason}</if>
+            <if test="lostPower != null"> and lost_power = #{lostPower}</if>
+            <if test="workPermitNum != null and workPermitNum != ''"> and work_permit_num = #{workPermitNum}</if>
+        </where>
+        order by id desc
+    </select>
+
+    <select id="selectRepairOrderWithPersonById" parameterType="Long" resultMap="GxtRepairOrderWithPersonResult">
+        SELECT 
+            t1.id,
+            t1.work_order_project_no,
+            t1.work_order_status,
+            t1.gxt_center_id,
+            t1.gxt_center,
+            t1.pcs_station_id,
+            t1.pcs_station_name,
+            t1.pcs_device_id,
+            t1.pcs_device_name,
+            t1.brand,
+            t1.model,
+            t1.fault_code,
+            t1.fault_desc,
+            t1.assign_time,
+            t1.assign_user_id,
+            t1.assign_user_name,
+            t1.accept_time,
+            t1.accept_user_id,
+            t1.accept_user_name,
+            t1.real_start_time,
+            t1.real_end_time,
+            t1.team_leader_id,
+            t1.team_leader_name,
+            t1.work_group_member_id,
+            t1.work_group_member_name,
+            t1.content,
+            t1.plan_hour,
+            t1.priority_type,
+            t1.score,
+            t1.review_content,
+            t1.maintenance_type,
+            t1.occur_time,
+            t1.fault_barcode,
+            t1.suspend_reason,
+            t1.suspend_description,
+            t1.approval_status,
+            t1.rejection_reason,
+            t1.modify_reason,
+            t1.finalization_remark,
+            t1.related_order_code,
+            t1.related_order_content,
+            t1.mis_order_no,
+            t1.restart_time,
+            t1.scoring_status,
+            t1.pcs_station_pid,
+            t1.attachment_urls,
+            t1.review_score_num,
+            t1.final_coefficient,
+            t1.create_by,
+            t1.create_time,
+            t1.update_by,
+            t1.update_time,
+            t1.remark,
+            t1.return_type,
+            t1.return_reason,
+            t1.order_attachment,
+            t1.extra_work,
+            t1.accept_return_type,
+            t1.accept_return_reason,
+            t1.score_return_reason,
+            t2.id as person_id,
+            t2.user_id as person_user_id,
+            t2.nick_name as person_nick_name,
+            t2.order_id as person_order_id,
+            t2.order_code as person_order_code,
+            t2.status as person_status,
+            t2.self_score as person_self_score,
+            t2.review_score as person_review_score,
+            t2.final_score as person_final_score,
+            t2.is_leader as person_is_leader,
+            t2.extra_score as person_extra_score,
+            t2.total_score as person_total_score
+        FROM gxt_repair_order t1
+        LEFT JOIN gxt_repair_order_person t2 ON t1.id = t2.order_id
+        WHERE t1.id = #{id}
+    </select>
+
+    <select id="selectGSTJ" resultMap="GxtOrderDataResult">
+        SELECT
+            u.user_id,a.wxgs,b.wbgs
+        FROM sys_user u
+        LEFT JOIN (
+        SELECT
+            rop.user_id,
+            SUM(CASE WHEN ro.real_end_time>ro.real_start_time
+                        THEN TIMESTAMPDIFF( SECOND, ro.real_start_time, ro.real_end_time ) - IFNULL(gq.total_in_work_suspend_seconds, 0)
+                    ELSE 0 END ) / 3600 AS wxgs
+        FROM
+            gxt_repair_order_person rop
+                LEFT JOIN gxt_repair_order ro ON rop.order_id = ro.id
+                LEFT JOIN gxt_repair_order_flow_records_next gq ON gq.order_id = rop.order_id
+                LEFT JOIN (SELECT order_id,MAX(action_time) AS finish_time FROM gxt_repair_order_flow WHERE action_type IN ('complete','auto_finalize') GROUP BY order_id) flow ON flow.order_id=rop.order_id
+        WHERE
+            ro.repair_method!='2' AND ro.work_order_status IN ('completed','archived')
+            AND ro.real_end_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
+          AND ro.real_end_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
+        GROUP BY
+            rop.user_id) a ON a.user_id=u.user_id
+        LEFT JOIN (
+        SELECT
+            wop.user_id,
+            SUM(CASE WHEN wo.real_end_time>wo.real_start_time
+                        THEN TIMESTAMPDIFF( SECOND, wo.real_start_time, wo.real_end_time ) - IFNULL(gq.total_in_work_suspend_seconds, 0)
+                    ELSE 0 END ) / 3600 AS wbgs
+        FROM
+            gxt_work_order_person wop
+                LEFT JOIN gxt_work_order wo ON wop.order_id = wo.id
+                LEFT JOIN gxt_work_order_flow_records_next gq ON gq.order_id = wop.order_id
+                LEFT JOIN (SELECT order_id,MAX(action_time) AS finish_time FROM gxt_work_order_flow WHERE action_type IN ('complete','auto_finalize') GROUP BY order_id) flow ON flow.order_id=wop.order_id
+        WHERE
+            wo.work_order_status IN ('completed','archived')
+          AND wo.real_end_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
+          AND wo.real_end_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
+        GROUP BY
+            wop.user_id) b ON u.user_id=b.user_id
+        <where>
+            <if test="userId != null"> and u.user_id=#{userId}</if>
+        </where>
+    </select>
+
+    <select id="selectHomePageData" resultMap="GxtOrderDataResult">
+        SELECT
+        u.user_id,
+        IFNULL( a.order_num, 0 ) AS workOrderNum,
+        IFNULL( b.order_num_last, 0 ) AS workOrderNumLast,
+        IFNULL( c.repair_num, 0 ) AS repairOrderNum,
+        IFNULL( cc.repair_num, 0 ) AS repairRestartOrderNum,
+        IFNULL( d.repair_num_last, 0 ) AS repairOrderNumLast,
+        IFNULL( n.score, 0 ) AS score,
+        IFNULL( o.score, 0 ) AS score_last,
+        IFNULL( p.pcsWorkOrderNum, 0 ) AS pcsWorkOrderNum,
+        IFNULL( q.pcsRepairOrderNum, 0 ) AS pcsRepairOrderNum,
+        IFNULL( qq.pcsRepairOrderNum, 0 ) AS pcsRepairRestartOrderNum,
+        IFNULL( r.centerWorkOrderNum, 0 ) AS centerWorkOrderNum,
+        IFNULL( s.centerRepairOrderNum, 0 ) AS centerRepairOrderNum,
+        IFNULL( ss.centerRepairOrderNum, 0 ) AS centerRepairRestartOrderNum,
+        IFNULL( t.companyWorkOrderNum, 0 ) AS companyWorkOrderNum,
+        IFNULL( tt.companyRepairOrderNum, 0 ) AS companyRepairOrderNum,
+        IFNULL( ttt.companyRepairOrderNum, 0 ) AS companyRepairRestartOrderNum
+        FROM
+        sys_user u
+        LEFT JOIN (
+        SELECT
+        COUNT(*) AS order_num,
+        wop.user_id
+        FROM
+        gxt_work_order wo
+        LEFT JOIN gxt_work_order_person wop ON wo.id = wop.order_id
+        WHERE wo.work_order_status IN ('completed','archived') AND
+        wo.create_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
+        AND wo.create_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
+        GROUP BY
+        wop.user_id
+        ) a ON a.user_id = u.user_id
+        LEFT JOIN (
+        SELECT
+        COUNT(*) AS order_num_last,
+        wop.user_id
+        FROM
+        gxt_work_order wo
+        LEFT JOIN gxt_work_order_person wop ON wo.id = wop.order_id
+        WHERE wo.work_order_status IN ('completed','archived') AND
+        wo.create_time >= DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL - 1 MONTH )
+        AND wo.create_time <![CDATA[<]]> STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
+        GROUP BY
+        wop.user_id
+        ) b ON u.user_id = b.user_id
+        LEFT JOIN (
+        SELECT
+        COUNT(*) AS repair_num,
+        rop.user_id
+        FROM
+        gxt_repair_order ro
+        LEFT JOIN gxt_repair_order_person rop ON ro.id = rop.order_id
+        WHERE ro.work_order_status IN ('completed','archived') AND ro.repair_method != '2'
+        AND ro.occur_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
+        AND ro.occur_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
+        GROUP BY
+        rop.user_id
+        ) c ON u.user_id = c.user_id
+        LEFT JOIN (
+            SELECT
+                COUNT(*) AS repair_num,
+                rop.operator_id AS user_id
+            FROM
+                gxt_repair_order ro
+                    LEFT JOIN gxt_repair_order_flow rop ON ro.id = rop.order_id AND rop.action_type='complete'
+            WHERE ro.work_order_status IN ('completed','archived') AND ro.repair_method = '2'
+        AND ro.occur_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
+              AND ro.occur_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
+            GROUP BY
+                rop.operator_id
+        ) cc ON u.user_id = cc.user_id
+        LEFT JOIN (
+        SELECT
+        COUNT(*) AS repair_num_last,
+        rop.user_id
+        FROM
+        gxt_repair_order ro
+        LEFT JOIN gxt_repair_order_person rop ON ro.id = rop.order_id
+        WHERE ro.work_order_status IN ('completed','archived') AND
+        ro.occur_time >= DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL - 1 MONTH )
+        AND ro.occur_time <![CDATA[<]]> STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
+        GROUP BY
+        rop.user_id
+        ) d ON u.user_id = d.user_id
+        LEFT JOIN (
+            SELECT
+                SUM( us.final_score ) AS score,
+                su.user_id
+            FROM
+                gxt_user_score us
+                    LEFT JOIN sys_user su ON us.user_name = su.user_name
+            WHERE
+                us.month_period = #{monthPeriod}
+            GROUP BY
+                su.user_id
+        ) n ON u.user_id = n.user_id
+        LEFT JOIN (
+            SELECT
+                SUM( us.final_score ) AS score,
+                su.user_id
+            FROM
+                gxt_user_score us
+                    LEFT JOIN sys_user su ON us.user_name = su.user_name
+            WHERE
+                    us.month_period = DATE_FORMAT( DATE_SUB( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01' ), '%Y-%m-%d' ), INTERVAL 1 MONTH ), '%Y-%m' )
+            GROUP BY
+                su.user_id
+        ) o ON u.user_id = o.user_id
+        LEFT JOIN (
+            SELECT
+                COUNT(*) AS pcsWorkOrderNum,
+                su.dept_id,su.user_id
+            FROM
+                gxt_work_order wo
+                    LEFT JOIN sys_user su ON wo.pcs_station_pid = su.dept_id
+            WHERE wo.work_order_status IN ('completed','archived') AND
+                su.user_id = #{userId}
+            AND wo.create_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
+              AND wo.create_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
+        ) p ON u.user_id = p.user_id
+        LEFT JOIN (
+            SELECT
+                COUNT(*) AS pcsRepairOrderNum,
+                su.dept_id,su.user_id
+            FROM
+                gxt_repair_order wo
+                    LEFT JOIN sys_user su ON wo.pcs_station_pid = su.dept_id
+            WHERE wo.work_order_status IN ('completed','archived') AND wo.repair_method != '2'
+              AND su.user_id = #{userId}
+              AND wo.occur_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
+              AND wo.occur_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
+        ) q ON u.user_id = q.user_id
+        LEFT JOIN (
+            SELECT
+                COUNT(*) AS pcsRepairOrderNum,
+                su.dept_id,su.user_id
+            FROM
+                gxt_repair_order wo
+                    LEFT JOIN sys_user su ON wo.pcs_station_pid = su.dept_id
+            WHERE wo.work_order_status IN ('completed','archived') AND wo.repair_method = '2'
+              AND su.user_id = #{userId}
+              AND wo.occur_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
+              AND wo.occur_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
+        ) qq ON u.user_id = qq.user_id
+        LEFT JOIN (
+            SELECT
+                COUNT(*) AS centerWorkOrderNum,
+                su.dept_id,su.user_id
+            FROM
+                gxt_work_order wo
+                    LEFT JOIN sys_user su ON wo.gxt_center_id = su.dept_id
+            WHERE wo.work_order_status IN ('completed','archived') AND
+                su.user_id = #{userId}
+              AND wo.create_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
+              AND wo.create_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
+        ) r ON u.user_id = r.user_id
+        LEFT JOIN (
+            SELECT
+                COUNT(*) AS centerRepairOrderNum,
+                su.dept_id,su.user_id
+            FROM
+                gxt_repair_order wo
+                    LEFT JOIN sys_user su ON wo.gxt_center_id = su.dept_id
+            WHERE wo.work_order_status IN ('completed','archived') AND wo.repair_method != '2'
+              AND su.user_id = #{userId}
+              AND wo.occur_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
+              AND wo.occur_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
+        ) s ON u.user_id = s.user_id
+        LEFT JOIN (
+            SELECT
+                COUNT(*) AS centerRepairOrderNum,
+                su.dept_id,su.user_id
+            FROM
+                gxt_repair_order wo
+                    LEFT JOIN sys_user su ON wo.gxt_center_id = su.dept_id
+            WHERE wo.work_order_status IN ('completed','archived') AND wo.repair_method = '2'
+              AND su.user_id = #{userId}
+              AND wo.occur_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
+              AND wo.occur_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
+        ) ss ON u.user_id = ss.user_id
+        LEFT JOIN (
+            SELECT
+                COUNT(*) AS companyWorkOrderNum,#{userId} AS user_id
+            FROM
+                gxt_work_order wo
+            WHERE wo.work_order_status IN ('completed','archived') AND
+             wo.create_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
+              AND wo.create_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
+        ) t ON u.user_id = t.user_id
+        LEFT JOIN (
+            SELECT
+                COUNT(*) AS companyRepairOrderNum,#{userId} AS user_id
+            FROM
+                gxt_repair_order wo
+            WHERE wo.work_order_status IN ('completed','archived') AND wo.repair_method != '2'
+              AND wo.occur_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
+              AND wo.occur_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
+        ) tt ON u.user_id = tt.user_id
+        LEFT JOIN (
+            SELECT
+                COUNT(*) AS companyRepairOrderNum,#{userId} AS user_id
+            FROM
+                gxt_repair_order wo
+            WHERE wo.work_order_status IN ('completed','archived') AND wo.repair_method = '2'
+              AND wo.occur_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
+              AND wo.occur_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
+        ) ttt ON u.user_id = ttt.user_id
+        WHERE
+        u.user_id = #{userId}
+    </select>
+
+    <select id="selectHomePageRank" parameterType="GxtUserScore" resultMap="GxtUserScoreResult">
+        SELECT
+            u.user_id,
+            u.user_name,
+            u.nick_name,
+            d.dept_id,
+            d.dept_name,
+            p.dept_id AS center_id,
+            p.dept_name AS center,
+            (SELECT dept_name FROM sys_dept WHERE parent_id=0) AS companyName,
+            IFNULL(us.final_score,0) AS final_score
+        FROM
+            sys_user u
+                LEFT JOIN sys_dept d ON u.dept_id = d.dept_id
+                LEFT JOIN sys_dept p ON d.parent_id = p.dept_id
+                LEFT JOIN (SELECT month_period,user_name,SUM(final_score) AS final_score FROM gxt_user_score GROUP BY month_period,user_name) us ON u.user_name = us.user_name AND us.month_period = DATE_FORMAT(CURDATE(), '%Y-%m')
+        WHERE 1=1
+        <if test="deptId != null">
+            AND d.dept_id=#{deptId}
+        </if>
+        <if test="centerId != null">
+            AND p.dept_id=#{centerId}
+        </if>
+        <if test="permission != null  and permission != ''">
+            AND u.user_id IN
+                <foreach item="item" collection="permission.split(',')" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+        </if>
+        ORDER BY
+            IFNULL(us.final_score,0) DESC
+    </select>
+
+    <select id="selectLatestGxtRepairOrderByDeviceId" parameterType="map" resultMap="GxtRepairOrderResult">
+        <include refid="selectGxtRepairOrderVo"/>
+        <where>
+            <if test="pcsDeviceId != null"> and pcs_device_id = #{pcsDeviceId}</if>
+            <if test="limit != null and limit > 0"> 
+                ORDER BY create_time DESC LIMIT #{limit}
+            </if>
+        </where>
+    </select>
+    
+    <select id="selectGxtRepairOrderByDeviceIdWithCondition" parameterType="map" resultMap="GxtRepairOrderResult">
+        <include refid="selectGxtRepairOrderVo"/>
+        <where>
+            <if test="pcsDeviceId != null"> and pcs_device_id = #{pcsDeviceId}</if>
+            <if test="workOrderStatus != null and workOrderStatus != ''">
+                <if test="excludeStatus">
+                    and work_order_status != #{workOrderStatus}
+                </if>
+                <if test="!excludeStatus">
+                    and work_order_status = #{workOrderStatus}
+                </if>
+            </if>
+            <if test="excludeRepairMethod2 != null and excludeRepairMethod2">
+                and repair_method != '2'
+            </if>
+            <if test="orderByField != null and orderByField == 'restartTime'">
+                and work_order_status IN ('completed','archived')
+            </if>
+        </where>
+        <choose>
+            <when test="orderByField != null and orderByField == 'occurTime'">
+                ORDER BY occur_time DESC
+            </when>
+            <when test="orderByField != null and orderByField == 'restartTime'">
+                ORDER BY restart_time DESC
+            </when>
+            <otherwise>
+                ORDER BY create_time DESC
+            </otherwise>
+        </choose>
+        <if test="limit != null and limit > 0"> 
+            LIMIT #{limit}
+        </if>
+    </select>
+    
+    <select id="selectGxtRepairOrderListForDeduction" resultMap="GxtRepairOrderResult">
+        SELECT DISTINCT t.*
+        FROM gxt_repair_order t
+        LEFT JOIN gxt_order_score_detail osd ON t.id = osd.order_id AND osd.order_type = 1 AND osd.score_type = 3
+        WHERE t.work_order_status = 'archived'
+          AND t.repair_method != '2'
+          AND osd.order_id IS NULL
+    </select>
+    
+    <select id="selectPendingRepairOrdersForDeduction" resultMap="GxtRepairOrderResult">
+        SELECT t.*
+        FROM gxt_repair_order t
+        WHERE t.work_order_status = 'to_finish'
+          AND t.occur_time IS NOT NULL
+    </select>
+    
+
+    
+    <!-- 查询指定时间之后的有效维修工单(用于奖励计算) -->
+    <select id="selectValidRepairOrdersAfterBreak" parameterType="map" resultMap="GxtRepairOrderResult">
+        SELECT t.*
+        FROM gxt_repair_order t
+        WHERE t.pcs_device_id = #{equipmentId}
+          AND t.work_order_status IN ('completed', 'archived')
+          AND t.restart_time IS NOT NULL
+          AND t.repair_method = '1'
+          AND (
+            #{lastBreakTime} IS NULL 
+            OR t.restart_time > #{lastBreakTime}
+          )
+        ORDER BY t.restart_time ASC
+    </select>
+    
+    <!-- 按occurTime倒序查询满足处理方式条件且停机时长大于30分钟的维修工单 -->
+    <select id="selectRepairOrdersByOccurTime" parameterType="map" resultMap="GxtRepairOrderResult">
+        SELECT t.*
+        FROM gxt_repair_order t
+        WHERE t.pcs_device_id = #{equipmentId}
+          AND t.work_order_status != 'invalid'
+          AND t.occur_time IS NOT NULL
+          AND (
+            -- 条件1: repair_method为空
+            (t.repair_method IS NULL AND t.work_order_status NOT IN ('completed', 'archived'))
+            OR
+            -- 条件2: repair_method不为空且满足特定条件
+            -- 处理方式为正常维修
+            t.repair_method = '1'
+            OR
+            -- 处理方式为复位启机且复位方式为人工复位
+            (t.repair_method = '2' AND t.reset_method = '1')
+          )
+        ORDER BY t.occur_time DESC,t.id DESC limit 1
+    </select>
+    
+
+    
+    <!-- 按restartTime倒序查询满足处理方式条件的维修工单 -->
+    <select id="selectRepairOrdersByRestartTime" parameterType="map" resultMap="GxtRepairOrderResult">
+        SELECT t.*
+        FROM gxt_repair_order t
+        WHERE t.pcs_device_id = #{equipmentId}
+          AND t.work_order_status != 'invalid'
+          AND t.occur_time IS NOT NULL
+          AND t.restart_time IS NOT NULL
+          AND (
+            -- 处理方式为正常维修
+            t.repair_method = '1'
+            OR 
+            -- 处理方式为复位启机且复位方式为人工复位
+            (t.repair_method = '2' AND t.reset_method = '1')
+          )
+        ORDER BY t.restart_time DESC
+    </select>
+    
+
+</mapper>

+ 9 - 0
ygtx-ui/src/api/gxt/repairOrder.js

@@ -212,3 +212,12 @@ export function getExportOrderDataList(query) {
     params: query
   })
 }
+
+// 添加参与人员
+export function addPerson(data) {
+  return request({
+    url: '/gxt/repairOrder/addPerson',
+    method: 'put',
+    data: data
+  })
+}

+ 584 - 0
ygtx-ui/src/components/repairOrder/addPerson.vue

@@ -0,0 +1,584 @@
+<template>
+  <el-dialog title="添加参与人员" v-model="visible" width="800px" append-to-body @close="handleClose">
+<!--    <el-alert type="info" :closable="false" style="border-color: #14b8a6; background-color: #f0fdfa; color: #0d9488; height: 35px;">-->
+<!--      <template #default>-->
+<!--        <i class="fa fa-file-text-o mr-2" style="color: #0d9488;"> 请选择信息录入方式,并上传相关附件完成结单。</i>-->
+<!--      </template>-->
+<!--    </el-alert>-->
+    <h4 class="text-sm font-medium text-gray-800 mb-3"></h4>
+    <el-form ref="addPersonFormRef" :model="formData" :rules="finalizeRules" label-width="120px" label-position="top">
+      <el-row>
+        <el-col :span="12">
+          <el-form-item label="工单编码"><el-input v-model="formData.workOrderProjectNo" disabled /></el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="风机编号"><el-input v-model="formData.pcsDeviceName" disabled /></el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="工单状态">
+            <el-select v-model="formData.workOrderStatus" style="width: 100%" disabled>
+              <el-option
+                  v-for="dict in workOrderStatusOptions"
+                  :key="dict.value"
+                  :label="dict.label"
+                  :value="dict.value"
+              />
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="维保中心"><el-input v-model="formData.gxtCenter" disabled /> </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="场站"><el-input v-model="formData.pcsStationName" disabled /> </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="品牌"><el-input v-model="formData.brand" disabled /> </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="故障代码"><el-input v-model="formData.faultCode" disabled /> </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="故障条文"><el-input v-model="formData.faultBarcode" disabled /> </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="故障描述">
+            <el-input
+              v-model="formData.faultDesc"
+              type="textarea"
+              :rows="3"
+              disabled
+            />
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row>
+        <el-col :span="12">
+          <el-form-item label="工作负责人" prop="teamLeaderName">
+            <el-input
+                v-model="formData.teamLeaderName"
+                placeholder="请输入工作负责人姓名或点击选择"
+                clearable
+                @focus="handleTeamLeaderInputFocus"
+                @blur="handleTeamLeaderInputBlur"
+                @input="handleTeamLeaderInput"
+                @clear="handleTeamLeaderClear"
+            >
+            </el-input>
+            <!-- 快速检索下拉框 -->
+            <div class="quick-select-dropdown" v-show="showTeamLeaderQuickSelect && quickTeamLeaderList.length > 0">
+              <div
+                  v-for="item in quickTeamLeaderList"
+                  :key="item.userId"
+                  class="quick-select-item"
+                  @click="handleTeamLeaderQuickSelect(item)">
+                <span class="user-name">{{ item.nickName }}</span>
+                <span class="user-name">{{ item.dept.deptName }}</span>
+              </div>
+            </div>
+            <div class="quick-select-dropdown no-data" v-show="showTeamLeaderQuickSelect && quickTeamLeaderList.length === 0 && formData.teamLeaderName && !teamLeaderLoading">
+              <div>未找到匹配的人员</div>
+            </div>
+            <div class="quick-select-dropdown no-data" v-show="showTeamLeaderQuickSelect && teamLeaderLoading">
+              <div>
+                <i class="el-icon-loading"></i>
+                搜索中...
+              </div>
+            </div>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="工作班成员" prop="workGroupMemberName">
+            <el-input
+                v-model="formData.workGroupMemberName"
+                placeholder="请选择工作班成员"
+            >
+              <template #append>
+                <el-button @click="userSelectVisible = true" icon="User"></el-button>
+              </template>
+            </el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+    <template #footer>
+      <div class="dialog-footer">
+        <el-button @click="handleCancel">取 消</el-button>
+        <el-button type="primary" @click="handleSubmit">确 认</el-button>
+      </div>
+    </template>
+  </el-dialog>
+
+  <!-- 人员选择组件 -->
+  <UserSelectMulti
+    v-model="userSelectVisible"
+    :pre-selected-users="selectedUsers"
+    :sort-dept-id="formData.pcsStationPid"
+    @onSelected="onUserSelected"
+  />
+</template>
+
+<script setup>
+import { ref, defineProps, defineEmits, getCurrentInstance, computed, watch } from 'vue'
+import preview from '@/components/FileUpload/preview.vue'
+import UserSelectMulti from '@/components/userSelect/multi.vue'
+import { ElMessageBox } from 'element-plus'
+import {listUser, listUserData, listUserNoPermi, listLeader} from "@/api/system/user";
+import MisInfoSelectSingle from "@/components/misInfoSelect/single.vue";
+import {listRepairOrder} from "@/api/gxt/repairOrder.js";
+import {listWorkPerson} from "@/api/gxt/misInfo.js";
+import {getOrderList} from "@/api/gxt/gxtOrder.js";
+
+// 获取当前实例
+const { proxy } = getCurrentInstance()
+
+// 定义属性
+const props = defineProps({
+  modelValue: {
+    type: Boolean,
+    default: false
+  },
+  data: {
+    type: Object,
+    default: () => ({})
+  },
+  workOrderStatusOptions: {
+    type: Array,
+    default: () => ([])
+  },
+  onSubmit: {
+    type: Function,
+    default: null
+  },
+  listRepairOrder: {
+    type: Function,
+    default: null
+  },
+  listWorkPerson: {
+    type: Function,
+    default: null
+  },
+  listUserData: {
+    type: Function,
+    default: null
+  },
+  listMisInfo: {
+    type: Function,
+    default: null
+  },
+  infoEntryDisabled: {
+    type: Boolean,
+    default: false
+  },
+  commonKey: {
+    type: Number,
+    default: 0
+  }
+})
+
+// 定义事件
+const emit = defineEmits(['update:modelValue', 'success', 'select-mis-info'])
+
+// 响应式数据
+const visible = ref(false)
+const formData = ref({})
+const addPersonFormRef = ref()
+const showMisNoQuickSelect = ref(false)
+const quickMisNoList = ref([])
+const misNoSearchTimer = ref(null)
+const userSelectVisible = ref(false) // 添加人员选择组件可见性
+const selectedUsers = ref([]) // 存储选中的用户
+const inputUsers = ref([]) // 存储选中的用户
+const flowList = ref([])
+const suspendInfo = ref(null)
+const resumeInfo = ref(null)
+const resumeShow = ref(false)
+const misInfoSelectVisible = ref(false)
+
+// 工作负责人快速检索相关响应式数据
+const showTeamLeaderQuickSelect = ref(false)
+const quickTeamLeaderList = ref([])
+const teamLeaderLoading = ref(false)
+const teamLeaderSearchTimer = ref(null)
+const allUserList = ref([]) // 存储所有设备数据用于快速检索
+const lastLoadedCenterId = ref(null)
+
+// 表单验证规则
+const finalizeRules = ref({
+  workGroupMemberName: [
+    { required: true, message: "请选择工作班成员", trigger: "change" },
+    {
+      validator: async (rule, value, callback) => {
+        // 如果值为空、关联MIS,直接通过验证
+        if (!value || formData.value.infoEntry == '1') {
+          selectedUsers.value = [];
+          return callback();
+        }
+        try {
+          inputUsers.value = []
+          // 将输入的工作班成员姓名按逗号分割
+          const names = value.split(',').map(name => name.trim());
+          // 验证每个工作班成员是否存在于组织架构中
+          for (const name of names) {
+            if (name.length > 0) {
+              // 检查输入中重复
+              if (inputUsers.value.some(u => u.nickName === name)) {
+                return callback(new Error(`工作班成员"${name}"重复,请重新输入`));
+              }
+              // 使用从属性传入的listUserData方法
+              if (!props.listUserData) {
+                return callback(new Error('系统配置错误:缺少用户数据查询方法'));
+              }
+              const response = await props.listUserData({nickName: name});
+              if (!response.rows || response.rows.length === 0) {
+                return callback(new Error(`工作班成员"${name}"非系统内人员,请重新输入`));
+              }else{
+                inputUsers.value.push(response.rows[0]);
+              }
+            } else {
+              return callback(new Error(`请正确输入工作班成员名单`));
+            }
+          }
+          selectedUsers.value = inputUsers.value;
+          callback();
+        } catch (error) {
+          callback(new Error('验证工作班成员时发生错误'));
+        }
+      },
+      trigger: 'blur'
+    }
+  ],
+
+  teamLeaderName: [
+    { required: true, message: "工作负责人不能为空", trigger: "change" }
+  ],
+})
+
+// 监听modelValue变化
+watch(() => props.modelValue, (val) => {
+  visible.value = val
+  if (val) {
+    // 初始化表单数据
+    formData.value = { ...props.data, selectedMembers: [] }
+  }
+})
+
+// 监听props.data变化
+watch(() => props.data, (newData) => {
+  if (visible.value) {
+    // 只有在对话框打开时才更新数据
+    formData.value = { ...newData, selectedMembers: [] }
+  }
+}, { deep: true })
+
+// 监听visible变化
+watch(visible, (val) => {
+  emit('update:modelValue', val)
+  if (val) {
+    // 打开对话框后重置表单验证错误
+    proxy.$nextTick(() => {
+      if (addPersonFormRef.value) {
+        addPersonFormRef.value.clearValidate()
+      }
+    })
+  }
+})
+
+// 关闭对话框
+const handleClose = () => {
+  visible.value = false
+  selectedUsers.value = []
+  resumeInfo.value = null
+  suspendInfo.value = null
+  resumeShow.value = false
+}
+
+// 取消操作
+const handleCancel = () => {
+  visible.value = false
+  selectedUsers.value = []
+  resumeInfo.value = null
+  suspendInfo.value = null
+  resumeShow.value = false
+}
+
+// 用户选择回调函数
+const onUserSelected = (users) => {
+  if (users && users.length > 0) {
+    // 合并用户,避免重复
+    const existingNames = selectedUsers.value.map(u => u.nickName);
+    const newUsers = users.filter(u => !existingNames.includes(u.nickName));
+    selectedUsers.value = [...selectedUsers.value, ...newUsers];
+    // 构建用户姓名列表
+    const userNames = selectedUsers.value.map(user => user.nickName).join(',');
+    formData.value.workGroupMemberName = userNames;
+  } else {
+    selectedUsers.value = [];
+    formData.value.workGroupMemberName = '';
+  }
+  formData.value.repairOrderPersonList = selectedUsers.value.map(user => ({
+    userId: user.userId,
+    nickName: user.nickName,
+    orderId: formData.value.id,
+    orderCode: formData.value.workOrderProjectNo,
+    status: 1
+  }));
+};
+
+// 提交操作
+// const handleSubmit = async () => {
+//   if (!addPersonFormRef.value) return
+//
+//   await addPersonFormRef.value.validate(async (valid) => {
+//     if (valid) {
+//       const { realStartTime, acceptTime } = formData.value;
+//       debugger
+//       try {
+//         debugger
+//         // 根据维修方式清除不需要的字段
+//         if (formData.value.repairMethod === '1') {
+//           // 正常维修时清除复位方式
+//           formData.value.resetMethod = undefined;
+//           formData.value.workArea = Array.isArray(formData.value.workArea) ? formData.value.workArea.join(',')
+//                                 : formData.value.workArea || ''
+//         } else if (formData.value.repairMethod === '2') {
+//           // 复位启机时清除MIS相关字段
+//           formData.value.misOrderNo = undefined;
+//           formData.value.realStartTime = undefined;
+//           formData.value.realEndTime = undefined;
+//           formData.value.workGroupMemberName = undefined;
+//           formData.value.infoEntry = undefined;
+//           formData.value.wwryNum = undefined;
+//           formData.value.wlryNum = undefined;
+//           formData.value.workArea = undefined;
+//           formData.value.repairOrderPersonList = [];
+//         }
+//
+//         // 调用父组件传入的提交函数
+//         if (props.onSubmit && typeof props.onSubmit === 'function') {
+//
+//           flowList.value = []
+//           if (formData.value.resumeTime && formData.value.resumeTime != resumeInfo.value.actionTime) { //存入新的挂起结束时间
+//             resumeInfo.value.actionTime = formData.value.resumeTime
+//             flowList.value.push(resumeInfo.value)
+//           }
+//           formData.value.repairOrderFlowList = flowList.value
+//           formData.value.finalizeMethod = '2'
+//           await props.onSubmit(formData.value)
+//         } else {
+//           throw new Error("未提供提交方法")
+//         }
+//
+//         proxy.$modal.msgSuccess("结单成功")
+//         visible.value = false
+//         emit('success')
+//       } catch (error) {
+//         // proxy.$modal.msgError("操作失败: " + (error.message || "未知错误"))
+//       }
+//     }
+//   })
+// }
+
+// 核心修改:提交函数 - 临时转换workArea格式,异常时恢复
+const handleSubmit = async () => {
+  if (!addPersonFormRef.value) return
+  await addPersonFormRef.value.validate(async (valid) => {
+    if (valid) {
+      try {
+        // 2. 构建提交用的临时数据(不修改原formData)
+        const submitData = { ...formData.value }
+        // 防止提交时候时间格式转换错误
+        submitData.createTime = null
+        submitData.updateTime = null
+        // 5. 调用父组件提交函数(传入转换后的临时数据)
+        if (props.onSubmit && typeof props.onSubmit === 'function') {
+          await props.onSubmit(submitData) // 提交转换后的数据
+        } else {
+          throw new Error("未提供提交方法")
+        }
+
+        // 提交成功逻辑
+        visible.value = false
+        emit('success')
+      } catch (error) {
+        // 重置表单验证状态
+        proxy.$nextTick(() => {
+          addPersonFormRef.value.clearValidate()
+        })
+      }
+    }
+  })
+}
+// 工作负责人快速检索方法
+/** 过滤快速检索用户列表 */
+const filterQuickUserList = (keyword) => {
+  debugger
+  if (!allUserList.value.length) {
+    loadQuickTeamLeaderList();
+    return;
+  }
+
+  const lowerKeyword = keyword.toLowerCase();
+  quickTeamLeaderList.value = allUserList.value.filter(item =>
+      (item.nickName && item.nickName.toLowerCase().includes(lowerKeyword))
+  );
+}
+/** 工作负责人输入框获取焦点 */
+const handleTeamLeaderInputFocus = () => {
+  showTeamLeaderQuickSelect.value = true
+  // 如果已有输入内容,立即搜索
+  if (formData.value.teamLeaderName && formData.value.teamLeaderName.trim()) {
+    handleTeamLeaderInput(formData.value.teamLeaderName)
+  } else {
+    // 如果没有输入内容,加载默认列表
+    loadQuickTeamLeaderList()
+  }
+}
+
+/** 工作负责人输入框失去焦点 */
+const handleTeamLeaderInputBlur = () => {
+  // 延迟隐藏下拉框,确保点击选项能触发
+  setTimeout(() => {
+    showTeamLeaderQuickSelect.value = false
+  }, 200)
+}
+
+/** 工作负责人输入事件 - 实时搜索 */
+const handleTeamLeaderInput = (value) => {
+  const searchText = value.trim()
+
+  if (!searchText) {
+    quickTeamLeaderList.value = []
+    showTeamLeaderQuickSelect.value = false
+    return
+  }
+
+  showTeamLeaderQuickSelect.value = true
+
+  // 清除之前的定时器
+  if (teamLeaderSearchTimer.value) {
+    clearTimeout(teamLeaderSearchTimer.value)
+  }
+
+  // 设置新的定时器,防抖处理(300ms)
+  // teamLeaderSearchTimer.value = setTimeout(() => {
+  // searchTeamLeaderList(searchText)
+  filterQuickUserList(searchText)
+  // }, 300)
+}
+
+/** 搜索工作负责人列表 */
+const searchTeamLeaderList = async (keyword) => {
+  if (!keyword) {
+    quickTeamLeaderList.value = []
+    return
+  }
+
+  teamLeaderLoading.value = true
+  try {
+    const response = await listLeader({
+      nickName: keyword,
+      // 可以根据需要添加其他搜索条件
+      status: '0' // 只搜索启用状态的用户
+    })
+
+    quickTeamLeaderList.value = response.data || []
+
+  } catch (error) {
+    console.error('搜索工作负责人失败:', error)
+    proxy.$modal.msgError('搜索失败,请重试')
+    quickTeamLeaderList.value = []
+  } finally {
+    teamLeaderLoading.value = false
+  }
+}
+
+/** 加载快速检索工作负责人列表 */
+const loadQuickTeamLeaderList = async () => {
+  // 如果已有所有用户数据,且是同一个维保中心,直接使用
+  if (allUserList.value.length > 0 && lastLoadedCenterId.value === formData.value.gxtCenterId) {
+    quickTeamLeaderList.value = allUserList.value;
+    return;
+  }
+
+  // 记录当前维保中心ID
+  lastLoadedCenterId.value = formData.value.gxtCenterId;
+
+  teamLeaderLoading.value = true
+  try {
+    // 加载当前部门下的用户列表
+    const response = await listLeader({
+      deptId: -1, // 通过后台配置部门
+      status: '0'
+    })
+    allUserList.value = response.data || []
+    quickTeamLeaderList.value = allUserList.value;
+  } catch (error) {
+    console.error('加载工作负责人列表失败:', error)
+    allUserList.value = []
+  } finally {
+    teamLeaderLoading.value = false
+  }
+}
+
+/** 快速选择工作负责人 */
+const handleTeamLeaderQuickSelect = (item) => {
+  formData.value.teamLeaderId = item.userId
+  formData.value.teamLeaderName = item.nickName
+  showTeamLeaderQuickSelect.value = false
+}
+
+/** 清空工作负责人 */
+const handleTeamLeaderClear = () => {
+  formData.value.teamLeaderId = undefined
+  formData.value.teamLeaderName = ''
+  quickTeamLeaderList.value = []
+  showTeamLeaderQuickSelect.value = false
+}
+
+</script>
+
+<style scoped>
+/* 表单中的列间距调整 */
+:deep(.el-col) {
+  padding-left: 5px;
+  padding-right: 5px;
+}
+.quick-select-dropdown {
+  position: absolute;
+  top: 100%;
+  left: 0;
+  right: 0;
+  z-index: 1000;
+  max-height: 200px;
+  overflow-y: auto;
+  background: white;
+  border: 1px solid #dcdfe6;
+  border-top: none;
+  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+}
+
+.quick-select-item {
+  padding: 8px 12px;
+  cursor: pointer;
+  border-bottom: 1px solid #f0f0f0;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
+
+.quick-select-item:hover {
+  background-color: #f5f7fa;
+}
+
+.no-data {
+  text-align: center;
+  padding: 10px;
+  color: #909399;
+}
+
+/* 穿透修改组件内部输入框的对齐方式(关键) */
+:deep(.input-number-left .el-input__inner) {
+  text-align: left !important; /* !important 覆盖组件默认的居中 */
+}
+</style>

+ 45 - 2
ygtx-ui/src/views/gxt/orderMyTodo/index.vue

@@ -224,6 +224,14 @@
                 @click="handleRestart(scope.row)"
                 v-hasPermi="['gxt:repairOrder:restart']"
             ><i class="fa fa-refresh"></i>复运</el-button>
+            <el-button
+                v-if="scope.row.workOrderStatus != 'archived' && scope.row.workOrderStatus != 'completed'
+              && scope.row.workOrderStatus != 'invalid' && scope.row.workOrderStatus != 'draft' && scope.row.overStopStatus == 1"
+                type="primary"
+                link
+                @click="handleAddPerson(scope.row)"
+                v-hasPermi="['gxt:repairOrder:addPerson']"
+            ><i class="fa fa-address-card-o"></i>参与人员</el-button>
           </template>
 
           <!-- 维保工单操作按钮 -->
@@ -969,7 +977,7 @@
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="损失电量(kWh)" prop="lostPower">
+            <el-form-item label="损失电量(kWh)">
               <el-input-number
                   v-model="restartRepairForm.lostPower"
                   controls-position="right"
@@ -1387,6 +1395,17 @@
         :on-submit="submitSuspendFromParent"
         @success="handleSuspendSuccess"
     />
+
+    <!-- 参与人员对话框 -->
+    <add-person-dialog
+        v-model="addPersonDialogVisible"
+        :data="currentRow"
+        :workOrderStatusOptions="gxt_work_order_status"
+        :onSubmit="handleAddPersonSubmit"
+        :listRepairOrder="listRepairOrder"
+        :listWorkPerson="listWorkPerson"
+        :listUserData="listUserData"
+    />
   </div>
 </template>
 
@@ -1419,7 +1438,7 @@ import {
   returnRepairOrder,
   suspendRepairOrder,
   approveSuspendRepairOrder,
-  revokeRepairOrder
+  revokeRepairOrder, addPerson
 } from "@/api/gxt/repairOrder";
 import ResetDialog from '@/components/repairOrder/reset.vue'
 import {
@@ -1446,6 +1465,7 @@ import BackfillFinalizeDialog from "@/components/gxtOrder/backfillFinalize.vue";
 import AddEditRepairOrder from "@/components/repairOrder/addEdit.vue"
 import AddEditWorkOrder from "@/components/gxtOrder/addEdit.vue"
 import BackfillAddEditWorkOrder from "@/components/gxtOrder/backfillAddEdit.vue"
+import AddPersonDialog from "@/components/repairOrder/addPerson.vue";
 
 
 const { proxy } = getCurrentInstance();
@@ -1463,6 +1483,9 @@ const tableHeight = ref(window.innerHeight - 300);
 // 数据总数
 const total = ref(0);
 
+const addPersonDialogVisible = ref(false) // 添加参与人员
+const currentRow = ref({}) // 当前操作的工单行数据
+
 // 维修工单详情对话框可见性
 const repairDetailDialogVisible = ref(false);
 
@@ -3385,6 +3408,26 @@ async function handleRepairRevoke(row) {
   }).catch(() => {})
 }
 
+/** 参与人员 */
+function handleAddPerson(row) {
+  currentRow.value = { ...row }
+  addPersonDialogVisible.value = true
+}
+
+/** 提交参与人员 */
+async function handleAddPersonSubmit(data) {
+  try {
+    await addPerson(data)
+    proxy.$modal.msgSuccess("添加参与人员成功")
+    addPersonDialogVisible.value = false
+    getList()
+  } catch (error) {
+    console.error('添加参与人员失败:', error)
+    proxy.$modal.msgError("添加参与人员失败:" + (error.message || "未知错误"))
+  }
+}
+
+
 </script>
 
 <style scoped>

+ 43 - 2
ygtx-ui/src/views/gxt/repairOrder/index.vue

@@ -420,6 +420,14 @@
               @click="handleInvalidate(scope.row)"
               v-hasPermi="['gxt:repairOrder:invalidate']"
           ><i class="fa fa-ban"></i>作废</el-button>
+          <el-button
+              v-if="scope.row.workOrderStatus != 'archived' && scope.row.workOrderStatus != 'completed'
+              && scope.row.workOrderStatus != 'invalid' && scope.row.workOrderStatus != 'draft' && scope.row.overStopStatus == 1"
+              type="primary"
+              link
+              @click="handleAddPerson(scope.row)"
+              v-hasPermi="['gxt:repairOrder:addPerson']"
+          ><i class="fa fa-address-card-o"></i>参与人员</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -1130,7 +1138,7 @@
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="损失电量(kWh)" prop="lostPower">
+            <el-form-item label="损失电量(kWh)">
               <el-input-number
                   v-model="restartForm.lostPower"
                   placeholder="请输入损失电量"
@@ -1293,6 +1301,17 @@
       </template>
     </el-dialog>
 
+    <!-- 参与人员对话框 -->
+    <add-person-dialog
+        v-model="addPersonDialogVisible"
+        :data="currentRow"
+        :workOrderStatusOptions="gxt_work_order_status"
+        :onSubmit="handleAddPersonSubmit"
+        :listRepairOrder="listRepairOrder"
+        :listWorkPerson="listWorkPerson"
+        :listUserData="listUserData"
+    />
+
     <!-- 设备选择组件 -->
     <equipment-select-single v-model="equipmentSelectVisible" @onSelected="onEquipmentSelected"></equipment-select-single>
   </div>
@@ -1322,7 +1341,7 @@ import {
   invalidateRepairOrder,
   returnRepairOrder,
   getExportFields,
-  getExportOrderDataList
+  getExportOrderDataList, addPerson
 } from "@/api/gxt/repairOrder";
 import { listDept,getDept } from "@/api/system/dept";
 import { listFaultCodes } from "@/api/gxt/faultCodes"
@@ -1338,6 +1357,7 @@ import MisInfoSelectSingle from "@/components/misInfoSelect/single.vue";
 import {listAutoMisInfo, listMisInfo, listWorkPerson} from "@/api/gxt/misInfo.js";
 import {getOrderList, listGxtOrder} from "@/api/gxt/gxtOrder.js";
 import {listOrderScore} from "@/api/gxt/orderScore.js";
+import AddPersonDialog from "@/components/repairOrder/addPerson.vue";
 import useUserStore from '@/store/modules/user'
 import { useRoute } from 'vue-router'
 import {ref, watch} from 'vue'
@@ -1459,6 +1479,8 @@ const equipmentSelectVisible = ref(false)
 const restartDialogVisible = ref(false)  // 添加复运对话框显示控制
 const returnDialogVisible = ref(false)
 const resetDialogVisible = ref(false)  // 添加复启对话框显示控制
+const addPersonDialogVisible = ref(false) // 添加参与人员
+const currentRow = ref({}) // 当前操作的工单行数据
 
 // 工单流转记录
 const flowList = ref([])
@@ -3377,6 +3399,25 @@ function handleSuspend(row) {
   suspendDialogVisible.value = true
 }
 
+/** 参与人员 */
+function handleAddPerson(row) {
+  currentRow.value = { ...row }
+  addPersonDialogVisible.value = true
+}
+
+/** 提交参与人员 */
+async function handleAddPersonSubmit(data) {
+  try {
+    await addPerson(data)
+    proxy.$modal.msgSuccess("添加参与人员成功")
+    addPersonDialogVisible.value = false
+    getList()
+  } catch (error) {
+    console.error('添加参与人员失败:', error)
+    proxy.$modal.msgError("添加参与人员失败:" + (error.message || "未知错误"))
+  }
+}
+
 /** 提交挂起 */
 async function submitSuspend() {
   proxy.$refs["suspendFormRef"].validate(async valid => {