459242451@qq.com 3 жил өмнө
parent
commit
1ab7908079

+ 80 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/PlanTask.java

@@ -0,0 +1,80 @@
+package com.ruoyi.web.controller.task;
+
+import cn.hutool.core.date.DateUtil;
+import com.ruoyi.common.core.redis.RedisCache;
+import com.ruoyi.qdtl.domain.PlanUser;
+import com.ruoyi.qdtl.domain.TlInspectionPlan;
+import com.ruoyi.qdtl.domain.TlPlanRecord;
+import com.ruoyi.qdtl.service.ITlInspectionPlanService;
+import com.ruoyi.qdtl.service.ITlPlanRecordService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Description: 巡检计划任务
+ * @Author: huangcheng
+ * @Date: 2022/3/30
+ * @Version V1.0
+ */
+@Component("planTask")
+public class PlanTask {
+
+    @Autowired
+    private ITlInspectionPlanService planService;
+    @Autowired
+    private ITlPlanRecordService planRecordService;
+    @Autowired
+    private RedisCache redisCache;
+
+    /**
+     * 根据巡检计划生成下一日巡检计划数据
+     */
+    public void createPlan() {
+        // 查询符合条件的计划。根据当前时间点,如果是晚20点~24点之间,就去生成第二天的计划,如果是凌晨0点~1点,就生成当天的计划
+        // 生成过的计划,标记已生成放到redis中
+        int hour = DateUtil.hour(new Date(), true);
+        String queryDate;
+        if (20 <= hour && hour <= 24) {
+            queryDate = DateUtil.formatDate(DateUtil.tomorrow());
+        } else if (0 <= hour && hour <= 1) {
+            queryDate = DateUtil.today();
+        } else {
+            return;
+        }
+        Boolean recordFlag = redisCache.getCacheObject("tl:planrecord:" + queryDate);
+        if (recordFlag == null || recordFlag) {
+            return;
+        }
+        List<TlInspectionPlan> planList = planService.queryPlanByDate(queryDate);
+        if (planList != null && planList.size() > 0) {
+            List<TlPlanRecord> planRecords = new ArrayList<>();
+            for (TlInspectionPlan inspectionPlan : planList) {
+                // 查询计划的人员.根据计划id查询人员以及设备号
+                List<PlanUser> userList = planService.queryPlanUser(inspectionPlan.getId());
+                if (userList != null && userList.size() > 0) {
+                    // 组装计划数据
+                    for (PlanUser planUser : userList) {
+                        TlPlanRecord planRecord = new TlPlanRecord();
+                        planRecord.setPlanId(planUser.getPlanId());
+                        planRecord.setPlanDate(queryDate);
+                        planRecord.setPlanName(inspectionPlan.getPlanName());
+                        planRecord.setUserId(planUser.getUserId());
+                        planRecord.setNickName(planUser.getNickName());
+                        planRecord.setCard(planUser.getCard());
+                        planRecord.setScore(inspectionPlan.getScore());
+                        planRecords.add(planRecord);
+                    }
+                }
+            }
+            if (planRecords.size() > 0) {
+                planRecordService.batchInsert(planRecords);
+                redisCache.setCacheObject("tl:planrecord:" + queryDate, true);
+            }
+        }
+
+    }
+}

+ 94 - 84
ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml

@@ -1,93 +1,103 @@
 <?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">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.quartz.mapper.SysJobLogMapper">
 
-	<resultMap type="SysJobLog" id="SysJobLogResult">
-		<id     property="jobLogId"       column="job_log_id"      />
-		<result property="jobName"        column="job_name"        />
-		<result property="jobGroup"       column="job_group"       />
-		<result property="invokeTarget"   column="invoke_target"   />
-		<result property="jobMessage"     column="job_message"     />
-		<result property="status"         column="status"          />
-		<result property="exceptionInfo"  column="exception_info"  />
-		<result property="createTime"     column="create_time"     />
-	</resultMap>
-	
-	<sql id="selectJobLogVo">
-        select job_log_id, job_name, job_group, invoke_target, job_message, status, exception_info, create_time 
-		from sys_job_log
+    <resultMap type="SysJobLog" id="SysJobLogResult">
+        <id property="jobLogId" column="job_log_id"/>
+        <result property="jobName" column="job_name"/>
+        <result property="jobGroup" column="job_group"/>
+        <result property="invokeTarget" column="invoke_target"/>
+        <result property="jobMessage" column="job_message"/>
+        <result property="status" column="status"/>
+        <result property="exceptionInfo" column="exception_info"/>
+        <result property="createTime" column="create_time"/>
+    </resultMap>
+
+    <sql id="selectJobLogVo">
+        select job_log_id,
+               job_name,
+               job_group,
+               invoke_target,
+               job_message,
+               status,
+               exception_info,
+               create_time
+        from sys_job_log
     </sql>
