问题修改

This commit is contained in:
hayu 2025-08-12 15:01:52 +08:00
parent 15895c528e
commit 185769e896
3 changed files with 32 additions and 0 deletions

View File

@ -92,6 +92,14 @@ public class AppOcrController extends BaseController {
return appOcrService.getOcrCode(bean); return appOcrService.getOcrCode(bean);
} }
@ApiOperation(value = "获取ocr编码")
@PreventRepeatSubmit
@PostMapping("/getOcrCodeTwo")
public AjaxResult getOcrCodeTwo(@RequestBody MachineOcrBean bean)
{
return appOcrService.getOcrCodeTwo(bean);
}
@ApiOperation(value = "推送设备至第三方入库") @ApiOperation(value = "推送设备至第三方入库")
@PreventRepeatSubmit @PreventRepeatSubmit
@PostMapping("/addDeviceNumber") @PostMapping("/addDeviceNumber")

View File

@ -61,4 +61,11 @@ public interface AppOcrService {
* @return * @return
*/ */
AjaxResult addDeviceNumber(MachineOcrBean bean); AjaxResult addDeviceNumber(MachineOcrBean bean);
/**
* 获取ocr编码
* @param bean
* @return
*/
AjaxResult getOcrCodeTwo(MachineOcrBean bean);
} }

View File

@ -263,6 +263,23 @@ public class AppOcrServiceImpl implements AppOcrService {
return AjaxResult.success(js); return AjaxResult.success(js);
} }
@Override
public AjaxResult getOcrCodeTwo(MachineOcrBean bean) {
String url = "http://10.138.55.102:10000/api_gqj/pre";
JSONObject js = null;
try {
System.out.println("ocr-base64数据:" + bean.getImage());
String jsonStr = JSONObject.toJSONString(bean);
String data = HttpHelper.sendHttpPostForToken(url, jsonStr);
System.out.println("ocr返回数据:" + data);
js = JSONObject.parseObject(data);
} catch (Exception e) {
e.printStackTrace();
log.error("获取OCR编码失败:" + e.getMessage());
}
return AjaxResult.success(js);
}
/** /**
* 推送设备至第三方入库 * 推送设备至第三方入库
* @param bean * @param bean