忘了提交了

This commit is contained in:
cjw 2024-07-03 10:22:10 +08:00
parent 2fd7323d79
commit 8361200034
22 changed files with 155 additions and 81 deletions

42
pom.xml
View File

@ -347,27 +347,27 @@
<version>${revision}</version> <version>${revision}</version>
</dependency> </dependency>
<!--office工具--> <!--office工具 暂且使用第三方服务-->
<dependency> <!-- <dependency>-->
<groupId>com.luhuiguo</groupId> <!-- <groupId>com.luhuiguo</groupId>-->
<artifactId>aspose-words</artifactId> <!-- <artifactId>aspose-words</artifactId>-->
<version>23.1</version> <!-- <version>23.1</version>-->
</dependency> <!-- </dependency>-->
<dependency> <!-- <dependency>-->
<groupId>com.luhuiguo</groupId> <!-- <groupId>com.luhuiguo</groupId>-->
<artifactId>aspose-pdf</artifactId> <!-- <artifactId>aspose-pdf</artifactId>-->
<version>23.1</version> <!-- <version>23.1</version>-->
</dependency> <!-- </dependency>-->
<dependency> <!-- <dependency>-->
<groupId>com.luhuiguo</groupId> <!-- <groupId>com.luhuiguo</groupId>-->
<artifactId>aspose-cells</artifactId> <!-- <artifactId>aspose-cells</artifactId>-->
<version>23.1</version> <!-- <version>23.1</version>-->
</dependency> <!-- </dependency>-->
<dependency> <!-- <dependency>-->
<groupId>com.luhuiguo</groupId> <!-- <groupId>com.luhuiguo</groupId>-->
<artifactId>aspose-slides</artifactId> <!-- <artifactId>aspose-slides</artifactId>-->
<version>23.1</version> <!-- <version>23.1</version>-->
</dependency> <!-- </dependency>-->
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>

View File

@ -6,7 +6,7 @@ spring.boot.admin.client:
instance: instance:
service-host-type: IP service-host-type: IP
username: ruoyi username: ruoyi
password: 123456 password: Mz123456!
--- # snail-job 配置 --- # snail-job 配置
snail-job: snail-job:

View File

@ -9,7 +9,7 @@ spring.boot.admin.client:
instance: instance:
service-host-type: IP service-host-type: IP
username: ruoyi username: ruoyi
password: 123456 password: Mz123456!
--- # snail-job 配置 --- # snail-job 配置
snail-job: snail-job:

View File

@ -6,7 +6,7 @@ spring.boot.admin.client:
instance: instance:
service-host-type: IP service-host-type: IP
username: ruoyi username: ruoyi
password: 123456 password: Mz123456!
--- # snail-job 配置 --- # snail-job 配置
snail-job: snail-job:

View File

