* 查询巡检任务分页列表 | * 查询巡检任务分页列表 | ||||
*/ | */ | ||||
@GetMapping("/page/list") | @GetMapping("/page/list") | ||||
public JsonResult list(@RequestBody QueryInspectionPageListRequest request) { | |||||
public JsonResult list(QueryInspectionPageListRequest request) { | |||||
log.info("进入查询巡检任务分页列表接口"); | log.info("进入查询巡检任务分页列表接口"); | ||||
return iInspectionService.selectPageList(request); | return iInspectionService.selectPageList(request); | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* 删除巡检任务 | |||||
* 重新提交巡检任务 | |||||
*/ | */ | ||||
@PostMapping("/resubmit") | @PostMapping("/resubmit") | ||||
public JsonResult resubmit(@RequestBody EditInspectionRequest editInspectionRequest) { | public JsonResult resubmit(@RequestBody EditInspectionRequest editInspectionRequest) { | ||||
log.info("进入重新提交任务接口, id={}", editInspectionRequest.getId()); | log.info("进入重新提交任务接口, id={}", editInspectionRequest.getId()); | ||||
return iInspectionService.resubmit(editInspectionRequest); | return iInspectionService.resubmit(editInspectionRequest); | ||||
} | } | ||||
/** | |||||
* 立即执行 | |||||
*/ | |||||
@PostMapping("/execute/{id}") | |||||
public JsonResult execute(@PathVariable("id") String id) { | |||||
log.info("进入立即执行任务接口, id={}", id); | |||||
return iInspectionService.execute(id); | |||||
} | |||||
} | } |
END_LATITUDE_IS_NULL(1230713, "终点纬度为空"), | END_LATITUDE_IS_NULL(1230713, "终点纬度为空"), | ||||
INSPECTION_TIME_IS_NULL(1230714, "巡检时间为空"), | INSPECTION_TIME_IS_NULL(1230714, "巡检时间为空"), | ||||
INSPECTION_IS_NOT_EXIST(1230715, "任务不存在"), | INSPECTION_IS_NOT_EXIST(1230715, "任务不存在"), | ||||
FAILED_INSPECTION_CANNOT_RESUBMIT(1230716, "非失败的任务不能被重新提交"), | FAILED_INSPECTION_CANNOT_RESUBMIT(1230716, "非失败的任务不能被重新提交"), | ||||
TYPE_IS_NOT_EDIT(1230717, "巡检类型不能被修改"), | TYPE_IS_NOT_EDIT(1230717, "巡检类型不能被修改"), | ||||
INSPECTION_TYPE_IS_NOT_EDIT(1230718, "巡检方式不能被修改"), | INSPECTION_TYPE_IS_NOT_EDIT(1230718, "巡检方式不能被修改"), |
JsonResult resubmit(EditInspectionRequest editInspectionRequest); | JsonResult resubmit(EditInspectionRequest editInspectionRequest); | ||||
/** | /** | ||||
<<<<<<< HEAD | |||||
* 获取飞行轨迹 | * 获取飞行轨迹 | ||||
* @param id | * @param id | ||||
* @return | * @return | ||||
*/ | */ | ||||
JsonResult findFlightData(String id); | JsonResult findFlightData(String id); | ||||
======= | |||||
* 立即执行 | |||||
* | |||||
* @param id 任务id | |||||
* @return 结果 | |||||
*/ | |||||
JsonResult execute(String id); | |||||
>>>>>>> 187812e997321373e2dee541777d3ca3493967dd | |||||
} | } |
import com.tuoheng.admin.request.inspection.EditInspectionRequest; | import com.tuoheng.admin.request.inspection.EditInspectionRequest; | ||||
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | ||||
import com.tuoheng.admin.service.inspection.add.AddInspectionService; | 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.resubmit.ResubmitInspectionService; | ||||
import com.tuoheng.admin.service.inspection.delete.DeleteInspectionService; | import com.tuoheng.admin.service.inspection.delete.DeleteInspectionService; | ||||
import com.tuoheng.admin.service.inspection.query.*; | import com.tuoheng.admin.service.inspection.query.*; | ||||
@Autowired | @Autowired | ||||
private QueryFindFlightDataService queryFindFlightDataService; | private QueryFindFlightDataService queryFindFlightDataService; | ||||
@Autowired | |||||
private ExecuteInspectionService executeInspectionService; | |||||
/** | /** | ||||
* 查询巡检任务分页分页列表 | * 查询巡检任务分页分页列表 | ||||
public JsonResult findFlightData(String id) { | public JsonResult findFlightData(String id) { | ||||
return queryFindFlightDataService.findFlightData(id); | return queryFindFlightDataService.findFlightData(id); | ||||
} | } | ||||
/** | |||||
*立即执行 | |||||
* @param id 任务id | |||||
* @return 结果 | |||||
*/ | |||||
@Override | |||||
public JsonResult execute(String id) { | |||||
return executeInspectionService.execute(id); | |||||
} | |||||
} | } |
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); | |||||
} | |||||
} |
package com.tuoheng.admin.service.inspection.query; | 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.conditions.query.LambdaQueryWrapper; | ||||
import com.baomidou.mybatisplus.core.metadata.IPage; | import com.baomidou.mybatisplus.core.metadata.IPage; | ||||
import com.baomidou.mybatisplus.core.metadata.OrderItem; | |||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.tuoheng.admin.conver.InspectionConverMapper; | import com.tuoheng.admin.conver.InspectionConverMapper; | ||||
import com.tuoheng.admin.entity.Dept; | import com.tuoheng.admin.entity.Dept; | ||||
import com.tuoheng.admin.entity.Inspection; | import com.tuoheng.admin.entity.Inspection; | ||||
import com.tuoheng.admin.entity.User; | import com.tuoheng.admin.entity.User; | ||||
import com.tuoheng.admin.enums.UserTypeEnum; | 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.enums.code.inspection.QueryInspectionPageListCodeEnum; | ||||
import com.tuoheng.admin.mapper.DeptMapper; | import com.tuoheng.admin.mapper.DeptMapper; | ||||
import com.tuoheng.admin.mapper.InspectionFileMapper; | import com.tuoheng.admin.mapper.InspectionFileMapper; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.beans.factory.annotation.Qualifier; | import org.springframework.beans.factory.annotation.Qualifier; | ||||
import org.springframework.security.core.parameters.P; | |||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import javax.annotation.PostConstruct; | import javax.annotation.PostConstruct; |
* | * | ||||
* @author wanjing | * @author wanjing | ||||
* @team tuoheng | * @team tuoheng | ||||
* @date 2022-12-201 | |||||
* @date 2022-12-01 | |||||
*/ | */ | ||||
@Slf4j | @Slf4j | ||||
@Service | @Service |