很多优化
This commit is contained in:
parent
0d337286b1
commit
fb1870328e
|
@ -36,7 +36,8 @@ public class SysCatalogPersonController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 查询目录-我的空间列表
|
* 查询目录-我的空间列表
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("catalog:person:list")
|
//@SaCheckPermission("catalog:person:list")
|
||||||
|
@SaCheckPermission("sys:person:oss")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public R<List<SysCatalogPersonVo>> list(SysCatalogPersonBo bo) {
|
public R<List<SysCatalogPersonVo>> list(SysCatalogPersonBo bo) {
|
||||||
List<SysCatalogPersonVo> list = personService.queryList(bo);
|
List<SysCatalogPersonVo> list = personService.queryList(bo);
|
||||||
|
@ -48,7 +49,8 @@ public class SysCatalogPersonController extends BaseController {
|
||||||
*
|
*
|
||||||
* @param catalogId 主键
|
* @param catalogId 主键
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("catalog:person:query")
|
//@SaCheckPermission("catalog:person:query")
|
||||||
|
@SaCheckPermission("sys:person:oss")
|
||||||
@GetMapping("/{catalogId}")
|
@GetMapping("/{catalogId}")
|
||||||
public R<SysCatalogPersonVo> getInfo(@NotNull(message = "主键不能为空")
|
public R<SysCatalogPersonVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
@PathVariable Long catalogId) {
|
@PathVariable Long catalogId) {
|
||||||
|
@ -58,7 +60,8 @@ public class SysCatalogPersonController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 新增目录-我的空间
|
* 新增目录-我的空间
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("catalog:person:add")
|
//@SaCheckPermission("catalog:person:add")
|
||||||
|
@SaCheckPermission("sys:person:oss")
|
||||||
@Log(title = "目录-我的空间", businessType = BusinessType.INSERT)
|
@Log(title = "目录-我的空间", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
|
@ -72,17 +75,19 @@ public class SysCatalogPersonController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 修改目录-我的空间
|
* 修改目录-我的空间
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("catalog:person:edit")
|
//@SaCheckPermission("catalog:person:edit")
|
||||||
|
@SaCheckPermission("sys:person:oss")
|
||||||
@Log(title = "目录-我的空间", businessType = BusinessType.UPDATE)
|
@Log(title = "目录-我的空间", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysCatalogPersonBo bo) {
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysCatalogPersonBo bo) {
|
||||||
Long catalogId = bo.getCatalogId();
|
// Long catalogId = bo.getCatalogId();
|
||||||
if (!personService.checkNameUnique(bo)) {
|
if (!personService.checkNameUnique(bo)) {
|
||||||
return R.fail("修改'" + bo.getCatalogName() + "'失败,名称已存在");
|
return R.fail("修改'" + bo.getCatalogName() + "'失败,名称已存在");
|
||||||
} else if (bo.getParentId().equals(catalogId)) {
|
|
||||||
return R.fail("修改'" + bo.getCatalogName() + "'失败,上级不能是自己");
|
|
||||||
}
|
}
|
||||||
|
// } else if (bo.getParentId().equals(catalogId)) {
|
||||||
|
// return R.fail("修改'" + bo.getCatalogName() + "'失败,上级不能是自己");
|
||||||
|
// }
|
||||||
return toAjax(personService.updateByBo(bo));
|
return toAjax(personService.updateByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +96,8 @@ public class SysCatalogPersonController extends BaseController {
|
||||||
*
|
*
|
||||||
* @param catalogId 主键串
|
* @param catalogId 主键串
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("catalog:person:remove")
|
//@SaCheckPermission("catalog:person:remove")
|
||||||
|
@SaCheckPermission("sys:person:oss")
|
||||||
@Log(title = "目录-我的空间", businessType = BusinessType.DELETE)
|
@Log(title = "目录-我的空间", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{catalogId}")
|
@DeleteMapping("/{catalogId}")
|
||||||
public R<Void> remove(@NotNull(message = "主键不能为空")
|
public R<Void> remove(@NotNull(message = "主键不能为空")
|
||||||
|
@ -110,7 +116,8 @@ public class SysCatalogPersonController extends BaseController {
|
||||||
*
|
*
|
||||||
* @param bo 拖动类
|
* @param bo 拖动类
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("catalog:person:edit")
|
//@SaCheckPermission("catalog:person:edit")
|
||||||
|
@SaCheckPermission("sys:person:oss")
|
||||||
@Log(title = "拖动目录-我的空间", businessType = BusinessType.UPDATE)
|
@Log(title = "拖动目录-我的空间", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/drag")
|
@PostMapping("/drag")
|
||||||
public R<Void> drag(@Validated @RequestBody CatalogDragBo bo) {
|
public R<Void> drag(@Validated @RequestBody CatalogDragBo bo) {
|
||||||
|
|
|
@ -89,12 +89,13 @@ public class SysCatalogResourceController extends BaseController {
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysCatalogResourceBo bo) {
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysCatalogResourceBo bo) {
|
||||||
Long catalogId = bo.getCatalogId();
|
// Long catalogId = bo.getCatalogId();
|
||||||
if (!resourceService.checkNameUnique(bo)) {
|
if (!resourceService.checkNameUnique(bo)) {
|
||||||
return R.fail("修改'" + bo.getCatalogName() + "'失败,名称已存在");
|
return R.fail("修改'" + bo.getCatalogName() + "'失败,名称已存在");
|
||||||
} else if (bo.getParentId().equals(catalogId)) {
|
|
||||||
return R.fail("修改'" + bo.getCatalogName() + "'失败,上级不能是自己");
|
|
||||||
}
|
}
|
||||||
|
// } else if (bo.getParentId().equals(catalogId)) {
|
||||||
|
// return R.fail("修改'" + bo.getCatalogName() + "'失败,上级不能是自己");
|
||||||
|
// }
|
||||||
return toAjax(resourceService.updateByBo(bo));
|
return toAjax(resourceService.updateByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,12 +88,13 @@ public class SysCatalogTextbookController extends BaseController {
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysCatalogTextbookBo bo) {
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysCatalogTextbookBo bo) {
|
||||||
Long catalogId = bo.getCatalogId();
|
// Long catalogId = bo.getCatalogId();
|
||||||
if (!textbookService.checkNameUnique(bo)) {
|
if (!textbookService.checkNameUnique(bo)) {
|
||||||
return R.fail("修改'" + bo.getCatalogName() + "'失败,名称已存在");
|
return R.fail("修改'" + bo.getCatalogName() + "'失败,名称已存在");
|
||||||
} else if (bo.getParentId().equals(catalogId)) {
|
|
||||||
return R.fail("修改'" + bo.getCatalogName() + "'失败,上级不能是自己");
|
|
||||||
}
|
}
|
||||||
|
// } else if (bo.getParentId().equals(catalogId)) {
|
||||||
|
// return R.fail("修改'" + bo.getCatalogName() + "'失败,上级不能是自己");
|
||||||
|
// }
|
||||||
return toAjax(textbookService.updateByBo(bo));
|
return toAjax(textbookService.updateByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,8 @@ public class SysOssPersonController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 查询资源-我的空间列表
|
* 查询资源-我的空间列表
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("file:person:pageList")
|
//@SaCheckPermission("file:person:pageList")
|
||||||
|
@SaCheckPermission("sys:person:oss")
|
||||||
@GetMapping("/pageList")
|
@GetMapping("/pageList")
|
||||||
public TableDataInfo<SysOssPersonVo> list(SysOssPersonBo bo, PageQuery pageQuery) {
|
public TableDataInfo<SysOssPersonVo> list(SysOssPersonBo bo, PageQuery pageQuery) {
|
||||||
return sysOssPersonService.queryPageList(bo, pageQuery);
|
return sysOssPersonService.queryPageList(bo, pageQuery);
|
||||||
|
@ -49,7 +50,8 @@ public class SysOssPersonController extends BaseController {
|
||||||
*
|
*
|
||||||
* @param id 主键
|
* @param id 主键
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("file:person:query")
|
//@SaCheckPermission("file:person:query")
|
||||||
|
@SaCheckPermission("sys:person:oss")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public R<SysOssPersonVo> getInfo(@NotNull(message = "主键不能为空")
|
public R<SysOssPersonVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
@PathVariable Long id) {
|
@PathVariable Long id) {
|
||||||
|
@ -59,7 +61,8 @@ public class SysOssPersonController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 新增资源-我的空间
|
* 新增资源-我的空间
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("file:person:add")
|
//@SaCheckPermission("file:person:add")
|
||||||
|
@SaCheckPermission("sys:person:oss")
|
||||||
@Log(title = "资源-我的空间", businessType = BusinessType.INSERT)
|
@Log(title = "资源-我的空间", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
|
@ -73,7 +76,8 @@ public class SysOssPersonController extends BaseController {
|
||||||
*
|
*
|
||||||
* @param ids 主键串
|
* @param ids 主键串
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("file:person:remove")
|
//@SaCheckPermission("file:person:remove")
|
||||||
|
@SaCheckPermission("sys:person:oss")
|
||||||
@Log(title = "资源-我的空间", businessType = BusinessType.DELETE)
|
@Log(title = "资源-我的空间", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@ -86,7 +90,8 @@ public class SysOssPersonController extends BaseController {
|
||||||
*
|
*
|
||||||
* @param bo 主键串
|
* @param bo 主键串
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("file:person:copy")
|
//@SaCheckPermission("file:person:copy")
|
||||||
|
@SaCheckPermission("sys:person:oss")
|
||||||
@Log(title = "【复制我的空间】", businessType = BusinessType.UPDATE)
|
@Log(title = "【复制我的空间】", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/copy")
|
@PutMapping("/copy")
|
||||||
public R<Void> copy(@RequestBody SysOssPersonBo bo) {
|
public R<Void> copy(@RequestBody SysOssPersonBo bo) {
|
||||||
|
@ -98,7 +103,8 @@ public class SysOssPersonController extends BaseController {
|
||||||
*
|
*
|
||||||
* @param bo 主键串
|
* @param bo 主键串
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("file:person:move")
|
//@SaCheckPermission("file:person:move")
|
||||||
|
@SaCheckPermission("sys:person:oss")
|
||||||
@Log(title = "【移动我的空间】", businessType = BusinessType.UPDATE)
|
@Log(title = "【移动我的空间】", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/move")
|
@PutMapping("/move")
|
||||||
public R<Void> move(@RequestBody SysOssPersonBo bo) {
|
public R<Void> move(@RequestBody SysOssPersonBo bo) {
|
||||||
|
@ -110,7 +116,8 @@ public class SysOssPersonController extends BaseController {
|
||||||
*
|
*
|
||||||
* @param bo 主键串
|
* @param bo 主键串
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("file:person:share")
|
//@SaCheckPermission("file:person:share")
|
||||||
|
@SaCheckPermission("sys:person:oss")
|
||||||
@Log(title = "【分享我的空间】", businessType = BusinessType.UPDATE)
|
@Log(title = "【分享我的空间】", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/share")
|
@PutMapping("/share")
|
||||||
public R<Void> share(@RequestBody SysOssPersonBo bo) {
|
public R<Void> share(@RequestBody SysOssPersonBo bo) {
|
||||||
|
@ -122,7 +129,8 @@ public class SysOssPersonController extends BaseController {
|
||||||
*
|
*
|
||||||
* @param id 主键
|
* @param id 主键
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("file:person:download")
|
//@SaCheckPermission("file:person:download")
|
||||||
|
@SaCheckPermission("sys:person:oss")
|
||||||
@PostMapping("/download/{id}")
|
@PostMapping("/download/{id}")
|
||||||
public void download(@NotNull(message = "主键不能为空") @PathVariable Long id, HttpServletResponse response) throws Exception {
|
public void download(@NotNull(message = "主键不能为空") @PathVariable Long id, HttpServletResponse response) throws Exception {
|
||||||
sysOssPersonService.download(id, response);
|
sysOssPersonService.download(id, response);
|
||||||
|
@ -133,7 +141,8 @@ public class SysOssPersonController extends BaseController {
|
||||||
*
|
*
|
||||||
* @param id 主键
|
* @param id 主键
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("file:person:preview")
|
//@SaCheckPermission("file:person:preview")
|
||||||
|
@SaCheckPermission("sys:person:oss")
|
||||||
@PostMapping("/preview/{id}")
|
@PostMapping("/preview/{id}")
|
||||||
public R<String> preview(@NotNull(message = "主键不能为空") @PathVariable Long id) throws Exception {
|
public R<String> preview(@NotNull(message = "主键不能为空") @PathVariable Long id) throws Exception {
|
||||||
return R.ok("操作成功", sysOssPersonService.preview(id));
|
return R.ok("操作成功", sysOssPersonService.preview(id));
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.dromara.system.service.impl;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.lock.annotation.Lock4j;
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
@ -25,6 +26,7 @@ import org.dromara.system.mapper.SysOssPersonMapper;
|
||||||
import org.dromara.system.service.ISysCatalogPersonService;
|
import org.dromara.system.service.ISysCatalogPersonService;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -87,7 +89,9 @@ public class SysCatalogPersonServiceImpl implements ISysCatalogPersonService {
|
||||||
* @param bo 目录-我的空间
|
* @param bo 目录-我的空间
|
||||||
* @return 是否新增成功
|
* @return 是否新增成功
|
||||||
*/
|
*/
|
||||||
|
@Lock4j
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean insertByBo(SysCatalogPersonBo bo) {
|
public Boolean insertByBo(SysCatalogPersonBo bo) {
|
||||||
Long parentId = bo.getParentId();
|
Long parentId = bo.getParentId();
|
||||||
SysCatalogPerson info = baseMapper.selectById(parentId);
|
SysCatalogPerson info = baseMapper.selectById(parentId);
|
||||||
|
@ -106,17 +110,20 @@ public class SysCatalogPersonServiceImpl implements ISysCatalogPersonService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateByBo(SysCatalogPersonBo bo) {
|
public Boolean updateByBo(SysCatalogPersonBo bo) {
|
||||||
SysCatalogPerson update = MapstructUtils.convert(bo, SysCatalogPerson.class);
|
// SysCatalogPerson update = MapstructUtils.convert(bo, SysCatalogPerson.class);
|
||||||
SysCatalogPerson old = baseMapper.selectById(update.getCatalogId());
|
// SysCatalogPerson old = baseMapper.selectById(update.getCatalogId());
|
||||||
if (!old.getParentId().equals(update.getParentId())) {
|
// if (!old.getParentId().equals(update.getParentId())) {
|
||||||
SysCatalogPerson newParentDept = baseMapper.selectById(update.getParentId());
|
// SysCatalogPerson newParentDept = baseMapper.selectById(update.getParentId());
|
||||||
if (ObjectUtil.isNotNull(newParentDept) && ObjectUtil.isNotNull(old)) {
|
// if (ObjectUtil.isNotNull(newParentDept) && ObjectUtil.isNotNull(old)) {
|
||||||
String newAncestors = newParentDept.getAncestors() + StringUtils.SEPARATOR + newParentDept.getCatalogId();
|
// String newAncestors = newParentDept.getAncestors() + StringUtils.SEPARATOR + newParentDept.getCatalogId();
|
||||||
String oldAncestors = old.getAncestors();
|
// String oldAncestors = old.getAncestors();
|
||||||
update.setAncestors(newAncestors);
|
// update.setAncestors(newAncestors);
|
||||||
updateDeptChildren(update.getCatalogId(), newAncestors, oldAncestors);
|
// updateDeptChildren(update.getCatalogId(), newAncestors, oldAncestors);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
SysCatalogPerson update = new SysCatalogPerson();
|
||||||
|
update.setCatalogId(bo.getCatalogId());
|
||||||
|
update.setCatalogName(bo.getCatalogName());
|
||||||
return baseMapper.updateById(update) > 0;
|
return baseMapper.updateById(update) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +196,9 @@ public class SysCatalogPersonServiceImpl implements ISysCatalogPersonService {
|
||||||
return baseMapper.selectList(queryWrapper);
|
return baseMapper.selectList(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Lock4j
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean dragCatalog(CatalogDragBo bo) {
|
public boolean dragCatalog(CatalogDragBo bo) {
|
||||||
Long oldCatalogId = bo.getOldCatalog();
|
Long oldCatalogId = bo.getOldCatalog();
|
||||||
Long newCatalogId = bo.getNewCatalog();
|
Long newCatalogId = bo.getNewCatalog();
|
||||||
|
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.lang.tree.Tree;
|
import cn.hutool.core.lang.tree.Tree;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.lock.annotation.Lock4j;
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
@ -29,6 +30,7 @@ import org.dromara.system.mapper.SysOssResourceMapper;
|
||||||
import org.dromara.system.service.ISysCatalogResourceService;
|
import org.dromara.system.service.ISysCatalogResourceService;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -134,7 +136,9 @@ public class SysCatalogResourceServiceImpl implements ISysCatalogResourceService
|
||||||
* @param bo 目录-专题资源
|
* @param bo 目录-专题资源
|
||||||
* @return 是否新增成功
|
* @return 是否新增成功
|
||||||
*/
|
*/
|
||||||
|
@Lock4j
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean insertByBo(SysCatalogResourceBo bo) {
|
public Boolean insertByBo(SysCatalogResourceBo bo) {
|
||||||
Long parentId = bo.getParentId();
|
Long parentId = bo.getParentId();
|
||||||
SysCatalogResource info = baseMapper.selectById(parentId);
|
SysCatalogResource info = baseMapper.selectById(parentId);
|
||||||
|
@ -159,17 +163,20 @@ public class SysCatalogResourceServiceImpl implements ISysCatalogResourceService
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateByBo(SysCatalogResourceBo bo) {
|
public Boolean updateByBo(SysCatalogResourceBo bo) {
|
||||||
SysCatalogResource update = MapstructUtils.convert(bo, SysCatalogResource.class);
|
// SysCatalogResource update = MapstructUtils.convert(bo, SysCatalogResource.class);
|
||||||
SysCatalogResourceVo old = SpringUtils.getAopProxy(this).selectCatalogById(update.getCatalogId());
|
// SysCatalogResourceVo old = SpringUtils.getAopProxy(this).selectCatalogById(update.getCatalogId());
|
||||||
if (!old.getParentId().equals(update.getParentId())) {
|
// if (!old.getParentId().equals(update.getParentId())) {
|
||||||
SysCatalogResourceVo newParentDept = SpringUtils.getAopProxy(this).selectCatalogById(update.getParentId());
|
// SysCatalogResourceVo newParentDept = SpringUtils.getAopProxy(this).selectCatalogById(update.getParentId());
|
||||||
if (ObjectUtil.isNotNull(newParentDept) && ObjectUtil.isNotNull(old)) {
|
// if (ObjectUtil.isNotNull(newParentDept) && ObjectUtil.isNotNull(old)) {
|
||||||
String newAncestors = newParentDept.getAncestors() + StringUtils.SEPARATOR + newParentDept.getCatalogId();
|
// String newAncestors = newParentDept.getAncestors() + StringUtils.SEPARATOR + newParentDept.getCatalogId();
|
||||||
String oldAncestors = old.getAncestors();
|
// String oldAncestors = old.getAncestors();
|
||||||
update.setAncestors(newAncestors);
|
// update.setAncestors(newAncestors);
|
||||||
updateDeptChildren(update.getCatalogId(), newAncestors, oldAncestors);
|
// updateDeptChildren(update.getCatalogId(), newAncestors, oldAncestors);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
SysCatalogResource update = new SysCatalogResource();
|
||||||
|
update.setCatalogId(bo.getCatalogId());
|
||||||
|
update.setCatalogName(bo.getCatalogName());
|
||||||
return baseMapper.updateById(update) > 0;
|
return baseMapper.updateById(update) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +256,9 @@ public class SysCatalogResourceServiceImpl implements ISysCatalogResourceService
|
||||||
return buildCatalogTreeSelect(voList);
|
return buildCatalogTreeSelect(voList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Lock4j
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean dragCatalog(CatalogDragBo bo) {
|
public boolean dragCatalog(CatalogDragBo bo) {
|
||||||
Long oldCatalogId = bo.getOldCatalog();
|
Long oldCatalogId = bo.getOldCatalog();
|
||||||
Long newCatalogId = bo.getNewCatalog();
|
Long newCatalogId = bo.getNewCatalog();
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.dromara.system.mapper.SysOssTextbookMapper;
|
||||||
import org.dromara.system.service.ISysCatalogTextbookService;
|
import org.dromara.system.service.ISysCatalogTextbookService;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -100,6 +101,7 @@ public class SysCatalogTextbookServiceImpl implements ISysCatalogTextbookService
|
||||||
*/
|
*/
|
||||||
@Lock4j
|
@Lock4j
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean insertByBo(SysCatalogTextbookBo bo) {
|
public Boolean insertByBo(SysCatalogTextbookBo bo) {
|
||||||
Long parentId = bo.getParentId();
|
Long parentId = bo.getParentId();
|
||||||
SysCatalogTextbook info = baseMapper.selectById(parentId);
|
SysCatalogTextbook info = baseMapper.selectById(parentId);
|
||||||
|
@ -124,17 +126,21 @@ public class SysCatalogTextbookServiceImpl implements ISysCatalogTextbookService
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateByBo(SysCatalogTextbookBo bo) {
|
public Boolean updateByBo(SysCatalogTextbookBo bo) {
|
||||||
SysCatalogTextbook update = MapstructUtils.convert(bo, SysCatalogTextbook.class);
|
// SysCatalogTextbook update = MapstructUtils.convert(bo, SysCatalogTextbook.class);
|
||||||
SysCatalogTextbookVo old = SpringUtils.getAopProxy(this).selectCatalogById(update.getCatalogId());
|
// SysCatalogTextbookVo old = SpringUtils.getAopProxy(this).selectCatalogById(update.getCatalogId());
|
||||||
if (!old.getParentId().equals(update.getParentId())) {
|
// if (!old.getParentId().equals(update.getParentId())) {
|
||||||
SysCatalogTextbookVo newParentDept = SpringUtils.getAopProxy(this).selectCatalogById(update.getParentId());
|
// SysCatalogTextbookVo newParentDept = SpringUtils.getAopProxy(this).selectCatalogById(update.getParentId());
|
||||||
if (ObjectUtil.isNotNull(newParentDept) && ObjectUtil.isNotNull(old)) {
|
// if (ObjectUtil.isNotNull(newParentDept) && ObjectUtil.isNotNull(old)) {
|
||||||
String newAncestors = newParentDept.getAncestors() + StringUtils.SEPARATOR + newParentDept.getCatalogId();
|
// String newAncestors = newParentDept.getAncestors() + StringUtils.SEPARATOR + newParentDept.getCatalogId();
|
||||||
String oldAncestors = old.getAncestors();
|
// String oldAncestors = old.getAncestors();
|
||||||
update.setAncestors(newAncestors);
|
// update.setAncestors(newAncestors);
|
||||||
updateCatalogChildren(update.getCatalogId(), newAncestors, oldAncestors);
|
// updateCatalogChildren(update.getCatalogId(), newAncestors, oldAncestors);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
// update.setOrderNum(null);
|
||||||
|
SysCatalogTextbook update = new SysCatalogTextbook();
|
||||||
|
update.setCatalogId(bo.getCatalogId());
|
||||||
|
update.setCatalogName(bo.getCatalogName());
|
||||||
return baseMapper.updateById(update) > 0;
|
return baseMapper.updateById(update) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,7 +226,9 @@ public class SysCatalogTextbookServiceImpl implements ISysCatalogTextbookService
|
||||||
return buildCatalogTreeSelect(voList);
|
return buildCatalogTreeSelect(voList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Lock4j
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean dragCatalog(CatalogDragBo bo) {
|
public boolean dragCatalog(CatalogDragBo bo) {
|
||||||
Long oldCatalogId = bo.getOldCatalog();
|
Long oldCatalogId = bo.getOldCatalog();
|
||||||
Long newCatalogId = bo.getNewCatalog();
|
Long newCatalogId = bo.getNewCatalog();
|
||||||
|
|
|
@ -16,20 +16,15 @@ import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.common.mybatis.helper.DataBaseHelper;
|
import org.dromara.common.mybatis.helper.DataBaseHelper;
|
||||||
import org.dromara.common.satoken.utils.LoginHelper;
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
import org.dromara.system.constant.StatusConstants;
|
|
||||||
import org.dromara.system.domain.SysCatalogPerson;
|
import org.dromara.system.domain.SysCatalogPerson;
|
||||||
import org.dromara.system.domain.SysOssPerson;
|
import org.dromara.system.domain.SysOssPerson;
|
||||||
import org.dromara.system.domain.SysOssTextbook;
|
|
||||||
import org.dromara.system.domain.bo.SysOssPersonBo;
|
import org.dromara.system.domain.bo.SysOssPersonBo;
|
||||||
|
import org.dromara.system.domain.bo.SysOssTextbookBo;
|
||||||
import org.dromara.system.domain.vo.SysCatalogPersonVo;
|
import org.dromara.system.domain.vo.SysCatalogPersonVo;
|
||||||
import org.dromara.system.domain.vo.SysOssPersonVo;
|
import org.dromara.system.domain.vo.SysOssPersonVo;
|
||||||
import org.dromara.system.domain.vo.SysOssVo;
|
import org.dromara.system.domain.vo.SysOssVo;
|
||||||
import org.dromara.system.mapper.SysOssPersonMapper;
|
import org.dromara.system.mapper.SysOssPersonMapper;
|
||||||
import org.dromara.system.mapper.SysOssTextbookMapper;
|
import org.dromara.system.service.*;
|
||||||
import org.dromara.system.service.ISysCatalogPersonService;
|
|
||||||
import org.dromara.system.service.ISysCatalogTextbookService;
|
|
||||||
import org.dromara.system.service.ISysOssPersonService;
|
|
||||||
import org.dromara.system.service.ISysOssService;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -51,9 +46,8 @@ public class SysOssPersonServiceImpl implements ISysOssPersonService {
|
||||||
|
|
||||||
private final ISysOssService ossService;
|
private final ISysOssService ossService;
|
||||||
|
|
||||||
private final SysOssTextbookMapper textbookMapper;
|
private final ISysOssTextbookService textbookService;
|
||||||
|
|
||||||
private final ISysCatalogTextbookService catalogTextbookService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询资源-我的空间
|
* 查询资源-我的空间
|
||||||
|
@ -231,20 +225,19 @@ public class SysOssPersonServiceImpl implements ISysOssPersonService {
|
||||||
@Override
|
@Override
|
||||||
public boolean share(SysOssPersonBo bo) {
|
public boolean share(SysOssPersonBo bo) {
|
||||||
SysOssPerson ossPerson = baseMapper.selectById(bo.getId());
|
SysOssPerson ossPerson = baseMapper.selectById(bo.getId());
|
||||||
SysOssTextbook date = new SysOssTextbook();
|
SysOssTextbookBo date = new SysOssTextbookBo();
|
||||||
date.setOssId(ossPerson.getOssId());
|
date.setOssId(ossPerson.getOssId());
|
||||||
String path = catalogTextbookService.selectCatalogNameById(bo.getCatalogId());
|
|
||||||
date.setCatalogId(bo.getCatalogId());
|
date.setCatalogId(bo.getCatalogId());
|
||||||
date.setFileName(ossPerson.getFileName());
|
date.setFileName(ossPerson.getFileName());
|
||||||
date.setFileSuffix(ossPerson.getFileSuffix());
|
date.setFileSuffix(ossPerson.getFileSuffix());
|
||||||
date.setFilePath(path);
|
|
||||||
date.setType(ossPerson.getType());
|
date.setType(ossPerson.getType());
|
||||||
date.setOssType(1);
|
date.setOssType(1);
|
||||||
date.setStatus(StatusConstants.IN_USE);
|
|
||||||
date.setFinalizeStatus(StatusConstants.DISABLED);
|
|
||||||
date.setCreateDept(ossPerson.getCreateDept());
|
date.setCreateDept(ossPerson.getCreateDept());
|
||||||
date.setCreateBy(ossPerson.getCreateBy());
|
date.setCreateBy(ossPerson.getCreateBy());
|
||||||
date.setUpdateBy(ossPerson.getCreateBy());
|
date.setUpdateBy(ossPerson.getCreateBy());
|
||||||
return textbookMapper.insert(date) > 0;
|
if (!textbookService.checkNameUnique(date)) {
|
||||||
|
throw new ServiceException("分享'" + date.getFileName() + "'失败,名称已存在");
|
||||||
|
}
|
||||||
|
return textbookService.insertByBo(date);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,6 +253,10 @@ public class SysOssResourceServiceImpl implements ISysOssResourceService {
|
||||||
if (ossResource.getCatalogId().equals(bo.getCatalogId())) {
|
if (ossResource.getCatalogId().equals(bo.getCatalogId())) {
|
||||||
throw new ServiceException("同目录下不能复制或移动");
|
throw new ServiceException("同目录下不能复制或移动");
|
||||||
}
|
}
|
||||||
|
bo.setFileName(ossResource.getFileName());
|
||||||
|
if(this.checkNameUnique(bo)){
|
||||||
|
throw new ServiceException("复制或移动'" + bo.getFileName() + "'失败,名称已存在");
|
||||||
|
}
|
||||||
SysOssResource date = new SysOssResource();
|
SysOssResource date = new SysOssResource();
|
||||||
date.setOssId(ossResource.getOssId());
|
date.setOssId(ossResource.getOssId());
|
||||||
String path = catalogService.selectCatalogNameById(bo.getCatalogId());
|
String path = catalogService.selectCatalogNameById(bo.getCatalogId());
|
||||||
|
|
|
@ -272,6 +272,11 @@ public class SysOssTextbookServiceImpl implements ISysOssTextbookService {
|
||||||
if (ossTextbook.getCatalogId().equals(bo.getCatalogId())) {
|
if (ossTextbook.getCatalogId().equals(bo.getCatalogId())) {
|
||||||
throw new ServiceException("同目录下不能复制或移动");
|
throw new ServiceException("同目录下不能复制或移动");
|
||||||
}
|
}
|
||||||
|
bo.setFileName(ossTextbook.getFileName());
|
||||||
|
bo.setOssType(ossTextbook.getOssType());
|
||||||
|
if (this.checkNameUnique(bo)) {
|
||||||
|
throw new ServiceException("复制或移动'" + bo.getFileName() + "'失败,名称已存在");
|
||||||
|
}
|
||||||
SysOssTextbook date = new SysOssTextbook();
|
SysOssTextbook date = new SysOssTextbook();
|
||||||
date.setOssId(ossTextbook.getOssId());
|
date.setOssId(ossTextbook.getOssId());
|
||||||
String path = catalogService.selectCatalogNameById(bo.getCatalogId());
|
String path = catalogService.selectCatalogNameById(bo.getCatalogId());
|
||||||
|
@ -360,6 +365,9 @@ public class SysOssTextbookServiceImpl implements ISysOssTextbookService {
|
||||||
public Boolean finalize(SysOssTextbookBo bo) {
|
public Boolean finalize(SysOssTextbookBo bo) {
|
||||||
Long id = bo.getId();
|
Long id = bo.getId();
|
||||||
SysOssTextbook ossTextbook = baseMapper.selectById(id);
|
SysOssTextbook ossTextbook = baseMapper.selectById(id);
|
||||||
|
if (ossTextbook.getFinalizeStatus() == 1) {
|
||||||
|
throw new ServiceException("请勿重复定稿");
|
||||||
|
}
|
||||||
SysOssTextbook date = new SysOssTextbook();
|
SysOssTextbook date = new SysOssTextbook();
|
||||||
date.setOssId(ossTextbook.getOssId());
|
date.setOssId(ossTextbook.getOssId());
|
||||||
date.setCatalogId(ossTextbook.getCatalogId());
|
date.setCatalogId(ossTextbook.getCatalogId());
|
||||||
|
|
Loading…
Reference in New Issue