Merge branch 'master' of code.gitlink.org.cn:Gitlink/microservices into dev_PMS_ZPK_merge_master
This commit is contained in:
commit
ec5a211757
|
|
@ -157,6 +157,11 @@ public class CmsDoc extends BaseSortEntity {
|
|||
*/
|
||||
private String auditEditableStatus;
|
||||
|
||||
/**
|
||||
* 关键词
|
||||
*/
|
||||
private String keywords;
|
||||
|
||||
public CmsDir copyToCmsDir() {
|
||||
CmsDir cmsDir = new CmsDir();
|
||||
cmsDir.setId(id);
|
||||
|
|
@ -224,6 +229,7 @@ public class CmsDoc extends BaseSortEntity {
|
|||
cmsDocDto.setAuditStatus(auditStatus);
|
||||
cmsDocDto.setAuditType(auditType);
|
||||
cmsDocDto.setCreateBy(createBy);
|
||||
cmsDocDto.setKeywords(keywords);
|
||||
|
||||
return cmsDocDto;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,6 +96,11 @@ public class CmsDocBaseDto {
|
|||
|
||||
@ApiModelProperty("文章创建者")
|
||||
private String createBy;
|
||||
/**
|
||||
* 关键词
|
||||
*/
|
||||
@ApiModelProperty("关键词")
|
||||
private String keywords;
|
||||
|
||||
public void setPublishTime(Date publishTime) {
|
||||
if (publishTime != null) {
|
||||
|
|
|
|||
|
|
@ -65,6 +65,11 @@ public class CmsDocDto {
|
|||
|
||||
@ApiModelProperty("是否在栏目下修改")
|
||||
private boolean isChangeOnDir;
|
||||
/**
|
||||
* 关键词
|
||||
*/
|
||||
@ApiModelProperty("关键词")
|
||||
private String keywords;
|
||||
|
||||
public String getName() {
|
||||
if (name != null) {
|
||||
|
|
|
|||
|
|
@ -45,6 +45,11 @@ public class CmsDocInputDto {
|
|||
*/
|
||||
@ApiModelProperty("文本编辑器类型")
|
||||
private String editorType;
|
||||
/**
|
||||
* 关键词
|
||||
*/
|
||||
@ApiModelProperty("关键词")
|
||||
private String keywords;
|
||||
|
||||
public String getContent() {
|
||||
String base64decodedString;
|
||||
|
|
@ -78,6 +83,7 @@ public class CmsDocInputDto {
|
|||
cmsDoc.setHeadImg(this.getHeadImg());
|
||||
cmsDoc.setDeptId(dirDoc.getDeptId());
|
||||
cmsDoc.setEditorType(this.editorType);
|
||||
cmsDoc.setKeywords(this.keywords);
|
||||
return cmsDoc;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,4 +78,9 @@ public class CmsDocSearchVo {
|
|||
*/
|
||||
@ApiModelProperty(value = "创建者", hidden = true)
|
||||
private String createBy;
|
||||
/**
|
||||
* 关键词
|
||||
*/
|
||||
@ApiModelProperty("关键词")
|
||||
private String keywords;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ public class CmsDocCommentServiceImpl implements ICmsDocCommentService {
|
|||
return true;
|
||||
}
|
||||
// 判断是否为当前组织下的专区管理员
|
||||
return deptId.equals(SecurityUtils.getUserIdentity().getDeptId())
|
||||
return deptId.equals(SecurityUtils.getDeptId())
|
||||
&& SystemRole.ZONE_ADMIN.getRoleKey().equals(SecurityUtils.getRoleKey());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -677,6 +677,17 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
if (!hasRepoRelatedChanged(oldCmsDoc, cmsDocDto)) {
|
||||
return cmsDocMapper.updateCmsDoc(oldCmsDoc) > 0;
|
||||
}
|
||||
// 当文章名称发生更改时,判断文章名是否在当前栏目下已存在
|
||||
if (StringUtils.isNotEmpty(cmsDocDto.getName()) && !cmsDocDto.getName().equals(oldCmsDoc.getName())) {
|
||||
String dirName = oldCmsDoc.getDirName();
|
||||
if (cmsDocDto.getDirId() != null) {
|
||||
CmsDir cmsDir = selectCmsDirById(cmsDocDto.getDirId(), false);
|
||||
if (!cmsDir.getName().equals(dirName)) {
|
||||
dirName = cmsDir.getName();
|
||||
}
|
||||
}
|
||||
checkDocName(cmsDocDto.getName(), oldCmsDoc.getDeptId(), dirName);
|
||||
}
|
||||
//用户为专区管理员或专区无审核机制时,直接更新文章及仓库主分支
|
||||
if (isCurrentUserZoneAdmin(oldCmsDoc.getDeptId()) || isNoAuditRequired(oldCmsDoc.getDeptId())) {
|
||||
//专区管理员重新编辑并提交审核未通过文章 或 重新编辑并提交待审核文章时专区不需审核机制
|
||||
|
|
@ -700,6 +711,7 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
oldCmsDoc = cmsAsyncService.updateCmsDocDatabaseAndUpdateForGitLink(oldCmsDoc, cmsDocDto, branchName);
|
||||
oldCmsDoc.setAuditStatus(DocAuditStatus.AUDIT_PASS.getAuditCode());
|
||||
oldCmsDoc.setAuditTmpBranchName(null);
|
||||
oldCmsDoc.setKeywords(cmsDocDto.getKeywords());
|
||||
return updateCmsCommonDatabase(oldCmsDoc, CmsConstants.BRANCH_MASTER) > 0;
|
||||
} else {
|
||||
|
||||
|
|
@ -761,6 +773,7 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
}
|
||||
}
|
||||
|
||||
oldCmsDoc.setKeywords(cmsDocDto.getKeywords());
|
||||
oldCmsDoc.setSummary(cmsDocDto.getSummary());
|
||||
oldCmsDoc.setHeadImg(cmsDocDto.getHeadImg());
|
||||
return isChangeName || isChangeContent || isChangeDir;
|
||||
|
|
@ -1133,16 +1146,7 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
}
|
||||
|
||||
private boolean insertCommonCmsDoc(CmsDoc cmsDoc, String message, String content) {
|
||||
//检查该文件是否已存在
|
||||
CmsDoc oldCmsDoc = cmsDocMapper.selectCmsDocByNameAndDeptId(cmsDoc.getName(), cmsDoc.getDeptId(), cmsDoc.getDirName());
|
||||
if (oldCmsDoc != null) {
|
||||
if (oldCmsDoc.getIsDir()) {
|
||||
throw new ServiceException("该栏目已存在(栏目名称[" + cmsDoc.getName() + "])");
|
||||
} else {
|
||||
throw new ServiceException("该文章已存在(文章名称[" + cmsDoc.getName() + "])");
|
||||
}
|
||||
|
||||
}
|
||||
checkDocName(cmsDoc.getName(), cmsDoc.getDeptId(), cmsDoc.getDirName());
|
||||
createFileByGitLink(cmsDoc, message, content);
|
||||
boolean success = insertCmsDocDatabase(cmsDoc, content);
|
||||
// 推送文章地址到搜索引擎
|
||||
|
|
@ -1150,6 +1154,19 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
return success;
|
||||
}
|
||||
|
||||
private void checkDocName(String docName, Long deptId, String dirName) {
|
||||
//检查该文件是否已存在
|
||||
CmsDoc oldCmsDoc = cmsDocMapper.selectCmsDocByNameAndDeptId(docName, deptId, dirName);
|
||||
if (oldCmsDoc != null) {
|
||||
if (oldCmsDoc.getIsDir()) {
|
||||
throw new ServiceException("该栏目已存在(栏目名称[%s])", docName);
|
||||
} else {
|
||||
throw new ServiceException("该文章在当前栏目下已存在(文章名称[%s],栏目名称[%s])", docName, dirName);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private boolean insertCmsDocWithAudit(CmsDoc cmsDoc, String message, String content) {
|
||||
//检查该文件是否已存在
|
||||
CmsDoc oldCmsDoc = cmsDocMapper.selectCmsDocByNameAndDeptId(cmsDoc.getName(), cmsDoc.getDeptId(), cmsDoc.getDirName());
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
<result property="auditType" column="audit_type"/>
|
||||
<result property="auditTmpBranchName" column="audit_tmp_branch_name"/>
|
||||
<result property="auditPrNumber" column="audit_pr_number"/>
|
||||
<result property="keywords" column="keywords"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectCmsDocVo">
|
||||
|
|
@ -69,6 +70,7 @@
|
|||
audit_status,
|
||||
audit_type,
|
||||
audit_tmp_branch_name,
|
||||
keywords,
|
||||
audit_pr_number
|
||||
from cms_doc
|
||||
</sql>
|
||||
|
|
@ -100,6 +102,7 @@
|
|||
cd.issue_id,
|
||||
cd.is_homepage,
|
||||
cd.editor_type,
|
||||
cd.keywords,
|
||||
cd.is_dir
|
||||
from cms_doc cd
|
||||
</sql>
|
||||
|
|
@ -163,6 +166,7 @@
|
|||
<sql id="selectListWhere">
|
||||
<where>
|
||||
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
|
||||
<if test="keywords != null and keywords != ''">and keywords like concat('%', #{keywords}, '%')</if>
|
||||
<if test="fileName != null and fileName != ''">and file_name like concat('%', #{fileName}, '%')</if>
|
||||
<if test="filePath != null and filePath != ''">and file_path = #{filePath}</if>
|
||||
<if test="publishTime != null ">and publish_time = #{publishTime}</if>
|
||||
|
|
@ -309,6 +313,7 @@
|
|||
<if test="auditType != null">audit_type,</if>
|
||||
<if test="auditTmpBranchName != null">audit_tmp_branch_name,</if>
|
||||
<if test="auditPrNumber != null">audit_pr_number,</if>
|
||||
<if test="keywords != null">keywords,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
|
|
@ -341,6 +346,7 @@
|
|||
<if test="auditType != null">#{auditType},</if>
|
||||
<if test="auditTmpBranchName != null">#{auditTmpBranchName},</if>
|
||||
<if test="auditPrNumber != null">#{auditPrNumber},</if>
|
||||
<if test="keywords != null">#{keywords},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -376,6 +382,7 @@
|
|||
<if test="auditType != null">audit_type = #{auditType},</if>
|
||||
<if test="auditTmpBranchName != null">audit_tmp_branch_name = #{auditTmpBranchName},</if>
|
||||
<if test="auditPrNumber != null">audit_pr_number = #{auditPrNumber},</if>
|
||||
<if test="keywords != null">keywords = #{keywords},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
-- 专区管理员增加修改组织权限
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||
VALUES (5, 1019);
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
-- 专区文章表增加Keywords关键字
|
||||
alter table cms_doc
|
||||
add keywords varchar(255) null comment '关键词';
|
||||
Loading…
Reference in New Issue