feat(oa-project-flow) add oa-project-flow api

approve-sys
bob 2 years ago
parent 643355f110
commit 70a52b2e2f

@ -1,12 +0,0 @@
@echo off
echo.
echo [信息] 清理生成路径。
echo.
%~d0
cd %~dp0
cd ..
call mvn clean
pause

@ -1,12 +0,0 @@
@echo off
echo.
echo [信息] 打包Web工程生成war/jar包文件。
echo.
%~d0
cd %~dp0
cd ..
call mvn clean package -Dmaven.test.skip=true
pause

@ -1,14 +0,0 @@
@echo off
echo.
echo [信息] 运行Web工程。
echo.
cd %~dp0
cd ../ruoyi-admin/target
set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
java -jar %JAVA_OPTS% ruoyi-admin.jar
cd bin
pause

Binary file not shown.

@ -1,134 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:bioc="http://bpmn.io/schema/bpmn/biocolor/1.0" xmlns:flowable="http://flowable.org/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.flowable.org/processdef">
<process id="process_tvk31y9s" name="请假流程" flowable:processCategory="leave">
<startEvent id="startNode1" name="开始">
<outgoing>Flow_00tfp5n</outgoing>
</startEvent>
<sequenceFlow id="Flow_00tfp5n" sourceRef="startNode1" targetRef="Activity_1o4r0b6" />
<userTask id="Activity_1o4r0b6" name="申请人" flowable:dataType="fixed" flowable:assignee="${INITIATOR}">
<incoming>Flow_00tfp5n</incoming>
<outgoing>Flow_0fp5q3o</outgoing>
</userTask>
<sequenceFlow id="Flow_0fp5q3o" sourceRef="Activity_1o4r0b6" targetRef="Activity_09jvd1k" />
<userTask id="Activity_09jvd1k" name="行政" flowable:dataType="fixed" flowable:assignee="1">
<incoming>Flow_0fp5q3o</incoming>
<outgoing>Flow_0gz6m5h</outgoing>
</userTask>
<exclusiveGateway id="Gateway_0cpycfu">
<incoming>Flow_0gz6m5h</incoming>
<outgoing>Flow_0xr8cyx</outgoing>
<outgoing>Flow_1q0104d</outgoing>
</exclusiveGateway>
<sequenceFlow id="Flow_0gz6m5h" sourceRef="Activity_09jvd1k" targetRef="Gateway_0cpycfu" />
<sequenceFlow id="Flow_0xr8cyx" name="大于5天" sourceRef="Gateway_0cpycfu" targetRef="Activity_1e8r5fw">
<conditionExpression xsi:type="tFormalExpression">${day&gt;='5'}</conditionExpression>
</sequenceFlow>
<userTask id="Activity_1e8r5fw" name="经理1" flowable:dataType="fixed" flowable:assignee="1">
<incoming>Flow_0xr8cyx</incoming>
<outgoing>Flow_0tsugrj</outgoing>
</userTask>
<sequenceFlow id="Flow_1q0104d" name="小于5天" sourceRef="Gateway_0cpycfu" targetRef="Activity_07noxc0">
<conditionExpression xsi:type="tFormalExpression">${day&lt;'5'}</conditionExpression>
</sequenceFlow>
<userTask id="Activity_07noxc0" name="经理2" flowable:dataType="dynamic" flowable:userType="candidateUsers" flowable:candidateUsers="#{approval}">
<incoming>Flow_1q0104d</incoming>
<outgoing>Flow_0lp4wbb</outgoing>
</userTask>
<exclusiveGateway id="Gateway_1ast211">
<incoming>Flow_0lp4wbb</incoming>
<incoming>Flow_0tsugrj</incoming>
<outgoing>Flow_1gzuxun</outgoing>
</exclusiveGateway>
<sequenceFlow id="Flow_0lp4wbb" sourceRef="Activity_07noxc0" targetRef="Gateway_1ast211" />
<sequenceFlow id="Flow_0tsugrj" sourceRef="Activity_1e8r5fw" targetRef="Gateway_1ast211" />
<sequenceFlow id="Flow_1gzuxun" sourceRef="Gateway_1ast211" targetRef="Activity_111pdbh" />
<userTask id="Activity_111pdbh" name="老板" flowable:dataType="fixed" flowable:assignee="1">
<incoming>Flow_1gzuxun</incoming>
<outgoing>Flow_1lheo5z</outgoing>
</userTask>
<endEvent id="Event_0n8co8k">
<incoming>Flow_1lheo5z</incoming>
</endEvent>
<sequenceFlow id="Flow_1lheo5z" sourceRef="Activity_111pdbh" targetRef="Event_0n8co8k" />
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_flow">
<bpmndi:BPMNPlane id="BPMNPlane_flow" bpmnElement="process_tvk31y9s">
<bpmndi:BPMNEdge id="Flow_1lheo5z_di" bpmnElement="Flow_1lheo5z">
<di:waypoint x="810" y="160" />
<di:waypoint x="872" y="160" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1gzuxun_di" bpmnElement="Flow_1gzuxun">
<di:waypoint x="655" y="160" />
<di:waypoint x="710" y="160" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0tsugrj_di" bpmnElement="Flow_0tsugrj">
<di:waypoint x="550" y="60" />
<di:waypoint x="630" y="60" />
<di:waypoint x="630" y="135" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0lp4wbb_di" bpmnElement="Flow_0lp4wbb">
<di:waypoint x="550" y="250" />
<di:waypoint x="630" y="250" />
<di:waypoint x="630" y="185" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1q0104d_di" bpmnElement="Flow_1q0104d">
<di:waypoint x="370" y="165" />
<di:waypoint x="370" y="250" />
<di:waypoint x="450" y="250" />
<bpmndi:BPMNLabel>
<omgdc:Bounds x="380" y="205" width="40" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0xr8cyx_di" bpmnElement="Flow_0xr8cyx">
<di:waypoint x="370" y="115" />
<di:waypoint x="370" y="60" />
<di:waypoint x="450" y="60" />
<bpmndi:BPMNLabel>
<omgdc:Bounds x="380" y="85" width="40" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0gz6m5h_di" bpmnElement="Flow_0gz6m5h">
<di:waypoint x="280" y="140" />
<di:waypoint x="345" y="140" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0fp5q3o_di" bpmnElement="Flow_0fp5q3o">
<di:waypoint x="120" y="140" />
<di:waypoint x="180" y="140" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_00tfp5n_di" bpmnElement="Flow_00tfp5n">
<di:waypoint x="-35" y="140" />
<di:waypoint x="20" y="140" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="BPMNShape_startNode1" bpmnElement="startNode1" bioc:stroke="">
<omgdc:Bounds x="-65" y="125" width="30" height="30" />
<bpmndi:BPMNLabel>
<omgdc:Bounds x="-62" y="162" width="22" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_01dhve2_di" bpmnElement="Activity_1o4r0b6">
<omgdc:Bounds x="20" y="100" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_022p6c8_di" bpmnElement="Activity_09jvd1k">
<omgdc:Bounds x="180" y="100" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Gateway_0cpycfu_di" bpmnElement="Gateway_0cpycfu" isMarkerVisible="true">
<omgdc:Bounds x="345" y="115" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1rql8n7_di" bpmnElement="Activity_1e8r5fw">
<omgdc:Bounds x="450" y="20" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0w55bzw_di" bpmnElement="Activity_07noxc0">
<omgdc:Bounds x="450" y="210" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Gateway_1ast211_di" bpmnElement="Gateway_1ast211" isMarkerVisible="true">
<omgdc:Bounds x="605" y="135" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0rvt0mc_di" bpmnElement="Activity_111pdbh">
<omgdc:Bounds x="710" y="120" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0n8co8k_di" bpmnElement="Event_0n8co8k">
<omgdc:Bounds x="872" y="142" width="36" height="36" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>

@ -1,6 +1,7 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.BaseIntOption;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
@ -9,6 +10,8 @@ import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysProject; import com.ruoyi.system.domain.SysProject;
import com.ruoyi.system.service.ISysProjectService; import com.ruoyi.system.service.ISysProjectService;
import org.eclipse.collections.api.list.MutableList;
import org.eclipse.collections.impl.factory.Lists;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -39,6 +42,20 @@ public class SysProjectController extends BaseController
List<SysProject> list = sysProjectService.selectSysProjectList(sysProject); List<SysProject> list = sysProjectService.selectSysProjectList(sysProject);
return getDataTable(list); return getDataTable(list);
} }
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:project:list')")
@GetMapping("/option")
public AjaxResult option()
{
startPage();
List<SysProject> list = sysProjectService.selectSysProjectList(new SysProject());
MutableList<BaseIntOption> collect = Lists.adapt(list)
.collect(e -> new BaseIntOption().label(e.getName())
.value(e.getProjectId()));
return AjaxResult.success(collect);
}
/** /**
* *

@ -118,7 +118,19 @@
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId> <artifactId>javax.servlet-api</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.collections</groupId>
<artifactId>eclipse-collections</artifactId>
<version>11.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

@ -0,0 +1,31 @@
package com.ruoyi.common.base;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Data
@Accessors(fluent = true)
public class BaseIntOption implements Serializable {
private static final long serialVersionUID = 1L;
private Long value;
private String label;
public Long getValue() {
return value;
}
public void setValue(Long value) {
this.value = value;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
}

@ -77,6 +77,15 @@ public class AjaxResult extends HashMap<String, Object>
{ {
return AjaxResult.success("操作成功", data); return AjaxResult.success("操作成功", data);
} }
/**
*
*
* @return
*/
public static AjaxResult data(String data)
{
return AjaxResult.success("操作成功", data);
}
/** /**
* *

@ -188,5 +188,12 @@ public class FlowDefinitionController {
List<SysRole> list = sysRoleService.selectRoleList(role); List<SysRole> list = sysRoleService.selectRoleList(role);
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@ApiOperation(value = "获取最新流程id")
@GetMapping("/getLatestIdByKey/{procKey}")
public AjaxResult getLatestIdByKey(@PathVariable("procKey") String procKey) {
String id = flowDefinitionService.getLatestIdByKey(procKey);
return AjaxResult.data(id);
}
} }

@ -26,6 +26,13 @@ public interface IFlowDefinitionService {
*/ */
Page<FlowProcDefDto> list(String name,Integer pageNum, Integer pageSize); Page<FlowProcDefDto> list(String name,Integer pageNum, Integer pageSize);
/**
* id
* @param key key
* @return
*/
String getLatestIdByKey(String key);
/** /**
* *
* *

@ -3,6 +3,8 @@ package com.ruoyi.flowable.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.CustomException;
import com.ruoyi.flowable.common.constant.ProcessConstants; import com.ruoyi.flowable.common.constant.ProcessConstants;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
@ -121,6 +123,27 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
return page; return page;
} }
/**
*
*
* @param key key
* @return
*/
@Override
public String getLatestIdByKey(String key) {
// // 流程定义列表数据查询
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
.processDefinitionKey(key)
.latestVersion()
.singleResult();
if (Objects.isNull(processDefinition)) {
throw new CustomException("获取流程信息异常,流程 不存在", HttpStatus.UNAUTHORIZED);
}
return processDefinition.getId();
}
/** /**
* *

@ -0,0 +1,29 @@
package com.ruoyi.flowable.service.impl;
import com.ruoyi.flowable.service.IFlowDefinitionService;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import javax.annotation.Resource;
import static org.junit.jupiter.api.Assertions.*;
@RunWith(SpringRunner.class)
@SpringBootTest
@ContextConfiguration
@WebAppConfiguration
@SpringBootConfiguration
class FlowDefinitionServiceImplTest {
@Resource
private IFlowDefinitionService iFlowDefinitionService;
@Test
void getLatestIdByKey() {
final String oa_project_flow = iFlowDefinitionService.getLatestIdByKey("oa_project_flow");
}
}
Loading…
Cancel
Save