Suddenly developing a SpringBoot+flowable workflow system, really fragrant

Recently, a small partner found Xiaomeng and developed a workflow system based on SpringBoot+flowable.

Just do it.

Of course, you can also use activity. Then first look at the difference between the two.

Activiti7 is developed by Salaboy team. The activiti6 and activiti5 codes are currently maintained by the Salaboy team.

flowable and activiti6 are developed by the same team, activiti first, flowable after

Therefore, flowable is an upgraded version of activiti6

1. System interface demonstration

Second, the system core code demonstration

/**
 * Parameter configuration information operation processing
 * 
 * @author Xiaomeng VX:jishulearn
 */
@RestController
@RequestMapping("/system/config")
public class SysConfigController extends BaseController
{
    @Autowired
    private ISysConfigService configService;

    /**
     * Get the parameter configuration list
     */
    @PreAuthorize("@ss.hasPermi('system:config:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysConfig config)
    {
        startPage();
        List<SysConfig> list = configService.selectConfigList(config);
        return getDataTable(list);
    }

    @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, "parameter data" );
    }

    /**
     * Get detailed information based on parameter number
     */
    @PreAuthorize("@ss.hasPermi('system:config:query')")
    @GetMapping(value = "/{configId}")
    public AjaxResult getInfo(@PathVariable Long configId)
    {
        return AjaxResult.success(configService.selectConfigById(configId));
    }

    /**
     * Query parameter value based on parameter key name
     */
    @GetMapping(value = "/configKey/{configKey}")
    public AjaxResult getConfigKey(@PathVariable String configKey)
    {
        return AjaxResult.success(configService.selectConfigByKey(configKey));
    }

    /**
     * Added parameter configuration
     */
    @PreAuthorize("@ss.hasPermi('system:config:add')")
    @PostMapping
    @RepeatSubmit
    public AjaxResult add(@Validated @RequestBody SysConfig config)
    {
        if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
        {
            return AjaxResult.error( "Add parameter'" + config.getConfigName() + "'Failed, parameter key name already exists" );
        }
        config.setCreateBy(SecurityUtils.getUsername());
        return toAjax(configService.insertConfig(config));
    }

    /**
     * Modify parameter configuration
     */
    @PreAuthorize("@ss.hasPermi('system:config:edit')")
    @PutMapping
    public AjaxResult edit(@Validated @RequestBody SysConfig config)
    {
        if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
        {
            return AjaxResult.error( "Modify parameter'" + config.getConfigName() + "'Failed, parameter key name already exists" );
        }
        config.setUpdateBy(SecurityUtils.getUsername());
        return toAjax(configService.updateConfig(config));
    }

    /**
     * delete parameter configuration
     */
    @PreAuthorize("@ss.hasPermi('system:config:remove')")
    @DeleteMapping("/{configIds}")
    public AjaxResult remove(@PathVariable Long[] configIds)
    {
        return toAjax(configService.deleteConfigByIds(configIds));
    }

    /**
     * Empty the cache
     */
    @PreAuthorize("@ss.hasPermi('system:config:remove')")
    @DeleteMapping("/clearCache")
    public AjaxResult clearCache()
    {
        configService.clearCache();
        return AjaxResult.success();
    }
}

/**
 * Department Information
 * 
 * @author Xiaomengvx:jishulearn
 *
 */
@RestController
@RequestMapping("/system/dept")
public class SysDeptController extends BaseController
{
    @Autowired
    private ISysDeptService deptService;

    /**
     * Get department list
     */
    @PreAuthorize("@ss.hasPermi('system:dept:list')")
    @GetMapping("/list")
    public AjaxResult list(SysDept dept)
    {
        List<SysDept> depts = deptService.selectDeptList(dept);
        return AjaxResult.success(depts);
    }

