@@ -29,7 +29,7 @@ public class InspectionController { | |||
* 查询巡检任务分页列表 | |||
*/ | |||
@GetMapping("/page/list") | |||
public JsonResult list(@RequestBody QueryInspectionPageListRequest request) { | |||
public JsonResult list(QueryInspectionPageListRequest request) { | |||
log.info("进入查询巡检任务分页列表接口"); | |||
return iInspectionService.selectPageList(request); | |||
} | |||
@@ -100,11 +100,20 @@ public class InspectionController { | |||
} | |||
/** | |||
* 删除巡检任务 | |||
* 重新提交巡检任务 | |||
*/ | |||
@PostMapping("/resubmit") | |||
public JsonResult resubmit(@RequestBody EditInspectionRequest editInspectionRequest) { | |||
log.info("进入重新提交任务接口, id={}", editInspectionRequest.getId()); | |||
return iInspectionService.resubmit(editInspectionRequest); | |||
} | |||
/** | |||
* 立即执行 | |||
*/ | |||
@PostMapping("/execute/{id}") | |||
public JsonResult execute(@PathVariable("id") String id) { | |||
log.info("进入立即执行任务接口, id={}", id); | |||
return iInspectionService.execute(id); | |||
} | |||
} |
@@ -27,7 +27,6 @@ public enum ResubmitInspectionCodeEnum { | |||
END_LATITUDE_IS_NULL(1230713, "终点纬度为空"), | |||
INSPECTION_TIME_IS_NULL(1230714, "巡检时间为空"), | |||
INSPECTION_IS_NOT_EXIST(1230715, "任务不存在"), | |||
FAILED_INSPECTION_CANNOT_RESUBMIT(1230716, "非失败的任务不能被重新提交"), | |||
TYPE_IS_NOT_EDIT(1230717, "巡检类型不能被修改"), | |||
INSPECTION_TYPE_IS_NOT_EDIT(1230718, "巡检方式不能被修改"), |
@@ -84,4 +84,12 @@ public interface IInspectionService { | |||
*/ | |||
JsonResult resubmit(EditInspectionRequest editInspectionRequest); | |||
/** | |||
* 立即执行 | |||
* | |||
* @param id 任务id | |||
* @return 结果 | |||
*/ | |||
JsonResult execute(String id); | |||
} |
@@ -6,6 +6,7 @@ import com.tuoheng.admin.request.inspection.AddInspectionRequest; | |||
import com.tuoheng.admin.request.inspection.EditInspectionRequest; | |||
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | |||
import com.tuoheng.admin.service.inspection.add.AddInspectionService; | |||
import com.tuoheng.admin.service.inspection.execute.ExecuteInspectionService; | |||
import com.tuoheng.admin.service.inspection.resubmit.ResubmitInspectionService; | |||
import com.tuoheng.admin.service.inspection.delete.DeleteInspectionService; | |||
import com.tuoheng.admin.service.inspection.query.*; | |||
@@ -56,6 +57,9 @@ public class InspectionServiceImpl implements IInspectionService { | |||
@Autowired | |||
private ResubmitInspectionService resubmitInspectionService; | |||
@Autowired | |||
private ExecuteInspectionService executeInspectionService; | |||
/** | |||
* 查询巡检任务分页分页列表 | |||
* | |||
@@ -161,4 +165,16 @@ public class InspectionServiceImpl implements IInspectionService { | |||
public JsonResult resubmit(EditInspectionRequest editInspectionRequest) { | |||
return resubmitInspectionService.resubmit(editInspectionRequest); | |||
} | |||
/** | |||
* 立即执行 | |||
* | |||
* @param id 任务id | |||
* @return 结果 | |||
*/ | |||
@Override | |||
public JsonResult execute(String id) { | |||
return executeInspectionService.execute(id); | |||
} | |||
} |
@@ -0,0 +1,84 @@ | |||
package com.tuoheng.admin.service.inspection.execute; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.tuoheng.admin.conver.InspectionConverMapper; | |||
import com.tuoheng.admin.entity.*; | |||
import com.tuoheng.admin.enums.InspectionStatusEnum; | |||
import com.tuoheng.admin.enums.InspectionTypeEnum; | |||
import com.tuoheng.admin.enums.code.inspection.ResubmitInspectionCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.request.inspection.EditInspectionRequest; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* 立即执行任务业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-01 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class ExecuteInspectionService { | |||
@Autowired | |||
private UserMapper userMapper; | |||
@Autowired | |||
private DeptMapper deptMapper; | |||
@Autowired | |||
private RoadInformationMapper roadInformationMapper; | |||
@Autowired | |||
private SectionMapper sectionMapper; | |||
@Autowired | |||
private InspectionMapper inspectionMapper; | |||
/** | |||
* 重新提交任务 | |||
* | |||
* @return | |||
*/ | |||
public JsonResult execute(String id) { | |||
log.info("进入立即执行任务业务"); | |||
String userId = ShiroUtils.getUserId(); | |||
JsonResult result = this.check(id); | |||
if (0 != result.getCode()) { | |||
log.info("立即执行任务业务:校验参数失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
Inspection inspection = (Inspection) result.getData(); | |||
log.info("立即执行任务业务:重新提交任务成功:{}", inspection); | |||
return JsonResult.success(inspection); | |||
} | |||
/** | |||
* 检查参数 | |||
* @param id | |||
* @return | |||
*/ | |||
private JsonResult check(String id) { | |||
if (StringUtils.isEmpty(id)) { | |||
return JsonResult.error(ResubmitInspectionCodeEnum.ID_IS_NULL.getCode(), ResubmitInspectionCodeEnum.ID_IS_NULL.getMsg()); | |||
} | |||
Inspection inspection = inspectionMapper.selectById(id); | |||
if (null == inspection) { | |||
return JsonResult.error(ResubmitInspectionCodeEnum.INSPECTION_IS_NOT_EXIST.getCode(), ResubmitInspectionCodeEnum.INSPECTION_IS_NOT_EXIST.getMsg()); | |||
} | |||
return JsonResult.success(inspection); | |||
} | |||
} |
@@ -1,16 +1,13 @@ | |||
package com.tuoheng.admin.service.inspection.query; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.core.metadata.OrderItem; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.conver.InspectionConverMapper; | |||
import com.tuoheng.admin.entity.Dept; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.enums.UserTypeEnum; | |||
import com.tuoheng.admin.enums.code.dept.QueryDeptChildListCodeEnum; | |||
import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum; | |||
import com.tuoheng.admin.mapper.DeptMapper; | |||
import com.tuoheng.admin.mapper.InspectionFileMapper; | |||
@@ -25,7 +22,6 @@ import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Qualifier; | |||
import org.springframework.security.core.parameters.P; | |||
import org.springframework.stereotype.Service; | |||
import javax.annotation.PostConstruct; |
@@ -22,7 +22,7 @@ import org.springframework.stereotype.Service; | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-201 | |||
* @date 2022-12-01 | |||
*/ | |||
@Slf4j | |||
@Service |