first commit
This commit is contained in:
parent
dc8df92ff9
commit
c2f3aada76
|
|
@ -13,11 +13,19 @@
|
|||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="de15048c-2fb1-4f65-af80-34b29e3a0154" name="Changes" comment="first commit">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/sonarlint/issuestore/1/2/12f3c9374649bdf1f495f1b8126fbd8b048b5dfd" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/sonarlint/issuestore/1/2/12f3c9374649bdf1f495f1b8126fbd8b048b5dfd" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/sonarlint/issuestore/1/e/1e24bf866dc51c9dad21292d7b33d6d8c8c34cce" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/sonarlint/issuestore/1/e/1e24bf866dc51c9dad21292d7b33d6d8c8c34cce" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/sonarlint/issuestore/5/1/51a2122a0d66f3177ddd273d6903a3d6beedca49" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/sonarlint/issuestore/5/1/51a2122a0d66f3177ddd273d6903a3d6beedca49" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/sonarlint/issuestore/8/4/84cd37784f4d386a07d29be93104fbda8cddd566" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/sonarlint/issuestore/8/4/84cd37784f4d386a07d29be93104fbda8cddd566" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/sonarlint/issuestore/c/c/cc7189188c46a21e6a21d34e94e0b5f3ce3d44f7" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/sonarlint/issuestore/index.pb" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/sonarlint/issuestore/index.pb" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/sonarlint/securityhotspotstore/c/c/cc7189188c46a21e6a21d34e94e0b5f3ce3d44f7" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/sonarlint/securityhotspotstore/index.pb" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/sonarlint/securityhotspotstore/index.pb" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/bonus/core/IdentifyRecognitionDTO.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/bonus/core/MySpringBootApplication.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/bonus/core/MySpringBootApplication.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/bonus/core/OCRRecognition.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/bonus/core/OCRRecognition.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
@ -73,6 +81,7 @@
|
|||
"RequestMappingsPanelWidth1": "75",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"SONARLINT_PRECOMMIT_ANALYSIS": "true",
|
||||
"Spring Boot.MySpringBootApplication.executor": "Run",
|
||||
"git-widget-placeholder": "main",
|
||||
"kotlin-language-version-configured": "true",
|
||||
|
|
@ -143,6 +152,7 @@
|
|||
<workItem from="1713747776583" duration="310000" />
|
||||
<workItem from="1713748089331" duration="843000" />
|
||||
<workItem from="1713756484781" duration="36234000" />
|
||||
<workItem from="1719459100748" duration="13286000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="first commit">
|
||||
<option name="closed" value="true" />
|
||||
|
|
@ -168,7 +178,15 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1713764755375</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="4" />
|
||||
<task id="LOCAL-00004" summary="first commit">
|
||||
<option name="closed" value="true" />
|
||||
<created>1719453146278</created>
|
||||
<option name="number" value="00004" />
|
||||
<option name="presentableId" value="LOCAL-00004" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1719453146278</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="5" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
|
|
@ -206,16 +224,26 @@
|
|||
<breakpoints>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/main/java/com/bonus/core/OCRRecognition.java</url>
|
||||
<line>29</line>
|
||||
<line>33</line>
|
||||
<option name="timeStamp" value="20" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/main/java/com/bonus/core/MySpringBootApplication.java</url>
|
||||
<line>47</line>
|
||||
<option name="timeStamp" value="22" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/main/java/com/bonus/core/OCRRecognition.java</url>
|
||||
<line>109</line>
|
||||
<option name="timeStamp" value="21" />
|
||||
<line>112</line>
|
||||
<option name="timeStamp" value="23" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
<pin-to-top-manager>
|
||||
<pinned-members>
|
||||
<PinnedItemInfo parentTag="com.bonus.core.IdentifyRecognitionDTO" memberName="msg" />
|
||||
</pinned-members>
|
||||
</pin-to-top-manager>
|
||||
</component>
|
||||
<component name="XSLT-Support.FileAssociations.UIState">
|
||||
<expand />
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
<artifactId>gson</artifactId>
|
||||
<version>2.8.9</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,99 @@
|
|||
package com.bonus.core;
|
||||
|
||||
public class IDCardInfoDTO {
|
||||
private int code = 2000;
|
||||
private String msg = "身份证信息提取完整";
|
||||
private Data data;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public class Data {
|
||||
private String issuingAuthority = "";
|
||||
private String validTime = "";
|
||||
private String name = "";
|
||||
private String gender = "";
|
||||
private String ethnicity = "";
|
||||
private String dateOfBirth = "";
|
||||
private String address = "";
|
||||
private String idNumber = "";
|
||||
|
||||
public String getIssuingAuthority() {
|
||||
return issuingAuthority;
|
||||
}
|
||||
|
||||
public void setIssuingAuthority(String issuingAuthority) {
|
||||
this.issuingAuthority = issuingAuthority;
|
||||
}
|
||||
|
||||
public String getValidTime() {
|
||||
return validTime;
|
||||
}
|
||||
|
||||
public void setValidTime(String validTime) {
|
||||
this.validTime = validTime;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public String getEthnicity() {
|
||||
return ethnicity;
|
||||
}
|
||||
|
||||
public void setEthnicity(String ethnicity) {
|
||||
this.ethnicity = ethnicity;
|
||||
}
|
||||
|
||||
public String getDateOfBirth() {
|
||||
return dateOfBirth;
|
||||
}
|
||||
|
||||
public void setDateOfBirth(String dateOfBirth) {
|
||||
this.dateOfBirth = dateOfBirth;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getIdNumber() {
|
||||
return idNumber;
|
||||
}
|
||||
|
||||
public void setIdNumber(String idNumber) {
|
||||
this.idNumber = idNumber;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -23,7 +23,7 @@ public class MySpringBootApplication {
|
|||
// String filePath1 = "/Users/wangvivi/Desktop/Code/ocrtest/images/1.jpg";
|
||||
// String filePath2 = "/Users/wangvivi/Desktop/Code/ocrtest/images/2.jpg";
|
||||
// app.callExtractIdentityInfoByLocalPath(filePath1,filePath2);
|
||||
// app.callExtractIdentityInfoByBase64Data(filePath1, filePath2);
|
||||
// app.callExtractIdentityInfoByLocalPath1(filePath1, "");
|
||||
}
|
||||
private static ApplicationContext context;
|
||||
|
||||
|
|
@ -38,6 +38,17 @@ public class MySpringBootApplication {
|
|||
logger.info(javaString);
|
||||
}
|
||||
|
||||
public void callExtractIdentityInfoByLocalPath1(String filePath1, String filePath2 ) {
|
||||
OCRRecognition myComponent = context.getBean(OCRRecognition.class);
|
||||
IdentifyRecognitionParams params = new IdentifyRecognitionParams();
|
||||
params.setType(IdentifyRecognitionParams.RecognitionType.IDENTITY_CARD_PATH);
|
||||
params.setRecognitionFrontData(filePath1);
|
||||
params.setRecognitionBackData(filePath2);
|
||||
IDCardInfoDTO javaString = myComponent.extractIDInfo(params);
|
||||
logger.info("身份证信息是:");
|
||||
}
|
||||
|
||||
|
||||
public String callExtractIdentityInfoByBase64Data(String file1Data, String file2Data ) {
|
||||
OCRRecognition myComponent = context.getBean(OCRRecognition.class);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
package com.bonus.core;
|
||||
import com.google.gson.Gson;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
|
@ -26,6 +27,9 @@ public class OCRRecognition {
|
|||
|
||||
private static final String BASE64_PATTERN = "^[A-Za-z0-9+/]+={0,2}$";
|
||||
|
||||
/**
|
||||
*根据传入的身份证的正反面进行识别和解析,返回身份证的8个字段信息的json字符串
|
||||
*/
|
||||
public String extractInfo(IdentifyRecognitionParams recognitionParams){
|
||||
Process proc;
|
||||
List<String> stringList = new ArrayList<>();
|
||||
|
|
@ -99,6 +103,16 @@ public class OCRRecognition {
|
|||
return lastElement;
|
||||
}
|
||||
|
||||
/**
|
||||
*据传入的身份证的正反面进行识别和解析,返回身份证的IDCardInfoDTO 对象,当code=2000时,身份证信息是完整
|
||||
*/
|
||||
public IDCardInfoDTO extractIDInfo(IdentifyRecognitionParams recognitionParams){
|
||||
String result = extractInfo(recognitionParams);
|
||||
Gson gson = new Gson();
|
||||
IDCardInfoDTO response = gson.fromJson(result, IDCardInfoDTO.class);
|
||||
return response;
|
||||
}
|
||||
|
||||
private void passParameter(OutputStream outputStream, byte[] input) throws IOException {
|
||||
int offset = 0;
|
||||
// 设置每次写入的批次大小
|
||||
|
|
|
|||
Loading…
Reference in New Issue