|
@ -56,7 +56,6 @@ import com.epmet.service.*; |
|
|
import com.epmet.utils.ModuleConstant; |
|
|
import com.epmet.utils.ModuleConstant; |
|
|
import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageInfo; |
|
|
import com.github.pagehelper.PageInfo; |
|
|
import com.sun.javafx.binding.StringConstant; |
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.jsoup.helper.StringUtil; |
|
|
import org.jsoup.helper.StringUtil; |
|
@ -68,7 +67,6 @@ import org.springframework.transaction.annotation.Propagation; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.util.CollectionUtils; |
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
|
import javax.swing.text.StringContent; |
|
|
|
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.concurrent.atomic.AtomicBoolean; |
|
|
import java.util.concurrent.atomic.AtomicBoolean; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
@ -136,8 +134,8 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
private static final String GRID = "grid"; |
|
|
private static final String GRID = "grid"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private ArticleVisitRecordService articleVisitRecordService; |
|
|
private ArticleVisitRecordService articleVisitRecordService; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @param tokenDTO |
|
|
* @param tokenDTO |
|
@ -148,26 +146,26 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
@Override |
|
|
@Override |
|
|
public ArticleGridResultDTO agencyGridList(TokenDto tokenDTO) { |
|
|
public ArticleGridResultDTO agencyGridList(TokenDto tokenDTO) { |
|
|
Result<ArticleGridResultDTO> result = govOrgOpenFeignClient.getAgencyGridList(tokenDTO.getUserId()); |
|
|
Result<ArticleGridResultDTO> result = govOrgOpenFeignClient.getAgencyGridList(tokenDTO.getUserId()); |
|
|
if(!result.success()){ |
|
|
if (!result.success()) { |
|
|
throw new RenException(result.getInternalMsg()); |
|
|
throw new RenException(result.getInternalMsg()); |
|
|
} |
|
|
} |
|
|
return result.getData(); |
|
|
return result.getData(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @param tokenDTO |
|
|
* @param tokenDTO |
|
|
* @return |
|
|
* @return |
|
|
* @Author sun |
|
|
* @Author sun |
|
|
* @Description 党建声音-政府端-可选发布单位 |
|
|
* @Description 党建声音-政府端-可选发布单位 |
|
|
**/ |
|
|
**/ |
|
|
@Override |
|
|
@Override |
|
|
public PublishAgencyListResultDTO publishAgencyList(TokenDto tokenDTO) { |
|
|
public PublishAgencyListResultDTO publishAgencyList(TokenDto tokenDTO) { |
|
|
Result<PublishAgencyListResultDTO> result = govOrgOpenFeignClient.getPublishAgencyList(tokenDTO.getUserId()); |
|
|
Result<PublishAgencyListResultDTO> result = govOrgOpenFeignClient.getPublishAgencyList(tokenDTO.getUserId()); |
|
|
if(!result.success()){ |
|
|
if (!result.success()) { |
|
|
throw new RenException(result.getInternalMsg()); |
|
|
throw new RenException(result.getInternalMsg()); |
|
|
} |
|
|
} |
|
|
return result.getData(); |
|
|
return result.getData(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
@ -222,10 +220,10 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void buildPreviewContent(DraftContentFromDTO fromDTO, DraftEntity draftEntity) { |
|
|
private void buildPreviewContent(DraftContentFromDTO fromDTO, DraftEntity draftEntity) { |
|
|
if (CollectionUtils.isEmpty(fromDTO.getContentList())){ |
|
|
if (CollectionUtils.isEmpty(fromDTO.getContentList())) { |
|
|
draftEntity.setPreviewContent(""); |
|
|
draftEntity.setPreviewContent(""); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
String content = ""; |
|
|
String content = ""; |
|
|
for (int i = 0; i < fromDTO.getContentList().size(); i++) { |
|
|
for (int i = 0; i < fromDTO.getContentList().size(); i++) { |
|
|
if (DraftConstant.TEXT.equals(fromDTO.getContentList().get(i).getContentType())) { |
|
|
if (DraftConstant.TEXT.equals(fromDTO.getContentList().get(i).getContentType())) { |
|
@ -244,22 +242,22 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
GovArticleDetailResultDTO articleDetail = baseDao.queryGovArticleDetail(articleId); |
|
|
GovArticleDetailResultDTO articleDetail = baseDao.queryGovArticleDetail(articleId); |
|
|
if (null != articleDetail) { |
|
|
if (null != articleDetail) { |
|
|
List<GovArticleContentDTO> articleContentList = baseDao.queryGovArticleContent(articleId); |
|
|
List<GovArticleContentDTO> articleContentList = baseDao.queryGovArticleContent(articleId); |
|
|
if(null!=articleContentList&&articleContentList.size()>0){ |
|
|
if (null != articleContentList && articleContentList.size() > 0) { |
|
|
articleDetail.setArticleContentList(articleContentList); |
|
|
articleDetail.setArticleContentList(articleContentList); |
|
|
}else{ |
|
|
} else { |
|
|
articleDetail.setArticleContentList(new ArrayList<>()); |
|
|
articleDetail.setArticleContentList(new ArrayList<>()); |
|
|
} |
|
|
} |
|
|
if (StringUtils.isNoneBlank(articleDetail.getTags())) { |
|
|
if (StringUtils.isNoneBlank(articleDetail.getTags())) { |
|
|
String[] tagNames = articleDetail.getTags().split("\\|"); |
|
|
String[] tagNames = articleDetail.getTags().split("\\|"); |
|
|
articleDetail.setTagNameList(tagNames); |
|
|
articleDetail.setTagNameList(tagNames); |
|
|
}else{ |
|
|
} else { |
|
|
articleDetail.setTagNameList(new String[0]); |
|
|
articleDetail.setTagNameList(new String[0]); |
|
|
} |
|
|
} |
|
|
ArticleEntity articleEntity=this.baseDao.selectById(articleId); |
|
|
ArticleEntity articleEntity = this.baseDao.selectById(articleId); |
|
|
log.info(String.format("当前文章id%s,发布人id%s,当前用户id%s", articleId, articleEntity.getCreatedBy(), loginUserUtil.getLoginUserId())); |
|
|
log.info(String.format("当前文章id%s,发布人id%s,当前用户id%s", articleId, articleEntity.getCreatedBy(), loginUserUtil.getLoginUserId())); |
|
|
if(articleEntity.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ |
|
|
if (articleEntity.getCreatedBy().equals(loginUserUtil.getLoginUserId())) { |
|
|
articleDetail.setIsMePublished(true); |
|
|
articleDetail.setIsMePublished(true); |
|
|
}else{ |
|
|
} else { |
|
|
articleDetail.setIsMePublished(false); |
|
|
articleDetail.setIsMePublished(false); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -268,7 +266,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Boolean saveDraftAttr(TokenDto tokenDto, DraftAttrFromDTO fromDTO) { |
|
|
public Boolean saveDraftAttr(TokenDto tokenDto, DraftAttrFromDTO fromDTO) { |
|
|
log.debug("saveDraftAttr param:{}",JSON.toJSONString(fromDTO)); |
|
|
log.debug("saveDraftAttr param:{}", JSON.toJSONString(fromDTO)); |
|
|
|
|
|
|
|
|
DraftEntity draftEntity = checkDraftStatus(fromDTO.getDraftId()); |
|
|
DraftEntity draftEntity = checkDraftStatus(fromDTO.getDraftId()); |
|
|
|
|
|
|
|
@ -288,18 +286,18 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
draftEntity.setPublisherType(fromDTO.getPublisherType()); |
|
|
draftEntity.setPublisherType(fromDTO.getPublisherType()); |
|
|
|
|
|
|
|
|
//TODO ? 如果为机关 不设置?
|
|
|
//TODO ? 如果为机关 不设置?
|
|
|
if(DraftConstant.GRID.equals(fromDTO.getPublisherType())) { |
|
|
if (DraftConstant.GRID.equals(fromDTO.getPublisherType())) { |
|
|
draftEntity.setGridId(fromDTO.getPublisher()); |
|
|
draftEntity.setGridId(fromDTO.getPublisher()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(fromDTO.getPublishDate())){ |
|
|
if (StringUtils.isNotBlank(fromDTO.getPublishDate())) { |
|
|
draftEntity.setPublishDate(DateUtils.stringToDate(fromDTO.getPublishDate(),DateUtils.DATE_PATTERN)); |
|
|
draftEntity.setPublishDate(DateUtils.stringToDate(fromDTO.getPublishDate(), DateUtils.DATE_PATTERN)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//封面
|
|
|
//封面
|
|
|
DraftCoverEntity coverEntity = buildCoverEntity(tokenDto, fromDTO); |
|
|
DraftCoverEntity coverEntity = buildCoverEntity(tokenDto, fromDTO); |
|
|
//发布范围
|
|
|
//发布范围
|
|
|
List<DraftPublishRangeEntity> publishRangeEntityList = buildDraftPublishRange(draftEntity,tokenDto, fromDTO); |
|
|
List<DraftPublishRangeEntity> publishRangeEntityList = buildDraftPublishRange(draftEntity, tokenDto, fromDTO); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
executeSaveDraftAttr(draftEntity, coverEntity, publishRangeEntityList); |
|
|
executeSaveDraftAttr(draftEntity, coverEntity, publishRangeEntityList); |
|
@ -309,16 +307,16 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
private DraftEntity checkDraftStatus(String draftId) { |
|
|
private DraftEntity checkDraftStatus(String draftId) { |
|
|
DraftEntity draftEntity = draftDao.selectById(draftId); |
|
|
DraftEntity draftEntity = draftDao.selectById(draftId); |
|
|
if (draftEntity == null) { |
|
|
if (draftEntity == null) { |
|
|
log.warn("saveDraftAttr draftId:{} is not exist in db",draftId); |
|
|
log.warn("saveDraftAttr draftId:{} is not exist in db", draftId); |
|
|
throw new RenException(ModuleConstant.DRAFT_ID_IS_NOT_EXIST); |
|
|
throw new RenException(ModuleConstant.DRAFT_ID_IS_NOT_EXIST); |
|
|
} |
|
|
} |
|
|
if (NumConstant.ONE_STR.equals(draftEntity.getDelFlag())) { |
|
|
if (NumConstant.ONE_STR.equals(draftEntity.getDelFlag())) { |
|
|
log.warn("saveDraftAttr draftId:{} have deleted",draftId); |
|
|
log.warn("saveDraftAttr draftId:{} have deleted", draftId); |
|
|
throw new RenException(ModuleConstant.DRAFT_STATUS_IS_DEL); |
|
|
throw new RenException(ModuleConstant.DRAFT_STATUS_IS_DEL); |
|
|
} |
|
|
} |
|
|
//只有未发布的和审核失败的才能修改
|
|
|
//只有未发布的和审核失败的才能修改
|
|
|
if (DraftConstant.AUDITING.equals(draftEntity.getStatusFlag()) || DraftConstant.PUBLISHED.equals(draftEntity.getStatusFlag())) { |
|
|
if (DraftConstant.AUDITING.equals(draftEntity.getStatusFlag()) || DraftConstant.PUBLISHED.equals(draftEntity.getStatusFlag())) { |
|
|
log.warn("saveDraftAttr draftId:{} publishStatus have published",draftId); |
|
|
log.warn("saveDraftAttr draftId:{} publishStatus have published", draftId); |
|
|
throw new RenException(ModuleConstant.DRAFT_STATUS_IS_NOT_ALLOW_MODIFY); |
|
|
throw new RenException(ModuleConstant.DRAFT_STATUS_IS_NOT_ALLOW_MODIFY); |
|
|
} |
|
|
} |
|
|
return draftEntity; |
|
|
return draftEntity; |
|
@ -339,8 +337,8 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
throw new RenException(ModuleConstant.DRAFT_IS_TOP_ERROR); |
|
|
throw new RenException(ModuleConstant.DRAFT_IS_TOP_ERROR); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ( fromDTO.getPublisherType() != DraftConstant.AGENCY && fromDTO.getPublisherType() != DraftConstant.DEPARTMENT |
|
|
if (fromDTO.getPublisherType() != DraftConstant.AGENCY && fromDTO.getPublisherType() != DraftConstant.DEPARTMENT |
|
|
&&fromDTO.getPublisherType() != DraftConstant.GRID) { |
|
|
&& fromDTO.getPublisherType() != DraftConstant.GRID) { |
|
|
throw new RenException(ModuleConstant.DRAFT_PUBLISHER_TYPE_ERROR); |
|
|
throw new RenException(ModuleConstant.DRAFT_PUBLISHER_TYPE_ERROR); |
|
|
} |
|
|
} |
|
|
return saveDraftAttr(tokenDto, fromDTO); |
|
|
return saveDraftAttr(tokenDto, fromDTO); |
|
@ -348,7 +346,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Boolean publish(TokenDto tokenDto, String draftId) { |
|
|
public Boolean publish(TokenDto tokenDto, String draftId) { |
|
|
if (StringUtils.isBlank(draftId)){ |
|
|
if (StringUtils.isBlank(draftId)) { |
|
|
log.warn("publish param error draftId is blank"); |
|
|
log.warn("publish param error draftId is blank"); |
|
|
throw new RenException(ModuleConstant.DRAFT_ID_IS_NULL); |
|
|
throw new RenException(ModuleConstant.DRAFT_ID_IS_NULL); |
|
|
} |
|
|
} |
|
@ -360,24 +358,24 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void executeSaveDraftAttr(DraftEntity draftEntity, DraftCoverEntity coverEntity, List<DraftPublishRangeEntity> publishRangeEntityList) { |
|
|
public void executeSaveDraftAttr(DraftEntity draftEntity, DraftCoverEntity coverEntity, List<DraftPublishRangeEntity> publishRangeEntityList) { |
|
|
Map<String,Object> draftIdMap = new HashMap<>(); |
|
|
Map<String, Object> draftIdMap = new HashMap<>(); |
|
|
//物理删除
|
|
|
//物理删除
|
|
|
draftCoverDao.deleteByDraftId(draftEntity.getId()); |
|
|
draftCoverDao.deleteByDraftId(draftEntity.getId()); |
|
|
if (coverEntity != null){ |
|
|
if (coverEntity != null) { |
|
|
draftCoverDao.insert(coverEntity); |
|
|
draftCoverDao.insert(coverEntity); |
|
|
} |
|
|
} |
|
|
//物理删除
|
|
|
//物理删除
|
|
|
draftPublishRangeDao.deleteByDraftId(draftEntity.getId()); |
|
|
draftPublishRangeDao.deleteByDraftId(draftEntity.getId()); |
|
|
if (!CollectionUtils.isEmpty(publishRangeEntityList)){ |
|
|
if (!CollectionUtils.isEmpty(publishRangeEntityList)) { |
|
|
publishRangeEntityList.forEach(publishRange->draftPublishRangeDao.insert(publishRange)); |
|
|
publishRangeEntityList.forEach(publishRange -> draftPublishRangeDao.insert(publishRange)); |
|
|
} |
|
|
} |
|
|
draftDao.updateById(draftEntity); |
|
|
draftDao.updateById(draftEntity); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private List<DraftPublishRangeEntity> buildDraftPublishRange(DraftEntity draftEntity, TokenDto tokenDto, DraftAttrFromDTO fromDTO) { |
|
|
private List<DraftPublishRangeEntity> buildDraftPublishRange(DraftEntity draftEntity, TokenDto tokenDto, DraftAttrFromDTO fromDTO) { |
|
|
if (CollectionUtils.isEmpty(fromDTO.getGridIdList())){ |
|
|
if (CollectionUtils.isEmpty(fromDTO.getGridIdList())) { |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
List<DraftPublishRangeEntity> publishRangeEntityList = new ArrayList<>(); |
|
|
List<DraftPublishRangeEntity> publishRangeEntityList = new ArrayList<>(); |
|
|
List<String> agencyGridNameList = new ArrayList<>(); |
|
|
List<String> agencyGridNameList = new ArrayList<>(); |
|
|
|
|
|
|
|
@ -386,15 +384,15 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
log.warn("saveDraftAttr userId:{} have not right access publishRange", tokenDto.getUserId()); |
|
|
log.warn("saveDraftAttr userId:{} have not right access publishRange", tokenDto.getUserId()); |
|
|
throw new RenException(ModuleConstant.GET_USER_CAN_SELECT_GRID_ERROR); |
|
|
throw new RenException(ModuleConstant.GET_USER_CAN_SELECT_GRID_ERROR); |
|
|
} |
|
|
} |
|
|
buildName(tokenDto,agencyGridNameList,publishRangeEntityList, fromDTO, articleGridResultDTO); |
|
|
buildName(tokenDto, agencyGridNameList, publishRangeEntityList, fromDTO, articleGridResultDTO); |
|
|
buildAgencyGridNames(tokenDto,agencyGridNameList,publishRangeEntityList, fromDTO, articleGridResultDTO); |
|
|
buildAgencyGridNames(tokenDto, agencyGridNameList, publishRangeEntityList, fromDTO, articleGridResultDTO); |
|
|
draftEntity.setPublishRangeDesc(StringUtils.join(agencyGridNameList, StrConstant.COMMA_ZH)); |
|
|
draftEntity.setPublishRangeDesc(StringUtils.join(agencyGridNameList, StrConstant.COMMA_ZH)); |
|
|
return publishRangeEntityList; |
|
|
return publishRangeEntityList; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private DraftCoverEntity buildCoverEntity(TokenDto tokenDto, DraftAttrFromDTO fromDTO) { |
|
|
private DraftCoverEntity buildCoverEntity(TokenDto tokenDto, DraftAttrFromDTO fromDTO) { |
|
|
String coverImg = fromDTO.getCoverImg(); |
|
|
String coverImg = fromDTO.getCoverImg(); |
|
|
if (StringUtils.isBlank(coverImg)){ |
|
|
if (StringUtils.isBlank(coverImg)) { |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
DraftCoverEntity coverEntity = new DraftCoverEntity(); |
|
|
DraftCoverEntity coverEntity = new DraftCoverEntity(); |
|
@ -409,7 +407,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
|
|
|
|
|
private void buildAgencyGridNames(TokenDto tokenDto, List<String> agencyGridNameList, List<DraftPublishRangeEntity> publishRangeEntityList, DraftAttrFromDTO fromDTO, ArticleGridResultDTO articleGridResultDTO) { |
|
|
private void buildAgencyGridNames(TokenDto tokenDto, List<String> agencyGridNameList, List<DraftPublishRangeEntity> publishRangeEntityList, DraftAttrFromDTO fromDTO, ArticleGridResultDTO articleGridResultDTO) { |
|
|
articleGridResultDTO.getSubAgencyGridList().forEach(subAgencyGrid -> { |
|
|
articleGridResultDTO.getSubAgencyGridList().forEach(subAgencyGrid -> { |
|
|
buildName(tokenDto,agencyGridNameList, publishRangeEntityList,fromDTO, subAgencyGrid); |
|
|
buildName(tokenDto, agencyGridNameList, publishRangeEntityList, fromDTO, subAgencyGrid); |
|
|
}); |
|
|
}); |
|
|
if (!CollectionUtils.isEmpty(articleGridResultDTO.getSubAgencyGridList())) { |
|
|
if (!CollectionUtils.isEmpty(articleGridResultDTO.getSubAgencyGridList())) { |
|
|
articleGridResultDTO.getSubAgencyGridList().forEach(subAgencyGrid -> { |
|
|
articleGridResultDTO.getSubAgencyGridList().forEach(subAgencyGrid -> { |
|
@ -422,7 +420,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
private void buildName(TokenDto tokenDto, List<String> agencyGridNameList, List<DraftPublishRangeEntity> publishRangeEntityList, DraftAttrFromDTO fromDTO, ArticleGridResultDTO articleGridResultDTO) { |
|
|
private void buildName(TokenDto tokenDto, List<String> agencyGridNameList, List<DraftPublishRangeEntity> publishRangeEntityList, DraftAttrFromDTO fromDTO, ArticleGridResultDTO articleGridResultDTO) { |
|
|
List<String> gridIdList = fromDTO.getGridIdList(); |
|
|
List<String> gridIdList = fromDTO.getGridIdList(); |
|
|
List<AgencyGridListResultDTO> gridList = articleGridResultDTO.getGridList(); |
|
|
List<AgencyGridListResultDTO> gridList = articleGridResultDTO.getGridList(); |
|
|
if (!CollectionUtils.isEmpty(gridList)&&!CollectionUtils.isEmpty(gridIdList)) { |
|
|
if (!CollectionUtils.isEmpty(gridList) && !CollectionUtils.isEmpty(gridIdList)) { |
|
|
gridList.forEach(grid -> { |
|
|
gridList.forEach(grid -> { |
|
|
if (gridIdList.contains(grid.getGridId())) { |
|
|
if (gridIdList.contains(grid.getGridId())) { |
|
|
String agencyGridName = articleGridResultDTO.getAgencyName().concat(StrConstant.HYPHEN).concat(grid.getGridName()); |
|
|
String agencyGridName = articleGridResultDTO.getAgencyName().concat(StrConstant.HYPHEN).concat(grid.getGridName()); |
|
@ -483,14 +481,14 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void offLineArticle(OffLineArticleFormDTO formDTO) { |
|
|
public void offLineArticle(OffLineArticleFormDTO formDTO) { |
|
|
//0:查询文章表数据,判断当前操作人是否是当初发表文章的人(谁发布的文章水才能下线)
|
|
|
//0:查询文章表数据,判断当前操作人是否是当初发表文章的人(谁发布的文章水才能下线)
|
|
|
ArticleEntity articleEntity = baseDao.selectById(formDTO.getArticleId()); |
|
|
ArticleEntity articleEntity = baseDao.selectById(formDTO.getArticleId()); |
|
|
if (null == articleEntity) { |
|
|
if (null == articleEntity) { |
|
|
throw new RenException(ArticleConstant.SELECT_ARTICLE_EXCEPTION); |
|
|
throw new RenException(ArticleConstant.SELECT_ARTICLE_EXCEPTION); |
|
|
} |
|
|
} |
|
|
if(!formDTO.getStaffId().equals(articleEntity.getCreatedBy())){ |
|
|
if (!formDTO.getStaffId().equals(articleEntity.getCreatedBy())) { |
|
|
throw new RenException(ArticleConstant.SHIRO_EXCEPTION); |
|
|
throw new RenException(ArticleConstant.SHIRO_EXCEPTION); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//1:根据文章Id查询全部(已发布、已下线)发布范围数据
|
|
|
//1:根据文章Id查询全部(已发布、已下线)发布范围数据
|
|
|
ArticlePublishRangeEntity rangeEntity = new ArticlePublishRangeEntity(); |
|
|
ArticlePublishRangeEntity rangeEntity = new ArticlePublishRangeEntity(); |
|
@ -554,19 +552,19 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
recordEntity.setCustomerId(articleEntity.getCustomerId()); |
|
|
recordEntity.setCustomerId(articleEntity.getCustomerId()); |
|
|
recordEntity.setArticleId(formDTO.getArticleId()); |
|
|
recordEntity.setArticleId(formDTO.getArticleId()); |
|
|
recordEntity.setOpUser(articleEntity.getPublisherName() + StrConstant.HYPHEN + staffDTO.getRealName()); |
|
|
recordEntity.setOpUser(articleEntity.getPublisherName() + StrConstant.HYPHEN + staffDTO.getRealName()); |
|
|
//下线文案,分为全部下线和部分下线
|
|
|
//下线文案,分为全部下线和部分下线
|
|
|
String content = ""; |
|
|
String content = ""; |
|
|
if (null == publishedList || publishedList.size() < NumConstant.ONE) { |
|
|
if (null == publishedList || publishedList.size() < NumConstant.ONE) { |
|
|
content = String.format(ArticleConstant.OFF_LINE_ALL_ARTICLE_MSG, articleEntity.getPublisherName(), staffDTO.getRealName(), articleEntity.getTitle()); |
|
|
content = String.format(ArticleConstant.OFF_LINE_ALL_ARTICLE_MSG, articleEntity.getPublisherName(), staffDTO.getRealName(), articleEntity.getTitle()); |
|
|
} else { |
|
|
} else { |
|
|
StringBuffer offLineRangeDesc = new StringBuffer(); |
|
|
StringBuffer offLineRangeDesc = new StringBuffer(); |
|
|
offLineList.forEach(off -> { |
|
|
offLineList.forEach(off -> { |
|
|
offLineRangeDesc.append(offLineRangeDesc.length() > NumConstant.ZERO ? StrConstant.COMMA_ZH : ""); |
|
|
offLineRangeDesc.append(offLineRangeDesc.length() > NumConstant.ZERO ? StrConstant.COMMA_ZH : ""); |
|
|
offLineRangeDesc.append(off.getAgencyGridName()); |
|
|
offLineRangeDesc.append(off.getAgencyGridName()); |
|
|
}); |
|
|
}); |
|
|
content = String.format(ArticleConstant.OFF_LINE_ARTICLE_MSG, articleEntity.getPublisherName(), staffDTO.getRealName(), articleEntity.getTitle(), offLineRangeDesc); |
|
|
content = String.format(ArticleConstant.OFF_LINE_ARTICLE_MSG, articleEntity.getPublisherName(), staffDTO.getRealName(), articleEntity.getTitle(), offLineRangeDesc); |
|
|
} |
|
|
} |
|
|
recordEntity.setContent(content); |
|
|
recordEntity.setContent(content); |
|
|
recordEntity.setOpType(ArticleConstant.OFFLINE); |
|
|
recordEntity.setOpType(ArticleConstant.OFFLINE); |
|
|
recordEntity.setOpTime(date); |
|
|
recordEntity.setOpTime(date); |
|
|
articleOperateRecordService.insert(recordEntity); |
|
|
articleOperateRecordService.insert(recordEntity); |
|
@ -582,7 +580,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageData publishedArticleList(TokenDto tokenDto, PublishedListFormDTO formDTO) { |
|
|
public PageData publishedArticleList(TokenDto tokenDto, PublishedListFormDTO formDTO) { |
|
|
PageHelper.startPage(formDTO.getPageNo(),formDTO.getPageSize()); |
|
|
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); |
|
|
List<PublishedListResultDTO> resultList; |
|
|
List<PublishedListResultDTO> resultList; |
|
|
List<CustomerStaffRoleResultDTO> roles = epmetUserOpenFeignClient.getStaffRoles(tokenDto.getUserId()).getData(); |
|
|
List<CustomerStaffRoleResultDTO> roles = epmetUserOpenFeignClient.getStaffRoles(tokenDto.getUserId()).getData(); |
|
|
LoginUserDetailsFormDTO loginUserDetailsFormDTO = new LoginUserDetailsFormDTO(); |
|
|
LoginUserDetailsFormDTO loginUserDetailsFormDTO = new LoginUserDetailsFormDTO(); |
|
@ -616,7 +614,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
resultList.forEach(result -> { |
|
|
resultList.forEach(result -> { |
|
|
String tags = result.getTags(); |
|
|
String tags = result.getTags(); |
|
|
List<String> tagList = new ArrayList<>(); |
|
|
List<String> tagList = new ArrayList<>(); |
|
|
tagList= Arrays.asList(tags.split("[|]")); |
|
|
tagList = Arrays.asList(tags.split("[|]")); |
|
|
result.setTagNameList(tagList); |
|
|
result.setTagNameList(tagList); |
|
|
}); |
|
|
}); |
|
|
PageInfo<PublishedListResultDTO> pageInfo = new PageInfo<>(resultList); |
|
|
PageInfo<PublishedListResultDTO> pageInfo = new PageInfo<>(resultList); |
|
@ -625,7 +623,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageData offlineList(TokenDto tokenDto, OfflineListFormDTO formDTO) { |
|
|
public PageData offlineList(TokenDto tokenDto, OfflineListFormDTO formDTO) { |
|
|
PageHelper.startPage(formDTO.getPageNo(),formDTO.getPageSize()); |
|
|
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); |
|
|
|
|
|
|
|
|
LoginUserDetailsFormDTO loginUserDetailsFormDTO = new LoginUserDetailsFormDTO(); |
|
|
LoginUserDetailsFormDTO loginUserDetailsFormDTO = new LoginUserDetailsFormDTO(); |
|
|
loginUserDetailsFormDTO.setApp(tokenDto.getApp()); |
|
|
loginUserDetailsFormDTO.setApp(tokenDto.getApp()); |
|
@ -637,46 +635,46 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
return new PageData<>(resultList, pageInfo.getTotal()); |
|
|
return new PageData<>(resultList, pageInfo.getTotal()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Description 根据网格Id查找置顶文章的相关信息列表 用处:居民端首页轮播 |
|
|
* @param commonArticleListFormDTO :: getGridId :: getNum |
|
|
* @param commonArticleListFormDTO :: getGridId :: getNum |
|
|
* @return List<ArticleBannerResultDTO> |
|
|
* @return List<ArticleBannerResultDTO> |
|
|
* @Description 根据网格Id查找置顶文章的相关信息列表 用处:居民端首页轮播 |
|
|
* @author wangc |
|
|
* @author wangc |
|
|
* @date 2020.06.02 16:13 |
|
|
* @date 2020.06.02 16:13 |
|
|
**/ |
|
|
**/ |
|
|
@Override |
|
|
@Override |
|
|
public List<ArticleBannerResultDTO> getTopArticleList(CommonArticleListFormDTO commonArticleListFormDTO) { |
|
|
public List<ArticleBannerResultDTO> getTopArticleList(CommonArticleListFormDTO commonArticleListFormDTO) { |
|
|
return baseDao.selectTopArticleMsg(commonArticleListFormDTO.getGridId(), |
|
|
return baseDao.selectTopArticleMsg(commonArticleListFormDTO.getGridId(), |
|
|
null == commonArticleListFormDTO.getNum() || commonArticleListFormDTO.getNum() <= NumConstant.ZERO ? |
|
|
null == commonArticleListFormDTO.getNum() || commonArticleListFormDTO.getNum() <= NumConstant.ZERO ? |
|
|
NumConstant.THREE : commonArticleListFormDTO.getNum()); |
|
|
NumConstant.THREE : commonArticleListFormDTO.getNum()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Description 根据网格Id查找最新文章的相关信息列表 用处:居民端首页最新文章列表 |
|
|
* @param commonArticleListFormDTO :: getGridId :: getNum |
|
|
* @param commonArticleListFormDTO :: getGridId :: getNum |
|
|
* @return List<ArticleLatestResultDTO> |
|
|
* @return List<ArticleLatestResultDTO> |
|
|
* @Description 根据网格Id查找最新文章的相关信息列表 用处:居民端首页最新文章列表 |
|
|
* @author wangc |
|
|
* @author wangc |
|
|
* @date 2020.06.03 09:53 |
|
|
* @date 2020.06.03 09:53 |
|
|
**/ |
|
|
**/ |
|
|
@Override |
|
|
@Override |
|
|
public List<ArticleLatestResultDTO> getLatestArticleList(CommonArticleListFormDTO commonArticleListFormDTO) { |
|
|
public List<ArticleLatestResultDTO> getLatestArticleList(CommonArticleListFormDTO commonArticleListFormDTO) { |
|
|
return baseDao.selectLatestArticleMsg(commonArticleListFormDTO.getGridId(), |
|
|
return baseDao.selectLatestArticleMsg(commonArticleListFormDTO.getGridId(), |
|
|
null == commonArticleListFormDTO.getNum() || commonArticleListFormDTO.getNum() <= NumConstant.ZERO ? |
|
|
null == commonArticleListFormDTO.getNum() || commonArticleListFormDTO.getNum() <= NumConstant.ZERO ? |
|
|
NumConstant.FIVE : commonArticleListFormDTO.getNum()); |
|
|
NumConstant.FIVE : commonArticleListFormDTO.getNum()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Description 根据网格Id和标签列表查找文章的相关信息列表 用处:居民端党建声音列表 |
|
|
* @param articlePageFormDTO |
|
|
* @param articlePageFormDTO |
|
|
* @return List<ArticleListResultDTO> |
|
|
* @return List<ArticleListResultDTO> |
|
|
* @Description 根据网格Id和标签列表查找文章的相关信息列表 用处:居民端党建声音列表 |
|
|
* @author wangc |
|
|
* @author wangc |
|
|
* @date 2020.06.03 14:19 |
|
|
* @date 2020.06.03 14:19 |
|
|
**/ |
|
|
**/ |
|
|
@Override |
|
|
@Override |
|
|
public List<ArticleListResultDTO> getArticleList(ArticlePageFormDTO articlePageFormDTO) { |
|
|
public List<ArticleListResultDTO> getArticleList(ArticlePageFormDTO articlePageFormDTO) { |
|
|
PageHelper.startPage(articlePageFormDTO.getPageNo(),articlePageFormDTO.getPageSize()); |
|
|
PageHelper.startPage(articlePageFormDTO.getPageNo(), articlePageFormDTO.getPageSize()); |
|
|
return baseDao.selectArticleList(articlePageFormDTO.getGridId(),articlePageFormDTO.getTagIdList()); |
|
|
return baseDao.selectArticleList(articlePageFormDTO.getGridId(), articlePageFormDTO.getTagIdList()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @param formDTO |
|
|
* @param formDTO |
|
@ -700,7 +698,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
loginUserDetailsFormDTO.setClient("wxmp"); |
|
|
loginUserDetailsFormDTO.setClient("wxmp"); |
|
|
loginUserDetailsFormDTO.setUserId(formDTO.getStaffId()); |
|
|
loginUserDetailsFormDTO.setUserId(formDTO.getStaffId()); |
|
|
Result<LoginUserDetailsResultDTO> resultDTOResult = epmetUserOpenFeignClient.getLoginUserDetails(loginUserDetailsFormDTO); |
|
|
Result<LoginUserDetailsResultDTO> resultDTOResult = epmetUserOpenFeignClient.getLoginUserDetails(loginUserDetailsFormDTO); |
|
|
String agencyId = resultDTOResult.getData().getOrgIdPath().substring(resultDTOResult.getData().getOrgIdPath().lastIndexOf(":")+NumConstant.ONE); |
|
|
String agencyId = resultDTOResult.getData().getOrgIdPath().substring(resultDTOResult.getData().getOrgIdPath().lastIndexOf(":") + NumConstant.ONE); |
|
|
//存放树的每一个节点对象,用于将同一节点下的网格列表合并(主键:agencyId 值:节点对象)
|
|
|
//存放树的每一个节点对象,用于将同一节点下的网格列表合并(主键:agencyId 值:节点对象)
|
|
|
Map<String, ArticleGridResultDTO> map = new HashMap<>(); |
|
|
Map<String, ArticleGridResultDTO> map = new HashMap<>(); |
|
|
//3:循环可下线网格列表,根据pids组织每一个树节点对象信息
|
|
|
//3:循环可下线网格列表,根据pids组织每一个树节点对象信息
|
|
@ -753,6 +751,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
List<ArticleGridResultDTO> list = agencyGridListToTree(resultDTOList); |
|
|
List<ArticleGridResultDTO> list = agencyGridListToTree(resultDTOList); |
|
|
return list.get(NumConstant.ZERO); |
|
|
return list.get(NumConstant.ZERO); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Author sun |
|
|
* @Author sun |
|
|
* @Description 可下线网格列表-将list转为Tree结构 |
|
|
* @Description 可下线网格列表-将list转为Tree结构 |
|
@ -790,6 +789,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
} |
|
|
} |
|
|
return listParentRecord; |
|
|
return listParentRecord; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Author sun |
|
|
* @Author sun |
|
|
* @Description 可下线网格列表-将list转为Tree结构-递归查询每一个根节点的下级节点集合 |
|
|
* @Description 可下线网格列表-将list转为Tree结构-递归查询每一个根节点的下级节点集合 |
|
@ -818,9 +818,9 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Description 根绝文章Id查询出文章的内容、封面等相关信息,如果居民端传入的网格Id不在该文章的发布范围内,则返回NULL |
|
|
|
|
|
* @param articleDetailFormDTO |
|
|
* @param articleDetailFormDTO |
|
|
* @return ArticleDetailResultDTO |
|
|
* @return ArticleDetailResultDTO |
|
|
|
|
|
* @Description 根绝文章Id查询出文章的内容、封面等相关信息,如果居民端传入的网格Id不在该文章的发布范围内,则返回NULL |
|
|
* @author wangc |
|
|
* @author wangc |
|
|
* @date 2020.06.03 18:28 |
|
|
* @date 2020.06.03 18:28 |
|
|
**/ |
|
|
**/ |
|
@ -828,20 +828,20 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public ArticleDetailResultDTO getArticleDetail(ResiArticleDetailFormDTO articleDetailFormDTO) { |
|
|
public ArticleDetailResultDTO getArticleDetail(ResiArticleDetailFormDTO articleDetailFormDTO) { |
|
|
//1.查询文章详情信息
|
|
|
//1.查询文章详情信息
|
|
|
ArticleDetailResultDTO articleInfo = baseDao.selectArticleDetail(articleDetailFormDTO.getGridId(),articleDetailFormDTO.getArticleId()); |
|
|
ArticleDetailResultDTO articleInfo = baseDao.selectArticleDetail(articleDetailFormDTO.getGridId(), articleDetailFormDTO.getArticleId()); |
|
|
if(null == articleInfo) { |
|
|
if (null == articleInfo) { |
|
|
throw new RenException(String.format(ModuleConstant.SPECIFIED_ARTICLE_NOT_FOUND_EXCEPTION_TEMPLATE,articleDetailFormDTO.getArticleId(),articleDetailFormDTO.getGridId())); |
|
|
throw new RenException(String.format(ModuleConstant.SPECIFIED_ARTICLE_NOT_FOUND_EXCEPTION_TEMPLATE, articleDetailFormDTO.getArticleId(), articleDetailFormDTO.getGridId())); |
|
|
} |
|
|
} |
|
|
//2.判断当前用户当前文章当前网格是否存在访问记录
|
|
|
//2.判断当前用户当前文章当前网格是否存在访问记录
|
|
|
Map<String,Object> params = new HashMap<>(); |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
params.put(ModuleConstant.FIELD_GRID_ID_CAMEL,articleDetailFormDTO.getGridId()); |
|
|
params.put(ModuleConstant.FIELD_GRID_ID_CAMEL, articleDetailFormDTO.getGridId()); |
|
|
params.put(ModuleConstant.FIELD_USER_ID_CAMEL,articleDetailFormDTO.getUserId()); |
|
|
params.put(ModuleConstant.FIELD_USER_ID_CAMEL, articleDetailFormDTO.getUserId()); |
|
|
params.put(ModuleConstant.FIELD_ARTICLE_ID_CAMEL,articleDetailFormDTO.getArticleId()); |
|
|
params.put(ModuleConstant.FIELD_ARTICLE_ID_CAMEL, articleDetailFormDTO.getArticleId()); |
|
|
params.put(ModuleConstant.FIELD_CUSTOMER_ID_CAMEL,articleInfo.getCustomerId()); |
|
|
params.put(ModuleConstant.FIELD_CUSTOMER_ID_CAMEL, articleInfo.getCustomerId()); |
|
|
params.put(FieldConstant.DEL_FLAG_HUMP,NumConstant.ZERO_STR); |
|
|
params.put(FieldConstant.DEL_FLAG_HUMP, NumConstant.ZERO_STR); |
|
|
List<ArticleVisitRecordDTO> existedVisitRecord = articleVisitRecordService.list(params); |
|
|
List<ArticleVisitRecordDTO> existedVisitRecord = articleVisitRecordService.list(params); |
|
|
//3.没有则插入
|
|
|
//3.没有则插入
|
|
|
if(null == existedVisitRecord || existedVisitRecord.size() < NumConstant.ONE){ |
|
|
if (null == existedVisitRecord || existedVisitRecord.size() < NumConstant.ONE) { |
|
|
ArticleVisitRecordEntity recordToInsert = new ArticleVisitRecordEntity(); |
|
|
ArticleVisitRecordEntity recordToInsert = new ArticleVisitRecordEntity(); |
|
|
recordToInsert.setArticleId(articleDetailFormDTO.getArticleId()); |
|
|
recordToInsert.setArticleId(articleDetailFormDTO.getArticleId()); |
|
|
recordToInsert.setGridId(articleDetailFormDTO.getGridId()); |
|
|
recordToInsert.setGridId(articleDetailFormDTO.getGridId()); |
|
@ -856,9 +856,9 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Description 草稿发布文章 |
|
|
|
|
|
* @param draft |
|
|
* @param draft |
|
|
* @return String 返回新发布文章的Id |
|
|
* @return String 返回新发布文章的Id |
|
|
|
|
|
* @Description 草稿发布文章 |
|
|
* @author wangc |
|
|
* @author wangc |
|
|
* @date 2020.06.05 09:10 |
|
|
* @date 2020.06.05 09:10 |
|
|
**/ |
|
|
**/ |
|
@ -866,40 +866,40 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
public ArticleEntity publishDraftToArticle(DraftEntity draft) { |
|
|
public ArticleEntity publishDraftToArticle(DraftEntity draft) { |
|
|
//1.查找草稿内容
|
|
|
//1.查找草稿内容
|
|
|
|
|
|
|
|
|
if(null != draft){ |
|
|
if (null != draft) { |
|
|
//2.查找草稿内容、封面、发布范围
|
|
|
//2.查找草稿内容、封面、发布范围
|
|
|
String draftId = draft.getId(); |
|
|
String draftId = draft.getId(); |
|
|
//直接查询改草稿的 封面及内容
|
|
|
//直接查询改草稿的 封面及内容
|
|
|
List<DraftContentEntity> draftContents = draftContentDao.selectByDraftId(draftId,null); |
|
|
List<DraftContentEntity> draftContents = draftContentDao.selectByDraftId(draftId, null); |
|
|
DraftCoverEntity draftCover = draftCoverDao.selectByDraftId(draftId,null); |
|
|
DraftCoverEntity draftCover = draftCoverDao.selectByDraftId(draftId, null); |
|
|
List<DraftPublishRangeEntity> draftPublishRange = draftPublishRangeDao.selectByDraftId(draftId); |
|
|
List<DraftPublishRangeEntity> draftPublishRange = draftPublishRangeDao.selectByDraftId(draftId); |
|
|
|
|
|
|
|
|
//3.生成文章以及相关记录
|
|
|
//3.生成文章以及相关记录
|
|
|
ArticleEntity article = ConvertUtils.sourceToTarget(draft,ArticleEntity.class); |
|
|
ArticleEntity article = ConvertUtils.sourceToTarget(draft, ArticleEntity.class); |
|
|
article.setId(null); |
|
|
article.setId(null); |
|
|
article.setDraftId(draftId); |
|
|
article.setDraftId(draftId); |
|
|
article.setStatusFlag(DraftConstant.PUBLISHED); |
|
|
article.setStatusFlag(DraftConstant.PUBLISHED); |
|
|
baseDao.insert(article); |
|
|
baseDao.insert(article); |
|
|
if(null != draftContents && draftContents.size() > NumConstant.ZERO){ |
|
|
if (null != draftContents && draftContents.size() > NumConstant.ZERO) { |
|
|
draftContents.forEach(content -> { |
|
|
draftContents.forEach(content -> { |
|
|
content.setOrderNum(content.getOrderNum()); |
|
|
content.setOrderNum(content.getOrderNum()); |
|
|
ArticleContentEntity contentToInsert = ConvertUtils.sourceToTarget(content,ArticleContentEntity.class); |
|
|
ArticleContentEntity contentToInsert = ConvertUtils.sourceToTarget(content, ArticleContentEntity.class); |
|
|
contentToInsert.setArticleId(article.getId()); |
|
|
contentToInsert.setArticleId(article.getId()); |
|
|
contentToInsert.setId(null); |
|
|
contentToInsert.setId(null); |
|
|
articleContentDao.insert(contentToInsert); |
|
|
articleContentDao.insert(contentToInsert); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
if(null != draftPublishRange && draftPublishRange.size() > NumConstant.ZERO){ |
|
|
if (null != draftPublishRange && draftPublishRange.size() > NumConstant.ZERO) { |
|
|
draftPublishRange.forEach(range -> { |
|
|
draftPublishRange.forEach(range -> { |
|
|
range.setPublishStatus(DraftConstant.PUBLISHED); |
|
|
range.setPublishStatus(DraftConstant.PUBLISHED); |
|
|
ArticlePublishRangeEntity rangeToInsert = ConvertUtils.sourceToTarget(range,ArticlePublishRangeEntity.class); |
|
|
ArticlePublishRangeEntity rangeToInsert = ConvertUtils.sourceToTarget(range, ArticlePublishRangeEntity.class); |
|
|
rangeToInsert.setArticleId(article.getId()); |
|
|
rangeToInsert.setArticleId(article.getId()); |
|
|
rangeToInsert.setId(null); |
|
|
rangeToInsert.setId(null); |
|
|
articlePublishRangeDao.insert(rangeToInsert); |
|
|
articlePublishRangeDao.insert(rangeToInsert); |
|
|
draftPublishRangeDao.updateById(range); |
|
|
draftPublishRangeDao.updateById(range); |
|
|
}); |
|
|
}); |
|
|
if(null != draftCover){ |
|
|
if (null != draftCover) { |
|
|
ArticleCoverEntity coverToInsert = ConvertUtils.sourceToTarget(draftCover,ArticleCoverEntity.class); |
|
|
ArticleCoverEntity coverToInsert = ConvertUtils.sourceToTarget(draftCover, ArticleCoverEntity.class); |
|
|
coverToInsert.setArticleId(article.getId()); |
|
|
coverToInsert.setArticleId(article.getId()); |
|
|
coverToInsert.setId(null); |
|
|
coverToInsert.setId(null); |
|
|
articleCoverDao.insert(coverToInsert); |
|
|
articleCoverDao.insert(coverToInsert); |
|
@ -920,7 +920,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
return article; |
|
|
return article; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
throw new RenException(String.format(ModuleConstant.SPECIFIED_DRAFT_NOT_FOUNT_EXCEPTION_TEMPLATE,draft.getId())); |
|
|
throw new RenException(String.format(ModuleConstant.SPECIFIED_DRAFT_NOT_FOUNT_EXCEPTION_TEMPLATE, draft.getId())); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -942,7 +942,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!isOk) { |
|
|
if (!isOk) { |
|
|
this.sendMsg(draftEntity.getCustomerId(),draftEntity.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draftEntity.getTitle())); |
|
|
this.sendMsg(draftEntity.getCustomerId(), draftEntity.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draftEntity.getTitle())); |
|
|
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL); |
|
|
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL); |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
@ -977,20 +977,20 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
Result<SyncScanResult> imgSyncScanResult = null; |
|
|
Result<SyncScanResult> imgSyncScanResult = null; |
|
|
Result<SyncScanResult> textSyncScanResult = null; |
|
|
Result<SyncScanResult> textSyncScanResult = null; |
|
|
|
|
|
|
|
|
if(!CollectionUtils.isEmpty(imgScanParamDTO.getTasks())){ |
|
|
if (!CollectionUtils.isEmpty(imgScanParamDTO.getTasks())) { |
|
|
log.info("scanContent imgScanParamDTO:{}", JSON.toJSONString(imgScanParamDTO)); |
|
|
log.info("scanContent imgScanParamDTO:{}", JSON.toJSONString(imgScanParamDTO)); |
|
|
imgSyncScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO); |
|
|
imgSyncScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO); |
|
|
log.info("scanContent imgSyncScanResult:{}", JSON.toJSONString(imgSyncScanResult)); |
|
|
log.info("scanContent imgSyncScanResult:{}", JSON.toJSONString(imgSyncScanResult)); |
|
|
} |
|
|
} |
|
|
if(!CollectionUtils.isEmpty(textScanParamDTO.getTasks())){ |
|
|
if (!CollectionUtils.isEmpty(textScanParamDTO.getTasks())) { |
|
|
log.info("scanContent textScanParamDTO:{}", JSON.toJSONString(textScanParamDTO)); |
|
|
log.info("scanContent textScanParamDTO:{}", JSON.toJSONString(textScanParamDTO)); |
|
|
textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); |
|
|
textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); |
|
|
log.info("scanContent textSyncScanResult:{}", JSON.toJSONString(textSyncScanResult)); |
|
|
log.info("scanContent textSyncScanResult:{}", JSON.toJSONString(textSyncScanResult)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result = new SyncScanResult(); |
|
|
result = new SyncScanResult(); |
|
|
if (imgSyncScanResult != null){ |
|
|
if (imgSyncScanResult != null) { |
|
|
SyncScanResult imgSyncScanResultData = imgSyncScanResult.getData(); |
|
|
SyncScanResult imgSyncScanResultData = imgSyncScanResult.getData(); |
|
|
if (imgSyncScanResult.success()) { |
|
|
if (imgSyncScanResult.success()) { |
|
|
result.setAllPass(imgSyncScanResultData.isAllPass()); |
|
|
result.setAllPass(imgSyncScanResultData.isAllPass()); |
|
@ -1008,15 +1008,16 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
} |
|
|
} |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.error("scanContent exception", e); |
|
|
log.error("scanContent exception", e); |
|
|
this.sendMsg(draftEntity.getCustomerId(),draftEntity.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draftEntity.getTitle())); |
|
|
this.sendMsg(draftEntity.getCustomerId(), draftEntity.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draftEntity.getTitle())); |
|
|
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL); |
|
|
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL); |
|
|
} |
|
|
} |
|
|
log.debug("scanContent result:{}", JSON.toJSONString(result)); |
|
|
log.debug("scanContent result:{}", JSON.toJSONString(result)); |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED) |
|
|
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) |
|
|
public void scanAllPassPublishArticle(TokenDto tokenDto, String draftId, SyncScanResult syncScanResult){ |
|
|
public void scanAllPassPublishArticle(TokenDto tokenDto, String draftId, SyncScanResult syncScanResult) { |
|
|
|
|
|
|
|
|
DraftEntity draft = draftDao.selectById(draftId); |
|
|
DraftEntity draft = draftDao.selectById(draftId); |
|
|
if (draft == null) { |
|
|
if (draft == null) { |
|
@ -1028,7 +1029,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
this.updateAuditStatusFailById(draftId, syncScanResult); |
|
|
this.updateAuditStatusFailById(draftId, syncScanResult); |
|
|
this.publishDraftToArticle(draft); |
|
|
this.publishDraftToArticle(draft); |
|
|
UpdateCustomerTagCacheDTO updateCustomerTagCacheDTO = this.updateCustomerTag(tokenDto, draftId); |
|
|
UpdateCustomerTagCacheDTO updateCustomerTagCacheDTO = this.updateCustomerTag(tokenDto, draftId); |
|
|
if (updateCustomerTagCacheDTO == null){ |
|
|
if (updateCustomerTagCacheDTO == null) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
List<UpdateGridTagCacheDTO> updateGridTagCacheDTOS = this.updateGridTag(tokenDto, draftId, updateCustomerTagCacheDTO); |
|
|
List<UpdateGridTagCacheDTO> updateGridTagCacheDTOS = this.updateGridTag(tokenDto, draftId, updateCustomerTagCacheDTO); |
|
@ -1044,31 +1045,31 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
} |
|
|
} |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.error("scanAllPassPublishArticle update db exception", e); |
|
|
log.error("scanAllPassPublishArticle update db exception", e); |
|
|
this.sendMsg(draft.getCustomerId(),draft.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draft.getTitle())); |
|
|
this.sendMsg(draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draft.getTitle())); |
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); |
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void updateAuditStatusFailById(String draftId,SyncScanResult syncScanResult) { |
|
|
public void updateAuditStatusFailById(String draftId, SyncScanResult syncScanResult) { |
|
|
DraftEntity draft = draftDao.selectById(draftId); |
|
|
DraftEntity draft = draftDao.selectById(draftId); |
|
|
if (draft == null) { |
|
|
if (draft == null) { |
|
|
log.error("updateAuditStatusFailById draftId:{} is not exist in db", draftId); |
|
|
log.error("updateAuditStatusFailById draftId:{} is not exist in db", draftId); |
|
|
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg()); |
|
|
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg()); |
|
|
} |
|
|
} |
|
|
if (syncScanResult.isAllPass()){ |
|
|
if (syncScanResult.isAllPass()) { |
|
|
this.updateDraftPublishStatus(draftId, DraftConstant.PUBLISHED); |
|
|
this.updateDraftPublishStatus(draftId, DraftConstant.PUBLISHED); |
|
|
}else{ |
|
|
} else { |
|
|
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL); |
|
|
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
boolean coverFail = false,contentFail = false; |
|
|
boolean coverFail = false, contentFail = false; |
|
|
try { |
|
|
try { |
|
|
List<String> failDataIds = syncScanResult.getFailDataIds(); |
|
|
List<String> failDataIds = syncScanResult.getFailDataIds(); |
|
|
for(String id:failDataIds) { |
|
|
for (String id : failDataIds) { |
|
|
if (id.indexOf(ModuleConstant.SCAN_COVER_PREFIX) >= NumConstant.ZERO) { |
|
|
if (id.indexOf(ModuleConstant.SCAN_COVER_PREFIX) >= NumConstant.ZERO) { |
|
|
draftCoverDao.updateAuditStatusById(id.replace(ModuleConstant.SCAN_COVER_PREFIX.concat(StrConstant.UNDER_LINE),""), ModuleConstant.AUDIT_STATUS_FAIL); |
|
|
draftCoverDao.updateAuditStatusById(id.replace(ModuleConstant.SCAN_COVER_PREFIX.concat(StrConstant.UNDER_LINE), ""), ModuleConstant.AUDIT_STATUS_FAIL); |
|
|
coverFail = true; |
|
|
coverFail = true; |
|
|
} else { |
|
|
} else { |
|
|
draftContentDao.updateAuditStatusById(id, ModuleConstant.AUDIT_STATUS_FAIL); |
|
|
draftContentDao.updateAuditStatusById(id, ModuleConstant.AUDIT_STATUS_FAIL); |
|
@ -1078,21 +1079,22 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
List<String> successDataIds = syncScanResult.getSuccessDataIds(); |
|
|
List<String> successDataIds = syncScanResult.getSuccessDataIds(); |
|
|
successDataIds.forEach(id -> { |
|
|
successDataIds.forEach(id -> { |
|
|
if (id.indexOf(ModuleConstant.SCAN_COVER_PREFIX) >= NumConstant.ZERO) { |
|
|
if (id.indexOf(ModuleConstant.SCAN_COVER_PREFIX) >= NumConstant.ZERO) { |
|
|
draftCoverDao.updateAuditStatusById(id.replace(ModuleConstant.SCAN_COVER_PREFIX.concat(StrConstant.UNDER_LINE),""), ModuleConstant.AUDIT_STATUS_PASS); |
|
|
draftCoverDao.updateAuditStatusById(id.replace(ModuleConstant.SCAN_COVER_PREFIX.concat(StrConstant.UNDER_LINE), ""), ModuleConstant.AUDIT_STATUS_PASS); |
|
|
} else { |
|
|
} else { |
|
|
draftContentDao.updateAuditStatusById(id, ModuleConstant.AUDIT_STATUS_PASS); |
|
|
draftContentDao.updateAuditStatusById(id, ModuleConstant.AUDIT_STATUS_PASS); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
if (coverFail || contentFail){ |
|
|
if (coverFail || contentFail) { |
|
|
String auditMsg = ""; |
|
|
String auditMsg = ""; |
|
|
if (coverFail&&contentFail){ |
|
|
if (coverFail && contentFail) { |
|
|
auditMsg = ModuleConstant.DRAFT_CONTENT_AND_COVER; |
|
|
auditMsg = ModuleConstant.DRAFT_CONTENT_AND_COVER; |
|
|
}else if (contentFail){ |
|
|
} else if (contentFail) { |
|
|
auditMsg = ModuleConstant.DRAFT_CONTENT; |
|
|
auditMsg = ModuleConstant.DRAFT_CONTENT; |
|
|
}else if (coverFail){ |
|
|
} else if (coverFail) { |
|
|
auditMsg = ModuleConstant.DRAFT_COVER;; |
|
|
auditMsg = ModuleConstant.DRAFT_COVER; |
|
|
|
|
|
; |
|
|
} |
|
|
} |
|
|
this.sendMsg(draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_AUDIT_CONTENT, draft.getTitle(),auditMsg)); |
|
|
this.sendMsg(draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_AUDIT_CONTENT, draft.getTitle(), auditMsg)); |
|
|
} |
|
|
} |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.error("scanAllPassPublishArticle update db exception", e); |
|
|
log.error("scanAllPassPublishArticle update db exception", e); |
|
@ -1107,37 +1109,37 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
return this.saveOrUpdateContent(tokenDto, fromDTO, false); |
|
|
return this.saveOrUpdateContent(tokenDto, fromDTO, false); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public Result sendMsg(String customerId, String title,String content) { |
|
|
public Result sendMsg(String customerId, String title, String content) { |
|
|
UserMessageFormDTO formDTO = new UserMessageFormDTO(); |
|
|
UserMessageFormDTO formDTO = new UserMessageFormDTO(); |
|
|
formDTO.setCustomerId(customerId); |
|
|
formDTO.setCustomerId(customerId); |
|
|
formDTO.setGridId(""); |
|
|
formDTO.setGridId(""); |
|
|
formDTO.setUserId(loginUserUtil.getLoginUserId()); |
|
|
formDTO.setUserId(loginUserUtil.getLoginUserId()); |
|
|
formDTO.setApp(AppClientConstant.APP_GOV); |
|
|
formDTO.setApp(AppClientConstant.APP_GOV); |
|
|
formDTO.setTitle(String.format(ModuleConstant.MSG_TITLE,title)); |
|
|
formDTO.setTitle(String.format(ModuleConstant.MSG_TITLE, title)); |
|
|
formDTO.setMessageContent(content); |
|
|
formDTO.setMessageContent(content); |
|
|
formDTO.setReadFlag(ReadFlagConstant.UN_READ); |
|
|
formDTO.setReadFlag(ReadFlagConstant.UN_READ); |
|
|
return epmetMessageOpenFeignClient.saveUserMessage(formDTO); |
|
|
return epmetMessageOpenFeignClient.saveUserMessage(formDTO); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void updateDraftPublishStatus(String draftId,String statusFlag){ |
|
|
public void updateDraftPublishStatus(String draftId, String statusFlag) { |
|
|
draftDao.updateAuditStatusById(draftId,statusFlag); |
|
|
draftDao.updateAuditStatusById(draftId, statusFlag); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Description 更新DB的标签使用次数 政府端 |
|
|
|
|
|
* @param draftId |
|
|
* @param draftId |
|
|
|
|
|
* @Description 更新DB的标签使用次数 政府端 |
|
|
* @author zxc |
|
|
* @author zxc |
|
|
*/ |
|
|
*/ |
|
|
public UpdateCustomerTagCacheDTO updateCustomerTag(TokenDto tokenDto, String draftId){ |
|
|
public UpdateCustomerTagCacheDTO updateCustomerTag(TokenDto tokenDto, String draftId) { |
|
|
//获取草稿基本信息
|
|
|
//获取草稿基本信息
|
|
|
DraftDTO draft = draftService.get(draftId); |
|
|
DraftDTO draft = draftService.get(draftId); |
|
|
String tags = draft.getTags(); |
|
|
String tags = draft.getTags(); |
|
|
String customerId = draft.getCustomerId(); |
|
|
String customerId = draft.getCustomerId(); |
|
|
String userId = tokenDto.getUserId(); |
|
|
String userId = tokenDto.getUserId(); |
|
|
UpdateCustomerTagCacheDTO result = null; |
|
|
UpdateCustomerTagCacheDTO result = null; |
|
|
if (StringUtils.isNotBlank(tags)){ |
|
|
if (StringUtils.isNotBlank(tags)) { |
|
|
result = new UpdateCustomerTagCacheDTO(); |
|
|
result = new UpdateCustomerTagCacheDTO(); |
|
|
List<String> tagsList = Arrays.asList(tags.split("\\|")); |
|
|
List<String> tagsList = Arrays.asList(tags.split("\\|")); |
|
|
List<UpdateTagUseCountsResultDTO> tagsInfo = new ArrayList<>(); |
|
|
List<UpdateTagUseCountsResultDTO> tagsInfo = new ArrayList<>(); |
|
@ -1155,37 +1157,37 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Description 更新redis 标签使用数量 和 标签级联 政府端 |
|
|
|
|
|
* @param formDto |
|
|
* @param formDto |
|
|
|
|
|
* @Description 更新redis 标签使用数量 和 标签级联 政府端 |
|
|
* @author zxc |
|
|
* @author zxc |
|
|
*/ |
|
|
*/ |
|
|
public void updateCacheCustomerTag(UpdateCustomerTagCacheDTO formDto){ |
|
|
public void updateCacheCustomerTag(UpdateCustomerTagCacheDTO formDto) { |
|
|
List<UpdateTagUseCountsResultDTO> tagsInfo = formDto.getTagsInfo(); |
|
|
List<UpdateTagUseCountsResultDTO> tagsInfo = formDto.getTagsInfo(); |
|
|
String customerId = formDto.getCustomerId(); |
|
|
String customerId = formDto.getCustomerId(); |
|
|
//更新缓存标签使用数量
|
|
|
//更新缓存标签使用数量
|
|
|
tagsInfo.forEach(resultDTO -> { |
|
|
tagsInfo.forEach(resultDTO -> { |
|
|
String customerKey = TagConstant.GOV_TAG_KEY+customerId; |
|
|
String customerKey = TagConstant.GOV_TAG_KEY + customerId; |
|
|
tagRedis.updateTagUseCounts(customerKey,resultDTO); |
|
|
tagRedis.updateTagUseCounts(customerKey, resultDTO); |
|
|
}); |
|
|
}); |
|
|
//政府端更新redis的级联标签(set)
|
|
|
//政府端更新redis的级联标签(set)
|
|
|
List<UpdateTagUseCountsResultDTO> tagsInfoCopy = new ArrayList<>(); |
|
|
List<UpdateTagUseCountsResultDTO> tagsInfoCopy = new ArrayList<>(); |
|
|
for (int i = 0; i < tagsInfo.size(); i++) { |
|
|
for (int i = 0; i < tagsInfo.size(); i++) { |
|
|
tagsInfoCopy.addAll(tagsInfo); |
|
|
tagsInfoCopy.addAll(tagsInfo); |
|
|
String key = TagConstant.GOV_RETAG_KEY+customerId+TagConstant.COLON+tagsInfo.get(i).getTagId(); |
|
|
String key = TagConstant.GOV_RETAG_KEY + customerId + TagConstant.COLON + tagsInfo.get(i).getTagId(); |
|
|
tagsInfoCopy.remove(tagsInfo.get(i)); |
|
|
tagsInfoCopy.remove(tagsInfo.get(i)); |
|
|
Set<UpdateTagUseCountsResultDTO> setTag = new HashSet<>(tagsInfoCopy); |
|
|
Set<UpdateTagUseCountsResultDTO> setTag = new HashSet<>(tagsInfoCopy); |
|
|
tagRedis.updateMoreTag(key,setTag); |
|
|
tagRedis.updateMoreTag(key, setTag); |
|
|
tagsInfoCopy.clear(); |
|
|
tagsInfoCopy.clear(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Description 更新数据库 网格下的标签使用数量 居民端 |
|
|
|
|
|
* @param draftId |
|
|
* @param draftId |
|
|
* @param formDto |
|
|
* @param formDto |
|
|
|
|
|
* @Description 更新数据库 网格下的标签使用数量 居民端 |
|
|
* @author zxc |
|
|
* @author zxc |
|
|
*/ |
|
|
*/ |
|
|
public List<UpdateGridTagCacheDTO> updateGridTag(TokenDto tokenDto,String draftId,UpdateCustomerTagCacheDTO formDto){ |
|
|
public List<UpdateGridTagCacheDTO> updateGridTag(TokenDto tokenDto, String draftId, UpdateCustomerTagCacheDTO formDto) { |
|
|
//获取草稿基本信息
|
|
|
//获取草稿基本信息
|
|
|
DraftDTO draft = draftService.get(draftId); |
|
|
DraftDTO draft = draftService.get(draftId); |
|
|
String customerId = draft.getCustomerId(); |
|
|
String customerId = draft.getCustomerId(); |
|
@ -1193,7 +1195,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
String userId = tokenDto.getUserId(); |
|
|
String userId = tokenDto.getUserId(); |
|
|
//根据草稿id查询发布范围id集合
|
|
|
//根据草稿id查询发布范围id集合
|
|
|
List<String> gridIds = draftPublishRangeDao.selectGridIdByDraftId(draftId); |
|
|
List<String> gridIds = draftPublishRangeDao.selectGridIdByDraftId(draftId); |
|
|
if (gridIds.size() == NumConstant.ZERO){ |
|
|
if (gridIds.size() == NumConstant.ZERO) { |
|
|
throw new RenException(TagConstant.SELECT_GRIDIDLIST_FAILURE); |
|
|
throw new RenException(TagConstant.SELECT_GRIDIDLIST_FAILURE); |
|
|
} |
|
|
} |
|
|
List<UpdateGridTagsFormDTO> gridTags = new ArrayList<>(); |
|
|
List<UpdateGridTagsFormDTO> gridTags = new ArrayList<>(); |
|
@ -1205,7 +1207,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
gridTagCache.add(cache); |
|
|
gridTagCache.add(cache); |
|
|
tagsInfo.forEach(resultDTO -> { |
|
|
tagsInfo.forEach(resultDTO -> { |
|
|
UpdateGridTagsFormDTO tag = new UpdateGridTagsFormDTO(); |
|
|
UpdateGridTagsFormDTO tag = new UpdateGridTagsFormDTO(); |
|
|
BeanUtils.copyProperties(resultDTO,tag); |
|
|
BeanUtils.copyProperties(resultDTO, tag); |
|
|
tag.setCreatedBy(userId); |
|
|
tag.setCreatedBy(userId); |
|
|
tag.setUpdatedBy(userId); |
|
|
tag.setUpdatedBy(userId); |
|
|
tag.setCustomerId(customerId); |
|
|
tag.setCustomerId(customerId); |
|
@ -1213,43 +1215,43 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
gridTags.add(tag); |
|
|
gridTags.add(tag); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
tagGridDao.updateGridTag(gridTags,userId); |
|
|
tagGridDao.updateGridTag(gridTags, userId); |
|
|
return gridTagCache; |
|
|
return gridTagCache; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Description 更新redis 网格下的 标签使用数量 和 级联标签 居民端 |
|
|
|
|
|
* @param gridTagCache |
|
|
* @param gridTagCache |
|
|
|
|
|
* @Description 更新redis 网格下的 标签使用数量 和 级联标签 居民端 |
|
|
* @author zxc |
|
|
* @author zxc |
|
|
*/ |
|
|
*/ |
|
|
public void updateCacheGridTag(List<UpdateGridTagCacheDTO> gridTagCache){ |
|
|
public void updateCacheGridTag(List<UpdateGridTagCacheDTO> gridTagCache) { |
|
|
//更新 网格下 标签使用数量
|
|
|
//更新 网格下 标签使用数量
|
|
|
List<UpdateTagUseCountsResultDTO> gridTagCacheCopy = new ArrayList<>(); |
|
|
List<UpdateTagUseCountsResultDTO> gridTagCacheCopy = new ArrayList<>(); |
|
|
gridTagCache.forEach(cacheDTO -> { |
|
|
gridTagCache.forEach(cacheDTO -> { |
|
|
String gridId = cacheDTO.getGridId(); |
|
|
String gridId = cacheDTO.getGridId(); |
|
|
String key = TagConstant.GRID_TAG_KEY+gridId; |
|
|
String key = TagConstant.GRID_TAG_KEY + gridId; |
|
|
List<UpdateTagUseCountsResultDTO> tagsInfo = cacheDTO.getTagsInfo(); |
|
|
List<UpdateTagUseCountsResultDTO> tagsInfo = cacheDTO.getTagsInfo(); |
|
|
tagsInfo.forEach(resultDTO -> { |
|
|
tagsInfo.forEach(resultDTO -> { |
|
|
tagRedis.updateTagUseCounts(key,resultDTO); |
|
|
tagRedis.updateTagUseCounts(key, resultDTO); |
|
|
}); |
|
|
}); |
|
|
//级联
|
|
|
//级联
|
|
|
for (int i = 0; i < tagsInfo.size(); i++) { |
|
|
for (int i = 0; i < tagsInfo.size(); i++) { |
|
|
gridTagCacheCopy.addAll(tagsInfo); |
|
|
gridTagCacheCopy.addAll(tagsInfo); |
|
|
String moreKey = TagConstant.GRID_RETAG_KEY+gridId+TagConstant.COLON+tagsInfo.get(i).getTagId(); |
|
|
String moreKey = TagConstant.GRID_RETAG_KEY + gridId + TagConstant.COLON + tagsInfo.get(i).getTagId(); |
|
|
gridTagCacheCopy.remove(tagsInfo.get(i)); |
|
|
gridTagCacheCopy.remove(tagsInfo.get(i)); |
|
|
Set<UpdateTagUseCountsResultDTO> setTag = new HashSet<>(gridTagCacheCopy); |
|
|
Set<UpdateTagUseCountsResultDTO> setTag = new HashSet<>(gridTagCacheCopy); |
|
|
tagRedis.updateMoreTag(moreKey,setTag); |
|
|
tagRedis.updateMoreTag(moreKey, setTag); |
|
|
gridTagCacheCopy.clear(); |
|
|
gridTagCacheCopy.clear(); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Description 给文章挂标签 article_tags |
|
|
|
|
|
* @param formDto |
|
|
* @param formDto |
|
|
|
|
|
* @Description 给文章挂标签 article_tags |
|
|
* @author zxc |
|
|
* @author zxc |
|
|
*/ |
|
|
*/ |
|
|
public void addArticleTags(UpdateCustomerTagCacheDTO formDto,String draftId,TokenDto tokenDto){ |
|
|
public void addArticleTags(UpdateCustomerTagCacheDTO formDto, String draftId, TokenDto tokenDto) { |
|
|
List<AddArticleTagsFormDTO> addArticleTags = new ArrayList<>(); |
|
|
List<AddArticleTagsFormDTO> addArticleTags = new ArrayList<>(); |
|
|
List<UpdateTagUseCountsResultDTO> tagsInfo = formDto.getTagsInfo(); |
|
|
List<UpdateTagUseCountsResultDTO> tagsInfo = formDto.getTagsInfo(); |
|
|
DraftDTO draft = draftService.get(draftId); |
|
|
DraftDTO draft = draftService.get(draftId); |
|
@ -1262,7 +1264,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
addArticleTag.setUpdatedBy(userId); |
|
|
addArticleTag.setUpdatedBy(userId); |
|
|
addArticleTag.setCustomerId(customerId); |
|
|
addArticleTag.setCustomerId(customerId); |
|
|
addArticleTag.setArticleId(articleId); |
|
|
addArticleTag.setArticleId(articleId); |
|
|
BeanUtils.copyProperties(resultDTO,addArticleTag); |
|
|
BeanUtils.copyProperties(resultDTO, addArticleTag); |
|
|
addArticleTags.add(addArticleTag); |
|
|
addArticleTags.add(addArticleTag); |
|
|
}); |
|
|
}); |
|
|
articleTagsDao.addArticleTags(addArticleTags); |
|
|
articleTagsDao.addArticleTags(addArticleTags); |
|
|