code review 工作流的代码

合并最新的 SQL
pull/2/head
YunaiV 2021-10-30 13:46:39 +08:00
parent 31c4a52858
commit 742125ed99
13 changed files with 210 additions and 878 deletions

View File

@ -1,17 +1,17 @@
/* /*
Navicat Premium Data Transfer Navicat Premium Data Transfer
Source Server : local-mysql001 Source Server : 127.0.0.1
Source Server Type : MySQL Source Server Type : MySQL
Source Server Version : 50718 Source Server Version : 80026
Source Host : localhost:3306 Source Host : localhost:3306
Source Schema : ruoyi-vue-pro Source Schema : ruoyi-vue-pro
Target Server Type : MySQL Target Server Type : MySQL
Target Server Version : 50718 Target Server Version : 80026
File Encoding : 65001 File Encoding : 65001
Date: 03/05/2021 12:01:37 Date: 30/10/2021 13:46:03
*/ */
SET NAMES utf8mb4; SET NAMES utf8mb4;
@ -29,7 +29,7 @@ CREATE TABLE `QRTZ_BLOB_TRIGGERS` (
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`), PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
KEY `SCHED_NAME` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`), KEY `SCHED_NAME` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
CONSTRAINT `qrtz_blob_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) CONSTRAINT `qrtz_blob_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ---------------------------- -- ----------------------------
-- Records of QRTZ_BLOB_TRIGGERS -- Records of QRTZ_BLOB_TRIGGERS
@ -46,7 +46,7 @@ CREATE TABLE `QRTZ_CALENDARS` (
`CALENDAR_NAME` varchar(190) NOT NULL, `CALENDAR_NAME` varchar(190) NOT NULL,
`CALENDAR` blob NOT NULL, `CALENDAR` blob NOT NULL,
PRIMARY KEY (`SCHED_NAME`,`CALENDAR_NAME`) PRIMARY KEY (`SCHED_NAME`,`CALENDAR_NAME`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ---------------------------- -- ----------------------------
-- Records of QRTZ_CALENDARS -- Records of QRTZ_CALENDARS
@ -66,12 +66,13 @@ CREATE TABLE `QRTZ_CRON_TRIGGERS` (
`TIME_ZONE_ID` varchar(80) DEFAULT NULL, `TIME_ZONE_ID` varchar(80) DEFAULT NULL,
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`), PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
CONSTRAINT `qrtz_cron_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) CONSTRAINT `qrtz_cron_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ---------------------------- -- ----------------------------
-- Records of QRTZ_CRON_TRIGGERS -- Records of QRTZ_CRON_TRIGGERS
-- ---------------------------- -- ----------------------------
BEGIN; BEGIN;
INSERT INTO `QRTZ_CRON_TRIGGERS` VALUES ('schedulerName', 'payNotifyJob', 'DEFAULT', '* * * * * ?', 'Asia/Shanghai');
INSERT INTO `QRTZ_CRON_TRIGGERS` VALUES ('schedulerName', 'sysUserSessionTimeoutJob', 'DEFAULT', '0 * * * * ? *', 'Asia/Shanghai'); INSERT INTO `QRTZ_CRON_TRIGGERS` VALUES ('schedulerName', 'sysUserSessionTimeoutJob', 'DEFAULT', '0 * * * * ? *', 'Asia/Shanghai');
COMMIT; COMMIT;
@ -85,9 +86,9 @@ CREATE TABLE `QRTZ_FIRED_TRIGGERS` (
`TRIGGER_NAME` varchar(190) NOT NULL, `TRIGGER_NAME` varchar(190) NOT NULL,
`TRIGGER_GROUP` varchar(190) NOT NULL, `TRIGGER_GROUP` varchar(190) NOT NULL,
`INSTANCE_NAME` varchar(190) NOT NULL, `INSTANCE_NAME` varchar(190) NOT NULL,
`FIRED_TIME` bigint(13) NOT NULL, `FIRED_TIME` bigint NOT NULL,
`SCHED_TIME` bigint(13) NOT NULL, `SCHED_TIME` bigint NOT NULL,
`PRIORITY` int(11) NOT NULL, `PRIORITY` int NOT NULL,
`STATE` varchar(16) NOT NULL, `STATE` varchar(16) NOT NULL,
`JOB_NAME` varchar(190) DEFAULT NULL, `JOB_NAME` varchar(190) DEFAULT NULL,
`JOB_GROUP` varchar(190) DEFAULT NULL, `JOB_GROUP` varchar(190) DEFAULT NULL,
@ -100,7 +101,7 @@ CREATE TABLE `QRTZ_FIRED_TRIGGERS` (
KEY `IDX_QRTZ_FT_JG` (`SCHED_NAME`,`JOB_GROUP`), KEY `IDX_QRTZ_FT_JG` (`SCHED_NAME`,`JOB_GROUP`),
KEY `IDX_QRTZ_FT_T_G` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`), KEY `IDX_QRTZ_FT_T_G` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
KEY `IDX_QRTZ_FT_TG` (`SCHED_NAME`,`TRIGGER_GROUP`) KEY `IDX_QRTZ_FT_TG` (`SCHED_NAME`,`TRIGGER_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ---------------------------- -- ----------------------------
-- Records of QRTZ_FIRED_TRIGGERS -- Records of QRTZ_FIRED_TRIGGERS
@ -126,12 +127,13 @@ CREATE TABLE `QRTZ_JOB_DETAILS` (
PRIMARY KEY (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`), PRIMARY KEY (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`),
KEY `IDX_QRTZ_J_REQ_RECOVERY` (`SCHED_NAME`,`REQUESTS_RECOVERY`), KEY `IDX_QRTZ_J_REQ_RECOVERY` (`SCHED_NAME`,`REQUESTS_RECOVERY`),
KEY `IDX_QRTZ_J_GRP` (`SCHED_NAME`,`JOB_GROUP`) KEY `IDX_QRTZ_J_GRP` (`SCHED_NAME`,`JOB_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ---------------------------- -- ----------------------------
-- Records of QRTZ_JOB_DETAILS -- Records of QRTZ_JOB_DETAILS
-- ---------------------------- -- ----------------------------
BEGIN; BEGIN;
INSERT INTO `QRTZ_JOB_DETAILS` VALUES ('schedulerName', 'payNotifyJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000057400104A4F425F48414E444C45525F4E414D4574000C7061794E6F746966794A6F627800);
INSERT INTO `QRTZ_JOB_DETAILS` VALUES ('schedulerName', 'sysUserSessionTimeoutJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000037400104A4F425F48414E444C45525F4E414D457400187379735573657253657373696F6E54696D656F75744A6F627800); INSERT INTO `QRTZ_JOB_DETAILS` VALUES ('schedulerName', 'sysUserSessionTimeoutJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000037400104A4F425F48414E444C45525F4E414D457400187379735573657253657373696F6E54696D656F75744A6F627800);
COMMIT; COMMIT;
@ -143,7 +145,7 @@ CREATE TABLE `QRTZ_LOCKS` (
`SCHED_NAME` varchar(120) NOT NULL, `SCHED_NAME` varchar(120) NOT NULL,
`LOCK_NAME` varchar(40) NOT NULL, `LOCK_NAME` varchar(40) NOT NULL,
PRIMARY KEY (`SCHED_NAME`,`LOCK_NAME`) PRIMARY KEY (`SCHED_NAME`,`LOCK_NAME`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ---------------------------- -- ----------------------------
-- Records of QRTZ_LOCKS -- Records of QRTZ_LOCKS
@ -161,7 +163,7 @@ CREATE TABLE `QRTZ_PAUSED_TRIGGER_GRPS` (
`SCHED_NAME` varchar(120) NOT NULL, `SCHED_NAME` varchar(120) NOT NULL,
`TRIGGER_GROUP` varchar(190) NOT NULL, `TRIGGER_GROUP` varchar(190) NOT NULL,
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_GROUP`) PRIMARY KEY (`SCHED_NAME`,`TRIGGER_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ---------------------------- -- ----------------------------
-- Records of QRTZ_PAUSED_TRIGGER_GRPS -- Records of QRTZ_PAUSED_TRIGGER_GRPS
@ -176,16 +178,16 @@ DROP TABLE IF EXISTS `QRTZ_SCHEDULER_STATE`;
CREATE TABLE `QRTZ_SCHEDULER_STATE` ( CREATE TABLE `QRTZ_SCHEDULER_STATE` (
`SCHED_NAME` varchar(120) NOT NULL, `SCHED_NAME` varchar(120) NOT NULL,
`INSTANCE_NAME` varchar(190) NOT NULL, `INSTANCE_NAME` varchar(190) NOT NULL,
`LAST_CHECKIN_TIME` bigint(13) NOT NULL, `LAST_CHECKIN_TIME` bigint NOT NULL,
`CHECKIN_INTERVAL` bigint(13) NOT NULL, `CHECKIN_INTERVAL` bigint NOT NULL,
PRIMARY KEY (`SCHED_NAME`,`INSTANCE_NAME`) PRIMARY KEY (`SCHED_NAME`,`INSTANCE_NAME`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ---------------------------- -- ----------------------------
-- Records of QRTZ_SCHEDULER_STATE -- Records of QRTZ_SCHEDULER_STATE
-- ---------------------------- -- ----------------------------
BEGIN; BEGIN;
INSERT INTO `QRTZ_SCHEDULER_STATE` VALUES ('schedulerName', 'Yunai1620010117445', 1620010210071, 15000); INSERT INTO `QRTZ_SCHEDULER_STATE` VALUES ('schedulerName', 'Yunai.local1635571630493', 1635572537879, 15000);
COMMIT; COMMIT;
-- ---------------------------- -- ----------------------------
@ -196,12 +198,12 @@ CREATE TABLE `QRTZ_SIMPLE_TRIGGERS` (
`SCHED_NAME` varchar(120) NOT NULL, `SCHED_NAME` varchar(120) NOT NULL,
`TRIGGER_NAME` varchar(190) NOT NULL, `TRIGGER_NAME` varchar(190) NOT NULL,
`TRIGGER_GROUP` varchar(190) NOT NULL, `TRIGGER_GROUP` varchar(190) NOT NULL,
`REPEAT_COUNT` bigint(7) NOT NULL, `REPEAT_COUNT` bigint NOT NULL,
`REPEAT_INTERVAL` bigint(12) NOT NULL, `REPEAT_INTERVAL` bigint NOT NULL,
`TIMES_TRIGGERED` bigint(10) NOT NULL, `TIMES_TRIGGERED` bigint NOT NULL,
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`), PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
CONSTRAINT `qrtz_simple_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) CONSTRAINT `qrtz_simple_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ---------------------------- -- ----------------------------
-- Records of QRTZ_SIMPLE_TRIGGERS -- Records of QRTZ_SIMPLE_TRIGGERS
@ -220,17 +222,17 @@ CREATE TABLE `QRTZ_SIMPROP_TRIGGERS` (
`STR_PROP_1` varchar(512) DEFAULT NULL, `STR_PROP_1` varchar(512) DEFAULT NULL,
`STR_PROP_2` varchar(512) DEFAULT NULL, `STR_PROP_2` varchar(512) DEFAULT NULL,
`STR_PROP_3` varchar(512) DEFAULT NULL, `STR_PROP_3` varchar(512) DEFAULT NULL,
`INT_PROP_1` int(11) DEFAULT NULL, `INT_PROP_1` int DEFAULT NULL,
`INT_PROP_2` int(11) DEFAULT NULL, `INT_PROP_2` int DEFAULT NULL,
`LONG_PROP_1` bigint(20) DEFAULT NULL, `LONG_PROP_1` bigint DEFAULT NULL,
`LONG_PROP_2` bigint(20) DEFAULT NULL, `LONG_PROP_2` bigint DEFAULT NULL,
`DEC_PROP_1` decimal(13,4) DEFAULT NULL, `DEC_PROP_1` decimal(13,4) DEFAULT NULL,
`DEC_PROP_2` decimal(13,4) DEFAULT NULL, `DEC_PROP_2` decimal(13,4) DEFAULT NULL,
`BOOL_PROP_1` varchar(1) DEFAULT NULL, `BOOL_PROP_1` varchar(1) DEFAULT NULL,
`BOOL_PROP_2` varchar(1) DEFAULT NULL, `BOOL_PROP_2` varchar(1) DEFAULT NULL,
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`), PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
CONSTRAINT `qrtz_simprop_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) CONSTRAINT `qrtz_simprop_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ---------------------------- -- ----------------------------
-- Records of QRTZ_SIMPROP_TRIGGERS -- Records of QRTZ_SIMPROP_TRIGGERS
@ -249,15 +251,15 @@ CREATE TABLE `QRTZ_TRIGGERS` (
`JOB_NAME` varchar(190) NOT NULL, `JOB_NAME` varchar(190) NOT NULL,
`JOB_GROUP` varchar(190) NOT NULL, `JOB_GROUP` varchar(190) NOT NULL,
`DESCRIPTION` varchar(250) DEFAULT NULL, `DESCRIPTION` varchar(250) DEFAULT NULL,
`NEXT_FIRE_TIME` bigint(13) DEFAULT NULL, `NEXT_FIRE_TIME` bigint DEFAULT NULL,
`PREV_FIRE_TIME` bigint(13) DEFAULT NULL, `PREV_FIRE_TIME` bigint DEFAULT NULL,
`PRIORITY` int(11) DEFAULT NULL, `PRIORITY` int DEFAULT NULL,
`TRIGGER_STATE` varchar(16) NOT NULL, `TRIGGER_STATE` varchar(16) NOT NULL,
`TRIGGER_TYPE` varchar(8) NOT NULL, `TRIGGER_TYPE` varchar(8) NOT NULL,
`START_TIME` bigint(13) NOT NULL, `START_TIME` bigint NOT NULL,
`END_TIME` bigint(13) DEFAULT NULL, `END_TIME` bigint DEFAULT NULL,
`CALENDAR_NAME` varchar(190) DEFAULT NULL, `CALENDAR_NAME` varchar(190) DEFAULT NULL,
`MISFIRE_INSTR` smallint(2) DEFAULT NULL, `MISFIRE_INSTR` smallint DEFAULT NULL,
`JOB_DATA` blob, `JOB_DATA` blob,
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`), PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
KEY `IDX_QRTZ_T_J` (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`), KEY `IDX_QRTZ_T_J` (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`),
@ -273,13 +275,14 @@ CREATE TABLE `QRTZ_TRIGGERS` (
KEY `IDX_QRTZ_T_NFT_ST_MISFIRE` (`SCHED_NAME`,`MISFIRE_INSTR`,`NEXT_FIRE_TIME`,`TRIGGER_STATE`), KEY `IDX_QRTZ_T_NFT_ST_MISFIRE` (`SCHED_NAME`,`MISFIRE_INSTR`,`NEXT_FIRE_TIME`,`TRIGGER_STATE`),
KEY `IDX_QRTZ_T_NFT_ST_MISFIRE_GRP` (`SCHED_NAME`,`MISFIRE_INSTR`,`NEXT_FIRE_TIME`,`TRIGGER_GROUP`,`TRIGGER_STATE`), KEY `IDX_QRTZ_T_NFT_ST_MISFIRE_GRP` (`SCHED_NAME`,`MISFIRE_INSTR`,`NEXT_FIRE_TIME`,`TRIGGER_GROUP`,`TRIGGER_STATE`),
CONSTRAINT `qrtz_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) REFERENCES `QRTZ_JOB_DETAILS` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) CONSTRAINT `qrtz_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) REFERENCES `QRTZ_JOB_DETAILS` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ---------------------------- -- ----------------------------
-- Records of QRTZ_TRIGGERS -- Records of QRTZ_TRIGGERS
-- ---------------------------- -- ----------------------------
BEGIN; BEGIN;
INSERT INTO `QRTZ_TRIGGERS` VALUES ('schedulerName', 'sysUserSessionTimeoutJob', 'DEFAULT', 'sysUserSessionTimeoutJob', 'DEFAULT', NULL, 1620010260000, 1620010200000, 5, 'WAITING', 'CRON', 1613649236000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D707400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000007D074000F4A4F425F52455452595F434F554E547371007E0009000000037800); INSERT INTO `QRTZ_TRIGGERS` VALUES ('schedulerName', 'payNotifyJob', 'DEFAULT', 'payNotifyJob', 'DEFAULT', NULL, 1635572540000, 1635572539000, 5, 'WAITING', 'CRON', 1635294882000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D707400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E5471007E000B7800);
INSERT INTO `QRTZ_TRIGGERS` VALUES ('schedulerName', 'sysUserSessionTimeoutJob', 'DEFAULT', 'sysUserSessionTimeoutJob', 'DEFAULT', NULL, 1635572580000, 1635572520000, 5, 'WAITING', 'CRON', 1613649236000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D707400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000007D074000F4A4F425F52455452595F434F554E547371007E0009000000037800);
COMMIT; COMMIT;
SET FOREIGN_KEY_CHECKS = 1; SET FOREIGN_KEY_CHECKS = 1;

File diff suppressed because one or more lines are too long

View File

@ -1,33 +1,32 @@
package cn.iocoder.yudao.adminserver.modules.activiti.controller.oa; package cn.iocoder.yudao.adminserver.modules.activiti.controller.oa;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.*; import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.*;
import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OaLeaveDO;
import cn.iocoder.yudao.adminserver.modules.activiti.convert.oa.OaLeaveConvert; import cn.iocoder.yudao.adminserver.modules.activiti.convert.oa.OaLeaveConvert;
import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OaLeaveDO;
import cn.iocoder.yudao.adminserver.modules.activiti.service.oa.OaLeaveService; import cn.iocoder.yudao.adminserver.modules.activiti.service.oa.OaLeaveService;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
// TODO @jasonOa=》OA 会不会好点,名词缩写哈
@Api(tags = "请假申请") @Api(tags = "请假申请")
@RestController @RestController
@RequestMapping("/oa/leave") @RequestMapping("/oa/leave")
@ -41,6 +40,7 @@ public class OaLeaveController {
@ApiOperation("创建请假申请") @ApiOperation("创建请假申请")
@PreAuthorize("@ss.hasPermission('oa:leave:create')") @PreAuthorize("@ss.hasPermission('oa:leave:create')")
public CommonResult<Long> createLeave(@Valid @RequestBody OaLeaveCreateReqVO createReqVO) { public CommonResult<Long> createLeave(@Valid @RequestBody OaLeaveCreateReqVO createReqVO) {
// TODO @芋艿processKey 自己去理解下。不过得把 leave 变成枚举
createReqVO.setProcessKey("leave"); createReqVO.setProcessKey("leave");
return success(leaveService.createLeave(createReqVO)); return success(leaveService.createLeave(createReqVO));
} }
@ -48,6 +48,7 @@ public class OaLeaveController {
@PostMapping("/form-key/create") @PostMapping("/form-key/create")
@ApiOperation("创建外置请假申请") @ApiOperation("创建外置请假申请")
public CommonResult<Long> createFormKeyLeave(@Valid @RequestBody OaLeaveCreateReqVO createReqVO) { public CommonResult<Long> createFormKeyLeave(@Valid @RequestBody OaLeaveCreateReqVO createReqVO) {
// TODO @芋艿processKey 自己去理解下。不过得把 formkey 变成枚举
createReqVO.setProcessKey("leave-formkey"); createReqVO.setProcessKey("leave-formkey");
return success(leaveService.createLeave(createReqVO)); return success(leaveService.createLeave(createReqVO));
} }
@ -92,6 +93,7 @@ public class OaLeaveController {
@PreAuthorize("@ss.hasPermission('oa:leave:query')") @PreAuthorize("@ss.hasPermission('oa:leave:query')")
public CommonResult<PageResult<OaLeaveRespVO>> getLeavePage(@Valid OaLeavePageReqVO pageVO) { public CommonResult<PageResult<OaLeaveRespVO>> getLeavePage(@Valid OaLeavePageReqVO pageVO) {
//值查询自己申请请假 //值查询自己申请请假
// TODO @芋艿:这里的传值,到底前端搞,还是后端搞。
pageVO.setUserId(SecurityFrameworkUtils.getLoginUser().getUsername()); pageVO.setUserId(SecurityFrameworkUtils.getLoginUser().getUsername());
PageResult<OaLeaveDO> pageResult = leaveService.getLeavePage(pageVO); PageResult<OaLeaveDO> pageResult = leaveService.getLeavePage(pageVO);
return success(OaLeaveConvert.INSTANCE.convertPage(pageResult)); return success(OaLeaveConvert.INSTANCE.convertPage(pageResult));

View File

@ -1,9 +1,13 @@
package cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo; package cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo;
import lombok.*; import io.swagger.annotations.ApiModel;
import java.util.*; import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*; import lombok.Data;
import javax.validation.constraints.*; import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.validation.constraints.NotNull;
import java.util.Map;
@ApiModel("请假申请更新 Request VO") @ApiModel("请假申请更新 Request VO")
@Data @Data
@ -15,6 +19,7 @@ public class OaLeaveUpdateReqVO extends OaLeaveBaseVO {
@NotNull(message = "请假表单主键不能为空") @NotNull(message = "请假表单主键不能为空")
private Long id; private Long id;
// TODO @jsonswagger 和 validator 的注解要加哈。
private String taskId; private String taskId;
@ -22,4 +27,6 @@ public class OaLeaveUpdateReqVO extends OaLeaveBaseVO {
private Map<String,Object> variables; private Map<String,Object> variables;
// TODO @芋艿variables 的作用是啥。
} }

View File

@ -3,8 +3,6 @@ package cn.iocoder.yudao.adminserver.modules.activiti.controller.workflow;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import org.activiti.api.process.runtime.ProcessRuntime; import org.activiti.api.process.runtime.ProcessRuntime;
import org.activiti.engine.RepositoryService; import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.repository.ProcessDefinitionQuery;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -12,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
// TODO @jsonswagger 和 validation 的注解,后续要补全下哈。可以等 workflow 基本写的差不多之后
@RestController @RestController
@RequestMapping("/workflow/process/definition") @RequestMapping("/workflow/process/definition")
public class ProcessDefinitionController { public class ProcessDefinitionController {
@ -31,4 +30,5 @@ public class ProcessDefinitionController {
// processRuntime.processDefinition(processDefinition.getId()).getFormKey(); // processRuntime.processDefinition(processDefinition.getId()).getFormKey();
return CommonResult.success("/flow/leave/apply"); return CommonResult.success("/flow/leave/apply");
} }
} }

View File

@ -14,6 +14,7 @@ import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
// TODO @jsonswagger 和 validation 的注解,后续要补全下哈。可以等 workflow 基本写的差不多之后
@Api(tags = "工作流待办任务") @Api(tags = "工作流待办任务")
@RestController @RestController
@RequestMapping("/workflow/task") @RequestMapping("/workflow/task")
@ -22,8 +23,6 @@ public class TaskController {
@Resource @Resource
private TaskService taskService; private TaskService taskService;
@GetMapping("/todo/page") @GetMapping("/todo/page")
@ApiOperation("获取待办任务分页") @ApiOperation("获取待办任务分页")
public CommonResult<PageResult<TodoTaskRespVO>> getTodoTaskPage(@Valid TodoTaskPageReqVO pageVO) { public CommonResult<PageResult<TodoTaskRespVO>> getTodoTaskPage(@Valid TodoTaskPageReqVO pageVO) {
@ -37,15 +36,14 @@ public class TaskController {
return success(true); return success(true);
} }
@PostMapping("/task-steps") @PostMapping("/task-steps")
public CommonResult<TaskHandleVO> getTaskSteps(@RequestBody TaskQueryReqVO taskQuery) { public CommonResult<TaskHandleVO> getTaskSteps(@RequestBody TaskQueryReqVO taskQuery) {
return success( taskService.getTaskSteps(taskQuery)); return success(taskService.getTaskSteps(taskQuery));
} }
@PostMapping("/formKey") @PostMapping("/formKey")
public CommonResult<TodoTaskRespVO> getTaskFormKey(@RequestBody TaskQueryReqVO taskQuery) { public CommonResult<TodoTaskRespVO> getTaskFormKey(@RequestBody TaskQueryReqVO taskQuery) {
return success( taskService.getTaskFormKey(taskQuery)); return success(taskService.getTaskFormKey(taskQuery));
} }
@PostMapping("/complete") @PostMapping("/complete")
@ -54,9 +52,9 @@ public class TaskController {
return success(true); return success(true);
} }
@GetMapping("/process/history-steps") @GetMapping("/process/history-steps")
public CommonResult<List<TaskStepVO>> getHistorySteps(@RequestParam("id") String processInstanceId) { public CommonResult<List<TaskStepVO>> getHistorySteps(@RequestParam("id") String processInstanceId) {
return success( taskService.getHistorySteps(processInstanceId)); return success(taskService.getHistorySteps(processInstanceId));
} }
} }

View File

@ -0,0 +1,2 @@
// TODO @芋艿:思考下 activiti、oa 的定位,边界,模块的拆分
package cn.iocoder.yudao.adminserver.modules.activiti;

View File

@ -4,9 +4,7 @@ import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OaLeaveDO
import cn.iocoder.yudao.adminserver.modules.activiti.dal.mysql.oa.OaLeaveMapper; import cn.iocoder.yudao.adminserver.modules.activiti.dal.mysql.oa.OaLeaveMapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.activiti.engine.delegate.DelegateExecution; import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.ExecutionListener; import org.activiti.engine.delegate.ExecutionListener;
import org.activiti.engine.delegate.TaskListener;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -34,10 +32,12 @@ public class ReportBackEndProcessor implements ExecutionListener {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void notify(DelegateExecution delegateExecution) { public void notify(DelegateExecution delegateExecution) {
final String businessKey = delegateExecution.getProcessInstanceBusinessKey(); final String businessKey = delegateExecution.getProcessInstanceBusinessKey();
// TODO @jsonservice 不要出现 dao 的元素,例如说 UpdateWrapper。这里我们可以调用 updateById 方法
UpdateWrapper<OaLeaveDO> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<OaLeaveDO> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", Long.valueOf(businessKey)); updateWrapper.eq("id", Long.valueOf(businessKey));
OaLeaveDO updateDo = new OaLeaveDO(); OaLeaveDO updateDo = new OaLeaveDO();
updateDo.setStatus(2); updateDo.setStatus(2); // TODO @jsonstatus 要枚举起来,不要出现 magic number
leaveMapper.update(updateDo, updateWrapper); leaveMapper.update(updateDo, updateWrapper);
} }
} }

View File

@ -1,5 +1,14 @@
package cn.iocoder.yudao.adminserver.modules.activiti.service.oa.impl; package cn.iocoder.yudao.adminserver.modules.activiti.service.oa.impl;
import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OaLeaveCreateReqVO;
import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OaLeaveExportReqVO;
import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OaLeavePageReqVO;
import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OaLeaveUpdateReqVO;
import cn.iocoder.yudao.adminserver.modules.activiti.convert.oa.OaLeaveConvert;
import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OaLeaveDO;
import cn.iocoder.yudao.adminserver.modules.activiti.dal.mysql.oa.OaLeaveMapper;
import cn.iocoder.yudao.adminserver.modules.activiti.service.oa.OaLeaveService;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.activiti.api.task.model.Task; import org.activiti.api.task.model.Task;
@ -7,24 +16,18 @@ import org.activiti.api.task.model.builders.TaskPayloadBuilder;
import org.activiti.api.task.runtime.TaskRuntime; import org.activiti.api.task.runtime.TaskRuntime;
import org.activiti.engine.RuntimeService; import org.activiti.engine.RuntimeService;
import org.activiti.engine.runtime.ProcessInstance; import org.activiti.engine.runtime.ProcessInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import java.util.*; import javax.annotation.Resource;
import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.*; import java.util.Collection;
import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OaLeaveDO; import java.util.HashMap;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import java.util.List;
import java.util.Map;
import cn.iocoder.yudao.adminserver.modules.activiti.convert.oa.OaLeaveConvert;
import cn.iocoder.yudao.adminserver.modules.activiti.dal.mysql.oa.OaLeaveMapper;
import cn.iocoder.yudao.adminserver.modules.activiti.service.oa.OaLeaveService;
import static cn.iocoder.yudao.adminserver.modules.activiti.enums.OaErrorCodeConstants.LEAVE_NOT_EXISTS;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.adminserver.modules.activiti.enums.OaErrorCodeConstants.*;
/** /**
* Service * Service
@ -50,35 +53,34 @@ public class OaLeaveServiceImpl implements OaLeaveService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Long createLeave(OaLeaveCreateReqVO createReqVO) { public Long createLeave(OaLeaveCreateReqVO createReqVO) {
// 插入 // 插入 OA 请假单
OaLeaveDO leave = OaLeaveConvert.INSTANCE.convert(createReqVO); OaLeaveDO leave = OaLeaveConvert.INSTANCE.convert(createReqVO);
leave.setStatus(1); leave.setStatus(1);
leave.setUserId(SecurityFrameworkUtils.getLoginUser().getUsername()); leave.setUserId(SecurityFrameworkUtils.getLoginUser().getUsername());
leaveMapper.insert(leave); leaveMapper.insert(leave);
// 创建工作流
Map<String, Object> variables = new HashMap<>(); Map<String, Object> variables = new HashMap<>();
//如何得到部门领导人, 暂时写死 // 如何得到部门领导人,暂时写死
variables.put("deptLeader", "admin"); variables.put("deptLeader", "admin"); // TODO @芋艿:需要部门的负责人
final Long id = leave.getId(); Long id = leave.getId();
String businessKey = String.valueOf(id); String businessKey = String.valueOf(id);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(createReqVO.getProcessKey(), businessKey, variables); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(createReqVO.getProcessKey(), businessKey, variables);
String processInstanceId = processInstance.getProcessInstanceId();
final String processInstanceId = processInstance.getProcessInstanceId(); // TODO @jsonservice 不要出现 dao 的元素,例如说 UpdateWrapper。这里我们可以调用 updateById 方法
// 将工作流的编号,更新到 OA 请假单中
UpdateWrapper<OaLeaveDO> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<OaLeaveDO> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", id); updateWrapper.eq("id", id);
OaLeaveDO updateDo = new OaLeaveDO(); OaLeaveDO updateDo = new OaLeaveDO();
updateDo.setProcessInstanceId(processInstanceId); updateDo.setProcessInstanceId(processInstanceId);
leaveMapper.update(updateDo, updateWrapper); leaveMapper.update(updateDo, updateWrapper);
// 返回
return id; return id;
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateLeave(OaLeaveUpdateReqVO updateReqVO) { public void updateLeave(OaLeaveUpdateReqVO updateReqVO) {
// 校验存在 // 校验存在
this.validateLeaveExists(updateReqVO.getId()); this.validateLeaveExists(updateReqVO.getId());
@ -91,14 +93,14 @@ public class OaLeaveServiceImpl implements OaLeaveService {
taskRuntime.complete(TaskPayloadBuilder.complete().withTaskId(task.getId()) taskRuntime.complete(TaskPayloadBuilder.complete().withTaskId(task.getId())
.withVariables(variables) .withVariables(variables)
.build()); .build());
// TODO @jason不需要加 final 哈。虽然是不变,但是代码比较少这么去写
final Object reApply = variables.get("reApply"); final Object reApply = variables.get("reApply");
// TODO @jason直接使用 Objects.equals(reApply, true) 就可以
if((reApply instanceof Boolean) && (Boolean)reApply){ if((reApply instanceof Boolean) && (Boolean)reApply){
// 更新 表单 // 更新 表单
OaLeaveDO updateObj = OaLeaveConvert.INSTANCE.convert(updateReqVO); OaLeaveDO updateObj = OaLeaveConvert.INSTANCE.convert(updateReqVO);
leaveMapper.updateById(updateObj); leaveMapper.updateById(updateObj);
} }
} }
@Override @Override
@ -107,6 +109,7 @@ public class OaLeaveServiceImpl implements OaLeaveService {
this.validateLeaveExists(id); this.validateLeaveExists(id);
// 删除 // 删除
leaveMapper.deleteById(id); leaveMapper.deleteById(id);
// TODO @jason需要调用 runtimeService 的 delete 方法,删除???
} }
private void validateLeaveExists(Long id) { private void validateLeaveExists(Long id) {

View File

@ -3,9 +3,9 @@ package cn.iocoder.yudao.adminserver.modules.activiti.service.workflow;
import cn.iocoder.yudao.adminserver.modules.activiti.controller.workflow.vo.*; import cn.iocoder.yudao.adminserver.modules.activiti.controller.workflow.vo.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
// TODO @芋艿:前缀,注释
public interface TaskService { public interface TaskService {
PageResult<TodoTaskRespVO> getTodoTaskPage(TodoTaskPageReqVO pageReqVO); PageResult<TodoTaskRespVO> getTodoTaskPage(TodoTaskPageReqVO pageReqVO);
@ -22,4 +22,5 @@ public interface TaskService {
List<TaskStepVO> getHistorySteps(String processInstanceId); List<TaskStepVO> getHistorySteps(String processInstanceId);
TodoTaskRespVO getTaskFormKey(TaskQueryReqVO taskQuery); TodoTaskRespVO getTaskFormKey(TaskQueryReqVO taskQuery);
} }

View File

@ -1,39 +1,28 @@
package cn.iocoder.yudao.adminserver.modules.activiti.service.workflow.impl; package cn.iocoder.yudao.adminserver.modules.activiti.service.workflow.impl;
import cn.iocoder.yudao.adminserver.modules.activiti.controller.workflow.vo.*; import cn.iocoder.yudao.adminserver.modules.activiti.controller.workflow.vo.*;
import cn.iocoder.yudao.adminserver.modules.activiti.convert.oa.OaLeaveConvert;
import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OaLeaveDO;
import cn.iocoder.yudao.adminserver.modules.activiti.dal.mysql.oa.OaLeaveMapper; import cn.iocoder.yudao.adminserver.modules.activiti.dal.mysql.oa.OaLeaveMapper;
import cn.iocoder.yudao.adminserver.modules.activiti.service.oa.OaLeaveService;
import cn.iocoder.yudao.adminserver.modules.activiti.service.workflow.TaskService; import cn.iocoder.yudao.adminserver.modules.activiti.service.workflow.TaskService;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import org.activiti.api.process.runtime.ProcessRuntime;
import org.activiti.api.runtime.shared.query.Page; import org.activiti.api.runtime.shared.query.Page;
import org.activiti.api.runtime.shared.query.Pageable; import org.activiti.api.runtime.shared.query.Pageable;
import org.activiti.api.task.model.Task; import org.activiti.api.task.model.Task;
import org.activiti.api.task.model.builders.ClaimTaskPayloadBuilder; import org.activiti.api.task.model.builders.ClaimTaskPayloadBuilder;
import org.activiti.api.task.model.builders.GetTasksPayloadBuilder;
import org.activiti.api.task.model.builders.TaskPayloadBuilder; import org.activiti.api.task.model.builders.TaskPayloadBuilder;
import org.activiti.api.task.runtime.TaskRuntime; import org.activiti.api.task.runtime.TaskRuntime;
import org.activiti.bpmn.model.BpmnModel;
import org.activiti.bpmn.model.Process;
import org.activiti.engine.HistoryService; import org.activiti.engine.HistoryService;
import org.activiti.engine.RepositoryService; import org.activiti.engine.RepositoryService;
import org.activiti.engine.history.HistoricActivityInstance; import org.activiti.engine.history.HistoricActivityInstance;
import org.activiti.engine.history.HistoricProcessInstance; import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.history.HistoricVariableInstance;
import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
import org.activiti.engine.repository.ProcessDefinition; import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.task.Comment; import org.activiti.engine.task.Comment;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -70,8 +59,10 @@ public class TaskServiceImpl implements TaskService {
@Override @Override
public PageResult<TodoTaskRespVO> getTodoTaskPage(TodoTaskPageReqVO pageReqVO) { public PageResult<TodoTaskRespVO> getTodoTaskPage(TodoTaskPageReqVO pageReqVO) {
final LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); final LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
// TODO @jason封装一个方法用于转换成 activiti 的分页对象
final Pageable pageable = Pageable.of((pageReqVO.getPageNo() - 1) * pageReqVO.getPageSize(), pageReqVO.getPageSize()); final Pageable pageable = Pageable.of((pageReqVO.getPageNo() - 1) * pageReqVO.getPageSize(), pageReqVO.getPageSize());
Page<Task> pageTasks = taskRuntime.tasks(pageable); Page<Task> pageTasks = taskRuntime.tasks(pageable);
// TODO @jasonconvert 里转换
List<Task> tasks = pageTasks.getContent(); List<Task> tasks = pageTasks.getContent();
int totalItems = pageTasks.getTotalItems(); int totalItems = pageTasks.getTotalItems();
final List<TodoTaskRespVO> respVOList = tasks.stream().map(task -> { final List<TodoTaskRespVO> respVOList = tasks.stream().map(task -> {
@ -84,7 +75,8 @@ public class TaskServiceImpl implements TaskService {
respVO.setStatus(task.getAssignee() == null ? 1 : 2); respVO.setStatus(task.getAssignee() == null ? 1 : 2);
return respVO; return respVO;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
return new PageResult(respVOList, Long.valueOf(totalItems)); // TODO @jason要注意泛型哈。
return new PageResult(respVOList, Long.valueOf(totalItems)); // TODO @jason(long) 转换即可
} }
@ -98,12 +90,11 @@ public class TaskServiceImpl implements TaskService {
@Override @Override
public void getTaskHistory(String taskId) { public void getTaskHistory(String taskId) {
final List<HistoricProcessInstance> list = historyService.createHistoricProcessInstanceQuery(). final List<HistoricProcessInstance> list = historyService.createHistoricProcessInstanceQuery().
processInstanceId("8e2801fc-1a38-11ec-98ce-74867a13730f").list(); processInstanceId("8e2801fc-1a38-11ec-98ce-74867a13730f").list();
} }
// TODO @jason一个方法里会有多个方法的调用最好写下对应的注释。这样容易理解
@Override @Override
@Transactional @Transactional
public void completeTask(TaskReqVO taskReq) { public void completeTask(TaskReqVO taskReq) {
@ -173,38 +164,40 @@ public class TaskServiceImpl implements TaskService {
private List<TaskStepVO> getTaskSteps(String processInstanceId) { private List<TaskStepVO> getTaskSteps(String processInstanceId) {
// 获得已完成的活动
List<TaskStepVO> steps = new ArrayList<>(); List<HistoricActivityInstance> finished = historyService.createHistoricActivityInstanceQuery()
List<HistoricActivityInstance> finished = historyService
.createHistoricActivityInstanceQuery()
.processInstanceId(processInstanceId) .processInstanceId(processInstanceId)
.activityType("userTask") .activityType("userTask")
.finished() .finished()
.orderByHistoricActivityInstanceStartTime().asc().list(); .orderByHistoricActivityInstanceStartTime().asc().list();
// 获得对应的步骤
finished.forEach(instance->{ List<TaskStepVO> steps = new ArrayList<>();
finished.forEach(instance -> {
// TODO @jason放到 convert 里
TaskStepVO step = new TaskStepVO(); TaskStepVO step = new TaskStepVO();
step.setStepName(instance.getActivityName()); step.setStepName(instance.getActivityName());
step.setStartTime(instance.getStartTime()); step.setStartTime(instance.getStartTime());
step.setEndTime(instance.getEndTime()); step.setEndTime(instance.getEndTime());
step.setAssignee(instance.getAssignee()); step.setAssignee(instance.getAssignee());
step.setStatus(1); step.setStatus(1);
final List<Comment> comments = activitiTaskService.getTaskComments(instance.getTaskId()); // TODO @jason一般判数组为空使用 CollUtil.isEmpty 会好点哈。另外null 时候,不用填写 "" 的哈
if(comments.size()>0){ List<Comment> comments = activitiTaskService.getTaskComments(instance.getTaskId());
if (comments.size() > 0) {
step.setComment(comments.get(0).getFullMessage()); step.setComment(comments.get(0).getFullMessage());
}else{ } else {
step.setComment(""); step.setComment("");
} }
steps.add(step); steps.add(step);
}); });
// 获得未完成的活动
List<HistoricActivityInstance> unfinished = historyService List<HistoricActivityInstance> unfinished = historyService
.createHistoricActivityInstanceQuery() .createHistoricActivityInstanceQuery()
.processInstanceId(processInstanceId) .processInstanceId(processInstanceId)
.activityType("userTask") .activityType("userTask")
.unfinished().list(); .unfinished().list();
// 获得对应的步骤
// TODO @json其实已完成和未完成它们的 convert 的逻辑,是一致的
for (HistoricActivityInstance instance : unfinished) { for (HistoricActivityInstance instance : unfinished) {
TaskStepVO step = new TaskStepVO(); TaskStepVO step = new TaskStepVO();
step.setStepName(instance.getActivityName()); step.setStepName(instance.getActivityName());
@ -221,13 +214,13 @@ public class TaskServiceImpl implements TaskService {
@Override @Override
public List<TaskStepVO> getHistorySteps(String processInstanceId) { public List<TaskStepVO> getHistorySteps(String processInstanceId) {
return getTaskSteps(processInstanceId); return getTaskSteps(processInstanceId);
} }
@Override @Override
public TodoTaskRespVO getTaskFormKey(TaskQueryReqVO taskQuery) { public TodoTaskRespVO getTaskFormKey(TaskQueryReqVO taskQuery) {
final Task task = taskRuntime.task(taskQuery.getTaskId()); final Task task = taskRuntime.task(taskQuery.getTaskId());
// 转换结果
TodoTaskRespVO respVO = new TodoTaskRespVO(); TodoTaskRespVO respVO = new TodoTaskRespVO();
respVO.setFormKey(task.getFormKey()); respVO.setFormKey(task.getFormKey());
respVO.setBusinessKey(task.getBusinessKey()); respVO.setBusinessKey(task.getBusinessKey());
@ -235,7 +228,6 @@ public class TaskServiceImpl implements TaskService {
return respVO; return respVO;
} }
// private List<String> getHighLightedFlows(ProcessDefinitionEntity processDefinition, String processInstanceId) { // private List<String> getHighLightedFlows(ProcessDefinitionEntity processDefinition, String processInstanceId) {
// //
// List<String> highLightedFlows = new ArrayList<String>(); // List<String> highLightedFlows = new ArrayList<String>();
@ -270,4 +262,5 @@ public class TaskServiceImpl implements TaskService {
// } // }
// return highLightedFlows; // return highLightedFlows;
// } // }
} }

View File

@ -44,6 +44,7 @@
<artifactId>spring-boot-starter-security</artifactId> <artifactId>spring-boot-starter-security</artifactId>
</dependency> </dependency>
<!-- TODO 芋艿: -->
<dependency> <dependency>
<groupId>org.activiti</groupId> <groupId>org.activiti</groupId>
<artifactId>activiti-engine</artifactId> <artifactId>activiti-engine</artifactId>

View File

@ -99,10 +99,8 @@ public class SecurityFrameworkUtils {
// 原因是Spring Security 的 Filter 在 ApiAccessLogFilter 后面,在它记录访问日志时,线上上下文已经没有用户编号等信息 // 原因是Spring Security 的 Filter 在 ApiAccessLogFilter 后面,在它记录访问日志时,线上上下文已经没有用户编号等信息
WebFrameworkUtils.setLoginUserId(request, loginUser.getId()); WebFrameworkUtils.setLoginUserId(request, loginUser.getId());
WebFrameworkUtils.setLoginUserType(request, loginUser.getUserType()); WebFrameworkUtils.setLoginUserType(request, loginUser.getUserType());
// TODO @jason使用 userId 会不会更合适哈?
org.activiti.engine.impl.identity.Authentication.setAuthenticatedUserId(loginUser.getUsername()); org.activiti.engine.impl.identity.Authentication.setAuthenticatedUserId(loginUser.getUsername());
} }
} }