Browse Source

党建声音 人工发布功能相关接口

dev_shibei_match
jianjun 5 years ago
parent
commit
8d76f18e54
  1. 5
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftDetailFormDTO.java
  2. 5
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftDetailResultDTO.java
  3. 5
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftListResultDTO.java
  4. 5
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GovDraftContentDTO.java
  5. 10
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/ArticleConstant.java
  6. 72
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java
  7. 16
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java
  8. 5
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleEntity.java
  9. 8
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java
  10. 54
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java
  11. 14
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftServiceImpl.java
  12. 2
      epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.2__addAutoPublish.sql
  13. 8
      epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftDao.xml

5
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftDetailFormDTO.java

@ -22,4 +22,9 @@ public class DraftDetailFormDTO implements Serializable {
*/ */
@NotBlank(message = "草稿id不能为空", groups = {DraftDetailFormDTO.AddUserInternalGroup.class}) @NotBlank(message = "草稿id不能为空", groups = {DraftDetailFormDTO.AddUserInternalGroup.class})
private String draftId; private String draftId;
/**
* 是否展示封面
*/
private boolean showCover;
} }

5
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftDetailResultDTO.java

@ -59,4 +59,9 @@ public class DraftDetailResultDTO implements Serializable {
* 标签名称数组 * 标签名称数组
*/ */
private String[] tagNameList; private String[] tagNameList;
/**
* 封面信息
*/
private CoverImgDTO coverInfo;
} }

5
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftListResultDTO.java

@ -31,4 +31,9 @@ public class DraftListResultDTO implements Serializable {
* 创建时间 * 创建时间
*/ */
private Long createdTime; private Long createdTime;
/**
* 审核状态
*/
private String auditStatus;
} }

5
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GovDraftContentDTO.java

@ -24,4 +24,9 @@ public class GovDraftContentDTO implements Serializable {
*/ */
private String content; private String content;
/**
* 审核状态
*/
private String auditStatus;
} }

10
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/ArticleConstant.java

@ -56,4 +56,14 @@ public interface ArticleConstant {
* 操作权限异常-自己发表的文章只有自己才能下线 * 操作权限异常-自己发表的文章只有自己才能下线
*/ */
String SHIRO_EXCEPTION = "当前人员不是文章发布者,不能下线文章"; String SHIRO_EXCEPTION = "当前人员不是文章发布者,不能下线文章";
/**
* 发布方式 人工强制发布 不审核
*/
String PUBLISH_WAY_MANUAL = "manualNoAudit";
/**
* 发布方式 api审核后自动发布
*/
String PUBLISH_WAY_AUTO_AUDIT = "autoAudit";
} }

72
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java

