OCR
parent
e4cb5296c4
commit
0bfbfb510e
|
@ -4,55 +4,16 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="7a302432-88ff-4688-b881-940ab700167c" name="Changes" comment="拼团">
|
||||
<change afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/uiDesigner.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-common/src/main/java/com/bwie/common/domain/Team.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/pom.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/AuthenApp.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/controller/AuthenController.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/service/AuthenService.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/service/AuthenServiceImpl.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/AliveUtil.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/IdCheckUtil.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/OCRUtil.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/OSSupload.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/ThreadPoolExecutorConfig.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AliveData.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AliveMotions.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AliveReq.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AliveRes.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AuthenReq.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/IdCheckReq.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/IdCheckResponse.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/IdData.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/OCRConfig.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/OCRReq.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/OCRResponse.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/resources/bootstrap.yml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/resources/mapper/SysMapper.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java/com/bwie/team/TeamApp.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java/com/bwie/team/controller/BackController.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java/com/bwie/team/mapper/BackMapper.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/BackService.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/impl/BackServiceImpl.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/AddGroup.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/Goods.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/GoodsSku.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/GroupSku.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java/com/bwie/team/vo/SkuBack.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/bwie-modules/bwie-team/src/main/resources/mapper/BackMapper.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/encodings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
|
||||
<list default="true" id="7a302432-88ff-4688-b881-940ab700167c" name="Changes" comment="OCR">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/bwie-modules/bwie-team/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/bwie-modules/bwie-team/pom.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java/com/bwie/team/controller/TeamController.java" beforeDir="false" afterPath="$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java/com/bwie/team/controller/TeamController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java/com/bwie/team/mapper/TeamMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java/com/bwie/team/mapper/TeamMapper.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/TeamService.java" beforeDir="false" afterPath="$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/TeamService.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/TeamServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java/com/bwie/team/service/impl/TeamServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/bwie-modules/bwie-team/src/main/resources/bootstrap.yml" beforeDir="false" afterPath="$PROJECT_DIR$/bwie-modules/bwie-team/src/main/resources/bootstrap.yml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/bwie-modules/bwie-team/src/main/resources/mapper/TeamMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/bwie-modules/bwie-team/src/main/resources/mapper/TeamMapper.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/bwie-modules/bwie-xxl/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/bwie-modules/bwie-xxl/pom.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/bwie-modules/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/bwie-modules/pom.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/controller/AuthenController.java" beforeDir="false" afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/controller/AuthenController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/service/AuthenService.java" beforeDir="false" afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/service/AuthenService.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/service/AuthenServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/service/AuthenServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/OCRUtil.java" beforeDir="false" afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/util/OCRUtil.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AuthenReq.java" beforeDir="false" afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/AuthenReq.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/OCRReq.java" beforeDir="false" afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/OCRReq.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/OCRResponse.java" beforeDir="false" afterPath="$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java/com/bwie/authen/vo/OCRResponse.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -222,7 +183,8 @@
|
|||
<workItem from="1714355985326" duration="15054000" />
|
||||
<workItem from="1714393574470" duration="2656000" />
|
||||
<workItem from="1714440386335" duration="3954000" />
|
||||
<workItem from="1714526011728" duration="2486000" />
|
||||
<workItem from="1714526011728" duration="11554000" />
|
||||
<workItem from="1714610383772" duration="2746000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="拼团">
|
||||
<option name="closed" value="true" />
|
||||
|
@ -232,7 +194,23 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1713854151245</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="2" />
|
||||
<task id="LOCAL-00002" summary="OCR">
|
||||
<option name="closed" value="true" />
|
||||
<created>1714529359654</created>
|
||||
<option name="number" value="00002" />
|
||||
<option name="presentableId" value="LOCAL-00002" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1714529359654</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00003" summary="OCR">
|
||||
<option name="closed" value="true" />
|
||||
<created>1714529580181</created>
|
||||
<option name="number" value="00003" />
|
||||
<option name="presentableId" value="LOCAL-00003" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1714529580181</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="4" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
|
@ -307,6 +285,7 @@
|
|||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="拼团" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="拼团" />
|
||||
<MESSAGE value="OCR" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="OCR" />
|
||||
</component>
|
||||
</project>
|
|
@ -27,22 +27,20 @@ public class AuthenController {
|
|||
}
|
||||
|
||||
@PostMapping("ocrScan")
|
||||
public Result ocrScan(@RequestBody OCRReq ocrReq) throws IOException {
|
||||
Result result = authenService.ocrScan(ocrReq);
|
||||
public Result ocrScan(@RequestParam String side,@RequestParam("file") MultipartFile url) throws IOException {
|
||||
Result result = authenService.ocrScan(side,url);
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping("commitAuthen")
|
||||
public Result commitAuthen(@RequestBody AuthenReq authenReq) throws ExecutionException, InterruptedException {
|
||||
Result result = authenService.commitAuthen(authenReq);
|
||||
public Result commitAuthen(@RequestParam("face") MultipartFile img1,
|
||||
@RequestParam("back") MultipartFile img2,
|
||||
@RequestParam("file") MultipartFile movie,
|
||||
AuthenReq authenReq) throws ExecutionException, InterruptedException {
|
||||
Result result = authenService.commitAuthen(img1,img2,movie,authenReq);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@PostMapping("upload")
|
||||
public Result upload(@RequestParam("file")MultipartFile multipartFile) throws IOException {
|
||||
String upload = authenService.upload(multipartFile);
|
||||
|
|
|
@ -3,20 +3,15 @@ package com.bwie.authen.service;
|
|||
import com.bwie.authen.vo.AliveReq;
|
||||
import com.bwie.authen.vo.AuthenReq;
|
||||
import com.bwie.authen.vo.IdCheckReq;
|
||||
import com.bwie.authen.vo.OCRReq;
|
||||
import com.bwie.common.result.Result;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
public interface AuthenService {
|
||||
Result ocrScan(OCRReq ocrReq) throws IOException;
|
||||
|
||||
Result commitAuthen(AuthenReq authenReq) throws ExecutionException, InterruptedException;
|
||||
Result ocrScan(String side, MultipartFile url) throws IOException;
|
||||
Result commitAuthen(MultipartFile img1, MultipartFile img2, MultipartFile movie, AuthenReq authenReq) throws ExecutionException, InterruptedException;
|
||||
|
||||
|
||||
|
||||
|
@ -30,4 +25,7 @@ public interface AuthenService {
|
|||
Result idCheck(IdCheckReq ocrReq);
|
||||
|
||||
Result alive(AliveReq ocrReq);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -9,12 +9,9 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Log4j2
|
||||
|
@ -35,27 +32,39 @@ public class AuthenServiceImpl implements AuthenService{
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result ocrScan(OCRReq ocrReq) throws IOException {
|
||||
OCRResponse send = ocrUtil.send(ocrReq);
|
||||
public Result ocrScan( String side, MultipartFile url) throws IOException {
|
||||
OCRResponse send = ocrUtil.send(side,url);
|
||||
return Result.success(send);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result commitAuthen(AuthenReq authenReq) throws ExecutionException, InterruptedException {
|
||||
public Result commitAuthen(MultipartFile img1, MultipartFile img2, MultipartFile movie, AuthenReq authenReq) throws ExecutionException, InterruptedException {
|
||||
ThreadPoolExecutor threadPoolExecutor = config.threadPoolExecutor();
|
||||
CompletableFuture<Integer> f1 = CompletableFuture.supplyAsync(() -> {
|
||||
IdCheckReq idCheckReq = new IdCheckReq();
|
||||
idCheckReq.setName(authenReq.getName());
|
||||
idCheckReq.setIdCardNo(authenReq.getIdCord());
|
||||
IdCheckResponse idcheck = idCheckUtil.idcheck(idCheckReq);
|
||||
return idcheck.getIdData().getResult();
|
||||
Integer result = idcheck.getIdData().getResult();
|
||||
if(result!=0){
|
||||
return 1;
|
||||
}
|
||||
try {
|
||||
OCRResponse send = ocrUtil.send("face", img1);
|
||||
if(send.getNum().equals(authenReq.getIdCord())&&send.getName().equals(authenReq.getName())){
|
||||
return 0;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return 1;
|
||||
},threadPoolExecutor);
|
||||
|
||||
CompletableFuture<? extends Serializable> f2= CompletableFuture.supplyAsync(() -> {
|
||||
|
||||
String upload = null;
|
||||
try {
|
||||
upload = osSupload.upload(authenReq.getMovie());
|
||||
upload = osSupload.upload(movie);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -76,13 +85,13 @@ public class AuthenServiceImpl implements AuthenService{
|
|||
CompletableFuture<Integer> f3 = CompletableFuture.supplyAsync(() -> {
|
||||
String upload = null;
|
||||
try {
|
||||
upload = osSupload.upload(authenReq.getImg2());
|
||||
upload = osSupload.upload(img2);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
String upload2 = null;
|
||||
try {
|
||||
upload2 = osSupload.upload(authenReq.getMovie());
|
||||
upload2 = osSupload.upload(movie);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
@ -7,8 +7,10 @@ import com.bwie.authen.vo.OCRReq;
|
|||
import com.bwie.authen.vo.OCRResponse;
|
||||
|
||||
|
||||
import com.bwie.common.result.Result;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
|
@ -31,17 +33,17 @@ public class OCRUtil {
|
|||
@Value("${ocr.path}")
|
||||
private String path;
|
||||
|
||||
public OCRResponse send(OCRReq ocrReq) throws IOException {
|
||||
public OCRResponse send(String side, MultipartFile url) throws IOException {
|
||||
|
||||
|
||||
// 对图像进行base64编码
|
||||
|
||||
String encode = Base64.encode(ocrReq.getUrl().getBytes());
|
||||
String encode = Base64.encode(url.getBytes());
|
||||
|
||||
// 拼装请求body的json字符串
|
||||
JSONObject requestObj = new JSONObject();
|
||||
requestObj.put("image", encode);
|
||||
requestObj.put("side", ocrReq.getSide()); // 假设ocrReq有getSide()方法返回要识别的身份证面(正/反)
|
||||
requestObj.put("side", side); // 假设ocrReq有getSide()方法返回要识别的身份证面(正/反)
|
||||
// 如果API还有其他配置参数,可以从ocrReq中获取并添加到requestObj中
|
||||
|
||||
String bodys = requestObj.toString();
|
||||
|
@ -60,7 +62,7 @@ public class OCRUtil {
|
|||
OCRResponse msgResponse = JSON.parseObject(result, OCRResponse.class);
|
||||
|
||||
// 检查是否成功,而不是使用Assert(Assert通常用于测试)
|
||||
if (!msgResponse.equals("true")) {
|
||||
if (!msgResponse.getSuccess().equals("true")) {
|
||||
// 处理失败情况,例如记录日志或返回错误信息给调用者
|
||||
throw new RuntimeException("扫描失败" ); // 假设OCRResponse有一个getErrorMessage方法
|
||||
}
|
||||
|
|
|
@ -9,10 +9,8 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AuthenReq {
|
||||
|
||||
private String motions;
|
||||
private MultipartFile img1;
|
||||
private MultipartFile img2;
|
||||
private MultipartFile movie;
|
||||
private String name;
|
||||
private String idCord;
|
||||
|
||||
|
@ -28,4 +26,5 @@ public class AuthenReq {
|
|||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,11 +5,11 @@ import lombok.Data;
|
|||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class OCRReq {
|
||||
private String side;
|
||||
private MultipartFile url;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public class OCRResponse {
|
|||
private String sex;
|
||||
private String num;
|
||||
private String birth;
|
||||
private boolean success;
|
||||
private String success;
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue