知识管理添加工作流审批2
This commit is contained in:
parent
044436aa3d
commit
76bd4f8777
@ -66,6 +66,12 @@ public interface KnowledgeService {
|
||||
* @return 评论列表
|
||||
*/
|
||||
List<CommentDO> getCommentListByKnowId(Long knowId);
|
||||
|
||||
/**
|
||||
* 更新请假申请的状态
|
||||
*
|
||||
* @param id 编号
|
||||
* @param status 结果
|
||||
*/
|
||||
void updateKnowledgeStatus(Long id, Integer status);
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.bpm.service.knows;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOALeaveDO;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -124,4 +125,14 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
||||
commentMapper.deleteByKnowId(knowId);
|
||||
}
|
||||
|
||||
private void validateLeaveExists(Long id) {
|
||||
if (knowledgeMapper.selectById(id) == null) {
|
||||
throw exception(KNOWLEDGE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void updateKnowledgeStatus(Long id, Integer status) {
|
||||
validateLeaveExists(id);
|
||||
knowledgeMapper.updateById(new KnowledgeDO().setId(id).setFlowStatus(status));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.knows.listener;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceStatusEvent;
|
||||
import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceStatusEventListener;
|
||||
import cn.iocoder.yudao.module.bpm.service.knows.KnowledgeService;
|
||||
import cn.iocoder.yudao.module.bpm.service.knows.KnowledgeServiceImpl;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* OA 请假单的结果的监听器实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Component
|
||||
public class BpmKnowledgeStatusListener extends BpmProcessInstanceStatusEventListener {
|
||||
|
||||
@Resource
|
||||
private KnowledgeService knowledgeService;
|
||||
|
||||
@Override
|
||||
protected String getProcessDefinitionKey() {
|
||||
return KnowledgeServiceImpl.PROCESS_KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEvent(BpmProcessInstanceStatusEvent event) {
|
||||
knowledgeService.updateKnowledgeStatus(Long.parseLong(event.getBusinessKey()), event.getStatus());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user