Commit b6217388 authored by 赵啸非's avatar 赵啸非

添加区域树

parent 5d65fc88
...@@ -25,17 +25,22 @@ import com.mortals.xhx.module.setup.service.SetupDbService; ...@@ -25,17 +25,22 @@ import com.mortals.xhx.module.setup.service.SetupDbService;
import com.mortals.xhx.module.setup.service.SetupProjectService; import com.mortals.xhx.module.setup.service.SetupProjectService;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.codehaus.plexus.archiver.tar.TarGZipUnArchiver;
import org.codehaus.plexus.logging.console.ConsoleLoggerManager;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.util.Arrays; import java.util.Arrays;
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 static com.mortals.xhx.common.code.ProductDisEnum.基础服务;
/** /**
* 项目工程信息 * 项目工程信息
* *
...@@ -266,8 +271,6 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se ...@@ -266,8 +271,6 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
if (YesNoEnum.YES.getValue() == siteAddRest.getCode()) { if (YesNoEnum.YES.getValue() == siteAddRest.getCode()) {
//更新所有项目的站点编码与名称 //更新所有项目的站点编码与名称
this.service.find(new SetupProjectQuery()).forEach(setupProjectEntity->{ this.service.find(new SetupProjectQuery()).forEach(setupProjectEntity->{
setupProjectEntity.setSiteName(siteAddRest.getData().getSiteName()); setupProjectEntity.setSiteName(siteAddRest.getData().getSiteName());
setupProjectEntity.setSiteCode(siteAddRest.getData().getSiteCode()); setupProjectEntity.setSiteCode(siteAddRest.getData().getSiteCode());
...@@ -277,9 +280,30 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se ...@@ -277,9 +280,30 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
this.service.update(setupProjectEntity); this.service.update(setupProjectEntity);
}); });
//todo 更加站点编码生成基础服务应用,并部署到/home/publish/app/ 目录下
//todo 在/home/publish/app/ 目录下 创建自助服务应用
String projectPath = this.publishPath + "/app/"+siteEntity.getSiteCode();
//解压资源文件
String sourcePath = this.publishPath + "/temp/project/" + 基础服务.getValue() + "/app.tar.gz";
File file = new File(sourcePath);
log.info("文件存在:{} ,文件地址:{}", file.exists(),sourcePath);
File destDir = new File(projectPath);
if (!file.exists()) {
throw new AppException("请上传项目工程文件!");
}
final TarGZipUnArchiver ua = new TarGZipUnArchiver();
ConsoleLoggerManager manager = new ConsoleLoggerManager();
manager.initialize();
ua.enableLogging(manager.getLoggerForComponent("bla"));
ua.setSourceFile(file);
destDir.mkdirs();
ua.setDestDirectory(destDir);
ua.extract();
//todo 更新门户站点信息,用户站点树等 //todo 更新门户站点信息,用户站点树等
//todo 更加站点编码生成基础服务应用,并部署
} else { } else {
throw new AppException("站点添加失败! " + rest.getMsg()); throw new AppException("站点添加失败! " + rest.getMsg());
...@@ -316,6 +340,12 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se ...@@ -316,6 +340,12 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
try { try {
//todo 在/home/publish/app/ 目录下 创建自助服务应用 //todo 在/home/publish/app/ 目录下 创建自助服务应用
String projectPath = this.publishPath + "/app/"+siteEntity.getSiteCode();
boolean exist = FileUtil.exist(projectPath);
if (!exist) {
FileUtil.mkdir(projectPath);
}
//解压
ret.put(KEY_RESULT_MSG, "子区域更新失败"); ret.put(KEY_RESULT_MSG, "子区域更新失败");
} catch (Exception e) { } catch (Exception e) {
...@@ -421,7 +451,7 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se ...@@ -421,7 +451,7 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
try { try {
//todo 检测是否初始安装,是否已经安装了base-manager,如果没有则进入引导界面进行安装 //todo 检测是否初始安装,是否已经安装了base-manager,如果没有则进入引导界面进行安装
SetupProjectQuery setupProjectQuery = new SetupProjectQuery(); SetupProjectQuery setupProjectQuery = new SetupProjectQuery();
setupProjectQuery.setProjectCode(ProductDisEnum.基础服务.getValue()); setupProjectQuery.setProjectCode(基础服务.getValue());
SetupProjectEntity setupProjectEntity = this.service.selectOne(setupProjectQuery); SetupProjectEntity setupProjectEntity = this.service.selectOne(setupProjectQuery);
if (ObjectUtils.isEmpty(setupProjectEntity)) throw new AppException("基础服务不存在"); if (ObjectUtils.isEmpty(setupProjectEntity)) throw new AppException("基础服务不存在");
//判断资源文件是否已经上传 //判断资源文件是否已经上传
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment