突然开发一个SpringBoot+flowable工作流系统,真的香
Posted 程序员springmeng
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了突然开发一个SpringBoot+flowable工作流系统,真的香相关的知识,希望对你有一定的参考价值。
最近有小伙伴,找到小孟,开发一个基于SpringBoot+flowable工作流系统。
那就干吧。
当然你用activity也是也可以的。那首先看一下两者的区别。
Activiti7是 Salaboy团队开发的。activiti6以及activiti5代码目前有 Salaboy团队进行维护。
flowable和activiti6是同一个团队开发的,activiti先,flowable后
所以,flowable 算是 activiti6的升级版
一,系统界面演示
二,系统核心代码演示
/**
* 参数配置 信息操作处理
*
* @author 小孟VX:jishulearn
*/
@RestController
@RequestMapping("/system/config")
public class SysConfigController extends BaseController
@Autowired
private ISysConfigService configService;
/**
* 获取参数配置列表
*/
@PreAuthorize("@ss.hasPermi('system:config:list')")
@GetMapping("/list")
public TableDataInfo list(SysConfig config)
startPage();
List<SysConfig> list = configService.selectConfigList(config);
return getDataTable(list);
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:config:export')")
@GetMapping("/export")
public AjaxResult export(SysConfig config)
List<SysConfig> list = configService.selectConfigList(config);
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
return util.exportExcel(list, "参数数据");
/**
* 根据参数编号获取详细信息
*/
@PreAuthorize("@ss.hasPermi('system:config:query')")
@GetMapping(value = "/configId")
public AjaxResult getInfo(@PathVariable Long configId)
return AjaxResult.success(configService.selectConfigById(configId));
/**
* 根据参数键名查询参数值
*/
@GetMapping(value = "/configKey/configKey")
public AjaxResult getConfigKey(@PathVariable String configKey)
return AjaxResult.success(configService.selectConfigByKey(configKey));
/**
* 新增参数配置
*/
@PreAuthorize("@ss.hasPermi('system:config:add')")
@Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping
@RepeatSubmit
public AjaxResult add(@Validated @RequestBody SysConfig config)
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
config.setCreateBy(SecurityUtils.getUsername());
return toAjax(configService.insertConfig(config));
/**
* 修改参数配置
*/
@PreAuthorize("@ss.hasPermi('system:config:edit')")
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysConfig config)
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
config.setUpdateBy(SecurityUtils.getUsername());
return toAjax(configService.updateConfig(config));
/**
* 删除参数配置
*/
@PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "参数管理", businessType = BusinessType.DELETE)
@DeleteMapping("/configIds")
public AjaxResult remove(@PathVariable Long[] configIds)
return toAjax(configService.deleteConfigByIds(configIds));
/**
* 清空缓存
*/
@PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
@DeleteMapping("/clearCache")
public AjaxResult clearCache()
configService.clearCache();
return AjaxResult.success();
/**
* 部门信息
*
* @author 小孟vx:jishulearn
*
*/
@RestController
@RequestMapping("/system/dept")
public class SysDeptController extends BaseController
@Autowired
private ISysDeptService deptService;
/**
* 获取部门列表
*/
@PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list")
public AjaxResult list(SysDept dept)
List<SysDept> depts = deptService.selectDeptList(dept);
return AjaxResult.success(depts);
/**
* 查询部门列表(排除节点)
*/
@PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list/exclude/deptId")
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
List<SysDept> depts = deptService.selectDeptList(new SysDept());
Iterator<SysDept> it = depts.iterator();
while (it.hasNext())
SysDept d = (SysDept) it.next();
if (d.getDeptId().intValue() == deptId
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""))
it.remove();
return AjaxResult.success(depts);
/**
* 根据部门编号获取详细信息
*/
@PreAuthorize("@ss.hasPermi('system:dept:query')")
@GetMapping(value = "/deptId")
public AjaxResult getInfo(@PathVariable Long deptId)
return AjaxResult.success(deptService.selectDeptById(deptId));
/**
* 获取部门下拉树列表
*/
@GetMapping("/treeselect")
public AjaxResult treeselect(SysDept dept)
List<SysDept> depts = deptService.selectDeptList(dept);
return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
/**
* 加载对应角色部门列表树
*/
@GetMapping(value = "/roleDeptTreeselect/roleId")
public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId)
List<SysDept> depts = deptService.selectDeptList(new SysDept());
AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
ajax.put("depts", deptService.buildDeptTreeSelect(depts));
return ajax;
/**
* 新增部门
*/
@PreAuthorize("@ss.hasPermi('system:dept:add')")
@Log(title = "部门管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDept dept)
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
dept.setCreateBy(SecurityUtils.getUsername());
return toAjax(deptService.insertDept(dept));
/**
* 修改部门
*/
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDept dept)
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
else if (dept.getParentId().equals(dept.getDeptId()))
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
&& deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0)
return AjaxResult.error("该部门包含未停用的子部门!");
dept.setUpdateBy(SecurityUtils.getUsername());
return toAjax(deptService.updateDept(dept));
/**
* 删除部门
*/
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
@Log(title = "部门管理", businessType = BusinessType.DELETE)
@DeleteMapping("/deptId")
public AjaxResult remove(@PathVariable Long deptId)
if (deptService.hasChildByDeptId(deptId))
return AjaxResult.error("存在下级部门,不允许删除");
if (deptService.checkDeptExistUser(deptId))
return AjaxResult.error("部门存在用户,不允许删除");
return toAjax(deptService.deleteDeptById(deptId));
/**
* 数据字典信息
*
* @author 小孟vx:jishulearn
*/
@RestController
@RequestMapping("/system/dict/data")
public class SysDictDataController extends BaseController
@Autowired
private ISysDictDataService dictDataService;
@Autowired
private ISysDictTypeService dictTypeService;
@PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list")
public TableDataInfo list(SysDictData dictData)
startPage();
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
return getDataTable(list);
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')")
@GetMapping("/export")
public AjaxResult export(SysDictData dictData)
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
return util.exportExcel(list, "字典数据");
/**
* 查询字典数据详细
*/
@PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/dictCode")
public AjaxResult getInfo(@PathVariable Long dictCode)
return AjaxResult.success(dictDataService.selectDictDataById(dictCode));
/**
* 根据字典类型查询字典数据信息
*/
@GetMapping(value = "/type/dictType")
public AjaxResult dictType(@PathVariable String dictType)
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
if (StringUtils.isNull(data))
data = new ArrayList<SysDictData>();
return AjaxResult.success(data);
/**
* 新增字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:add')")
@Log(title = "字典数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDictData dict)
dict.setCreateBy(SecurityUtils.getUsername());
return toAjax(dictDataService.insertDictData(dict));
/**
* 修改保存字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictData dict)
dict.setUpdateBy(SecurityUtils.getUsername());
return toAjax(dictDataService.updateDictData(dict));
/**
* 删除字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/dictCodes")
public AjaxResult remove以上是关于突然开发一个SpringBoot+flowable工作流系统,真的香的主要内容,如果未能解决你的问题,请参考以下文章
突然开发一个SpringBoot+flowable工作流系统,真的香