|
@@ -624,32 +624,32 @@ public class WorkerLogic {
|
|
|
if (!user.getType().equals(UserTypeEnum.WORKER.getKey())) {
|
|
|
throw new RemoteServiceException("非“师傅”类型账号, 操作失败");
|
|
|
}
|
|
|
- final InputStream inputStream = signFile.getInputStream();
|
|
|
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
|
|
- byte[] buffer = new byte[1024];
|
|
|
- int length = 0;
|
|
|
- while ((length = inputStream.read(buffer)) != -1) {
|
|
|
- baos.write(buffer, 0, length);
|
|
|
- }
|
|
|
- inputStream.close();
|
|
|
- baos.close();
|
|
|
String path = System.getProperty("user.dir");
|
|
|
-
|
|
|
// 生成的文件的存放路径
|
|
|
- String fileSuffix = signFile.getName().substring(signFile.getName().lastIndexOf("."));
|
|
|
|
|
|
- String mkdir = path + "/tmp/ocr";
|
|
|
- if (!FileUtil.exist(path + "/tmp/ocr")) {
|
|
|
- FileUtil.mkdir(path + "/tmp/ocr");
|
|
|
+ String mkdir = path + "/tmp/ocr/";
|
|
|
+ if (!FileUtil.exist(path + "/tmp/ocr/")) {
|
|
|
+ FileUtil.mkdir(path + "/tmp/ocr/");
|
|
|
}
|
|
|
|
|
|
// 创建文件
|
|
|
- File uploadFile = new File(mkdir + IdWorker.getIdStr() + fileSuffix);
|
|
|
+ File uploadFile = new File(mkdir + signFile.getOriginalFilename());
|
|
|
uploadFile.createNewFile();
|
|
|
|
|
|
// 将文件写入磁盘
|
|
|
FileCopyUtils.copy(signFile.getBytes(), uploadFile);
|
|
|
|
|
|
+ final InputStream inputStream = signFile.getInputStream();
|
|
|
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
|
|
+ byte[] buffer = new byte[1024];
|
|
|
+ int length = 0;
|
|
|
+ while ((length = inputStream.read(buffer)) != -1) {
|
|
|
+ baos.write(buffer, 0, length);
|
|
|
+ }
|
|
|
+ inputStream.close();
|
|
|
+ baos.close();
|
|
|
+
|
|
|
+
|
|
|
final String name = ocrUtil.handwritingORC(new ByteArrayInputStream(baos.toByteArray()));
|
|
|
log.info("OCR识别名称:" + name + ", 师傅名称:" + user.getNickName());
|
|
|
if (!StrUtil.equals(name, user.getNickName().replace(" ", ""))) {
|