From a27351e4827eb1a340b834fe80c149806f819bd5 Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期五, 20 九月 2024 14:39:04 +0800
Subject: [PATCH] 项目打包生成xml文件

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java
index d0bb2f8..bda62b1 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java
@@ -25,6 +25,7 @@
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.Velocity;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
@@ -67,7 +68,8 @@
     @Autowired
     private ConfigApi configApi;
 
-    private String mpkBakFilePath = "";
+    @Value("${mpk.bakFilePath}")
+    private String mpkBakFilePath;
 
     /*@PostConstruct
     public void init() {
@@ -296,6 +298,13 @@
         prop.put("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
         Velocity.init(prop);
 
+        //生成menu.xml文件
+        Map<String, Map<String, List<MpkFileDTO>>> collect = entities.stream().collect(Collectors.groupingBy(MpkFileDTO::getMenuName, Collectors.groupingBy(e -> StringUtils.isNotBlank(e.getGroupName()) ? e.getGroupName() : "default_group")));
+        Map<String, Object> map1 = new HashMap<>();
+        map1.put("collects",collect);
+        File xmlFile = new File(dirPath.getAbsolutePath() + File.separator + "menu.xml");
+        GenUtils.drawTemplate("menu.xml.vm",new VelocityContext(map1),xmlFile);
+
         //生成cpp文件
         File cppFile = new File(dirPath.getAbsolutePath() + File.separator + UUID.randomUUID() + ".cpp");
         GenUtils.drawTemplate("pkg.cpp.vm",context,cppFile);

--
Gitblit v1.9.3