@Override | @Override | ||||
public void execute() { | public void execute() { | ||||
logger.info("--卡片发行批次列查询开始--"); | |||||
logger.info("--卡片一行数据列查询开始--"); | |||||
int num = 0; | int num = 0; | ||||
try { | try { | ||||
int start = Math.toIntExact(repo.countId()); | int start = Math.toIntExact(repo.countId()); | ||||
num += size; | num += size; | ||||
hasMoreData = size >= BATCH_SIZE; | hasMoreData = size >= BATCH_SIZE; | ||||
} | } | ||||
logger.info("--卡片发行批次列查询结束,共处理 {} 条记录--", num); | |||||
logger.info("--卡卡片一行数据列查询结束,共处理 {} 条记录--", num); | |||||
} catch (ManagerException e) { | } catch (ManagerException e) { | ||||
logger.error("--卡片发行批次列查询失败:", e); | |||||
logger.error("--卡片一行数据列查询失败:", e); | |||||
e.printStackTrace(); | e.printStackTrace(); | ||||
} | } | ||||
} | } |
@Override | @Override | ||||
public void execute() { | public void execute() { | ||||
logger.info("--双片国密OBU发行批次列表查询开始--"); | |||||
logger.info("--双片国密OBU一发列表查询开始--"); | |||||
int num = 0; | int num = 0; | ||||
try { | try { | ||||
int start = Math.toIntExact(repo.countByEncryptType("0")); | int start = Math.toIntExact(repo.countByEncryptType("0")); | ||||
num += size; | num += size; | ||||
hasMoreData = size >= BATCH_SIZE; | hasMoreData = size >= BATCH_SIZE; | ||||
} | } | ||||
logger.info("--双片国密OBU发行批次列表查询结束,共处理 {} 条记录--", num); | |||||
logger.info("--双片国密OBU一发列表查询结束,共处理 {} 条记录--", num); | |||||
} catch (ManagerException e) { | } catch (ManagerException e) { | ||||
logger.error("--双片国密OBU发行批次列表查询失败:", e); | |||||
logger.error("--双片国密OBU一发列表查询失败:", e); | |||||
e.printStackTrace(); | e.printStackTrace(); | ||||
} | } | ||||
} | } |
@Override | @Override | ||||
public void execute() { | public void execute() { | ||||
logger.info("--单片OBU发行批次列表查询开始--"); | |||||
logger.info("--单片OBU一发列表查询开始--"); | |||||
int num = 0; | int num = 0; | ||||
try { | try { | ||||
int start = Math.toIntExact(repo.countByEncryptType("1")); | int start = Math.toIntExact(repo.countByEncryptType("1")); | ||||
num += size; | num += size; | ||||
hasMoreData = size >= BATCH_SIZE; | hasMoreData = size >= BATCH_SIZE; | ||||
} | } | ||||
logger.info("--单片OBU发行批次列表查询结束,共处理 {} 条记录--", num); | |||||
logger.info("--单片OBU一发列表查询结束,共处理 {} 条记录--", num); | |||||
} catch (ManagerException e) { | } catch (ManagerException e) { | ||||
logger.error("--单片OBU发行批次列表查询失败:", e); | |||||
logger.error("--单片OBU一发列表查询失败:", e); | |||||
e.printStackTrace(); | e.printStackTrace(); | ||||
} | } | ||||
} | } |
@Override | @Override | ||||
public void execute() { | public void execute() { | ||||
logger.info("--3DESOBU发行批次列表查询开始--"); | |||||
logger.info("--3DESOBU一发列表查询开始--"); | |||||
int num = 0; | int num = 0; | ||||
try { | try { | ||||
int start = Math.toIntExact(repo.countByEncryptType("2")); | int start = Math.toIntExact(repo.countByEncryptType("2")); | ||||
num += size; | num += size; | ||||
hasMoreData = size >= BATCH_SIZE; | hasMoreData = size >= BATCH_SIZE; | ||||
} | } | ||||
logger.info("--3DESOBU发行批次列表查询结束,共处理 {} 条记录--", num); | |||||
logger.info("--3DESOBU一发列表查询结束,共处理 {} 条记录--", num); | |||||
} catch (ManagerException e) { | } catch (ManagerException e) { | ||||
logger.error("--3DESOBU发行批次列表查询失败:", e); | |||||
logger.error("--3DESOBU一发列表查询失败:", e); | |||||
e.printStackTrace(); | e.printStackTrace(); | ||||
} | } | ||||
} | } |
HttpClient client = HttpClients.createDefault(); | HttpClient client = HttpClients.createDefault(); | ||||
// 发送请求 | // 发送请求 | ||||
HttpResponse response = sendRequest(client, url, params); | HttpResponse response = sendRequest(client, url, params); | ||||
; | |||||
// 处理返回 无响应则重试两次 | // 处理返回 无响应则重试两次 | ||||
for (int i = 0; i < RETRY_TIMES; i++) { | for (int i = 0; i < RETRY_TIMES; i++) { | ||||
response = sendRequest(client, url, params); | response = sendRequest(client, url, params); |
private BaiduOcrUtil baiduOcrUtil; | private BaiduOcrUtil baiduOcrUtil; | ||||
@Autowired | @Autowired | ||||
private ImageCompressManager imageCompressManager; | private ImageCompressManager imageCompressManager; | ||||
private static final String BASEURL="http://100.65.10.25:8049"; | |||||
public BusinessLicenseOcrResponse serviceHandle(BusinessLicenseOcrRequest req) throws ServiceHandleException { | public BusinessLicenseOcrResponse serviceHandle(BusinessLicenseOcrRequest req) throws ServiceHandleException { | ||||
if(!StringTools.hasText(req.getUrl())){ | if(!StringTools.hasText(req.getUrl())){ | ||||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("请传入图片地址"); | throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("请传入图片地址"); | ||||
public BusinessLicenseOcrResponse doBusiness(BusinessLicenseOcrRequest req) throws ServiceHandleException { | public BusinessLicenseOcrResponse doBusiness(BusinessLicenseOcrRequest req) throws ServiceHandleException { | ||||
try { | try { | ||||
URL url = new URL(req.getUrl()); | |||||
URL downloadUrl = new URL("http", "100.65.10.25", 8049, url.getPath()); | |||||
String compressedImgBase64 = imageCompressManager.getBaiduOcrCompressBase64(downloadUrl.toString()); | |||||
String reqUrl = req.getUrl(); | |||||
// 判断是否为/开头 | |||||
if (reqUrl.startsWith("/")) { | |||||
reqUrl = BASEURL + reqUrl; | |||||
}else { | |||||
reqUrl = BASEURL + "/" + reqUrl; | |||||
} | |||||
URL url = new URL(reqUrl); | |||||
String compressedImgBase64 = imageCompressManager.getBaiduOcrCompressBase64(url.toString()); | |||||
BusinessLicenseOcrResponse res = baiduOcr(compressedImgBase64); | BusinessLicenseOcrResponse res = baiduOcr(compressedImgBase64); | ||||
res.setImageUrl(url == null ? "" : url.toString()); | |||||
res.setImageUrl(req.getUrl()); | |||||
logger.info("营业执照识别结果>{}", res); | logger.info("营业执照识别结果>{}", res); | ||||
return res; | return res; | ||||
} catch (Exception e) { | } catch (Exception e) { |
@Autowired | @Autowired | ||||
private ImageCompressManager imageCompressManager; | private ImageCompressManager imageCompressManager; | ||||
private static final String BASEURL="http://100.65.10.25:8049"; | |||||
public IdCardOcrResponse serviceHandle(IdCardOcrRequest req) throws ServiceHandleException { | public IdCardOcrResponse serviceHandle(IdCardOcrRequest req) throws ServiceHandleException { | ||||
if(!StringTools.hasText(req.getUrl())){ | if(!StringTools.hasText(req.getUrl())){ | ||||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("请传入图片地址"); | throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("请传入图片地址"); | ||||
public IdCardOcrResponse doBusiness(IdCardOcrRequest req) throws ServiceHandleException { | public IdCardOcrResponse doBusiness(IdCardOcrRequest req) throws ServiceHandleException { | ||||
try { | try { | ||||
URL url = new URL(req.getUrl()); | |||||
URL downloadUrl = new URL("http", "100.65.10.25", 8049, url.getPath()); | |||||
String reqUrl = req.getUrl(); | |||||
// 判断是否为/开头 | |||||
if (reqUrl.startsWith("/")) { | |||||
reqUrl = BASEURL + reqUrl; | |||||
}else { | |||||
reqUrl = BASEURL + "/" + reqUrl; | |||||
} | |||||
URL url = new URL(reqUrl); | |||||
String compressedImgBase64 = imageCompressManager.getBaiduOcrCompressBase64(downloadUrl.toString()); | |||||
String compressedImgBase64 = imageCompressManager.getBaiduOcrCompressBase64(url.toString()); | |||||
IdCardOcrResponse res = baiduOcr(compressedImgBase64, req.getImageType()); | IdCardOcrResponse res = baiduOcr(compressedImgBase64, req.getImageType()); | ||||
res.setImageUrl(url == null ? "" : url.toString()); | |||||
res.setImageUrl(req.getUrl()); | |||||
logger.info("身份证识别结果>{}", res); | logger.info("身份证识别结果>{}", res); | ||||
return res; | return res; | ||||
} catch (Exception e) { | } catch (Exception e) { |
@Autowired | @Autowired | ||||
private ImageCompressManager imageCompressManager; | private ImageCompressManager imageCompressManager; | ||||
private static final String BASEURL="http://100.65.10.25:8049"; | |||||
public VehicleLicenseOcrResponse serviceHandle(VehicleLicenseOcrRequest req) throws ServiceHandleException { | public VehicleLicenseOcrResponse serviceHandle(VehicleLicenseOcrRequest req) throws ServiceHandleException { | ||||
if(!StringTools.hasText(req.getUrl())){ | if(!StringTools.hasText(req.getUrl())){ | ||||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("请传入图片地址"); | throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("请传入图片地址"); | ||||
public VehicleLicenseOcrResponse doBusiness(VehicleLicenseOcrRequest req) throws ServiceHandleException { | public VehicleLicenseOcrResponse doBusiness(VehicleLicenseOcrRequest req) throws ServiceHandleException { | ||||
try { | try { | ||||
URL url = new URL(req.getUrl()); | |||||
URL downloadUrl = new URL("http", "100.65.10.25", 8049, url.getPath()); | |||||
String reqUrl = req.getUrl(); | |||||
// 判断是否为/开头 | |||||
if (reqUrl.startsWith("/")) { | |||||
reqUrl = BASEURL + reqUrl; | |||||
}else { | |||||
reqUrl = BASEURL + "/" + reqUrl; | |||||
} | |||||
URL url = new URL(reqUrl); | |||||
String compressedImgBase64 = imageCompressManager.getBaiduOcrCompressBase64(downloadUrl.toString()); | |||||
String compressedImgBase64 = imageCompressManager.getBaiduOcrCompressBase64(url.toString()); | |||||
VehicleLicenseOcrResponse res = baiduOcr(compressedImgBase64, req.getImageType()); | VehicleLicenseOcrResponse res = baiduOcr(compressedImgBase64, req.getImageType()); | ||||
res.setImageUrl(url == null ? "" : url.toString()); | |||||
res.setImageUrl(req.getUrl()); | |||||
logger.info("驾驶证识别结果>{}", res); | logger.info("驾驶证识别结果>{}", res); | ||||
return res; | return res; | ||||
} catch (Exception e) { | } catch (Exception e) { |