Browse Source

Merge branch 'dev_voice' into dev

dev_shibei_match
sunyuchao 5 years ago
parent
commit
77104c6871
  1. 8
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/ArticleConstant.java
  2. 48
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java
  3. 36
      epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml

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

@ -44,4 +44,12 @@ public interface ArticleConstant {
* 发布文章操作记录表文案
*/
String PUBLISH_ARTICLE_MSG = "%s-%s发布文章【%s】";
/**
* 查询文章基本信息失败
*/
String SELECT_ARTICLE_EXCEPTION = "获取文章信息失败";
/**
* 操作权限异常-自己发表的文章只有自己才能下线
*/
String SHIRO_EXCEPTION = "当前人员不是文章发布者,不能下线文章";
}

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

@ -195,8 +195,8 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
draftEntity.setCustomerId(tokenDto.getCustomerId());
draftEntity.setIsTop(DraftConstant.UN_TOP);
draftEntity.setStatusFlag(DraftConstant.UNPUBLISH);
String orgIdPath = loginUserDetails.getData().getOrgIdPath();
String agencyId = orgIdPath.split(":")[orgIdPath.split(":").length - 1];
String[] orgIdPath = loginUserDetails.getData().getOrgIdPath().split(":");
String agencyId = orgIdPath[orgIdPath.length - 1];
draftEntity.setOrgId(agencyId);
draftEntity.setOrgIdPath(loginUserDetails.getData().getOrgIdPath());
draftEntity.setGridId("");
@ -477,6 +477,15 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
@Override
@Transactional(rollbackFor = Exception.class)
public void offLineArticle(OffLineArticleFormDTO formDTO) {
//0:查询文章表数据,判断当前操作人是否是当初发表文章的人(谁发布的文章水才能下线)
ArticleEntity articleEntity = baseDao.selectById(formDTO.getArticleId());
if (null == articleEntity) {
throw new RenException(ArticleConstant.SELECT_ARTICLE_EXCEPTION);
}
if(!formDTO.getStaffId().equals(articleEntity.getCreatedBy())){
throw new RenException(ArticleConstant.SHIRO_EXCEPTION);
}
//1:根据文章Id查询全部(已发布、已下线)发布范围数据
ArticlePublishRangeEntity rangeEntity = new ArticlePublishRangeEntity();
rangeEntity.setArticleId(formDTO.getArticleId());
@ -534,9 +543,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
//4:文章操作记录表新增数据
//4.1:调用epmet-user服务,查询工作人员信息
CustomerStaffDTO staffDTO = getCustomerStaff(formDTO.getStaffId());
//4.2:查询文章表数据
ArticleEntity articleEntity = baseDao.selectById(formDTO.getArticleId());
//4.3:新增操作表数据
//4.2:新增操作表数据
ArticleOperateRecordEntity recordEntity = new ArticleOperateRecordEntity();
recordEntity.setCustomerId(articleEntity.getCustomerId());
recordEntity.setArticleId(formDTO.getArticleId());
@ -922,7 +929,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
}
if (!isOk) {
this.sendMsg(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);
return null;
}
@ -989,7 +996,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
}
} catch (Exception e) {
log.error("scanContent exception", e);
this.sendMsg(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);
}
log.debug("scanContent result:{}", JSON.toJSONString(result));
@ -1025,7 +1032,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
}
} catch (Exception e) {
log.error("scanAllPassPublishArticle update db exception", e);
this.sendMsg(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()));
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL);
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
@ -1039,15 +1046,18 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
log.error("updateAuditStatusFailById draftId:{} is not exist in db", draftId);
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
boolean coverFail = false,contentFail = false;
try {
List<String> failDataIds = syncScanResult.getFailDataIds();
failDataIds.forEach(id -> {
for(String id:failDataIds) {
if (id.indexOf(ModuleConstant.SCAN_COVER_PREFIX) >= NumConstant.ZERO) {
draftCoverDao.updateAuditStatusById(id, ModuleConstant.AUDIT_STATUS_FAIL);
coverFail = true;
} else {
draftContentDao.updateAuditStatusById(id, ModuleConstant.AUDIT_STATUS_FAIL);
contentFail = true;
}
});
}
List<String> successDataIds = syncScanResult.getSuccessDataIds();
successDataIds.forEach(id -> {
if (id.indexOf(ModuleConstant.SCAN_COVER_PREFIX) >= 0) {
@ -1056,9 +1066,21 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
draftContentDao.updateAuditStatusById(id, ModuleConstant.AUDIT_STATUS_PASS);
}
});
if (coverFail || contentFail){
String auditMsg = "";
if (coverFail&&contentFail){
auditMsg = "内容和封面";
}else if (contentFail){
auditMsg = "内容";
}else if (coverFail){
auditMsg = "封面";
}
this.sendMsg(draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draft.getTitle(),auditMsg));
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL);
}
} catch (Exception e) {
log.error("scanAllPassPublishArticle update db exception", e);
this.sendMsg(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()));
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL);
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
@ -1069,9 +1091,9 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
return this.saveOrUpdateContent(tokenDto, fromDTO, false);
}
public Result sendMsg(String title,String content) {
public Result sendMsg(String customerId, String title,String content) {
UserMessageFormDTO formDTO = new UserMessageFormDTO();
formDTO.setCustomerId(loginUserUtil.getLoginUserApp());
formDTO.setCustomerId(customerId);
formDTO.setGridId("");
formDTO.setUserId(loginUserUtil.getLoginUserId());
formDTO.setApp(AppClientConstant.APP_GOV);

36
epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml

@ -60,19 +60,16 @@
AND a.STATUS_FLAG = 'published'
AND a.CUSTOMER_ID = #{customerId}
<if test="tagIdList !=null and tagIdList.size() > 0">
AND EXISTS (
SELECT DISTINCT
at.ARTICLE_ID
FROM article_tags at
WHERE at.DEL_FLAG = '0'
AND at.ARTICLE_ID = a.ID
<foreach item="tagId" collection="tagIdList" open="AND (" separator="and" close=")" index="">
at.TAG_ID = #{tagId}
<foreach collection="tagIdList" item="tagId" separator=" ">
AND EXISTS(
SELECT 1
FROM ARTICLE_TAGS
WHERE DEL_FLAG = '0'
AND ARTICLE_ID = a.ID
AND TAG_ID=#{tagId}
)
</foreach>
)
</if>
ORDER BY PUBLISH_DATE DESC, UPDATED_TIME DESC
</select>
<select id="selectArticleListForGrid" resultType="com.epmet.dto.result.PublishedListResultDTO">
@ -118,16 +115,15 @@
</foreach>
) t
<if test="tagIdList !=null and tagIdList.size() > 0">
AND EXISTS (
SELECT DISTINCT
at.ARTICLE_ID
FROM article_tags at
WHERE at.DEL_FLAG = '0'
AND at.ARTICLE_ID = t.articleId
<foreach item="tagId" collection="tagIdList" open="AND (" separator="and" close=")" index="">
at.TAG_ID = #{tagId}
<foreach collection="tagIdList" item="tagId" separator=" ">
AND EXISTS(
SELECT 1
FROM ARTICLE_TAGS
WHERE DEL_FLAG = '0'
AND ARTICLE_ID = a.ID
AND TAG_ID=#{tagId}
)
</foreach>
)
</if>
ORDER BY publishDate DESC, UPDATED_TIME DESC
</select>

Loading…
Cancel
Save