master
周文涛 2 years ago
parent a9945aa2ec
commit a5a7bb3324

@ -203,7 +203,7 @@ public class ApiController {
@ApiOperation(value = "刷新为完成的任务", notes = "任务完结通知")
@GetMapping("/restartTask")
public Result restartTask(){
public Result restartTask() throws InterruptedException {
//获取未执行完的任务
List<OcrIdentify> list = ocrIdentifyService.list(new LambdaQueryWrapper<OcrIdentify>().eq(OcrIdentify::getStatus, "0"));
List<String> identifyIdList = list.stream().map(l -> l.getId()).collect(Collectors.toList());
@ -212,6 +212,7 @@ public class ApiController {
for (OcrIdentify ocrIdentify : list) {
log.info("打印ocrIdentifyId:"+ocrIdentify.getId());
List<String> identifyUrlList = FileOUtils.fileLists(null, ocrIdentify.getIdentifyUrl());
Thread.sleep(1000L);
ocrIdentifyService.postSemantic(ocrIdentify,identifyUrlList);
}
}

@ -476,7 +476,6 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
}
@Transactional(rollbackFor = Exception.class)
@Async
public void executeTask() {
//获取任务
List<TaskModel> taskList = getTaskList();
@ -546,8 +545,6 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
//睡眠
try {
String parameter = taskModel.getParameter();
log.info("打印taskModel:");
log.info(taskModel.toString());
// 任务类型
if ("identify".equals(taskModel.getTaskType())) {
String[] parameters = parameter.split(",");
@ -559,8 +556,9 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
requestBody.put("task_id", task_id);
requestBody.put("img_path", image);
JSONObject semanticResponseJson = RestUtil.post(OcrConstant.api_test2_identify_url, requestBody);
//semanticResponseJson = JSONObject.parseObject("{\"医院名称\":[{\"area\":[[361,93],[623,39],[630,73],[368,127]],\"end\":6,\"ocrText\":\"黑石社区医院\",\"probability\":0.9874083762059627,\"start\":0,\"text\":\"黑石社区医院\"}],\"姓名\":[],\"时间\":[],\"科室\":[]}");
semanticResponseJson.put("identifyId", masterTaskId);
log.info("ocr识别返回数据:");
log.info(semanticResponseJson.toJSONString());
this.getSemanticInfo(semanticResponseJson);
//该子任务已执行,判断主任务是否残留
String masterTask = (String) redisUtil.get("identify_" + masterTaskId);

Loading…
Cancel
Save