@ -60,6 +60,16 @@ public class RegexValidator extends Validator {
return isMatchRegex(ACCOUNT, value); return isMatchRegex(ACCOUNT, value);
} }
/**
* 检查输入的密码是否匹配预定义的规则
*
* @param value 要验证的密码
* @return 如果密码符合规则返回 true否则返回 false
*/
public static boolean isPassword(CharSequence value) {
return isMatchRegex(PASSWORD, value);
}
/** /**
* 验证输入的账号是否符合规则如果不符合则抛出 ValidateException 异常 * 验证输入的账号是否符合规则如果不符合则抛出 ValidateException 异常
* *

View File

@ -14,7 +14,7 @@ spring:
security: security:
user: user:
name: ruoyi name: ruoyi
password: 123456 password: Mz123456!
boot: boot:
admin: admin:
ui: ui:
@ -42,4 +42,4 @@ spring.boot.admin.client:
instance: instance:
service-host-type: IP service-host-type: IP
username: ruoyi username: ruoyi
password: 123456 password: Mz123456!

View File

@ -44,4 +44,4 @@ spring.boot.admin.client:
instance: instance:
service-host-type: IP service-host-type: IP
username: ruoyi username: ruoyi
password: 123456 password: Mz123456!

View File

@ -44,4 +44,4 @@ spring.boot.admin.client:
instance: instance:
service-host-type: IP service-host-type: IP
username: ruoyi username: ruoyi
password: 123456 password: Mz123456!

View File

@ -95,22 +95,22 @@
<artifactId>ruoyi-common-websocket</artifactId> <artifactId>ruoyi-common-websocket</artifactId>
</dependency> </dependency>
<dependency> <!-- <dependency>-->
<groupId>com.luhuiguo</groupId> <!-- <groupId>com.luhuiguo</groupId>-->
<artifactId>aspose-words</artifactId> <!-- <artifactId>aspose-words</artifactId>-->
</dependency> <!-- </dependency>-->
<dependency> <!-- <dependency>-->
<groupId>com.luhuiguo</groupId> <!-- <groupId>com.luhuiguo</groupId>-->
<artifactId>aspose-pdf</artifactId> <!-- <artifactId>aspose-pdf</artifactId>-->
</dependency> <!-- </dependency>-->
<dependency> <!-- <dependency>-->
<groupId>com.luhuiguo</groupId> <!-- <groupId>com.luhuiguo</groupId>-->
<artifactId>aspose-cells</artifactId> <!-- <artifactId>aspose-cells</artifactId>-->
</dependency> <!-- </dependency>-->
<dependency> <!-- <dependency>-->
<groupId>com.luhuiguo</groupId> <!-- <groupId>com.luhuiguo</groupId>-->
<artifactId>aspose-slides</artifactId> <!-- <artifactId>aspose-slides</artifactId>-->
</dependency> <!-- </dependency>-->
</dependencies> </dependencies>

View File

@ -113,13 +113,13 @@ public class SysOssPersonController extends BaseController {
@SaCheckPermission("file:person:download") @SaCheckPermission("file:person:download")
@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);
} }
@SaCheckPermission("file:person:preview") @SaCheckPermission("file:person:preview")
@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));
} }
} }

View File

@ -47,12 +47,21 @@ public class SysOssResourceController extends BaseController {
/** /**
* 待审核查询列表 * 待审核查询列表
*/ */
@SaCheckPermission("file:textbook:awaitList") @SaCheckPermission("file:resource:awaitList")
@GetMapping("/await/pageList") @GetMapping("/await/pageList")
public TableDataInfo<SysOssResourceVo> awaitList(SysOssResourceBo bo, PageQuery pageQuery) { public TableDataInfo<SysOssResourceVo> awaitList(SysOssResourceBo bo, PageQuery pageQuery) {
return sysOssResourceService.queryAwaitPageList(bo, pageQuery); return sysOssResourceService.queryAwaitPageList(bo, pageQuery);
} }
/**
* 待审核数量
*/
@SaCheckPermission("file:resource:review")
@GetMapping("/await/count")
public R<Long> awaitListCount(SysOssResourceBo bo) {
return R.ok(sysOssResourceService.countAwaitList(bo));
}
/** /**
* 获取专题资源文件详细信息 * 获取专题资源文件详细信息
* *
@ -89,6 +98,7 @@ public class SysOssResourceController extends BaseController {
@PathVariable Long[] ossIds) { @PathVariable Long[] ossIds) {
return toAjax(sysOssResourceService.deleteWithValidByIds(List.of(ossIds), true)); return toAjax(sysOssResourceService.deleteWithValidByIds(List.of(ossIds), true));
} }
/** /**
* 审核 * 审核
* *
@ -127,17 +137,18 @@ public class SysOssResourceController extends BaseController {
/** /**
* 下载 * 下载
*
* @param id 主键 * @param id 主键
*/ */
@SaCheckPermission("file:resource:download") @SaCheckPermission("file:resource:download")
@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 {
sysOssResourceService.download(id,response); sysOssResourceService.download(id, response);
} }
@SaCheckPermission("file:resource:preview") @SaCheckPermission("file:resource:preview")
@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("操作成功",sysOssResourceService.preview(id)); return R.ok("操作成功", sysOssResourceService.preview(id));
} }
} }

View File

