From 5520f1f7168a9e4e3af508e6a38eea4752cbd493 Mon Sep 17 00:00:00 2001
From: liyj <1003249715@qq.com>
Date: Mon, 02 Sep 2024 16:10:39 +0800
Subject: [PATCH] 1、上传附件加上身份证识别结果
---
/dev/null | 166 ------------------
dyh-service/dyh-base/src/main/java/cn/huge/module/sys/dto/FileInfoBaseDTO.java | 6
dyh-service/dyh-base/src/main/java/cn/huge/module/constant/NotionBaseConstsEnum.java | 143 +++++++++++++++
dyh-service/dyh-base/src/main/java/cn/huge/module/sys/dto/IdcardOcrResultDTO.java | 91 ++++++++++
dyh-service/dyh-sys/src/main/java/cn/huge/module/utils/BaiduMapUtils.java | 3
dyh-service/dyh-sys/src/main/java/cn/huge/module/file/controller/web/FileInfoWebController.java | 13
dyh-service/dyh-sys/src/main/java/cn/huge/module/utils/BaiduOcrUtils.java | 106 +++++++++++
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/po/CasePerson.java | 12 -
8 files changed, 356 insertions(+), 184 deletions(-)
diff --git a/dyh-service/dyh-base/src/main/java/cn/huge/base/common/utils/BaiduOcrUtils.java b/dyh-service/dyh-base/src/main/java/cn/huge/base/common/utils/BaiduOcrUtils.java
deleted file mode 100644
index 31e851f..0000000
--- a/dyh-service/dyh-base/src/main/java/cn/huge/base/common/utils/BaiduOcrUtils.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package cn.huge.base.common.utils;
-
-
-import com.baidu.aip.ocr.AipOcr;
-import com.google.common.collect.Maps;
-import org.json.JSONObject;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @title: 百度云OCR工具类
- * @description: 百度云OCR工具类
- * @company: hugeinfo
- * @author: liyj
- * @time: 2021-11-05 16:51:48
- * @version: 1.0.0
- */
-public class BaiduOcrUtils {
- // 公司百度云账号
-// public static final String APP_ID = "24661114";
-// public static final String API_KEY = "cKXdjXhgRP9fsbI15UxGB0jM";
-// public static final String SECRET_KEY = "1X1BY7oAAmjemQgzzdfG3VnTh0rUTO2X";
- // 个人账号-15602261488
- public static final String APP_ID = "27535980";
- public static final String API_KEY = "6U6tSA75gKf4UMXvHgDpzOC9";
- public static final String SECRET_KEY = "BBjjCDhy2sAVO0jfiaGn8OWIGE470lWU";
-
- public static void main(String[] args) {
-
- }
-
- /**
- * 身份证识别(图片路径)
- * @param imagePath
- * @return
- */
- public static JSONObject idcardRecoImg(String imagePath) {
- AipOcr client = new AipOcr(APP_ID,API_KEY,SECRET_KEY);
- // 设置识别身份证正面参数 front - 身份证含照片的一面 back - 身份证带国徽的一面
- String idCardSide = "front";
-
- // 自定义参数定义
- HashMap<String, String> options = new HashMap<String, String>();
- options.put("detect_direction", "true");
- options.put("detect_risk", "true");
-
- JSONObject response = client.idcard(imagePath, idCardSide, options);
- return response;
-
- }
-
- /**
- * 身份证识别(二进制流)
- * @param images
- * @return
- */
- public static JSONObject idcardRecoByte(byte[] images) {
- AipOcr client = new AipOcr(APP_ID,API_KEY,SECRET_KEY);
- // 设置识别身份证正面参数 front - 身份证含照片的一面 back - 身份证带国徽的一面
- String idCardSide = "front";
-
- // 自定义参数定义
- HashMap<String, String> options = new HashMap<String, String>();
- options.put("detect_direction", "true");
- options.put("detect_risk", "true");
-
- JSONObject response = client.idcard(images, idCardSide, options);
- return response;
- }
-
- /**
- * 身份证识别(二进制流)
- * @param images
- * @return
- */
- public static Map<String, Object> ocrIdcard(byte[] images) {
- Map<String, Object> map = Maps.newHashMap();
- AipOcr client = new AipOcr(APP_ID,API_KEY,SECRET_KEY);
- // 设置识别身份证正面参数 front - 身份证含照片的一面 back - 身份证带国徽的一面
- String idCardSide = "front";
-
- // 自定义参数定义
- HashMap<String, String> options = new HashMap<String, String>();
- options.put("detect_direction", "true");
- options.put("detect_risk", "true");
-
- JSONObject json = client.idcard(images, idCardSide, options);
- JSONObject result = json.getJSONObject("words_result");
- String sex = result.getJSONObject("性别").getString("words");
- map.put("sex",sex);
- String name = result.getJSONObject("姓名").getString("words");
- map.put("trueName",name);
- String address = result.getJSONObject("住址").getString("words");
- map.put("sendAddress",address);
- String idcard = result.getJSONObject("公民身份号码").getString("words");
- map.put("certificateType", "09_00015-1");
- map.put("certificateTypeName", "身份证");
- map.put("certificateNumber",idcard);
- String bir = result.getJSONObject("出生").getString("words");
- String birthday = "";
- birthday += bir.substring(0,4)+"-"+bir.substring(4,6)+"-"+bir.substring(6,8);
- map.put("birthday",birthday);
- String nation = result.getJSONObject("民族").getString("words")+"族";
- map.put("nation",nation);
- return map;
- }
-
- /**
- * 身份证识别(二进制流)
- *
- * @param images
- * @return
- */
- public static Map<String, Object> ocrIdcard2(byte[] images) {
- Map<String, Object> map = Maps.newHashMap();
- AipOcr client = new AipOcr(APP_ID, API_KEY, SECRET_KEY);
- // 设置识别身份证正面参数 front - 身份证含照片的一面 back - 身份证带国徽的一面
- String idCardSide = "front";
-
- // 自定义参数定义
- HashMap<String, String> options = new HashMap<String, String>();
- options.put("detect_direction", "true");
- options.put("detect_risk", "true");
-
- JSONObject json = client.idcard(images, idCardSide, options);
- JSONObject result = json.getJSONObject("words_result");
- String sex = result.getJSONObject("性别").getString("words");
- map.put("sex", sex+"性");
- String name = result.getJSONObject("姓名").getString("words");
- map.put("name", name);
- String address = result.getJSONObject("住址").getString("words");
- map.put("address", address);
- String idcard = result.getJSONObject("公民身份号码").getString("words");
- map.put("idcard", idcard);
- String bir = result.getJSONObject("出生").getString("words");
- String birthday = "";
- birthday += bir.substring(0, 4) + "-" + bir.substring(4, 6) + "-" + bir.substring(6, 8);
- map.put("birthday", birthday);
- String nation = result.getJSONObject("民族").getString("words") + "族";
- map.put("nation", nation);
- return map;
- }
-}
-/**
- * -------------------_ooOoo_-------------------
- * ------------------o8888888o------------------
- * ------------------88" . "88------------------
- * ------------------(| -_- |)------------------
- * ------------------O\ = /O------------------
- * ---------------____/`---'\____---------------
- * -------------.' \\| |// `.-------------
- * ------------/ \\||| : |||// \------------
- * -----------/ _||||| -:- |||||- \-----------
- * -----------| | \\\ - /// | |-----------
- * -----------| \_| ''\---/'' | |-----------
- * -----------\ .-\__ `-` ___/-. /-----------
- * ---------___`. .' /--.--\ `. . __----------
- * ------."" '< `.___\_<|>_/___.' >'"".-------
- * -----| | : `- \`.;`\ _ /`;.`/ - ` : | |-----
- * -----\ \ `-. \_ __\ /__ _/ .-` / /-----
- * ======`-.____`-.___\_____/___.-`____.-'======
- * -------------------`=---='
- * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- * ---------佛祖保佑---hugeinfo---永无BUG----------
- */
diff --git a/dyh-service/dyh-base/src/main/java/cn/huge/module/constant/NotionBaseConstsEnum.java b/dyh-service/dyh-base/src/main/java/cn/huge/module/constant/NotionBaseConstsEnum.java
new file mode 100644
index 0000000..034f47e
--- /dev/null
+++ b/dyh-service/dyh-base/src/main/java/cn/huge/module/constant/NotionBaseConstsEnum.java
@@ -0,0 +1,143 @@
+package cn.huge.module.constant;
+
+/**
+ * @title: 调解相关常量枚举类
+ * @description: 调解相关常量枚举类
+ * @company: hugeinfo
+ * @author: liyj
+ * @time: 2021-11-05 16:51:48
+ * @version: 1.0.0
+ */
+public enum NotionBaseConstsEnum {
+
+ /**
+ * 民族
+ */
+ NATION_1("09_00005-1", "汉族"),
+ NATION_2("09_00005-2", "蒙古族"),
+ NATION_3("09_00005-3", "回族"),
+ NATION_4("09_00005-4", "藏族"),
+ NATION_5("09_00005-5", "维吾尔族"),
+ NATION_6("09_00005-6", "苗族"),
+ NATION_7("09_00005-7", "彝族"),
+ NATION_8("09_00005-8", "壮族"),
+ NATION_9("09_00005-9", "布依族"),
+ NATION_10("09_00005-10", "朝鲜族"),
+ NATION_11("09_00005-11", "满族"),
+ NATION_12("09_00005-12", "侗族"),
+ NATION_13("09_00005-13", "瑶族"),
+ NATION_14("09_00005-14", "白族"),
+ NATION_15("09_00005-15", "土家族"),
+ NATION_16("09_00005-16", "哈尼族"),
+ NATION_17("09_00005-17", "哈萨克族"),
+ NATION_18("09_00005-18", "傣族"),
+ NATION_19("09_00005-19", "黎族"),
+ NATION_20("09_00005-20", "傈僳族"),
+ NATION_21("09_00005-21", "佤族"),
+ NATION_22("09_00005-22", "畲族"),
+ NATION_23("09_00005-23", "高山族"),
+ NATION_24("09_00005-24", "拉祜族"),
+ NATION_25("09_00005-25", "水族"),
+ NATION_26("09_00005-26", "东乡族"),
+ NATION_27("09_00005-27", "纳西族"),
+ NATION_28("09_00005-28", "景颇族"),
+ NATION_29("09_00005-29", "柯尔克孜族"),
+ NATION_30("09_00005-30", "土族"),
+ NATION_31("09_00005-31", "达斡尔族"),
+ NATION_32("09_00005-32", "仫佬族"),
+ NATION_33("09_00005-33", "羌族"),
+ NATION_34("09_00005-34", "布郎族"),
+ NATION_35("09_00005-35", "撒拉族"),
+ NATION_36("09_00005-36", "毛南族"),
+ NATION_37("09_00005-37", "仡佬族"),
+ NATION_38("09_00005-38", "锡伯族"),
+ NATION_39("09_00005-39", "阿昌族"),
+ NATION_40("09_00005-40", "普米族"),
+ NATION_41("09_00005-41", "塔吉克族"),
+ NATION_42("09_00005-42", "怒族"),
+ NATION_43("09_00005-43", "乌孜别克族"),
+ NATION_44("09_00005-44", "俄罗斯族"),
+ NATION_45("09_00005-45", "鄂温克族"),
+ NATION_46("09_00005-46", "崩龙族"),
+ NATION_47("09_00005-47", "保安族"),
+ NATION_48("09_00005-48", "裕固族"),
+ NATION_49("09_00005-49", "京族"),
+ NATION_50("09_00005-50", "塔塔尔族"),
+ NATION_51("09_00005-51", "独龙族"),
+ NATION_52("09_00005-52", "鄂伦春族"),
+ NATION_53("09_00005-53", "赫哲族"),
+ NATION_54("09_00005-54", "门巴族"),
+ NATION_55("09_00005-55", "珞巴族"),
+ NATION_56("09_00005-56", "基诺族"),
+ NATION_57("09_00005-57", "台湾人"),
+ NATION_58("09_00005-58", "香港人"),
+ NATION_59("09_00005-59", "澳门人"),
+ NATION_60("09_00005-60", "华侨"),
+ NATION_61("09_00005-255", "其他");
+
+
+ /**
+ * 代码编号
+ */
+ private String index;
+
+ /**
+ * 描述
+ */
+ private String des;
+
+ public String getIndex() {
+ return index;
+ }
+
+ public void setIndex(String index) {
+ this.index = index;
+ }
+
+ public String getDes() {
+ return des;
+ }
+
+ public void setDes(String desc) {
+ this.des = desc;
+ }
+
+ /**
+ * 构造方法
+ * @param index
+ * @param des
+ */
+ NotionBaseConstsEnum(String index, String des) {
+ this.index = index;
+ this.des = des;
+ }
+
+ /**
+ * 静态方法
+ * @param index
+ * @return
+ */
+ public static String getDes(String index) {
+ for (NotionBaseConstsEnum constantEnum : NotionBaseConstsEnum.values()) {
+ if (constantEnum.getIndex().equals(index)) {
+ return constantEnum.des;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * 静态方法
+ * @param des
+ * @return
+ */
+ public static String getIndex(String des) {
+ for (NotionBaseConstsEnum constantEnum : NotionBaseConstsEnum.values()) {
+ if (constantEnum.getDes().equals(des)) {
+ return constantEnum.index;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/dyh-service/dyh-base/src/main/java/cn/huge/module/sys/dto/FileInfoBaseDTO.java b/dyh-service/dyh-base/src/main/java/cn/huge/module/sys/dto/FileInfoBaseDTO.java
index 18cdec3..4fc2489 100644
--- a/dyh-service/dyh-base/src/main/java/cn/huge/module/sys/dto/FileInfoBaseDTO.java
+++ b/dyh-service/dyh-base/src/main/java/cn/huge/module/sys/dto/FileInfoBaseDTO.java
@@ -4,6 +4,7 @@
import lombok.Data;
import java.util.Date;
+import java.util.Map;
/**
* @title: 附件信息数据传输对象
@@ -156,6 +157,11 @@
private Integer uploaderType;
/**
+ * 身份证识别结果
+ */
+ private IdcardOcrResultDTO idcardOcrResult;
+
+ /**
* 前端固定参数,值为:done
*/
private String status;
diff --git a/dyh-service/dyh-base/src/main/java/cn/huge/module/sys/dto/IdcardOcrResultDTO.java b/dyh-service/dyh-base/src/main/java/cn/huge/module/sys/dto/IdcardOcrResultDTO.java
new file mode 100644
index 0000000..1f9a829
--- /dev/null
+++ b/dyh-service/dyh-base/src/main/java/cn/huge/module/sys/dto/IdcardOcrResultDTO.java
@@ -0,0 +1,91 @@
+package cn.huge.module.sys.dto;
+
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+
+
+/**
+ * @title: 身份证识别结果集
+ * @description: 身份证识别结果集
+ * @company:hugeinfo
+ * @author: liyj
+ * @time: 2022-03-22 11:41:14
+ * @version 1.0.0
+ */
+@Data
+public class IdcardOcrResultDTO {
+
+ /**
+ * 姓名/企业/机构名称
+ */
+ private String trueName;
+
+ /**
+ * 性别
+ */
+ private String sex;
+
+ /**
+ * 性别名称
+ */
+ private String sexName;
+
+ /**
+ * 证件类型
+ */
+ private String certiType;
+
+ /**
+ * 证件类型名称
+ */
+ private String certiTypeName;
+
+ /**
+ * 证件号码
+ */
+ private String certiNo;
+
+ /**
+ * 出生日期
+ */
+ private String birthday;
+
+ /**
+ * 户籍/住所地址详细地址
+ */
+ private String placeAddr;
+
+ /**
+ * 民族
+ */
+ private String nation;
+
+ /**
+ * 民族名称
+ */
+ private String nationName;
+
+}
+/**
+ * -------------------_ooOoo_-------------------
+ * ------------------o8888888o------------------
+ * ------------------88" . "88------------------
+ * ------------------(| -_- |)------------------
+ * ------------------O\ = /O------------------
+ * ---------------____/`---'\____---------------
+ * -------------.' \\| |// `.-------------
+ * ------------/ \\||| : |||// \------------
+ * -----------/ _||||| -:- |||||- \-----------
+ * -----------| | \\\ - /// | |-----------
+ * -----------| \_| ''\---/'' | |-----------
+ * -----------\ .-\__ `-` ___/-. /-----------
+ * ---------___`. .' /--.--\ `. . __----------
+ * ------."" '< `.___\_<|>_/___.' >'"".-------
+ * -----| | : `- \`.;`\ _ /`;.`/ - ` : | |-----
+ * -----\ \ `-. \_ __\ /__ _/ .-` / /-----
+ * ======`-.____`-.___\_____/___.-`____.-'======
+ * -------------------`=---='
+ * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ * ---------佛祖保佑---hugeinfo---永无BUG----------
+ */
diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/po/CasePerson.java b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/po/CasePerson.java
index 4088c02..aa63d13 100644
--- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/po/CasePerson.java
+++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/po/CasePerson.java
@@ -99,18 +99,6 @@
private String orgaTypeName;
/**
- * 证件类型
- */
- @TableField(value = "certi_type")
- private String certiType;
-
- /**
- * 证件类型名称
- */
- @TableField(value = "certi_type_name")
- private String certiTypeName;
-
- /**
* 证件号码
*/
@TableField(value = "certi_no")
diff --git a/dyh-service/dyh-sys/src/main/java/cn/huge/module/file/controller/web/FileInfoWebController.java b/dyh-service/dyh-sys/src/main/java/cn/huge/module/file/controller/web/FileInfoWebController.java
index 3aef0b7..b91f202 100644
--- a/dyh-service/dyh-sys/src/main/java/cn/huge/module/file/controller/web/FileInfoWebController.java
+++ b/dyh-service/dyh-sys/src/main/java/cn/huge/module/file/controller/web/FileInfoWebController.java
@@ -1,6 +1,8 @@
package cn.huge.module.file.controller.web;
import cn.huge.base.common.exception.ClientException;
+import cn.huge.module.sys.dto.IdcardOcrResultDTO;
+import cn.huge.module.utils.BaiduOcrUtils;
import cn.huge.base.common.utils.ContentTypeUtils;
import cn.huge.base.common.utils.ReturnFailUtils;
import cn.huge.base.common.utils.ReturnSucUtils;
@@ -23,9 +25,6 @@
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.PageRequest;
-import org.springframework.data.domain.Sort;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
@@ -39,8 +38,6 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
/**
* @title: 附件信息表接口api-web端
@@ -102,6 +99,12 @@
FileInfo fileInfo = service.webUploadFile(file, mainId, ownerId, ownerType, fileCount, uploaderDTO);
FileInfoBaseDTO fileInfoBaseDTO = new FileInfoBaseDTO();
BeanUtils.copyProperties(fileInfo, fileInfoBaseDTO);
+
+ // 如果是身份证,就采用ocr失败
+ if (FileOwnerTypeBaseEnum.OWNER_TYPE_202.getIndex().equals(ownerType)){
+ fileInfoBaseDTO.setIdcardOcrResult(BaiduOcrUtils.ocrIdcard(file.getBytes()));
+ }
+
files.add(fileInfoBaseDTO);
fileCount++;
} else {
diff --git a/dyh-service/dyh-base/src/main/java/cn/huge/base/common/utils/BaiduMapUtils.java b/dyh-service/dyh-sys/src/main/java/cn/huge/module/utils/BaiduMapUtils.java
similarity index 97%
rename from dyh-service/dyh-base/src/main/java/cn/huge/base/common/utils/BaiduMapUtils.java
rename to dyh-service/dyh-sys/src/main/java/cn/huge/module/utils/BaiduMapUtils.java
index 58ac50c..0cd9f35 100644
--- a/dyh-service/dyh-base/src/main/java/cn/huge/base/common/utils/BaiduMapUtils.java
+++ b/dyh-service/dyh-sys/src/main/java/cn/huge/module/utils/BaiduMapUtils.java
@@ -1,5 +1,6 @@
-package cn.huge.base.common.utils;
+package cn.huge.module.utils;
+import cn.huge.base.common.utils.HttpClientUtils;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
diff --git a/dyh-service/dyh-sys/src/main/java/cn/huge/module/utils/BaiduOcrUtils.java b/dyh-service/dyh-sys/src/main/java/cn/huge/module/utils/BaiduOcrUtils.java
new file mode 100644
index 0000000..ddf10fe
--- /dev/null
+++ b/dyh-service/dyh-sys/src/main/java/cn/huge/module/utils/BaiduOcrUtils.java
@@ -0,0 +1,106 @@
+package cn.huge.module.utils;
+
+
+import cn.huge.module.constant.CaseBaseConstsEnum;
+import cn.huge.module.constant.NotionBaseConstsEnum;
+import cn.huge.module.sys.dto.IdcardOcrResultDTO;
+import com.baidu.aip.ocr.AipOcr;
+import lombok.extern.slf4j.Slf4j;
+import org.json.JSONObject;
+
+import java.util.HashMap;
+
+/**
+ * @title: 百度云OCR工具类
+ * @description: 百度云OCR工具类
+ * @company: hugeinfo
+ * @author: liyj
+ * @time: 2021-11-05 16:51:48
+ * @version: 1.0.0
+ */
+@Slf4j
+public class BaiduOcrUtils {
+ // 公司百度云账号
+// public static final String APP_ID = "24661114";
+// public static final String API_KEY = "cKXdjXhgRP9fsbI15UxGB0jM";
+// public static final String SECRET_KEY = "1X1BY7oAAmjemQgzzdfG3VnTh0rUTO2X";
+ // 个人账号-15602261488
+ public static final String APP_ID = "27535980";
+ public static final String API_KEY = "6U6tSA75gKf4UMXvHgDpzOC9";
+ public static final String SECRET_KEY = "BBjjCDhy2sAVO0jfiaGn8OWIGE470lWU";
+
+ public static void main(String[] args) {
+
+ }
+
+ /**
+ * 身份证识别(二进制流)
+ * @param images
+ * @return
+ */
+ public static IdcardOcrResultDTO ocrIdcard(byte[] images) {
+ try{
+ AipOcr client = new AipOcr(APP_ID,API_KEY,SECRET_KEY);
+ // 设置识别身份证正面参数 front - 身份证含照片的一面 back - 身份证带国徽的一面
+ String idCardSide = "front";
+ // 自定义参数定义
+ HashMap<String, String> options = new HashMap<String, String>();
+ options.put("detect_direction", "true");
+ options.put("detect_risk", "true");
+ JSONObject json = client.idcard(images, idCardSide, options);
+ JSONObject result = json.getJSONObject("words_result");
+ // 解析识别结果
+ IdcardOcrResultDTO idcardOcrResultDTO = new IdcardOcrResultDTO();
+ String name = result.getJSONObject("姓名").getString("words");
+ idcardOcrResultDTO.setTrueName(name);
+
+ String sex = result.getJSONObject("性别").getString("words");
+ idcardOcrResultDTO.setSexName(sex);
+ idcardOcrResultDTO.setSex(CaseBaseConstsEnum.getIndex(sex));
+
+ String idcard = result.getJSONObject("公民身份号码").getString("words");
+ idcardOcrResultDTO.setCertiType(CaseBaseConstsEnum.CARD_TYPE_1.getIndex());
+ idcardOcrResultDTO.setCertiTypeName(CaseBaseConstsEnum.CARD_TYPE_1.getDes());
+ idcardOcrResultDTO.setCertiNo(idcard);
+
+ String address = result.getJSONObject("住址").getString("words");
+ idcardOcrResultDTO.setPlaceAddr(address);
+
+ String bir = result.getJSONObject("出生").getString("words");
+ String birthday = "";
+ birthday += bir.substring(0,4)+"-"+bir.substring(4,6)+"-"+bir.substring(6,8);
+ idcardOcrResultDTO.setBirthday(birthday);
+
+ String nation = result.getJSONObject("民族").getString("words")+"族";
+ idcardOcrResultDTO.setNationName(nation);
+ idcardOcrResultDTO.setNation(NotionBaseConstsEnum.getIndex(nation));
+ return idcardOcrResultDTO;
+ }catch (Exception e){
+ log.error("方法[BaiduOcrUtils.ocrIdcard]调用失败,异常信息:"+e, e);
+ return null;
+ }
+ }
+
+}
+/**
+ * -------------------_ooOoo_-------------------
+ * ------------------o8888888o------------------
+ * ------------------88" . "88------------------
+ * ------------------(| -_- |)------------------
+ * ------------------O\ = /O------------------
+ * ---------------____/`---'\____---------------
+ * -------------.' \\| |// `.-------------
+ * ------------/ \\||| : |||// \------------
+ * -----------/ _||||| -:- |||||- \-----------
+ * -----------| | \\\ - /// | |-----------
+ * -----------| \_| ''\---/'' | |-----------
+ * -----------\ .-\__ `-` ___/-. /-----------
+ * ---------___`. .' /--.--\ `. . __----------
+ * ------."" '< `.___\_<|>_/___.' >'"".-------
+ * -----| | : `- \`.;`\ _ /`;.`/ - ` : | |-----
+ * -----\ \ `-. \_ __\ /__ _/ .-` / /-----
+ * ======`-.____`-.___\_____/___.-`____.-'======
+ * -------------------`=---='
+ * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ * ---------佛祖保佑---hugeinfo---永无BUG----------
+ */
--
Gitblit v1.8.0