假如你现在还在为自己的技术担忧,假如你现在想提升自己的工资,假如你想在职场上获得更多的话语权,假如你想顺利的度过35岁这个魔咒,假如你想体验BAT的工作环境,那么现在请我们一起开启提升技术之旅吧,详情请点击
一,总览
具体细节请见上一篇博文
二,不同之处
2.1,接口
1 package com.bill99.coe.ocr.service; 2 3 import java.util.Map; 4 5 import org.springframework.web.multipart.MultipartFile; 6 7 public interface OcrService { 8 9 10 /**11 * 身份证识别12 * 13 * @param imageFile14 * @return15 */16 MapidCardRecognize(MultipartFile imageFile);17 18 /**19 * 银行卡识别20 * 21 * @param imageFile22 * @return23 */24 Map bankCardRecognize(MultipartFile imageFile);25 26 /**27 * 行驶证识别28 * 29 * @param imageFile30 * @return31 */32 Map veCardRecognize(MultipartFile imageFile);33 34 /**35 * 驾驶证识别36 * 37 * @param imageFile38 * @return39 */40 Map driverCardRecognize(MultipartFile imageFile);41 42 /**43 * 营业执照识别44 * 45 * @param imageFile46 * @return47 */48 Map businessLicenseRecognize(MultipartFile imageFile);49 50 /**51 * 通用类型识别52 * @param recotype53 * @param imageFile54 * @return55 */56 Map ocrRecognize(String recotype, MultipartFile imageFile);57 }
2.2,实现类OcrServiceImpl
1 package com.bill99.coe.ocr.service.impl; 2 3 import java.util.Map; 4 5 import org.springframework.web.multipart.MultipartFile; 6 7 import com.bill99.coe.ocr.client.OcrServer; 8 import com.bill99.coe.ocr.service.OcrService; 9 10 public class OcrServiceImpl implements OcrService {11 /**12 * ocr服务调用13 */14 private OcrServer ocrServer = null;15 16 @Override17 public MapidCardRecognize(MultipartFile imageFile) {18 return ocrServer.pictureRecognition("IdCard", imageFile);19 }20 21 @Override22 public Map bankCardRecognize(MultipartFile imageFile) {23 return ocrServer.pictureRecognition("BankCard", imageFile);24 }25 26 @Override27 public Map veCardRecognize(MultipartFile imageFile) {28 return ocrServer.pictureRecognition("VeCard", imageFile);29 }30 31 @Override32 public Map driverCardRecognize(MultipartFile imageFile) {33 return ocrServer.pictureRecognition("DriverCard", imageFile);34 }35 36 @Override37 public Map businessLicenseRecognize(MultipartFile imageFile) {38 return ocrServer.pictureRecognition("BusinessLicense", imageFile);39 }40 41 @Override42 public Map ocrRecognize(String recotype,43 MultipartFile imageFile) {44 return ocrServer.pictureRecognition(recotype, imageFile);45 }46 47 public void setOcrServer(OcrServer ocrServer) {48 this.ocrServer = ocrServer;49 }50 51 }
2.3,返回json结果
1 /* 身份证识别结果JSON数据定义: 2 "name" --------------姓名 3 "gender" --------------性别 4 "nation" --------------民族 5 “birthdate” -------------生日 6 “address” ---------------住址 7 “idno” -----------------身份证号码 8 “issuedby” -------------------签发机关 9 “validthru” -------------------有效期限10 "cropped_image" ---------------切割图11 "head_portrait" -------------------头像12 13 14 银行卡识别结果JSON数据定义:15 "bankname" --------------银行名称16 "cardname" --------------卡名17 "cardtype" --------------卡类型18 “cardno” -------------卡号19 “expmonth” ---------------有效期截止月份20 “expyear” ----------------有效期截止年份21 "cropped_image" ---------------切割图22 23 行驶证识别结果JSON数据定义:24 "plateno" ------------车牌号码25 " vehicletype " --------------车辆类型26 "veaddress" --------------住址27 “usecharacter” -------------使用性质28 “engineno” ---------------发动机号码29 “model” ----------------品牌型号30 “vin” -------------------车辆识别代码31 “registerdate” -------------------注册日期32 “issuedate” -------------------发证日期33 "cropped_image" ---------------切割图34 35 驾驶证识别结果JSON数据定义:36 "name" --------------姓名37 "gender" --------------性别38 "nation" --------------国籍39 "cardno" --------------证号40 “address” -------------住址41 “birthdate” -------------出生日期42 “issuedate” -------------------初次领证日期43 “driverclass” -------------------准驾车型44 “validdate” -------------------有效期限45 "cropped_image" ---------------切割图46 47 营业执照识别结果JSON数据定义:48 统一社会信用代码 : 49 名称 : 50 类型 : 51 法定代表人 : 52 注册资本 : 53 成立日期 : 年-月-日54 住所 : 55 营业期限自 : 年-月-日56 营业期限至 : 年-月-日57 经营范围 : 58 登记机关 : 59 核准日期 : 年-月-日60 经营状态 : */61 62 63 /*64 错误码 具体错误信息65 0 正确66 1 识别错误67 2 登录失败68 3 服务器忙69 4 服务未启动70 5 服务器异常71 6 数据库错误72 7 无合格图像73 8 识别次数已经用完*/
最主要的就是返回的json格式的结果不一样