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

添加产品资源枚举类

parent 405a430e
package com.mortals.xhx.module.setup.service.impl;
import cn.hutool.Hutool;
import cn.hutool.core.compress.Gzip;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.RuntimeUtil;
import cn.hutool.core.util.ZipUtil;
import cn.hutool.db.DbUtil;
import cn.hutool.extra.compress.CompressUtil;
import cn.hutool.extra.compress.extractor.Extractor;
import cn.hutool.system.OsInfo;
import cn.hutool.system.SystemUtil;
import com.mortals.framework.common.Rest;
import com.mortals.framework.util.ThreadPool;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.common.code.ProductDisEnum;
import com.mortals.xhx.common.code.ProjectStatusEnum;
import com.mortals.xhx.common.code.ProjectTypeEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.utils.ZipUtils;
import com.mortals.xhx.module.setup.dao.SetupProjectDao;
import com.mortals.xhx.module.setup.mode.DbSetupEntity;
import com.mortals.xhx.module.setup.mode.SiteEntity;
import com.mortals.xhx.module.setup.model.SetupProjectEntity;
import com.mortals.xhx.module.setup.model.SetupProjectQuery;
import com.mortals.xhx.module.setup.service.SetupDbService;
import org.apache.commons.compress.compressors.CompressorInputStream;
import com.mortals.xhx.module.setup.service.SetupProjectService;
import lombok.extern.slf4j.Slf4j;
import org.codehaus.plexus.archiver.tar.TarGZipUnArchiver;
import org.codehaus.plexus.logging.console.ConsoleLoggerManager;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import javax.sql.DataSource;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.sql.Connection;
import java.sql.PreparedStatement;
......@@ -36,22 +42,6 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.setup.dao.SetupProjectDao;
import com.mortals.xhx.module.setup.model.SetupProjectEntity;
import com.mortals.xhx.module.setup.service.SetupProjectService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.sql.DataSource;
/**
* SetupProjectService
......@@ -222,7 +212,7 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
boolean exist = FileUtil.exist(projectPath);
if (!exist) throw new AppException("请先上传项目工程文件!");
//2.部署并启动项目 包括网关,基础服务,门户服务,设备管理系统,前端,后端资源等等
//2.部署并启动项目 包括网关,基础服务后端,门户服务,设备管理系统,前端,后端资源等等
buildGateWay(context);
buildBaseManager(context);
buildBaseManagerUi(context);
......@@ -243,20 +233,20 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
}
private void buildBaseManager(Context context) {
log.info("开始部署基础服务");
SetupProjectEntity setupProject = this.selectOne(new SetupProjectQuery().projectCode(ProductDisEnum.基础服务.getValue()));
log.info("开始部署基础服务后端");
SetupProjectEntity setupProject = this.selectOne(new SetupProjectQuery().projectCode(ProductDisEnum.基础服务后端.getValue()));
this.distribute(setupProject, context);
}
private void buildBaseManagerUi(Context context) {
log.info("开始部署基础服务前端");
log.info("开始部署基础服务后端前端");
SetupProjectEntity setupProject = this.selectOne(new SetupProjectQuery().projectCode(ProductDisEnum.基础服务前端.getValue()));
this.distribute(setupProject, context);
}
private void buildPortalManager(Context context) {
log.info("开始部署门户服务");
SetupProjectEntity setupProject = this.selectOne(new SetupProjectQuery().projectCode(ProductDisEnum.门户服务.getValue()));
SetupProjectEntity setupProject = this.selectOne(new SetupProjectQuery().projectCode(ProductDisEnum.门户服务后端.getValue()));
this.distribute(setupProject, context);
}
......@@ -268,7 +258,7 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
private void buildDeviceManager(Context context) {
log.info("开始部署设备管理服务");
SetupProjectEntity setupProject = this.selectOne(new SetupProjectQuery().projectCode(ProductDisEnum.设备管理服务.getValue()));
SetupProjectEntity setupProject = this.selectOne(new SetupProjectQuery().projectCode(ProductDisEnum.设备管理服务后端.getValue()));
this.distribute(setupProject, context);
}
......@@ -280,7 +270,7 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
private void buildLogManager(Context context) {
log.info("开始部署设备管理服务");
SetupProjectEntity setupProject = this.selectOne(new SetupProjectQuery().projectCode(ProductDisEnum.设备管理服务.getValue()));
SetupProjectEntity setupProject = this.selectOne(new SetupProjectQuery().projectCode(ProductDisEnum.设备管理服务后端.getValue()));
this.distribute(setupProject, context);
}
......@@ -320,7 +310,7 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
// @Override
public Rest<String> updateBaseSystem(SiteEntity siteEntity) {
//获取数据库连接 如果基础服务不存在 则提示
//获取数据库连接 如果基础服务后端不存在 则提示
DbSetupEntity dbSetupEntity = new DbSetupEntity();
dbSetupEntity.setDbName(siteEntity.getDbName());
......
......@@ -39,7 +39,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.mortals.xhx.common.code.ProductDisEnum.基础服务;
import static com.mortals.xhx.common.code.ProductDisEnum.*;
/**
* 项目工程信息
......@@ -279,7 +279,7 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
//todo 在/home/publish/app/ 目录下 更加站点编码生成基础服务应用 创建自助服务应用
String projectPath = this.publishPath + "/app/" + siteAddRest.getData().getSiteCode();
//解压资源文件
String sourcePath = this.publishPath + "/temp/project/" + 基础服务.getValue() + "/app.tar.gz";
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);
......@@ -297,7 +297,7 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
projectPath = this.publishPath + "/app/";
//解压资源文件
sourcePath = this.publishPath + "/temp/project/" + 基础服务.getValue() + "/other.tar.gz";
sourcePath = this.publishPath + "/temp/project/" + 基础服务后端.getValue() + "/other.tar.gz";
file = new File(sourcePath);
destDir = new File(projectPath);
manager.initialize();
......@@ -485,7 +485,7 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
try {
//todo 检测是否初始安装,是否已经安装了base-manager,如果没有则进入引导界面进行安装
SetupProjectQuery setupProjectQuery = new SetupProjectQuery();
setupProjectQuery.setProjectCode(基础服务.getValue());
setupProjectQuery.setProjectCode(基础服务后端.getValue());
SetupProjectEntity setupProjectEntity = this.service.selectOne(setupProjectQuery);
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