|
@@ -22,6 +22,7 @@ import com.redxun.search.service.SearchService;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@@ -35,6 +36,9 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
public class KnowledgeServiceImpl extends SuperServiceImpl<KnowledgeMapper, Knowledge> implements BaseService<Knowledge> {
|
|
|
|
|
|
+ @Value("${file.url}")
|
|
|
+ private String fileUrl;
|
|
|
+
|
|
|
@Resource
|
|
|
private KnowledgeMapper knowledgeMapper;
|
|
|
|
|
@@ -56,6 +60,9 @@ public class KnowledgeServiceImpl extends SuperServiceImpl<KnowledgeMapper, Know
|
|
|
@Autowired
|
|
|
private KnowledgeCategoryMapper knowledgeCategoryMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SearchService searchService;
|
|
|
+
|
|
|
@Override
|
|
|
public BaseDao<Knowledge> getRepository() {
|
|
|
return knowledgeMapper;
|
|
@@ -89,6 +96,8 @@ public class KnowledgeServiceImpl extends SuperServiceImpl<KnowledgeMapper, Know
|
|
|
knowledge.setAttachmentName(knowledgeDto.getAttachmentName());
|
|
|
knowledge.setAttachmentType(knowledgeDto.getAttachmentType());
|
|
|
knowledge.setContent(knowledgeDto.getContent());
|
|
|
+ //knowledge.setAuthor(knowledgeDto.getAuthor());
|
|
|
+ //knowledge.setCreateBy(knowledgeDto.getCreateBy());
|
|
|
|
|
|
JPaasUser user = userService.queryUser(userService.queryLoginUser());
|
|
|
if (user != null) {
|
|
@@ -153,6 +162,7 @@ public class KnowledgeServiceImpl extends SuperServiceImpl<KnowledgeMapper, Know
|
|
|
approvalVo.setActualApproverName(approve.getActualApproverName());
|
|
|
approvalVo.setApprovalTime(approve.getApprovalTime());
|
|
|
approvalVo.setSort(approve.getSort());
|
|
|
+ approvalVo.setRemark(approve.getRemark());
|
|
|
// 审核状态 :提交审核 审核通过 审核驳回
|
|
|
if (approve.getResult() == null && isFirstNoneApprove) {
|
|
|
isFirstNoneApprove = false;
|
|
@@ -179,8 +189,10 @@ public class KnowledgeServiceImpl extends SuperServiceImpl<KnowledgeMapper, Know
|
|
|
knowledgeVo.setContent(knowledge.getContent());
|
|
|
knowledgeVo.setSummary(knowledge.getSummary());
|
|
|
knowledgeVo.setAttachment(knowledge.getAttachment());
|
|
|
+ knowledgeVo.setAttachmentName(knowledge.getAttachmentName());
|
|
|
knowledgeVo.setCreateTime(knowledge.getCreateTime());
|
|
|
knowledgeVo.setApprovalStatus(knowledge.getApprovalStatus());
|
|
|
+ knowledgeVo.setCreateBy(knowledge.getCreateBy());
|
|
|
knowledgeVo.setApprovals(approvals);
|
|
|
knowledgeVo.setKnowledgeCategoryAdminVo(knowledgeCategoryService.findAllParentByCategoryId(knowledge.getCategoryId()));
|
|
|
return knowledgeVo;
|
|
@@ -193,12 +205,11 @@ public class KnowledgeServiceImpl extends SuperServiceImpl<KnowledgeMapper, Know
|
|
|
*/
|
|
|
public IPage findAllKnowledge(QueryFilter filter) {
|
|
|
Map<String, Object> params = PageHelper.constructParams(filter);
|
|
|
- if (filter.getParams().containsKey("categoryId")){
|
|
|
- String categoryId = (String) filter.getParams().get("categoryId");
|
|
|
- String strip = StringUtils.strip(categoryId, "[]");
|
|
|
- String[] split = strip.split(",");
|
|
|
- filter.getParams().put("categoryId",split[0]);
|
|
|
- }
|
|
|
+ //配合前端传入分类id
|
|
|
+ //if (filter.getParams().containsKey("categoryIds")){
|
|
|
+ // String[] categoryIds = (String[]) filter.getParams().get("categoryIds");
|
|
|
+ // filter.getParams().put("categoryId",categoryIds[0]);
|
|
|
+ //}
|
|
|
IPage page = knowledgeMapper.findAllKnowledge(filter.getPage(), filter.getParams(), params);
|
|
|
List<KnowledgeVo> knowledgeVoList = page.getRecords();
|
|
|
knowledgeVoList.forEach(e -> {
|
|
@@ -240,15 +251,22 @@ public class KnowledgeServiceImpl extends SuperServiceImpl<KnowledgeMapper, Know
|
|
|
Knowledge knowledge = this.get(entity.getPkId());
|
|
|
// 知识为待节点审核状态和待最终审核状态,修改失败;知识为最终审核通过,修改失败
|
|
|
if (knowledge.getApprovalStatus() == 3 || knowledge.getApprovalStatus() == 1){
|
|
|
- throw new RuntimeException("当前知识正在审核中,无法修改");
|
|
|
- } else if (knowledge.getApprovalStatus() == 5){
|
|
|
- throw new RuntimeException("当前知识已通过最终审核,无法修改");
|
|
|
+ throw new RuntimeException("知识正在审核中,无法修改");
|
|
|
} else {
|
|
|
+ //} else if (knowledge.getApprovalStatus() == 5){
|
|
|
+ // throw new RuntimeException("当前知识已通过最终审核,无法修改");
|
|
|
+ //} else {
|
|
|
//知识被驳回了,重新修改进行审核(批次加1)
|
|
|
entity.setApprovalStatus(1);
|
|
|
entity.setApprovalBatch(knowledge.getApprovalBatch() + 1);
|
|
|
+ //把该知识附件信息传入搜索平台
|
|
|
+ searchService.notice(entity.getPkId(),entity.getDocumentId(),entity.getAttachmentName(),null,
|
|
|
+ fileUrl + entity.getAttachment(),null,
|
|
|
+ entity.getCreateBy(),
|
|
|
+ entity.getAuthor(),null,1);
|
|
|
+ return this.getRepository().updateById(entity);
|
|
|
}
|
|
|
- return this.getRepository().updateById(entity);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|