Browse Source

1、修改手动执行任务和定时任务执行修改状态;2、修改日志;

tags/v1.0.0^2
wanjing 1 year ago
parent
commit
1e79fca905
9 changed files with 37 additions and 8 deletions
  1. +3
    -3
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionController.java
  2. +3
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/callback/CloudBoxCallbackoxController.java
  3. +2
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspection/ExecuteInspectionCodeEnum.java
  4. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/flightdata/FlightDataServiceImpl.java
  5. +0
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/InspectionServiceImpl.java
  6. +4
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/execute/ExecuteInspectionService.java
  7. +0
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/status/UpdateExecuteTaskStatusService.java
  8. +23
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/ExecuteTaskService.java
  9. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/task/AirportTask.java

+ 3
- 3
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionController.java View File

@@ -29,7 +29,7 @@ public class InspectionController {
*/
@GetMapping("/page/list")
public JsonResult list(QueryInspectionPageListRequest request) {
log.info("进入查询巡检任务分页列表接口");
// log.info("进入查询巡检任务分页列表接口");
return iInspectionService.selectPageList(request);
}

@@ -38,7 +38,7 @@ public class InspectionController {
*/
@GetMapping(value = "/info/{id}")
public JsonResult getInfo(@PathVariable("id") String id) {
log.info("进入查询任务详情接口, id={}", id);
// log.info("进入查询任务详情接口, id={}", id);
return iInspectionService.getInspectionInfo(id);
}

@@ -47,7 +47,7 @@ public class InspectionController {
*/
@GetMapping(value = "/details/{id}")
public JsonResult getDetails(@PathVariable("id") String id) {
log.info("进入查询任务详情接口, id={}", id);
// log.info("进入查询任务详情接口, id={}", id);
return iInspectionService.getInspectionDetails(id);
}


+ 3
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/callback/CloudBoxCallbackoxController.java View File

@@ -3,6 +3,7 @@ package com.tuoheng.admin.controller.callback;
import com.tuoheng.admin.entity.FlightData;
import com.tuoheng.admin.service.flightdata.IFlightDataService;
import com.tuoheng.common.core.common.OperationEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
* @author 拓恒
* @since 2021-09-18
*/
@Slf4j
@RestController
@RequestMapping("/cloudbox/callback")
public class CloudBoxCallbackoxController {
@@ -32,6 +34,7 @@ public class CloudBoxCallbackoxController {
*/
@PostMapping("/add")
public OperationEnum addCallback(@RequestBody FlightData entity) {
log.info("云盒遥测回调接口");
flightDataService.addCallback(entity);
return OperationEnum.OPERATION_SUCCESS;
}

+ 2
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspection/ExecuteInspectionCodeEnum.java View File

@@ -17,7 +17,8 @@ public enum ExecuteInspectionCodeEnum {
USER_ONLY_EXECUTE_DEPARTMENT_TASK(1230803, "用户只能执行本部门任务"),
TENANT_IS_NOT_EXIST(1230804, "租户不存在"),
AIRPORT_URL_IS_NULL(1230805, "机场平台URL为空"),
AIRPORT_RETURN_DATA_IS_NULL(1230806, "机场接口返回数据为空");
AIRPORT_RETURN_DATA_IS_NULL(1230806, "机场接口返回数据为空"),
INSPECTION_CANNOT_REPEATED_EXECUTE(1230807, "任务不能被重复执行"),;

/**
* 错误码

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/flightdata/FlightDataServiceImpl.java View File

@@ -64,7 +64,7 @@ public class FlightDataServiceImpl extends BaseServiceImpl<FlightDataMapper, Fli

@Override
public void addCallback(FlightData entity) {
log.info("addCallback接口入参:" + entity);
log.info("云盒遥测回调,入参:{}", entity);
if (ObjectUtil.isNull(entity)) {
log.info("传入参数entity为空");
return;

+ 0
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/InspectionServiceImpl.java View File

@@ -185,7 +185,6 @@ public class InspectionServiceImpl implements IInspectionService {
return queryInspectionListService.getListByAirportId(dto);
}


@Override
public JsonResult getVideoById(String id) {
return queryVideoService.getVideoById(id);

+ 4
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/execute/ExecuteInspectionService.java View File

@@ -87,6 +87,10 @@ public class ExecuteInspectionService {
return JsonResult.error(ExecuteInspectionCodeEnum.INSPECTION_IS_NOT_EXIST.getCode(), ExecuteInspectionCodeEnum.INSPECTION_IS_NOT_EXIST.getMsg());
}

if (2 == inspection.getExecutionStatus()) {
return JsonResult.error(ExecuteInspectionCodeEnum.INSPECTION_CANNOT_REPEATED_EXECUTE.getCode(), ExecuteInspectionCodeEnum.INSPECTION_CANNOT_REPEATED_EXECUTE.getMsg());
}

User user = userMapper.selectOne(new LambdaQueryWrapper<User>()
.eq(User::getTenantId, tenantId)
.eq(User::getId, userId)

+ 0
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/status/UpdateExecuteTaskStatusService.java View File

@@ -83,7 +83,6 @@ public class UpdateExecuteTaskStatusService {
* @param inspection
*/
private void updateInspection(String userId, Inspection inspection) {
inspection.setExecutionStatus(2);
inspection.setStatus(inspection.getStatus());
inspection.setUpdateUser(userId);
inspection.setUpdateTime(DateUtils.now());

+ 23
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/ExecuteTaskService.java View File

@@ -6,7 +6,9 @@ import com.tuoheng.admin.constant.SystemConstant;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.Tenant;
import com.tuoheng.admin.enums.code.inspection.ExecuteInspectionCodeEnum;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.mapper.TenantMapper;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.HttpUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
@@ -21,6 +23,9 @@ public class ExecuteTaskService {
@Autowired
private TenantMapper tenantMapper;

@Autowired
private InspectionMapper inspectionMapper;

public JsonResult executeTask(String userId, Inspection inspection) {
log.info("进入调用机场平台方法,执行任务");
// 读取不同租户的机场平台url
@@ -51,7 +56,25 @@ public class ExecuteTaskService {
inspection.getId(), inspection.getName(), inspection.getAirportId(), inspection.getAirportName(), inspection.getInspectionLine(), inspection.getInspectionLineName());
return JsonResult.error(ExecuteInspectionCodeEnum.AIRPORT_RETURN_DATA_IS_NULL.getCode(), ExecuteInspectionCodeEnum.AIRPORT_RETURN_DATA_IS_NULL.getMsg());
}

// 修改任务执行状态,防止手动执行和定时重复
this.updateInspectionExecutionStatus(userId, inspection);

log.info("进入调用机场平台方法: 等待机场平台回调,修改执行任务状态");
return JsonResult.success();
}

/**
* 修改任务执行状态
*
* @param userId
* @param inspection
*/
private void updateInspectionExecutionStatus(String userId, Inspection inspection) {
inspection.setExecutionStatus(2);
inspection.setStatus(inspection.getStatus());
inspection.setUpdateUser(userId);
inspection.setUpdateTime(DateUtils.now());
inspectionMapper.update(inspection);
}
}

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/task/AirportTask.java View File

@@ -53,7 +53,7 @@ public class AirportTask {
return;
}
for (Inspection inspection : inspectionList) {
log.info("执行定时执行飞行任务开始: inspectionId:{}" + inspection.getId());
log.info("执行定时执行飞行任务开始: inspectionId:{}", inspection.getId());
airportService.executeTask("", inspection);
log.info("执行定时执行飞行任务结束: inspectionId:{}");
}

Loading…
Cancel
Save