|
|
@ -116,26 +116,21 @@ public abstract class AbstractTask { |
|
|
|
resultForAcs.setCode(HttpStatus.HTTP_BAD_REQUEST); |
|
|
|
resultForAcs.setMessage(e.getMessage()); |
|
|
|
} |
|
|
|
// todo: 可优化点:解除双层循环判断任务的完成性
|
|
|
|
// 如果下发完毕,就修改状态
|
|
|
|
if (resultForAcs.getCode() == 200) { |
|
|
|
// 解析
|
|
|
|
JSONArray errArr = resultForAcs.getErrArr(); |
|
|
|
for (SchBaseTask schBaseTask : taskList) { |
|
|
|
if (errArr == null) { |
|
|
|
schBaseTask.setTask_status(TaskStatus.ISSUED.getCode()); |
|
|
|
} else { |
|
|
|
schBaseTask.setTask_status(TaskStatus.ISSUED.getCode()); |
|
|
|
// 判断是否是出错的任务
|
|
|
|
for (int i = 0; i < errArr.size(); i++) { |
|
|
|
JSONObject errObj = errArr.getJSONObject(i); |
|
|
|
String taskCode = errObj.getString("task_code"); |
|
|
|
if (taskCode.equals(schBaseTask.getTask_code())) { |
|
|
|
// 出错的任务就设置出错信息为备注,不是出错就设置下发
|
|
|
|
schBaseTask.setTask_status(TaskStatus.CREATED.getCode()); |
|
|
|
schBaseTask.setRemark(errObj.getString("message")); |
|
|
|
break; |
|
|
|
} |
|
|
|
schBaseTask.setTask_status(TaskStatus.ISSUED.getCode()); |
|
|
|
// 判断是否是出错的任务
|
|
|
|
for (int i = 0; ObjectUtil.isNotEmpty(errArr) && i < errArr.size(); i++) { |
|
|
|
JSONObject errObj = errArr.getJSONObject(i); |
|
|
|
String taskCode = errObj.getString("task_code"); |
|
|
|
if (taskCode.equals(schBaseTask.getTask_code())) { |
|
|
|
// 出错的任务就设置出错信息为备注,不是出错就设置下发
|
|
|
|
schBaseTask.setTask_status(TaskStatus.CREATED.getCode()); |
|
|
|
schBaseTask.setRemark(errObj.getString("message")); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|