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

添加资源校验

parent 6b31dc60
...@@ -50,6 +50,8 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se ...@@ -50,6 +50,8 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
@Autowired @Autowired
private SetupDbService setupDbService; private SetupDbService setupDbService;
@Value("${project.publishPath:'/home/publish'}")
private String publishPath;
public SetupProjectController() { public SetupProjectController() {
...@@ -118,7 +120,6 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se ...@@ -118,7 +120,6 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
} }
@PostMapping("/dbConnect") @PostMapping("/dbConnect")
@UnAuth @UnAuth
public String connect(@RequestBody SetupProjectEntity setupProjectEntity) { public String connect(@RequestBody SetupProjectEntity setupProjectEntity) {
...@@ -364,12 +365,6 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se ...@@ -364,12 +365,6 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
} }
/**
* 导入文档生成代码
*
* @param file
* @return
*/
@PostMapping("/importProjectData") @PostMapping("/importProjectData")
@UnAuth @UnAuth
public String importDoc(MultipartFile file) { public String importDoc(MultipartFile file) {
...@@ -379,10 +374,8 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se ...@@ -379,10 +374,8 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
String busiDesc = "导入" + getModuleDesc(); String busiDesc = "导入" + getModuleDesc();
int code = VALUE_RESULT_SUCCESS; int code = VALUE_RESULT_SUCCESS;
try { try {
//解压 //解压
this.service.unProjectZip(file, context); this.service.unProjectZip(file, context);
recordSysLog(request, busiDesc + " 【成功】"); recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) { } catch (Exception e) {
code = VALUE_RESULT_FAILURE; code = VALUE_RESULT_FAILURE;
...@@ -401,20 +394,29 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se ...@@ -401,20 +394,29 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
*/ */
@GetMapping("/check") @GetMapping("/check")
@UnAuth @UnAuth
public Rest<Boolean> check() { public Rest<HashMap<String, Object>> check() {
Boolean bool = false; Boolean bool = false;
HashMap<String, Object> data = new HashMap<>();
data.put("resource", false);
data.put("project", false);
try { try {
//todo 检测是否初始安装,是否已经安装了base-manager,如果没有则进入引导界面进行安装 //todo 检测是否初始安装,是否已经安装了base-manager,如果没有则进入引导界面进行安装
SetupProjectQuery setupProjectQuery = new SetupProjectQuery(); SetupProjectQuery setupProjectQuery = new SetupProjectQuery();
setupProjectQuery.setProjectCode(ProductDisEnum.基础服务.getValue()); setupProjectQuery.setProjectCode(ProductDisEnum.基础服务.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("基础服务不存在");
//判断资源文件是否已经上传
if(setupProjectEntity.getProjectStatus()>ProjectStatusEnum.未部署.getValue()){ String projectPath = this.publishPath + "/temp/project/";
bool=true; boolean exist = FileUtil.exist(projectPath);
return Rest.ok("项目工程已部署", bool); if (exist) {
data.put("resource", true);
}
if (setupProjectEntity.getProjectStatus() > ProjectStatusEnum.未部署.getValue()) {
bool = true;
data.put("project", bool);
return Rest.ok("项目工程已部署", data);
} }
return Rest.ok("项目工程未部署,进入引导界面", bool); return Rest.ok("项目工程未部署,进入引导界面", data);
} catch (Exception e) { } catch (Exception e) {
log.error("检测异常", e); log.error("检测异常", e);
return Rest.fail(e.getMessage()); return Rest.fail(e.getMessage());
......
...@@ -9,8 +9,8 @@ spring: ...@@ -9,8 +9,8 @@ spring:
active: @profiles.active@ active: @profiles.active@
servlet: servlet:
multipart: multipart:
max-file-size: 1000MB max-file-size: 2048MB
max-request-size: 1000MB max-request-size: 2048MB
# redis: # redis:
# host: @profiles.redis.uri@ # host: @profiles.redis.uri@
# port: @profiles.redis.port@ # port: @profiles.redis.port@
......
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