|
@@ -29,6 +29,8 @@ import org.springblade.core.oss.model.BladeFile;
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
import org.springblade.core.tool.utils.ResourceUtil;
|
|
import org.springblade.core.tool.utils.ResourceUtil;
|
|
import org.springblade.core.tool.utils.StringUtil;
|
|
import org.springblade.core.tool.utils.StringUtil;
|
|
|
|
+import org.springblade.manager.entity.ExcelTab;
|
|
|
|
+import org.springblade.manager.feign.ExcelTabClient;
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
import org.springblade.system.cache.ParamCache;
|
|
import org.springblade.system.cache.ParamCache;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -43,6 +45,7 @@ import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
@Service
|
|
@Service
|
|
@@ -57,6 +60,8 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
|
|
|
|
|
|
private ArchiveFileClient archiveFileClient;
|
|
private ArchiveFileClient archiveFileClient;
|
|
|
|
|
|
|
|
+ private final ExcelTabClient excelTabClient;
|
|
|
|
+
|
|
public static final String[] ARCHIVE_NUMBER = new String[]{"r_Archives_front", "r_Archives_catalog", "r_Archives_spare", "r_Archives_back"};
|
|
public static final String[] ARCHIVE_NUMBER = new String[]{"r_Archives_front", "r_Archives_catalog", "r_Archives_spare", "r_Archives_back"};
|
|
|
|
|
|
public static final Map<String, String> URL_MAP = new HashMap<>();
|
|
public static final Map<String, String> URL_MAP = new HashMap<>();
|
|
@@ -138,6 +143,8 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
|
|
|
|
|
|
Long projectId = 1578599210897772545L;
|
|
Long projectId = 1578599210897772545L;
|
|
|
|
|
|
|
|
+ List<ExcelTab> excelTabList = excelTabClient.getArchiveTabList();
|
|
|
|
+
|
|
ArchivesAuto archivesAuto = new ArchivesAuto();
|
|
ArchivesAuto archivesAuto = new ArchivesAuto();
|
|
archivesAuto.setId(SnowFlakeUtil.getId());
|
|
archivesAuto.setId(SnowFlakeUtil.getId());
|
|
archivesAuto.setProjectId(projectId);
|
|
archivesAuto.setProjectId(projectId);
|
|
@@ -965,5 +972,31 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
|
|
return url;
|
|
return url;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public void assignFileUrlsToUrlMap(List<ExcelTab> excelTabList) {
|
|
|
|
+
|
|
|
|
+ Map<String, String> invertedNameMap = NAME_MAP.entrySet()
|
|
|
|
+ .stream()
|
|
|
|
+ .collect(Collectors.toMap(Map.Entry::getValue, Map.Entry::getKey));
|
|
|
|
+
|
|
|
|
+ for (ExcelTab tab : excelTabList) {
|
|
|
|
+ // Find the corresponding key in the inverted map by the tab's name
|
|
|
|
+ String key = invertedNameMap.get(tab.getName());
|
|
|
|
+ if (key != null) {
|
|
|
|
+ if (StringUtils.isNotEmpty(tab.getFileUrl())) {
|
|
|
|
+ URL_MAP.put(key, tab.getFileUrl());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 从数据库读取最新的清表
|
|
|
|
+ */
|
|
|
|
+ public void assignArchiveTableUrl() {
|
|
|
|
+ List<ExcelTab> excelTabList = excelTabClient.getArchiveTabList();
|
|
|
|
+ assignFileUrlsToUrlMap(excelTabList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|