|
|
|
@ -16,6 +16,7 @@ |
|
|
|
*/ |
|
|
|
|
|
|
|
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; |
|
|
|
@ -61,10 +62,10 @@ import java.util.*; |
|
|
|
@Service |
|
|
|
public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntity> implements ArticleService { |
|
|
|
private final Log logger = LogFactory.getLog(getClass()); |
|
|
|
@Autowired |
|
|
|
private ArticleRedis articleRedis; |
|
|
|
@Autowired |
|
|
|
private GovOrgSelfFeignClient govOrgSelfFeignClient; |
|
|
|
@Autowired |
|
|
|
private ArticleRedis articleRedis; |
|
|
|
@Autowired |
|
|
|
private GovOrgSelfFeignClient govOrgSelfFeignClient; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@ -126,17 +127,17 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param tokenDTO |
|
|
|
* @return |
|
|
|
* @Author sun |
|
|
|
* @Description 党建声音-政府端-可选发布范围 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public ArticleGridResultDTO agencyGridList(TokenDto tokenDTO) { |
|
|
|
Result<ArticleGridResultDTO> result = govOrgSelfFeignClient.getAgencyGridList(tokenDTO.getUserId()); |
|
|
|
return result.getData(); |
|
|
|
} |
|
|
|
/** |
|
|
|
* @param tokenDTO |
|
|
|
* @return |
|
|
|
* @Author sun |
|
|
|
* @Description 党建声音-政府端-可选发布范围 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public ArticleGridResultDTO agencyGridList(TokenDto tokenDTO) { |
|
|
|
Result<ArticleGridResultDTO> result = govOrgSelfFeignClient.getAgencyGridList(tokenDTO.getUserId()); |
|
|
|
return result.getData(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@ -181,7 +182,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
|
|
|
|
String draftId = draftEntity.getId(); |
|
|
|
fromDTO.setDraftId(draftId); |
|
|
|
draftContentList = buildDraftContent(tokenDto,fromDTO); |
|
|
|
draftContentList = buildDraftContent(tokenDto, fromDTO); |
|
|
|
if (CollectionUtils.isEmpty(draftContentList)) { |
|
|
|
logger.warn("saveOrUpdateContent contentList is empty"); |
|
|
|
throw new RenException("参数错误"); |
|
|
|
@ -199,30 +200,25 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
/** |
|
|
|
* desc:构建 内容对象 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param tokenDto |
|
|
|
* @param fromDTO |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private List<DraftContentEntity> buildDraftContent(TokenDto tokenDto, DraftContentFromDTO fromDTO) { |
|
|
|
//如果已发布 则需要校验内容是否更改过 没有更改则 不对审核状态进行重置
|
|
|
|
List<DraftContentEntity> newContentList = new ArrayList<>(); |
|
|
|
|
|
|
|
List<DraftContentFromDTO.DraftContentDTO> contentList = fromDTO.getContentList(); |
|
|
|
|
|
|
|
Set<Integer> orderNumSet = new HashSet<>(); |
|
|
|
contentList.forEach(content -> { |
|
|
|
for (int i = 0; i < contentList.size(); i++) { |
|
|
|
DraftContentFromDTO.DraftContentDTO content = contentList.get(i); |
|
|
|
DraftContentEntity entity = ConvertUtils.sourceToTarget(content, DraftContentEntity.class); |
|
|
|
entity.setId(content.getDraftContentId()); |
|
|
|
entity.setCustomerId(tokenDto.getCustomerId()); |
|
|
|
entity.setDraftId(fromDTO.getDraftId()); |
|
|
|
orderNumSet.add(content.getOrderNum()); |
|
|
|
entity.setOrderNum(i + 1); |
|
|
|
newContentList.add(entity); |
|
|
|
}); |
|
|
|
if (orderNumSet.size() != newContentList.size()) { |
|
|
|
logger.warn("saveOrUpdateContent contentList orderNum is repeat"); |
|
|
|
throw new RenException("参数错误"); |
|
|
|
} |
|
|
|
|
|
|
|
return newContentList; |
|
|
|
} |
|
|
|
|
|
|
|
|