|
|
@ -18,8 +18,6 @@ |
|
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
@ -46,8 +44,8 @@ import com.epmet.entity.*; |
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
|
import com.epmet.redis.ArticleRedis; |
|
|
|
import com.epmet.service.*; |
|
|
|
import com.epmet.redis.TagRedis; |
|
|
|
import com.epmet.service.*; |
|
|
|
import com.epmet.utils.ModuleConstant; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
@ -117,58 +115,6 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
@Autowired |
|
|
|
private ArticleVisitRecordService articleVisitRecordService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<ArticleDTO> page(Map<String, Object> params) { |
|
|
|
IPage<ArticleEntity> page = baseDao.selectPage( |
|
|
|
getPage(params, FieldConstant.CREATED_TIME, false), |
|
|
|
getWrapper(params) |
|
|
|
); |
|
|
|
return getPageData(page, ArticleDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<ArticleDTO> list(Map<String, Object> params) { |
|
|
|
List<ArticleEntity> entityList = baseDao.selectList(getWrapper(params)); |
|
|
|
|
|
|
|
return ConvertUtils.sourceToTarget(entityList, ArticleDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
private QueryWrapper<ArticleEntity> getWrapper(Map<String, Object> params) { |
|
|
|
String id = (String) params.get(FieldConstant.ID_HUMP); |
|
|
|
|
|
|
|
QueryWrapper<ArticleEntity> wrapper = new QueryWrapper<>(); |
|
|
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|
|
|
|
|
|
|
return wrapper; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ArticleDTO get(String id) { |
|
|
|
ArticleEntity entity = baseDao.selectById(id); |
|
|
|
return ConvertUtils.sourceToTarget(entity, ArticleDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void save(ArticleDTO dto) { |
|
|
|
ArticleEntity entity = ConvertUtils.sourceToTarget(dto, ArticleEntity.class); |
|
|
|
insert(entity); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void update(ArticleDTO dto) { |
|
|
|
ArticleEntity entity = ConvertUtils.sourceToTarget(dto, ArticleEntity.class); |
|
|
|
updateById(entity); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void delete(String[] ids) { |
|
|
|
// 逻辑删除(@TableLogic 注解)
|
|
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param tokenDTO |
|
|
|
* @return |
|
|
@ -901,6 +847,44 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
throw new RenException(String.format(ModuleConstant.SPECIFIED_DRAFT_NOT_FOUNT_EXCEPTION_TEMPLATE,draftId)); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void scanContent(String draftId) { |
|
|
|
DraftEntity draftEntity = draftDao.selectById(draftId); |
|
|
|
if (draftEntity == null){ |
|
|
|
log.error("scanContent draftId:{} is not exist",draftId); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!DraftConstant.AUDITING.equals(draftEntity.getStatusFlag())){ |
|
|
|
log.error("scanContent draftId:{} statusFlag:{} is not support 2 modify",draftId,draftEntity.getStatusFlag()); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (!NumConstant.ONE_STR.equals(draftEntity.getDelFlag())){ |
|
|
|
log.error("scanContent draftId:{} delFlag:{} is not support 2 modify",draftId,draftEntity.getDelFlag()); |
|
|
|
return; |
|
|
|
} |
|
|
|
Map<String,String> imgMap = new HashMap<>(); |
|
|
|
Map<String,String> textMap = new HashMap<>(); |
|
|
|
DraftCoverDTO draftCoverDTO = draftCoverDao.selectCoverIdAndUrlByDraftId(draftId); |
|
|
|
if (draftCoverDTO != null){ |
|
|
|
imgMap.put(ModuleConstant.SCAN_COVER_PREFIX.concat(draftCoverDTO.getId()), draftCoverDTO.getImgUrl()); |
|
|
|
} |
|
|
|
List<DraftContentDTO> contentDTOList = draftContentDao.selectScanContentByDraftId(draftId); |
|
|
|
if(!CollectionUtils.isEmpty(contentDTOList)){ |
|
|
|
contentDTOList.forEach(content->{ |
|
|
|
String contentType = content.getContentType(); |
|
|
|
if (DraftConstant.TEXT.equals(contentType)){ |
|
|
|
//todo 内容叠加审核吧 id拼起来
|
|
|
|
textMap.put(content.getId(),content.getContent()); |
|
|
|
}else if (DraftConstant.IMG.equals(contentType)){ |
|
|
|
imgMap.put(draftCoverDTO.getId(), draftCoverDTO.getImgUrl()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
//todo 执行审核
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 更新DB的标签使用次数 |
|
|
|
* @param draftId |
|
|
|