|
|
@@ -46,8 +46,6 @@ import org.apache.pdfbox.pdmodel.PDPage;
|
|
|
import org.apache.pdfbox.pdmodel.PDResources;
|
|
|
import org.apache.pdfbox.pdmodel.graphics.PDXObject;
|
|
|
import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject;
|
|
|
-import org.bytedeco.javacv.Java2DFrameConverter;
|
|
|
-import org.bytedeco.javacv.OpenCVFrameConverter;
|
|
|
import org.springblade.archive.dto.*;
|
|
|
import org.springblade.archive.entity.*;
|
|
|
import org.springblade.archive.mapper.ArchiveConclusionMapper;
|
|
|
@@ -5586,85 +5584,6 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
- @Async
|
|
|
- public void checkFileInfo(List<String> ids){
|
|
|
- if (ids == null || ids.isEmpty()) {
|
|
|
- return;
|
|
|
- }
|
|
|
- String idsStr = ids.stream().filter(StringUtil::isNumeric).collect(Collectors.joining(","));
|
|
|
- List<ArchiveFile> query = jdbcTemplate.query("select id,node_id,duty_user,file_time,file_url,pdf_file_url from u_archive_file where is_deleted = 0 and id in (" + idsStr + ")",
|
|
|
- new BeanPropertyRowMapper<>(ArchiveFile.class));
|
|
|
- if (query.isEmpty()) {
|
|
|
- query = jdbcTemplate.query("select id,node_id,duty_user,file_time,file_url,pdf_file_url from u_archive_file where is_deleted = 0 and archive_id in (" + idsStr + ")",
|
|
|
- new BeanPropertyRowMapper<>(ArchiveFile.class));
|
|
|
- if (query.isEmpty()) {
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- String value = ParamCache.getValue("archive.pdf.check");
|
|
|
- checkArchiveFile( query, value != null && "1".equals(value.trim()));
|
|
|
- List<Object[]> params = query.stream().map(entry -> new Object[]{entry.getCheckStatus(), entry.getId()}).collect(Collectors.toList());
|
|
|
- jdbcTemplate.batchUpdate("update u_archive_file set check_status = ? where id = ?", params);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 检测文件完整性,包括:日期、责任者、PDF是否有污渍、PDF分辨率是否大于等于300DPI
|
|
|
- */
|
|
|
- private void checkArchiveFile(List<ArchiveFile> list, boolean checkPdf) {
|
|
|
- Pattern datePattern = Pattern.compile("[0-9]{4}.?[0-9]{2}.?[0-9]{2}");
|
|
|
- for (ArchiveFile file : list) {
|
|
|
- String checkStatus = "";
|
|
|
- if (file.getFileTime() == null || !datePattern.matcher(file.getFileTime()).find()) {
|
|
|
- checkStatus += "1";
|
|
|
- }
|
|
|
- if (file.getDutyUser() == null || file.getDutyUser().trim().isEmpty() || file.getDutyUser().trim().equals("null")) {
|
|
|
- checkStatus += ",2";
|
|
|
- }
|
|
|
- String url = "";
|
|
|
- if (file.getPdfFileUrl() != null && file.getPdfFileUrl().contains("http")) {
|
|
|
- url = file.getFileUrl();
|
|
|
- } else if (file.getFileUrl() != null && file.getFileUrl().contains("http")) {
|
|
|
- url = file.getPdfFileUrl();
|
|
|
- }
|
|
|
- if (url == null || !url.endsWith(".pdf")) {
|
|
|
- checkStatus += ",3";
|
|
|
- } else {
|
|
|
- if (checkPdf) {
|
|
|
- int lastIndexOf = url.lastIndexOf("/");
|
|
|
- String prefix = url.substring(0, lastIndexOf + 1);
|
|
|
- String suffix = url.substring(lastIndexOf + 1);
|
|
|
- try {
|
|
|
- url = prefix + URLEncoder.encode(suffix, "UTF-8");
|
|
|
- try (InputStream ossIs = CommonUtil.getOSSInputStream(url); ) {
|
|
|
- Map<String, Object> map = ImageQualityDetectorUtils.checkImageQuality(ossIs, 0);
|
|
|
- Object checkDPI = map.get("checkDPI");
|
|
|
- if (checkDPI != null && !"true".equals(checkDPI.toString())) {
|
|
|
- checkStatus += ",5";
|
|
|
- }
|
|
|
- Object hasStains = map.get("hasStains");
|
|
|
- if (hasStains != null && "true".equals(hasStains.toString())) {
|
|
|
- checkStatus += ",4";
|
|
|
- }
|
|
|
- Object isA4OrA3 = map.get("isA4OrA3");
|
|
|
- if (isA4OrA3 != null && !"true".equals(isA4OrA3.toString())) {
|
|
|
- checkStatus += ",6";
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- checkStatus += ",3";
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (checkStatus.isEmpty()) {
|
|
|
- checkStatus = "-1";
|
|
|
- } else if (checkStatus.charAt(0) == ',') {
|
|
|
- checkStatus = checkStatus.substring(1);
|
|
|
- }
|
|
|
- file.setCheckStatus(checkStatus);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public String jointNomination(List<String> authId) {
|
|
|
StringBuilder sb = new StringBuilder();
|