Browse Source

新增重新开始接口

master
鲲鹏 4 years ago
parent
commit
011d3e7df7
3 changed files with 60 additions and 4 deletions
  1. +15
    -3
      src/main/java/com/taauav/app/controller/InspectAppController.java
  2. +8
    -0
      src/main/java/com/taauav/app/service/IInspectAppService.java
  3. +37
    -1
      src/main/java/com/taauav/app/service/impl/InspectAppServiceImpl.java

+ 15
- 3
src/main/java/com/taauav/app/controller/InspectAppController.java View File

@@ -50,14 +50,26 @@ public class InspectAppController extends ApiBaseController {
/**
* 巡检暂停
*
* @param inspectEndDto 参数
* @param inspectPauseDto 参数
* @return
*/
@PostMapping("/inspectPause")
public Response inspectPause(@RequestBody InspectPauseDto inspectEndDto) {
return inspectAppService.inspectPause(inspectEndDto);
public Response inspectPause(@RequestBody InspectPauseDto inspectPauseDto) {
return inspectAppService.inspectPause(inspectPauseDto);
}

/**
* 重新开始
*
* @param inspectPauseDto 参数
* @return
*/
@PostMapping("/inspectReStart")
public Response inspectReStart(@RequestBody InspectPauseDto inspectPauseDto) {
return inspectAppService.inspectReStart(inspectPauseDto);
}


/**
* 获取巡检记录列表
*

+ 8
- 0
src/main/java/com/taauav/app/service/IInspectAppService.java View File

@@ -42,6 +42,14 @@ public interface IInspectAppService extends IService<TauvInspectApp> {
*/
Response inspectPause(InspectPauseDto inspectPauseDto);

/**
* 巡检重新开始
*
* @param inspectPauseDto 参数
* @return
*/
Response inspectReStart(InspectPauseDto inspectPauseDto);

/**
* 获取巡检记录列表
*

+ 37
- 1
src/main/java/com/taauav/app/service/impl/InspectAppServiceImpl.java View File

@@ -164,6 +164,9 @@ public class InspectAppServiceImpl extends ServiceImpl<InspectAppMapper, TauvIns
if (inspectApp == null) {
return response.failure("巡检任务不存在");
}
if (inspectApp.getStatus() == 3) {
return response.failure("当前任务已结束,无需再次结束");
}
inspectApp.setStatus(3);
inspectApp.setEndTime(DateUtil.now());
int result = inspectAppMapper.updateById(inspectApp);
@@ -189,7 +192,10 @@ public class InspectAppServiceImpl extends ServiceImpl<InspectAppMapper, TauvIns
if (inspectApp == null) {
return response.failure("巡检任务不存在");
}
inspectApp.setStatus(3);
if (inspectApp.getStatus() != 1) {
return response.failure("当前任务无法暂停");
}
inspectApp.setStatus(2);
int result = inspectAppMapper.updateById(inspectApp);
if (result == 0) {
return response.failure("巡检任务状态更新失败");
@@ -197,6 +203,36 @@ public class InspectAppServiceImpl extends ServiceImpl<InspectAppMapper, TauvIns
return response.success("巡检暂停成功");
}

/**
* 重新开启巡检
*
* @param inspectPauseDto 参数
* @return
*/
@Override
public Response inspectReStart(InspectPauseDto inspectPauseDto) {
// 巡检ID验证
if (inspectPauseDto.getInspectId() == null || inspectPauseDto.getInspectId() <= 0) {
return response.failure("巡检任务不存在");
}
TauvInspectApp inspectApp = inspectAppMapper.selectById(inspectPauseDto.getInspectId());
if (inspectApp == null) {
return response.failure("巡检任务不存在");
}
if (inspectApp.getStatus() == 1) {
return response.failure("当前任务正在进行中,无需重新开始");
}
if (inspectApp.getStatus() == 3) {
return response.failure("当前任务已完整,无法重新开始");
}
inspectApp.setStatus(1);
int result = inspectAppMapper.updateById(inspectApp);
if (result == 0) {
return response.failure("操作失败");
}
return response.success("操作成功");
}

/**
* 获取巡检记录列表
*

Loading…
Cancel
Save