|
@@ -29,6 +29,7 @@ import com.redxun.knowledge.entity.vo.*;
|
|
|
import com.redxun.knowledge.map.entity.dao.MapContent;
|
|
|
import com.redxun.knowledge.map.mapper.MapContentMapper;
|
|
|
import com.redxun.knowledge.mapper.*;
|
|
|
+import com.redxun.knowledge.utils.ObjectUtil;
|
|
|
import com.redxun.knowledge.utils.PageListUtils;
|
|
|
import com.redxun.search.service.SearchService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -115,7 +116,7 @@ public class KnowledgeServiceImpl extends SuperServiceImpl<KnowledgeMapper, Know
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String create(KnowledgeDto knowledgeDto) {
|
|
|
- if (Objects.isNull(knowledgeCategoryMapper.selectById(knowledgeDto.getCategoryId()))){
|
|
|
+ if (Objects.isNull(knowledgeCategoryMapper.selectById(knowledgeDto.getCategoryId())) && knowledgeDto.getIsDraft() == 1){
|
|
|
throw new RuntimeException("输入的分类不存在,请重新输入");
|
|
|
}
|
|
|
if (knowledgeDto != null) {
|
|
@@ -146,7 +147,7 @@ public class KnowledgeServiceImpl extends SuperServiceImpl<KnowledgeMapper, Know
|
|
|
knowledge.setCreateTime(new Date());
|
|
|
knowledge.setUpdateBy(users.getUserId());
|
|
|
knowledge.setUpdateTime(new Date());
|
|
|
- if (!Objects.isNull(knowledgeDto.getOrganizationIds())){
|
|
|
+ if (!ObjectUtil.valueAllNull(knowledgeDto.getOrganizationIds())){
|
|
|
String organizationId = JSON.toJSON(knowledgeDto.getOrganizationIds()).toString();
|
|
|
knowledge.setOrganizationId(organizationId);
|
|
|
}
|
|
@@ -285,6 +286,9 @@ public class KnowledgeServiceImpl extends SuperServiceImpl<KnowledgeMapper, Know
|
|
|
if (flag != null && flag == 1 && knowledgeVo.getApprovalStatus() == 5 && !knowledge.getCreateBy().equals(userService.queryLoginUser())) {
|
|
|
knowledgeVo = parseOrganization(knowledge.getOrganizationId(), true, knowledgeVo);
|
|
|
}
|
|
|
+ if (knowledgeVo.getIsOrganizationId() != null && knowledgeVo.getIsOrganizationId() == 1){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
return knowledgeVo;
|
|
|
}
|
|
|
|
|
@@ -362,7 +366,7 @@ public class KnowledgeServiceImpl extends SuperServiceImpl<KnowledgeMapper, Know
|
|
|
}
|
|
|
Knowledge knowledge = this.get(entity.getPkId());
|
|
|
//处理组织架构
|
|
|
- if (!Objects.isNull(entity.getOrganizationIds())){
|
|
|
+ if (!ObjectUtil.valueAllNull(entity.getOrganizationIds())){
|
|
|
String organizationId = JSON.toJSON(entity.getOrganizationIds()).toString();
|
|
|
knowledge.setOrganizationId(organizationId);
|
|
|
}
|
|
@@ -413,7 +417,7 @@ public class KnowledgeServiceImpl extends SuperServiceImpl<KnowledgeMapper, Know
|
|
|
}
|
|
|
}
|
|
|
// 组织架构/职系/职等信息
|
|
|
- if (Objects.isNull(entity.getOrganizationIds())){
|
|
|
+ if (ObjectUtil.valueAllNull(entity.getOrganizationIds())){
|
|
|
entity.setOrganizationId("");
|
|
|
}
|
|
|
return this.getRepository().updateById(entity);
|
|
@@ -464,6 +468,10 @@ public class KnowledgeServiceImpl extends SuperServiceImpl<KnowledgeMapper, Know
|
|
|
String categoryId = e.getCategoryId();
|
|
|
KnowledgeCategoryAdminVo knowledgeCategoryAdminVo = knowledgeCategoryService.findAllParentByCategoryId(categoryId);
|
|
|
e.setKnowledgeCategoryAdminVo(knowledgeCategoryAdminVo);
|
|
|
+ if (StringUtils.isNotEmpty(e.getOrganizationId())){
|
|
|
+ OrganizationDto organizationDto = JSON.parseObject(e.getOrganizationId(), OrganizationDto.class);
|
|
|
+ e.setOrganizationIds(organizationDto);
|
|
|
+ }
|
|
|
// 判断当前登录人是否可以审核每一条知识
|
|
|
String userNo = userService.queryLoginUsername();
|
|
|
String userId = userService.queryLoginUser();
|
|
@@ -647,6 +655,7 @@ public class KnowledgeServiceImpl extends SuperServiceImpl<KnowledgeMapper, Know
|
|
|
|
|
|
// 解析组织架构/职系/职等数据
|
|
|
OrganizationDto organizationDto = JSON.parseObject(organizationId, OrganizationDto.class);
|
|
|
+ log.info("解析出组织架构信息 -> {}",organizationDto);
|
|
|
knowledgeVo.setOrganizationIds(organizationDto);
|
|
|
// 获取当前登录人的组织架构/职系/职等数据
|
|
|
String sequenceCode = osUserDto.getSequenceCode();
|
|
@@ -675,11 +684,9 @@ public class KnowledgeServiceImpl extends SuperServiceImpl<KnowledgeMapper, Know
|
|
|
addCountViews(osUserDto.getUserId(), knowledgeVo.getPkId());
|
|
|
}
|
|
|
knowledgeVo.setIsOrganizationId(0);
|
|
|
- return knowledgeVo;
|
|
|
} else {
|
|
|
// 没有权限(不增加点击量)
|
|
|
knowledgeVo.setIsOrganizationId(1);
|
|
|
- return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -693,11 +700,9 @@ public class KnowledgeServiceImpl extends SuperServiceImpl<KnowledgeMapper, Know
|
|
|
addCountViews(osUserDto.getUserId(), knowledgeVo.getPkId());
|
|
|
}
|
|
|
knowledgeVo.setIsOrganizationId(0);
|
|
|
- return knowledgeVo;
|
|
|
} else {
|
|
|
// 没有权限(不增加点击量)
|
|
|
knowledgeVo.setIsOrganizationId(1);
|
|
|
- return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -711,11 +716,9 @@ public class KnowledgeServiceImpl extends SuperServiceImpl<KnowledgeMapper, Know
|
|
|
addCountViews(osUserDto.getUserId(), knowledgeVo.getPkId());
|
|
|
}
|
|
|
knowledgeVo.setIsOrganizationId(0);
|
|
|
- return knowledgeVo;
|
|
|
} else {
|
|
|
// 没有权限(不增加点击量)
|
|
|
knowledgeVo.setIsOrganizationId(1);
|
|
|
- return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -728,11 +731,9 @@ public class KnowledgeServiceImpl extends SuperServiceImpl<KnowledgeMapper, Know
|
|
|
addCountViews(osUserDto.getUserId(), knowledgeVo.getPkId());
|
|
|
}
|
|
|
knowledgeVo.setIsOrganizationId(0);
|
|
|
- return knowledgeVo;
|
|
|
} else {
|
|
|
// 没有权限(不增加点击量)
|
|
|
knowledgeVo.setIsOrganizationId(1);
|
|
|
- return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -745,11 +746,9 @@ public class KnowledgeServiceImpl extends SuperServiceImpl<KnowledgeMapper, Know
|
|
|
addCountViews(osUserDto.getUserId(), knowledgeVo.getPkId());
|
|
|
}
|
|
|
knowledgeVo.setIsOrganizationId(0);
|
|
|
- return knowledgeVo;
|
|
|
} else {
|
|
|
// 没有权限(不增加点击量)
|
|
|
knowledgeVo.setIsOrganizationId(1);
|
|
|
- return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -762,11 +761,9 @@ public class KnowledgeServiceImpl extends SuperServiceImpl<KnowledgeMapper, Know
|
|
|
addCountViews(osUserDto.getUserId(), knowledgeVo.getPkId());
|
|
|
}
|
|
|
knowledgeVo.setIsOrganizationId(0);
|
|
|
- return knowledgeVo;
|
|
|
} else {
|
|
|
// 没有权限(不增加点击量)
|
|
|
knowledgeVo.setIsOrganizationId(1);
|
|
|
- return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -779,14 +776,12 @@ public class KnowledgeServiceImpl extends SuperServiceImpl<KnowledgeMapper, Know
|
|
|
addCountViews(osUserDto.getUserId(), knowledgeVo.getPkId());
|
|
|
}
|
|
|
knowledgeVo.setIsOrganizationId(0);
|
|
|
- return knowledgeVo;
|
|
|
} else {
|
|
|
// 没有权限(不增加点击量)
|
|
|
knowledgeVo.setIsOrganizationId(1);
|
|
|
- return null;
|
|
|
}
|
|
|
}
|
|
|
- return null;
|
|
|
+ return knowledgeVo;
|
|
|
}
|
|
|
|
|
|
|