巡检任务查询+巡检问题处理查询修改

master
wany 2024-09-02 11:37:39 +08:00
parent 94c35bdf00
commit 658c0c5cf6
6 changed files with 46 additions and 6 deletions

View File

@ -3,6 +3,7 @@ package com.gunshi.project.xyt.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gunshi.core.result.R; import com.gunshi.core.result.R;
import com.gunshi.project.xyt.entity.so.InspectTaskPageSo; import com.gunshi.project.xyt.entity.so.InspectTaskPageSo;
import com.gunshi.project.xyt.entity.vo.InspectTaskDetailVo;
import com.gunshi.project.xyt.model.InspectTask; import com.gunshi.project.xyt.model.InspectTask;
import com.gunshi.project.xyt.service.InspectTaskService; import com.gunshi.project.xyt.service.InspectTaskService;
import com.gunshi.project.xyt.validate.markers.Insert; import com.gunshi.project.xyt.validate.markers.Insert;
@ -14,6 +15,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* : * :
* author: xusan * author: xusan
@ -22,7 +25,7 @@ import org.springframework.web.bind.annotation.*;
@Tag(name = "巡检任务") @Tag(name = "巡检任务")
@RestController @RestController
@RequestMapping(value="/inspect/task") @RequestMapping(value="/inspect/task")
public class InspectTaskController { public class InspectTaskController extends AbstractCommonFileController{
@Autowired @Autowired
private InspectTaskService service; private InspectTaskService service;
@ -58,6 +61,15 @@ public class InspectTaskController {
return R.ok(service.startInspect(id)); return R.ok(service.startInspect(id));
} }
@Operation(summary = "结束巡查")
@PostMapping("/finish")
public R<Boolean> finish(@RequestBody @Validated List<InspectTaskDetailVo> list) {
return R.ok(service.finish(list));
}
@Override
public String getGroupId() {
return "inspectTask";
}
} }

View File

@ -28,7 +28,6 @@ public class InspectTaskDetailController {
@Autowired @Autowired
private InspectTaskDetailService service; private InspectTaskDetailService service;
@Operation(summary = "编辑详情") @Operation(summary = "编辑详情")
@GetMapping("/getByTaskId") @GetMapping("/getByTaskId")
public R<List<InspectTaskDetail>> getByTaskId(@Schema(name = "taskId",description = "任务id") @RequestParam(name = "taskId") Long taskId) { public R<List<InspectTaskDetail>> getByTaskId(@Schema(name = "taskId",description = "任务id") @RequestParam(name = "taskId") Long taskId) {
@ -46,4 +45,8 @@ public class InspectTaskDetailController {
public R<Page<InspectProblemVo>> page(@RequestBody @Validated InspectProblemPageSo page) { public R<Page<InspectProblemVo>> page(@RequestBody @Validated InspectProblemPageSo page) {
return R.ok(service.pageQuery(page)); return R.ok(service.pageQuery(page));
} }
} }

View File

@ -38,10 +38,10 @@ public interface InspectTaskDetailMapper extends BaseMapper<InspectTaskDetail> {
left join public.inspect_task t4 on t1.task_id =t4.id left join public.inspect_task t4 on t1.task_id =t4.id
<where> <where>
<if test="obj.inspectUserId != null "> <if test="obj.inspectUserId != null ">
t1.inspect_user_id = #{obj.inspectUserId} t4.inspect_user_id = #{obj.inspectUserId}
</if> </if>
<if test="obj.isHandle != null "> <if test="obj.isHandle != null ">
t1.is_handle = #{obj.isHandle} and t1.is_handle = #{obj.isHandle}
</if> </if>
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.start != null"> <if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.start != null">
and t4.finish_time <![CDATA[>=]]> #{obj.dateTimeRangeSo.start} and t4.finish_time <![CDATA[>=]]> #{obj.dateTimeRangeSo.start}

View File

@ -25,7 +25,7 @@ public interface InspectTaskMapper extends BaseMapper<InspectTask> {
t.create_user_id = #{obj.createUserId} t.create_user_id = #{obj.createUserId}
</if> </if>
<if test="obj.status != null "> <if test="obj.status != null ">
t.status = #{obj.status} and t.status = #{obj.status}
</if> </if>
<if test="obj.taskType != null "> <if test="obj.taskType != null ">
and t.task_type = #{obj.taskType} and t.task_type = #{obj.taskType}

View File

@ -10,6 +10,7 @@ import com.gunshi.project.xyt.entity.vo.InspectTaskDetailVo;
import com.gunshi.project.xyt.mapper.InspectTaskDetailMapper; import com.gunshi.project.xyt.mapper.InspectTaskDetailMapper;
import com.gunshi.project.xyt.model.InspectTaskDetail; import com.gunshi.project.xyt.model.InspectTaskDetail;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -119,6 +120,21 @@ public class InspectTaskDetailService extends ServiceImpl<InspectTaskDetailMappe
private String getHandleVideoType() { private String getHandleVideoType() {
return "handleVideo"; return "handleVideo";
} }
public void finish(List<InspectTaskDetailVo> list) {
List<InspectTaskDetail> res = new ArrayList<>();
for(InspectTaskDetailVo vo : list){
InspectTaskDetail detail = new InspectTaskDetail();
BeanUtils.copyProperties(vo,detail);
res.add(detail);
fileService.save(vo.getInspectPics(),vo.getId().toString(),getGroupId(),getPicType());
fileService.save(vo.getInspectVideos(),vo.getId().toString(),getGroupId(),getVideoType());
fileService.save(vo.getHandlePics(),vo.getId().toString(),getGroupId(),getHandlePicType());
fileService.save(vo.getHandleVideos(),vo.getId().toString(),getGroupId(),getHandleVideoType());
}
//更新任务巡检信息表
this.updateBatchById(res);
}
} }

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gunshi.project.xyt.entity.so.InspectTaskPageSo; import com.gunshi.project.xyt.entity.so.InspectTaskPageSo;
import com.gunshi.project.xyt.entity.vo.InspectTaskDetailVo;
import com.gunshi.project.xyt.mapper.InspectTaskMapper; import com.gunshi.project.xyt.mapper.InspectTaskMapper;
import com.gunshi.project.xyt.model.InspectTask; import com.gunshi.project.xyt.model.InspectTask;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -12,6 +13,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.Objects; import java.util.Objects;
/** /**
@ -69,6 +71,13 @@ public class InspectTaskService extends ServiceImpl<InspectTaskMapper, InspectTa
} }
public Boolean finish(List<InspectTaskDetailVo> list) {
inspectTaskDetailService.finish(list);
InspectTask task = this.getById(list.get(0).getTaskId());
task.setFinishTime(new Date());
task.setStatus(2);
return this.updateById(task);
}
} }