|
|
@@ -76,6 +76,7 @@ import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.core.tool.utils.FileUtil;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springblade.core.tool.utils.StringUtil;
|
|
|
import org.springblade.manager.entity.*;
|
|
|
import org.springblade.manager.feign.ArchiveTreeContractClient;
|
|
|
import org.springblade.manager.feign.ContractClient;
|
|
|
@@ -5561,10 +5562,15 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
if (ids == null || ids.isEmpty()) {
|
|
|
return;
|
|
|
}
|
|
|
- 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 (" + String.join(",", ids) + ")",
|
|
|
+ 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()) {
|
|
|
- return;
|
|
|
+ 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;
|
|
|
+ }
|
|
|
}
|
|
|
checkArchiveFile( query);
|
|
|
List<Object[]> params = query.stream().map(entry -> new Object[]{entry.getCheckStatus(), entry.getId()}).collect(Collectors.toList());
|
|
|
@@ -5577,13 +5583,12 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
private void checkArchiveFile(List<ArchiveFile> list) {
|
|
|
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()) {
|
|
|
- file.setCheckStatus(1);
|
|
|
- continue;
|
|
|
+ checkStatus += "1";
|
|
|
}
|
|
|
if (file.getDutyUser() == null || file.getDutyUser().trim().isEmpty() || file.getDutyUser().trim().equals("null")) {
|
|
|
- file.setCheckStatus(2);
|
|
|
- continue;
|
|
|
+ checkStatus += ",2";
|
|
|
}
|
|
|
String url = "";
|
|
|
if (file.getPdfFileUrl() != null && file.getPdfFileUrl().contains("http")) {
|
|
|
@@ -5592,31 +5597,38 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
url = file.getPdfFileUrl();
|
|
|
}
|
|
|
if (url == null || !url.endsWith(".pdf")) {
|
|
|
- file.setCheckStatus(3);
|
|
|
- continue;
|
|
|
- }
|
|
|
- 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, 96);
|
|
|
- Object checkDPI = map.get("checkDPI");
|
|
|
- if (checkDPI != null && !"true".equals(checkDPI.toString())) {
|
|
|
- file.setCheckStatus(3);
|
|
|
- } else {
|
|
|
+ checkStatus += ",3";
|
|
|
+ } else {
|
|
|
+ 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())) {
|
|
|
- file.setCheckStatus(4);
|
|
|
- } else {
|
|
|
- file.setCheckStatus(-1);
|
|
|
+ checkStatus += ",4";
|
|
|
+ }
|
|
|
+ Object isA4OrA3 = map.get("isA4OrA3");
|
|
|
+ if (isA4OrA3 != null && !"true".equals(isA4OrA3.toString())) {
|
|
|
+ checkStatus += ",6";
|
|
|
}
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ checkStatus += ",3";
|
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
- file.setCheckStatus(3);
|
|
|
}
|
|
|
+ if (checkStatus.isEmpty()) {
|
|
|
+ checkStatus = "-1";
|
|
|
+ } else if (checkStatus.charAt(0) == ',') {
|
|
|
+ checkStatus = checkStatus.substring(1);
|
|
|
+ }
|
|
|
+ file.setCheckStatus(checkStatus);
|
|
|
}
|
|
|
}
|
|
|
|