    /**
     * Query department list (excluding nodes)
     */
    @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);
    }

    /**
     * Get details by department number
     */
    @PreAuthorize("@ss.hasPermi('system:dept:query')")
    @GetMapping(value = "/{deptId}")
    public AjaxResult getInfo(@PathVariable Long deptId)
    {
        return AjaxResult.success(deptService.selectDeptById(deptId));
    }

    /**
     * Get the department drop-down tree list
     */
    @GetMapping("/treeselect")
    public AjaxResult treeselect(SysDept dept)
    {
        List<SysDept> depts = deptService.selectDeptList(dept);
        return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
    }

    /**
     * Load the corresponding role department list tree
     */ 
    @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;
    }

    /**
     * New department
     */
    @PreAuthorize("@ss.hasPermi('system:dept:add')")
    @PostMapping
    public AjaxResult add(@Validated @RequestBody SysDept dept)
    {
        if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
        {
            return AjaxResult.error( "Add a department'" + dept.getDeptName() + "'Failed, the department name already exists" );
        }
        dept.setCreateBy(SecurityUtils.getUsername());
        return toAjax(deptService.insertDept(dept));
    }

    /**
     * Modify department
     */
    @PreAuthorize("@ss.hasPermi('system:dept:edit')")
    @PutMapping
    public AjaxResult edit(@Validated @RequestBody SysDept dept)
    {
        if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
        {
            return AjaxResult.error( "Modify department'" + dept.getDeptName() + "'Failed, the department name already exists" );
        }
        else if (dept.getParentId().equals(dept.getDeptId()))
        {
            return AjaxResult.error( "Modify department'" + dept.getDeptName() + "'Failed, the superior department cannot be itself" );
        }
        else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
                && deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0)
        {
            return AjaxResult.error( "This department contains sub-departments that are not deactivated!" );
        }
        dept.setUpdateBy(SecurityUtils.getUsername());
        return toAjax(deptService.updateDept(dept));
    }

    /**
     * delete department
     */
    @PreAuthorize("@ss.hasPermi('system:dept:remove')")
    @DeleteMapping("/{deptId}")
    public AjaxResult remove(@PathVariable Long deptId)
    {
        if (deptService.hasChildByDeptId(deptId))
        {
            return AjaxResult.error( "There is a subordinate department, deletion is not allowed" );
        }
        if (deptService.checkDeptExistUser(deptId))
        {
            return AjaxResult.error( "Users exist in the department, deletion is not allowed" );
        }
        return toAjax(deptService.deleteDeptById(deptId));
    }
}

/**
 * Data dictionary information
 * 
 * @author Xiaomengvx: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);
    }

    @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, "dictionary data" );
    }

    /**
     * Query dictionary data for details
     */
    @PreAuthorize("@ss.hasPermi('system:dict:query')")
    @GetMapping(value = "/{dictCode}")
    public AjaxResult getInfo(@PathVariable Long dictCode)
    {
        return AjaxResult.success(dictDataService.selectDictDataById(dictCode));
    }

    /**
     * Query dictionary data information based on dictionary type
     */
    @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);
    }

    /**
     * Added dictionary type
     */
    @PreAuthorize("@ss.hasPermi('system:dict:add')")
    @PostMapping
    public AjaxResult add(@Validated @RequestBody SysDictData dict)
    {
        dict.setCreateBy(SecurityUtils.getUsername());
        return toAjax(dictDataService.insertDictData(dict));
    }

    /**
     * Modify the save dictionary type
     */
    @PreAuthorize("@ss.hasPermi('system:dict:edit')")
    @PutMapping
    public AjaxResult edit(@Validated @RequestBody SysDictData dict)
    {
        dict.setUpdateBy(SecurityUtils.getUsername());
        return toAjax(dictDataService.updateDictData(dict));
    }

    /**
     * delete dictionary type
     */
    @PreAuthorize("@ss.hasPermi('system:dict:remove')")
    @DeleteMapping("/{dictCodes}")
    public AjaxResult remove(@PathVariable Long[] dictCodes)
    {
        return toAjax(dictDataService.deleteDictDataByIds(dictCodes));
    }
}

Third, the core data table design

