From a78f69bead6d9346421f6b695e3c4dd68c41799e Mon Sep 17 00:00:00 2001 From: "youhong.ai" Date: Mon, 10 Jul 2023 16:21:08 +0800 Subject: [PATCH] ignore .Ds_store --- .../service/ExamBtnControlService.java | 23 ++++++++++++++++++- .../java/builderpackage/AutoPackageJar.java | 5 +++- .../java/builderpackage/FileCompressor.java | 4 ++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/api/youhong/ai/pcn/examcontrol/service/ExamBtnControlService.java b/src/main/java/com/api/youhong/ai/pcn/examcontrol/service/ExamBtnControlService.java index 0d6db00..955dfc5 100644 --- a/src/main/java/com/api/youhong/ai/pcn/examcontrol/service/ExamBtnControlService.java +++ b/src/main/java/com/api/youhong/ai/pcn/examcontrol/service/ExamBtnControlService.java @@ -61,6 +61,13 @@ public class ExamBtnControlService { return isReadVersion2(user, params); } + /** + *

是否已读版本二

+ * + * @param user 当前用户 + * @param params 参数 + * @return 是否已读 + */ private boolean isReadVersion2(User user, Map params) { // 获取表名称 String tableName = Util.null2String(params.get("tableName")); @@ -81,6 +88,7 @@ public class ExamBtnControlService { if (docIds.size() != docReadTime.size()) { return false; } + // 转为map key->docId value->time Map readDocTime = docReadTime.stream().collect( Collectors.toMap( v -> Util.null2String(v.get("docId")), @@ -89,6 +97,7 @@ public class ExamBtnControlService { if (CollectionUtil.isEmpty(readDocTime)) { throw new CustomerException("数组转map异常,请检查!"); } + // 循环对比 for (Map map : docInfo) { String docId = Util.null2String(map.get(docIdField)); String time = Util.null2String(map.get(timeField)); @@ -120,6 +129,14 @@ public class ExamBtnControlService { return where; } + /** + *

是否已读版本1

+ * + * @param user 当前用户 + * @param params 请求参数 + * @return 是否已读 + */ + private boolean isReadVersion1(User user, Map params) { // 获取表名称 String tableName = Util.null2String(params.get("tableName")); @@ -278,6 +295,10 @@ public class ExamBtnControlService { } else { dataId = Util.getModeDataId("uf_exam_doc_read_time", 1); } - return mapper.updateReadTimeTag(docId, user.getUID(), currentReadTimeInt, dataId); + boolean b = mapper.updateReadTimeTag(docId, user.getUID(), currentReadTimeInt, dataId); + if (b) { + Util.rebuildModeDataShare(1, "uf_exam_doc_read_time", dataId); + } + return b; } } diff --git a/src/test/java/builderpackage/AutoPackageJar.java b/src/test/java/builderpackage/AutoPackageJar.java index d8c91b4..99269b8 100644 --- a/src/test/java/builderpackage/AutoPackageJar.java +++ b/src/test/java/builderpackage/AutoPackageJar.java @@ -25,7 +25,7 @@ public class AutoPackageJar { public static void createJar(String targetPath) { String path = AutoPackageJar.class.getResource("").getPath(); - String finalPath = path.split(File.separator + targetPath)[0] + File.separator + targetPath + FileTreeBuilder.classPath; + String finalPath = path.split(File.separator + targetPath)[0] + File.separator + targetPath + FileTreeBuilder.classPath; createJar(finalPath + "aiyh", finalPath + "aiyh_utils.jar"); createJar(finalPath + "ebu7common", finalPath + "ebu7common.jar"); } @@ -62,6 +62,9 @@ public class AutoPackageJar { } private static void addFileToJar(String entryPath, File file, JarOutputStream jos) throws IOException { + if (file.getName().endsWith(".DS_Store")) { + return; + } String entryName = entryPath + file.getName(); jos.putNextEntry(new JarEntry(entryName)); diff --git a/src/test/java/builderpackage/FileCompressor.java b/src/test/java/builderpackage/FileCompressor.java index dbd7448..3d2b7f1 100644 --- a/src/test/java/builderpackage/FileCompressor.java +++ b/src/test/java/builderpackage/FileCompressor.java @@ -44,9 +44,13 @@ public class FileCompressor { } private static void addFileToZip(File file, String parentPath, ZipOutputStream zipOutputStream, Function replacePath) throws IOException { + if (file.getName().endsWith(".DS_Store")) { + return; + } try (FileInputStream fileInputStream = new FileInputStream(file)) { String entryPath = parentPath + File.separator + file.getName(); String finalPath = replacePath.apply(entryPath); + if (StrUtil.isBlank(finalPath)) { finalPath = "/"; }