流程管理新增
This commit is contained in:
@@ -17,7 +17,6 @@ import static com.njcn.bpm.utils.CollectionUtils.convertMap;
|
||||
/**
|
||||
* BPM 流程分类 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface IBpmCategoryService extends IService<BpmCategory> {
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import static com.njcn.bpm.utils.CollectionUtils.convertMap;
|
||||
*
|
||||
* @author yunlong.li
|
||||
* @author ZJQ
|
||||
* @author 芋道源码
|
||||
* @author hongawen
|
||||
*/
|
||||
public interface IBpmProcessDefinitionService extends IService<BpmProcessDefinitionInfo> {
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.njcn.bpm.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.bpm.pojo.param.BpmSignParam;
|
||||
import com.njcn.bpm.pojo.po.BpmSign;
|
||||
import com.njcn.bpm.pojo.vo.BpmSignVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* BPM 流程标识 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-05-13
|
||||
*/
|
||||
public interface IBpmSignService extends IService<BpmSign> {
|
||||
|
||||
String createSign(BpmSignParam bpmSignParam);
|
||||
|
||||
void updateSign(BpmSignParam.BpmSignUpdateParam updateParam);
|
||||
|
||||
void deleteSign(List<String> ids);
|
||||
|
||||
Page<BpmSignVO> getSignPage(BpmSignParam.BpmSignQueryParam bpmSignQueryParam);
|
||||
|
||||
List<BpmSign> getSignSimpleList();
|
||||
}
|
||||
@@ -29,7 +29,6 @@ import java.util.List;
|
||||
/**
|
||||
* BPM 流程分类 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
@@ -43,6 +42,7 @@ public class BpmCategoryServiceImpl extends ServiceImpl<BpmCategoryMapper, BpmCa
|
||||
checkCategoryCode(bpmCategoryParam, false);
|
||||
// 插入
|
||||
BpmCategory category = BeanUtils.toBean(bpmCategoryParam, BpmCategory.class);
|
||||
category.setState(DataStateEnum.ENABLE.getCode());
|
||||
this.baseMapper.insert(category);
|
||||
return category.getId();
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class BpmCategoryServiceImpl extends ServiceImpl<BpmCategoryMapper, BpmCa
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(bpmCategoryQueryParam.getCode())) {
|
||||
categoryVOQueryWrapper.like("bpm_category.name", bpmCategoryQueryParam.getCode());
|
||||
categoryVOQueryWrapper.like("bpm_category.code", bpmCategoryQueryParam.getCode());
|
||||
}
|
||||
categoryVOQueryWrapper.eq("bpm_category.state", DataStateEnum.ENABLE.getCode());
|
||||
categoryVOQueryWrapper.orderByDesc("bpm_category.update_time");
|
||||
@@ -135,7 +135,7 @@ public class BpmCategoryServiceImpl extends ServiceImpl<BpmCategoryMapper, BpmCa
|
||||
int nameCountByAccount = this.count(categoryLambdaQueryWrapper);
|
||||
//大于等于1个则表示重复
|
||||
if (nameCountByAccount >= 1) {
|
||||
throw new BusinessException(BpmResponseEnum.REPEAT_CATEGORY_NAME_FORM);
|
||||
throw new BusinessException(BpmResponseEnum.REPEAT_CATEGORY_CODE_FORM);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ import java.util.Objects;
|
||||
* 主要进行 Flowable {@link Model} 的维护
|
||||
*
|
||||
* @author yunlongn
|
||||
* @author 芋道源码
|
||||
* @author hongawen
|
||||
* @author jason
|
||||
*/
|
||||
@Service
|
||||
|
||||
@@ -41,7 +41,7 @@ import static java.util.Collections.emptyList;
|
||||
*
|
||||
* @author yunlongn
|
||||
* @author ZJQ
|
||||
* @author 芋道源码
|
||||
* @author hongawen
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.njcn.bpm.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.bpm.enums.BpmResponseEnum;
|
||||
import com.njcn.bpm.mapper.BpmSignMapper;
|
||||
import com.njcn.bpm.pojo.param.BpmCategoryParam;
|
||||
import com.njcn.bpm.pojo.param.BpmSignParam;
|
||||
import com.njcn.bpm.pojo.po.BpmCategory;
|
||||
import com.njcn.bpm.pojo.po.BpmSign;
|
||||
import com.njcn.bpm.pojo.vo.BpmCategoryVO;
|
||||
import com.njcn.bpm.pojo.vo.BpmSignVO;
|
||||
import com.njcn.bpm.service.IBpmSignService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.bpm.utils.BeanUtils;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* BPM 流程标识 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-05-13
|
||||
*/
|
||||
@Service
|
||||
public class BpmSignServiceImpl extends ServiceImpl<BpmSignMapper, BpmSign> implements IBpmSignService {
|
||||
|
||||
@Override
|
||||
public String createSign(BpmSignParam bpmSignParam) {
|
||||
//判断名称和key是否重复
|
||||
checkSignName(bpmSignParam, false);
|
||||
checkSignKey(bpmSignParam, false);
|
||||
BpmSign sign = BeanUtils.toBean(bpmSignParam, BpmSign.class);
|
||||
sign.setState(DataStateEnum.ENABLE.getCode());
|
||||
this.baseMapper.insert(sign);
|
||||
return sign.getId();
|
||||
}
|
||||
|
||||
private void checkSignName(BpmSignParam bpmSignParam, boolean isExcludeSelf) {
|
||||
LambdaQueryWrapper<BpmSign> signLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
//判断流程表单的名称
|
||||
signLambdaQueryWrapper
|
||||
.eq(BpmSign::getName, bpmSignParam.getName())
|
||||
.eq(BpmSign::getState, DataStateEnum.ENABLE.getCode());
|
||||
//更新的时候,需排除当前记录
|
||||
if (isExcludeSelf) {
|
||||
if (bpmSignParam instanceof BpmSignParam.BpmSignUpdateParam) {
|
||||
signLambdaQueryWrapper.ne(BpmSign::getId, ((BpmSignParam.BpmSignUpdateParam) bpmSignParam).getId());
|
||||
}
|
||||
}
|
||||
int nameCountByAccount = this.count(signLambdaQueryWrapper);
|
||||
//大于等于1个则表示重复
|
||||
if (nameCountByAccount >= 1) {
|
||||
throw new BusinessException(BpmResponseEnum.REPEAT_SIGN_NAME_FORM);
|
||||
}
|
||||
}
|
||||
private void checkSignKey(BpmSignParam bpmSignParam, boolean isExcludeSelf) {
|
||||
LambdaQueryWrapper<BpmSign> signLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
//判断流程表单的名称
|
||||
signLambdaQueryWrapper
|
||||
.eq(BpmSign::getSignKey, bpmSignParam.getSignKey())
|
||||
.eq(BpmSign::getState, DataStateEnum.ENABLE.getCode());
|
||||
//更新的时候,需排除当前记录
|
||||
if (isExcludeSelf) {
|
||||
if (bpmSignParam instanceof BpmSignParam.BpmSignUpdateParam) {
|
||||
signLambdaQueryWrapper.ne(BpmSign::getId, ((BpmSignParam.BpmSignUpdateParam) bpmSignParam).getId());
|
||||
}
|
||||
}
|
||||
int nameCountByAccount = this.count(signLambdaQueryWrapper);
|
||||
//大于等于1个则表示重复
|
||||
if (nameCountByAccount >= 1) {
|
||||
throw new BusinessException(BpmResponseEnum.REPEAT_SIGN_KEY_FORM);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void updateSign(BpmSignParam.BpmSignUpdateParam updateParam) {
|
||||
//判断名称和key是否重复
|
||||
checkSignName(updateParam, true);
|
||||
checkSignKey(updateParam, true);
|
||||
// 更新
|
||||
BpmSign bpmSign = BeanUtils.toBean(updateParam, BpmSign.class);
|
||||
this.baseMapper.updateById(bpmSign);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSign(List<String> ids) {
|
||||
this.lambdaUpdate().set(BpmSign::getState, DataStateEnum.DELETED.getCode())
|
||||
.in(BpmSign::getId, ids)
|
||||
.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<BpmSignVO> getSignPage(BpmSignParam.BpmSignQueryParam bpmSignQueryParam) {
|
||||
QueryWrapper<BpmSignVO> bpmSignVOQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
if (StrUtil.isNotBlank(bpmSignQueryParam.getName())) {
|
||||
bpmSignVOQueryWrapper.like("bpm_sign.name", bpmSignQueryParam.getName());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(bpmSignQueryParam.getKey())) {
|
||||
bpmSignVOQueryWrapper.like("bpm_sign.signKey", bpmSignQueryParam.getKey());
|
||||
}
|
||||
bpmSignVOQueryWrapper.eq("bpm_sign.state", DataStateEnum.ENABLE.getCode());
|
||||
bpmSignVOQueryWrapper.orderByDesc("bpm_sign.update_time");
|
||||
return this.baseMapper.page(new Page<>(PageFactory.getPageNum(bpmSignQueryParam), PageFactory.getPageSize(bpmSignQueryParam)), bpmSignVOQueryWrapper);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BpmSign> getSignSimpleList() {
|
||||
LambdaQueryWrapper<BpmSign> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.select(BpmSign::getId,BpmSign::getName,BpmSign::getViewPath,BpmSign::getSignKey)
|
||||
.eq(BpmSign::getState,DataStateEnum.ENABLE.getCode());
|
||||
return this.baseMapper.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import java.util.List;
|
||||
/**
|
||||
* BPM 活动实例 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author hongawen
|
||||
*/
|
||||
public interface IBpmActivityService {
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import static com.njcn.bpm.utils.CollectionUtils.convertMap;
|
||||
/**
|
||||
* 流程实例 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author hongawen
|
||||
*/
|
||||
public interface IBpmProcessInstanceService {
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Map;
|
||||
* 流程任务实例 Service 接口
|
||||
*
|
||||
* @author jason
|
||||
* @author 芋道源码
|
||||
* @author hongawen
|
||||
*/
|
||||
public interface IBpmTaskService {
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.List;
|
||||
/**
|
||||
* BPM 活动实例 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author hongawen
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
|
||||
@@ -56,7 +56,7 @@ import java.util.*;
|
||||
* <p>
|
||||
* 简单来说,前者 = 历史 + 运行中的流程实例,后者仅是运行中的流程实例
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author hongawen
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
|
||||
@@ -60,7 +60,7 @@ import static com.njcn.bpm.utils.CollectionUtils.convertListByFlatMap;
|
||||
/**
|
||||
* 流程任务实例 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author hongawen
|
||||
* @author jason
|
||||
*/
|
||||
@Slf4j
|
||||
|
||||
Reference in New Issue
Block a user