-- ----------------------------
-- Table structure for {{EJS0}}
-- ----------------------------
DROP TABLE IF EXISTS {{EJS1}};
CREATE TABLE {{EJS2}} (
  {{EJS3}} bigint(20) NOT NULL AUTO_INCREMENT,
  {{EJS4}} varchar(64) COLLATE utf8_bin DEFAULT NULL,
  {{EJS5}} varchar(64) COLLATE utf8_bin DEFAULT NULL,
  {{EJS6}} varchar(64) COLLATE utf8_bin DEFAULT NULL,
  {{EJS7}} varchar(64) COLLATE utf8_bin DEFAULT NULL,
  {{EJS8}} varchar(64) COLLATE utf8_bin DEFAULT NULL,
  {{EJS9}} timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
  {{EJS10}} varchar(255) COLLATE utf8_bin DEFAULT NULL,
  {{EJS11}} longblob,
  {{EJS12}} varchar(255) COLLATE utf8_bin DEFAULT NULL,
  {{EJS13}} timestamp(3) NULL DEFAULT NULL,
  {{EJS14}} tinyint(4) DEFAULT '0',
  PRIMARY KEY ({{EJS15}})
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

-- ----------------------------
-- Records of act_evt_log
-- ----------------------------

-- ----------------------------
-- Table structure for {{EJS16}}
-- ----------------------------
DROP TABLE IF EXISTS {{EJS17}};
CREATE TABLE {{EJS18}} (
  {{EJS19}} varchar(64) COLLATE utf8_bin NOT NULL,
  {{EJS20}} int(11) DEFAULT NULL,
  {{EJS21}} varchar(255) COLLATE utf8_bin DEFAULT NULL,
  {{EJS22}} varchar(64) COLLATE utf8_bin DEFAULT NULL,
  {{EJS23}} longblob,
  {{EJS24}} tinyint(4) DEFAULT NULL,
  PRIMARY KEY ({{EJS25}}),
  KEY {{EJS26}} ({{EJS27}}),
  CONSTRAINT {{EJS28}} FOREIGN KEY ({{EJS29}}) REFERENCES {{EJS30}} ({{EJS31}})
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

-- ----------------------------
DROP TABLE IF EXISTS {{EJS32}};
CREATE TABLE {{EJS33}} (
  {{EJS34}} varchar(64) COLLATE utf8_bin NOT NULL,
  {{EJS35}} varchar(300) COLLATE utf8_bin DEFAULT NULL,
  {{EJS36}} int(11) DEFAULT NULL,
  PRIMARY KEY ({{EJS37}})
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

-- ----------------------------
DROP TABLE IF EXISTS {{EJS38}};
CREATE TABLE {{EJS39}} (
  {{EJS40}} varchar(64) COLLATE utf8_bin NOT NULL,
  {{EJS41}} int(11) DEFAULT '1',
  {{EJS42}} varchar(64) COLLATE utf8_bin NOT NULL,
  {{EJS43}} varchar(64) COLLATE utf8_bin NOT NULL,
  {{EJS44}} varchar(64) COLLATE utf8_bin NOT NULL,
  {{EJS45}} varchar(255) COLLATE utf8_bin NOT NULL,
  {{EJS46}} varchar(64) COLLATE utf8_bin DEFAULT NULL,
  {{EJS47}} varchar(64) COLLATE utf8_bin DEFAULT NULL,
  {{EJS48}} varchar(255) COLLATE utf8_bin DEFAULT NULL,
  {{EJS49}} varchar(255) COLLATE utf8_bin NOT NULL,
  {{EJS50}} varchar(255) COLLATE utf8_bin DEFAULT NULL,
  {{EJS51}} datetime(3) NOT NULL,
  {{EJS52}} datetime(3) DEFAULT NULL,
  {{EJS53}} int(11) DEFAULT NULL,
  {{EJS54}} bigint(20) DEFAULT NULL,
  {{EJS55}} varchar(4000) COLLATE utf8_bin DEFAULT NULL,
  {{EJS56}} varchar(255) COLLATE utf8_bin DEFAULT '',
  PRIMARY KEY ({{EJS57}}),
  KEY {{EJS58}} ({{EJS59}}),
  KEY {{EJS60}} ({{EJS61}}),
  KEY {{EJS62}} ({{EJS63}},{{EJS64}}),
  KEY {{EJS65}} ({{EJS66}},{{EJS67}})
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

-- ----------------------------
DROP TABLE IF EXISTS {{EJS68}};
CREATE TABLE {{EJS69}} (
  {{EJS70}} varchar(64) COLLATE utf8_bin NOT NULL,
  {{EJS71}} int(11) DEFAULT NULL,
  {{EJS72}} varchar(255) COLLATE utf8_bin DEFAULT NULL,
  {{EJS73}} varchar(255) COLLATE utf8_bin DEFAULT NULL,
  {{EJS74}} varchar(4000) COLLATE utf8_bin DEFAULT NULL,
  {{EJS75}} varchar(255) COLLATE utf8_bin DEFAULT NULL,
  {{EJS76}} varchar(64) COLLATE utf8_bin DEFAULT NULL,
  {{EJS77}} varchar(64) COLLATE utf8_bin DEFAULT NULL,
  {{EJS78}} varchar(4000) COLLATE utf8_bin DEFAULT NULL,
  {{EJS79}} varchar(64) COLLATE utf8_bin DEFAULT NULL,
  {{EJS80}} datetime(3) DEFAULT NULL,
  PRIMARY KEY ({{EJS81}})
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

-- ----------------------------
-- Records of act_hi_attachment
-- ----------------------------

-- ----------------------------
-- Table structure for {{EJS82}}
-- ----------------------------
DROP TABLE IF EXISTS {{EJS83}};
CREATE TABLE {{EJS84}} (
  {{EJS85}} varchar(64) COLLATE utf8_bin NOT NULL,
  {{EJS86}} varchar(255) COLLATE utf8_bin DEFAULT NULL,
  {{EJS87}} datetime(3) NOT NULL,
  {{EJS88}} varchar(255) COLLATE utf8_bin DEFAULT NULL,
  {{EJS89}} varchar(64) COLLATE utf8_bin DEFAULT NULL,
  {{EJS90}} varchar(64) COLLATE utf8_bin DEFAULT NULL,
  {{EJS91}} varchar(255) COLLATE utf8_bin DEFAULT NULL,
  {{EJS92}} varchar(4000) COLLATE utf8_bin DEFAULT NULL,
  {{EJS93}} longblob,
  PRIMARY KEY ({{EJS94}})
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

-- ----------------------------

In order to help more friends learn, I have recorded a lot of projects and open sourced a lot of project tutorials. Pay attention to the picture that pops up below,

Reply: The whole project can keep learning.

I’m Xiaomeng, a programmer. Please like and follow. I will keep updating various project tutorials.

Leave a Comment

Your email address will not be published. Required fields are marked *