Compare commits
2 Commits
b23367b873
...
c15d6c4468
Author | SHA1 | Date | |
---|---|---|---|
|
c15d6c4468 | ||
|
56b2a3a889 |
|
@ -44,7 +44,7 @@ import java.util.Map;
|
|||
public class SysOssController extends BaseController {
|
||||
|
||||
@Value("${file.BASE_FILE_SAVE_PATH}")
|
||||
private String filePath;
|
||||
private String uploadPath;
|
||||
|
||||
private final ISysOssService iSysOssService;
|
||||
private final ISysImageService iSysImageService;
|
||||
|
@ -65,9 +65,9 @@ public class SysOssController extends BaseController {
|
|||
*/
|
||||
@SaCheckPermission("system:oss:list")
|
||||
@GetMapping("/listByIds/{ossIds}")
|
||||
public R<List<SysOssVo>> listByIds(@NotEmpty(message = "主键不能为空")
|
||||
public R<List<String>> listByIds(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ossIds) {
|
||||
List<SysOssVo> list = iSysOssService.listByIds(Arrays.asList(ossIds));
|
||||
List<String> list = iSysOssService.listByIds(Arrays.asList(ossIds));
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class SysOssController extends BaseController {
|
|||
public R<Map<String, String>> addPartsUpload(@RequestPart("file") MultipartFile file) {
|
||||
Map<String,String> map=new HashMap<>();
|
||||
|
||||
String filePath=System.getProperty("user.dir")+"/file/upload/";
|
||||
String filePath=uploadPath+"/file/upload/";
|
||||
try {
|
||||
if (file.isEmpty()) {
|
||||
return R.warn("文件为空");
|
||||
|
|
|
@ -172,4 +172,4 @@ sms:
|
|||
sdkAppId:
|
||||
--- # 文件上传路径
|
||||
file:
|
||||
BASE_FILE_SAVE_PATH: ./image
|
||||
BASE_FILE_SAVE_PATH: /www/wwwroot/guanwang/web/image
|
||||
|
|
|
@ -129,6 +129,7 @@ security:
|
|||
- /**/*.html
|
||||
- /**/*.css
|
||||
- /**/*.js
|
||||
- /**/*.jpg
|
||||
- # 配置白名单
|
||||
- /official/slideshow/**
|
||||
# 公共路径
|
||||
|
|
|
@ -33,7 +33,7 @@ public class FileChunkFilelistController extends BaseController {
|
|||
/**
|
||||
* 查询已上传文件记录列表
|
||||
*/
|
||||
@SaCheckPermission("official:chunkFilelist:list")
|
||||
/*@SaCheckPermission("official:chunkFilelist:list")*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<FileChunkFilelistVo> list(FileChunkFilelistBo bo, PageQuery pageQuery) {
|
||||
return iFileChunkFilelistService.queryPageList(bo, pageQuery);
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.ruoyi.official.service.impl;
|
|||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
|
@ -16,6 +17,7 @@ import com.ruoyi.official.domain.vo.GwSlideshowVo;
|
|||
import com.ruoyi.official.domain.GwSlideshow;
|
||||
import com.ruoyi.official.mapper.GwSlideshowMapper;
|
||||
import com.ruoyi.official.service.IGwSlideshowService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
@ -68,6 +70,13 @@ public class GwSlideshowServiceImpl implements IGwSlideshowService {
|
|||
public TableDataInfo<GwSlideshowVo> queryPageList(GwSlideshowBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<GwSlideshow> lqw = buildQueryWrapper(bo);
|
||||
Page<GwSlideshowVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
if (CollUtil.isNotEmpty(result.getRecords())){
|
||||
List<GwSlideshowVo> records = result.getRecords();
|
||||
List<GwSlideshowVo> collect = records.stream().filter(ObjectUtil::isNotEmpty).sorted(Comparator.comparing(GwSlideshowVo::getReleaseTime).reversed()).collect(Collectors.toList());
|
||||
List<GwSlideshowVo> fist = collect.stream().filter(itx -> itx.getIsTop().equals("1")).collect(Collectors.toList());
|
||||
fist.addAll(collect.stream().filter(itx->!itx.getIsTop().equals("1")).collect(Collectors.toList()));
|
||||
result.setRecords(fist);
|
||||
}
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
|
@ -112,6 +121,7 @@ public class GwSlideshowServiceImpl implements IGwSlideshowService {
|
|||
* 修改新闻信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(GwSlideshowBo bo) {
|
||||
GwSlideshow update = BeanUtil.toBean(bo, GwSlideshow.class);
|
||||
validEntityBeforeSave(update);
|
||||
|
@ -124,15 +134,26 @@ public class GwSlideshowServiceImpl implements IGwSlideshowService {
|
|||
private void validEntityBeforeSave(GwSlideshow entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
//存在已置顶的数据不允许添加、编辑
|
||||
if (ObjectUtil.isNotEmpty(entity.getId())) {
|
||||
/* if (ObjectUtil.isNotEmpty(entity.getId())) {
|
||||
//编辑
|
||||
boolean exists = baseMapper.exists(Wrappers.<GwSlideshow>lambdaQuery().eq(GwSlideshow::getIsTop, "1"));
|
||||
if (exists && entity.getIsTop().equals("1")) throw new RuntimeException("已存在置顶的图片信息!");
|
||||
GwSlideshowVo slideshowVo = baseMapper.selectVoOne(Wrappers.<GwSlideshow>lambdaQuery().eq(GwSlideshow::getIsTop, "1"));
|
||||
if (!(ObjectUtil.equal(slideshowVo.getId(),entity.getId()))) throw new RuntimeException("已存在置顶的图片信息!");
|
||||
} else {
|
||||
//新增
|
||||
boolean exists = baseMapper.exists(Wrappers.<GwSlideshow>lambdaQuery().eq(GwSlideshow::getIsTop, "1"));
|
||||
if (exists && entity.getIsTop().equals("1")) throw new RuntimeException("已存在置顶的图片信息!");
|
||||
}
|
||||
}*/
|
||||
if (!ObjectUtil.equal(entity.getIsTop(),"1"))return;
|
||||
//存在想置顶得数据,将原来得数据修改为非置顶
|
||||
List<GwSlideshowVo> vos = baseMapper.selectVoList(Wrappers.<GwSlideshow>lambdaQuery().eq(GwSlideshow::getIsTop, "1"));
|
||||
if ( CollUtil.isEmpty(vos)) return;
|
||||
UpdateWrapper<GwSlideshow> updateWrapper = new UpdateWrapper<>();
|
||||
|
||||
vos.stream().forEach(ixt->{
|
||||
// updateWrapper.("id", list).set("is_top", "0");
|
||||
updateWrapper.eq("id",ixt.getId()).set("is_top", "0");
|
||||
baseMapper.update(BeanUtil.toBean(ixt,GwSlideshow.class),updateWrapper);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ public interface ISysOssService {
|
|||
|
||||
TableDataInfo<SysOssVo> queryPageList(SysOssBo sysOss, PageQuery pageQuery);
|
||||
|
||||
List<SysOssVo> listByIds(Collection<Long> ossIds);
|
||||
List<String> listByIds(Collection<Long> ossIds);
|
||||
|
||||
SysOssVo getById(Long ossId);
|
||||
|
||||
|
|
|
@ -17,6 +17,9 @@ import com.ruoyi.common.utils.BeanCopyUtils;
|
|||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.FileUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.official.domain.SysImage;
|
||||
import com.ruoyi.official.domain.vo.SysImageVo;
|
||||
import com.ruoyi.official.mapper.SysImageMapper;
|
||||
import com.ruoyi.oss.core.OssClient;
|
||||
import com.ruoyi.oss.entity.UploadResult;
|
||||
import com.ruoyi.oss.enumd.AccessPolicyType;
|
||||
|
@ -48,6 +51,7 @@ import java.util.stream.Collectors;
|
|||
public class SysOssServiceImpl implements ISysOssService, OssService {
|
||||
|
||||
private final SysOssMapper baseMapper;
|
||||
private final SysImageMapper sysImageMapper;
|
||||
|
||||
@Override
|
||||
public TableDataInfo<SysOssVo> queryPageList(SysOssBo bo, PageQuery pageQuery) {
|
||||
|
@ -59,14 +63,11 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<SysOssVo> listByIds(Collection<Long> ossIds) {
|
||||
public List<String> listByIds(Collection<Long> ossIds) {
|
||||
List<SysOssVo> list = new ArrayList<>();
|
||||
Optional<Long> first = ossIds.stream().findFirst();
|
||||
List<SysOssVo> sysOssVos = baseMapper.selectVoList(Wrappers.<SysOss>lambdaQuery().eq(SysOss::getOssId, first.get()));
|
||||
return CollUtil.isNotEmpty(sysOssVos)?sysOssVos.stream().map(itx->{
|
||||
System.out.println(itx.getUrl()+"/"+itx.getFileName());
|
||||
return itx.setUrl(itx.getUrl()+"/"+itx.getFileName());
|
||||
}).collect(Collectors.toList()):null;
|
||||
List<SysImageVo> sysImageVos = sysImageMapper.selectVoList(Wrappers.<SysImage>lambdaQuery().eq(SysImage::getId, first.get()));
|
||||
return CollUtil.isNotEmpty(sysImageVos)?sysImageVos.stream().filter(ObjectUtil::isNotEmpty).map(SysImageVo::getUrl).collect(Collectors.toList()):null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue
Block a user