更改一下这段代码的错误之处public void startReadRFID(String ip, RobotTaskCallBackEntity robotTaskCallBackEntity) { String jobId = robotTaskCallBackEntity.getData().getJobId(); this.requestClient.startReadRfid(ip, (apiResult, forestRequest, forestResponse) -> { log.info("读RFID响应"+ apiResult.getString("msg")); RobotTask select = this.robotTaskDao.selectByJobId(jobId); if (apiResult.getInteger("code").intValue() == 200) { log.info("rfid开始读取!"); } else { this.requestClient.abortRobotJob(jobId); try { CheckingTask checkingTask = this.checkingTaskService.selectById(select.getTaskId()); checkingTask.setTaskStatus(Integer.valueOf(5)); this.checkingTaskService.update((CheckingTask)checkingTask); } catch (Exception e) { log.error("读取RFID失败后无法重置任务状态为新建!"); log.error(e.getMessage()); } } }(forestRuntimeException, forestRequest, forestResponse) -> { // log.error(forestRuntimeException.getMessage()); log.error("开启RFID自动读取失败!"); RobotTask select = this.robotTaskDao.selectByJobId(jobId); this.requestClient.abortRobotJob(jobId); try { CheckingTask checkingTask = this.checkingTaskService.selectById(select.getTaskId()); checkingTask.setTaskStatus(Integer.valueOf(5)); this.checkingTaskService.update((CheckingTask)checkingTask); } catch (Exception e) { log.error("读取RFID失败后无法重置任务状态为新建!"); log.error(e.getMessage()); } }); }
时间: 2024-02-15 18:29:04 浏览: 65
操作系统源代码.doc
在这段代码中有一个错误:缺少括号,导致 Lambda 表达式无法正确闭合。正确的代码应该是:
public void startReadRFID(String ip, RobotTaskCallBackEntity robotTaskCallBackEntity) {
String jobId = robotTaskCallBackEntity.getData().getJobId();
this.requestClient.startReadRfid(ip, (apiResult, forestRequest, forestResponse) -> {
log.info("读RFID响应"+ apiResult.getString("msg"));
RobotTask select = this.robotTaskDao.selectByJobId(jobId);
if (apiResult.getInteger("code").intValue() == 200) {
log.info("rfid开始读取!");
} else {
this.requestClient.abortRobotJob(jobId);
try {
CheckingTask checkingTask = this.checkingTaskService.selectById(select.getTaskId());
checkingTask.setTaskStatus(Integer.valueOf(5));
this.checkingTaskService.update((CheckingTask)checkingTask);
} catch (Exception e) {
log.error("读取RFID失败后无法重置任务状态为新建!");
log.error(e.getMessage());
}
}
}, (forestRuntimeException, forestRequest, forestResponse) -> {
log.error("开启RFID自动读取失败!");
RobotTask select = this.robotTaskDao.selectByJobId(jobId);
this.requestClient.abortRobotJob(jobId);
try {
CheckingTask checkingTask = this.checkingTaskService.selectById(select.getTaskId());
checkingTask.setTaskStatus(Integer.valueOf(5));
this.checkingTaskService.update((CheckingTask)checkingTask);
} catch (Exception e) {
log.error("读取RFID失败后无法重置任务状态为新建!");
log.error(e.getMessage());
}
});
}
阅读全文