@ -53,6 +53,14 @@ public class SysOssTextbookController extends BaseController {
return sysOssTextbookService.queryAwaitPageList(bo, pageQuery); return sysOssTextbookService.queryAwaitPageList(bo, pageQuery);
} }
/**
* 待审核数量
*/
@SaCheckPermission("file:textbook:review")
@GetMapping("/await/count")
public R<Long> awaitListCount(SysOssTextbookBo bo) {
return R.ok(sysOssTextbookService.countAwaitList(bo));
}
/** /**
* 获取同步教材文件的详细信息 * 获取同步教材文件的详细信息
@ -134,12 +142,12 @@ public class SysOssTextbookController extends BaseController {
@SaCheckPermission("file:textbook:download") @SaCheckPermission("file:textbook:download")
@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 {
sysOssTextbookService.download(id,response); sysOssTextbookService.download(id, response);
} }
@SaCheckPermission("file:textbook:preview") @SaCheckPermission("file:textbook:preview")
@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("操作成功",sysOssTextbookService.preview(id)); return R.ok("操作成功", sysOssTextbookService.preview(id));
} }
} }

View File

@ -1,6 +1,5 @@
package org.dromara.system.controller.portal; package org.dromara.system.controller.portal;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaIgnore; import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.lang.tree.Tree; import cn.hutool.core.lang.tree.Tree;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
@ -71,7 +70,7 @@ public class PortalController extends BaseController {
* *
* @param showId 主键 * @param showId 主键
*/ */
@SaCheckPermission("home:show:query") @SaIgnore
@GetMapping("/show/{showId}") @GetMapping("/show/{showId}")
public R<SysHomeShowVo> getShowInfo(@NotNull(message = "主键不能为空") public R<SysHomeShowVo> getShowInfo(@NotNull(message = "主键不能为空")
@PathVariable Long showId) { @PathVariable Long showId) {

View File

@ -10,6 +10,7 @@ import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.dromara.common.core.constant.TenantConstants; import org.dromara.common.core.constant.TenantConstants;
import org.dromara.common.core.domain.R; import org.dromara.common.core.domain.R;
import org.dromara.common.core.utils.regex.RegexValidator;
import org.dromara.common.core.validate.AddGroup; import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup; import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.encrypt.annotation.ApiEncrypt; import org.dromara.common.encrypt.annotation.ApiEncrypt;
@ -91,6 +92,10 @@ public class SysTenantController extends BaseController {
if (!tenantService.checkCompanyNameUnique(bo)) { if (!tenantService.checkCompanyNameUnique(bo)) {
return R.fail("新增租户'" + bo.getCompanyName() + "'失败,企业名称已存在"); return R.fail("新增租户'" + bo.getCompanyName() + "'失败,企业名称已存在");
} }
String password = bo.getPassword();
if (!RegexValidator.isPassword(password)) {
return R.fail("密码复杂度不合规");
}
return toAjax(TenantHelper.ignore(() -> tenantService.insertByBo(bo))); return toAjax(TenantHelper.ignore(() -> tenantService.insertByBo(bo)));
} }

View File

@ -13,6 +13,7 @@ import org.dromara.common.core.domain.R;
import org.dromara.common.core.domain.model.LoginUser; import org.dromara.common.core.domain.model.LoginUser;
import org.dromara.common.core.utils.StreamUtils; import org.dromara.common.core.utils.StreamUtils;
import org.dromara.common.core.utils.StringUtils; import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.core.utils.regex.RegexValidator;
import org.dromara.common.encrypt.annotation.ApiEncrypt; import org.dromara.common.encrypt.annotation.ApiEncrypt;
import org.dromara.common.excel.core.ExcelResult; import org.dromara.common.excel.core.ExcelResult;
import org.dromara.common.excel.utils.ExcelUtil; import org.dromara.common.excel.utils.ExcelUtil;
@ -157,19 +158,22 @@ public class SysUserController extends BaseController {
@PostMapping @PostMapping
public R<Void> add(@Validated @RequestBody SysUserBo user) { public R<Void> add(@Validated @RequestBody SysUserBo user) {
deptService.checkDeptDataScope(user.getDeptId()); deptService.checkDeptDataScope(user.getDeptId());
String password = user.getPassword();
if (!userService.checkUserNameUnique(user)) { if (!userService.checkUserNameUnique(user)) {
return R.fail("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); return R.fail("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
} else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { } else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
return R.fail("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); return R.fail("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) { } else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
return R.fail("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); return R.fail("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
} else if (!RegexValidator.isPassword(password)) {
return R.fail("新增用户'" + user.getUserName() + "'失败,密码复杂度不合规");
} }
if (TenantHelper.isEnable()) { if (TenantHelper.isEnable()) {
if (!tenantService.checkAccountBalance(TenantHelper.getTenantId())) { if (!tenantService.checkAccountBalance(TenantHelper.getTenantId())) {
return R.fail("当前租户下用户名额不足,请联系管理员"); return R.fail("当前租户下用户名额不足,请联系管理员");
} }
} }
user.setPassword(BCrypt.hashpw(user.getPassword())); user.setPassword(BCrypt.hashpw(password));
return toAjax(userService.insertUser(user)); return toAjax(userService.insertUser(user));
} }
@ -231,7 +235,11 @@ public class SysUserController extends BaseController {
public R<Void> resetPwd(@RequestBody SysUserBo user) { public R<Void> resetPwd(@RequestBody SysUserBo user) {
userService.checkUserAllowed(user.getUserId()); userService.checkUserAllowed(user.getUserId());
userService.checkUserDataScope(user.getUserId()); userService.checkUserDataScope(user.getUserId());
user.setPassword(BCrypt.hashpw(user.getPassword())); String password = user.getPassword();
if (!RegexValidator.isPassword(password)) {
return R.fail("密码复杂度不合规");
}
user.setPassword(BCrypt.hashpw(password));
return toAjax(userService.resetUserPwd(user.getUserId(), user.getPassword())); return toAjax(userService.resetUserPwd(user.getUserId(), user.getPassword()));
} }

View File

@ -28,7 +28,7 @@ public interface SysOssResourceMapper extends BaseMapperPlus<SysOssResource, Sys
@DataColumn(key = "userName", value = "r.create_by") @DataColumn(key = "userName", value = "r.create_by")
}) })
Page<SysOssResourceVo> selectPageAwaitList(@Param("page") Page<SysOssTextbook> page, Page<SysOssResourceVo> selectPageAwaitList(@Param("page") Page<SysOssTextbook> page,
@Param(Constants.WRAPPER) Wrapper<SysOssTextbook> queryWrapper); @Param(Constants.WRAPPER) Wrapper<SysOssResource> queryWrapper);
int addDownloadNum(Long id); int addDownloadNum(Long id);
int addPreviewNum(Long id); int addPreviewNum(Long id);

