|
@@ -15,6 +15,7 @@ import com.fjhx.xmhjc.service.column.ColumnArticleService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fjhx.xmhjc.service.column.ColumnMenuService;
|
|
|
import com.fjhx.xmhjc.service.column.ColumnMenuSubService;
|
|
|
+import com.fjhx.xmhjc.service.home.HomeSettingService;
|
|
|
import com.ruoyi.common.utils.wrapper.SqlField;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -43,6 +44,8 @@ public class ColumnArticleServiceImpl extends ServiceImpl<ColumnArticleMapper, C
|
|
|
private ColumnMenuService columnMenuService;
|
|
|
@Resource
|
|
|
private ColumnMenuSubService columnMenuSubService;
|
|
|
+ @Resource
|
|
|
+ private HomeSettingService homeSettingService;
|
|
|
|
|
|
@Override
|
|
|
public List<ColumnArticleVo> getList(ColumnArticleSelectDto dto) {
|
|
@@ -112,6 +115,12 @@ public class ColumnArticleServiceImpl extends ServiceImpl<ColumnArticleMapper, C
|
|
|
|
|
|
@Override
|
|
|
public void edit(ColumnArticleDto columnArticleDto) {
|
|
|
+ if (columnArticleDto.getStatus().equals("0")){
|
|
|
+ //判断文章是否被引用
|
|
|
+ homeSettingService.checkDelete(columnArticleDto.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
this.updateById(columnArticleDto);
|
|
|
|
|
|
// 封面
|
|
@@ -121,6 +130,7 @@ public class ColumnArticleServiceImpl extends ServiceImpl<ColumnArticleMapper, C
|
|
|
|
|
|
@Override
|
|
|
public void delete(Long id) {
|
|
|
+ homeSettingService.checkDelete(id);
|
|
|
this.removeById(id);
|
|
|
}
|
|
|
|
|
@@ -150,9 +160,34 @@ public class ColumnArticleServiceImpl extends ServiceImpl<ColumnArticleMapper, C
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public List<ColumnArticleVo> getArticle(ColumnArticleSelectDto dto) {
|
|
|
+ List<ColumnArticleVo> list = getList(dto);
|
|
|
+
|
|
|
+ list.forEach(x->{
|
|
|
+ //获取封面图片
|
|
|
+ List<Long> businessIdList = new ArrayList<>();
|
|
|
+ businessIdList.add(x.getId());
|
|
|
+ Map<Long, List<FileInfoVo>> fileMap = ObsFileUtil.getFileMap(businessIdList, 1);
|
|
|
+ x.setCoverList(fileMap.get(x.getId()));
|
|
|
+ });
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public ColumnArticleVo getArticleDetailByOpen(Long id) {
|
|
|
ColumnArticle ColumnArticle = this.getById(id);
|
|
|
ColumnArticleVo result = BeanUtil.toBean(ColumnArticle, ColumnArticleVo.class);
|
|
|
+
|
|
|
+ Map<Long, String> map = columnMenuService.getList(new ColumnMenuSelectDto()).stream().collect(Collectors.toMap(ColumnMenuVo::getId, ColumnMenuVo::getName));
|
|
|
+ Map<Long, String> map1 = columnMenuSubService.getList(new ColumnMenuSubSelectDto()).stream().collect(Collectors.toMap(ColumnMenuSubVo::getId, ColumnMenuSubVo::getName));
|
|
|
+ result.setColumnIdName(map.getOrDefault(result.getColumnId(),""));
|
|
|
+ result.setSubIdName(map1.getOrDefault(result.getSubId(),""));
|
|
|
+
|
|
|
+ //获取视频
|
|
|
+ List<Long> businessIdList = new ArrayList<>();
|
|
|
+ businessIdList.add(result.getId());
|
|
|
+ Map<Long, List<FileInfoVo>> fileMap = ObsFileUtil.getFileMap(businessIdList, 2);
|
|
|
+ result.setVideoList(fileMap.get(result.getId()));
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -181,6 +216,13 @@ public class ColumnArticleServiceImpl extends ServiceImpl<ColumnArticleMapper, C
|
|
|
}
|
|
|
wrapper.orderByDesc("ca", ColumnArticle::getReadNum);
|
|
|
Page<ColumnArticleVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
+ page.getRecords().forEach(x->{
|
|
|
+ //获取封面图片
|
|
|
+ List<Long> businessIdList = new ArrayList<>();
|
|
|
+ businessIdList.add(x.getId());
|
|
|
+ Map<Long, List<FileInfoVo>> fileMap = ObsFileUtil.getFileMap(businessIdList, 1);
|
|
|
+ x.setCoverList(fileMap.get(x.getId()));
|
|
|
+ });
|
|
|
return page;
|
|
|
}
|
|
|
}
|