-	
-	<select id="selectJobLogList" parameterType="SysJobLog" resultMap="SysJobLogResult">
-		<include refid="selectJobLogVo"/>
-		<where>
-			<if test="jobName != null and jobName != ''">
-				AND job_name like concat('%', #{jobName}, '%')
-			</if>
-			<if test="jobGroup != null and jobGroup != ''">
-				AND job_group = #{jobGroup}
-			</if>
-			<if test="status != null and status != ''">
-				AND status = #{status}
-			</if>
-			<if test="invokeTarget != null and invokeTarget != ''">
-				AND invoke_target like concat('%', #{invokeTarget}, '%')
-			</if>
-			<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-				and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
-			</if>
-			<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-				and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
-			</if>
-		</where>
-	</select>
-	
-	<select id="selectJobLogAll" resultMap="SysJobLogResult">
-		<include refid="selectJobLogVo"/>
-	</select>
-	
-	<select id="selectJobLogById" parameterType="Long" resultMap="SysJobLogResult">
-		<include refid="selectJobLogVo"/>
-		where job_log_id = #{jobLogId}
-	</select>
-	
-	<delete id="deleteJobLogById" parameterType="Long">
- 		delete from sys_job_log where job_log_id = #{jobLogId}
- 	</delete>
- 	
- 	<delete id="deleteJobLogByIds" parameterType="Long">
- 		delete from sys_job_log where job_log_id in
- 		<foreach collection="array" item="jobLogId" open="(" separator="," close=")">
- 			#{jobLogId}
-        </foreach> 
- 	</delete>
- 	
- 	<update id="cleanJobLog">
+
+    <select id="selectJobLogList" parameterType="SysJobLog" resultMap="SysJobLogResult">
+        <include refid="selectJobLogVo"/>
+        <where>
+            <if test="jobName != null and jobName != ''">
+                AND job_name like concat('%', #{jobName}, '%')
+            </if>
+            <if test="jobGroup != null and jobGroup != ''">
+                AND job_group = #{jobGroup}
+            </if>
+            <if test="status != null and status != ''">
+                AND status = #{status}
+            </if>
+            <if test="invokeTarget != null and invokeTarget != ''">
+                AND invoke_target like concat('%', #{invokeTarget}, '%')
+            </if>
+            <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
+                and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+            </if>
+            <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
+                and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+            </if>
+        </where>
+        order by create_time desc
+    </select>
+
+    <select id="selectJobLogAll" resultMap="SysJobLogResult">
+        <include refid="selectJobLogVo"/>
+    </select>
+
+    <select id="selectJobLogById" parameterType="Long" resultMap="SysJobLogResult">
+        <include refid="selectJobLogVo"/>
+        where job_log_id = #{jobLogId}
+    </select>
+
+    <delete id="deleteJobLogById" parameterType="Long">
+        delete
+        from sys_job_log
+        where job_log_id = #{jobLogId}
+    </delete>
+
+    <delete id="deleteJobLogByIds" parameterType="Long">
+        delete from sys_job_log where job_log_id in
+        <foreach collection="array" item="jobLogId" open="(" separator="," close=")">
+            #{jobLogId}
+        </foreach>
+    </delete>
+
+    <update id="cleanJobLog">
         truncate table sys_job_log
     </update>
- 	
- 	<insert id="insertJobLog" parameterType="SysJobLog">
- 		insert into sys_job_log(
- 			<if test="jobLogId != null and jobLogId != 0">job_log_id,</if>
- 			<if test="jobName != null and jobName != ''">job_name,</if>
- 			<if test="jobGroup != null and jobGroup != ''">job_group,</if>
- 			<if test="invokeTarget != null and invokeTarget != ''">invoke_target,</if>
- 			<if test="jobMessage != null and jobMessage != ''">job_message,</if>
- 			<if test="status != null and status != ''">status,</if>
- 			<if test="exceptionInfo != null and exceptionInfo != ''">exception_info,</if>
- 			create_time
- 		)values(
- 			<if test="jobLogId != null and jobLogId != 0">#{jobLogId},</if>
- 			<if test="jobName != null and jobName != ''">#{jobName},</if>
- 			<if test="jobGroup != null and jobGroup != ''">#{jobGroup},</if>
- 			<if test="invokeTarget != null and invokeTarget != ''">#{invokeTarget},</if>
- 			<if test="jobMessage != null and jobMessage != ''">#{jobMessage},</if>
- 			<if test="status != null and status != ''">#{status},</if>
- 			<if test="exceptionInfo != null and exceptionInfo != ''">#{exceptionInfo},</if>
- 			sysdate()
- 		)
-	</insert>
+
+    <insert id="insertJobLog" parameterType="SysJobLog">
+        insert into sys_job_log(
+        <if test="jobLogId != null and jobLogId != 0">job_log_id,</if>
+        <if test="jobName != null and jobName != ''">job_name,</if>
+        <if test="jobGroup != null and jobGroup != ''">job_group,</if>
+        <if test="invokeTarget != null and invokeTarget != ''">invoke_target,</if>
+        <if test="jobMessage != null and jobMessage != ''">job_message,</if>
+        <if test="status != null and status != ''">status,</if>
+        <if test="exceptionInfo != null and exceptionInfo != ''">exception_info,</if>
+        create_time
+        )values(
+        <if test="jobLogId != null and jobLogId != 0">#{jobLogId},</if>
+        <if test="jobName != null and jobName != ''">#{jobName},</if>
+        <if test="jobGroup != null and jobGroup != ''">#{jobGroup},</if>
+        <if test="invokeTarget != null and invokeTarget != ''">#{invokeTarget},</if>
+        <if test="jobMessage != null and jobMessage != ''">#{jobMessage},</if>
+        <if test="status != null and status != ''">#{status},</if>
+        <if test="exceptionInfo != null and exceptionInfo != ''">#{exceptionInfo},</if>
+        sysdate()
+        )
+    </insert>
 
 </mapper> 

+ 17 - 0
ruoyi-system/src/main/java/com/ruoyi/qdtl/domain/PlanUser.java

@@ -0,0 +1,17 @@
+package com.ruoyi.qdtl.domain;
+
+import lombok.Data;
+
+/**
+ * @Description: TODO
+ * @Author: huangcheng
+ * @Date: 2022/3/30
+ * @Version V1.0
+ */
+@Data
+public class PlanUser {
+    private Long planId;
+    private Long userId;
+    private String nickName;
+    private String card;
+}

+ 10 - 0
ruoyi-system/src/main/java/com/ruoyi/qdtl/domain/TlInspectionLocation.java

@@ -21,6 +21,8 @@ public class TlInspectionLocation extends BaseEntity {
      */
     private Long id;
 
+    private Long locationId;
+
     /**
      * 编号
      */
@@ -193,4 +195,12 @@ public class TlInspectionLocation extends BaseEntity {
     public void setThirdId(String thirdId) {
         this.thirdId = thirdId;
     }
+
+    public Long getLocationId() {
+        return locationId;
+    }
+
+    public void setLocationId(Long locationId) {
+        this.locationId = locationId;
+    }
 }

+ 76 - 59
ruoyi-system/src/main/java/com/ruoyi/qdtl/domain/TlInspectionPlan.java

@@ -1,146 +1,155 @@
 package com.ruoyi.qdtl.domain;
 
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
 
 import java.util.List;
 
 /**
  * 巡检计划管理对象 tl_inspection_plan
- * 
+ *
  * @author ruoyi
  * @date 2022-03-03
  */
-public class TlInspectionPlan extends BaseEntity
-{
+public class TlInspectionPlan extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** id */
+    /**
+     * id
+     */
     private Long id;
 
-    /** 编号 */
+    /**
+     * 编号
+     */
     @Excel(name = "编号")
     private String planCode;
 
-    /** 名称 */
+    /**
+     * 名称
+     */
     @Excel(name = "名称")
     private String planName;
 
-    /** 类型 */
+    /**
+     * 类型
+     */
     @Excel(name = "类型")
     private String planType;
 
-    /** 开始时间 */
+    /**
+     * 开始时间
+     */
     @Excel(name = "开始时间")
     private String startDate;
 
-    /** 结束时间 */
+    /**
+     * 结束时间
+     */
     @Excel(name = "结束时间")
     private String endDate;
 
-    /** 线路id */
+    /**
+     * 线路id
+     */
     @Excel(name = "线路id")
     private Long lineId;
 
-    /** 计划分数 */
+    /**
+     * 计划分数
+     */
     @Excel(name = "计划分数")
     private String score;
 
+    // 计划状态。1-计划中、2-计划暂停、3-计划删除
+    private String status;
+
     private List<TlInspectionPlanUser> planUsers;
 
     private String planUser;
 
-    public void setId(Long id) 
-    {
+    public void setId(Long id) {
         this.id = id;
     }
 
-    public Long getId() 
-    {
+    public Long getId() {
         return id;
     }
-    public void setPlanCode(String planCode) 
-    {
+
+    public void setPlanCode(String planCode) {
         this.planCode = planCode;
     }
 
-    public String getPlanCode() 
-    {
+    public String getPlanCode() {
         return planCode;
     }
-    public void setPlanName(String planName) 
-    {
+
+    public void setPlanName(String planName) {
         this.planName = planName;
     }
 
-    public String getPlanName() 
-    {
+    public String getPlanName() {
         return planName;
     }
-    public void setPlanType(String planType) 
-    {
+
+    public void setPlanType(String planType) {
         this.planType = planType;
     }
 
-    public String getPlanType() 
-    {
+    public String getPlanType() {
         return planType;
     }
-    public void setStartDate(String startDate) 
-    {
+
+    public void setStartDate(String startDate) {
         this.startDate = startDate;
     }
 
-    public String getStartDate() 
-    {
+    public String getStartDate() {
         return startDate;
     }
-    public void setEndDate(String endDate) 
-    {
+
+    public void setEndDate(String endDate) {
         this.endDate = endDate;
     }
 
-    public String getEndDate() 
-    {
+    public String getEndDate() {
         return endDate;
     }
-    public void setLineId(Long lineId) 
-    {
+
+    public void setLineId(Long lineId) {
         this.lineId = lineId;
     }
 
-    public Long getLineId() 
-    {
+    public Long getLineId() {
         return lineId;
     }
-    public void setScore(String score) 
-    {
+
+    public void setScore(String score) {
         this.score = score;
     }
 
-    public String getScore() 
-    {
+    public String getScore() {
         return score;
     }
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("planCode", getPlanCode())
-            .append("planName", getPlanName())
-            .append("planType", getPlanType())
-            .append("startDate", getStartDate())
-            .append("endDate", getEndDate())
-            .append("lineId", getLineId())
-            .append("score", getScore())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .toString();
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("id", getId())
+                .append("planCode", getPlanCode())
+                .append("planName", getPlanName())
+                .append("planType", getPlanType())
+                .append("startDate", getStartDate())
+                .append("endDate", getEndDate())
+                .append("lineId", getLineId())
+                .append("score", getScore())
+                .append("createBy", getCreateBy())
+                .append("createTime", getCreateTime())
+                .append("updateBy", getUpdateBy())
+                .append("updateTime", getUpdateTime())
+                .toString();
     }
 
     public List<TlInspectionPlanUser> getPlanUsers() {
@@ -158,4 +167,12 @@ public class TlInspectionPlan extends BaseEntity
     public void setPlanUser(String planUser) {
         this.planUser = planUser;
     }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
 }

+ 16 - 10
ruoyi-system/src/main/java/com/ruoyi/qdtl/mapper/TlInspectionPlanMapper.java

@@ -1,19 +1,21 @@
 package com.ruoyi.qdtl.mapper;
 
-import java.util.List;
+import com.ruoyi.qdtl.domain.PlanUser;
 import com.ruoyi.qdtl.domain.TlInspectionPlan;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 巡检计划管理Mapper接口
- * 
+ *
  * @author ruoyi
  * @date 2022-03-03
  */
-public interface TlInspectionPlanMapper 
-{
+public interface TlInspectionPlanMapper {
     /**
      * 查询巡检计划管理
-     * 
+     *
      * @param id 巡检计划管理主键
      * @return 巡检计划管理
      */
@@ -21,7 +23,7 @@ public interface TlInspectionPlanMapper
 
     /**
      * 查询巡检计划管理列表
-     * 
+     *
      * @param tlInspectionPlan 巡检计划管理
      * @return 巡检计划管理集合
      */
@@ -29,7 +31,7 @@ public interface TlInspectionPlanMapper
 
     /**
      * 新增巡检计划管理
-     * 
+     *
      * @param tlInspectionPlan 巡检计划管理
      * @return 结果
      */
@@ -37,7 +39,7 @@ public interface TlInspectionPlanMapper
 
     /**
      * 修改巡检计划管理
-     * 
+     *
      * @param tlInspectionPlan 巡检计划管理
      * @return 结果
      */
@@ -45,7 +47,7 @@ public interface TlInspectionPlanMapper
 
     /**
      * 删除巡检计划管理
-     * 
+     *
      * @param id 巡检计划管理主键
      * @return 结果
      */
@@ -53,9 +55,13 @@ public interface TlInspectionPlanMapper
 
     /**
      * 批量删除巡检计划管理
-     * 
+     *
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
     public int deleteTlInspectionPlanByIds(Long[] ids);
+
+    List<TlInspectionPlan> queryPlanByDate(@Param("queryDate") String queryDate);
+
+    List<PlanUser> queryPlanUser(@Param("id") Long id);
 }

+ 13 - 10
ruoyi-system/src/main/java/com/ruoyi/qdtl/mapper/TlPlanRecordMapper.java

@@ -1,19 +1,20 @@
 package com.ruoyi.qdtl.mapper;
 
-import java.util.List;
 import com.ruoyi.qdtl.domain.TlPlanRecord;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 巡检计划记录Mapper接口
- * 
+ *
  * @author ruoyi
  * @date 2022-03-30
  */
-public interface TlPlanRecordMapper 
-{
+public interface TlPlanRecordMapper {
     /**
      * 查询巡检计划记录
-     * 
+     *
      * @param id 巡检计划记录主键
      * @return 巡检计划记录
      */
@@ -21,7 +22,7 @@ public interface TlPlanRecordMapper
 
     /**
      * 查询巡检计划记录列表
-     * 
+     *
      * @param tlPlanRecord 巡检计划记录
      * @return 巡检计划记录集合
      */
@@ -29,7 +30,7 @@ public interface TlPlanRecordMapper
 
     /**
      * 新增巡检计划记录
-     * 
+     *
      * @param tlPlanRecord 巡检计划记录
      * @return 结果
      */
@@ -37,7 +38,7 @@ public interface TlPlanRecordMapper
 
     /**
      * 修改巡检计划记录
-     * 
+     *
      * @param tlPlanRecord 巡检计划记录
      * @return 结果
      */
@@ -45,7 +46,7 @@ public interface TlPlanRecordMapper
 
     /**
      * 删除巡检计划记录
-     * 
+     *
      * @param id 巡检计划记录主键
      * @return 结果
      */
@@ -53,9 +54,11 @@ public interface TlPlanRecordMapper
 
     /**
      * 批量删除巡检计划记录
-     * 
+     *
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
     public int deleteTlPlanRecordByIds(Long[] ids);
+
+    void batchInsert(@Param("list") List<TlPlanRecord> planRecords);
 }

+ 15 - 10
ruoyi-system/src/main/java/com/ruoyi/qdtl/service/ITlInspectionPlanService.java

@@ -1,19 +1,20 @@
 package com.ruoyi.qdtl.service;
 
-import java.util.List;
+import com.ruoyi.qdtl.domain.PlanUser;
 import com.ruoyi.qdtl.domain.TlInspectionPlan;
 
+import java.util.List;
+
 /**
  * 巡检计划管理Service接口
- * 
+ *
  * @author ruoyi
  * @date 2022-03-03
  */
-public interface ITlInspectionPlanService 
-{
+public interface ITlInspectionPlanService {
     /**
      * 查询巡检计划管理
-     * 
+     *
      * @param id 巡检计划管理主键
      * @return 巡检计划管理
      */
@@ -21,7 +22,7 @@ public interface ITlInspectionPlanService
 
     /**
      * 查询巡检计划管理列表
-     * 
+     *
      * @param tlInspectionPlan 巡检计划管理
      * @return 巡检计划管理集合
      */
@@ -29,7 +30,7 @@ public interface ITlInspectionPlanService
 
     /**
      * 新增巡检计划管理
-     * 
+     *
      * @param tlInspectionPlan 巡检计划管理
      * @return 结果
      */
@@ -37,7 +38,7 @@ public interface ITlInspectionPlanService
 
     /**
      * 修改巡检计划管理
-     * 
+     *
      * @param tlInspectionPlan 巡检计划管理
      * @return 结果
      */
@@ -45,7 +46,7 @@ public interface ITlInspectionPlanService
 
     /**
      * 批量删除巡检计划管理
-     * 
+     *
      * @param ids 需要删除的巡检计划管理主键集合
      * @return 结果
      */
@@ -53,9 +54,13 @@ public interface ITlInspectionPlanService
 
     /**
      * 删除巡检计划管理信息
-     * 
+     *
      * @param id 巡检计划管理主键
      * @return 结果
      */
     public int deleteTlInspectionPlanById(Long id);
+
+    List<TlInspectionPlan> queryPlanByDate(String queryDate);
+
+    List<PlanUser> queryPlanUser(Long id);
 }

+ 13 - 10
ruoyi-system/src/main/java/com/ruoyi/qdtl/service/ITlPlanRecordService.java

@@ -1,19 +1,19 @@
 package com.ruoyi.qdtl.service;
 
-import java.util.List;
 import com.ruoyi.qdtl.domain.TlPlanRecord;
 
+import java.util.List;
+
 /**
  * 巡检计划记录Service接口
- * 
+ *
  * @author ruoyi
  * @date 2022-03-30
  */
-public interface ITlPlanRecordService 
-{
+public interface ITlPlanRecordService {
     /**
      * 查询巡检计划记录
-     * 
+     *
      * @param id 巡检计划记录主键
      * @return 巡检计划记录
      */
@@ -21,7 +21,7 @@ public interface ITlPlanRecordService
 
     /**
      * 查询巡检计划记录列表
-     * 
+     *
      * @param tlPlanRecord 巡检计划记录
      * @return 巡检计划记录集合
      */
@@ -29,7 +29,7 @@ public interface ITlPlanRecordService
 
     /**
      * 新增巡检计划记录
-     * 
+     *
      * @param tlPlanRecord 巡检计划记录
      * @return 结果
      */
@@ -37,7 +37,7 @@ public interface ITlPlanRecordService
 
     /**
      * 修改巡检计划记录
-     * 
+     *
      * @param tlPlanRecord 巡检计划记录
      * @return 结果
      */
@@ -45,7 +45,7 @@ public interface ITlPlanRecordService
 
     /**
      * 批量删除巡检计划记录
-     * 
+     *
      * @param ids 需要删除的巡检计划记录主键集合
      * @return 结果
      */
@@ -53,9 +53,12 @@ public interface ITlPlanRecordService
 
     /**
      * 删除巡检计划记录信息
-     * 
+     *
      * @param id 巡检计划记录主键
      * @return 结果
      */
     public int deleteTlPlanRecordById(Long id);
+
+    void batchInsert(List<TlPlanRecord> planRecords);
+    
 }

+ 30 - 25
ruoyi-system/src/main/java/com/ruoyi/qdtl/service/impl/TlInspectionPlanServiceImpl.java

@@ -1,24 +1,25 @@
 package com.ruoyi.qdtl.service.impl;
 
-import java.util.List;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.qdtl.domain.PlanUser;
+import com.ruoyi.qdtl.domain.TlInspectionPlan;
 import com.ruoyi.qdtl.domain.TlInspectionPlanUser;
+import com.ruoyi.qdtl.mapper.TlInspectionPlanMapper;
+import com.ruoyi.qdtl.service.ITlInspectionPlanService;
 import com.ruoyi.qdtl.service.ITlInspectionPlanUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import com.ruoyi.qdtl.mapper.TlInspectionPlanMapper;
-import com.ruoyi.qdtl.domain.TlInspectionPlan;
-import com.ruoyi.qdtl.service.ITlInspectionPlanService;
+
+import java.util.List;
 
 /**
  * 巡检计划管理Service业务层处理
- * 
+ *
  * @author ruoyi
  * @date 2022-03-03
  */
 @Service
-public class TlInspectionPlanServiceImpl implements ITlInspectionPlanService 
-{
+public class TlInspectionPlanServiceImpl implements ITlInspectionPlanService {
     @Autowired
     private TlInspectionPlanMapper tlInspectionPlanMapper;
     @Autowired
@@ -26,37 +27,34 @@ public class TlInspectionPlanServiceImpl implements ITlInspectionPlanService
 
     /**
      * 查询巡检计划管理
-     * 
+     *
      * @param id 巡检计划管理主键
      * @return 巡检计划管理
      */
     @Override
-    public TlInspectionPlan selectTlInspectionPlanById(Long id)
-    {
+    public TlInspectionPlan selectTlInspectionPlanById(Long id) {
         return tlInspectionPlanMapper.selectTlInspectionPlanById(id);
     }
 
     /**
      * 查询巡检计划管理列表
-     * 
+     *
      * @param tlInspectionPlan 巡检计划管理
      * @return 巡检计划管理
      */
     @Override
-    public List<TlInspectionPlan> selectTlInspectionPlanList(TlInspectionPlan tlInspectionPlan)
-    {
+    public List<TlInspectionPlan> selectTlInspectionPlanList(TlInspectionPlan tlInspectionPlan) {
         return tlInspectionPlanMapper.selectTlInspectionPlanList(tlInspectionPlan);
     }
 
     /**
      * 新增巡检计划管理
-     * 
+     *
      * @param tlInspectionPlan 巡检计划管理
      * @return 结果
      */
     @Override
-    public int insertTlInspectionPlan(TlInspectionPlan tlInspectionPlan)
-    {
+    public int insertTlInspectionPlan(TlInspectionPlan tlInspectionPlan) {
         tlInspectionPlan.setCreateTime(DateUtils.getNowDate());
         int row = tlInspectionPlanMapper.insertTlInspectionPlan(tlInspectionPlan);
         for (TlInspectionPlanUser planUser : tlInspectionPlan.getPlanUsers()) {
@@ -70,13 +68,12 @@ public class TlInspectionPlanServiceImpl implements ITlInspectionPlanService
 
     /**
      * 修改巡检计划管理
-     * 
+     *
      * @param tlInspectionPlan 巡检计划管理
      * @return 结果
      */
     @Override
-    public int updateTlInspectionPlan(TlInspectionPlan tlInspectionPlan)
-    {
+    public int updateTlInspectionPlan(TlInspectionPlan tlInspectionPlan) {
         tlInspectionPlan.setUpdateTime(DateUtils.getNowDate());
         int row = tlInspectionPlanMapper.updateTlInspectionPlan(tlInspectionPlan);
         // 删除关系后再新增
@@ -92,25 +89,33 @@ public class TlInspectionPlanServiceImpl implements ITlInspectionPlanService
 
     /**
      * 批量删除巡检计划管理
-     * 
+     *
      * @param ids 需要删除的巡检计划管理主键
      * @return 结果
      */
     @Override
-    public int deleteTlInspectionPlanByIds(Long[] ids)
-    {
+    public int deleteTlInspectionPlanByIds(Long[] ids) {
         return tlInspectionPlanMapper.deleteTlInspectionPlanByIds(ids);
     }
 
     /**
      * 删除巡检计划管理信息
-     * 
+     *
      * @param id 巡检计划管理主键
      * @return 结果
      */
     @Override
-    public int deleteTlInspectionPlanById(Long id)
-    {
+    public int deleteTlInspectionPlanById(Long id) {
         return tlInspectionPlanMapper.deleteTlInspectionPlanById(id);
     }
+
+    @Override
+    public List<TlInspectionPlan> queryPlanByDate(String queryDate) {
+        return tlInspectionPlanMapper.queryPlanByDate(queryDate);
+    }
+
+    @Override
+    public List<PlanUser> queryPlanUser(Long id) {
+        return tlInspectionPlanMapper.queryPlanUser(id);
+    }
 }

+ 24 - 25
ruoyi-system/src/main/java/com/ruoyi/qdtl/service/impl/TlPlanRecordServiceImpl.java

@@ -1,95 +1,94 @@
 package com.ruoyi.qdtl.service.impl;
 
-import java.util.List;
 import com.ruoyi.common.utils.DateUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import com.ruoyi.qdtl.mapper.TlPlanRecordMapper;
 import com.ruoyi.qdtl.domain.TlPlanRecord;
+import com.ruoyi.qdtl.mapper.TlPlanRecordMapper;
 import com.ruoyi.qdtl.service.ITlPlanRecordService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
 
 /**
  * 巡检计划记录Service业务层处理
- * 
+ *
  * @author ruoyi
  * @date 2022-03-30
  */
 @Service
-public class TlPlanRecordServiceImpl implements ITlPlanRecordService 
-{
+public class TlPlanRecordServiceImpl implements ITlPlanRecordService {
     @Autowired
     private TlPlanRecordMapper tlPlanRecordMapper;
 
     /**
      * 查询巡检计划记录
-     * 
+     *
      * @param id 巡检计划记录主键
      * @return 巡检计划记录
      */
     @Override
-    public TlPlanRecord selectTlPlanRecordById(Long id)
-    {
+    public TlPlanRecord selectTlPlanRecordById(Long id) {
         return tlPlanRecordMapper.selectTlPlanRecordById(id);
     }
 
     /**
      * 查询巡检计划记录列表
-     * 
+     *
      * @param tlPlanRecord 巡检计划记录
      * @return 巡检计划记录
      */
     @Override
-    public List<TlPlanRecord> selectTlPlanRecordList(TlPlanRecord tlPlanRecord)
-    {
+    public List<TlPlanRecord> selectTlPlanRecordList(TlPlanRecord tlPlanRecord) {
         return tlPlanRecordMapper.selectTlPlanRecordList(tlPlanRecord);
     }
 
     /**
      * 新增巡检计划记录
-     * 
+     *
      * @param tlPlanRecord 巡检计划记录
      * @return 结果
      */
     @Override
-    public int insertTlPlanRecord(TlPlanRecord tlPlanRecord)
-    {
+    public int insertTlPlanRecord(TlPlanRecord tlPlanRecord) {
         tlPlanRecord.setCreateTime(DateUtils.getNowDate());
         return tlPlanRecordMapper.insertTlPlanRecord(tlPlanRecord);
     }
 
     /**
      * 修改巡检计划记录
-     * 
+     *
      * @param tlPlanRecord 巡检计划记录
      * @return 结果
      */
     @Override
-    public int updateTlPlanRecord(TlPlanRecord tlPlanRecord)
-    {
+    public int updateTlPlanRecord(TlPlanRecord tlPlanRecord) {
         return tlPlanRecordMapper.updateTlPlanRecord(tlPlanRecord);
     }
 
     /**
      * 批量删除巡检计划记录
-     * 
+     *
      * @param ids 需要删除的巡检计划记录主键
      * @return 结果
      */
     @Override
-    public int deleteTlPlanRecordByIds(Long[] ids)
-    {
+    public int deleteTlPlanRecordByIds(Long[] ids) {
         return tlPlanRecordMapper.deleteTlPlanRecordByIds(ids);
     }
 
     /**
      * 删除巡检计划记录信息
-     * 
+     *
      * @param id 巡检计划记录主键
      * @return 结果
      */
     @Override
-    public int deleteTlPlanRecordById(Long id)
-    {
+    public int deleteTlPlanRecordById(Long id) {
         return tlPlanRecordMapper.deleteTlPlanRecordById(id);
     }
+
+    @Override
+    public void batchInsert(List<TlPlanRecord> planRecords) {
+        tlPlanRecordMapper.batchInsert(planRecords);
+    }
 }

+ 2 - 1
ruoyi-system/src/main/resources/mapper/qdtl/TlInspectionLocationMapper.xml

@@ -81,7 +81,8 @@
         lnglat,
         remark,
         t1.sort_no sortNo,
-        t1.line_id lineId
+        t1.line_id lineId,
+        t1.location_id locationId
         from tl_inspection_line_location t1
         left join tl_inspection_location t2 on t1.location_id = t2.id
         where del_flag = 0

+ 58 - 26
ruoyi-system/src/main/resources/mapper/qdtl/TlInspectionPlanMapper.xml

@@ -1,43 +1,72 @@
 <?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">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.qdtl.mapper.TlInspectionPlanMapper">
-    
+
     <resultMap type="TlInspectionPlan" id="TlInspectionPlanResult">
-        <result property="id"    column="id"    />
-        <result property="planCode"    column="plan_code"    />
-        <result property="planName"    column="plan_name"    />
-        <result property="planType"    column="plan_type"    />
-        <result property="startDate"    column="start_date"    />
-        <result property="endDate"    column="end_date"    />
-        <result property="lineId"    column="line_id"    />
-        <result property="score"    column="score"    />
-        <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="id" column="id"/>
+        <result property="planCode" column="plan_code"/>
+        <result property="planName" column="plan_name"/>
+        <result property="planType" column="plan_type"/>
+        <result property="startDate" column="start_date"/>
+        <result property="endDate" column="end_date"/>
+        <result property="lineId" column="line_id"/>
+        <result property="status" column="status"/>
+        <result property="score" column="score"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
     </resultMap>
 
     <sql id="selectTlInspectionPlanVo">
-        select id, plan_code, plan_name, plan_type, start_date, end_date, line_id, score, create_by, create_time, update_by, update_time from tl_inspection_plan
+        select id,
+               plan_code,
+               plan_name,
+               plan_type,
+               start_date,
+               end_date,
+               line_id,
+               score,
+               status,
+               create_by,
+               create_time,
+               update_by,
+               update_time
+        from tl_inspection_plan
     </sql>
 
     <select id="selectTlInspectionPlanList" parameterType="TlInspectionPlan" resultMap="TlInspectionPlanResult">
         <include refid="selectTlInspectionPlanVo"/>
-        <where>  
-            <if test="planCode != null  and planCode != ''"> and plan_code like concat('%', #{planCode}, '%')</if>
-            <if test="planName != null  and planName != ''"> and plan_name like concat('%', #{planName}, '%')</if>
-            <if test="planType != null  and planType != ''"> and plan_type = #{planType}</if>
+        <where>
+            <if test="planCode != null  and planCode != ''">and plan_code like concat('%', #{planCode}, '%')</if>
+            <if test="planName != null  and planName != ''">and plan_name like concat('%', #{planName}, '%')</if>
+            <if test="planType != null  and planType != ''">and plan_type = #{planType}</if>
+            and status != '3'
         </where>
         order by create_time desc
     </select>
-    
+
     <select id="selectTlInspectionPlanById" parameterType="Long" resultMap="TlInspectionPlanResult">
         <include refid="selectTlInspectionPlanVo"/>
         where id = #{id}
+        and status != '3'
+    </select>
+
+    <select id="queryPlanByDate" resultMap="TlInspectionPlanResult">
+        <include refid="selectTlInspectionPlanVo"/>
+        where status = '1' and start_date &lt;= #{queryDate} and end_date &gt;= #{queryDate}
     </select>
-        
+
+    <select id="queryPlanUser" resultType="com.ruoyi.qdtl.domain.PlanUser">
+        select plan_id as planId, t1.user_id as userId, t1.nick_name as nickName, patrolman as card
+        from tl_inspection_plan_user t1
+                 left join sys_user t2 on t1.user_id = t2.user_id
+        where t1.plan_id = #{id}
+          and t2.patrolman != '';
+    </select>
+
     <insert id="insertTlInspectionPlan" parameterType="TlInspectionPlan" useGeneratedKeys="true" keyProperty="id">
         insert into tl_inspection_plan
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -52,7 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">create_time,</if>
             <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="planCode != null">#{planCode},</if>
             <if test="planName != null">#{planName},</if>
@@ -65,7 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
-         </trim>
+        </trim>
     </insert>
 
     <update id="updateTlInspectionPlan" parameterType="TlInspectionPlan">
@@ -78,6 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="endDate != null">end_date = #{endDate},</if>
             <if test="lineId != null">line_id = #{lineId},</if>
             <if test="score != null">score = #{score},</if>
+            <if test="status != null">status = #{status},</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>
@@ -87,11 +117,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
     <delete id="deleteTlInspectionPlanById" parameterType="Long">
-        delete from tl_inspection_plan where id = #{id}
+        delete
+        from tl_inspection_plan
+        where id = #{id}
     </delete>
 
     <delete id="deleteTlInspectionPlanByIds" parameterType="String">
-        delete from tl_inspection_plan where id in 
+        delete from tl_inspection_plan where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>

+ 64 - 33
ruoyi-system/src/main/resources/mapper/qdtl/TlPlanRecordMapper.xml

@@ -1,49 +1,61 @@
 <?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">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.qdtl.mapper.TlPlanRecordMapper">
-    
+
     <resultMap type="TlPlanRecord" id="TlPlanRecordResult">
-        <result property="id"    column="id"    />
-        <result property="planId"    column="plan_id"    />
-        <result property="planDate"    column="plan_date"    />
-        <result property="planName"    column="plan_name"    />
-        <result property="userId"    column="user_id"    />
-        <result property="nickName"    column="nick_name"    />
-        <result property="card"    column="card"    />
-        <result property="checkpointCard"    column="checkpoint_card"    />
-        <result property="deviceCode"    column="device_code"    />
-        <result property="fence"    column="fence"    />
-        <result property="createTime"    column="create_time"    />
-        <result property="score"    column="score"    />
+        <result property="id" column="id"/>
+        <result property="planId" column="plan_id"/>
+        <result property="planDate" column="plan_date"/>
+        <result property="planName" column="plan_name"/>
+        <result property="userId" column="user_id"/>
+        <result property="nickName" column="nick_name"/>
+        <result property="card" column="card"/>
+        <result property="checkpointCard" column="checkpoint_card"/>
+        <result property="deviceCode" column="device_code"/>
+        <result property="fence" column="fence"/>
+        <result property="createTime" column="create_time"/>
+        <result property="score" column="score"/>
     </resultMap>
 
     <sql id="selectTlPlanRecordVo">
-        select id, plan_id, plan_date, plan_name, user_id, nick_name, card, checkpoint_card, device_code, fence, create_time, score from tl_plan_record
+        select id,
+               plan_id,
+               plan_date,
+               plan_name,
+               user_id,
+               nick_name,
+               card,
+               checkpoint_card,
+               device_code,
+               fence,
+               create_time,
+               score
+        from tl_plan_record
     </sql>
 
     <select id="selectTlPlanRecordList" parameterType="TlPlanRecord" resultMap="TlPlanRecordResult">
         <include refid="selectTlPlanRecordVo"/>
-        <where>  
-            <if test="planId != null "> and plan_id = #{planId}</if>
-            <if test="planDate != null  and planDate != ''"> and plan_date = #{planDate}</if>
-            <if test="planName != null  and planName != ''"> and plan_name like concat('%', #{planName}, '%')</if>
-            <if test="userId != null "> and user_id = #{userId}</if>
-            <if test="nickName != null  and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
-            <if test="card != null  and card != ''"> and card = #{card}</if>
-            <if test="checkpointCard != null  and checkpointCard != ''"> and checkpoint_card = #{checkpointCard}</if>
-            <if test="deviceCode != null  and deviceCode != ''"> and device_code = #{deviceCode}</if>
-            <if test="fence != null  and fence != ''"> and fence = #{fence}</if>
-            <if test="score != null  and score != ''"> and score = #{score}</if>
+        <where>
+            <if test="planId != null ">and plan_id = #{planId}</if>
+            <if test="planDate != null  and planDate != ''">and plan_date = #{planDate}</if>
+            <if test="planName != null  and planName != ''">and plan_name like concat('%', #{planName}, '%')</if>
+            <if test="userId != null ">and user_id = #{userId}</if>
+            <if test="nickName != null  and nickName != ''">and nick_name like concat('%', #{nickName}, '%')</if>
+            <if test="card != null  and card != ''">and card = #{card}</if>
+            <if test="checkpointCard != null  and checkpointCard != ''">and checkpoint_card = #{checkpointCard}</if>
+            <if test="deviceCode != null  and deviceCode != ''">and device_code = #{deviceCode}</if>
+            <if test="fence != null  and fence != ''">and fence = #{fence}</if>
+            <if test="score != null  and score != ''">and score = #{score}</if>
         </where>
     </select>
-    
+
     <select id="selectTlPlanRecordById" parameterType="Long" resultMap="TlPlanRecordResult">
         <include refid="selectTlPlanRecordVo"/>
         where id = #{id}
     </select>
-        
+
     <insert id="insertTlPlanRecord" parameterType="TlPlanRecord" useGeneratedKeys="true" keyProperty="id">
         insert into tl_plan_record
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -58,7 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="fence != null">fence,</if>
             <if test="createTime != null">create_time,</if>
             <if test="score != null">score,</if>
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="planId != null">#{planId},</if>
             <if test="planDate != null">#{planDate},</if>
@@ -71,7 +83,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="fence != null">#{fence},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="score != null">#{score},</if>
-         </trim>
+        </trim>
+    </insert>
+
+    <insert id="batchInsert">
+        insert into tl_plan_record
+        (plan_id, plan_date, plan_name, user_id, nick_name, card, score)
+        values
+        <foreach collection="list" item="item" separator=",">
+            (
+            #{item.planId},
+            #{item.planDate},
+            #{item.planName},
+            #{item.userId},
+            #{item.nickName},
+            #{item.card},
+            #{item.score}
+            )
+        </foreach>
     </insert>
 
     <update id="updateTlPlanRecord" parameterType="TlPlanRecord">
@@ -93,11 +122,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
     <delete id="deleteTlPlanRecordById" parameterType="Long">
-        delete from tl_plan_record where id = #{id}
+        delete
+        from tl_plan_record
+        where id = #{id}
     </delete>
 
     <delete id="deleteTlPlanRecordByIds" parameterType="String">
-        delete from tl_plan_record where id in 
+        delete from tl_plan_record where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>

+ 24 - 0
sql/ry_20210908.sql

@@ -993,6 +993,30 @@ create table tl_inspection_device_trail
 ) engine = innodb
   auto_increment = 100000 comment = '设备轨迹';
 
+
+create table tl_patrolman
+(
+    id        bigint(20) not null auto_increment comment 'id',
+    name      varchar(40) comment '巡检员姓名',
+    card      varchar(40) comment '巡检员卡号',
+    area_id   varchar(20) comment '组织id',
+    area_name varchar(40) comment '组织名称',
+    third_id  varchar(20) comment '第三方id',
+    version   int default 0 comment '同步版本',
+    primary key (id),
+    index     `idx_third_id` (`third_id`),
+    index     `idx_card` (`card`)
+) engine = innodb
+  auto_increment = 100000 comment = '巡检员';
+
+
+alter table tl_inspection_plan
+    add status varchar(5) default '1' null comment '计划状态。1-计划中、2-计划暂停、3-计划删除';
+
+alter table sys_user
+    add patrolman varchar(20) null comment '巡检员绑定的卡号';
+
 -- 已同步
 
 
+