This commit is contained in:
liyawei
2022-06-01 17:20:26 +08:00
parent d1f9d50643
commit 5fdd85cd1f
2 changed files with 20 additions and 5 deletions
@@ -64,6 +64,7 @@
from params_manifest pm left join params_template pt on pm.params_template_id = pt.id from params_manifest pm left join params_template pt on pm.params_template_id = pt.id
) tmp_tb ) tmp_tb
<include refid="BaseQuerySql"/> <include refid="BaseQuerySql"/>
order by create_time desc
</select> </select>
<select id="pageInfoAll" resultMap="ParamsManifestEOResultMapForCopy"> <select id="pageInfoAll" resultMap="ParamsManifestEOResultMapForCopy">
@@ -86,5 +87,6 @@
<if test="projectName !=null and projectName !=''"> <if test="projectName !=null and projectName !=''">
AND project_name LIKE CONCAT(CONCAT('%',#{projectName}),'%') AND project_name LIKE CONCAT(CONCAT('%',#{projectName}),'%')
</if> </if>
order by create_time desc
</select> </select>
</mapper> </mapper>
@@ -2,6 +2,7 @@ package com.jero.modules.ocr.controller;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.jero.common.api.vo.Result; import com.jero.common.api.vo.Result;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.exception.JeroBootException; import com.jero.common.exception.JeroBootException;
import com.jero.modules.ocr.entity.OcrRecordEO; import com.jero.modules.ocr.entity.OcrRecordEO;
import com.jero.modules.ocr.enums.ResultContentEnum; import com.jero.modules.ocr.enums.ResultContentEnum;
@@ -165,12 +166,24 @@ public class OcrRestfulController{
String fileOriPath = ossFile.getUrl(); String fileOriPath = ossFile.getUrl();
String oriName = ossFile.getFileName(); String oriName = ossFile.getFileName();
File pdfFile = new File(fileOriPath); File pdfFile = new File(fileOriPath);
FileInputStream fileInputStream = new FileInputStream(pdfFile); try {
MultipartFile multipartFile = new MockMultipartFile(oriName, oriName, FileInputStream fileInputStream = new FileInputStream(pdfFile);
ContentType.APPLICATION_OCTET_STREAM.toString(), fileInputStream); MultipartFile multipartFile = new MockMultipartFile(oriName, oriName,
return ocrRestfulService.handleFile(multipartFile,multipartFile.getOriginalFilename(),ocrRecordEO,"add"); ContentType.APPLICATION_OCTET_STREAM.toString(), fileInputStream);
return ocrRestfulService.handleFile(multipartFile,multipartFile.getOriginalFilename(),ocrRecordEO,"add");
} catch (FileNotFoundException fileNotFoundException) { // 系统找不到指定的文件
if (CutEnum.CN.getValue().equals(ocrRecordEO.getCut())) {
return Result.error("无法找到该文件");
} else {
return Result.error("File not found");
}
}
} else { } else {
return Result.error("无法找到该文件"); if (CutEnum.CN.getValue().equals(ocrRecordEO.getCut())) {
return Result.error("无法找到该文件");
} else {
return Result.error("File not found");
}
} }
} }