pc ocr识别

This commit is contained in:
shuo.wang
2025-05-22 16:03:22 +08:00
parent f1b256205e
commit 6310372d2a

View File

@@ -1,8 +1,12 @@
package com.cool.store.controller.webb; package com.cool.store.controller.webb;
import com.cool.store.dto.ocr.InvoiceDTO; import com.cool.store.dto.ocr.InvoiceDTO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.response.ResponseResult; import com.cool.store.response.ResponseResult;
import com.cool.store.service.AliyunService; import com.cool.store.service.AliyunService;
import com.cool.store.vo.BusinessLicenseInfoVO;
import com.cool.store.vo.FoodLicenseVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -34,6 +38,27 @@ public class PCOcrController {
return ResponseResult.success(aliyunService.getRecognizeInvoiceWithOptions(imageUrl)); return ResponseResult.success(aliyunService.getRecognizeInvoiceWithOptions(imageUrl));
} }
@GetMapping(path = "/getBusinessLicenseInfo")
@ApiOperation("根据营业证照解析获取数据")
public ResponseResult<BusinessLicenseInfoVO> getBusinessLicenseInfo(@RequestParam(value = "imageUrl")String imageUrl){
try {
BusinessLicenseInfoVO businessLicenseInfo = aliyunService.getBusinessLicenseInfo(imageUrl);
return ResponseResult.success(businessLicenseInfo);
} catch (Exception e) {
throw new ServiceException(ErrorCodeEnum.BUSINESS_LICENSE_PARSE_FAIL);
}
}
@GetMapping(path = "/getFoodBusinessLicense")
@ApiOperation("根据食营证照解析获取数据")
public ResponseResult<FoodLicenseVO> getFoodLicense(@RequestParam(value = "imageUrl")String imageUrl){
try {
FoodLicenseVO businessLicenseInfo = aliyunService.getFoodLicense(imageUrl);
return ResponseResult.success(businessLicenseInfo);
} catch (Exception e) {
throw new ServiceException(ErrorCodeEnum.FOOD_BUSINESS_LICENSE_PARSE_FAIL);
}
}
} }