|
|
@ -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); |
|
|
|