|
|
@@ -3,15 +3,15 @@ package com.tuoheng.admin.service.inspection.execute; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.tuoheng.admin.entity.Inspection; |
|
|
|
import com.tuoheng.admin.entity.InspectionHistory; |
|
|
|
import com.tuoheng.admin.entity.Tenant; |
|
|
|
import com.tuoheng.admin.enums.code.inspection.ExecuteInspectionCodeEnum; |
|
|
|
import com.tuoheng.admin.mapper.InspectionHistoryMapper; |
|
|
|
import com.tuoheng.admin.mapper.InspectionMapper; |
|
|
|
import com.tuoheng.admin.mapper.TenantMapper; |
|
|
|
import com.tuoheng.admin.utils.ShiroUtils; |
|
|
|
import com.tuoheng.common.core.utils.HttpUtils; |
|
|
|
import com.tuoheng.common.core.utils.JacksonUtil; |
|
|
|
import com.tuoheng.common.core.utils.JsonResult; |
|
|
|
import com.tuoheng.common.core.utils.StringUtils; |
|
|
|
import com.tuoheng.common.core.utils.*; |
|
|
|
import lombok.Data; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@@ -33,6 +33,8 @@ public class ExecuteInspectionService { |
|
|
|
@Autowired |
|
|
|
private TenantMapper tenantMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private InspectionHistoryMapper inspectionHistoryMapper; |
|
|
|
|
|
|
|
/** |
|
|
|
* 重新提交任务 |
|
|
@@ -42,6 +44,8 @@ public class ExecuteInspectionService { |
|
|
|
public JsonResult execute(String id) { |
|
|
|
log.info("进入立即执行任务业务"); |
|
|
|
String userId = ShiroUtils.getUserId(); |
|
|
|
String tenantId = ShiroUtils.getTenantId(); |
|
|
|
|
|
|
|
JsonResult result = this.check(id); |
|
|
|
if (0 != result.getCode()) { |
|
|
|
log.info("立即执行任务业务:校验参数失败:{}", result.getMsg()); |
|
|
@@ -76,10 +80,11 @@ public class ExecuteInspectionService { |
|
|
|
* |
|
|
|
* 调用机场平台 |
|
|
|
* |
|
|
|
* @param tenantId |
|
|
|
* @param inspection |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public JsonResult executeTask(Inspection inspection) { |
|
|
|
public JsonResult executeTask(String tenantId, Inspection inspection) { |
|
|
|
//读取不同租户的机场平台url |
|
|
|
Tenant tenant = tenantMapper.selectById(inspection.getTenantId()); |
|
|
|
if (ObjectUtil.isEmpty(tenant)) { |
|
|
@@ -116,10 +121,18 @@ public class ExecuteInspectionService { |
|
|
|
* |
|
|
|
* 更新任务中 |
|
|
|
* |
|
|
|
* @param tenantId |
|
|
|
* @param inspection |
|
|
|
*/ |
|
|
|
private void updateInspection(Inspection 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); |
|
|
|
} |
|
|
|
|
|
|
|
} |