Переглянути джерело

Merge branch 'develop' of gitadmin/tuoheng_freeway into release

tags/v1.0.0^2
wanjing 1 рік тому
джерело
коміт
dfc1a2f1ff
12 змінених файлів з 187 додано та 28 видалено
  1. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/constant/SystemConstant.java
  2. +12
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/callback/AirPortCallbackController.java
  3. +36
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspection/ExecuteTaskStatusRequest.java
  4. +6
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/IInspectionService.java
  5. +13
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/InspectionServiceImpl.java
  6. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryInspectionPageListService.java
  7. +109
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/status/UpdateExecuteTaskStatusService.java
  8. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/status/UpdateInspectionStatusService.java
  9. +3
    -3
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/query/QueryReportPageListService.java
  10. +1
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/ExecuteTaskService.java
  11. +2
    -2
      tuoheng-service/tuoheng-admin/src/main/resources/application-prod.yml
  12. +2
    -16
      tuoheng-service/tuoheng-miniprogram/src/main/resources/application-prod.yml

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/constant/SystemConstant.java Переглянути файл

@@ -27,7 +27,7 @@ public interface SystemConstant {
/**
* 机场平台:执行接口
*/
String API_AIRPORT_EXECUTE_TASK = "/api/airportInterface/executeTask";
String API_AIRPORT_EXECUTE_TASK = "/api/airportInterface/executeTaskAnsy";

/**
* 机场平台:获取天气

+ 12
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/callback/AirPortCallbackController.java Переглянути файл

@@ -1,6 +1,7 @@
package com.tuoheng.admin.controller.callback;

import com.alibaba.fastjson.JSONObject;
import com.tuoheng.admin.request.inspection.ExecuteTaskStatusRequest;
import com.tuoheng.admin.request.inspection.InspectionRequest;
import com.tuoheng.admin.request.inspection.MissionStatusRequest;
import com.tuoheng.admin.service.inspection.IInspectionService;
@@ -28,11 +29,20 @@ public class AirPortCallbackController {
private IInspectionService iInspectionService;

/**
* 被硬件调用,存任务状态
* 被硬件调用,执行任务后,回调执行状态
*/
@PostMapping("/executeTaskStatus")
public JsonResult getExecuteTaskStatus(@RequestBody @Valid ExecuteTaskStatusRequest executeTaskStatusRequest) {
log.info("被硬件调用,执行任务后,回调执行状态:{}", JSONObject.toJSONString(executeTaskStatusRequest));
return iInspectionService.getExecuteTaskStatus(executeTaskStatusRequest);
}

/**
* 被硬件调用,存任务飞行开始/结束状态
*/
@PutMapping("/status")
public JsonResult updateStatus(@RequestBody @Valid MissionStatusRequest missionStatusRequest) {
log.info("被硬件调用,存任务状态:{}", JSONObject.toJSONString(missionStatusRequest));
log.info("被硬件调用,存任务飞行开始/结束状态:{}", JSONObject.toJSONString(missionStatusRequest));
return iInspectionService.updateStatus(missionStatusRequest);
}


+ 36
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspection/ExecuteTaskStatusRequest.java Переглянути файл

@@ -0,0 +1,36 @@
package com.tuoheng.admin.request.inspection;

import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
* 修改任务请求参数
*
* @author wanjing
* @team tuoheng
* @date 2023-01-10
*/
@Data
public class ExecuteTaskStatusRequest implements Serializable {

private static final long serialVersionUID = 1L;

/**
* 0:成功,500:失败
*/
private String code;

/**
* 业务平台任务id
*/
private String requestId;

/**
* 执行结果
*/
private String msg;


}

+ 6
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/IInspectionService.java Переглянути файл

@@ -114,7 +114,12 @@ public interface IInspectionService {
JsonResult getNewInspectionList();

/**
* 被硬件调用,存任务状态
* 被硬件调用,执行任务后,回调执行状态
*/
JsonResult getExecuteTaskStatus(ExecuteTaskStatusRequest executeTaskStatusRequest);

/**
* 被硬件调用,存任务飞行开始/结束状态
*/
JsonResult updateStatus(MissionStatusRequest missionStatusRequest);


+ 13
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/InspectionServiceImpl.java Переглянути файл

@@ -14,6 +14,7 @@ import com.tuoheng.admin.service.inspection.delete.DeleteInspectionService;
import com.tuoheng.admin.service.inspection.query.*;
import com.tuoheng.admin.service.inspection.update.UpdateInspectionService;
import com.tuoheng.admin.service.inspection.update.flyer.UpdateFlyerService;
import com.tuoheng.admin.service.inspection.update.status.UpdateExecuteTaskStatusService;
import com.tuoheng.admin.service.inspection.update.status.UpdateInspectionStatusService;
import com.tuoheng.admin.service.inspection.upload.UploadFlightUrlService;
import com.tuoheng.common.core.common.OperationEnum;
@@ -87,6 +88,9 @@ public class InspectionServiceImpl implements IInspectionService {
@Autowired
private UpdateFlyerService updateFlyerService;

@Autowired
private UpdateExecuteTaskStatusService updateExecuteTaskStatusService;

/**
* 查询巡检任务分页分页列表
*
@@ -239,7 +243,15 @@ public class InspectionServiceImpl implements IInspectionService {
}

/**
* 被硬件调用,存任务状态
* 被硬件调用,执行任务后,回调执行状态
*/
@Override
public JsonResult getExecuteTaskStatus(ExecuteTaskStatusRequest executeTaskStatusRequest) {
return updateExecuteTaskStatusService.updateStatus(executeTaskStatusRequest);
}

/**
* 被硬件调用,存任务飞行开始/结束状态
*/
@Override
public JsonResult updateStatus(MissionStatusRequest missionStatusRequest) {

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryInspectionPageListService.java Переглянути файл

@@ -93,7 +93,7 @@ public class QueryInspectionPageListService {
}

public JsonResult getPageList(QueryInspectionPageListRequest request) {
log.info("进入查询巡检任务分页列表业务");
// log.info("进入查询巡检任务分页列表业务");

String userId = CurrentUserUtil.getUserId();
String tenantId = CurrentUserUtil.getTenantId();

+ 109
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/status/UpdateExecuteTaskStatusService.java Переглянути файл

@@ -0,0 +1,109 @@
package com.tuoheng.admin.service.inspection.update.status;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.InspectionHistory;
import com.tuoheng.admin.enums.InspectionStatusEnum;
import com.tuoheng.admin.enums.MarkTypeEnum;
import com.tuoheng.admin.mapper.InspectionHistoryMapper;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.request.inspection.ExecuteTaskStatusRequest;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* 被硬件调用,执行任务后,回调执行状态
*
* @author wanjing
* @team tuoheng
* @date 2023-01-10
*/
@Slf4j
@Service
public class UpdateExecuteTaskStatusService {

@Autowired
private InspectionMapper inspectionMapper;

@Autowired
private InspectionHistoryMapper inspectionHistoryMapper;

/**
* 被硬件调用,执行任务后,回调执行状态
*
* @return
*/
public JsonResult updateStatus(ExecuteTaskStatusRequest executeTaskStatusRequest) {
JsonResult result = this.check(executeTaskStatusRequest);
if (0 != result.getCode()) {
log.info("被硬件调用,执行任务后,回调执行状态业务:校验失败:{}", result.getMsg());
return result;
}
Inspection inspection = (Inspection) result.getData();
if (!"0".equals(executeTaskStatusRequest.getCode())) {
log.info("被硬件调用,执行任务后,回调执行状态业务, 机场接口返回结果:失败:{}", executeTaskStatusRequest.getMsg());
inspection.setStatus(InspectionStatusEnum.FLIGHT_FAILED.getCode());
this.updateInspection("", inspection);

this.insertInspectionHistory("", inspection.getTenantId(), inspection, executeTaskStatusRequest.getMsg());
} else {
inspection.setStatus(InspectionStatusEnum.IN_FLIGHT.getCode());
this.updateInspection("", inspection);
}
log.info("被硬件调用,任务执行后,回调执行状态业务成功");
return JsonResult.success("被硬件调用,任务执行后,回调执行状态业务成功");
}

/**
* 检查参数
*
* @param executeTaskStatusRequest
* @return
*/
private JsonResult check(ExecuteTaskStatusRequest executeTaskStatusRequest) {
//查询出对应的巡检任务
Inspection inspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>()
.eq(Inspection::getMark, MarkTypeEnum.VALID.getCode())
.eq(Inspection::getId, executeTaskStatusRequest.getRequestId()));
if (ObjectUtil.isEmpty(inspection)) {
log.info("任务不存在, inspectionId:{}", executeTaskStatusRequest.getRequestId());
return JsonResult.error(500, "任务不存在" + executeTaskStatusRequest.getRequestId());
}
return JsonResult.success(inspection);
}

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

/**
* 更新任务中
*
* @param tenantId
* @param inspection
*/
private void insertInspectionHistory(String userId, String tenantId, Inspection inspection, String msg) {
InspectionHistory inspectionHistory = new InspectionHistory();
inspectionHistory.setTenantId(tenantId);
inspectionHistory.setInspectionId(inspection.getId());
inspectionHistory.setHistoryName(msg);
inspectionHistory.setCreateUser(userId);
inspectionHistory.setCreateTime(DateUtils.now());
inspectionHistoryMapper.insert(inspectionHistory);
}
}

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/status/UpdateInspectionStatusService.java Переглянути файл

@@ -39,7 +39,7 @@ public class UpdateInspectionStatusService {
* @return
*/
public JsonResult updateStatus(MissionStatusRequest missionStatusRequest) {
log.info("进入修改任务状态业务接口, missionStatusRequest:{}", missionStatusRequest);
log.info("进入修改任务飞行开始/结束状态业务接口, missionStatusRequest:{}", missionStatusRequest);
JsonResult result = this.check(missionStatusRequest);
if (0 != result.getCode()) {
log.info("修改任务状态业务接口:校验失败:{}", result.getMsg());

+ 3
- 3
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/query/QueryReportPageListService.java Переглянути файл

@@ -42,21 +42,21 @@ public class QueryReportPageListService {

/**
*
* 查报告分页列表
* 查报告分页列表
* 用户只能查看自己生成的报告
*
* @param request
* @return
*/
public JsonResult getPageList(QueryReportPageListRequest request) {
log.info("进入查询巡检任务分页列表业务");
// log.info("进入查询报告分页列表业务");

String userId = CurrentUserUtil.getUserId();
String tenantId = CurrentUserUtil.getTenantId();

JsonResult result = this.check(tenantId, request);
if (0 != result.getCode()) {
log.info("进入查询巡检任务分页列表业务:校验失败:{}", result.getMsg());
log.info("查询报告分页列表:校验失败:{}", result.getMsg());
return result;
}


+ 1
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/ExecuteTaskService.java Переглянути файл

@@ -54,6 +54,7 @@ public class ExecuteTaskService {
log.info("进入调用机场平台方法: jsonObject:{}", jsonObject);

String airPortStr = HttpUtils.doSend(url, jsonObject, null, "POST");

if (StringUtils.isEmpty(airPortStr)) {
log.info("立即执行任务业务:机场接口返回数据为空,飞行失败,任务id:{},任务名称:{},机场id:{},机场名称:{}, 路线id:{},路线名称:{}",
inspection.getId(), inspection.getName(), inspection.getAirportId(), inspection.getAirportName(), inspection.getInspectionLine(), inspection.getInspectionLineName());

+ 2
- 2
tuoheng-service/tuoheng-admin/src/main/resources/application-prod.yml Переглянути файл

@@ -2,11 +2,11 @@ spring:
# 注册中心consul地址
cloud:
consul:
host: 172.16.1.31 # consul 所在服务地址
host: 172.16.5.12 # consul 所在服务地址
port: 8500 # consul 服务端口
discovery:
## consul ip地址
hostname: 172.16.1.31
hostname: 172.16.5.12
# 注册到consul的服务名称
service-name: ${spring.application.name} # 服务提供者名称
instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${server.port} #实例ID

+ 2
- 16
tuoheng-service/tuoheng-miniprogram/src/main/resources/application-prod.yml Переглянути файл

@@ -2,7 +2,7 @@ spring:
# 注册中心consul地址
cloud:
consul:
host: 172.16.1.31 # consul 所在服务地址
host: 172.16.5.12 # consul 所在服务地址
port: 8500 # consul 服务端口
discovery:
# 是否启用服务发现
@@ -11,7 +11,7 @@ spring:
register: true
deregister: true
## consul ip地址
hostname: 172.16.1.31
hostname: 172.16.5.12
# 注册到consul的服务名称
service-name: ${spring.application.name} # 服务提供者名称
instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${server.port} #实例ID
@@ -87,20 +87,6 @@ tuoheng:
staticAccessPath: /**
#静态资源实际存储路径
uploadFolder: /data/java/tuoheng_freeway/uploads/
xxl:
enable: true
job:
admin:
addresses: http://172.16.1.31:8110/xxl-job-admin
accessToken: tuoheng
executor:
appname: xxl-job-executor-freeway-miniprogram
address:
ip:
# 多个后台,端口号不能相同
port: 9991
logpath: /data/java/logs/xxl-job/jobhandler
logretentiondays: 15
## 配置feign熔断
#feign:
# circuitbreaker:

Завантаження…
Відмінити
Зберегти