Merge remote-tracking branch 'origin/dev_third_stage' into dev_third_stage

This commit is contained in:
wangzhijiang
2022-08-11 11:54:15 +08:00
24 changed files with 341 additions and 198 deletions
@@ -64,8 +64,8 @@ public class SarFileCompareInfoController extends JeroController<SarFileCompareI
@RequestParam(name = "cut", defaultValue = "cn") String cut, HttpServletRequest req) {
QueryWrapper<SarFileCompareInfo> queryWrapper = QueryGenerator.initQueryWrapper(sarFileCompareInfo, req.getParameterMap());
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
queryWrapper.eq("create_by", sysUser.getUsername()).or().eq("release_state", ReleaseConditionEnum.DRAFT.getValue());
Page<SarFileCompareInfo> page = new Page<SarFileCompareInfo>(pageNo, pageSize);
queryWrapper.eq("create_by", sysUser.getUsername()).or().eq("release_state", ReleaseConditionEnum.PUBLISHED.getValue());
Page<SarFileCompareInfo> page = new Page<>(pageNo, pageSize);
IPage<SarFileCompareInfo> pageList = sarFileCompareInfoService.page(page, queryWrapper);
for (SarFileCompareInfo info : pageList.getRecords()) {
info.setReleaseStateTitle(ReleaseConditionEnum.getTextByValue(info.getReleaseState(), cut));
@@ -229,14 +229,14 @@ public class SarFileCompareInfoServiceImpl extends ServiceImpl<SarFileCompareInf
String id = UUID.randomUUID().toString();
sarFileCompareInfo.setId(id);
sarFileCompareInfo.setFileIdLeft(leftInfo.getId());
sarFileCompareInfo.setFileKeyLeft(leftInfo.getFileId());
sarFileCompareInfo.setFileKeyLeft(leftInfo.getConnectId());
sarFileCompareInfo.setFileNameLeft(leftInfo.getFileName());
sarFileCompareInfo.setTitleLeft(leftInfo.getTitle());
sarFileCompareInfo.setFileTypeLeft(leftInfo.getFileType());
sarFileCompareInfo.setSerialNumberLeft(leftInfo.getSerialNumber());
sarFileCompareInfo.setFileIdRight(rightInfo.getId());
sarFileCompareInfo.setFileKeyRight(rightInfo.getFileId());
sarFileCompareInfo.setFileKeyRight(rightInfo.getConnectId());
sarFileCompareInfo.setFileNameRight(rightInfo.getFileName());
sarFileCompareInfo.setFileTypeRight(rightInfo.getFileType());
sarFileCompareInfo.setTitleRight(rightInfo.getTitle());
@@ -11,7 +11,6 @@ import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.oss.CosBootUtil;
import com.jero.modules.extRepo.entity.ExtRepoData;
import com.jero.modules.extRepo.entity.ExtRepoDataPage;
import com.jero.modules.extRepo.entity.ExtRepoFolder;
import com.jero.modules.extRepo.service.IExtRepoDataService;
import com.jero.modules.extRepo.service.IExtRepoFolderService;
import io.swagger.annotations.Api;
@@ -185,29 +184,20 @@ public class ExtRepoDataController extends JeroController<ExtRepoData, IExtRepoD
Result<ExtRepoData> result = new Result();
ExtRepoData erd = extRepoDataService.queryById(id);
if (null != erd) {
int count = getRootFolderCount();
if (erd.getSupFolder().equals("root") && count <= 1) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (extRepoFolderService.isManager() || sysUser.getUsername().equals(erd.getCreateBy())) {
extRepoDataService.deleteById(id);
CosBootUtil.delete(erd.getFileKey());
if (CutEnum.CN.getValue().equals(cut)) {
result.error500("此文件夹不可删除!");
result.success("删除成功!");
} else {
result.error500("This folder cannot be deleted!");
result.success("Data deletion successfully!");
}
} else {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (sysUser.getUsername().equals(erd.getCreateBy())) {
extRepoDataService.deleteById(id);
CosBootUtil.delete(erd.getFileKey());
if (CutEnum.CN.getValue().equals(cut)) {
result.success("删除成功!");
} else {
result.success("Data deletion successfully!");
}
if (CutEnum.CN.getValue().equals(cut)) {
result.error500("没有权限!");
} else {
if (CutEnum.CN.getValue().equals(cut)) {
result.error500("没有权限!");
} else {
result.error500("You do not have permission!");
}
result.error500("You do not have permission!");
}
}
} else {
@@ -220,11 +210,6 @@ public class ExtRepoDataController extends JeroController<ExtRepoData, IExtRepoD
return result;
}
private int getRootFolderCount() {
LambdaQueryWrapper<ExtRepoFolder> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ExtRepoFolder::getSupFolder, "root");
return extRepoFolderService.count(queryWrapper);
}
/**
* 批量删除
@@ -1,5 +1,6 @@
package com.jero.modules.extRepo.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.constant.enums.CutEnum;
@@ -63,6 +64,11 @@ public class ExtRepoFolderController extends JeroController<ExtRepoFolder, IExtR
public Result<?> add(@Validated @RequestBody ExtRepoFolder extRepoFolder) {
Result<ExtRepoFolder> result = new Result();
if (extRepoFolderService.haveManageAuth(extRepoFolder.getSupFolder())) {
if (!extRepoFolder.isAddSub()) {
//增加同级文件夹
ExtRepoFolder folder = extRepoFolderService.queryById(extRepoFolder.getSupFolder());
extRepoFolder.setSupFolder(folder.getSupFolder());
}
extRepoFolderService.add(extRepoFolder);
if (CutEnum.CN.getValue().equals(extRepoFolder.getCut())) {
result.success("添加成功!");
@@ -122,15 +128,25 @@ public class ExtRepoFolderController extends JeroController<ExtRepoFolder, IExtR
if (extRepoFolderService.haveManageAuth(id)) {
List<ExtRepoFolder> resList = extRepoFolderService.getListBySupFolder(id);
if (resList.isEmpty()) {
List<ExtRepoData> erdList = extRepoDataService.queryByFolder(id);
for (ExtRepoData erd : erdList) {
extRepoDataService.deleteById(erd.getId());
}
extRepoFolderService.deleteById(id);
if (CutEnum.CN.getValue().equals(cut)) {
result.success("删除成功!");
ExtRepoFolder erf = extRepoFolderService.queryById(id);
int count = getRootFolderCount();
if (erf.getSupFolder().equals("root") && count <= 1) {
if (CutEnum.CN.getValue().equals(cut)) {
result.error500("此文件夹不可删除!");
} else {
result.error500("This folder cannot be deleted!");
}
} else {
result.success("Data deletion successfully!");
List<ExtRepoData> erdList = extRepoDataService.queryByFolder(id);
for (ExtRepoData erd : erdList) {
extRepoDataService.deleteById(erd.getId());
}
extRepoFolderService.deleteById(id);
if (CutEnum.CN.getValue().equals(cut)) {
result.success("删除成功!");
} else {
result.success("Data deletion successfully!");
}
}
} else {
if (CutEnum.CN.getValue().equals(cut)) {
@@ -149,6 +165,13 @@ public class ExtRepoFolderController extends JeroController<ExtRepoFolder, IExtR
return result;
}
private int getRootFolderCount() {
LambdaQueryWrapper<ExtRepoFolder> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ExtRepoFolder::getSupFolder, "root");
return extRepoFolderService.count(queryWrapper);
}
/**
* 通过id查询
*
@@ -96,4 +96,7 @@ public class ExtRepoFolder implements Serializable {
@TableField(exist = false)
private String cut;
@TableField(exist = false)
private boolean addSub;
}