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

添加产品资源枚举类

parent 2c265c37
......@@ -33,9 +33,9 @@ public enum ProductDisEnum {
DATAV管理后台前端("datav-portal", "datav-portal"),
报表系统管理后端("bill-manager", "bill-manager"),
报表系统管理前端("bill-manager-ui", "bill-manager-ui"),
存取件前端("access-manager-ui", "access-manager-ui"),
窗口服务行为监察前端("ai-xnjc-ui", "ai-xnjc-ui"),
窗口服务行为监察PHP后端("monitor", "monitor"),
背靠背评价系统管理后台前端("back-to-back-pc-ui", "back-to-back-pc-ui"),
数据驾驶舱前端("cabin", "cabin"),
数据资源管理后台前端("data-resources", "data-resources"),
......@@ -49,7 +49,7 @@ public enum ProductDisEnum {
可视化播控前端("bokong-manager", "bokong-manager"),
微官网前端("weChat-ui", "weChat-ui"),
窗口评价前端("window-evaluate", "window-evaluate"),
排号系统PHP后端("number-manager-php", "number-manager-php"),
排号系统PHP后端("zwfw4", "zwfw4"),
;
private String value;
private String desc;
......
......@@ -88,7 +88,7 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
String sourcePath = this.publishPath + "/temp/project/" + ProductDisEnum.getByValue(setupProjectEntity.getProjectCode()).getDesc() + "/" + ProductDisEnum.getByValue(setupProjectEntity.getProjectCode()).getValue() + ".tar.gz";
File file = new File(sourcePath);
log.info("文件路径:{},存在:{}",sourcePath, file.exists());
log.info("文件路径:{},存在:{}", sourcePath, file.exists());
File destDir = new File(setupProjectEntity.getProjectPath());
......@@ -144,7 +144,7 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
String sourceUiZipPath = path + ".zip";
File uiZipFile = new File(sourceUiZipPath);
File destDir = new File(setupProjectEntity.getProjectPath());
log.info("tar文件存在:{},文件路径:{},zip文件存在:{},文件路径:{}", uiFile.exists(),sourceUiPath, uiZipFile.exists(),sourceUiZipPath);
log.info("tar文件存在:{},文件路径:{},zip文件存在:{},文件路径:{}", uiFile.exists(), sourceUiPath, uiZipFile.exists(), sourceUiZipPath);
if (uiFile.exists()) {
//解压tar.gz
final TarGZipUnArchiver ua = new TarGZipUnArchiver();
......@@ -172,25 +172,24 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
} else if (ProjectTypeEnum.PHP后端.getValue() == setupProjectEntity.getProjectType()) {
//TODO: 解压php逻辑
String sourcePath = this.publishPath + "/temp/project/" + ProductDisEnum.getByValue(setupProjectEntity.getProjectCode()).getDesc() + "/" + ProductDisEnum.getByValue(setupProjectEntity.getProjectCode()).getValue() + ".tar.gz";
String sourcePath = this.publishPath + "/temp/project/" + ProductDisEnum.getByValue(setupProjectEntity.getProjectCode()).getDesc() + "/" + ProductDisEnum.getByValue(setupProjectEntity.getProjectCode()).getValue() + ".zip";
File file = new File(sourcePath);
log.info("文件路径:{},存在:{}",sourcePath, file.exists());
log.info("文件路径:{},存在:{}", sourcePath, file.exists());
File destDir = new File(setupProjectEntity.getProjectPath());
if (!destDir.exists()) {
boolean mkdirs = destDir.mkdirs();
log.info("创建目录:{},{}", destDir.getPath(), mkdirs);
}
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();
InputStream inputStream = FileUtil.getInputStream(file);
ZipUtil.unzip(inputStream, destDir, Charset.defaultCharset());
String publicPath = setupProjectEntity.getProjectPath() + ProductDisEnum.getByValue(setupProjectEntity.getProjectCode()).getValue();
File sqlPath = new File(publicPath + "/db/base.sql");
File sqlPath = new File(publicPath + "/db/zwfw4.sql");
if (sqlPath.exists()) {
//导入数据库业务
DbSetupEntity dbSetupEntity = new DbSetupEntity();
......@@ -205,12 +204,12 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
if (YesNoEnum.YES.getValue() != dbRest.getCode()) {
log.info("数据库初始化成功!");
}
}else{
log.info("数据库文件不存在!{}",sqlPath.getPath());
}
setupProjectEntity.setProjectStatus(ProjectStatusEnum.已部署.getValue());
this.update(setupProjectEntity);
}
return Rest.ok();
......
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