@@ -58,4 +58,10 @@ public class QuestionHandle extends BaseEntity implements Serializable { | |||
*/ | |||
@TableField(exist = false) | |||
private Integer status; | |||
/** | |||
* 处理人名称 | |||
*/ | |||
@TableField(exist = false) | |||
private String handlerUserName; | |||
} |
@@ -19,6 +19,11 @@ public class WorkOrderQuestionVO { | |||
*/ | |||
private String type; | |||
/** | |||
* 问题描述 | |||
*/ | |||
private String questionDesc; | |||
/** | |||
* 问题类型名称 | |||
*/ |
@@ -154,6 +154,16 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio | |||
@Override | |||
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的数量来判断是否是批量确认和忽略 | |||
Question question=new Question(UpdateOrCreateEnum.UPDATE.getCode()); | |||
question.setStatus(entity.getStatus()); |
@@ -150,25 +150,28 @@ public class ThInspectionServiceImpl extends BaseServiceImpl<ThInspectionMapper, | |||
jsonObject.put("taskId", thMission.getInspectionLine()); | |||
jsonObject.put("requestId", missionId); | |||
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)){ | |||
return JsonResult.error("机场接口返回数据为空"); | |||
} | |||
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()); | |||
} 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 |
@@ -69,10 +69,10 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO | |||
Date startDate = null; | |||
Date endDate = null; | |||
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()); | |||
@@ -223,6 +223,12 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO | |||
questionHandle.setHandlerImage(handerImg); | |||
} | |||
//查询处理人名称 | |||
User user = userMapper.selectById(questionHandle.getHandlerUser()); | |||
if(ObjectUtil.isNotNull(user)){ | |||
questionHandle.setHandlerUserName(user.getRealname()); | |||
} | |||
//查询问题处理状态 | |||
WorkOrderQuestion workOrderQuestion = workOrderQuestionMapper.selectOne(new LambdaQueryWrapper<WorkOrderQuestion>() | |||
.eq(WorkOrderQuestion::getQuestionId, questionId)); |
@@ -1,20 +1,17 @@ | |||
package com.tuoheng.admin.task; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.entity.domain.ThMission; | |||
import com.tuoheng.admin.enums.MarkTypeEnum; | |||
import com.tuoheng.admin.enums.TaskStatusEnum; | |||
import com.tuoheng.admin.enums.UpdateOrCreateEnum; | |||
import com.tuoheng.admin.mapper.ThMissionMapper; | |||
import com.tuoheng.admin.service.IMissionService; | |||
import com.tuoheng.admin.service.IThInspectionService; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.common.utils.StringUtils; | |||
import com.xxl.job.core.handler.annotation.XxlJob; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.scheduling.annotation.Scheduled; | |||
import org.springframework.stereotype.Component; | |||
import java.text.SimpleDateFormat; | |||
@@ -56,15 +53,14 @@ public class ScheduledTask { | |||
log.info("执行定时执行飞行任务:" + thMission.getId()); | |||
JsonResult jsonResult = inspectionService.executeTask(String.valueOf(thMission.getId()), null); | |||
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); | |||
} | |||
} | |||
@@ -83,7 +83,7 @@ public class HttpUtils { | |||
connection.setDoOutput(true); // 设置该连接是可以输出的 | |||
//设置连接超时时间和读取超时时间 | |||
connection.setConnectTimeout(15000); | |||
connection.setReadTimeout(60000 * 2); | |||
connection.setReadTimeout(60000 * 5); | |||
//设置请求方式 | |||
connection.setRequestMethod(method); | |||
connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8"); |