@ -75,31 +75,33 @@ public class ArticleController {
/** /**
* desc:政府端-点击返回按钮时点击保存草稿 无需校验参数 * desc:政府端-点击返回按钮时点击保存草稿 无需校验参数
*
* @param fromDTO * @param fromDTO
* @throws Exception * @throws Exception
*/ */
@PostMapping("savedraft") @PostMapping("savedraft")
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH) @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH)
public Result<DraftContentSaveResultDTO> savedraft(@LoginUser TokenDto tokenDto,@RequestBody DraftContentFromDTO fromDTO) throws Exception { public Result<DraftContentSaveResultDTO> savedraft(@LoginUser TokenDto tokenDto, @RequestBody DraftContentFromDTO fromDTO) throws Exception {
DraftContentSaveResultDTO draftDTO = articleService.saveDraft(tokenDto, fromDTO); DraftContentSaveResultDTO draftDTO = articleService.saveDraft(tokenDto, fromDTO);
return new Result<DraftContentSaveResultDTO>().ok(draftDTO); return new Result<DraftContentSaveResultDTO>().ok(draftDTO);
} }
/** /**
* desc:保存或修改草稿内容 * desc:保存或修改草稿内容
*
* @param fromDTO * @param fromDTO
* @throws Exception * @throws Exception
*/ */
@PostMapping("savecontent") @PostMapping("savecontent")
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH) @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH)
public Result<DraftContentSaveResultDTO> saveOrUpdateContent(@LoginUser TokenDto tokenDto,@RequestBody DraftContentFromDTO fromDTO) throws Exception { public Result<DraftContentSaveResultDTO> saveOrUpdateContent(@LoginUser TokenDto tokenDto, @RequestBody DraftContentFromDTO fromDTO) throws Exception {
DraftContentSaveResultDTO resultDTO = articleService.saveOrUpdateContent(tokenDto, fromDTO, true); DraftContentSaveResultDTO resultDTO = articleService.saveOrUpdateContent(tokenDto, fromDTO, true);
return new Result<DraftContentSaveResultDTO>().ok(resultDTO); return new Result<DraftContentSaveResultDTO>().ok(resultDTO);
} }
/** /**
* @param formDTO * @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.form.ArticleOperationResultDTO>> * @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.dto.form.ArticleOperationResultDTO>>
* @author yinzuomei@elink-cn.com * @author yinzuomei@elink-cn.com
* @description 政府端查询文章操作记录 * @description 政府端查询文章操作记录
* @date 2020/6/2 16:50 * @date 2020/6/2 16:50
@ -135,9 +137,9 @@ public class ArticleController {
**/ **/
@PostMapping("getcontent") @PostMapping("getcontent")
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_DRAFT_EDIT) @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_DRAFT_EDIT)
public Result<DraftContentResultDTO> getContent(@RequestBody DraftDetailFormDTO formDTO){ public Result<DraftContentResultDTO> getContent(@RequestBody DraftDetailFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, GovArticleDetailFormDTO.AddUserInternalGroup.class); ValidatorUtils.validateEntity(formDTO, GovArticleDetailFormDTO.AddUserInternalGroup.class);
DraftContentResultDTO draftContent=draftService.queryDraftContent(formDTO); DraftContentResultDTO draftContent = draftService.queryDraftContent(formDTO);
return new Result<DraftContentResultDTO>().ok(draftContent); return new Result<DraftContentResultDTO>().ok(draftContent);
} }
@ -152,9 +154,10 @@ public class ArticleController {
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_DRAFT_EDIT) @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_DRAFT_EDIT)
public Result<DraftAttrResultDTO> getAttr(@RequestBody DraftDetailFormDTO formDTO) { public Result<DraftAttrResultDTO> getAttr(@RequestBody DraftDetailFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, GovArticleDetailFormDTO.AddUserInternalGroup.class); ValidatorUtils.validateEntity(formDTO, GovArticleDetailFormDTO.AddUserInternalGroup.class);
DraftAttrResultDTO draftAttrResultDTO=draftService.getDraftAttr(formDTO); DraftAttrResultDTO draftAttrResultDTO = draftService.getDraftAttr(formDTO);
return new Result<DraftAttrResultDTO>().ok(draftAttrResultDTO); return new Result<DraftAttrResultDTO>().ok(draftAttrResultDTO);
} }
/** /**
* @param tokenDTO * @param tokenDTO
* @return * @return
@ -183,12 +186,13 @@ public class ArticleController {
/** /**
* desc:保存草稿属性 * desc:保存草稿属性
*
* @param fromDTO * @param fromDTO
* @throws Exception * @throws Exception
*/ */
@PostMapping("saveattr") @PostMapping("saveattr")
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH) @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH)
public Result<Boolean> saveDraftAttr(@LoginUser TokenDto tokenDto,@RequestBody DraftAttrFromDTO fromDTO) throws Exception { public Result<Boolean> saveDraftAttr(@LoginUser TokenDto tokenDto, @RequestBody DraftAttrFromDTO fromDTO) throws Exception {
ValidatorUtils.validateEntity(fromDTO, DefaultGroup.class); ValidatorUtils.validateEntity(fromDTO, DefaultGroup.class);
Boolean isSuccess = articleService.saveDraftAttr(tokenDto, fromDTO); Boolean isSuccess = articleService.saveDraftAttr(tokenDto, fromDTO);
return new Result<Boolean>().ok(isSuccess); return new Result<Boolean>().ok(isSuccess);
@ -196,12 +200,13 @@ public class ArticleController {
/** /**
* desc:预览保存草稿属性 * desc:预览保存草稿属性
*
* @param fromDTO * @param fromDTO
* @throws Exception * @throws Exception
*/ */
@PostMapping("previewsaveattr") @PostMapping("previewsaveattr")
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH) @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH)
public Result<Boolean> previewSaveDraftAttr(@LoginUser TokenDto tokenDto,@RequestBody DraftAttrFromDTO fromDTO) throws Exception { public Result<Boolean> previewSaveDraftAttr(@LoginUser TokenDto tokenDto, @RequestBody DraftAttrFromDTO fromDTO) throws Exception {
ValidatorUtils.validateEntity(fromDTO, DefaultGroup.class); ValidatorUtils.validateEntity(fromDTO, DefaultGroup.class);
Boolean isSuccess = articleService.previewSaveDraftAttr(tokenDto, fromDTO); Boolean isSuccess = articleService.previewSaveDraftAttr(tokenDto, fromDTO);
return new Result<Boolean>().ok(isSuccess); return new Result<Boolean>().ok(isSuccess);
@ -209,6 +214,7 @@ public class ArticleController {
/** /**
* desc:发布文章 * desc:发布文章
*
* @param formDTO * @param formDTO
* @throws Exception * @throws Exception
*/ */
@ -222,8 +228,21 @@ public class ArticleController {
return new Result<Boolean>().ok(isSuccess); 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 @Async
public void scanContent(TokenDto tokenDto,String draftId){ public void scanContent(TokenDto tokenDto, String draftId) {
try { try {
SyncScanResult syncScanResult = articleService.scanContent(tokenDto, draftId); SyncScanResult syncScanResult = articleService.scanContent(tokenDto, draftId);
if (syncScanResult == null) { if (syncScanResult == null) {
@ -244,11 +263,12 @@ public class ArticleController {
/** /**
* 已发布文章列表 * 已发布文章列表
* @author zhaoqifeng *
* @date 2020/6/3 16:19
* @param tokenDto * @param tokenDto
* @param formDTO * @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.commons.tools.page.PageData> * @return com.epmet.commons.tools.utils.Result<com.epmet.commons.tools.page.PageData>
* @author zhaoqifeng
* @date 2020/6/3 16:19
*/ */
@PostMapping("publishedarticlelist") @PostMapping("publishedarticlelist")
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISHED_LIST) @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISHED_LIST)
@ -261,55 +281,57 @@ public class ArticleController {
/** /**
* 已下线文章列表 * 已下线文章列表
* @author zhaoqifeng *
* @date 2020/6/3 16:19
* @param tokenDto * @param tokenDto
* @param formDTO * @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.commons.tools.page.PageData> * @return com.epmet.commons.tools.utils.Result<com.epmet.commons.tools.page.PageData>
* @author zhaoqifeng
* @date 2020/6/3 16:19
*/ */
@PostMapping("offlinearticlelist") @PostMapping("offlinearticlelist")
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_OFFLINE_LIST) @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_OFFLINE_LIST)
public Result<List<OfflineListResultDTO> > offLineList(@LoginUser TokenDto tokenDto, @RequestBody OfflineListFormDTO formDTO) { public Result<List<OfflineListResultDTO>> offLineList(@LoginUser TokenDto tokenDto, @RequestBody OfflineListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO); ValidatorUtils.validateEntity(formDTO);
List<OfflineListResultDTO> list = articleService.offlineList(tokenDto, formDTO).getList(); List<OfflineListResultDTO> list = articleService.offlineList(tokenDto, formDTO).getList();
return new Result<List<OfflineListResultDTO> >().ok(list); return new Result<List<OfflineListResultDTO>>().ok(list);
} }
/** /**
* @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
**/ **/
@PostMapping("resitoparticlelist") @PostMapping("resitoparticlelist")
public Result<List<ArticleBannerResultDTO>> resiTopArticleList(@RequestBody CommonArticleListFormDTO commonArticleListFormDTO){ public Result<List<ArticleBannerResultDTO>> resiTopArticleList(@RequestBody CommonArticleListFormDTO commonArticleListFormDTO) {
ValidatorUtils.validateEntity(commonArticleListFormDTO, CommonArticleListFormDTO.ArticleBannerInternalGroup.class); ValidatorUtils.validateEntity(commonArticleListFormDTO, CommonArticleListFormDTO.ArticleBannerInternalGroup.class);
return new Result<List<ArticleBannerResultDTO>>().ok(articleService.getTopArticleList(commonArticleListFormDTO)); return new Result<List<ArticleBannerResultDTO>>().ok(articleService.getTopArticleList(commonArticleListFormDTO));
} }
/** /**
* @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
**/ **/
@PostMapping("resilatestarticlelist") @PostMapping("resilatestarticlelist")
public Result<List<ArticleLatestResultDTO>> resiLatestArticleList(@RequestBody CommonArticleListFormDTO commonArticleListFormDTO){ public Result<List<ArticleLatestResultDTO>> resiLatestArticleList(@RequestBody CommonArticleListFormDTO commonArticleListFormDTO) {
ValidatorUtils.validateEntity(commonArticleListFormDTO, CommonArticleListFormDTO.ArticleBannerInternalGroup.class); ValidatorUtils.validateEntity(commonArticleListFormDTO, CommonArticleListFormDTO.ArticleBannerInternalGroup.class);
return new Result<List<ArticleLatestResultDTO>>().ok(articleService.getLatestArticleList(commonArticleListFormDTO)); return new Result<List<ArticleLatestResultDTO>>().ok(articleService.getLatestArticleList(commonArticleListFormDTO));
} }
/** /**
* @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
**/ **/
@PostMapping("resiarticlelist") @PostMapping("resiarticlelist")
public Result<List<ArticleListResultDTO>> resiArticleList(@RequestBody ArticlePageFormDTO articlePageFormDTO){ public Result<List<ArticleListResultDTO>> resiArticleList(@RequestBody ArticlePageFormDTO articlePageFormDTO) {
ValidatorUtils.validateEntity(articlePageFormDTO,ArticlePageFormDTO.ArticlePageInternalGroup.class); ValidatorUtils.validateEntity(articlePageFormDTO, ArticlePageFormDTO.ArticlePageInternalGroup.class);
return new Result<List<ArticleListResultDTO>>().ok(articleService.getArticleList(articlePageFormDTO)); return new Result<List<ArticleListResultDTO>>().ok(articleService.getArticleList(articlePageFormDTO));
} }
@ -330,15 +352,15 @@ public class ArticleController {
/** /**
* @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
**/ **/
@PostMapping("resiarticledetail") @PostMapping("resiarticledetail")
public Result<ArticleDetailResultDTO> resiArticleDetail(@RequestBody ResiArticleDetailFormDTO articleDetailFormDTO){ public Result<ArticleDetailResultDTO> resiArticleDetail(@RequestBody ResiArticleDetailFormDTO articleDetailFormDTO) {
ValidatorUtils.validateEntity(articleDetailFormDTO,ResiArticleDetailFormDTO.ResiArticleDetailInternalGroup.class); ValidatorUtils.validateEntity(articleDetailFormDTO, ResiArticleDetailFormDTO.ResiArticleDetailInternalGroup.class);
return new Result<ArticleDetailResultDTO>().ok(articleService.getArticleDetail(articleDetailFormDTO)); return new Result<ArticleDetailResultDTO>().ok(articleService.getArticleDetail(articleDetailFormDTO));
} }

16
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java

@ -24,7 +24,10 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.DeleteDraftFormDTO; import com.epmet.dto.form.DeleteDraftFormDTO;
import com.epmet.dto.form.DraftDetailFormDTO;
import com.epmet.dto.form.DraftListFormDTO; import com.epmet.dto.form.DraftListFormDTO;
import com.epmet.dto.form.GovArticleDetailFormDTO;
import com.epmet.dto.result.DraftDetailResultDTO;
import com.epmet.dto.result.DraftListResultDTO; import com.epmet.dto.result.DraftListResultDTO;
import com.epmet.service.DraftService; import com.epmet.service.DraftService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -70,4 +73,17 @@ public class DraftController {
ValidatorUtils.validateEntity(formDTO); ValidatorUtils.validateEntity(formDTO);
return new Result<List<DraftListResultDTO>>().ok(draftService.draftList(tokenDto, formDTO).getList()); return new Result<List<DraftListResultDTO>>().ok(draftService.draftList(tokenDto, formDTO).getList());
} }
/**
* desc:政府端带封面的预览
* @param formDTO
* @return
*/
@PostMapping("detailwithcover")
public Result<DraftDetailResultDTO> detailWithCover(@RequestBody DraftDetailFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, GovArticleDetailFormDTO.AddUserInternalGroup.class);
formDTO.setShowCover(true);
DraftDetailResultDTO draftDetailResultDTO = draftService.queryDraftDetail(formDTO);
return new Result<DraftDetailResultDTO>().ok(draftDetailResultDTO);
}
} }

5
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleEntity.java

@ -103,6 +103,11 @@ public class ArticleEntity extends BaseEpmetEntity {
*/ */
private String tags; private String tags;
/**
* 发布方式 自动审核后发布autoAudit;人工确认无误发布(不审核)manualNoAudit
*/
private String publishWay;
/** /**
* 组织ID * 组织ID
*/ */

8
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java

@ -206,4 +206,12 @@ public interface ArticleService extends BaseService<ArticleEntity> {
* @return * @return
*/ */
void updateDraftPublishStatus(String draftId,String statusFlag); void updateDraftPublishStatus(String draftId,String statusFlag);
/**
* desc:人工发布文章 不走审核接口
* @param tokenDto
* @param draftId
* @return
*/
void manualPublish(TokenDto tokenDto, String draftId);
} }

54
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java

@ -63,7 +63,6 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
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;
@ -322,7 +321,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
@Override @Override
public Boolean previewSaveDraftAttr(TokenDto tokenDto, DraftAttrFromDTO fromDTO) { public Boolean previewSaveDraftAttr(TokenDto tokenDto, DraftAttrFromDTO fromDTO) {
log.debug("previewSaveDraftAttr param:{}",JSON.toJSONString(fromDTO)); log.debug("previewSaveDraftAttr param:{}", JSON.toJSONString(fromDTO));
//校验参数 //校验参数
ValidatorUtils.validateEntity(fromDTO); ValidatorUtils.validateEntity(fromDTO);
if (DraftConstant.TOP.equals(fromDTO.getIsTop()) && StringUtils.isBlank(fromDTO.getCoverImg())) { if (DraftConstant.TOP.equals(fromDTO.getIsTop()) && StringUtils.isBlank(fromDTO.getCoverImg())) {
@ -566,7 +565,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
offLineList.forEach(off -> { offLineList.forEach(off -> {
offLineGridId.append(StrConstant.COLON).append(off.getGridId()); offLineGridId.append(StrConstant.COLON).append(off.getGridId());
}); });
recordEntity.setGridIds(offLineGridId.toString().replaceFirst(StrConstant.COLON,"")); recordEntity.setGridIds(offLineGridId.toString().replaceFirst(StrConstant.COLON, ""));
recordEntity.setContent(content); recordEntity.setContent(content);
recordEntity.setOpType(ArticleConstant.OFFLINE); recordEntity.setOpType(ArticleConstant.OFFLINE);
recordEntity.setOpTime(date); recordEntity.setOpTime(date);
@ -641,7 +640,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
if (RoleKeyConstants.ROLE_KEY_PARTY_PRINCIPALS.equals(role.getRoleKey())) { if (RoleKeyConstants.ROLE_KEY_PARTY_PRINCIPALS.equals(role.getRoleKey())) {
staffLevel = AGENCY; staffLevel = AGENCY;
break; break;
} else if (RoleKeyConstants.ROLE_KEY_GRID_PARTY_DIRECTOR.equals(role.getRoleKey())){ } else if (RoleKeyConstants.ROLE_KEY_GRID_PARTY_DIRECTOR.equals(role.getRoleKey())) {
staffLevel = GRID; staffLevel = GRID;
} }
} }
@ -888,7 +887,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
* @date 2020.06.05 09:10 * @date 2020.06.05 09:10
**/ **/
public ArticleEntity publishDraftToArticle(DraftEntity draft) { public ArticleEntity publishDraftToArticle(DraftEntity draft, String publishWay) {
//1.查找草稿内容 //1.查找草稿内容
if (null != draft) { if (null != draft) {
@ -904,6 +903,9 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
article.setId(null); article.setId(null);
article.setDraftId(draftId); article.setDraftId(draftId);
article.setStatusFlag(DraftConstant.PUBLISHED); article.setStatusFlag(DraftConstant.PUBLISHED);
if (StringUtils.isNotBlank(publishWay)) {
article.setPublishWay(publishWay);
}
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 -> {
@ -1006,16 +1008,16 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
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 (!imgSyncScanResult.success()){ if (!imgSyncScanResult.success()) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(),imgSyncScanResult.getMsg()); throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), imgSyncScanResult.getMsg());
} }
} }
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));
if (!textSyncScanResult.success()){ if (!textSyncScanResult.success()) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(),textSyncScanResult.getMsg()); throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), textSyncScanResult.getMsg());
} }
} }
@ -1047,7 +1049,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
} }
@Override @Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) @Transactional(rollbackFor = Exception.class)
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);
@ -1058,7 +1060,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
try { try {
//审核通过 //审核通过
this.updateAuditStatusFailById(draftId, syncScanResult); this.updateAuditStatusFailById(draftId, syncScanResult);
ArticleEntity articleEntity = this.publishDraftToArticle(draft); ArticleEntity articleEntity = this.publishDraftToArticle(draft, ArticleConstant.PUBLISH_WAY_AUTO_AUDIT);
UpdateCustomerTagCacheDTO updateCustomerTagCacheDTO = this.updateCustomerTag(tokenDto, draftId); UpdateCustomerTagCacheDTO updateCustomerTagCacheDTO = this.updateCustomerTag(tokenDto, draftId);
if (updateCustomerTagCacheDTO == null) { if (updateCustomerTagCacheDTO == null) {
return; return;
@ -1123,7 +1125,6 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
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));
} }
@ -1157,6 +1158,35 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
draftDao.updateAuditStatusById(draftId, statusFlag); draftDao.updateAuditStatusById(draftId, statusFlag);
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void manualPublish(TokenDto tokenDto, String draftId) {
try {
//校验草稿状态 并更新为已发布
DraftEntity draftEntity = checkDraftStatus(draftId);
this.updateDraftPublishStatus(draftId, DraftConstant.PUBLISHED);
//复制 草稿到文章(草稿内容,封面,属性)
ArticleEntity articleEntity = this.publishDraftToArticle(draftEntity, ArticleConstant.PUBLISH_WAY_MANUAL);
UpdateCustomerTagCacheDTO updateCustomerTagCacheDTO = this.updateCustomerTag(tokenDto, draftId);
if (updateCustomerTagCacheDTO == null) {
return;
}
List<UpdateGridTagCacheDTO> updateGridTagCacheDTOS = this.updateGridTag(tokenDto, draftId, updateCustomerTagCacheDTO);
this.addArticleTags(updateCustomerTagCacheDTO, draftId, tokenDto, articleEntity.getCreatedTime());
//更新redis
try {
this.updateCacheCustomerTag(updateCustomerTagCacheDTO);
this.updateCacheGridTag(updateGridTagCacheDTOS);
} catch (Exception e) {
log.error("manualPublish update redis exception", e);
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
} catch (RenException e) {
log.error("manualPublish exception", e);
}
}
/** /**
* @param draftId * @param draftId

14
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftServiceImpl.java

@ -26,12 +26,14 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.constant.DraftConstant; import com.epmet.constant.DraftConstant;
import com.epmet.dao.DraftCoverDao;
import com.epmet.dao.DraftDao; import com.epmet.dao.DraftDao;
import com.epmet.dto.DraftDTO; import com.epmet.dto.DraftDTO;
import com.epmet.dto.form.DeleteDraftFormDTO; import com.epmet.dto.form.DeleteDraftFormDTO;
import com.epmet.dto.form.DraftDetailFormDTO; import com.epmet.dto.form.DraftDetailFormDTO;
import com.epmet.dto.form.DraftListFormDTO; import com.epmet.dto.form.DraftListFormDTO;
import com.epmet.dto.result.*; import com.epmet.dto.result.*;
import com.epmet.entity.DraftCoverEntity;
import com.epmet.entity.DraftEntity; import com.epmet.entity.DraftEntity;
import com.epmet.service.DraftService; import com.epmet.service.DraftService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
@ -39,6 +41,7 @@ import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -57,6 +60,8 @@ import java.util.Map;
public class DraftServiceImpl extends BaseServiceImpl<DraftDao, DraftEntity> implements DraftService { public class DraftServiceImpl extends BaseServiceImpl<DraftDao, DraftEntity> implements DraftService {
private Logger logger = LoggerFactory.getLogger(getClass()); private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private DraftCoverDao draftCoverDao;
@Override @Override
public PageData<DraftDTO> page(Map<String, Object> params) { public PageData<DraftDTO> page(Map<String, Object> params) {
IPage<DraftEntity> page = baseDao.selectPage( IPage<DraftEntity> page = baseDao.selectPage(
@ -179,6 +184,15 @@ public class DraftServiceImpl extends BaseServiceImpl<DraftDao, DraftEntity> imp
}else{ }else{
draftDetailResultDTO.setTagNameList(new String[0]); draftDetailResultDTO.setTagNameList(new String[0]);
} }
if (formDTO.isShowCover()){
DraftCoverEntity coverEntity = draftCoverDao.selectByDraftId(formDTO.getDraftId(), null);
if (coverEntity != null){
CoverImgDTO coverImgDTO = ConvertUtils.sourceToTarget(coverEntity, CoverImgDTO.class);
draftDetailResultDTO.setCoverInfo(coverImgDTO);
}else{
draftDetailResultDTO.setCoverInfo(new CoverImgDTO());
}
}
} }
return draftDetailResultDTO; return draftDetailResultDTO;
} }

2
epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.2__addAutoPublish.sql

@ -0,0 +1,2 @@
ALTER TABLE `epmet_gov_voice`.`article`
ADD COLUMN `PUBLISH_WAY` varchar(16) NOT NULL DEFAULT 'autoAudit' COMMENT '发布方式 自动审核后发布:autoAudit;人工确认无误发布(不审核):manualNoAudit' AFTER `TAGS`;

8
epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftDao.xml

@ -142,7 +142,9 @@
ID AS "draftId", ID AS "draftId",
TITLE AS "title", TITLE AS "title",
IFNULL(PREVIEW_CONTENT, "") AS "content", IFNULL(PREVIEW_CONTENT, "") AS "content",
UNIX_TIMESTAMP(CREATED_TIME) AS "createdTime" UNIX_TIMESTAMP(CREATED_TIME) AS "createdTime",
AUDIT_STATUS,
AUDIT_REASON
FROM draft FROM draft
WHERE DEL_FLAG = '0' WHERE DEL_FLAG = '0'
AND (STATUS_FLAG = 'unpublish' OR STATUS_FLAG = 'auditfail') AND (STATUS_FLAG = 'unpublish' OR STATUS_FLAG = 'auditfail')
@ -169,7 +171,9 @@
<select id="selectDraftContentList" parameterType="java.lang.String" resultType="com.epmet.dto.result.GovDraftContentDTO"> <select id="selectDraftContentList" parameterType="java.lang.String" resultType="com.epmet.dto.result.GovDraftContentDTO">
SELECT SELECT
dc.CONTENT_TYPE, dc.CONTENT_TYPE,
dc.CONTENT dc.CONTENT,
dc.AUDIT_STATUS,
dc.AUDIT_REASON
FROM FROM
draft_content dc draft_content dc
WHERE WHERE

Loading…
Cancel
Save