|
@ -132,6 +132,8 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; |
|
|
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private ArticleTagsService articleTagsService; |
|
|
private ArticleTagsService articleTagsService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private DraftPublishRangeService draftPublishRangeService; |
|
|
|
|
|
|
|
|
@Value("${openapi.scan.server.url}") |
|
|
@Value("${openapi.scan.server.url}") |
|
|
private String scanApiUrl; |
|
|
private String scanApiUrl; |
|
@ -1341,6 +1343,9 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public List<UpdateGridTagCacheDTO> updateGridTagV2(UpdateCustomerTagCacheDTO formDto,String customerId,List<String> gridIds,String userId){ |
|
|
public List<UpdateGridTagCacheDTO> updateGridTagV2(UpdateCustomerTagCacheDTO formDto,String customerId,List<String> gridIds,String userId){ |
|
|
|
|
|
if (CollectionUtils.isEmpty(gridIds)){ |
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
|
} |
|
|
List<UpdateTagUseCountsResultDTO> tagsInfo = formDto.getTagsInfo(); |
|
|
List<UpdateTagUseCountsResultDTO> tagsInfo = formDto.getTagsInfo(); |
|
|
List<UpdateGridTagsFormDTO> gridTags = new ArrayList<>(); |
|
|
List<UpdateGridTagsFormDTO> gridTags = new ArrayList<>(); |
|
|
List<UpdateGridTagCacheDTO> gridTagCache = new ArrayList<>(); |
|
|
List<UpdateGridTagCacheDTO> gridTagCache = new ArrayList<>(); |
|
@ -1369,6 +1374,9 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
* @author zxc |
|
|
* @author zxc |
|
|
*/ |
|
|
*/ |
|
|
public void updateCacheGridTag(List<UpdateGridTagCacheDTO> gridTagCache) { |
|
|
public void updateCacheGridTag(List<UpdateGridTagCacheDTO> gridTagCache) { |
|
|
|
|
|
if (CollectionUtils.isEmpty(gridTagCache)){ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
//更新 网格下 标签使用数量
|
|
|
//更新 网格下 标签使用数量
|
|
|
List<UpdateTagUseCountsResultDTO> gridTagCacheCopy = new ArrayList<>(); |
|
|
List<UpdateTagUseCountsResultDTO> gridTagCacheCopy = new ArrayList<>(); |
|
|
gridTagCache.forEach(cacheDTO -> { |
|
|
gridTagCache.forEach(cacheDTO -> { |
|
@ -1406,6 +1414,9 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
public void addArticleTagsV2(UpdateCustomerTagCacheDTO formDto,String customerId,String articleId){ |
|
|
public void addArticleTagsV2(UpdateCustomerTagCacheDTO formDto,String customerId,String articleId){ |
|
|
List<ArticleTagsEntity> articleTags = new ArrayList<>(); |
|
|
List<ArticleTagsEntity> articleTags = new ArrayList<>(); |
|
|
List<UpdateTagUseCountsResultDTO> tagsInfo = formDto.getTagsInfo(); |
|
|
List<UpdateTagUseCountsResultDTO> tagsInfo = formDto.getTagsInfo(); |
|
|
|
|
|
if (CollectionUtils.isEmpty(tagsInfo)){ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
tagsInfo.forEach(resultDTO -> { |
|
|
tagsInfo.forEach(resultDTO -> { |
|
|
ArticleTagsEntity e = ConvertUtils.sourceToTarget(resultDTO, ArticleTagsEntity.class); |
|
|
ArticleTagsEntity e = ConvertUtils.sourceToTarget(resultDTO, ArticleTagsEntity.class); |
|
|
e.setCustomerId(customerId); |
|
|
e.setCustomerId(customerId); |
|
@ -1479,6 +1490,12 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void addOrSaveDraft(AddOrSaveDraftFormDTO formDTO) { |
|
|
public void addOrSaveDraft(AddOrSaveDraftFormDTO formDTO) { |
|
|
|
|
|
if (StringUtils.isNotBlank(formDTO.getDraftId())){ |
|
|
|
|
|
// 删除草稿,草稿内容,草稿发布范围
|
|
|
|
|
|
draftDao.deleteDraft(formDTO.getDraftId()); |
|
|
|
|
|
draftContentDao.deleteByDraftId(formDTO.getDraftId()); |
|
|
|
|
|
draftPublishRangeDao.deleteByDraftId(formDTO.getDraftId()); |
|
|
|
|
|
} |
|
|
String customerId = formDTO.getCustomerId(); |
|
|
String customerId = formDTO.getCustomerId(); |
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, formDTO.getUserId()); |
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, formDTO.getUserId()); |
|
|
if (null == staffInfo){ |
|
|
if (null == staffInfo){ |
|
@ -1492,7 +1509,6 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
if (formDTO.getType().equals(ArticleConstant.SAVE_TYPE_ARTICLE)){ |
|
|
if (formDTO.getType().equals(ArticleConstant.SAVE_TYPE_ARTICLE)){ |
|
|
// 1.文章
|
|
|
// 1.文章
|
|
|
ArticleEntity article = ConvertUtils.sourceToTarget(formDTO, ArticleEntity.class); |
|
|
ArticleEntity article = ConvertUtils.sourceToTarget(formDTO, ArticleEntity.class); |
|
|
article.setCustomerId(customerId); |
|
|
|
|
|
// 按照之前逻辑存成客户ID
|
|
|
// 按照之前逻辑存成客户ID
|
|
|
article.setDepartmentId(customerId); |
|
|
article.setDepartmentId(customerId); |
|
|
article.setStatusFlag(DraftConstant.PUBLISHED); |
|
|
article.setStatusFlag(DraftConstant.PUBLISHED); |
|
@ -1504,7 +1520,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
article.setPreviewContent(formDTO.getContent().length() > DraftConstant.PREVIEW_CONTENT_MAX_LENGTH ? formDTO.getContent().substring(NumConstant.ZERO,DraftConstant.PREVIEW_CONTENT_MAX_LENGTH) : formDTO.getContent()); |
|
|
article.setPreviewContent(formDTO.getContent().length() > DraftConstant.PREVIEW_CONTENT_MAX_LENGTH ? formDTO.getContent().substring(NumConstant.ZERO,DraftConstant.PREVIEW_CONTENT_MAX_LENGTH) : formDTO.getContent()); |
|
|
article.setPublishDate(DateUtils.stringToDate(formDTO.getPublishDate(),DateUtils.DATE_PATTERN)); |
|
|
article.setPublishDate(DateUtils.stringToDate(formDTO.getPublishDate(),DateUtils.DATE_PATTERN)); |
|
|
article.setPublisherId(formDTO.getPublisher()); |
|
|
article.setPublisherId(formDTO.getPublisher()); |
|
|
article.setPublishRangeDesc(formDTO.getPublishRangeDesc().stream().collect(Collectors.joining("、"))); |
|
|
article.setPublishRangeDesc(CollectionUtils.isEmpty(formDTO.getPublishRangeDesc()) ? "" : formDTO.getPublishRangeDesc().stream().collect(Collectors.joining("、"))); |
|
|
article.setTags(CollectionUtils.isEmpty(formDTO.getTagNameList()) ? "" : formDTO.getTagNameList().stream().collect(Collectors.joining("|"))); |
|
|
article.setTags(CollectionUtils.isEmpty(formDTO.getTagNameList()) ? "" : formDTO.getTagNameList().stream().collect(Collectors.joining("|"))); |
|
|
article.setOrgId(staffInfo.getAgencyId()); |
|
|
article.setOrgId(staffInfo.getAgencyId()); |
|
|
article.setOrgIdPath(StringUtils.isBlank(agencyInfo.getPids()) || agencyInfo.getPids().equals(NumConstant.ZERO_STR) ? agencyInfo.getId() : agencyInfo.getPids().concat(":").concat(agencyInfo.getId())); |
|
|
article.setOrgIdPath(StringUtils.isBlank(agencyInfo.getPids()) || agencyInfo.getPids().equals(NumConstant.ZERO_STR) ? agencyInfo.getId() : agencyInfo.getPids().concat(":").concat(agencyInfo.getId())); |
|
@ -1522,30 +1538,32 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
ArticleOperateRecordEntity articleOperateRecord = new ArticleOperateRecordEntity(); |
|
|
ArticleOperateRecordEntity articleOperateRecord = new ArticleOperateRecordEntity(); |
|
|
articleOperateRecord.setCustomerId(customerId); |
|
|
articleOperateRecord.setCustomerId(customerId); |
|
|
articleOperateRecord.setArticleId(article.getId()); |
|
|
articleOperateRecord.setArticleId(article.getId()); |
|
|
articleOperateRecord.setGridIds(formDTO.getGridIdList().stream().collect(Collectors.joining(":"))); |
|
|
articleOperateRecord.setGridIds(CollectionUtils.isEmpty(formDTO.getGridIdList()) ? "" : formDTO.getGridIdList().stream().collect(Collectors.joining(":"))); |
|
|
articleOperateRecord.setOpUser(staffInfo.getAgencyName().concat("-").concat(staffInfo.getRealName())); |
|
|
articleOperateRecord.setOpUser(staffInfo.getAgencyName().concat("-").concat(staffInfo.getRealName())); |
|
|
articleOperateRecord.setContent(formDTO.getContent()); |
|
|
articleOperateRecord.setContent(formDTO.getContent()); |
|
|
articleOperateRecord.setOpType(ArticleConstant.PUBLISH); |
|
|
articleOperateRecord.setOpType(ArticleConstant.PUBLISH); |
|
|
articleOperateRecord.setOpTime(new Date()); |
|
|
articleOperateRecord.setOpTime(new Date()); |
|
|
articleOperateRecordService.insert(articleOperateRecord); |
|
|
articleOperateRecordService.insert(articleOperateRecord); |
|
|
// 4.发布范围
|
|
|
// 4.发布范围
|
|
|
List<ArticlePublishRangeEntity> rangeList = new ArrayList<>(); |
|
|
if (!CollectionUtils.isEmpty(formDTO.getGridIdList())){ |
|
|
formDTO.getGridIdList().forEach(g -> { |
|
|
List<ArticlePublishRangeEntity> rangeList = new ArrayList<>(); |
|
|
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(g); |
|
|
formDTO.getGridIdList().forEach(g -> { |
|
|
if (null == gridInfo){ |
|
|
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(g); |
|
|
throw new EpmetException("未查询到网格信息:"+g); |
|
|
if (null == gridInfo){ |
|
|
} |
|
|
throw new EpmetException("未查询到网格信息:"+g); |
|
|
ArticlePublishRangeEntity articlePublishRange = ConvertUtils.sourceToTarget(gridInfo,ArticlePublishRangeEntity.class); |
|
|
} |
|
|
articlePublishRange.setCustomerId(customerId); |
|
|
ArticlePublishRangeEntity articlePublishRange = ConvertUtils.sourceToTarget(gridInfo,ArticlePublishRangeEntity.class); |
|
|
articlePublishRange.setArticleId(article.getId()); |
|
|
articlePublishRange.setCustomerId(customerId); |
|
|
articlePublishRange.setGridId(g); |
|
|
articlePublishRange.setArticleId(article.getId()); |
|
|
articlePublishRange.setAgencyGridName(gridInfo.getGridNamePath()); |
|
|
articlePublishRange.setGridId(g); |
|
|
articlePublishRange.setAgencyId(gridInfo.getPid()); |
|
|
articlePublishRange.setAgencyGridName(gridInfo.getGridNamePath()); |
|
|
articlePublishRange.setPublishStatus(ArticleConstant.PUBLISHED); |
|
|
articlePublishRange.setAgencyId(gridInfo.getPid()); |
|
|
articlePublishRange.setId(null); |
|
|
articlePublishRange.setPublishStatus(ArticleConstant.PUBLISHED); |
|
|
rangeList.add(articlePublishRange); |
|
|
articlePublishRange.setId(null); |
|
|
}); |
|
|
rangeList.add(articlePublishRange); |
|
|
articlePublishRangeService.insertBatch(rangeList); |
|
|
}); |
|
|
|
|
|
articlePublishRangeService.insertBatch(rangeList); |
|
|
|
|
|
} |
|
|
// 5.文章标签
|
|
|
// 5.文章标签
|
|
|
UpdateCustomerTagCacheDTO updateCustomerTagCacheDTO = updateCustomerTagV2(formDTO.getUserId(), formDTO.getCustomerId(), article.getTags()); |
|
|
UpdateCustomerTagCacheDTO updateCustomerTagCacheDTO = updateCustomerTagV2(formDTO.getUserId(), formDTO.getCustomerId(), article.getTags()); |
|
|
addArticleTagsV2(updateCustomerTagCacheDTO,customerId,article.getId()); |
|
|
addArticleTagsV2(updateCustomerTagCacheDTO,customerId,article.getId()); |
|
@ -1560,7 +1578,51 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit |
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); |
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); |
|
|
} |
|
|
} |
|
|
}else {// 存草稿
|
|
|
}else {// 存草稿
|
|
|
|
|
|
// 1.草稿
|
|
|
|
|
|
DraftEntity draft = ConvertUtils.sourceToTarget(formDTO, DraftEntity.class); |
|
|
|
|
|
draft.setDepartmentId(customerId); |
|
|
|
|
|
draft.setTitleAuditStatus(ArticleConstant.AUDIT_WAY_NO_AUDIT); |
|
|
|
|
|
draft.setPreviewContent(formDTO.getContent().length() > DraftConstant.PREVIEW_CONTENT_MAX_LENGTH ? formDTO.getContent().substring(NumConstant.ZERO,DraftConstant.PREVIEW_CONTENT_MAX_LENGTH) : formDTO.getContent()); |
|
|
|
|
|
draft.setPublishRangeDesc(CollectionUtils.isEmpty(formDTO.getPublishRangeDesc()) ? "" : formDTO.getPublishRangeDesc().stream().collect(Collectors.joining("、"))); |
|
|
|
|
|
draft.setPublisherId(formDTO.getPublisher()); |
|
|
|
|
|
draft.setPublishDate(DateUtils.stringToDate(formDTO.getPublishDate(),DateUtils.DATE_PATTERN)); |
|
|
|
|
|
draft.setTags(CollectionUtils.isEmpty(formDTO.getTagNameList()) ? "" : formDTO.getTagNameList().stream().collect(Collectors.joining("|"))); |
|
|
|
|
|
draft.setOrgId(staffInfo.getAgencyId()); |
|
|
|
|
|
draft.setOrgIdPath(StringUtils.isBlank(agencyInfo.getPids()) || agencyInfo.getPids().equals(NumConstant.ZERO_STR) ? agencyInfo.getId() : agencyInfo.getPids().concat(":").concat(agencyInfo.getId())); |
|
|
|
|
|
if (formDTO.getPublisherType().equals(DraftConstant.GRID)){ |
|
|
|
|
|
draft.setGridId(formDTO.getPublisher()); |
|
|
|
|
|
} |
|
|
|
|
|
draft.setStatusFlag(DraftConstant.UNPUBLISH); |
|
|
|
|
|
draftDao.insert(draft); |
|
|
|
|
|
// 2.内容
|
|
|
|
|
|
DraftContentEntity draftContent = ConvertUtils.sourceToTarget(draft, DraftContentEntity.class); |
|
|
|
|
|
draftContent.setCustomerId(customerId); |
|
|
|
|
|
draftContent.setDraftId(draft.getId()); |
|
|
|
|
|
draftContent.setContent(formDTO.getContent()); |
|
|
|
|
|
draftContent.setContentType("rich_text"); |
|
|
|
|
|
draftContent.setAuditStatus(ArticleConstant.AUDIT_WAY_NO_AUDIT); |
|
|
|
|
|
draftContent.setOrderNum(NumConstant.ZERO); |
|
|
|
|
|
draftContentDao.insert(draftContent); |
|
|
|
|
|
// 3.发布范围
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(formDTO.getGridIdList())){ |
|
|
|
|
|
List<DraftPublishRangeEntity> rangeList = new ArrayList<>(); |
|
|
|
|
|
formDTO.getGridIdList().forEach(g -> { |
|
|
|
|
|
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(g); |
|
|
|
|
|
if (null == gridInfo){ |
|
|
|
|
|
throw new EpmetException("未查询到网格信息:"+g); |
|
|
|
|
|
} |
|
|
|
|
|
DraftPublishRangeEntity draftPublishRange = ConvertUtils.sourceToTarget(gridInfo,DraftPublishRangeEntity.class); |
|
|
|
|
|
draftPublishRange.setCustomerId(customerId); |
|
|
|
|
|
draftPublishRange.setDraftId(draft.getId()); |
|
|
|
|
|
draftPublishRange.setGridId(g); |
|
|
|
|
|
draftPublishRange.setAgencyGridName(gridInfo.getGridNamePath()); |
|
|
|
|
|
draftPublishRange.setAgencyId(gridInfo.getPid()); |
|
|
|
|
|
draftPublishRange.setPublishStatus(ArticleConstant.PUBLISHED); |
|
|
|
|
|
draftPublishRange.setId(null); |
|
|
|
|
|
rangeList.add(draftPublishRange); |
|
|
|
|
|
}); |
|
|
|
|
|
draftPublishRangeService.insertBatch(rangeList); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|