优化bug;租户数据初始化
This commit is contained in:
parent
f3316fc400
commit
a83bdf69ab
|
@ -2,7 +2,6 @@ package org.dromara.system.controller.file;
|
|||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
|
@ -107,7 +106,7 @@ public class SysCatalogPersonController extends BaseController {
|
|||
@SaCheckPermission("catalog:person:remove")
|
||||
@Log(title = "目录-我的空间", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{catalogId}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
public R<Void> remove(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long catalogId) {
|
||||
if (personService.hasChildByCatalogId(catalogId)) {
|
||||
return R.warn("存在下级,不允许删除");
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.dromara.system.controller.file;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
|
@ -110,7 +109,7 @@ public class SysCatalogResourceController extends BaseController {
|
|||
@SaCheckPermission("catalog:resource:remove")
|
||||
@Log(title = "目录-专题资源", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{catalogId}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
public R<Void> remove(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long catalogId) {
|
||||
if (resourceService.hasChildByCatalogId(catalogId)) {
|
||||
return R.warn("存在下级,不允许删除");
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.dromara.system.controller.file;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
|
@ -107,7 +106,7 @@ public class SysCatalogTextbookController extends BaseController {
|
|||
@SaCheckPermission("catalog:textbook:remove")
|
||||
@Log(title = "目录-同步教材", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{catalogId}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
public R<Void> remove(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long catalogId) {
|
||||
if (textbookService.hasChildByCatalogId(catalogId)) {
|
||||
return R.warn("存在下级,不允许删除");
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.dromara.system.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.dromara.system.domain.SysCatalogPerson;
|
||||
import org.dromara.system.domain.vo.SysCatalogPersonVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
@ -10,6 +11,7 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
|||
* @author cjw
|
||||
* @date 2024-06-13
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysCatalogPersonMapper extends BaseMapperPlus<SysCatalogPerson, SysCatalogPersonVo> {
|
||||
|
||||
}
|
||||
|
|
|
@ -336,8 +336,14 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
|||
xls.save(os, com.aspose.cells.SaveFormat.XLSX);
|
||||
}
|
||||
if ((".ppt").equals(sysOss.getFileSuffix())) {
|
||||
Presentation xls = new Presentation(is);
|
||||
xls.save(os, com.aspose.slides.SaveFormat.Pdf);
|
||||
//LoadOptions options = new LoadOptions();
|
||||
//options.set
|
||||
Presentation ppt = new Presentation(is);
|
||||
ppt.save(os, com.aspose.slides.SaveFormat.Pdf);
|
||||
}
|
||||
if ((".pptx").equals(sysOss.getFileSuffix())) {
|
||||
Presentation pptx = new Presentation(is);
|
||||
pptx.save(os, com.aspose.slides.SaveFormat.Pdf);
|
||||
}
|
||||
int len = 0;
|
||||
while ((len = is.read(byteData)) != -1) {
|
||||
|
@ -361,4 +367,20 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
// 验证License
|
||||
try {
|
||||
FileInputStream fileInput = new FileInputStream("D:/test.ppt");
|
||||
Presentation pres = new Presentation(fileInput);
|
||||
FileOutputStream out = new FileOutputStream(new File("D:/test.pdf"));
|
||||
pres.save(out, com.aspose.slides.SaveFormat.Pdf);
|
||||
out.close();
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,11 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
|||
private final SysDictDataMapper dictDataMapper;
|
||||
private final SysConfigMapper configMapper;
|
||||
|
||||
private final SysCatalogPersonMapper catalogPersonMapper;
|
||||
private final SysCatalogTextbookMapper catalogTextbookMapper;
|
||||
private final SysCatalogResourceMapper catalogResourceMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询租户
|
||||
*/
|
||||
|
@ -117,7 +122,9 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
|||
|
||||
// 获取所有租户编号
|
||||
List<String> tenantIds = baseMapper.selectObjs(
|
||||
new LambdaQueryWrapper<SysTenant>().select(SysTenant::getTenantId), x -> {return Convert.toStr(x);});
|
||||
new LambdaQueryWrapper<SysTenant>().select(SysTenant::getTenantId), x -> {
|
||||
return Convert.toStr(x);
|
||||
});
|
||||
String tenantId = generateTenantId(tenantIds);
|
||||
add.setTenantId(tenantId);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
|
@ -129,6 +136,27 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
|||
// 根据套餐创建角色
|
||||
Long roleId = createTenantRole(tenantId, bo.getPackageId());
|
||||
|
||||
//创建默认资源目录
|
||||
SysCatalogPerson catalogPerson = new SysCatalogPerson();
|
||||
catalogPerson.setTenantId(tenantId);
|
||||
catalogPerson.setCatalogName("我的空间");
|
||||
catalogPerson.setParentId(Constants.TOP_PARENT_ID);
|
||||
catalogPerson.setAncestors(Constants.TOP_PARENT_ID.toString());
|
||||
catalogPersonMapper.insert(catalogPerson);
|
||||
SysCatalogTextbook catalogTextbook = new SysCatalogTextbook();
|
||||
catalogTextbook.setTenantId(tenantId);
|
||||
catalogTextbook.setCatalogName("同步教材");
|
||||
catalogTextbook.setParentId(Constants.TOP_PARENT_ID);
|
||||
catalogTextbook.setAncestors(Constants.TOP_PARENT_ID.toString());
|
||||
catalogTextbook.setType(1);
|
||||
catalogTextbookMapper.insert(catalogTextbook);
|
||||
SysCatalogResource catalogResource = new SysCatalogResource();
|
||||
catalogResource.setTenantId(tenantId);
|
||||
catalogResource.setCatalogName("专题资源");
|
||||
catalogResource.setParentId(Constants.TOP_PARENT_ID);
|
||||
catalogResource.setAncestors(Constants.TOP_PARENT_ID.toString());
|
||||
catalogResource.setType(1);
|
||||
catalogResourceMapper.insert(catalogResource);
|
||||
// 创建部门: 公司名是部门名称
|
||||
SysDept dept = new SysDept();
|
||||
dept.setTenantId(tenantId);
|
||||
|
|
Loading…
Reference in New Issue