zhangjian
2023-05-30 686affcacf0d761610ccc00da111a2f0fdd0d27f
视频巡检任务 重新生成表
已修改7个文件
192 ■■■■ 文件已修改
ard-work/src/main/java/com/ruoyi/inspect/controller/ArdVideoInspectTaskController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/inspect/domain/ArdVideoInspectTask.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/inspect/domain/ArdVideoInspectTaskStep.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/inspect/mapper/ArdVideoInspectTaskMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/inspect/service/IArdVideoInspectTaskService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java 87 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/resources/mapper/inspect/ArdVideoInspectTaskMapper.xml 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/inspect/controller/ArdVideoInspectTaskController.java
@@ -25,7 +25,7 @@
 * 视频巡检任务Controller
 * 
 * @author ruoyi
 * @date 2023-05-26
 * @date 2023-05-30
 */
@RestController
@RequestMapping("/inspect/task")
ard-work/src/main/java/com/ruoyi/inspect/domain/ArdVideoInspectTask.java
@@ -10,7 +10,7 @@
 * 视频巡检任务对象 ard_video_inspect_task
 * 
 * @author ruoyi
 * @date 2023-05-26
 * @date 2023-05-30
 */
public class ArdVideoInspectTask extends BaseEntity
{
@@ -32,6 +32,7 @@
    private String endTime;
    /** 重复周期 */
    @Excel(name = "重复周期")
    private String repeatPeriod;
    /** 巡检模式 */
@@ -42,10 +43,28 @@
    @Excel(name = "手动开关")
    private String menualSwitch;
    /** 相机id */
    @Excel(name = "相机id")
    private String cameraId;
    /** 当前步骤id */
    @Excel(name = "当前步骤id")
    private String currentStepId;
    /** 当前步骤开始时间 */
    @Excel(name = "当前步骤开始时间")
    private String currentStepStartTime;
    /** 通道 */
    @Excel(name = "通道")
    private String channel;
    /** 部门id */
    @Excel(name = "部门id")
    private String deptId;
    /** 用户id */
    @Excel(name = "用户id")
    private String userId;
    /** 视频巡检步骤信息 */
@@ -114,6 +133,42 @@
    {
        return menualSwitch;
    }
    public void setCameraId(String cameraId)
    {
        this.cameraId = cameraId;
    }
    public String getCameraId()
    {
        return cameraId;
    }
    public void setCurrentStepId(String currentStepId)
    {
        this.currentStepId = currentStepId;
    }
    public String getCurrentStepId()
    {
        return currentStepId;
    }
    public void setCurrentStepStartTime(String currentStepStartTime)
    {
        this.currentStepStartTime = currentStepStartTime;
    }
    public String getCurrentStepStartTime()
    {
        return currentStepStartTime;
    }
    public void setChannel(String channel)
    {
        this.channel = channel;
    }
    public String getChannel()
    {
        return channel;
    }
    public void setDeptId(String deptId) 
    {
        this.deptId = deptId;
@@ -154,6 +209,10 @@
            .append("inspectMode", getInspectMode())
            .append("menualSwitch", getMenualSwitch())
            .append("createBy", getCreateBy())
            .append("cameraId", getCameraId())
            .append("currentStepId", getCurrentStepId())
            .append("currentStepStartTime", getCurrentStepStartTime())
            .append("channel", getChannel())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
ard-work/src/main/java/com/ruoyi/inspect/domain/ArdVideoInspectTaskStep.java
@@ -9,7 +9,7 @@
 * 视频巡检步骤对象 ard_video_inspect_task_step
 * 
 * @author ruoyi
 * @date 2023-05-26
 * @date 2023-05-30
 */
public class ArdVideoInspectTaskStep extends BaseEntity
{
ard-work/src/main/java/com/ruoyi/inspect/mapper/ArdVideoInspectTaskMapper.java
@@ -8,7 +8,7 @@
 * 视频巡检任务Mapper接口
 * 
 * @author ruoyi
 * @date 2023-05-26
 * @date 2023-05-30
 */
public interface ArdVideoInspectTaskMapper 
{
ard-work/src/main/java/com/ruoyi/inspect/service/IArdVideoInspectTaskService.java
@@ -7,7 +7,7 @@
 * 视频巡检任务Service接口
 * 
 * @author ruoyi
 * @date 2023-05-26
 * @date 2023-05-30
 */
public interface IArdVideoInspectTaskService 
{
ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java
@@ -1,19 +1,16 @@
package com.ruoyi.inspect.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
        import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
    import java.util.ArrayList;
import java.util.ArrayList;
import java.util.UUID;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.inspect.domain.ArdVideoInspectTaskStep;
    import com.ruoyi.common.utils.StringUtils;
    import com.ruoyi.common.utils.SecurityUtils;
    import org.springframework.transaction.annotation.Transactional;
    import com.ruoyi.inspect.domain.ArdVideoInspectTaskStep;
import com.ruoyi.inspect.mapper.ArdVideoInspectTaskMapper;
import com.ruoyi.inspect.domain.ArdVideoInspectTask;
import com.ruoyi.inspect.service.IArdVideoInspectTaskService;
@@ -22,7 +19,7 @@
 * 视频巡检任务Service业务层处理
 *
 * @author ruoyi
 * @date 2023-05-26
 * @date 2023-05-30
 */
@Service
public class ArdVideoInspectTaskServiceImpl implements IArdVideoInspectTaskService {
@@ -57,16 +54,15 @@
     * @param ardVideoInspectTask 视频巡检任务
     * @return 结果
     */
    @Transactional
        @Transactional
    @Override
    public int insertArdVideoInspectTask(ArdVideoInspectTask ardVideoInspectTask) {
        ardVideoInspectTask.setCreateBy(SecurityUtils.getUsername());
        ardVideoInspectTask.setCreateTime(DateUtils.getNowDate());
        ardVideoInspectTask.setUserId(SecurityUtils.getUserId());
        ardVideoInspectTask.setId(UUID.randomUUID().toString());//task 主键 UUID
        int rows = ardVideoInspectTaskMapper.insertArdVideoInspectTask(ardVideoInspectTask);
        insertArdVideoInspectTaskStep(ardVideoInspectTask);
        return rows;
                ardVideoInspectTask.setCreateBy(SecurityUtils.getUsername());
                ardVideoInspectTask.setCreateTime(DateUtils.getNowDate());
                ardVideoInspectTask.setUserId(SecurityUtils.getUserId());
            int rows = ardVideoInspectTaskMapper.insertArdVideoInspectTask(ardVideoInspectTask);
            insertArdVideoInspectTaskStep(ardVideoInspectTask);
            return rows;
    }
    /**
@@ -75,14 +71,14 @@
     * @param ardVideoInspectTask 视频巡检任务
     * @return 结果
     */
    @Transactional
        @Transactional
    @Override
    public int updateArdVideoInspectTask(ArdVideoInspectTask ardVideoInspectTask) {
        ardVideoInspectTask.setUpdateBy(SecurityUtils.getUsername());
        ardVideoInspectTask.setUpdateTime(DateUtils.getNowDate());
        ardVideoInspectTaskMapper.deleteArdVideoInspectTaskStepByTaskId(ardVideoInspectTask.getId())
        ;
        insertArdVideoInspectTaskStep(ardVideoInspectTask);
                ardVideoInspectTask.setUpdateBy(SecurityUtils.getUsername());
                ardVideoInspectTask.setUpdateTime(DateUtils.getNowDate());
                ardVideoInspectTaskMapper.deleteArdVideoInspectTaskStepByTaskId(ardVideoInspectTask.getId())
            ;
            insertArdVideoInspectTaskStep(ardVideoInspectTask);
        return ardVideoInspectTaskMapper.updateArdVideoInspectTask(ardVideoInspectTask);
    }
@@ -92,10 +88,10 @@
     * @param ids 需要删除的视频巡检任务主键
     * @return 结果
     */
    @Transactional
        @Transactional
    @Override
    public int deleteArdVideoInspectTaskByIds(String[] ids) {
        ardVideoInspectTaskMapper.deleteArdVideoInspectTaskStepByTaskIds(ids);
                ardVideoInspectTaskMapper.deleteArdVideoInspectTaskStepByTaskIds(ids);
        return ardVideoInspectTaskMapper.deleteArdVideoInspectTaskByIds(ids);
    }
@@ -105,30 +101,31 @@
     * @param id 视频巡检任务主键
     * @return 结果
     */
    @Transactional
        @Transactional
    @Override
    public int deleteArdVideoInspectTaskById(String id) {
        ardVideoInspectTaskMapper.deleteArdVideoInspectTaskStepByTaskId(id);
                ardVideoInspectTaskMapper.deleteArdVideoInspectTaskStepByTaskId(id);
        return ardVideoInspectTaskMapper.deleteArdVideoInspectTaskById(id);
    }
    /**
     * 新增视频巡检步骤信息
     *
     * @param ardVideoInspectTask 视频巡检任务对象
     */
    public void insertArdVideoInspectTaskStep(ArdVideoInspectTask ardVideoInspectTask) {
        List<ArdVideoInspectTaskStep> ardVideoInspectTaskStepList = ardVideoInspectTask.getArdVideoInspectTaskStepList();
        String id = ardVideoInspectTask.getId();
        if (StringUtils.isNotNull(ardVideoInspectTaskStepList)) {
            List<ArdVideoInspectTaskStep> list = new ArrayList<ArdVideoInspectTaskStep>();
            for (ArdVideoInspectTaskStep ardVideoInspectTaskStep : ardVideoInspectTaskStepList) {
                ardVideoInspectTaskStep.setTaskId(id);
                list.add(ardVideoInspectTaskStep);
            }
            if (list.size() > 0) {
                ardVideoInspectTaskMapper.batchArdVideoInspectTaskStep(list);
        /**
         * 新增视频巡检步骤信息
         *
         * @param ardVideoInspectTask 视频巡检任务对象
         */
        public void insertArdVideoInspectTaskStep(ArdVideoInspectTask ardVideoInspectTask) {
            List<ArdVideoInspectTaskStep> ardVideoInspectTaskStepList = ardVideoInspectTask.getArdVideoInspectTaskStepList();
            String id = ardVideoInspectTask.getId();
            if (StringUtils.isNotNull(ardVideoInspectTaskStepList)) {
                List<ArdVideoInspectTaskStep> list = new ArrayList<ArdVideoInspectTaskStep>();
                for (ArdVideoInspectTaskStep ardVideoInspectTaskStep :ardVideoInspectTaskStepList)
                {
                    ardVideoInspectTaskStep.setTaskId(id);
                    list.add(ardVideoInspectTaskStep);
                }
                if (list.size() > 0) {
                        ardVideoInspectTaskMapper.batchArdVideoInspectTaskStep(list);
                }
            }
        }
    }
}
ard-work/src/main/resources/mapper/inspect/ArdVideoInspectTaskMapper.xml
@@ -13,6 +13,10 @@
        <result property="inspectMode"    column="inspect_mode"    />
        <result property="menualSwitch"    column="menual_switch"    />
        <result property="createBy"    column="create_by"    />
        <result property="cameraId"    column="camera_id"    />
        <result property="currentStepId"    column="current_step_id"    />
        <result property="currentStepStartTime"    column="current_step_start_time"    />
        <result property="channel"    column="channel"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
@@ -36,23 +40,29 @@
    </resultMap>
    <sql id="selectArdVideoInspectTaskVo">
        select id, task_name, start_time, end_time, repeat_period, inspect_mode, menual_switch, create_by, create_time, update_by, update_time, dept_id, user_id from ard_video_inspect_task
        select id, task_name, start_time, end_time, repeat_period, inspect_mode, menual_switch, create_by, camera_id, current_step_id, current_step_start_time, channel, create_time, update_by, update_time, dept_id, user_id from ard_video_inspect_task
    </sql>
    <select id="selectArdVideoInspectTaskList" parameterType="ArdVideoInspectTask" resultMap="ArdVideoInspectTaskResult">
        <include refid="selectArdVideoInspectTaskVo"/>
        <where>  
            <if test="taskName != null  and taskName != ''"> and task_name like '%'||#{taskName}||'%'</if>
            <if test="startTime != null  and startTime != ''"> and start_time = #{startTime}</if>
            <if test="endTime != null  and endTime != ''"> and end_time = #{endTime}</if>
            <if test="params.beginStartTime != null and params.beginStartTime != '' and params.endStartTime != null and params.endStartTime != ''"> and start_time between #{params.beginStartTime} and #{params.endStartTime}</if>
            <if test="params.beginEndTime != null and params.beginEndTime != '' and params.endEndTime != null and params.endEndTime != ''"> and end_time between #{params.beginEndTime} and #{params.endEndTime}</if>
            <if test="repeatPeriod != null  and repeatPeriod != ''"> and repeat_period = #{repeatPeriod}</if>
            <if test="inspectMode != null  and inspectMode != ''"> and inspect_mode = #{inspectMode}</if>
            <if test="menualSwitch != null  and menualSwitch != ''"> and menual_switch = #{menualSwitch}</if>
            <if test="cameraId != null  and cameraId != ''"> and camera_id = #{cameraId}</if>
            <if test="currentStepId != null  and currentStepId != ''"> and current_step_id = #{currentStepId}</if>
            <if test="currentStepStartTime != null  and currentStepStartTime != ''"> and current_step_start_time = #{currentStepStartTime}</if>
            <if test="channel != null  and channel != ''"> and channel = #{channel}</if>
            <if test="deptId != null  and deptId != ''"> and dept_id = #{deptId}</if>
            <if test="userId != null  and userId != ''"> and user_id = #{userId}</if>
        </where>
        ORDER BY start_time desc
    </select>
    
    <select id="selectArdVideoInspectTaskById" parameterType="String" resultMap="ArdVideoInspectTaskArdVideoInspectTaskStepResult">
        select a.id, a.task_name, a.start_time, a.end_time, a.repeat_period, a.inspect_mode, a.menual_switch, a.create_by, a.create_time, a.update_by, a.update_time, a.dept_id, a.user_id,
        select a.id, a.task_name, a.start_time, a.end_time, a.repeat_period, a.inspect_mode, a.menual_switch, a.create_by, a.camera_id, a.current_step_id, a.current_step_start_time, a.channel, a.create_time, a.update_by, a.update_time, a.dept_id, a.user_id,
 b.id as sub_id, b.order_number as sub_order_number, b.camera_id as sub_camera_id, b.recording_time as sub_recording_time, b.well_id as sub_well_id, b.task_id as sub_task_id, b.dept_id as sub_dept_id, b.user_id as sub_user_id
        from ard_video_inspect_task a
        left join ard_video_inspect_task_step b on b.task_id = a.id
@@ -70,6 +80,10 @@
            <if test="inspectMode != null">inspect_mode,</if>
            <if test="menualSwitch != null">menual_switch,</if>
            <if test="createBy != null">create_by,</if>
            <if test="cameraId != null">camera_id,</if>
            <if test="currentStepId != null">current_step_id,</if>
            <if test="currentStepStartTime != null">current_step_start_time,</if>
            <if test="channel != null">channel,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
@@ -85,6 +99,10 @@
            <if test="inspectMode != null">#{inspectMode},</if>
            <if test="menualSwitch != null">#{menualSwitch},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="cameraId != null">#{cameraId},</if>
            <if test="currentStepId != null">#{currentStepId},</if>
            <if test="currentStepStartTime != null">#{currentStepStartTime},</if>
            <if test="channel != null">#{channel},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
@@ -103,6 +121,10 @@
            <if test="inspectMode != null">inspect_mode = #{inspectMode},</if>
            <if test="menualSwitch != null">menual_switch = #{menualSwitch},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="cameraId != null">camera_id = #{cameraId},</if>
            <if test="currentStepId != null">current_step_id = #{currentStepId},</if>
            <if test="currentStepStartTime != null">current_step_start_time = #{currentStepStartTime},</if>
            <if test="channel != null">channel = #{channel},</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>
@@ -135,9 +157,9 @@
    </delete>
    <insert id="batchArdVideoInspectTaskStep">
        insert into ard_video_inspect_task_step(  order_number, camera_id, recording_time, well_id, task_id, dept_id, user_id) values
        insert into ard_video_inspect_task_step( id, order_number, camera_id, recording_time, well_id, task_id, dept_id, user_id) values
        <foreach item="item" index="index" collection="list" separator=",">
            (  #{item.orderNumber}, #{item.cameraId}, #{item.recordingTime}, #{item.wellId}, #{item.taskId}, #{item.deptId}, #{item.userId})
            ( #{item.id}, #{item.orderNumber}, #{item.cameraId}, #{item.recordingTime}, #{item.wellId}, #{item.taskId}, #{item.deptId}, #{item.userId})
        </foreach>
    </insert>
</mapper>