Commit c7b0581b by 284718418@qq.com

1.云盘-我空间业务代码

parent 5fb06474
...@@ -143,7 +143,13 @@ public class DiskCatalogue extends Model<DiskCatalogue> { ...@@ -143,7 +143,13 @@ public class DiskCatalogue extends Model<DiskCatalogue> {
@TableField(exist = false) @TableField(exist = false)
private List<DiskCatalogue> breadcrumb; private List<DiskCatalogue> breadcrumb;
/**
* 云空间成员表ID
*/
@ApiModelProperty(value = "云空间成员表ID")
@Transient
@TableField(exist = false)
private Integer cloudDiskUserId;
/** /**
* 用户类型:0.超级管理员,1.管理员,2.普通用户 * 用户类型:0.超级管理员,1.管理员,2.普通用户
*/ */
......
...@@ -169,6 +169,7 @@ public class DiskCatalogueController { ...@@ -169,6 +169,7 @@ public class DiskCatalogueController {
public Result<Object> myfile(@CurrentUser UserBean userBean, DiskCatalogueParam diskCatalogueParam) { public Result<Object> myfile(@CurrentUser UserBean userBean, DiskCatalogueParam diskCatalogueParam) {
try { try {
diskCatalogueParam.setUserId(userBean.getEmpNum()); diskCatalogueParam.setUserId(userBean.getEmpNum());
diskCatalogueParam.setOrgId(userBean.getOrgCode());
// 获取文件夹 // 获取文件夹
List<DiskCatalogue> diskCatalogueList = DiskCatalogue.builder().build().selectList(new QueryWrapper<DiskCatalogue>() List<DiskCatalogue> diskCatalogueList = DiskCatalogue.builder().build().selectList(new QueryWrapper<DiskCatalogue>()
.lambda().eq(DiskCatalogue::getOrgId, userBean.getOrgCode()) .lambda().eq(DiskCatalogue::getOrgId, userBean.getOrgCode())
...@@ -177,15 +178,13 @@ public class DiskCatalogueController { ...@@ -177,15 +178,13 @@ public class DiskCatalogueController {
.eq(DiskCatalogue::getType, diskCatalogueParam.getType()) .eq(DiskCatalogue::getType, diskCatalogueParam.getType())
.eq(DiskCatalogue::getDeleteFlag, 0) .eq(DiskCatalogue::getDeleteFlag, 0)
); );
if(StringUtils.isEmpty(diskCatalogueParam.getParentId()) || diskCatalogueParam.getParentId() == 0){ if(StringUtils.isEmpty(diskCatalogueParam.getParentId()) || diskCatalogueParam.getParentId() == 0
&& JxglEnumInterface.DiskCatalogueType.DISK_YUN.getType().equals(diskCatalogueParam.getType())){
//空间 获取有权限的 //空间 获取有权限的
List<DiskCatalogue> diskCatalogueList2 = DiskCatalogue.builder().build().selectList(new QueryWrapper<DiskCatalogue>() List<DiskCatalogue> diskCatalogueList2 = diskCloudDiskUserService.getDiskCatalogueList(diskCatalogueParam);
.lambda().eq(DiskCatalogue::getOrgId, userBean.getOrgCode()) if(!CollectionUtils.isEmpty(diskCatalogueList2)){
.eq(DiskCatalogue::getCreateUserId, userBean.getEmpNum()) diskCatalogueList.addAll(diskCatalogueList2);
.eq(DiskCatalogue::getParentId, diskCatalogueParam.getParentId()) }
.eq(DiskCatalogue::getType, diskCatalogueParam.getType())
.eq(DiskCatalogue::getDeleteFlag, 0)
);
} }
// 获取文件夹下所有文件 // 获取文件夹下所有文件
List<DiskFiles> filesList = diskFilesService.getDiskFiles(diskCatalogueParam); List<DiskFiles> filesList = diskFilesService.getDiskFiles(diskCatalogueParam);
...@@ -206,7 +205,7 @@ public class DiskCatalogueController { ...@@ -206,7 +205,7 @@ public class DiskCatalogueController {
breadcrumbDataList = DiskCatalogue.builder().build().selectList(new QueryWrapper<DiskCatalogue>() breadcrumbDataList = DiskCatalogue.builder().build().selectList(new QueryWrapper<DiskCatalogue>()
.lambda().in(DiskCatalogue::getId,ids) .lambda().in(DiskCatalogue::getId,ids)
.eq(DiskCatalogue::getOrgId, userBean.getOrgCode()) .eq(DiskCatalogue::getOrgId, userBean.getOrgCode())
.eq(DiskCatalogue::getCreateUserId, userBean.getEmpNum()) //.eq(DiskCatalogue::getCreateUserId, userBean.getEmpNum())
.eq(DiskCatalogue::getDeleteFlag, 0) .eq(DiskCatalogue::getDeleteFlag, 0)
); );
} }
...@@ -234,4 +233,77 @@ public class DiskCatalogueController { ...@@ -234,4 +233,77 @@ public class DiskCatalogueController {
); );
return ResultUtil.data(userattgor); return ResultUtil.data(userattgor);
} }
/**
* 云盘-退出空间
*
* @param userBean
* @return
*/
@PostMapping(value = "/sign_out/{id}")
@ApiOperation(value = "退出共享空间", httpMethod = "POST", notes = "退出共享空间")
public Result<Object> signOut(@CurrentUser UserBean userBean, @PathVariable Integer id) {
try {
DiskCloudDiskUser diskCloudDiskUser = DiskCloudDiskUser.builder().id(id).build().selectById();
if(StringUtils.isEmpty(diskCloudDiskUser)){
ResultUtil.error("操作失败,该共享空间不存在");
}
DiskCloudDiskUser entity = DiskCloudDiskUser.builder().build();
entity.setId(diskCloudDiskUser.getId());
entity.setDeleteFlag(1);
boolean flag = entity.updateById();
if(flag){
return ResultUtil.success();
}else {
return ResultUtil.error("操作失败!");
}
}catch (Exception e){
e.printStackTrace();
throw new CustomException("获取我的文件夹列表异常");
}
}
/**
* 云盘-删除文件夹以及文件
*
* @param userBean
* @return
*/
@PostMapping(value = "/edit_catalogue")
@ApiOperation(value = "删除文件夹以及文件", httpMethod = "POST", notes = "删除文件夹以及文件")
public Result<Object> editCatalogue(@CurrentUser UserBean userBean, @RequestBody DiskCatalogueDto diskCatalogueDto) {
try {
DiskCatalogue diskCatalogue = new DiskCatalogue();
DiskCatalogue catalogue = DiskCatalogue.builder().id(diskCatalogueDto.getId()).build().selectById();
if(StringUtils.isEmpty(catalogue)){
ResultUtil.error("操作失败~");
}
// 云盘逻辑删除 权限判断
if(JxglEnumInterface.DiskCatalogueType.DISK_YUN.getType().equals(diskCatalogueDto.getType()) &&
!StringUtils.isEmpty(diskCatalogueDto.getId()) && diskCatalogueDto.getId() > 0){
diskCatalogueDto.setUserId(userBean.getEmpNum());
if(!diskCloudDiskUserService.getDiskUserRole(diskCatalogueDto,DiskCatalogue.builder().id(diskCatalogueDto.getId()).build().selectById())){
return ResultUtil.error("无权限,操作失败!");
}
// 删除之前的成员 全部重新添加
DiskCloudDiskUser.builder().deleteFlag(1).build().update(new QueryWrapper<DiskCloudDiskUser>()
.lambda().eq(DiskCloudDiskUser::getOrgId, userBean.getOrgCode())
.eq(DiskCloudDiskUser::getCatalogueId, catalogue.getId())
.eq(DiskCloudDiskUser::getUserId, userBean.getEmpNum()));
}
diskCatalogue.setId(catalogue.getId());
diskCatalogue.setDeleteFlag(1);
diskCatalogue.setUpdateUserId(userBean.getEmpNum());
boolean flag = diskCatalogue.updateById();
if(flag){
return ResultUtil.success();
}else {
return ResultUtil.error("操作失败!");
}
}catch (Exception e){
e.printStackTrace();
throw new CustomException("删除文件夹以及文件异常");
}
}
} }
...@@ -5,6 +5,7 @@ import cn.timer.api.bean.disk.DiskCloudDiskUser; ...@@ -5,6 +5,7 @@ import cn.timer.api.bean.disk.DiskCloudDiskUser;
import cn.timer.api.bean.disk.DiskFiles; import cn.timer.api.bean.disk.DiskFiles;
import cn.timer.api.dto.disk.DiskCatalogueDto; import cn.timer.api.dto.disk.DiskCatalogueDto;
import cn.timer.api.dto.disk.DiskCatalogueParam; import cn.timer.api.dto.disk.DiskCatalogueParam;
import cn.timer.api.dto.disk.DiskCloudDiskUserParam;
import java.util.List; import java.util.List;
...@@ -20,4 +21,11 @@ public interface DiskCloudDiskUserService { ...@@ -20,4 +21,11 @@ public interface DiskCloudDiskUserService {
* @return * @return
*/ */
boolean getDiskUserRole(DiskCatalogueDto diskCatalogueDto, DiskCatalogue catalogue); boolean getDiskUserRole(DiskCatalogueDto diskCatalogueDto, DiskCatalogue catalogue);
/**
* 获取空间具体权限
* @param diskCatalogueParam
* @return
*/
List<DiskCatalogue> getDiskCatalogueList(DiskCatalogueParam diskCatalogueParam);
} }
...@@ -5,12 +5,15 @@ import cn.timer.api.bean.disk.DiskCloudDiskUser; ...@@ -5,12 +5,15 @@ import cn.timer.api.bean.disk.DiskCloudDiskUser;
import cn.timer.api.config.enuminterface.JxglEnumInterface; import cn.timer.api.config.enuminterface.JxglEnumInterface;
import cn.timer.api.dao.disk.DiskCloudDiskUserMapper; import cn.timer.api.dao.disk.DiskCloudDiskUserMapper;
import cn.timer.api.dto.disk.DiskCatalogueDto; import cn.timer.api.dto.disk.DiskCatalogueDto;
import cn.timer.api.dto.disk.DiskCatalogueParam;
import cn.timer.api.dto.disk.DiskCloudDiskUserParam;
import cn.timer.api.utils.ResultUtil; import cn.timer.api.utils.ResultUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
/** /**
* @author wuqingjun * @author wuqingjun
...@@ -38,4 +41,9 @@ public class DiskCloudDiskUserServiceImpl implements DiskCloudDiskUserService { ...@@ -38,4 +41,9 @@ public class DiskCloudDiskUserServiceImpl implements DiskCloudDiskUserService {
} }
return false; return false;
} }
@Override
public List<DiskCatalogue> getDiskCatalogueList(DiskCatalogueParam diskCatalogueParam) {
return diskCloudDiskUserMapper.getDiskCatalogueList(diskCatalogueParam);
}
} }
package cn.timer.api.dao.disk; package cn.timer.api.dao.disk;
import cn.timer.api.bean.disk.DiskCatalogue;
import cn.timer.api.bean.disk.DiskCloudDiskUser; import cn.timer.api.bean.disk.DiskCloudDiskUser;
import cn.timer.api.dto.disk.DiskCatalogueParam;
import cn.timer.api.dto.disk.DiskCloudDiskUserParam;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
/** /**
* 云盘-云空间成员表 * 云盘-云空间成员表
* *
...@@ -15,4 +21,6 @@ import org.springframework.stereotype.Repository; ...@@ -15,4 +21,6 @@ import org.springframework.stereotype.Repository;
@Repository @Repository
public interface DiskCloudDiskUserMapper extends BaseMapper<DiskCloudDiskUser> { public interface DiskCloudDiskUserMapper extends BaseMapper<DiskCloudDiskUser> {
List<DiskCatalogue> getDiskCatalogueList(@Param("param")DiskCatalogueParam param);
} }
...@@ -48,4 +48,10 @@ public class DiskCatalogueParam implements Serializable { ...@@ -48,4 +48,10 @@ public class DiskCatalogueParam implements Serializable {
*/ */
@ApiModelProperty(value = "用户ID", example = "0") @ApiModelProperty(value = "用户ID", example = "0")
private Integer userId; private Integer userId;
/**
* 当前企业id
*/
@ApiModelProperty(value = "当前企业id")
private Integer orgId;
} }
package cn.timer.api.dto.disk;
import cn.timer.api.config.exception.ValidationMsg;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @author wuqingjun
* @email 284718418@qq.com
* @date 2021/12/31
*/
@Data
public class DiskCloudDiskUserParam implements Serializable {
private static final long serialVersionUID = -1230023773946170911L;
/**
* 资源目录表ID
*/
@ApiModelProperty(value = "资源目录表ID")
private Integer catalogueId;
/**
* 当前企业id
*/
@ApiModelProperty(value = "当前企业id")
private Integer orgId;
/**
* 用户ID
*/
@ApiModelProperty(value = "用户ID")
private Integer userId;
}
...@@ -16,4 +16,15 @@ ...@@ -16,4 +16,15 @@
<result property="deleteFlag" column="delete_flag"/> <result property="deleteFlag" column="delete_flag"/>
</resultMap> </resultMap>
<select id="getDiskCatalogueList" resultType="cn.timer.api.bean.disk.DiskCatalogue">
SELECT c.*,cdu.id as cloud_disk_user_id,cdu.user_role,cdu.user_power FROM `disk_catalogue` c
LEFT JOIN disk_cloud_disk_user cdu ON c.id=cdu.catalogue_id AND c.id > 0
WHERE c.delete_flag=0 AND cdu.delete_flag = 0
AND cdu.user_id = #{param.userId}
AND cdu.org_id = #{param.orgId}
<if test="param.id != null and param.id != ''">
AND c.id = #{param.id}
</if>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
SELECT f.* FROM `disk_files` f SELECT f.* FROM `disk_files` f
LEFT JOIN disk_catalogue_files cf ON f.id=cf.files_id AND cf.id > 0 LEFT JOIN disk_catalogue_files cf ON f.id=cf.files_id AND cf.id > 0
WHERE f.delete_flag=0 AND cf.delete_flag = 0 WHERE f.delete_flag=0 AND cf.delete_flag = 0
AND f.create_user_id = #{param.userId} AND cf.catalogue_id=#{param.parentId} AND cf.catalogue_id=#{param.parentId}
<if test="param.searchName != null and param.searchName != ''"> <if test="param.searchName != null and param.searchName != ''">
AND f.title like CONCAT('%',#{param.searchName},'%') AND f.title like CONCAT('%',#{param.searchName},'%')
</if> </if>
......
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