diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/api/controller/ApiController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/api/controller/ApiController.java index 952e1f9..2c0dd70 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/api/controller/ApiController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/api/controller/ApiController.java @@ -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 = "任务完结通知") diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/service/impl/OcrIdentifyServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/service/impl/OcrIdentifyServiceImpl.java index 0fb3500..30fa167 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/service/impl/OcrIdentifyServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/service/impl/OcrIdentifyServiceImpl.java @@ -472,7 +472,7 @@ public class OcrIdentifyServiceImpl extends ServiceImpl