master
周文涛 2 years ago
parent 962283716e
commit 463debeb89

@ -8,8 +8,10 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.OcrConstant;
import org.jeecg.common.util.AssertUtils;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.common.util.RestUtil;
import org.jeecg.modules.ocr.entity.OcrIdentify;
import org.jeecg.modules.ocr.entity.OcrRuleCheck;
import org.jeecg.modules.ocr.model.TaskModel;
@ -139,11 +141,30 @@ public class ApiController {
@PostMapping(value = "/imgNotify")
@Transactional(rollbackFor = Exception.class)
public JSONObject imgNotify() {
String ss="{\t\"requestId\":\"10001\",\t\"result\":{\t\t\"ocrResult\":[\t\t\t{\t\t\t\t\"tag\":\"hospitalName\",\t\t\t\t\"inputText\":\"仁和医院\",\t\t\t\t\"ocrText\":\"仁和医院\",\t\t\t\t\"ocrPrecisionRate\":0.8,\t\t\t\t\"sourceImage\":{\t\t\t\t\t\"fileName\":\"test1.png\",\t\t\t\t\t\"path\":\"/usr/local/ocr/test1.png\"\t\t\t\t},\t\t\t\t\"failureReason\":\"\"\t\t\t}\t\t],\t\t\"ruleValidation\":false,\t\t\"retrieveReviewCompliance\":\"80\",\t\t\"imageTagRetrievePercentage\":\"66.6\",\t\t\"failureReason\":\"医生名称不匹配\"\t}}";
JSONObject requestBody=JSONObject.parseObject(ss);
JSONObject semanticResponseJson = RestUtil.post("http://192.168.5.179:8080/api/task/image/ocr/callback", requestBody);
return semanticResponseJson;
/*String requestId = jsonObject.getString("requestId");
String fileName = jsonObject.getString("fileName");
AssertUtils.notEmpty(requestId,"请输入[请求唯一标识]");
AssertUtils.notEmpty(fileName,"请输入[图片名称]");*/
return JSONObject.parseObject("{\"requestId\":\"10001\",\"result\":{\"tag\":\"hospitalName\",\"inputText\":\"仁和医院\",\"ocrText\":\"仁和医院\",\"ocrPrecisionRate\":0.8,\"ruleValidation\":true,\"sourceImage\":{\"fileName\":\"test1.png\",\"path\":\"/usr/local/ocr/test1.png\"},\"failureReason\":\"图片不清晰\"}}");
//return JSONObject.parseObject("{\"requestId\":\"10001\",\"result\":{\"tag\":\"hospitalName\",\"inputText\":\"仁和医院\",\"ocrText\":\"仁和医院\",\"ocrPrecisionRate\":0.8,\"ruleValidation\":true,\"sourceImage\":{\"fileName\":\"test1.png\",\"path\":\"/usr/local/ocr/test1.png\"},\"failureReason\":\"图片不清晰\"}}");
}
@ApiOperation(value = "单张图片异步通知1", notes = "单张图片异步通知1")
@PostMapping(value = "/imgNotify1")
@Transactional(rollbackFor = Exception.class)
public JSONObject imgNotify1() {
String ss="{\t\"requestId\":\"10001\",\t\"result\":{\t\t\"ocrResult\":[\t\t\t{\t\t\t\t\"tag\":\"hospitalName\",\t\t\t\t\"inputText\":\"仁和医院\",\t\t\t\t\"ocrText\":\"仁和医院\",\t\t\t\t\"ocrPrecisionRate\":0.8,\t\t\t\t\"sourceImage\":{\t\t\t\t\t\"fileName\":\"test1.png\",\t\t\t\t\t\"path\":\"/usr/local/ocr/test1.png\"\t\t\t\t},\t\t\t\t\"failureReason\":\"\"\t\t\t}\t\t],\t\t\"ruleValidation\":false,\t\t\"retrieveReviewCompliance\":\"80\",\t\t\"imageTagRetrievePercentage\":\"66.6\",\t\t\"failureReason\":\"医生名称不匹配\"\t}}";
JSONObject requestBody=JSONObject.parseObject(ss);
JSONObject semanticResponseJson = RestUtil.post("https://192.168.5.179:8080/api/task/image/ocr/callback", requestBody);
return semanticResponseJson;
/*String requestId = jsonObject.getString("requestId");
String fileName = jsonObject.getString("fileName");
AssertUtils.notEmpty(requestId,"请输入[请求唯一标识]");
AssertUtils.notEmpty(fileName,"请输入[图片名称]");*/
//return JSONObject.parseObject("{\"requestId\":\"10001\",\"result\":{\"tag\":\"hospitalName\",\"inputText\":\"仁和医院\",\"ocrText\":\"仁和医院\",\"ocrPrecisionRate\":0.8,\"ruleValidation\":true,\"sourceImage\":{\"fileName\":\"test1.png\",\"path\":\"/usr/local/ocr/test1.png\"},\"failureReason\":\"图片不清晰\"}}");
}
@ApiOperation(value = "任务完结通知", notes = "任务完结通知")

@ -472,7 +472,7 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
redisUtil.del(masterTaskId);
//刷新Ocr识别任务状态
updateOcrIdentifyStatus(masterTaskId,"1");
log.debug("更新任务状态id:"+masterTaskId);
log.error("更新任务状态id:"+masterTaskId);
}else{
//主任务还存在,刷新主任务明细
redisUtil.set(masterTaskId,collect);

Loading…
Cancel
Save