|
|
@ -52,308 +52,330 @@ import java.util.List; |
|
|
|
@RestController |
|
|
|
@RequestMapping("article") |
|
|
|
public class ArticleController { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ArticleService articleService; |
|
|
|
@Autowired |
|
|
|
private ArticleOperateRecordService articleOperateRecordService; |
|
|
|
@Autowired |
|
|
|
private DraftService draftService; |
|
|
|
|
|
|
|
/** |
|
|
|
* @param tokenDTO |
|
|
|
* @return |
|
|
|
* @Author sun |
|
|
|
* @Description 党建声音-政府端-可选发布范围 |
|
|
|
**/ |
|
|
|
@PostMapping("agencygridlist") |
|
|
|
public Result<ArticleAgencyGridListResultDTO> agencyGridList(@LoginUser TokenDto tokenDTO) { |
|
|
|
ArticleAgencyGridListResultDTO agencyGridList = new ArticleAgencyGridListResultDTO(); |
|
|
|
agencyGridList.setAgencyGridList(articleService.agencyGridList(tokenDTO)); |
|
|
|
return new Result<ArticleAgencyGridListResultDTO>().ok(agencyGridList); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* desc:政府端-点击返回按钮时,点击保存草稿 无需校验参数 |
|
|
|
* @param fromDTO |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
@PostMapping("savedraft") |
|
|
|
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH) |
|
|
|
public Result<DraftContentSaveResultDTO> savedraft(@LoginUser TokenDto tokenDto,@RequestBody DraftContentFromDTO fromDTO) throws Exception { |
|
|
|
DraftContentSaveResultDTO draftDTO = articleService.saveDraft(tokenDto, fromDTO); |
|
|
|
return new Result<DraftContentSaveResultDTO>().ok(draftDTO); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* desc:保存或修改草稿内容 |
|
|
|
* @param fromDTO |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
@PostMapping("savecontent") |
|
|
|
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH) |
|
|
|
public Result<DraftContentSaveResultDTO> saveOrUpdateContent(@LoginUser TokenDto tokenDto,@RequestBody DraftContentFromDTO fromDTO) throws Exception { |
|
|
|
DraftContentSaveResultDTO resultDTO = articleService.saveOrUpdateContent(tokenDto, fromDTO, true); |
|
|
|
return new Result<DraftContentSaveResultDTO>().ok(resultDTO); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.form.ArticleOperationResultDTO>> |
|
|
|
* @author yinzuomei@elink-cn.com |
|
|
|
* @description 政府端:查询文章操作记录 |
|
|
|
* @date 2020/6/2 16:50 |
|
|
|
**/ |
|
|
|
@PostMapping("oprationlist") |
|
|
|
public Result<List<ArticleOperationResultDTO>> operationList(@RequestBody ArticleOperationFormDTO formDTO) { |
|
|
|
ValidatorUtils.validateEntity(formDTO, ArticleOperationFormDTO.AddUserInternalGroup.class); |
|
|
|
List<ArticleOperationResultDTO> list = |
|
|
|
articleOperateRecordService.listOfArticleOperation(formDTO.getArticleId()); |
|
|
|
return new Result<List<ArticleOperationResultDTO>>().ok(list); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.GovArticleDetailResultDTO> |
|
|
|
* @author yinzuomei@elink-cn.com |
|
|
|
* @description 政府端:(已发布、已下线)文章详情 |
|
|
|
* @date 2020/6/3 9:44 |
|
|
|
**/ |
|
|
|
@PostMapping("articledetail") |
|
|
|
public Result<GovArticleDetailResultDTO> articleDetail(@RequestBody GovArticleDetailFormDTO formDTO) { |
|
|
|
ValidatorUtils.validateEntity(formDTO, GovArticleDetailFormDTO.AddUserInternalGroup.class); |
|
|
|
GovArticleDetailResultDTO articleDetail = articleService.queryGovArticleDetail(formDTO.getArticleId()); |
|
|
|
return new Result<GovArticleDetailResultDTO>().ok(articleDetail); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO 草稿id |
|
|
|
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.DraftContentResultDTO> |
|
|
|
* @author yinzuomei@elink-cn.com |
|
|
|
* @description 政府端:选中草稿编辑,获取草稿内容 |
|
|
|
* @date 2020/6/3 13:18 |
|
|
|
**/ |
|
|
|
@PostMapping("getcontent") |
|
|
|
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_DRAFT_EDIT) |
|
|
|
public Result<DraftContentResultDTO> getContent(@RequestBody DraftDetailFormDTO formDTO){ |
|
|
|
ValidatorUtils.validateEntity(formDTO, GovArticleDetailFormDTO.AddUserInternalGroup.class); |
|
|
|
DraftContentResultDTO draftContent=draftService.queryDraftContent(formDTO); |
|
|
|
return new Result<DraftContentResultDTO>().ok(draftContent); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return com.epmet.commons.tools.utils.Result |
|
|
|
* @author yinzuomei@elink-cn.com |
|
|
|
* @description 政府端:选中草稿编辑,获取草稿属性 |
|
|
|
* @date 2020/6/3 13:51 |
|
|
|
**/ |
|
|
|
@PostMapping("getattr") |
|
|
|
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_DRAFT_EDIT) |
|
|
|
public Result<DraftAttrResultDTO> getAttr(@RequestBody DraftDetailFormDTO formDTO) { |
|
|
|
ValidatorUtils.validateEntity(formDTO, GovArticleDetailFormDTO.AddUserInternalGroup.class); |
|
|
|
DraftAttrResultDTO draftAttrResultDTO=draftService.getDraftAttr(formDTO); |
|
|
|
return new Result<DraftAttrResultDTO>().ok(draftAttrResultDTO); |
|
|
|
} |
|
|
|
/** |
|
|
|
* @param tokenDTO |
|
|
|
* @return |
|
|
|
* @Author sun |
|
|
|
* @Description 党建声音-政府端-可选发布单位 |
|
|
|
**/ |
|
|
|
@PostMapping("publishagencylist") |
|
|
|
public Result<PublishAgencyListResultDTO> publishAgencyList(@LoginUser TokenDto tokenDTO) { |
|
|
|
return new Result<PublishAgencyListResultDTO>().ok(articleService.publishAgencyList(tokenDTO)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param tokenDTO formDTO |
|
|
|
* @return |
|
|
|
* @Author sun |
|
|
|
* @Description 党建声音-政府端-下线文章 |
|
|
|
**/ |
|
|
|
@PostMapping("offlinearticle") |
|
|
|
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_OFFLINE) |
|
|
|
public Result offLineArticle(@LoginUser TokenDto tokenDTO, @RequestBody OffLineArticleFormDTO formDTO) { |
|
|
|
formDTO.setStaffId(tokenDTO.getUserId()); |
|
|
|
ValidatorUtils.validateEntity(formDTO, OffLineArticleFormDTO.AddUserInternalGroup.class); |
|
|
|
articleService.offLineArticle(formDTO); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* desc:保存草稿属性 |
|
|
|
* @param fromDTO |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
@PostMapping("saveattr") |
|
|
|
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH) |
|
|
|
public Result<Boolean> saveDraftAttr(@LoginUser TokenDto tokenDto,@RequestBody DraftAttrFromDTO fromDTO) throws Exception { |
|
|
|
ValidatorUtils.validateEntity(fromDTO, DefaultGroup.class); |
|
|
|
Boolean isSuccess = articleService.saveDraftAttr(tokenDto, fromDTO); |
|
|
|
return new Result<Boolean>().ok(isSuccess); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* desc:预览保存草稿属性 |
|
|
|
* @param fromDTO |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
@PostMapping("previewsaveattr") |
|
|
|
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH) |
|
|
|
public Result<Boolean> previewSaveDraftAttr(@LoginUser TokenDto tokenDto,@RequestBody DraftAttrFromDTO fromDTO) throws Exception { |
|
|
|
ValidatorUtils.validateEntity(fromDTO, DefaultGroup.class); |
|
|
|
Boolean isSuccess = articleService.previewSaveDraftAttr(tokenDto, fromDTO); |
|
|
|
return new Result<Boolean>().ok(isSuccess); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* desc:发布文章 |
|
|
|
* @param formDTO |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
@PostMapping("publish") |
|
|
|
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH) |
|
|
|
public Result<Boolean> publishArticle(@LoginUser TokenDto tokenDto, @RequestBody PublishArticleFormDTO formDTO) throws Exception { |
|
|
|
Boolean isSuccess = articleService.publish(tokenDto, formDTO.getDraftId()); |
|
|
|
if (isSuccess) { |
|
|
|
scanContent(tokenDto, formDTO.getDraftId()); |
|
|
|
} |
|
|
|
return new Result<Boolean>().ok(isSuccess); |
|
|
|
} |
|
|
|
|
|
|
|
@Async |
|
|
|
public void scanContent(TokenDto tokenDto,String draftId){ |
|
|
|
try { |
|
|
|
SyncScanResult syncScanResult = articleService.scanContent(tokenDto, draftId); |
|
|
|
if (syncScanResult == null) { |
|
|
|
log.error("scanContent draftId:{} return result null", draftId); |
|
|
|
} |
|
|
|
|
|
|
|
if (syncScanResult.isAllPass()) { |
|
|
|
articleService.scanAllPassPublishArticle(tokenDto, draftId, syncScanResult); |
|
|
|
} else { |
|
|
|
articleService.updateAuditStatusFailById(draftId, syncScanResult); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
articleService.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL); |
|
|
|
log.error("scanContent exception draftId:{} return result null", e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 已发布文章列表 |
|
|
|
* @author zhaoqifeng |
|
|
|
* @date 2020/6/3 16:19 |
|
|
|
* @param tokenDto |
|
|
|
* @param formDTO |
|
|
|
* @return com.epmet.commons.tools.utils.Result<com.epmet.commons.tools.page.PageData> |
|
|
|
*/ |
|
|
|
@PostMapping("publishedarticlelist") |
|
|
|
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISHED_LIST) |
|
|
|
public Result<List<PublishedListResultDTO>> publishedArticleList(@LoginUser TokenDto tokenDto, @RequestBody PublishedListFormDTO formDTO) { |
|
|
|
ValidatorUtils.validateEntity(formDTO); |
|
|
|
List<PublishedListResultDTO> list = articleService.publishedArticleList(tokenDto, formDTO).getList(); |
|
|
|
return new Result<List<PublishedListResultDTO>>().ok(list); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 已下线文章列表 |
|
|
|
* @author zhaoqifeng |
|
|
|
* @date 2020/6/3 16:19 |
|
|
|
* @param tokenDto |
|
|
|
* @param formDTO |
|
|
|
* @return com.epmet.commons.tools.utils.Result<com.epmet.commons.tools.page.PageData> |
|
|
|
*/ |
|
|
|
@PostMapping("offlinearticlelist") |
|
|
|
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_OFFLINE_LIST) |
|
|
|
public Result<List<OfflineListResultDTO> > offLineList(@LoginUser TokenDto tokenDto, @RequestBody OfflineListFormDTO formDTO) { |
|
|
|
ValidatorUtils.validateEntity(formDTO); |
|
|
|
List<OfflineListResultDTO> list = articleService.offlineList(tokenDto, formDTO).getList(); |
|
|
|
return new Result<List<OfflineListResultDTO> >().ok(list); |
|
|
|
} |
|
|
|
/** |
|
|
|
* @Description 根据网格Id查找置顶文章的相关信息列表 用处:居民端首页轮播 |
|
|
|
* @param commonArticleListFormDTO :: getGridId :: getNum |
|
|
|
* @return List<ArticleBannerResultDTO> |
|
|
|
* @author wangc |
|
|
|
* @date 2020.06.02 16:13 |
|
|
|
**/ |
|
|
|
@PostMapping("resitoparticlelist") |
|
|
|
public Result<List<ArticleBannerResultDTO>> resiTopArticleList(@RequestBody CommonArticleListFormDTO commonArticleListFormDTO){ |
|
|
|
ValidatorUtils.validateEntity(commonArticleListFormDTO, CommonArticleListFormDTO.ArticleBannerInternalGroup.class); |
|
|
|
return new Result<List<ArticleBannerResultDTO>>().ok(articleService.getTopArticleList(commonArticleListFormDTO)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 根据网格Id查找最新文章的相关信息列表 用处:居民端首页最新文章列表 |
|
|
|
* @param commonArticleListFormDTO :: getGridId :: getNum |
|
|
|
* @return List<ArticleLatestResultDTO> |
|
|
|
* @author wangc |
|
|
|
* @date 2020.06.03 09:53 |
|
|
|
**/ |
|
|
|
@PostMapping("resilatestarticlelist") |
|
|
|
public Result<List<ArticleLatestResultDTO>> resiLatestArticleList(@RequestBody CommonArticleListFormDTO commonArticleListFormDTO){ |
|
|
|
ValidatorUtils.validateEntity(commonArticleListFormDTO, CommonArticleListFormDTO.ArticleBannerInternalGroup.class); |
|
|
|
return new Result<List<ArticleLatestResultDTO>>().ok(articleService.getLatestArticleList(commonArticleListFormDTO)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 根据网格Id和标签列表查找文章的相关信息列表 用处:居民端党建声音列表 |
|
|
|
* @param articlePageFormDTO |
|
|
|
* @return List<ArticleListResultDTO> |
|
|
|
* @author wangc |
|
|
|
* @date 2020.06.03 14:19 |
|
|
|
**/ |
|
|
|
@PostMapping("resiarticlelist") |
|
|
|
public Result<List<ArticleListResultDTO>> resiArticleList(@RequestBody ArticlePageFormDTO articlePageFormDTO){ |
|
|
|
ValidatorUtils.validateEntity(articlePageFormDTO,ArticlePageFormDTO.ArticlePageInternalGroup.class); |
|
|
|
return new Result<List<ArticleListResultDTO>>().ok(articleService.getArticleList(articlePageFormDTO)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param tokenDTO formDTO |
|
|
|
* @return |
|
|
|
* @Author sun |
|
|
|
* @Description 党建声音-政府端-可下线网格列表 |
|
|
|
**/ |
|
|
|
@PostMapping("publishgridlist") |
|
|
|
public Result<ArticleAgencyGridListResultDTO> publishGridList(@LoginUser TokenDto tokenDTO, @RequestBody PublishGridListFormDTO formDTO) { |
|
|
|
formDTO.setStaffId(tokenDTO.getUserId()); |
|
|
|
ValidatorUtils.validateEntity(formDTO, PublishGridListFormDTO.AddUserInternalGroup.class); |
|
|
|
ArticleAgencyGridListResultDTO agencyGridList = new ArticleAgencyGridListResultDTO(); |
|
|
|
agencyGridList.setAgencyGridList(articleService.publishGridList(formDTO)); |
|
|
|
return new Result<ArticleAgencyGridListResultDTO>().ok(agencyGridList); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 根绝文章Id查询出文章的内容、封面等相关信息,如果居民端传入的网格Id不在该文章的发布范围内,则返回NULL |
|
|
|
* @param articleDetailFormDTO |
|
|
|
* @return ArticleDetailResultDTO |
|
|
|
* @author wangc |
|
|
|
* @date 2020.06.03 18:28 |
|
|
|
**/ |
|
|
|
@PostMapping("resiarticledetail") |
|
|
|
public Result<ArticleDetailResultDTO> resiArticleDetail(@RequestBody ResiArticleDetailFormDTO articleDetailFormDTO){ |
|
|
|
ValidatorUtils.validateEntity(articleDetailFormDTO,ResiArticleDetailFormDTO.ResiArticleDetailInternalGroup.class); |
|
|
|
return new Result<ArticleDetailResultDTO>().ok(articleService.getArticleDetail(articleDetailFormDTO)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.DraftDetailResultDTO> |
|
|
|
* @author yinzuomei@elink-cn.com |
|
|
|
* @description 政府端:文章预览 |
|
|
|
* @date 2020/6/5 10:56 |
|
|
|
**/ |
|
|
|
@PostMapping("draftdetail") |
|
|
|
public Result<DraftDetailResultDTO> queryDraftDetail(@RequestBody DraftDetailFormDTO formDTO) { |
|
|
|
ValidatorUtils.validateEntity(formDTO, GovArticleDetailFormDTO.AddUserInternalGroup.class); |
|
|
|
DraftDetailResultDTO draftDetailResultDTO = draftService.queryDraftDetail(formDTO); |
|
|
|
return new Result<DraftDetailResultDTO>().ok(draftDetailResultDTO); |
|
|
|
} |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ArticleService articleService; |
|
|
|
@Autowired |
|
|
|
private ArticleOperateRecordService articleOperateRecordService; |
|
|
|
@Autowired |
|
|
|
private DraftService draftService; |
|
|
|
|
|
|
|
/** |
|
|
|
* @param tokenDTO |
|
|
|
* @return |
|
|
|
* @Author sun |
|
|
|
* @Description 党建声音-政府端-可选发布范围 |
|
|
|
**/ |
|
|
|
@PostMapping("agencygridlist") |
|
|
|
public Result<ArticleAgencyGridListResultDTO> agencyGridList(@LoginUser TokenDto tokenDTO) { |
|
|
|
ArticleAgencyGridListResultDTO agencyGridList = new ArticleAgencyGridListResultDTO(); |
|
|
|
agencyGridList.setAgencyGridList(articleService.agencyGridList(tokenDTO)); |
|
|
|
return new Result<ArticleAgencyGridListResultDTO>().ok(agencyGridList); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* desc:政府端-点击返回按钮时,点击保存草稿 无需校验参数 |
|
|
|
* |
|
|
|
* @param fromDTO |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
@PostMapping("savedraft") |
|
|
|
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH) |
|
|
|
public Result<DraftContentSaveResultDTO> savedraft(@LoginUser TokenDto tokenDto, @RequestBody DraftContentFromDTO fromDTO) throws Exception { |
|
|
|
DraftContentSaveResultDTO draftDTO = articleService.saveDraft(tokenDto, fromDTO); |
|
|
|
return new Result<DraftContentSaveResultDTO>().ok(draftDTO); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* desc:保存或修改草稿内容 |
|
|
|
* |
|
|
|
* @param fromDTO |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
@PostMapping("savecontent") |
|
|
|
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH) |
|
|
|
public Result<DraftContentSaveResultDTO> saveOrUpdateContent(@LoginUser TokenDto tokenDto, @RequestBody DraftContentFromDTO fromDTO) throws Exception { |
|
|
|
DraftContentSaveResultDTO resultDTO = articleService.saveOrUpdateContent(tokenDto, fromDTO, true); |
|
|
|
return new Result<DraftContentSaveResultDTO>().ok(resultDTO); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.dto.form.ArticleOperationResultDTO>> |
|
|
|
* @author yinzuomei@elink-cn.com |
|
|
|
* @description 政府端:查询文章操作记录 |
|
|
|
* @date 2020/6/2 16:50 |
|
|
|
**/ |
|
|
|
@PostMapping("oprationlist") |
|
|
|
public Result<List<ArticleOperationResultDTO>> operationList(@RequestBody ArticleOperationFormDTO formDTO) { |
|
|
|
ValidatorUtils.validateEntity(formDTO, ArticleOperationFormDTO.AddUserInternalGroup.class); |
|
|
|
List<ArticleOperationResultDTO> list = |
|
|
|
articleOperateRecordService.listOfArticleOperation(formDTO.getArticleId()); |
|
|
|
return new Result<List<ArticleOperationResultDTO>>().ok(list); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.GovArticleDetailResultDTO> |
|
|
|
* @author yinzuomei@elink-cn.com |
|
|
|
* @description 政府端:(已发布、已下线)文章详情 |
|
|
|
* @date 2020/6/3 9:44 |
|
|
|
**/ |
|
|
|
@PostMapping("articledetail") |
|
|
|
public Result<GovArticleDetailResultDTO> articleDetail(@RequestBody GovArticleDetailFormDTO formDTO) { |
|
|
|
ValidatorUtils.validateEntity(formDTO, GovArticleDetailFormDTO.AddUserInternalGroup.class); |
|
|
|
GovArticleDetailResultDTO articleDetail = articleService.queryGovArticleDetail(formDTO.getArticleId()); |
|
|
|
return new Result<GovArticleDetailResultDTO>().ok(articleDetail); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO 草稿id |
|
|
|
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.DraftContentResultDTO> |
|
|
|
* @author yinzuomei@elink-cn.com |
|
|
|
* @description 政府端:选中草稿编辑,获取草稿内容 |
|
|
|
* @date 2020/6/3 13:18 |
|
|
|
**/ |
|
|
|
@PostMapping("getcontent") |
|
|
|
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_DRAFT_EDIT) |
|
|
|
public Result<DraftContentResultDTO> getContent(@RequestBody DraftDetailFormDTO formDTO) { |
|
|
|
ValidatorUtils.validateEntity(formDTO, GovArticleDetailFormDTO.AddUserInternalGroup.class); |
|
|
|
DraftContentResultDTO draftContent = draftService.queryDraftContent(formDTO); |
|
|
|
return new Result<DraftContentResultDTO>().ok(draftContent); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return com.epmet.commons.tools.utils.Result |
|
|
|
* @author yinzuomei@elink-cn.com |
|
|
|
* @description 政府端:选中草稿编辑,获取草稿属性 |
|
|
|
* @date 2020/6/3 13:51 |
|
|
|
**/ |
|
|
|
@PostMapping("getattr") |
|
|
|
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_DRAFT_EDIT) |
|
|
|
public Result<DraftAttrResultDTO> getAttr(@RequestBody DraftDetailFormDTO formDTO) { |
|
|
|
ValidatorUtils.validateEntity(formDTO, GovArticleDetailFormDTO.AddUserInternalGroup.class); |
|
|
|
DraftAttrResultDTO draftAttrResultDTO = draftService.getDraftAttr(formDTO); |
|
|
|
return new Result<DraftAttrResultDTO>().ok(draftAttrResultDTO); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param tokenDTO |
|
|
|
* @return |
|
|
|
* @Author sun |
|
|
|
* @Description 党建声音-政府端-可选发布单位 |
|
|
|
**/ |
|
|
|
@PostMapping("publishagencylist") |
|
|
|
public Result<PublishAgencyListResultDTO> publishAgencyList(@LoginUser TokenDto tokenDTO) { |
|
|
|
return new Result<PublishAgencyListResultDTO>().ok(articleService.publishAgencyList(tokenDTO)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param tokenDTO formDTO |
|
|
|
* @return |
|
|
|
* @Author sun |
|
|
|
* @Description 党建声音-政府端-下线文章 |
|
|
|
**/ |
|
|
|
@PostMapping("offlinearticle") |
|
|
|
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_OFFLINE) |
|
|
|
public Result offLineArticle(@LoginUser TokenDto tokenDTO, @RequestBody OffLineArticleFormDTO formDTO) { |
|
|
|
formDTO.setStaffId(tokenDTO.getUserId()); |
|
|
|
ValidatorUtils.validateEntity(formDTO, OffLineArticleFormDTO.AddUserInternalGroup.class); |
|
|
|
articleService.offLineArticle(formDTO); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* desc:保存草稿属性 |
|
|
|
* |
|
|
|
* @param fromDTO |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
@PostMapping("saveattr") |
|
|
|
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH) |
|
|
|
public Result<Boolean> saveDraftAttr(@LoginUser TokenDto tokenDto, @RequestBody DraftAttrFromDTO fromDTO) throws Exception { |
|
|
|
ValidatorUtils.validateEntity(fromDTO, DefaultGroup.class); |
|
|
|
Boolean isSuccess = articleService.saveDraftAttr(tokenDto, fromDTO); |
|
|
|
return new Result<Boolean>().ok(isSuccess); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* desc:预览保存草稿属性 |
|
|
|
* |
|
|
|
* @param fromDTO |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
@PostMapping("previewsaveattr") |
|
|
|
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH) |
|
|
|
public Result<Boolean> previewSaveDraftAttr(@LoginUser TokenDto tokenDto, @RequestBody DraftAttrFromDTO fromDTO) throws Exception { |
|
|
|
ValidatorUtils.validateEntity(fromDTO, DefaultGroup.class); |
|
|
|
Boolean isSuccess = articleService.previewSaveDraftAttr(tokenDto, fromDTO); |
|
|
|
return new Result<Boolean>().ok(isSuccess); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* desc:发布文章 |
|
|
|
* |
|
|
|
* @param formDTO |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
@PostMapping("publish") |
|
|
|
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH) |
|
|
|
public Result<Boolean> publishArticle(@LoginUser TokenDto tokenDto, @RequestBody PublishArticleFormDTO formDTO) throws Exception { |
|
|
|
Boolean isSuccess = articleService.publish(tokenDto, formDTO.getDraftId()); |
|
|
|
if (isSuccess) { |
|
|
|
scanContent(tokenDto, formDTO.getDraftId()); |
|
|
|
} |
|
|
|
return new Result<Boolean>().ok(isSuccess); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* desc:人工确认无误后发布文章,不走审核接口 |
|
|
|
* |
|
|
|
* @param formDTO |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
@PostMapping("manualpublish") |
|
|
|
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH) |
|
|
|
public Result<Boolean> manualPublish(@LoginUser TokenDto tokenDto, @RequestBody PublishArticleFormDTO formDTO) throws Exception { |
|
|
|
articleService.manualPublish(tokenDto, formDTO.getDraftId()); |
|
|
|
return new Result<Boolean>().ok(true); |
|
|
|
} |
|
|
|
|
|
|
|
@Async |
|
|
|
public void scanContent(TokenDto tokenDto, String draftId) { |
|
|
|
try { |
|
|
|
SyncScanResult syncScanResult = articleService.scanContent(tokenDto, draftId); |
|
|
|
if (syncScanResult == null) { |
|
|
|
log.error("scanContent draftId:{} return result null", draftId); |
|
|
|
} |
|
|
|
|
|
|
|
if (syncScanResult.isAllPass()) { |
|
|
|
articleService.scanAllPassPublishArticle(tokenDto, draftId, syncScanResult); |
|
|
|
} else { |
|
|
|
articleService.updateAuditStatusFailById(draftId, syncScanResult); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
articleService.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL); |
|
|
|
log.error("scanContent exception draftId:{} return result null", e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 已发布文章列表 |
|
|
|
* |
|
|
|
* @param tokenDto |
|
|
|
* @param formDTO |
|
|
|
* @return com.epmet.commons.tools.utils.Result<com.epmet.commons.tools.page.PageData> |
|
|
|
* @author zhaoqifeng |
|
|
|
* @date 2020/6/3 16:19 |
|
|
|
*/ |
|
|
|
@PostMapping("publishedarticlelist") |
|
|
|
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISHED_LIST) |
|
|
|
public Result<List<PublishedListResultDTO>> publishedArticleList(@LoginUser TokenDto tokenDto, @RequestBody PublishedListFormDTO formDTO) { |
|
|
|
ValidatorUtils.validateEntity(formDTO); |
|
|
|
List<PublishedListResultDTO> list = articleService.publishedArticleList(tokenDto, formDTO).getList(); |
|
|
|
return new Result<List<PublishedListResultDTO>>().ok(list); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 已下线文章列表 |
|
|
|
* |
|
|
|
* @param tokenDto |
|
|
|
* @param formDTO |
|
|
|
* @return com.epmet.commons.tools.utils.Result<com.epmet.commons.tools.page.PageData> |
|
|
|
* @author zhaoqifeng |
|
|
|
* @date 2020/6/3 16:19 |
|
|
|
*/ |
|
|
|
@PostMapping("offlinearticlelist") |
|
|
|
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_OFFLINE_LIST) |
|
|
|
public Result<List<OfflineListResultDTO>> offLineList(@LoginUser TokenDto tokenDto, @RequestBody OfflineListFormDTO formDTO) { |
|
|
|
ValidatorUtils.validateEntity(formDTO); |
|
|
|
List<OfflineListResultDTO> list = articleService.offlineList(tokenDto, formDTO).getList(); |
|
|
|
return new Result<List<OfflineListResultDTO>>().ok(list); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param commonArticleListFormDTO :: getGridId :: getNum |
|
|
|
* @return List<ArticleBannerResultDTO> |
|
|
|
* @Description 根据网格Id查找置顶文章的相关信息列表 用处:居民端首页轮播 |
|
|
|
* @author wangc |
|
|
|
* @date 2020.06.02 16:13 |
|
|
|
**/ |
|
|
|
@PostMapping("resitoparticlelist") |
|
|
|
public Result<List<ArticleBannerResultDTO>> resiTopArticleList(@RequestBody CommonArticleListFormDTO commonArticleListFormDTO) { |
|
|
|
ValidatorUtils.validateEntity(commonArticleListFormDTO, CommonArticleListFormDTO.ArticleBannerInternalGroup.class); |
|
|
|
return new Result<List<ArticleBannerResultDTO>>().ok(articleService.getTopArticleList(commonArticleListFormDTO)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param commonArticleListFormDTO :: getGridId :: getNum |
|
|
|
* @return List<ArticleLatestResultDTO> |
|
|
|
* @Description 根据网格Id查找最新文章的相关信息列表 用处:居民端首页最新文章列表 |
|
|
|
* @author wangc |
|
|
|
* @date 2020.06.03 09:53 |
|
|
|
**/ |
|
|
|
@PostMapping("resilatestarticlelist") |
|
|
|
public Result<List<ArticleLatestResultDTO>> resiLatestArticleList(@RequestBody CommonArticleListFormDTO commonArticleListFormDTO) { |
|
|
|
ValidatorUtils.validateEntity(commonArticleListFormDTO, CommonArticleListFormDTO.ArticleBannerInternalGroup.class); |
|
|
|
return new Result<List<ArticleLatestResultDTO>>().ok(articleService.getLatestArticleList(commonArticleListFormDTO)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param articlePageFormDTO |
|
|
|
* @return List<ArticleListResultDTO> |
|
|
|
* @Description 根据网格Id和标签列表查找文章的相关信息列表 用处:居民端党建声音列表 |
|
|
|
* @author wangc |
|
|
|
* @date 2020.06.03 14:19 |
|
|
|
**/ |
|
|
|
@PostMapping("resiarticlelist") |
|
|
|
public Result<List<ArticleListResultDTO>> resiArticleList(@RequestBody ArticlePageFormDTO articlePageFormDTO) { |
|
|
|
ValidatorUtils.validateEntity(articlePageFormDTO, ArticlePageFormDTO.ArticlePageInternalGroup.class); |
|
|
|
return new Result<List<ArticleListResultDTO>>().ok(articleService.getArticleList(articlePageFormDTO)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param tokenDTO formDTO |
|
|
|
* @return |
|
|
|
* @Author sun |
|
|
|
* @Description 党建声音-政府端-可下线网格列表 |
|
|
|
**/ |
|
|
|
@PostMapping("publishgridlist") |
|
|
|
public Result<ArticleAgencyGridListResultDTO> publishGridList(@LoginUser TokenDto tokenDTO, @RequestBody PublishGridListFormDTO formDTO) { |
|
|
|
formDTO.setStaffId(tokenDTO.getUserId()); |
|
|
|
ValidatorUtils.validateEntity(formDTO, PublishGridListFormDTO.AddUserInternalGroup.class); |
|
|
|
ArticleAgencyGridListResultDTO agencyGridList = new ArticleAgencyGridListResultDTO(); |
|
|
|
agencyGridList.setAgencyGridList(articleService.publishGridList(formDTO)); |
|
|
|
return new Result<ArticleAgencyGridListResultDTO>().ok(agencyGridList); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @param articleDetailFormDTO |
|
|
|
* @return ArticleDetailResultDTO |
|
|
|
* @Description 根绝文章Id查询出文章的内容、封面等相关信息,如果居民端传入的网格Id不在该文章的发布范围内,则返回NULL |
|
|
|
* @author wangc |
|
|
|
* @date 2020.06.03 18:28 |
|
|
|
**/ |
|
|
|
@PostMapping("resiarticledetail") |
|
|
|
public Result<ArticleDetailResultDTO> resiArticleDetail(@RequestBody ResiArticleDetailFormDTO articleDetailFormDTO) { |
|
|
|
ValidatorUtils.validateEntity(articleDetailFormDTO, ResiArticleDetailFormDTO.ResiArticleDetailInternalGroup.class); |
|
|
|
return new Result<ArticleDetailResultDTO>().ok(articleService.getArticleDetail(articleDetailFormDTO)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.DraftDetailResultDTO> |
|
|
|
* @author yinzuomei@elink-cn.com |
|
|
|
* @description 政府端:文章预览 |
|
|
|
* @date 2020/6/5 10:56 |
|
|
|
**/ |
|
|
|
@PostMapping("draftdetail") |
|
|
|
public Result<DraftDetailResultDTO> queryDraftDetail(@RequestBody DraftDetailFormDTO formDTO) { |
|
|
|
ValidatorUtils.validateEntity(formDTO, GovArticleDetailFormDTO.AddUserInternalGroup.class); |
|
|
|
DraftDetailResultDTO draftDetailResultDTO = draftService.queryDraftDetail(formDTO); |
|
|
|
return new Result<DraftDetailResultDTO>().ok(draftDetailResultDTO); |
|
|
|
} |
|
|
|
|
|
|
|
} |