*/ | */ | ||||
@TableField(exist = false) | @TableField(exist = false) | ||||
private Integer status; | private Integer status; | ||||
/** | |||||
* 处理人名称 | |||||
*/ | |||||
@TableField(exist = false) | |||||
private String handlerUserName; | |||||
} | } |
*/ | */ | ||||
private String type; | private String type; | ||||
/** | |||||
* 问题描述 | |||||
*/ | |||||
private String questionDesc; | |||||
/** | /** | ||||
* 问题类型名称 | * 问题类型名称 | ||||
*/ | */ |
@Override | @Override | ||||
public JsonResult<Boolean> check(QuestionStatusRequest entity) { | public JsonResult<Boolean> check(QuestionStatusRequest entity) { | ||||
//已经生成工单的问题无法修改 | |||||
for (Integer id : entity.getId()) { | |||||
List<WorkOrderQuestion> workOrderQuestions = workOrderQuestionMapper.selectList(new LambdaQueryWrapper<WorkOrderQuestion>() | |||||
.eq(WorkOrderQuestion::getQuestionId, id)); | |||||
if(StringUtils.isNotEmpty(workOrderQuestions)){ | |||||
return JsonResult.error("问题:"+id+"已生成工单,无法修改!"); | |||||
} | |||||
} | |||||
//根据ID的数量来判断是否是批量确认和忽略 | //根据ID的数量来判断是否是批量确认和忽略 | ||||
Question question=new Question(UpdateOrCreateEnum.UPDATE.getCode()); | Question question=new Question(UpdateOrCreateEnum.UPDATE.getCode()); | ||||
question.setStatus(entity.getStatus()); | question.setStatus(entity.getStatus()); |
jsonObject.put("taskId", thMission.getInspectionLine()); | jsonObject.put("taskId", thMission.getInspectionLine()); | ||||
jsonObject.put("requestId", missionId); | jsonObject.put("requestId", missionId); | ||||
log.info("***** executeTask url:{};param:{}", url, jsonObject.toJSONString()); | log.info("***** executeTask url:{};param:{}", url, jsonObject.toJSONString()); | ||||
String airPortStr = HttpUtils.doSend(url, jsonObject, null, "POST"); | |||||
String airPortStr = null; | |||||
try { | |||||
airPortStr = HttpUtils.doSend(url, jsonObject, null, "POST"); | |||||
} catch (Exception e) { | |||||
log.error("调用机场executeTask接口异常:",e); | |||||
return JsonResult.error("调用机场executeTask接口异常"); | |||||
} | |||||
if(StringUtils.isEmpty(airPortStr)){ | if(StringUtils.isEmpty(airPortStr)){ | ||||
return JsonResult.error("机场接口返回数据为空"); | return JsonResult.error("机场接口返回数据为空"); | ||||
} | } | ||||
JsonResult jsonResult = JacksonUtil.json2pojo(airPortStr, JsonResult.class); | JsonResult jsonResult = JacksonUtil.json2pojo(airPortStr, JsonResult.class); | ||||
if (ObjectUtil.isEmpty(jsonResult) || (!ObjectUtil.isEmpty(Objects.requireNonNull(jsonResult).getData()) && jsonResult.getCode() != 0)) { | |||||
assert jsonResult != null; | |||||
return JsonResult.error(JSONObject.parseArray(JSONObject.parseObject(JSONObject.toJSONString(jsonResult.getData())).get("data").toString(), AirExecuteTaskVO.class), "执行任务失败!"); | |||||
} else if (ObjectUtil.isEmpty(jsonResult.getData()) && jsonResult.getCode() != 0) { | |||||
if (jsonResult.getCode() != 0) { | |||||
return JsonResult.error(jsonResult.getMsg()); | return JsonResult.error(jsonResult.getMsg()); | ||||
} else { | |||||
ThMission thMissionUpdate = new ThMission(UpdateOrCreateEnum.UPDATE.getCode()); | |||||
thMissionUpdate.setId(Integer.parseInt(missionId)); | |||||
//修改执行时间为当前 | |||||
thMissionUpdate.setExecutionStartTime(new Date()); | |||||
missionMapper.updateById(thMissionUpdate); | |||||
//返回执行结果 | |||||
return JsonResult.success(jsonResult.getMsg()); | |||||
} | } | ||||
//将任务执行状态修改为已执行 | |||||
ThMission thMissionUpdate = new ThMission(UpdateOrCreateEnum.UPDATE.getCode()); | |||||
thMissionUpdate.setId(thMission.getId()); | |||||
thMissionUpdate.setExecutionStatus(2); | |||||
missionMapper.updateById(thMissionUpdate); | |||||
return JsonResult.success(); | |||||
} | } | ||||
@Override | @Override |
Date startDate = null; | Date startDate = null; | ||||
Date endDate = null; | Date endDate = null; | ||||
if(StringUtils.isNotEmpty(request.getCreateStartTime()) && StringUtils.isNotEmpty(request.getCreateEndTime())){ | if(StringUtils.isNotEmpty(request.getCreateStartTime()) && StringUtils.isNotEmpty(request.getCreateEndTime())){ | ||||
String startTime = request.getCreateStartTime() + "00:00:00"; | |||||
String endTime = request.getCreateEndTime() + "23:59:59"; | |||||
startDate = DateUtils.dateTime(DateUtils.YYYY_MM_DD, startTime); | |||||
endDate = DateUtils.dateTime(DateUtils.YYYY_MM_DD, endTime); | |||||
String startTime = request.getCreateStartTime() + " 00:00:00"; | |||||
String endTime = request.getCreateEndTime() + " 23:59:59"; | |||||
startDate = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, startTime); | |||||
endDate = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, endTime); | |||||
} | } | ||||
// 获取分页数据 | // 获取分页数据 | ||||
IPage<WorkOrder> page = new Page<>(request.getPage(), request.getLimit()); | IPage<WorkOrder> page = new Page<>(request.getPage(), request.getLimit()); | ||||
questionHandle.setHandlerImage(handerImg); | questionHandle.setHandlerImage(handerImg); | ||||
} | } | ||||
//查询处理人名称 | |||||
User user = userMapper.selectById(questionHandle.getHandlerUser()); | |||||
if(ObjectUtil.isNotNull(user)){ | |||||
questionHandle.setHandlerUserName(user.getRealname()); | |||||
} | |||||
//查询问题处理状态 | //查询问题处理状态 | ||||
WorkOrderQuestion workOrderQuestion = workOrderQuestionMapper.selectOne(new LambdaQueryWrapper<WorkOrderQuestion>() | WorkOrderQuestion workOrderQuestion = workOrderQuestionMapper.selectOne(new LambdaQueryWrapper<WorkOrderQuestion>() | ||||
.eq(WorkOrderQuestion::getQuestionId, questionId)); | .eq(WorkOrderQuestion::getQuestionId, questionId)); |
package com.tuoheng.admin.task; | package com.tuoheng.admin.task; | ||||
import cn.hutool.core.util.ObjectUtil; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.tuoheng.admin.entity.domain.ThMission; | import com.tuoheng.admin.entity.domain.ThMission; | ||||
import com.tuoheng.admin.enums.MarkTypeEnum; | import com.tuoheng.admin.enums.MarkTypeEnum; | ||||
import com.tuoheng.admin.enums.TaskStatusEnum; | import com.tuoheng.admin.enums.TaskStatusEnum; | ||||
import com.tuoheng.admin.enums.UpdateOrCreateEnum; | import com.tuoheng.admin.enums.UpdateOrCreateEnum; | ||||
import com.tuoheng.admin.mapper.ThMissionMapper; | import com.tuoheng.admin.mapper.ThMissionMapper; | ||||
import com.tuoheng.admin.service.IMissionService; | |||||
import com.tuoheng.admin.service.IThInspectionService; | import com.tuoheng.admin.service.IThInspectionService; | ||||
import com.tuoheng.common.utils.JsonResult; | import com.tuoheng.common.utils.JsonResult; | ||||
import com.tuoheng.common.utils.StringUtils; | import com.tuoheng.common.utils.StringUtils; | ||||
import com.xxl.job.core.handler.annotation.XxlJob; | import com.xxl.job.core.handler.annotation.XxlJob; | ||||
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.scheduling.annotation.Scheduled; | |||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
log.info("执行定时执行飞行任务:" + thMission.getId()); | log.info("执行定时执行飞行任务:" + thMission.getId()); | ||||
JsonResult jsonResult = inspectionService.executeTask(String.valueOf(thMission.getId()), null); | JsonResult jsonResult = inspectionService.executeTask(String.valueOf(thMission.getId()), null); | ||||
log.info("执行定时执行飞行任务result:" + jsonResult); | log.info("执行定时执行飞行任务result:" + jsonResult); | ||||
thMission.setExecutionStatus(2); | |||||
ThMission thMissionUpdate = new ThMission(UpdateOrCreateEnum.UPDATE.getCode()); | |||||
thMissionUpdate.setId(thMission.getId()); | |||||
thMissionUpdate.setExecutionStatus(2); | |||||
if(jsonResult.getCode()!=0 && ObjectUtil.isEmpty(jsonResult.getData())){ | |||||
thMission.setStatus(TaskStatusEnum.FAIL.getCode()); | |||||
if(jsonResult.getCode() != 0){ | |||||
ThMission thMissionUpdate = new ThMission(UpdateOrCreateEnum.UPDATE.getCode()); | |||||
thMissionUpdate.setId(thMission.getId()); | |||||
log.error("执行定时执行机场起飞失败" + thMission.getId()); | |||||
thMissionUpdate.setStatus(TaskStatusEnum.FAIL.getCode()); | |||||
missionMapper.updateById(thMissionUpdate); | |||||
} | } | ||||
missionMapper.updateById(thMissionUpdate); | |||||
} | } | ||||
} | } | ||||
connection.setDoOutput(true); // 设置该连接是可以输出的 | connection.setDoOutput(true); // 设置该连接是可以输出的 | ||||
//设置连接超时时间和读取超时时间 | //设置连接超时时间和读取超时时间 | ||||
connection.setConnectTimeout(15000); | connection.setConnectTimeout(15000); | ||||
connection.setReadTimeout(60000 * 2); | |||||
connection.setReadTimeout(60000 * 5); | |||||
//设置请求方式 | //设置请求方式 | ||||
connection.setRequestMethod(method); | connection.setRequestMethod(method); | ||||
connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8"); | connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8"); |