View File

@ -68,8 +68,10 @@ public interface ISysOssPersonService {
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
Boolean copyByBo(SysOssPersonBo bo); Boolean copyByBo(SysOssPersonBo bo);
Boolean moveByBo(SysOssPersonBo bo); Boolean moveByBo(SysOssPersonBo bo);
void download(Long id,HttpServletResponse response) throws Exception; void download(Long id, HttpServletResponse response) throws Exception;
String preview(Long id); String preview(Long id);
} }

View File

@ -44,6 +44,13 @@ public interface ISysOssResourceService {
*/ */
TableDataInfo<SysOssResourceVo> queryAwaitPageList(SysOssResourceBo bo, PageQuery pageQuery); TableDataInfo<SysOssResourceVo> queryAwaitPageList(SysOssResourceBo bo, PageQuery pageQuery);
/**
* 待审核数量
*
* @param bo 查询条件
*/
Long countAwaitList(SysOssResourceBo bo);
/** /**
* 查询符合条件的请填写功能名称列表 * 查询符合条件的请填写功能名称列表
* *

View File

@ -44,6 +44,13 @@ public interface ISysOssTextbookService {
*/ */
TableDataInfo<SysOssTextbookVo> queryAwaitPageList(SysOssTextbookBo bo, PageQuery pageQuery); TableDataInfo<SysOssTextbookVo> queryAwaitPageList(SysOssTextbookBo bo, PageQuery pageQuery);
/**
* 待审核数量
*
* @param bo 查询条件
*/
Long countAwaitList(SysOssTextbookBo bo);
/** /**
* 查询符合条件的请填写功能名称列表 * 查询符合条件的请填写功能名称列表
* *
@ -78,10 +85,13 @@ public interface ISysOssTextbookService {
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
Boolean reviewByBo(SysOssTextbookBo bo); Boolean reviewByBo(SysOssTextbookBo bo);
Boolean copyByBo(SysOssTextbookBo bo); Boolean copyByBo(SysOssTextbookBo bo);
Boolean moveByBo(SysOssTextbookBo bo); Boolean moveByBo(SysOssTextbookBo bo);
void download(Long id, HttpServletResponse response) throws Exception; void download(Long id, HttpServletResponse response) throws Exception;
String preview(Long id); String preview(Long id);
} }

View File

@ -206,14 +206,14 @@ public class SysOssPersonServiceImpl implements ISysOssPersonService {
} }
@Override @Override
public void download(Long id, HttpServletResponse response) throws Exception{ public void download(Long id, HttpServletResponse response) throws Exception {
SysOssPerson ossPerson = baseMapper.selectById(id); SysOssPerson ossPerson = baseMapper.selectById(id);
String fileName = ossPerson.getFileName(); String fileName = ossPerson.getFileName();
ossService.download(ossPerson.getOssId(), fileName, response); ossService.download(ossPerson.getOssId(), fileName, response);
} }
@Override @Override
public String preview(Long id){ public String preview(Long id) {
SysOssPerson ossPerson = baseMapper.selectById(id); SysOssPerson ossPerson = baseMapper.selectById(id);
return ossService.getUrlById(ossPerson.getOssId()); return ossService.getUrlById(ossPerson.getOssId());
} }

View File

@ -17,7 +17,6 @@ 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.system.domain.SysCatalogResource; import org.dromara.system.domain.SysCatalogResource;
import org.dromara.system.domain.SysOssResource; import org.dromara.system.domain.SysOssResource;
import org.dromara.system.domain.SysOssTextbook;
import org.dromara.system.domain.bo.SysOssResourceBo; import org.dromara.system.domain.bo.SysOssResourceBo;
import org.dromara.system.domain.vo.SysCatalogResourceVo; import org.dromara.system.domain.vo.SysCatalogResourceVo;
import org.dromara.system.domain.vo.SysOssResourceVo; import org.dromara.system.domain.vo.SysOssResourceVo;
@ -74,7 +73,7 @@ public class SysOssResourceServiceImpl implements ISysOssResourceService {
@Override @Override
public TableDataInfo<SysOssResourceVo> queryAwaitPageList(SysOssResourceBo bo, PageQuery pageQuery) { public TableDataInfo<SysOssResourceVo> queryAwaitPageList(SysOssResourceBo bo, PageQuery pageQuery) {
QueryWrapper<SysOssTextbook> wrapper = Wrappers.query(); QueryWrapper<SysOssResource> wrapper = Wrappers.query();
wrapper.le("r.status", 0) wrapper.le("r.status", 0)
.eq(StringUtils.isNotEmpty(bo.getFileSuffix()), "r.file_suffix", bo.getFileSuffix()) .eq(StringUtils.isNotEmpty(bo.getFileSuffix()), "r.file_suffix", bo.getFileSuffix())
.like(StringUtils.isNotEmpty(bo.getFileName()), "r.file_name", bo.getFileName()) .like(StringUtils.isNotEmpty(bo.getFileName()), "r.file_name", bo.getFileName())
@ -83,6 +82,16 @@ public class SysOssResourceServiceImpl implements ISysOssResourceService {
return TableDataInfo.build(result); return TableDataInfo.build(result);
} }
@Override
public Long countAwaitList(SysOssResourceBo bo) {
QueryWrapper<SysOssResource> wrapper = Wrappers.query();
wrapper.eq("r.status", -1)
.eq(StringUtils.isNotEmpty(bo.getFileSuffix()), "r.file_suffix", bo.getFileSuffix())
.like(StringUtils.isNotEmpty(bo.getFileName()), "r.file_name", bo.getFileName());
return baseMapper.selectCount(wrapper);
}
/** /**
* 查询符合条件的请填写功能名称列表 * 查询符合条件的请填写功能名称列表
* *
@ -202,7 +211,7 @@ public class SysOssResourceServiceImpl implements ISysOssResourceService {
if (isValid) { if (isValid) {
//TODO 做一些业务上的校验,判断是否需要校验 //TODO 做一些业务上的校验,判断是否需要校验
} }
for(Long id :ids){ for (Long id : ids) {
SysOssResourceVo ossResourceVo = baseMapper.selectVoById(id); SysOssResourceVo ossResourceVo = baseMapper.selectVoById(id);
SysOssVo ossVo = ossService.getById(ossResourceVo.getOssId()); SysOssVo ossVo = ossService.getById(ossResourceVo.getOssId());
ossService.decrease(1, ossVo.getSize()); ossService.decrease(1, ossVo.getSize());
@ -233,7 +242,7 @@ public class SysOssResourceServiceImpl implements ISysOssResourceService {
baseMapper.insert(move); baseMapper.insert(move);
validEntityBeforeSave(move); validEntityBeforeSave(move);
int i = baseMapper.deleteById(bo.getId()); int i = baseMapper.deleteById(bo.getId());
return i>0; return i > 0;
} }
private SysOssResource processDate(SysOssResourceBo bo) { private SysOssResource processDate(SysOssResourceBo bo) {
@ -253,7 +262,7 @@ public class SysOssResourceServiceImpl implements ISysOssResourceService {
} }
@Override @Override
public void download(Long id, HttpServletResponse response)throws Exception { public void download(Long id, HttpServletResponse response) throws Exception {
SysOssResource ossResource = baseMapper.selectById(id); SysOssResource ossResource = baseMapper.selectById(id);
String fileName = ossResource.getFileName(); String fileName = ossResource.getFileName();
ossService.download(ossResource.getOssId(), fileName, response); ossService.download(ossResource.getOssId(), fileName, response);

View File

@ -2,7 +2,6 @@ package org.dromara.system.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
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.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -10,12 +9,9 @@ import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.dromara.common.core.exception.ServiceException; import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StreamUtils;
import org.dromara.common.core.utils.StringUtils; import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.PageQuery; 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.system.domain.SysCatalogTextbook;
import org.dromara.system.domain.SysOssTextbook; import org.dromara.system.domain.SysOssTextbook;
import org.dromara.system.domain.bo.SysOssTextbookBo; import org.dromara.system.domain.bo.SysOssTextbookBo;
import org.dromara.system.domain.vo.SysCatalogTextbookVo; import org.dromara.system.domain.vo.SysCatalogTextbookVo;
@ -79,19 +75,28 @@ public class SysOssTextbookServiceImpl implements ISysOssTextbookService {
wrapper.le("ot.status", 0) wrapper.le("ot.status", 0)
.eq(StringUtils.isNotEmpty(bo.getFileSuffix()), "ot.file_suffix", bo.getFileSuffix()) .eq(StringUtils.isNotEmpty(bo.getFileSuffix()), "ot.file_suffix", bo.getFileSuffix())
.like(StringUtils.isNotEmpty(bo.getFileName()), "ot.file_name", bo.getFileName()) .like(StringUtils.isNotEmpty(bo.getFileName()), "ot.file_name", bo.getFileName())
.and(ObjectUtil.isNotNull(bo.getCatalogId()), w -> { // .and(ObjectUtil.isNotNull(bo.getCatalogId()), w -> {
List<SysCatalogTextbook> list = catalogService.selectList(new LambdaQueryWrapper<SysCatalogTextbook>() // List<SysCatalogTextbook> list = catalogService.selectList(new LambdaQueryWrapper<SysCatalogTextbook>()
.select(SysCatalogTextbook::getCatalogId) // .select(SysCatalogTextbook::getCatalogId)
.apply(DataBaseHelper.findInSet(bo.getCatalogId(), "ancestors"))); // .apply(DataBaseHelper.findInSet(bo.getCatalogId(), "ancestors")));
List<Long> ids = StreamUtils.toList(list, SysCatalogTextbook::getCatalogId); // List<Long> ids = StreamUtils.toList(list, SysCatalogTextbook::getCatalogId);
ids.add(bo.getCatalogId()); // ids.add(bo.getCatalogId());
w.in("ot.catalog_id", ids); // w.in("ot.catalog_id", ids);
}) // })
.orderByDesc("ot.create_time"); .orderByDesc("ot.create_time");
Page<SysOssTextbookVo> result = baseMapper.selectPageAwaitList(pageQuery.build(), wrapper); Page<SysOssTextbookVo> result = baseMapper.selectPageAwaitList(pageQuery.build(), wrapper);
return TableDataInfo.build(result); return TableDataInfo.build(result);
} }
@Override
public Long countAwaitList(SysOssTextbookBo bo) {
QueryWrapper<SysOssTextbook> wrapper = Wrappers.query();
wrapper.eq("ot.status", -1)
.eq(StringUtils.isNotEmpty(bo.getFileSuffix()), "ot.file_suffix", bo.getFileSuffix())
.like(StringUtils.isNotEmpty(bo.getFileName()), "ot.file_name", bo.getFileName());
return baseMapper.selectCount(wrapper);
}
/** /**
* 查询符合条件的请填写功能名称列表 * 查询符合条件的请填写功能名称列表
@ -272,7 +277,7 @@ public class SysOssTextbookServiceImpl implements ISysOssTextbookService {
} }
@Override @Override
public String preview(Long id){ public String preview(Long id) {
SysOssTextbook ossTextbook = baseMapper.selectById(id); SysOssTextbook ossTextbook = baseMapper.selectById(id);
baseMapper.addPreviewNum(id); baseMapper.addPreviewNum(id);
return ossService.getUrlById(ossTextbook.getOssId()); return ossService.getUrlById(ossTextbook.getOssId());