flowable集成
This commit is contained in:
parent
b4e03795d4
commit
45a47a5bd0
|
@ -1,20 +1,49 @@
|
|||
package com.snow;
|
||||
|
||||
import org.flowable.ui.common.rest.idm.remote.RemoteAccountResource;
|
||||
import org.flowable.ui.modeler.properties.FlowableModelerAppProperties;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.FilterType;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author snow
|
||||
*/
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
@SpringBootApplication(
|
||||
exclude= {
|
||||
DataSourceAutoConfiguration.class,
|
||||
SecurityAutoConfiguration.class,
|
||||
SecurityAutoConfiguration.class,
|
||||
UserDetailsServiceAutoConfiguration.class,
|
||||
LiquibaseAutoConfiguration.class
|
||||
}
|
||||
)
|
||||
@ComponentScan(basePackages = {"com.snow",
|
||||
"org.flowable.ui"
|
||||
|
||||
},
|
||||
excludeFilters= @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {RemoteAccountResource.class})
|
||||
)
|
||||
public class SnowApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||
SpringApplication.run(SnowApplication.class, args);
|
||||
|
||||
|
||||
}
|
||||
@Bean
|
||||
public FlowableModelerAppProperties flowableModelerAppProperties() {
|
||||
FlowableModelerAppProperties flowableModelerAppProperties=new FlowableModelerAppProperties();
|
||||
return flowableModelerAppProperties;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,185 @@
|
|||
package com.snow.web.controller.flowable;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelReader;
|
||||
import com.alibaba.excel.read.metadata.ReadSheet;
|
||||
import com.snow.common.annotation.Log;
|
||||
import com.snow.common.core.controller.BaseController;
|
||||
import com.snow.common.core.domain.AjaxResult;
|
||||
import com.snow.common.core.page.TableDataInfo;
|
||||
import com.snow.common.enums.BusinessType;
|
||||
import com.snow.common.utils.poi.ExcelUtil;
|
||||
import com.snow.flowable.domain.DeploymentDTO;
|
||||
import com.snow.flowable.domain.DeploymentQueryDTO;
|
||||
import com.snow.flowable.domain.DeploymentVO;
|
||||
import com.snow.flowable.service.impl.FlowablePublishServiceImpl;
|
||||
import com.snow.flowable.service.impl.FlowableServiceImpl;
|
||||
import com.snow.framework.excel.FinanceAlipayFlowListener;
|
||||
import com.snow.framework.util.ShiroUtils;
|
||||
import com.snow.system.domain.FinanceAlipayFlow;
|
||||
import com.snow.system.domain.FinanceAlipayFlowImport;
|
||||
import com.snow.system.domain.SysUser;
|
||||
import com.snow.system.service.IFinanceAlipayFlowService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.flowable.engine.repository.DeploymentQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 财务支付宝流水Controller
|
||||
*
|
||||
* @author snow
|
||||
* @date 2020-11-09
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/modeler")
|
||||
public class FlowModelerController extends BaseController
|
||||
{
|
||||
private String prefix = "flow";
|
||||
|
||||
@Autowired
|
||||
private IFinanceAlipayFlowService financeAlipayFlowService;
|
||||
@Autowired
|
||||
private FlowableServiceImpl flowableService;
|
||||
@Autowired
|
||||
private FlowablePublishServiceImpl flowablePublishService;
|
||||
|
||||
/**
|
||||
* 跳转流程编译器
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("modeler:flow:view")
|
||||
@GetMapping("/index")
|
||||
public String index()
|
||||
{
|
||||
|
||||
return redirect("/modeler/index.html");
|
||||
}
|
||||
@RequiresPermissions("modeler:flow:view")
|
||||
@GetMapping()
|
||||
public String deploymentView()
|
||||
{
|
||||
return prefix + "/deployment";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询发布实例列表
|
||||
*/
|
||||
@RequiresPermissions("modeler:flow:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(DeploymentQueryDTO deploymentQuery)
|
||||
{
|
||||
|
||||
startPage();
|
||||
List<DeploymentVO> deploymentList = flowableService.getDeploymentList(deploymentQuery);
|
||||
return getDataTable(deploymentList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出财务支付宝流水列表
|
||||
*/
|
||||
@RequiresPermissions("system:flow:export")
|
||||
@Log(title = "财务支付宝流水", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(FinanceAlipayFlow financeAlipayFlow)
|
||||
{
|
||||
List<FinanceAlipayFlow> list = financeAlipayFlowService.selectFinanceAlipayFlowList(financeAlipayFlow);
|
||||
ExcelUtil<FinanceAlipayFlow> util = new ExcelUtil<FinanceAlipayFlow>(FinanceAlipayFlow.class);
|
||||
return util.exportExcel(list, "flow");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取XML
|
||||
*/
|
||||
@GetMapping("/getXml")
|
||||
public void getXml(String id,String resourceName,HttpServletResponse response)
|
||||
{
|
||||
|
||||
flowableService.getDeploymentSource(id,resourceName,"xml",response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取XML
|
||||
*/
|
||||
@GetMapping("/getFlowPicture")
|
||||
public void getFlowPicture(String id,String resourceName,HttpServletResponse response)
|
||||
{
|
||||
|
||||
flowableService.getDeploymentSource(id,resourceName,"png",response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存财务支付宝流水
|
||||
*/
|
||||
@RequiresPermissions("system:flow:add")
|
||||
@Log(title = "财务支付宝流水", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(FinanceAlipayFlow financeAlipayFlow)
|
||||
{
|
||||
return toAjax(financeAlipayFlowService.insertFinanceAlipayFlow(financeAlipayFlow));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改财务支付宝流水
|
||||
*/
|
||||
@GetMapping("/edit/{id}")
|
||||
public String edit(@PathVariable("id") Long id, ModelMap mmap)
|
||||
{
|
||||
FinanceAlipayFlow financeAlipayFlow = financeAlipayFlowService.selectFinanceAlipayFlowById(id);
|
||||
mmap.put("financeAlipayFlow", financeAlipayFlow);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存财务支付宝流水
|
||||
*/
|
||||
@RequiresPermissions("system:flow:edit")
|
||||
@Log(title = "财务支付宝流水", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(FinanceAlipayFlow financeAlipayFlow)
|
||||
{
|
||||
return toAjax(financeAlipayFlowService.updateFinanceAlipayFlow(financeAlipayFlow));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除发布
|
||||
*/
|
||||
@RequiresPermissions("modeler:flow:remove")
|
||||
@Log(title = "删除发布", businessType = BusinessType.DELETE)
|
||||
@PostMapping( "/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
flowableService.deleteDeployment(ids);
|
||||
return toAjax(1);
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "发布流程", businessType = BusinessType.IMPORT)
|
||||
@RequiresPermissions("modeler:flow:import")
|
||||
@PostMapping("/importData")
|
||||
@ResponseBody
|
||||
public AjaxResult importData(MultipartFile file, String name,String key,String category) throws Exception
|
||||
{
|
||||
InputStream inputStream = file.getInputStream();
|
||||
String originalFilename = file.getOriginalFilename();
|
||||
DeploymentDTO deploymentQueryDTO=new DeploymentDTO();
|
||||
deploymentQueryDTO.setName(name);
|
||||
deploymentQueryDTO.setKey(key);
|
||||
deploymentQueryDTO.setCategory(category);
|
||||
deploymentQueryDTO.setResourceName(originalFilename);
|
||||
flowablePublishService.createInputStreamDeployment(deploymentQueryDTO,inputStream);
|
||||
return AjaxResult.success("发布成功");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package com.snow.web.controller.flowable;
|
||||
|
||||
import com.snow.common.core.controller.BaseController;
|
||||
import com.snow.common.core.page.TableDataInfo;
|
||||
import com.snow.flowable.domain.FlowRemoteVO;
|
||||
import com.snow.flowable.service.FlowableUserService;
|
||||
import org.flowable.ui.common.model.RemoteGroup;
|
||||
import org.flowable.ui.common.model.RemoteUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author qimingjin
|
||||
* @Title:
|
||||
* @Description:
|
||||
* @date 2020/11/20 10:34
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app")
|
||||
public class FlowUserController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private FlowableUserService flowableUserService;
|
||||
|
||||
/**
|
||||
* 编译器登录
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/rest/account")
|
||||
public String getAccount() {
|
||||
return "{\"id\":\"admin\",\"firstName\":\"Test\",\"lastName\":\"Administrator\",\"email\":\"admin@modeler.org\",\"fullName\":\"Test Administrator\",\"groups\":[],\"privileges\":[\"access-idm\",\"access-task\",\"access-modeler\",\"access-admin\"]}\n" +
|
||||
"";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
* @param filter
|
||||
*/
|
||||
@GetMapping(value = "/rest/getUserList")
|
||||
public FlowRemoteVO getFlowUserList(@RequestParam(value = "filter",required = false) String filter) {
|
||||
startPage();
|
||||
List<RemoteUser> flowUserList = flowableUserService.getFlowUserList(filter);
|
||||
TableDataInfo dataTable = getDataTable(flowUserList);
|
||||
FlowRemoteVO flowRemoteVO = new FlowRemoteVO();
|
||||
flowRemoteVO.setData(dataTable.getRows());
|
||||
flowRemoteVO.setSize(dataTable.getPageSize());
|
||||
flowRemoteVO.setStart(dataTable.getPageIndex());
|
||||
flowRemoteVO.setTotal(dataTable.getTotal());
|
||||
return flowRemoteVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
* @param filter
|
||||
*/
|
||||
@GetMapping(value = "/rest/getUserGroupList")
|
||||
public FlowRemoteVO getUserGroupList(@RequestParam(value = "filter",required = false) String filter) {
|
||||
startPage();
|
||||
List<RemoteGroup> flowUserGroupList = flowableUserService.getFlowUserGroupList(filter);
|
||||
TableDataInfo dataTable = getDataTable(flowUserGroupList);
|
||||
FlowRemoteVO flowRemoteVO = new FlowRemoteVO();
|
||||
flowRemoteVO.setData(dataTable.getRows());
|
||||
flowRemoteVO.setSize(dataTable.getPageSize());
|
||||
flowRemoteVO.setStart(dataTable.getPageIndex());
|
||||
flowRemoteVO.setTotal(dataTable.getTotal());
|
||||
return flowRemoteVO;
|
||||
}
|
||||
}
|
|
@ -54,7 +54,7 @@ spring:
|
|||
basename: static/i18n/messages
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
|
||||
profiles:
|
||||
active: druid
|
||||
# 文件上传
|
||||
|
@ -75,10 +75,11 @@ mybatis:
|
|||
# 搜索指定包别名
|
||||
typeAliasesPackage: com.snow.**.domain
|
||||
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||
mapperLocations: classpath*:META-INF/modeler-mybatis-mappings/*.xml,classpath*:mapper/**/*Mapper.xml
|
||||
# 加载全局的配置文件
|
||||
configLocation: classpath:mybatis/mybatis-config.xml
|
||||
|
||||
|
||||
# PageHelper分页插件
|
||||
pagehelper:
|
||||
helperDialect: mysql
|
||||
|
@ -140,6 +141,13 @@ flowable:
|
|||
async-executor-activate: false
|
||||
# 将databaseSchemaUpdate设置为true。当Flowable发现库与数据库表结构不一致时,会自动将数据库表结构升级至新版本。
|
||||
database-schema-update: true
|
||||
common:
|
||||
app:
|
||||
idm-url: http://localhost:80
|
||||
idm-admin:
|
||||
user: admin
|
||||
password: test
|
||||
|
||||
log4j:
|
||||
rootLogger: ERROR, CA
|
||||
|
||||
|
|
|
@ -3,7 +3,12 @@
|
|||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
|
||||
<properties>
|
||||
<property name="prefix" value="" />
|
||||
<property name="blobType" value="BLOB" />
|
||||
|
||||
</properties>
|
||||
|
||||
<settings>
|
||||
<setting name="cacheEnabled" value="true" /> <!-- 全局映射器启用缓存 -->
|
||||
<setting name="useGeneratedKeys" value="true" /> <!-- 允许 JDBC 支持自动生成主键 -->
|
||||
|
@ -11,5 +16,5 @@ PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
|||
<setting name="logImpl" value="SLF4J" /> <!-- 指定 MyBatis 所用日志的具体实现 -->
|
||||
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> 驼峰式命名 -->
|
||||
</settings>
|
||||
|
||||
|
||||
</configuration>
|
||||
|
|
|
@ -105,7 +105,7 @@ function _showTip(htmlNode, element)
|
|||
event: 'click mouseleave'
|
||||
},
|
||||
style: {
|
||||
classes: 'ui-tooltip-flowable-cmmn'
|
||||
classes: 'ui-tooltip-modeler-cmmn'
|
||||
}
|
||||
});
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue