diff --git a/init.sql b/init.sql new file mode 100644 index 000000000..1ba44b1b9 --- /dev/null +++ b/init.sql @@ -0,0 +1,1690 @@ +create table act_evt_log +( + log_nr_ bigint auto_increment + primary key, + type_ varchar(64) null, + proc_def_id_ varchar(64) null, + proc_inst_id_ varchar(64) null, + execution_id_ varchar(64) null, + task_id_ varchar(64) null, + time_stamp_ timestamp(3) default current_timestamp(3) not null, + user_id_ varchar(255) null, + data_ longblob null, + lock_owner_ varchar(255) null, + lock_time_ timestamp(3) null, + is_processed_ tinyint default 0 null +) collate = utf8mb3_bin; + +create table act_fo_databasechangelog +( + id varchar(255) not null, + author varchar(255) not null, + filename varchar(255) not null, + dateexecuted datetime not null, + orderexecuted int not null, + exectype varchar(10) not null, + md5sum varchar(35) null, + description varchar(255) null, + comments varchar(255) null, + tag varchar(255) null, + liquibase varchar(20) null, + contexts varchar(255) null, + labels varchar(255) null, + deployment_id varchar(10) null +); + +create table act_fo_databasechangeloglock +( + id int not null + primary key, + locked bit not null, + lockgranted datetime null, + lockedby varchar(255) null +); + +create table act_fo_form_definition +( + id_ varchar(255) not null + primary key, + name_ varchar(255) null, + version_ int null, + key_ varchar(255) null, + category_ varchar(255) null, + deployment_id_ varchar(255) null, + tenant_id_ varchar(255) null, + resource_name_ varchar(255) null, + description_ varchar(255) null, + constraint act_idx_form_def_uniq + unique (key_, version_, tenant_id_) +); + +create table act_fo_form_deployment +( + id_ varchar(255) not null + primary key, + name_ varchar(255) null, + category_ varchar(255) null, + deploy_time_ datetime(3) null, + tenant_id_ varchar(255) null, + parent_deployment_id_ varchar(255) null +); + +create table act_fo_form_instance +( + id_ varchar(255) not null + primary key, + form_definition_id_ varchar(255) not null, + task_id_ varchar(255) null, + proc_inst_id_ varchar(255) null, + proc_def_id_ varchar(255) null, + submitted_date_ datetime(3) null, + submitted_by_ varchar(255) null, + form_values_id_ varchar(255) null, + tenant_id_ varchar(255) null, + scope_id_ varchar(255) null, + scope_type_ varchar(255) null, + scope_definition_id_ varchar(255) null +); + +create index act_idx_form_proc + on act_fo_form_instance (proc_inst_id_); + +create index act_idx_form_scope + on act_fo_form_instance (scope_id_, scope_type_); + +create index act_idx_form_task + on act_fo_form_instance (task_id_); + +create table act_fo_form_resource +( + id_ varchar(255) not null + primary key, + name_ varchar(255) null, + deployment_id_ varchar(255) null, + resource_bytes_ longblob null +); + +create table act_ge_property +( + name_ varchar(64) not null + primary key, + value_ varchar(300) null, + rev_ int null +) collate = utf8mb3_bin; + +create table act_hi_actinst +( + id_ varchar(64) not null + primary key, + rev_ int default 1 null, + proc_def_id_ varchar(64) not null, + proc_inst_id_ varchar(64) not null, + execution_id_ varchar(64) not null, + act_id_ varchar(255) not null, + task_id_ varchar(64) null, + call_proc_inst_id_ varchar(64) null, + act_name_ varchar(255) null, + act_type_ varchar(255) not null, + assignee_ varchar(255) null, + start_time_ datetime(3) not null, + end_time_ datetime(3) null, + transaction_order_ int null, + duration_ bigint null, + delete_reason_ varchar(4000) null, + tenant_id_ varchar(255) default '' null +) collate = utf8mb3_bin; + +create index act_idx_hi_act_inst_end + on act_hi_actinst (end_time_); + +create index act_idx_hi_act_inst_exec + on act_hi_actinst (execution_id_, act_id_); + +create index act_idx_hi_act_inst_procinst + on act_hi_actinst (proc_inst_id_, act_id_); + +create index act_idx_hi_act_inst_start + on act_hi_actinst (start_time_); + +create table act_hi_attachment +( + id_ varchar(64) not null + primary key, + rev_ int null, + user_id_ varchar(255) null, + name_ varchar(255) null, + description_ varchar(4000) null, + type_ varchar(255) null, + task_id_ varchar(64) null, + proc_inst_id_ varchar(64) null, + url_ varchar(4000) null, + content_id_ varchar(64) null, + time_ datetime(3) null +) collate = utf8mb3_bin; + +create index act_idx_hi_attach_proc_inst + on act_hi_attachment (proc_inst_id_); + +create index act_idx_hi_attach_task_id + on act_hi_attachment (task_id_); + +create table act_hi_comment +( + id_ varchar(64) not null + primary key, + type_ varchar(255) null, + time_ datetime(3) not null, + user_id_ varchar(255) null, + task_id_ varchar(64) null, + proc_inst_id_ varchar(64) null, + action_ varchar(255) null, + message_ varchar(4000) null, + full_msg_ longblob null +) collate = utf8mb3_bin; + +create index act_idx_hi_comment_proc_inst + on act_hi_comment (proc_inst_id_); + +create index act_idx_hi_comment_task_id + on act_hi_comment (task_id_); + +create table act_hi_detail +( + id_ varchar(64) not null + primary key, + type_ varchar(255) not null, + proc_inst_id_ varchar(64) null, + execution_id_ varchar(64) null, + task_id_ varchar(64) null, + act_inst_id_ varchar(64) null, + name_ varchar(255) not null, + var_type_ varchar(255) null, + rev_ int null, + time_ datetime(3) not null, + bytearray_id_ varchar(64) null, + double_ double null, + long_ bigint null, + text_ varchar(4000) null, + text2_ varchar(4000) null +) collate = utf8mb3_bin; + +create index act_idx_hi_detail_act_inst + on act_hi_detail (act_inst_id_); + +create index act_idx_hi_detail_name + on act_hi_detail (name_); + +create index act_idx_hi_detail_proc_inst + on act_hi_detail (proc_inst_id_); + +create index act_idx_hi_detail_task_id + on act_hi_detail (task_id_); + +create index act_idx_hi_detail_time + on act_hi_detail (time_); + +create table act_hi_entitylink +( + id_ varchar(64) not null + primary key, + link_type_ varchar(255) null, + create_time_ datetime(3) null, + scope_id_ varchar(255) null, + sub_scope_id_ varchar(255) null, + scope_type_ varchar(255) null, + scope_definition_id_ varchar(255) null, + parent_element_id_ varchar(255) null, + ref_scope_id_ varchar(255) null, + ref_scope_type_ varchar(255) null, + ref_scope_definition_id_ varchar(255) null, + root_scope_id_ varchar(255) null, + root_scope_type_ varchar(255) null, + hierarchy_type_ varchar(255) null +) collate = utf8mb3_bin; + +create index act_idx_hi_ent_lnk_ref_scope + on act_hi_entitylink (ref_scope_id_, ref_scope_type_, link_type_); + +create index act_idx_hi_ent_lnk_root_scope + on act_hi_entitylink (root_scope_id_, root_scope_type_, link_type_); + +create index act_idx_hi_ent_lnk_scope + on act_hi_entitylink (scope_id_, scope_type_, link_type_); + +create index act_idx_hi_ent_lnk_scope_def + on act_hi_entitylink (scope_definition_id_, scope_type_, link_type_); + +create table act_hi_identitylink +( + id_ varchar(64) not null + primary key, + group_id_ varchar(255) null, + type_ varchar(255) null, + user_id_ varchar(255) null, + task_id_ varchar(64) null, + create_time_ datetime(3) null, + proc_inst_id_ varchar(64) null, + scope_id_ varchar(255) null, + sub_scope_id_ varchar(255) null, + scope_type_ varchar(255) null, + scope_definition_id_ varchar(255) null +) collate = utf8mb3_bin; + +create index act_idx_hi_ident_lnk_procinst + on act_hi_identitylink (proc_inst_id_); + +create index act_idx_hi_ident_lnk_scope + on act_hi_identitylink (scope_id_, scope_type_); + +create index act_idx_hi_ident_lnk_scope_def + on act_hi_identitylink (scope_definition_id_, scope_type_); + +create index act_idx_hi_ident_lnk_sub_scope + on act_hi_identitylink (sub_scope_id_, scope_type_); + +create index act_idx_hi_ident_lnk_task + on act_hi_identitylink (task_id_); + +create index act_idx_hi_ident_lnk_user + on act_hi_identitylink (user_id_); + +create table act_hi_procinst +( + id_ varchar(64) not null + primary key, + rev_ int default 1 null, + proc_inst_id_ varchar(64) not null, + business_key_ varchar(255) null, + proc_def_id_ varchar(64) not null, + start_time_ datetime(3) not null, + end_time_ datetime(3) null, + duration_ bigint null, + start_user_id_ varchar(255) null, + start_act_id_ varchar(255) null, + end_act_id_ varchar(255) null, + super_process_instance_id_ varchar(64) null, + delete_reason_ varchar(4000) null, + tenant_id_ varchar(255) default '' null, + name_ varchar(255) null, + callback_id_ varchar(255) null, + callback_type_ varchar(255) null, + reference_id_ varchar(255) null, + reference_type_ varchar(255) null, + propagated_stage_inst_id_ varchar(255) null, + business_status_ varchar(255) null, + constraint proc_inst_id_ + unique (proc_inst_id_) +) collate = utf8mb3_bin; + +create index act_idx_hi_pro_inst_end + on act_hi_procinst (end_time_); + +create index act_idx_hi_pro_i_buskey + on act_hi_procinst (business_key_); + +create index idx_start_time_proc_def + on act_hi_procinst (start_time_ desc, proc_def_id_ asc); + +create table act_hi_taskinst +( + id_ varchar(64) not null + primary key, + rev_ int default 1 null, + proc_def_id_ varchar(64) null, + task_def_id_ varchar(64) null, + task_def_key_ varchar(255) null, + proc_inst_id_ varchar(64) null, + execution_id_ varchar(64) null, + scope_id_ varchar(255) null, + sub_scope_id_ varchar(255) null, + scope_type_ varchar(255) null, + scope_definition_id_ varchar(255) null, + propagated_stage_inst_id_ varchar(255) null, + name_ varchar(255) null, + parent_task_id_ varchar(64) null, + description_ varchar(4000) null, + owner_ varchar(255) null, + assignee_ varchar(255) null, + start_time_ datetime(3) not null, + claim_time_ datetime(3) null, + end_time_ datetime(3) null, + duration_ bigint null, + delete_reason_ varchar(4000) null, + priority_ int null, + due_date_ datetime(3) null, + form_key_ varchar(255) null, + category_ varchar(255) null, + tenant_id_ varchar(255) default '' null, + last_updated_time_ datetime(3) null +) collate = utf8mb3_bin; + +create index act_idx_hi_task_inst_procinst + on act_hi_taskinst (proc_inst_id_); + +create index act_idx_hi_task_scope + on act_hi_taskinst (scope_id_, scope_type_); + +create index act_idx_hi_task_scope_def + on act_hi_taskinst (scope_definition_id_, scope_type_); + +create index act_idx_hi_task_sub_scope + on act_hi_taskinst (sub_scope_id_, scope_type_); + +create table act_hi_tsk_log +( + id_ bigint auto_increment + primary key, + type_ varchar(64) null, + task_id_ varchar(64) not null, + time_stamp_ timestamp(3) not null, + user_id_ varchar(255) null, + data_ varchar(4000) null, + execution_id_ varchar(64) null, + proc_inst_id_ varchar(64) null, + proc_def_id_ varchar(64) null, + scope_id_ varchar(255) null, + scope_definition_id_ varchar(255) null, + sub_scope_id_ varchar(255) null, + scope_type_ varchar(255) null, + tenant_id_ varchar(255) default '' null +) collate = utf8mb3_bin; + +create table act_hi_varinst +( + id_ varchar(64) not null + primary key, + rev_ int default 1 null, + proc_inst_id_ varchar(64) null, + execution_id_ varchar(64) null, + task_id_ varchar(64) null, + name_ varchar(255) not null, + var_type_ varchar(100) null, + scope_id_ varchar(255) null, + sub_scope_id_ varchar(255) null, + scope_type_ varchar(255) null, + bytearray_id_ varchar(64) null, + double_ double null, + long_ bigint null, + text_ varchar(4000) null, + text2_ varchar(4000) null, + create_time_ datetime(3) null, + last_updated_time_ datetime(3) null +) collate = utf8mb3_bin; + +create index act_idx_hi_procvar_exe + on act_hi_varinst (execution_id_); + +create index act_idx_hi_procvar_name_type + on act_hi_varinst (name_, var_type_); + +create index act_idx_hi_procvar_proc_inst + on act_hi_varinst (proc_inst_id_); + +create index act_idx_hi_procvar_task_id + on act_hi_varinst (task_id_); + +create index act_idx_hi_var_scope_id_type + on act_hi_varinst (scope_id_, scope_type_); + +create index act_idx_hi_var_sub_id_type + on act_hi_varinst (sub_scope_id_, scope_type_); + +create table act_re_deployment +( + id_ varchar(64) not null + primary key, + name_ varchar(255) null, + category_ varchar(255) null, + key_ varchar(255) null, + tenant_id_ varchar(255) default '' null, + deploy_time_ timestamp(3) null, + derived_from_ varchar(64) null, + derived_from_root_ varchar(64) null, + parent_deployment_id_ varchar(255) null, + engine_version_ varchar(255) null +) collate = utf8mb3_bin; + +create table act_ge_bytearray +( + id_ varchar(64) not null + primary key, + rev_ int null, + name_ varchar(255) null, + deployment_id_ varchar(64) null, + bytes_ longblob null, + generated_ tinyint null, + constraint act_fk_bytearr_depl + foreign key (deployment_id_) references act_re_deployment (id_) +) collate = utf8mb3_bin; + +create table act_re_model +( + id_ varchar(64) not null + primary key, + rev_ int null, + name_ varchar(255) null, + key_ varchar(255) null, + category_ varchar(255) null, + create_time_ timestamp(3) null, + last_update_time_ timestamp(3) null, + version_ int null, + meta_info_ varchar(4000) null, + deployment_id_ varchar(64) null, + editor_source_value_id_ varchar(64) null, + editor_source_extra_value_id_ varchar(64) null, + tenant_id_ varchar(255) default '' null, + constraint act_fk_model_deployment + foreign key (deployment_id_) references act_re_deployment (id_), + constraint act_fk_model_source + foreign key (editor_source_value_id_) references act_ge_bytearray (id_), + constraint act_fk_model_source_extra + foreign key (editor_source_extra_value_id_) references act_ge_bytearray (id_) +) collate = utf8mb3_bin; + +create table act_re_procdef +( + id_ varchar(64) not null + primary key, + rev_ int null, + category_ varchar(255) null, + name_ varchar(255) null, + key_ varchar(255) not null, + version_ int not null, + deployment_id_ varchar(64) null, + resource_name_ varchar(4000) null, + dgrm_resource_name_ varchar(4000) null, + description_ varchar(4000) null, + has_start_form_key_ tinyint null, + has_graphical_notation_ tinyint null, + suspension_state_ int null, + tenant_id_ varchar(255) default '' null, + engine_version_ varchar(255) null, + derived_from_ varchar(64) null, + derived_from_root_ varchar(64) null, + derived_version_ int default 0 not null, + constraint act_uniq_procdef + unique (key_, version_, derived_version_, tenant_id_) +) collate = utf8mb3_bin; + +create table act_procdef_info +( + id_ varchar(64) not null + primary key, + proc_def_id_ varchar(64) not null, + rev_ int null, + info_json_id_ varchar(64) null, + constraint act_uniq_info_procdef + unique (proc_def_id_), + constraint act_fk_info_json_ba + foreign key (info_json_id_) references act_ge_bytearray (id_), + constraint act_fk_info_procdef + foreign key (proc_def_id_) references act_re_procdef (id_) +) collate = utf8mb3_bin; + +create index act_idx_info_procdef + on act_procdef_info (proc_def_id_); + +create table act_ru_actinst +( + id_ varchar(64) not null + primary key, + rev_ int default 1 null, + proc_def_id_ varchar(64) not null, + proc_inst_id_ varchar(64) not null, + execution_id_ varchar(64) not null, + act_id_ varchar(255) not null, + task_id_ varchar(64) null, + call_proc_inst_id_ varchar(64) null, + act_name_ varchar(255) null, + act_type_ varchar(255) not null, + assignee_ varchar(255) null, + start_time_ datetime(3) not null, + end_time_ datetime(3) null, + duration_ bigint null, + transaction_order_ int null, + delete_reason_ varchar(4000) null, + tenant_id_ varchar(255) default '' null +) collate = utf8mb3_bin; + +create index act_idx_ru_acti_end + on act_ru_actinst (end_time_); + +create index act_idx_ru_acti_exec + on act_ru_actinst (execution_id_); + +create index act_idx_ru_acti_exec_act + on act_ru_actinst (execution_id_, act_id_); + +create index act_idx_ru_acti_proc + on act_ru_actinst (proc_inst_id_); + +create index act_idx_ru_acti_proc_act + on act_ru_actinst (proc_inst_id_, act_id_); + +create index act_idx_ru_acti_start + on act_ru_actinst (start_time_); + +create index act_idx_ru_acti_task + on act_ru_actinst (task_id_); + +create table act_ru_entitylink +( + id_ varchar(64) not null + primary key, + rev_ int null, + create_time_ datetime(3) null, + link_type_ varchar(255) null, + scope_id_ varchar(255) null, + sub_scope_id_ varchar(255) null, + scope_type_ varchar(255) null, + scope_definition_id_ varchar(255) null, + parent_element_id_ varchar(255) null, + ref_scope_id_ varchar(255) null, + ref_scope_type_ varchar(255) null, + ref_scope_definition_id_ varchar(255) null, + root_scope_id_ varchar(255) null, + root_scope_type_ varchar(255) null, + hierarchy_type_ varchar(255) null +) collate = utf8mb3_bin; + +create index act_idx_ent_lnk_ref_scope + on act_ru_entitylink (ref_scope_id_, ref_scope_type_, link_type_); + +create index act_idx_ent_lnk_root_scope + on act_ru_entitylink (root_scope_id_, root_scope_type_, link_type_); + +create index act_idx_ent_lnk_scope + on act_ru_entitylink (scope_id_, scope_type_, link_type_); + +create index act_idx_ent_lnk_scope_def + on act_ru_entitylink (scope_definition_id_, scope_type_, link_type_); + +create table act_ru_execution +( + id_ varchar(64) not null + primary key, + rev_ int null, + proc_inst_id_ varchar(64) null, + business_key_ varchar(255) null, + parent_id_ varchar(64) null, + proc_def_id_ varchar(64) null, + super_exec_ varchar(64) null, + root_proc_inst_id_ varchar(64) null, + act_id_ varchar(255) null, + is_active_ tinyint null, + is_concurrent_ tinyint null, + is_scope_ tinyint null, + is_event_scope_ tinyint null, + is_mi_root_ tinyint null, + suspension_state_ int null, + cached_ent_state_ int null, + tenant_id_ varchar(255) default '' null, + name_ varchar(255) null, + start_act_id_ varchar(255) null, + start_time_ datetime(3) null, + start_user_id_ varchar(255) null, + lock_time_ timestamp(3) null, + lock_owner_ varchar(255) null, + is_count_enabled_ tinyint null, + evt_subscr_count_ int null, + task_count_ int null, + job_count_ int null, + timer_job_count_ int null, + susp_job_count_ int null, + deadletter_job_count_ int null, + external_worker_job_count_ int null, + var_count_ int null, + id_link_count_ int null, + callback_id_ varchar(255) null, + callback_type_ varchar(255) null, + reference_id_ varchar(255) null, + reference_type_ varchar(255) null, + propagated_stage_inst_id_ varchar(255) null, + business_status_ varchar(255) null, + constraint act_fk_exe_parent + foreign key (parent_id_) references act_ru_execution (id_) + on delete cascade, + constraint act_fk_exe_procdef + foreign key (proc_def_id_) references act_re_procdef (id_), + constraint act_fk_exe_procinst + foreign key (proc_inst_id_) references act_ru_execution (id_) + on update cascade on delete cascade, + constraint act_fk_exe_super + foreign key (super_exec_) references act_ru_execution (id_) + on delete cascade +) collate = utf8mb3_bin; + +create table act_ru_deadletter_job +( + id_ varchar(64) not null + primary key, + rev_ int null, + category_ varchar(255) null, + type_ varchar(255) not null, + exclusive_ tinyint(1) null, + execution_id_ varchar(64) null, + process_instance_id_ varchar(64) null, + proc_def_id_ varchar(64) null, + element_id_ varchar(255) null, + element_name_ varchar(255) null, + scope_id_ varchar(255) null, + sub_scope_id_ varchar(255) null, + scope_type_ varchar(255) null, + scope_definition_id_ varchar(255) null, + correlation_id_ varchar(255) null, + exception_stack_id_ varchar(64) null, + exception_msg_ varchar(4000) null, + duedate_ timestamp(3) null, + repeat_ varchar(255) null, + handler_type_ varchar(255) null, + handler_cfg_ varchar(4000) null, + custom_values_id_ varchar(64) null, + create_time_ timestamp(3) null, + tenant_id_ varchar(255) default '' null, + constraint act_fk_deadletter_job_custom_values + foreign key (custom_values_id_) references act_ge_bytearray (id_), + constraint act_fk_deadletter_job_exception + foreign key (exception_stack_id_) references act_ge_bytearray (id_), + constraint act_fk_deadletter_job_execution + foreign key (execution_id_) references act_ru_execution (id_), + constraint act_fk_deadletter_job_process_instance + foreign key (process_instance_id_) references act_ru_execution (id_), + constraint act_fk_deadletter_job_proc_def + foreign key (proc_def_id_) references act_re_procdef (id_) +) collate = utf8mb3_bin; + +create index act_idx_deadletter_job_correlation_id + on act_ru_deadletter_job (correlation_id_); + +create index act_idx_deadletter_job_custom_values_id + on act_ru_deadletter_job (custom_values_id_); + +create index act_idx_deadletter_job_exception_stack_id + on act_ru_deadletter_job (exception_stack_id_); + +create index act_idx_djob_scope + on act_ru_deadletter_job (scope_id_, scope_type_); + +create index act_idx_djob_scope_def + on act_ru_deadletter_job (scope_definition_id_, scope_type_); + +create index act_idx_djob_sub_scope + on act_ru_deadletter_job (sub_scope_id_, scope_type_); + +create table act_ru_event_subscr +( + id_ varchar(64) not null + primary key, + rev_ int null, + event_type_ varchar(255) not null, + event_name_ varchar(255) null, + execution_id_ varchar(64) null, + proc_inst_id_ varchar(64) null, + activity_id_ varchar(64) null, + configuration_ varchar(255) null, + created_ timestamp(3) default current_timestamp(3) not null, + proc_def_id_ varchar(64) null, + sub_scope_id_ varchar(64) null, + scope_id_ varchar(64) null, + scope_definition_id_ varchar(64) null, + scope_type_ varchar(64) null, + tenant_id_ varchar(255) default '' null, + constraint act_fk_event_exec + foreign key (execution_id_) references act_ru_execution (id_) +) collate = utf8mb3_bin; + +create index act_idx_event_subscr_config_ + on act_ru_event_subscr (configuration_); + +create index act_idc_exec_root + on act_ru_execution (root_proc_inst_id_); + +create index act_idx_exec_buskey + on act_ru_execution (business_key_); + +create index act_idx_exec_ref_id_ + on act_ru_execution (reference_id_); + +create table act_ru_external_job +( + id_ varchar(64) not null + primary key, + rev_ int null, + category_ varchar(255) null, + type_ varchar(255) not null, + lock_exp_time_ timestamp(3) null, + lock_owner_ varchar(255) null, + exclusive_ tinyint(1) null, + execution_id_ varchar(64) null, + process_instance_id_ varchar(64) null, + proc_def_id_ varchar(64) null, + element_id_ varchar(255) null, + element_name_ varchar(255) null, + scope_id_ varchar(255) null, + sub_scope_id_ varchar(255) null, + scope_type_ varchar(255) null, + scope_definition_id_ varchar(255) null, + correlation_id_ varchar(255) null, + retries_ int null, + exception_stack_id_ varchar(64) null, + exception_msg_ varchar(4000) null, + duedate_ timestamp(3) null, + repeat_ varchar(255) null, + handler_type_ varchar(255) null, + handler_cfg_ varchar(4000) null, + custom_values_id_ varchar(64) null, + create_time_ timestamp(3) null, + tenant_id_ varchar(255) default '' null, + constraint act_fk_external_job_custom_values + foreign key (custom_values_id_) references act_ge_bytearray (id_), + constraint act_fk_external_job_exception + foreign key (exception_stack_id_) references act_ge_bytearray (id_) +) collate = utf8mb3_bin; + +create index act_idx_ejob_scope + on act_ru_external_job (scope_id_, scope_type_); + +create index act_idx_ejob_scope_def + on act_ru_external_job (scope_definition_id_, scope_type_); + +create index act_idx_ejob_sub_scope + on act_ru_external_job (sub_scope_id_, scope_type_); + +create index act_idx_external_job_correlation_id + on act_ru_external_job (correlation_id_); + +create index act_idx_external_job_custom_values_id + on act_ru_external_job (custom_values_id_); + +create index act_idx_external_job_exception_stack_id + on act_ru_external_job (exception_stack_id_); + +create table act_ru_history_job +( + id_ varchar(64) not null + primary key, + rev_ int null, + lock_exp_time_ timestamp(3) null, + lock_owner_ varchar(255) null, + retries_ int null, + exception_stack_id_ varchar(64) null, + exception_msg_ varchar(4000) null, + handler_type_ varchar(255) null, + handler_cfg_ varchar(4000) null, + custom_values_id_ varchar(64) null, + adv_handler_cfg_id_ varchar(64) null, + create_time_ timestamp(3) null, + scope_type_ varchar(255) null, + tenant_id_ varchar(255) default '' null +) collate = utf8mb3_bin; + +create table act_ru_job +( + id_ varchar(64) not null + primary key, + rev_ int null, + category_ varchar(255) null, + type_ varchar(255) not null, + lock_exp_time_ timestamp(3) null, + lock_owner_ varchar(255) null, + exclusive_ tinyint(1) null, + execution_id_ varchar(64) null, + process_instance_id_ varchar(64) null, + proc_def_id_ varchar(64) null, + element_id_ varchar(255) null, + element_name_ varchar(255) null, + scope_id_ varchar(255) null, + sub_scope_id_ varchar(255) null, + scope_type_ varchar(255) null, + scope_definition_id_ varchar(255) null, + correlation_id_ varchar(255) null, + retries_ int null, + exception_stack_id_ varchar(64) null, + exception_msg_ varchar(4000) null, + duedate_ timestamp(3) null, + repeat_ varchar(255) null, + handler_type_ varchar(255) null, + handler_cfg_ varchar(4000) null, + custom_values_id_ varchar(64) null, + create_time_ timestamp(3) null, + tenant_id_ varchar(255) default '' null, + constraint act_fk_job_custom_values + foreign key (custom_values_id_) references act_ge_bytearray (id_), + constraint act_fk_job_exception + foreign key (exception_stack_id_) references act_ge_bytearray (id_), + constraint act_fk_job_execution + foreign key (execution_id_) references act_ru_execution (id_), + constraint act_fk_job_process_instance + foreign key (process_instance_id_) references act_ru_execution (id_), + constraint act_fk_job_proc_def + foreign key (proc_def_id_) references act_re_procdef (id_) +) collate = utf8mb3_bin; + +create index act_idx_job_correlation_id + on act_ru_job (correlation_id_); + +create index act_idx_job_custom_values_id + on act_ru_job (custom_values_id_); + +create index act_idx_job_exception_stack_id + on act_ru_job (exception_stack_id_); + +create index act_idx_job_scope + on act_ru_job (scope_id_, scope_type_); + +create index act_idx_job_scope_def + on act_ru_job (scope_definition_id_, scope_type_); + +create index act_idx_job_sub_scope + on act_ru_job (sub_scope_id_, scope_type_); + +create table act_ru_suspended_job +( + id_ varchar(64) not null + primary key, + rev_ int null, + category_ varchar(255) null, + type_ varchar(255) not null, + exclusive_ tinyint(1) null, + execution_id_ varchar(64) null, + process_instance_id_ varchar(64) null, + proc_def_id_ varchar(64) null, + element_id_ varchar(255) null, + element_name_ varchar(255) null, + scope_id_ varchar(255) null, + sub_scope_id_ varchar(255) null, + scope_type_ varchar(255) null, + scope_definition_id_ varchar(255) null, + correlation_id_ varchar(255) null, + retries_ int null, + exception_stack_id_ varchar(64) null, + exception_msg_ varchar(4000) null, + duedate_ timestamp(3) null, + repeat_ varchar(255) null, + handler_type_ varchar(255) null, + handler_cfg_ varchar(4000) null, + custom_values_id_ varchar(64) null, + create_time_ timestamp(3) null, + tenant_id_ varchar(255) default '' null, + constraint act_fk_suspended_job_custom_values + foreign key (custom_values_id_) references act_ge_bytearray (id_), + constraint act_fk_suspended_job_exception + foreign key (exception_stack_id_) references act_ge_bytearray (id_), + constraint act_fk_suspended_job_execution + foreign key (execution_id_) references act_ru_execution (id_), + constraint act_fk_suspended_job_process_instance + foreign key (process_instance_id_) references act_ru_execution (id_), + constraint act_fk_suspended_job_proc_def + foreign key (proc_def_id_) references act_re_procdef (id_) +) collate = utf8mb3_bin; + +create index act_idx_sjob_scope + on act_ru_suspended_job (scope_id_, scope_type_); + +create index act_idx_sjob_scope_def + on act_ru_suspended_job (scope_definition_id_, scope_type_); + +create index act_idx_sjob_sub_scope + on act_ru_suspended_job (sub_scope_id_, scope_type_); + +create index act_idx_suspended_job_correlation_id + on act_ru_suspended_job (correlation_id_); + +create index act_idx_suspended_job_custom_values_id + on act_ru_suspended_job (custom_values_id_); + +create index act_idx_suspended_job_exception_stack_id + on act_ru_suspended_job (exception_stack_id_); + +create table act_ru_task +( + id_ varchar(64) not null + primary key, + rev_ int null, + execution_id_ varchar(64) null, + proc_inst_id_ varchar(64) null, + proc_def_id_ varchar(64) null, + task_def_id_ varchar(64) null, + scope_id_ varchar(255) null, + sub_scope_id_ varchar(255) null, + scope_type_ varchar(255) null, + scope_definition_id_ varchar(255) null, + propagated_stage_inst_id_ varchar(255) null, + name_ varchar(255) null, + parent_task_id_ varchar(64) null, + description_ varchar(4000) null, + task_def_key_ varchar(255) null, + owner_ varchar(255) null, + assignee_ varchar(255) null, + delegation_ varchar(64) null, + priority_ int null, + create_time_ timestamp(3) null, + due_date_ datetime(3) null, + category_ varchar(255) null, + suspension_state_ int null, + tenant_id_ varchar(255) default '' null, + form_key_ varchar(255) null, + claim_time_ datetime(3) null, + is_count_enabled_ tinyint null, + var_count_ int null, + id_link_count_ int null, + sub_task_count_ int null, + constraint act_fk_task_exe + foreign key (execution_id_) references act_ru_execution (id_), + constraint act_fk_task_procdef + foreign key (proc_def_id_) references act_re_procdef (id_), + constraint act_fk_task_procinst + foreign key (proc_inst_id_) references act_ru_execution (id_) +) collate = utf8mb3_bin; + +create table act_ru_identitylink +( + id_ varchar(64) not null + primary key, + rev_ int null, + group_id_ varchar(255) null, + type_ varchar(255) null, + user_id_ varchar(255) null, + task_id_ varchar(64) null, + proc_inst_id_ varchar(64) null, + proc_def_id_ varchar(64) null, + scope_id_ varchar(255) null, + sub_scope_id_ varchar(255) null, + scope_type_ varchar(255) null, + scope_definition_id_ varchar(255) null, + constraint act_fk_athrz_procedef + foreign key (proc_def_id_) references act_re_procdef (id_), + constraint act_fk_idl_procinst + foreign key (proc_inst_id_) references act_ru_execution (id_), + constraint act_fk_tskass_task + foreign key (task_id_) references act_ru_task (id_) +) collate = utf8mb3_bin; + +create index act_idx_athrz_procedef + on act_ru_identitylink (proc_def_id_); + +create index act_idx_ident_lnk_group + on act_ru_identitylink (group_id_); + +create index act_idx_ident_lnk_scope + on act_ru_identitylink (scope_id_, scope_type_); + +create index act_idx_ident_lnk_scope_def + on act_ru_identitylink (scope_definition_id_, scope_type_); + +create index act_idx_ident_lnk_sub_scope + on act_ru_identitylink (sub_scope_id_, scope_type_); + +create index act_idx_ident_lnk_user + on act_ru_identitylink (user_id_); + +create index act_idx_task_create + on act_ru_task (create_time_); + +create index act_idx_task_scope + on act_ru_task (scope_id_, scope_type_); + +create index act_idx_task_scope_def + on act_ru_task (scope_definition_id_, scope_type_); + +create index act_idx_task_sub_scope + on act_ru_task (sub_scope_id_, scope_type_); + +create table act_ru_timer_job +( + id_ varchar(64) not null + primary key, + rev_ int null, + category_ varchar(255) null, + type_ varchar(255) not null, + lock_exp_time_ timestamp(3) null, + lock_owner_ varchar(255) null, + exclusive_ tinyint(1) null, + execution_id_ varchar(64) null, + process_instance_id_ varchar(64) null, + proc_def_id_ varchar(64) null, + element_id_ varchar(255) null, + element_name_ varchar(255) null, + scope_id_ varchar(255) null, + sub_scope_id_ varchar(255) null, + scope_type_ varchar(255) null, + scope_definition_id_ varchar(255) null, + correlation_id_ varchar(255) null, + retries_ int null, + exception_stack_id_ varchar(64) null, + exception_msg_ varchar(4000) null, + duedate_ timestamp(3) null, + repeat_ varchar(255) null, + handler_type_ varchar(255) null, + handler_cfg_ varchar(4000) null, + custom_values_id_ varchar(64) null, + create_time_ timestamp(3) null, + tenant_id_ varchar(255) default '' null, + constraint act_fk_timer_job_custom_values + foreign key (custom_values_id_) references act_ge_bytearray (id_), + constraint act_fk_timer_job_exception + foreign key (exception_stack_id_) references act_ge_bytearray (id_), + constraint act_fk_timer_job_execution + foreign key (execution_id_) references act_ru_execution (id_), + constraint act_fk_timer_job_process_instance + foreign key (process_instance_id_) references act_ru_execution (id_), + constraint act_fk_timer_job_proc_def + foreign key (proc_def_id_) references act_re_procdef (id_) +) collate = utf8mb3_bin; + +create index act_idx_timer_job_correlation_id + on act_ru_timer_job (correlation_id_); + +create index act_idx_timer_job_custom_values_id + on act_ru_timer_job (custom_values_id_); + +create index act_idx_timer_job_duedate + on act_ru_timer_job (duedate_); + +create index act_idx_timer_job_exception_stack_id + on act_ru_timer_job (exception_stack_id_); + +create index act_idx_tjob_scope + on act_ru_timer_job (scope_id_, scope_type_); + +create index act_idx_tjob_scope_def + on act_ru_timer_job (scope_definition_id_, scope_type_); + +create index act_idx_tjob_sub_scope + on act_ru_timer_job (sub_scope_id_, scope_type_); + +create table act_ru_variable +( + id_ varchar(64) not null + primary key, + rev_ int null, + type_ varchar(255) not null, + name_ varchar(255) not null, + execution_id_ varchar(64) null, + proc_inst_id_ varchar(64) null, + task_id_ varchar(64) null, + scope_id_ varchar(255) null, + sub_scope_id_ varchar(255) null, + scope_type_ varchar(255) null, + bytearray_id_ varchar(64) null, + double_ double null, + long_ bigint null, + text_ varchar(4000) null, + text2_ varchar(4000) null, + constraint act_fk_var_bytearray + foreign key (bytearray_id_) references act_ge_bytearray (id_), + constraint act_fk_var_exe + foreign key (execution_id_) references act_ru_execution (id_), + constraint act_fk_var_procinst + foreign key (proc_inst_id_) references act_ru_execution (id_) +) collate = utf8mb3_bin; + +create index act_idx_ru_var_scope_id_type + on act_ru_variable (scope_id_, scope_type_); + +create index act_idx_ru_var_sub_id_type + on act_ru_variable (sub_scope_id_, scope_type_); + +create index act_idx_variable_task_id + on act_ru_variable (task_id_); + +create table ext_ax_api_log +( + id bigint auto_increment comment '主键' + primary key, + trace_id varchar(100) default '' not null comment '唯一标识', + type varchar(10) default '' not null comment '函数类型', + request_application_name varchar(20) default '' null comment '请求方服务名称', + client_version varchar(20) default '' null comment '客户端 API 版本', + api_url varchar(2000) default '' not null comment '请求 API', + request_body longblob null comment '请求参数', + response_body longblob null comment '响应参数', + take_time decimal(5, 2) not null comment '执行耗时', + create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间', + update_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', + is_delete bigint default 0 not null comment '是否删除' +) comment 'API 执行耗时记录表'; + +create table ext_ax_bpmn_form_relation +( + id bigint auto_increment comment '主键' + primary key, + `key` varchar(64) default '' not null comment '业务标识', + bpmn_definition_id varchar(64) default '' not null comment 'BPMN定义 ID', + form_deployment_id varchar(64) default '' not null comment '表单部署 ID', + tenant_id varchar(64) default '' not null comment '租户 ID', + update_by bigint default 0 not null comment '更新人', + update_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', + create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间', + create_by bigint default 0 not null comment '创建人', + is_delete bigint default 0 not null comment '是否删除:0否,1是' +); + +create index idx_key_def_form + on ext_ax_bpmn_form_relation (bpmn_definition_id desc, `key` asc, tenant_id asc, is_delete asc); + +create table ext_ax_dict +( + id bigint auto_increment comment '字典编码' + primary key, + type varchar(100) default '' not null comment '字典类型', + label varchar(100) default '' not null comment '字典标签', + value varchar(100) default '' not null comment '字典键值', + remark varchar(500) null comment '备注', + sort int default 0 not null comment '字典排序', + status tinyint default 0 not null comment '状态(1正常 0停用)', + tenant_id varchar(100) default '' not null comment '租户', + operator_name varchar(100) default '' not null comment '创建者姓名', + workspace_type_code varchar(100) default '' not null comment '工作台类型 Code', + icon varchar(100) default '' not null comment '图标', + business_type varchar(10) default 'APPROVAL' not null comment '业务类型', + display_initiate_menu tinyint default 0 not null comment '是否展示到发起工作台', + create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间', + update_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', + is_delete bigint default 0 not null comment '是否删除', + version int default 0 not null comment '版本(用于区分新老参数、模版配置)', + auto_replace_variables tinyint default 0 not null comment '自定替换未设置的变量为空串' +) comment '字典数据表'; + +create index idx_type_label_value + on ext_ax_dict (type, label, value); + +create table ext_ax_dict_conf +( + id bigint auto_increment comment '字典编码' + primary key, + dict_id bigint not null comment '分类字典的 ID', + config_type varchar(50) default '' not null comment '配置类型', + workspace_id bigint not null comment '工作台 ID', + operation_name varchar(50) default '' not null comment '操作人', + create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间', + update_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', + is_delete bigint default 0 not null comment '是否删除' +) comment '字典数据表'; + +create index idx_type_label_value + on ext_ax_dict_conf (dict_id, workspace_id, config_type); + +create table ext_ax_dict_group +( + id bigint auto_increment comment '主键' + primary key, + parent_group_id bigint null, + group_name varchar(255) default '' not null comment '分组名', + create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间', + update_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', + is_delete bigint default 0 not null comment '是否删除', + dict_id bigint not null comment '字典 ID', + ordinal int not null comment '顺序' +) comment '变量分组'; + +create table ext_ax_dict_group_variable +( + id bigint auto_increment comment '主键' + primary key, + group_id bigint not null comment '分组 ID', + type varchar(50) default '' not null comment '变量类型', + code varchar(255) default '' not null comment '变量标识', + name varchar(255) default '' not null comment '变量名称', + create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间', + update_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', + is_delete bigint default 0 not null comment '是否删除', + dict_id bigint not null comment '字典 ID', + ordinal int not null comment '顺序' +) comment '变量分组下变量'; + +create table ext_ax_dict_permission +( + id bigint auto_increment comment '主键' + primary key, + dict_value varchar(20) default '' not null comment '关联的业务', + type varchar(10) default '' not null comment '权限设置类型', + conf_value json null comment '权限配置值', + tenant_id varchar(20) default '' not null comment '租户ID', + create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间', + update_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', + is_delete bigint default 0 not null comment '是否删除' +) comment '业务权限'; + +create table ext_ax_doc_content +( + id bigint auto_increment comment '主键' + primary key, + file_id bigint not null comment '文件 ID', + file_type varchar(50) default 'UNKNOWN' not null comment '文件类型', + content longblob not null comment '文件内容', + create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间', + update_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', + is_delete bigint default 0 not null comment '是否删除' +) comment '文档具体内容'; + +create table ext_ax_dynamic_sign_record +( + id bigint unsigned auto_increment comment '主键' + primary key, + process_instance_id varchar(64) default '' not null comment '流程实例 ID', + process_definition_id varchar(64) default '' not null comment '流程定义 ID', + original_activity_id varchar(64) default '' not null comment '加签原节点 ID', + target_activity_id varchar(64) default '' not null comment '加签目标节点', + counter_sign_type varchar(64) default '' not null comment '加签类型', + target_node_mode varchar(64) default '' not null comment '目标节点的审批方式 (会签、或签、顺序签)', + assigner_list varchar(2048) default '[]' not null comment '加签人 JSON 数据', + create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间', + update_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', + is_delete bigint default 0 not null comment '是否删除' +) comment '动态前后加签'; + +create index idx_create + on ext_ax_dynamic_sign_record (create_at); + +create table ext_ax_hi_taskinst +( + id bigint auto_increment comment '主键' + primary key, + proc_inst_id varchar(100) default '' not null comment '流程实例ID', + task_id varchar(100) default '' not null comment '流程任务ID', + task_definition_key varchar(100) default '' not null comment '流程节点定义ID', + status varchar(100) default '' not null comment '状态 通过/拒绝等', + assignee varchar(100) default '' not null comment '操作人', + create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间', + update_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', + is_delete bigint default 0 not null comment '是否删除', + constraint uk_proc_task + unique (proc_inst_id, task_id) +) comment '流程历史任务信息扩展表'; + +create index idx_proc_def_id + on ext_ax_hi_taskinst (proc_inst_id, task_definition_key, task_id, assignee); + +create table ext_ax_model_doc +( + id bigint auto_increment comment '主键' + primary key, + model_id varchar(100) default '' not null comment '流程模型ID', + model_key varchar(50) default '' not null comment '审批模型key', + file_relation_id varchar(100) default '' not null comment '文件关联标识(word/excel对应 wps 的 Id,如果是 hp 是文档内容表主键,如果是 pdf 为 fileKey)', + file_name varchar(50) null comment '文档名称', + template_name varchar(50) default '' not null comment '模板名称', + location bigint default 0 not null comment '自动归档路径', + file_type varchar(10) default 'UNKNOWN' not null comment '文档类型', + tag varchar(100) default '' not null comment '业务标签', + status tinyint default 1 not null comment '文档状态', + temp_file tinyint default 0 not null comment 'HiPrint 克隆文件标识,该文件不是模型关联数据', + `require` tinyint default 0 not null comment '是否必选', + `order` int default 1 not null comment '排序', + tenant_id varchar(50) default '' not null comment '租户ID', + create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间', + update_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', + is_delete bigint default 0 not null comment '是否删除' +) comment '模板关联的文档'; + +create table ext_ax_mq_log +( + id bigint auto_increment comment '主键' + primary key, + unique_id varchar(50) default '' not null comment '唯一ID', + message_id varchar(100) default '' not null comment 'MQ 的 Message ID', + mq_tag varchar(50) default '' not null comment 'MQ 的 TAG', + mq_key varchar(50) default '' not null comment 'MQ 的 KEY', + message_body text null comment 'MQ 的 Message Body', + trace_id varchar(50) default '' not null comment 'traceId', + create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间', + update_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', + is_delete bigint default 0 not null comment '是否删除', + insert_thread_name varchar(100) default '' not null comment '插入线程名', + update_thread_name varchar(100) default '' not null comment '更新线程名', + delete_thread_name varchar(100) default '' not null comment '删除线程名', + constraint idx_unique + unique (unique_id) +) comment 'MQ发送记录表'; + +create table ext_ax_node_alter_job +( + id bigint unsigned auto_increment comment '主键' + primary key, + process_instance_id varchar(64) default '' not null comment '实例ID', + process_definition_id varchar(64) default '' not null comment '流程定义 ID', + activity_id varchar(64) default '' not null comment '流程节点 ID', + activity_name varchar(255) default '' not null comment '节点名称', + alter_time datetime not null comment '执行告警时间', + exception text not null comment '执行异常信息', + create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间', + update_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', + is_delete bigint default 0 not null comment '是否删除' +) comment '业务节点告警任务'; + +create table ext_ax_process_admin +( + id bigint auto_increment comment '主键' + primary key, + person_id bigint default 0 not null comment '自然人id', + organizational_unit_id bigint default 0 not null comment '单位id', + workspace_id bigint default 0 not null comment '工作台ID', + workspace_type tinyint default 0 not null comment '工作台类型,1-企业, 2-项目, 3-政务监管平台, 6-oms工作台,参考 WorkspaceType枚举', + admin_type varchar(15) default 'COMMON_ADMIN' not null comment '管理员类型, SUPER_ADMIN-超级管理员, COMMON_ADMIN-普通管理员', + role_type varchar(20) default 'OTHER' not null comment '角色类型, ORGANIZATION_ADMIN-单位超管, ORG_WORKSPACE_ADMIN-项目内单位负责人, WORKSPACE_ADMIN-项目超管,OTHER-其他用户', + data_source varchar(15) default 'USER_ENTRY' not null comment '数据来源, SYSTEM_ENTRY-系统录入, USER_ENTRY-用户手动录入', + update_by bigint default 0 not null comment '更新人', + update_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', + create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间', + create_by bigint default 0 not null comment '创建人', + is_delete bigint default 0 not null comment '是否删除:0否,1是' +); + +create index EXT_IDX_PROCESS_ADMIN_CONFIG_USER + on ext_ax_process_admin (person_id, organizational_unit_id, workspace_id); + +create table ext_ax_process_log +( + id bigint auto_increment comment '主键' + primary key, + process_instance_id varchar(64) default '' not null comment '流程实例 ID', + tenant_id varchar(64) default '' not null comment '实例归属租户', + activity_id varchar(64) default '' not null comment '节点 ID', + activity_name varchar(255) default '' not null comment '节点名称', + approval_method varchar(32) default '' not null comment '审批方式:配置审批人/业务指定/业务触发(不含人)', + node_type varchar(32) default '' not null comment '节点类型:审批节点/业务节点/评论节点/抄送节点', + node_mode varchar(32) default '' not null comment '节点模式:会签/或签', + task_id varchar(64) default '' not null comment '任务 ID', + advice varchar(4000) default '' not null comment '操作建议', + operation_desc varchar(4000) default '' not null comment '操作描述', + assignee_full json null comment '审批人(JSON)', + assignee_id bigint default 0 not null comment '审批人标识(axzo=personId)', + assignee_tenant_id varchar(255) default '' not null comment '审批人归属租户', + assignee_name varchar(255) default '' not null comment '审批人姓名', + assignee_ou_id varchar(64) default '' not null comment '审批人归属单位', + start_time datetime(3) default CURRENT_TIMESTAMP(3) not null comment '任务开始时间', + end_time datetime(3) null comment '任务结束时间', + button_conf json null comment '按钮配置', + form_field_permission_conf json null comment '表单字段权限', + status varchar(16) default '' not null comment '任务状态:审批中/通过/驳回/转交/加签', + signature tinyint default 0 not null comment '电子签名开关', + extra json null comment '扩展字段', + create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间', + update_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', + is_delete bigint default 0 not null comment '是否删除', + constraint idx_process_task_status + unique (process_instance_id, task_id, status, create_at) +) comment '审批日志持久化'; + +create table ext_ax_process_sign +( + id bigint auto_increment comment '主键' + primary key, + process_instance_id varchar(32) default '' not null comment '流程实例 ID', + sign_type varchar(10) default '' not null comment '签署方式', + pending_message_id varchar(32) default '' not null comment '签署业务待办', + doc_template json null comment '流程创建时的模板最终版本', + file_archive json null comment '文档归档信息', + create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间', + update_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', + is_delete bigint default 0 not null comment '是否删除' +) comment '流程实例基于签署业务的扩展信息记录表'; + +create table ext_ax_property +( + id bigint auto_increment comment '主键' + primary key, + name varchar(100) default '' not null comment '客户端使用方', + value varchar(100) default '' not null comment '客户端版本', + create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间', + update_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', + is_delete bigint default 0 not null comment '是否删除', + manageable tinyint(1) default 0 null comment '接入方是否使用了 manageable', + constraint name_unique_index + unique (name) +) comment '引擎服务持久配置信息'; + +create table ext_ax_re_model +( + id bigint auto_increment comment '主键' + primary key, + model_id varchar(100) not null comment '流程模型ID', + status tinyint default 0 not null comment '状态(1正常 0停用)', + print_status tinyint default 0 not null comment '打印开关状态', + print_file_name varchar(100) default '' not null comment '打印模板生成文件的名称', + print_template_name varchar(100) default '' not null comment '打印模板名称', + print_template_config text null comment '打印模板配置内容', + create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间', + update_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', + is_delete bigint default 0 not null comment '是否删除' +) comment '流程模型信息扩展表'; + +create index idx_model_id + on ext_ax_re_model (model_id); + +create table ext_ax_re_procdef +( + id bigint auto_increment comment '主键' + primary key, + proc_def_id varchar(100) default '' not null comment '流程定义ID', + operator_id varchar(100) default '' not null comment '操作人ID', + operator_name varchar(100) default '' not null comment '操作人姓名', + operator_type varchar(100) default '' not null comment '操作人类型', + tenant_id varchar(100) default '' not null comment '操作人租户 ID', + operator_meta_data varchar(4000) not null comment '操作人原始信息', + create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间', + update_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', + is_delete bigint default 0 not null comment '是否删除' +) comment '流程模型信息扩展表'; + +create index idx_proc_def_id + on ext_ax_re_procdef (proc_def_id); + +create table ext_ax_read_record +( + id bigint auto_increment comment '主键' + primary key, + process_instance_id varchar(32) default '' not null comment '流程实例ID', + person_id bigint default 0 not null comment '自然人 ID', + read_status json null comment '阅读状态', + is_delete bigint default 0 not null, + create_at datetime default CURRENT_TIMESTAMP not null, + update_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP +) comment '签署业务阅读记录'; + +create table ext_ax_rocket_log +( + id bigint auto_increment comment '主键' + primary key, + event varchar(100) default '' not null comment '事件类型', + `key` varchar(100) default '' not null comment 'shardKey', + event_source varchar(4000) not null comment '事件源数据', + create_at datetime default CURRENT_TIMESTAMP not null comment '创建时间', + update_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', + is_delete bigint default 0 not null comment '是否删除' +) comment '流程模型信息扩展表'; + + +create table flw_channel_definition +( + id_ varchar(255) not null + primary key, + name_ varchar(255) null, + version_ int null, + key_ varchar(255) null, + category_ varchar(255) null, + deployment_id_ varchar(255) null, + create_time_ datetime(3) null, + tenant_id_ varchar(255) null, + resource_name_ varchar(255) null, + description_ varchar(255) null, + type_ varchar(255) null, + implementation_ varchar(255) null, + constraint act_idx_channel_def_uniq + unique (key_, version_, tenant_id_) +) collate = utf8mb4_unicode_ci; + +create table flw_event_definition +( + id_ varchar(255) not null + primary key, + name_ varchar(255) null, + version_ int null, + key_ varchar(255) null, + category_ varchar(255) null, + deployment_id_ varchar(255) null, + tenant_id_ varchar(255) null, + resource_name_ varchar(255) null, + description_ varchar(255) null, + constraint act_idx_event_def_uniq + unique (key_, version_, tenant_id_) +) collate = utf8mb4_unicode_ci; + +create table flw_event_deployment +( + id_ varchar(255) not null + primary key, + name_ varchar(255) null, + category_ varchar(255) null, + deploy_time_ datetime(3) null, + tenant_id_ varchar(255) null, + parent_deployment_id_ varchar(255) null +) collate = utf8mb4_unicode_ci; + +create table flw_event_resource +( + id_ varchar(255) not null + primary key, + name_ varchar(255) null, + deployment_id_ varchar(255) null, + resource_bytes_ longblob null +) collate = utf8mb4_unicode_ci; + +create table flw_ev_databasechangelog +( + id varchar(255) not null, + author varchar(255) not null, + filename varchar(255) not null, + dateexecuted datetime not null, + orderexecuted int not null, + exectype varchar(10) not null, + md5sum varchar(35) null, + description varchar(255) null, + comments varchar(255) null, + tag varchar(255) null, + liquibase varchar(20) null, + contexts varchar(255) null, + labels varchar(255) null, + deployment_id varchar(10) null +) collate = utf8mb4_unicode_ci; + +create table flw_ev_databasechangeloglock +( + id int not null + primary key, + locked bit not null, + lockgranted datetime null, + lockedby varchar(255) null +) collate = utf8mb4_unicode_ci; + +create table flw_ru_batch +( + id_ varchar(64) not null + primary key, + rev_ int null, + type_ varchar(64) not null, + search_key_ varchar(255) null, + search_key2_ varchar(255) null, + create_time_ datetime(3) not null, + complete_time_ datetime(3) null, + status_ varchar(255) null, + batch_doc_id_ varchar(64) null, + tenant_id_ varchar(255) default '' null +) collate = utf8mb3_bin; + +create table flw_ru_batch_part +( + id_ varchar(64) not null + primary key, + rev_ int null, + batch_id_ varchar(64) null, + type_ varchar(64) not null, + scope_id_ varchar(64) null, + sub_scope_id_ varchar(64) null, + scope_type_ varchar(64) null, + search_key_ varchar(255) null, + search_key2_ varchar(255) null, + create_time_ datetime(3) not null, + complete_time_ datetime(3) null, + status_ varchar(255) null, + result_doc_id_ varchar(64) null, + tenant_id_ varchar(255) default '' null, + constraint flw_fk_batch_part_parent + foreign key (batch_id_) references flw_ru_batch (id_) +) collate = utf8mb3_bin; + +create index flw_idx_batch_part + on flw_ru_batch_part (batch_id_); + + +INSERT INTO ACT_FO_DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, EXECTYPE, MD5SUM, DESCRIPTION, + COMMENTS, TAG, LIQUIBASE, CONTEXTS, LABELS, DEPLOYMENT_ID) +VALUES ('1', 'activiti', 'org/flowable/form/db/liquibase/flowable-form-db-changelog.xml', '2025-09-25 10:04:08', 1, + 'EXECUTED', '8:033ebf9380889aed7c453927ecc3250d', + 'createTable tableName=ACT_FO_FORM_DEPLOYMENT; createTable tableName=ACT_FO_FORM_RESOURCE; createTable tableName=ACT_FO_FORM_DEFINITION; createTable tableName=ACT_FO_FORM_INSTANCE', + '', null, '3.10.3', null, null, '8765848418'); +INSERT INTO ACT_FO_DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, EXECTYPE, MD5SUM, DESCRIPTION, + COMMENTS, TAG, LIQUIBASE, CONTEXTS, LABELS, DEPLOYMENT_ID) +VALUES ('2', 'flowable', 'org/flowable/form/db/liquibase/flowable-form-db-changelog.xml', '2025-09-25 10:04:08', 2, + 'EXECUTED', '8:986365ceb40445ce3b27a8e6b40f159b', 'addColumn tableName=ACT_FO_FORM_INSTANCE', '', null, + '3.10.3', null, null, '8765848418'); +INSERT INTO ACT_FO_DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, EXECTYPE, MD5SUM, DESCRIPTION, + COMMENTS, TAG, LIQUIBASE, CONTEXTS, LABELS, DEPLOYMENT_ID) +VALUES ('3', 'flowable', 'org/flowable/form/db/liquibase/flowable-form-db-changelog.xml', '2025-09-25 10:04:08', 3, + 'EXECUTED', '8:abf482518ceb09830ef674e52c06bf15', + 'dropColumn columnName=PARENT_DEPLOYMENT_ID_, tableName=ACT_FO_FORM_DEFINITION', '', null, '3.10.3', null, null, + '8765848418'); +INSERT INTO ACT_FO_DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, EXECTYPE, MD5SUM, DESCRIPTION, + COMMENTS, TAG, LIQUIBASE, CONTEXTS, LABELS, DEPLOYMENT_ID) +VALUES ('4', 'flowable', 'org/flowable/form/db/liquibase/flowable-form-db-changelog.xml', '2025-09-25 10:04:08', 4, + 'EXECUTED', '8:2087829f22a4b2298dbf530681c74854', + 'modifyDataType columnName=DEPLOY_TIME_, tableName=ACT_FO_FORM_DEPLOYMENT; modifyDataType columnName=SUBMITTED_DATE_, tableName=ACT_FO_FORM_INSTANCE', + '', null, '3.10.3', null, null, '8765848418'); +INSERT INTO ACT_FO_DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, EXECTYPE, MD5SUM, DESCRIPTION, + COMMENTS, TAG, LIQUIBASE, CONTEXTS, LABELS, DEPLOYMENT_ID) +VALUES ('5', 'flowable', 'org/flowable/form/db/liquibase/flowable-form-db-changelog.xml', '2025-09-25 10:04:08', 5, + 'EXECUTED', '8:b4be732b89e5ca028bdd520c6ad4d446', + 'createIndex indexName=ACT_IDX_FORM_DEF_UNIQ, tableName=ACT_FO_FORM_DEFINITION', '', null, '3.10.3', null, null, + '8765848418'); +INSERT INTO ACT_FO_DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, EXECTYPE, MD5SUM, DESCRIPTION, + COMMENTS, TAG, LIQUIBASE, CONTEXTS, LABELS, DEPLOYMENT_ID) +VALUES ('6', 'flowable', 'org/flowable/form/db/liquibase/flowable-form-db-changelog.xml', '2025-09-25 10:04:08', 6, + 'EXECUTED', '8:384bbd364a649b67c3ca1bcb72fe537f', + 'createIndex indexName=ACT_IDX_FORM_TASK, tableName=ACT_FO_FORM_INSTANCE; createIndex indexName=ACT_IDX_FORM_PROC, tableName=ACT_FO_FORM_INSTANCE; createIndex indexName=ACT_IDX_FORM_SCOPE, tableName=ACT_FO_FORM_INSTANCE', + '', null, '3.10.3', null, null, '8765848418'); + +INSERT INTO ACT_FO_DATABASECHANGELOGLOCK (ID, LOCKED, LOCKGRANTED, LOCKEDBY) +VALUES (1, false, null, null); + +INSERT INTO ACT_GE_PROPERTY (NAME_, VALUE_, REV_) +VALUES ('batch.schema.version', '6.7.2.0', 1); +INSERT INTO ACT_GE_PROPERTY (NAME_, VALUE_, REV_) +VALUES ('cfg.execution-related-entities-count', 'true', 1); +INSERT INTO ACT_GE_PROPERTY (NAME_, VALUE_, REV_) +VALUES ('cfg.task-related-entities-count', 'true', 1); +INSERT INTO ACT_GE_PROPERTY (NAME_, VALUE_, REV_) +VALUES ('common.schema.version', '6.7.2.0', 1); +INSERT INTO ACT_GE_PROPERTY (NAME_, VALUE_, REV_) +VALUES ('entitylink.schema.version', '6.7.2.0', 1); +INSERT INTO ACT_GE_PROPERTY (NAME_, VALUE_, REV_) +VALUES ('eventsubscription.schema.version', '6.7.2.0', 1); +INSERT INTO ACT_GE_PROPERTY (NAME_, VALUE_, REV_) +VALUES ('identitylink.schema.version', '6.7.2.0', 1); +INSERT INTO ACT_GE_PROPERTY (NAME_, VALUE_, REV_) +VALUES ('job.schema.version', '6.7.2.0', 1); +INSERT INTO ACT_GE_PROPERTY (NAME_, VALUE_, REV_) +VALUES ('next.dbid', '1', 1); +INSERT INTO ACT_GE_PROPERTY (NAME_, VALUE_, REV_) +VALUES ('schema.history', 'create(6.7.2.0)', 1); +INSERT INTO ACT_GE_PROPERTY (NAME_, VALUE_, REV_) +VALUES ('schema.version', '6.7.2.0', 1); +INSERT INTO ACT_GE_PROPERTY (NAME_, VALUE_, REV_) +VALUES ('task.schema.version', '6.7.2.0', 1); +INSERT INTO ACT_GE_PROPERTY (NAME_, VALUE_, REV_) +VALUES ('variable.schema.version', '6.7.2.0', 1); +INSERT INTO ACT_GE_PROPERTY (NAME_, VALUE_, REV_) +VALUES ('workflow.engine.version', '1.5.1', 1); + +INSERT INTO EXT_AX_PROPERTY (id, name, value, create_at, update_at, is_delete, manageable) +VALUES (1, 'yoke', '1.3.0-SNAPSHOT', '2024-02-19 16:30:19', '2024-02-19 16:30:19', 0, 0); diff --git a/workflow-engine-api/src/main/java/cn/axzo/workflow/client/feign/manage/FunctionApi.java b/workflow-engine-api/src/main/java/cn/axzo/workflow/client/feign/manage/FunctionApi.java index 821818f3a..c24fdc58f 100644 --- a/workflow-engine-api/src/main/java/cn/axzo/workflow/client/feign/manage/FunctionApi.java +++ b/workflow-engine-api/src/main/java/cn/axzo/workflow/client/feign/manage/FunctionApi.java @@ -5,6 +5,7 @@ import cn.axzo.workflow.common.annotation.InvokeMode; import cn.axzo.workflow.common.annotation.Manageable; import cn.axzo.workflow.common.enums.AdminDataSource; import cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum; +import cn.axzo.workflow.common.model.dto.CommonDingTalkDTO; import cn.axzo.workflow.common.model.request.feature.DingTalkStarterAlterDTO; import cn.azxo.framework.common.model.CommonResponse; import io.swagger.v3.oas.annotations.Operation; @@ -47,4 +48,9 @@ public interface FunctionApi { @PostMapping("/api/function/dingtalk/alter") @InvokeMode(SYNC) CommonResponse sendDingtalk(@Validated @RequestBody DingTalkStarterAlterDTO dto); + + @Operation(summary = "发送通用钉钉消息") + @PostMapping("/api/function/common/dingtalk/send") + @InvokeMode(SYNC) + CommonResponse sendCommonDingtalk(@Validated @RequestBody CommonDingTalkDTO dto); } diff --git a/workflow-engine-common/src/main/java/cn/axzo/workflow/common/model/NextNodePreCheckAlterDTO.java b/workflow-engine-common/src/main/java/cn/axzo/workflow/common/model/NextNodePreCheckAlterDTO.java deleted file mode 100644 index e0a2de5de..000000000 --- a/workflow-engine-common/src/main/java/cn/axzo/workflow/common/model/NextNodePreCheckAlterDTO.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.axzo.workflow.common.model; - -import lombok.Data; - -/** - * 节点检测告警对象 - * - * @author wangli - * @since 2024-09-13 11:37 - */ -@Data -public class NextNodePreCheckAlterDTO { - - private String processDefinitionKey; - - private String processDefinitionName; - - private String processInstanceId; - - private String activityId; - - private String errorMsg; -} diff --git a/workflow-engine-common/src/main/java/cn/axzo/workflow/common/model/dto/CommonDingTalkDTO.java b/workflow-engine-common/src/main/java/cn/axzo/workflow/common/model/dto/CommonDingTalkDTO.java new file mode 100644 index 000000000..70ddececb --- /dev/null +++ b/workflow-engine-common/src/main/java/cn/axzo/workflow/common/model/dto/CommonDingTalkDTO.java @@ -0,0 +1,42 @@ +package cn.axzo.workflow.common.model.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.ArrayList; +import java.util.List; + +/** + * 通用的 Starter 发送钉钉消息传输对象 + * + * @author wangli + * @since 2026-02-02 16:22 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class CommonDingTalkDTO { + /** + * 钉钉消息 markdown 的标题 + */ + private String title; + /** + * 钉钉消息 markdown 的内容 + */ + private String context; + + /** + * 是否 @ 接收人 + */ + @Builder.Default + private Boolean at = false; + + /** + * 钉钉消息 mardown 的接收人手机号 + */ + @Builder.Default + private List mobiles = new ArrayList<>(); +} diff --git a/workflow-engine-core/pom.xml b/workflow-engine-core/pom.xml index d449a41c3..d1f28ced6 100644 --- a/workflow-engine-core/pom.xml +++ b/workflow-engine-core/pom.xml @@ -114,5 +114,9 @@ com.aliyun alibaba-dingtalk-service-sdk + + cn.axzo + riven-api + diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/conf/FlowableConfiguration.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/conf/FlowableConfiguration.java index 8fcd6ac20..aadb9aa29 100644 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/conf/FlowableConfiguration.java +++ b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/conf/FlowableConfiguration.java @@ -122,7 +122,7 @@ public class FlowableConfiguration { configuration.addCustomJobHandler(new AsyncApproveTaskWithFormJobHandler()); configuration.addCustomJobHandler(new AsyncRemindTaskJobHandler(refreshProperties)); configuration.addCustomJobHandler(new AsyncResetApproversUserTaskJobHandler(extAxHiTaskInstService)); - configuration.addCustomJobHandler(new NextActivityConfigCheckJobHandler()); + configuration.addCustomJobHandler(new NextActivityConfigCheckJobHandler(refreshProperties)); configurers.forEach(i -> configuration.addCustomJobHandler(i.getJobHandler())); // 异步任务异常重试时间间隔 configuration.setDefaultFailedJobWaitTime(30); diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/conf/SupportRefreshProperties.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/conf/SupportRefreshProperties.java index 7b3689bbe..b61a3b905 100644 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/conf/SupportRefreshProperties.java +++ b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/conf/SupportRefreshProperties.java @@ -19,6 +19,8 @@ import java.util.concurrent.TimeUnit; @Data @RefreshScope public class SupportRefreshProperties { + @Value("${spring.profiles.active:local}") + private String profile; @Value("${workflow.apiLog.enable: false}") private Boolean apiLogEnable; @@ -84,9 +86,6 @@ public class SupportRefreshProperties { @Value(value = "${workflow.alter.repeat:false}") private Boolean repeatAlter; - @Value(value = "${workflow.alter.sendDingTalk:true}") - private Boolean alterSendDingTalk; - /** * 用于控制转交管理员的 API */ diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/engine/job/AsyncTermNodeAlterJobHandler.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/engine/job/AsyncTermNodeAlterJobHandler.java deleted file mode 100644 index 5abef2fe2..000000000 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/engine/job/AsyncTermNodeAlterJobHandler.java +++ /dev/null @@ -1,173 +0,0 @@ -package cn.axzo.workflow.core.engine.job; - -import cn.axzo.basics.common.util.NumberUtil; -import cn.axzo.workflow.common.model.dto.AlterDTO; -import cn.axzo.workflow.common.model.dto.TermNodePausingDTO; -import cn.axzo.workflow.common.model.response.category.CategoryItemVO; -import cn.axzo.workflow.core.common.utils.SpringContextUtils; -import cn.axzo.workflow.core.conf.SupportRefreshProperties; -import cn.axzo.workflow.core.listener.Alter; -import cn.axzo.workflow.core.service.CategoryService; -import cn.hutool.core.date.DateTime; -import cn.hutool.core.date.DateUtil; -import com.alibaba.fastjson.JSON; -import lombok.extern.slf4j.Slf4j; -import org.flowable.common.engine.impl.interceptor.CommandContext; -import org.flowable.engine.ManagementService; -import org.flowable.engine.RuntimeService; -import org.flowable.engine.TaskService; -import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl; -import org.flowable.engine.impl.util.CommandContextUtil; -import org.flowable.engine.runtime.ProcessInstance; -import org.flowable.job.service.JobHandler; -import org.flowable.job.service.TimerJobService; -import org.flowable.job.service.impl.persistence.entity.JobEntity; -import org.flowable.job.service.impl.persistence.entity.TimerJobEntity; -import org.flowable.task.api.Task; -import org.flowable.variable.api.delegate.VariableScope; -import org.springframework.util.CollectionUtils; -import org.springframework.util.StringUtils; - -import java.util.Date; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -import static cn.axzo.workflow.common.constant.BpmnConstants.BIZ_NODE_ALTER; - -/** - * 检查指定节点是否长时间卡住,如果卡住则进行钉钉告警 - * - * @author wangli - * @since 2024-09-11 13:50 - */ -@Slf4j -public class AsyncTermNodeAlterJobHandler extends AbstractJobHandler implements JobHandler { - public static final String TYPE = "term-node-alter-cycle"; - private final SupportRefreshProperties refreshProperties; - - public AsyncTermNodeAlterJobHandler(SupportRefreshProperties refreshProperties) { - this.refreshProperties = refreshProperties; - } - - @Override - public String getType() { - return TYPE; - } - - @Override - public void execute(JobEntity job, String configuration, VariableScope variableScope, CommandContext commandContext) { - log.warn("AsyncTermNodeAlterJobHandler exec start..."); - ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext); -// JSONObject jsonObject = JSON.parseObject(job.getJobHandlerConfiguration()); -// if (!jsonObject.containsKey("activityId")) { -// return; -// } - String activityId = job.getJobHandlerConfiguration(); - RuntimeService runtimeService = processEngineConfiguration.getRuntimeService(); - ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(job.getProcessInstanceId()).singleResult(); - if(Objects.isNull(processInstance)) { - return; - } - TermNodePausingDTO dto = runtimeService.getVariable(job.getProcessInstanceId(), BIZ_NODE_ALTER + activityId, TermNodePausingDTO.class); - TaskService taskService = processEngineConfiguration.getTaskService(); - List tasks = taskService.createTaskQuery() - .processInstanceId(dto.getProcessInstanceId()) - .taskDefinitionKey(dto.getActivityId()) - .active() - .list(); - - StringBuilder sb = new StringBuilder(); - tasks.forEach(e -> { - sb.append("id:").append(e.getId()).append(", assignee: ").append(e.getAssignee()); - }); - log.info("tasks size:{}, info: {}", tasks.size(), JSON.toJSONString(sb)); - if (CollectionUtils.isEmpty(tasks) || tasks.size() > 1 || hasAssignee(tasks.get(0).getAssignee())) { - return; - } - - if (DateUtil.compare(DateUtil.date(), getDateTime(tasks.get(0).getCreateTime())) <= 0) { - ManagementService managementService = processEngineConfiguration.getManagementService(); - managementService.executeCommand(context -> { - TimerJobService timerJobService = CommandContextUtil.getTimerJobService(); - TimerJobEntity timerJobEntity = timerJobService.createTimerJob(); - timerJobEntity.setJobType("timer"); - timerJobEntity.setJobHandlerType(AsyncTermNodeAlterJobHandler.TYPE); // 这里填写你自定义的 JobHandler 类型 - timerJobEntity.setProcessInstanceId(dto.getProcessInstanceId()); - timerJobEntity.setExecutionId(null); - timerJobEntity.setDuedate(getDateTime(new Date())); // 立即执行 - timerJobEntity.setRepeat(null); // 不重复 - timerJobEntity.setRetries(1); - timerJobEntity.setJobHandlerConfiguration(dto.getActivityId()); // 可选,传递参数 - timerJobService.scheduleTimerJob(timerJobEntity); - return null; - }); - return; - } - - // 不允许重复告警 - if (!refreshProperties.getRepeatAlter() && dto.getRetries() > 0) { - return; - } - // 超过告警次数 - if (refreshProperties.getAlterRetries() != 0 && dto.getRetries() >= refreshProperties.getAlterRetries()) { - return; - } - - CategoryService bean = SpringContextUtils.getBean(CategoryService.class); - Optional bpmModelCategory = bean.get("bpm_model_category", processInstance.getProcessDefinitionKey()); - // 发送告警对象 - Alter alter = SpringContextUtils.getBean(Alter.class); - AlterDTO alterDTO = new AlterDTO(); - alterDTO.setProcessDefinitionKey(processInstance.getProcessDefinitionKey()); - alterDTO.setProcessDefinitionName(bpmModelCategory.orElse(new CategoryItemVO()).getLabel()); - alterDTO.setProcessInstanceId(dto.getProcessInstanceId()); - alterDTO.setActivityId(dto.getActivityId()); - alterDTO.setTaskId(tasks.get(0).getId()); - alterDTO.setStartTime(tasks.get(0).getCreateTime()); - alterDTO.setPrettyStartTime(DateUtil.formatDateTime(tasks.get(0).getCreateTime())); - if (Boolean.TRUE.equals(refreshProperties.getAlterSendDingTalk())) { - alter.invoke(alterDTO); - - // 记录告警次数 - incRetries(job, dto, runtimeService, activityId); - - } - } - - private DateTime getDateTime(Date date) { - DateTime dateTime; - switch (refreshProperties.getAlterIntervalUnit()) { - case MINUTES: - dateTime = DateUtil.offsetMinute(date, refreshProperties.getPauseDelay()); - break; - case HOURS: - dateTime = DateUtil.offsetHour(date, refreshProperties.getPauseDelay()); - break; - default: - dateTime = DateUtil.offsetSecond(date, refreshProperties.getPauseDelay()); - break; - } - return dateTime; - } - - private void incRetries(JobEntity job, TermNodePausingDTO dto, RuntimeService runtimeService, String activityId) { - dto.setRetries(dto.getRetries() + 1); - runtimeService.setVariable(job.getProcessInstanceId(), BIZ_NODE_ALTER + activityId, dto); - } - -// private void deleteTimerJob(TermNodePausingDTO dto) { -// Context.getTransactionContext().addTransactionListener(TransactionState.COMMITTED, -// new DeleteTimerJobTransactionListener(dto)); -// } - - private Boolean hasAssignee(String assignee) { - if (!StringUtils.hasText(assignee)) { - return false; - } - String[] split = assignee.split("\\|"); - return split.length == 2 && NumberUtil.isPositiveNumber(Long.valueOf(split[1])); - } - - -} diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/engine/job/NextActivityConfigCheckJobHandler.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/engine/job/NextActivityConfigCheckJobHandler.java index 9ad5586c7..bf81b5f99 100644 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/engine/job/NextActivityConfigCheckJobHandler.java +++ b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/engine/job/NextActivityConfigCheckJobHandler.java @@ -1,14 +1,14 @@ package cn.axzo.workflow.core.engine.job; import cn.axzo.workflow.common.enums.ApproverEmptyHandleTypeEnum; -import cn.axzo.workflow.common.model.NextNodePreCheckAlterDTO; import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskDelegateAssigner; import cn.axzo.workflow.common.model.response.category.CategoryItemVO; import cn.axzo.workflow.core.common.utils.SpringContextUtils; +import cn.axzo.workflow.core.conf.SupportRefreshProperties; import cn.axzo.workflow.core.deletage.BpmnTaskAssigneeSelector; -import cn.axzo.workflow.core.listener.Alter; import cn.axzo.workflow.core.service.CategoryService; import cn.axzo.workflow.core.service.support.FlowNodeForecastService; +import cn.axzo.workflow.core.util.RivenDingTalkHelper; import cn.hutool.json.JSONUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.ListUtils; @@ -49,6 +49,12 @@ import static cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper.getApprove public class NextActivityConfigCheckJobHandler extends AbstractJobHandler implements JobHandler { public static final String TYPE = "next-activity-config-check"; + private final SupportRefreshProperties refreshProperties; + + public NextActivityConfigCheckJobHandler(SupportRefreshProperties refreshProperties) { + this.refreshProperties = refreshProperties; + } + @Override public String getType() { return TYPE; @@ -77,15 +83,17 @@ public class NextActivityConfigCheckJobHandler extends AbstractJobHandler implem log.warn("NextActivityConfigCheckJobHandler msg: {}", e.getMessage(), e); CategoryService bean = SpringContextUtils.getBean(CategoryService.class); Optional bpmModelCategory = bean.get("bpm_model_category", processInstance.getProcessDefinitionKey()); - Alter alter = SpringContextUtils.getBean(Alter.class); + RivenDingTalkHelper rivenDingTalkHelper = SpringContextUtils.getBean(RivenDingTalkHelper.class); FlowElement flowElement = ListUtils.emptyIfNull(flowElements).stream().filter(i -> i instanceof UserTask || i instanceof ReceiveTask || i instanceof ServiceTask).findFirst().orElse(null); - NextNodePreCheckAlterDTO alterDTO = new NextNodePreCheckAlterDTO(); - alterDTO.setProcessDefinitionKey(processInstance.getProcessDefinitionKey()); - alterDTO.setProcessDefinitionName(bpmModelCategory.orElse(new CategoryItemVO()).getLabel()); - alterDTO.setProcessInstanceId(job.getProcessInstanceId()); - alterDTO.setActivityId(Objects.nonNull(flowElement) ? flowElement.getId() : null); - alterDTO.setErrorMsg(e.getMessage()); - alter.invoke(alterDTO); + + String title = "Notice 审批模板节点预检查告警, Env:" + refreshProperties.getProfile(); + String content = "#### [" + refreshProperties.getProfile() + "]审批模板节点预检查告警\n" + + "> 审批业务: " + bpmModelCategory.orElse(new CategoryItemVO()).getLabel() + "(" + processInstance.getProcessDefinitionKey() + ")" + "\n\n" + + "> 实例 ID:" + job.getProcessInstanceId() + "\n\n" + + "> 检测节点 ID:" + (Objects.nonNull(flowElement) ? flowElement.getId() : null) + "\n\n" + + "> ##### 错误信息:" + e.getMessage() + "\n\n"; + // 生产环境需要 + rivenDingTalkHelper.sendMarkdownMessage(title, content, true, false); } } diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/engine/listener/EngineExecutionStartListener.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/engine/listener/EngineExecutionStartListener.java index 1150b6100..9925dd73b 100644 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/engine/listener/EngineExecutionStartListener.java +++ b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/engine/listener/EngineExecutionStartListener.java @@ -14,7 +14,7 @@ import cn.axzo.workflow.core.deletage.BpmnTaskDelegate; import cn.axzo.workflow.core.deletage.MockTaskAssigneeSelector; import cn.axzo.workflow.core.engine.cmd.CustomAbortProcessInstanceAsyncCmd; import cn.axzo.workflow.core.engine.job.NextActivityConfigCheckJobHandler; -import cn.axzo.workflow.core.util.DingTalkUtils; +import cn.axzo.workflow.core.util.RivenDingTalkHelper; import cn.hutool.json.JSONUtil; import com.google.common.collect.Lists; import lombok.extern.slf4j.Slf4j; @@ -90,6 +90,8 @@ public class EngineExecutionStartListener implements ExecutionListener { private List selectors; @Resource private SupportRefreshProperties refreshProperties; + @Resource + private RivenDingTalkHelper rivenDingTalkHelper; @Override public void notify(DelegateExecution execution) { @@ -252,7 +254,15 @@ public class EngineExecutionStartListener implements ExecutionListener { //发送钉钉消息 if (Boolean.TRUE.equals(refreshProperties.getSendDingTalk())) { CooperationOrgDTO orgScopes = execution.getVariable(BIZ_ORG_RELATION, CooperationOrgDTO.class); - DingTalkUtils.sendDingTalkForTransferToAdminError(profile, execution.getProcessInstanceId(), userTask.getId(), orgScopes, targetUrl); + + String title = "Notice 转交管理员后的审批人为空, Env: " + profile; + String content = "#### [" + profile + "]转交管理员后的审批人为空\n" + + "> 流程实例 ID: " + execution.getProcessInstanceId() + "\n\n" + + "> 节点参数(节点 ID): " + userTask.getId() + "\n\n" + + "> OrgScopes 参数信息: " + JSONUtil.toJsonStr(orgScopes) + "\n\n" + + "> 目标接口: " + targetUrl + "\n\n" + + "> ##### 提示:仅作为提示信息,不代表是异常"; + rivenDingTalkHelper.sendMarkdownMessage(title, content, false, false); } BpmnProcessInstanceAbortDTO abortDTO = new BpmnProcessInstanceAbortDTO(); abortDTO.setProcessInstanceId(execution.getProcessInstanceId()); diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/listener/Alter.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/listener/Alter.java index 2b6ac9afd..025a9a640 100644 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/listener/Alter.java +++ b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/listener/Alter.java @@ -1,7 +1,5 @@ package cn.axzo.workflow.core.listener; -import cn.axzo.workflow.common.model.dto.AlterDTO; - /** * Core 往外转发的钩子 * @@ -10,5 +8,5 @@ import cn.axzo.workflow.common.model.dto.AlterDTO; */ public interface Alter { - void invoke(Object obj); + void _invoke(Object obj); } diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/util/DingTalkUtils.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/util/DingTalkUtils.java deleted file mode 100644 index b32b1a0d0..000000000 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/util/DingTalkUtils.java +++ /dev/null @@ -1,224 +0,0 @@ -package cn.axzo.workflow.core.util; - -import cn.axzo.workflow.common.model.NextNodePreCheckAlterDTO; -import cn.axzo.workflow.common.model.dto.AlterDTO; -import cn.axzo.workflow.common.model.request.feature.DingTalkStarterAlterDTO; -import cn.hutool.core.date.DateUtil; -import cn.hutool.json.JSONObject; -import cn.hutool.json.JSONUtil; -import com.dingtalk.api.DefaultDingTalkClient; -import com.dingtalk.api.DingTalkClient; -import com.dingtalk.api.request.OapiRobotSendRequest; -import com.dingtalk.api.response.OapiRobotSendResponse; -import lombok.SneakyThrows; -import lombok.extern.slf4j.Slf4j; -import org.slf4j.MDC; -import org.springframework.util.StringUtils; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -import static cn.azxo.framework.common.constatns.Constants.CTX_LOG_ID_MDC; - -/** - * 钉钉告警处理 - * - * @author wangli - * @since 2024/1/12 14:34 - */ -@Slf4j -public class DingTalkUtils { - - private static final String dingtalk_robot_webhook = "https://oapi.dingtalk" + - ".com/robot/send?access_token=341ee2907f3ebc15dc495fb7771a646230058710999fec7838066c109849878e"; - - private static final Map ENV_URL_MAPPING = new HashMap<>(); - private static final Map WEB_URL_MAPPING = new HashMap<>(); - - static { - ENV_URL_MAPPING.put("local", "https://dev-app.axzo.cn"); - ENV_URL_MAPPING.put("dev", "https://dev-app.axzo.cn"); - ENV_URL_MAPPING.put("test", "https://test-api.axzo.cn"); - ENV_URL_MAPPING.put("pre", "https://pre-api.axzo.cn"); - ENV_URL_MAPPING.put("live", "https://live-api.axzo.cn"); - ENV_URL_MAPPING.put("default", "https://api.axzo.cn"); - - WEB_URL_MAPPING.put("local", "https://dev-new-workflow-web.axzo.cn"); - WEB_URL_MAPPING.put("dev", "https://dev-new-workflow-web.axzo.cn"); - WEB_URL_MAPPING.put("test", "https://test-new-workflow-web.axzo.cn"); - WEB_URL_MAPPING.put("pre", "https://pre-new-workflow-web.axzo.cn"); - WEB_URL_MAPPING.put("live", "https://live-new-workflow-web.axzo.cn"); - WEB_URL_MAPPING.put("default", "https://new-workflow-web.axzo.cn"); - } - - public static String getEnvUrl(String profile) { - String urlPrefix = ENV_URL_MAPPING.get(profile); - if (!StringUtils.hasText(urlPrefix)) { - urlPrefix = ENV_URL_MAPPING.get("default"); - } - return urlPrefix; - } - - public static String getWebUrl(String profile) { - String urlPrefix = WEB_URL_MAPPING.get(profile); - if (!StringUtils.hasText(urlPrefix)) { - urlPrefix = WEB_URL_MAPPING.get("default"); - } - return urlPrefix; - } - - @SneakyThrows - public static void sendDingTalk(String profile, String title, Object req, String invokeServerName, Throwable throwable) { - OapiRobotSendRequest request = new OapiRobotSendRequest(); - request.setMsgtype("markdown"); - OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown(); - markdown.setTitle("Notice " + title + ", Env: " + profile); - String text = "#### [" + profile + "]" + title + "\n" + - "> 时间: " + DateUtil.now() + "\n" + - "> 入参: " + JSONUtil.toJsonStr(req) + "\n\n" + - "> ###### 异常信息: " + JSONUtil.toJsonStr(Objects.isNull(throwable.getCause()) ? throwable.getMessage() : - throwable.getCause().getMessage()) + " \n\n" + - "> ##### traceId: " + MDC.get(CTX_LOG_ID_MDC) + " \n" + - "> ##### 调用方服务名称:" + invokeServerName + " \n"; - String deadLetterStacktrace = getDeadLetterStacktrace(profile, req); - text = text + (StringUtils.hasText(deadLetterStacktrace) ? "> ##### [点击查看异常明细](" + deadLetterStacktrace + ") \n" : ""); - markdown.setText(text); - request.setMarkdown(markdown); - sendDingTalk(request); - } - - private static String getDeadLetterStacktrace(String profile, Object req) { - try { - JSONObject entries = JSONUtil.parseObj(req); - String jobId = entries.getStr("id"); - if (!StringUtils.hasText(jobId)) { - return ""; - } - return getEnvUrl(profile) + "/workflow-engine/web/v1/api/process/job/dead-letter/exception/stacktrace/byId?jobId=" + jobId; - } catch (Exception e) { - log.warn("构造查询错误堆栈地址异常", e); - return ""; - } - } - - @SneakyThrows - public static void sendDingTalkForSlowUrl(String profile, Double time, String apiUrl, Object requestParam, Object responseBody) { - OapiRobotSendRequest request = new OapiRobotSendRequest(); - request.setMsgtype("markdown"); - OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown(); - markdown.setTitle("Notice 请求二方接口慢 URL, Env: " + profile); - markdown.setText("#### [" + profile + "]请求二方接口过慢\n" + - "> 接口地址: " + apiUrl + ",经过了" + time + "秒\n\n" + - "> 请求参数: " + JSONUtil.toJsonStr(requestParam) + "\n\n" + - "> ###### 结果: " + JSONUtil.toJsonStr(responseBody) + " \n"); - request.setMarkdown(markdown); - sendDingTalk(request); - } - - @SneakyThrows - public static void sendDingTalkForSlowApi(String profile, Double time, String apiUrl, String uniqueId) { - OapiRobotSendRequest request = new OapiRobotSendRequest(); - request.setMsgtype("markdown"); - OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown(); - markdown.setTitle("Notice API 处理耗时报告, Env: " + profile); - markdown.setText("#### [" + profile + "]API 处理耗时报告\n" + - "> 接口地址: " + apiUrl + ",经过了" + time + "秒\n\n" + - "> ###### 标识: " + uniqueId + " \n"); - request.setMarkdown(markdown); - sendDingTalk(request); - } - - @SneakyThrows - private static void sendDingTalk(OapiRobotSendRequest request) { - DingTalkClient client = new DefaultDingTalkClient(dingtalk_robot_webhook); - OapiRobotSendResponse response = client.execute(request); - } - - public static void sendDingTalkForBizNodeAlter(String profile, AlterDTO alterDTO, List atMobiles) { -// if (CollectionUtils.isEmpty(atMobiles)) { -// return; -// } - String processInstanceId = alterDTO.getProcessInstanceId(); - OapiRobotSendRequest request = new OapiRobotSendRequest(); - request.setMsgtype("markdown"); - OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown(); - markdown.setTitle("Notice 业务节点长时间停止告警, Env: " + profile); - markdown.setText("#### [" + profile + "]业务节点长时间停止\n" + - "> 审批业务: " + alterDTO.getProcessDefinitionName() + "(" + alterDTO.getProcessDefinitionKey() + ")" + "\n\n" + - "> 节点相关信息: " + JSONUtil.toJsonStr(alterDTO) + "\n\n" + - "> ##### [点击查看审批日志](" + getWebUrl(profile) + "/#/workflow/examples?processInstanceId=" + processInstanceId + ") \n\n" + - "> ##### 提示:如果以上地址提示未登录,请在对应环境 OMS 系统登录后并点击审批管理的功能后,再使用。或者复制实例 ID 到 OMS 中手动查询 \n\n" + - mobiles(atMobiles)); - request.setMarkdown(markdown); - OapiRobotSendRequest.At at = new OapiRobotSendRequest.At(); - at.setAtMobiles(atMobiles); - at.setIsAtAll(false); - request.setAt(at); - sendDingTalk(request); - } - - public static String mobiles(List atMobiles) { - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < atMobiles.size(); i++) { - if (i != 0) { - sb.append(","); - } - sb.append("@").append(atMobiles.get(i)); - } - return sb.toString(); - } - - public static void sendDingTalkForNodePreCheck(String profile, NextNodePreCheckAlterDTO alterDTO, List alterMobiles) { - OapiRobotSendRequest request = new OapiRobotSendRequest(); - request.setMsgtype("markdown"); - OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown(); - markdown.setTitle("Notice 审批模板节点预检查告警, Env: " + profile); - markdown.setText("#### [" + profile + "]审批模板节点预检查告警\n" + - "> 审批业务: " + alterDTO.getProcessDefinitionName() + "(" + alterDTO.getProcessDefinitionKey() + ")" + "\n\n" + - "> 实例 ID:" + alterDTO.getProcessInstanceId() + "\n\n" + - "> 检测节点 ID:" + alterDTO.getActivityId() + "\n\n" + - "> ##### 错误信息:" + alterDTO.getErrorMsg() + "\n\n" + - mobiles(alterMobiles)); - request.setMarkdown(markdown); - OapiRobotSendRequest.At at = new OapiRobotSendRequest.At(); - at.setAtMobiles(alterMobiles); - at.setIsAtAll(false); - request.setAt(at); - sendDingTalk(request); - - } - - public static void sendDingTalkForTransferToAdminError(String profile, String processInstanceId, String taskDefinitionKey, Object orgScopes, String targetUrl) { - OapiRobotSendRequest request = new OapiRobotSendRequest(); - request.setMsgtype("markdown"); - OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown(); - markdown.setTitle("Notice 转交管理员后的审批人为空, Env: " + profile); - markdown.setText("#### [" + profile + "]转交管理员后的审批人为空\n" + - "> 流程实例 ID: " + processInstanceId + "\n\n" + - "> 节点参数(节点 ID): " + taskDefinitionKey + "\n\n" + - "> OrgScopes 参数信息: " + JSONUtil.toJsonStr(orgScopes) + "\n\n" + - "> 目标接口: " + targetUrl + "\n\n" + - "> ##### 提示:仅作为提示信息,不代表是异常"); - request.setMarkdown(markdown); - sendDingTalk(request); - } - - public static void sendDingTalkForStarter(DingTalkStarterAlterDTO dto, List alterMobiles) { - OapiRobotSendRequest request = new OapiRobotSendRequest(); - request.setMsgtype("markdown"); - OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown(); - markdown.setTitle("Notice 应用必接广播 MQ 事件告警, Env: " + dto.getProfile()); - markdown.setText("#### [" + dto.getProfile() + "]应用必接广播 MQ 事件告警\n" + - "> 应用名称:" + dto.getApplicationName() + "\n\n" + - "> 检测信息:" + dto.getAlterContent() + "\n\n" + - mobiles(alterMobiles)); - request.setMarkdown(markdown); - OapiRobotSendRequest.At at = new OapiRobotSendRequest.At(); - at.setAtMobiles(alterMobiles); - at.setIsAtAll(false); - request.setAt(at); - sendDingTalk(request); - } -} diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/util/RivenDingTalkHelper.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/util/RivenDingTalkHelper.java new file mode 100644 index 000000000..2bfc455dc --- /dev/null +++ b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/util/RivenDingTalkHelper.java @@ -0,0 +1,177 @@ +package cn.axzo.workflow.core.util; + +import cn.axzo.riven.client.feign.DingDingMsgApi; +import cn.axzo.riven.client.model.SampleMarkdown; +import cn.axzo.riven.client.req.DingDingSendRebootGroupMsgReq; +import com.alibaba.fastjson.JSONObject; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * Riven 钉钉消息发送统一工具类 + *

+ * 用于替代原有的 webhook 直调方式,统一通过 Riven 服务发送钉钉消息。 + * 支持所有业务场景,包括: + * - 业务节点告警 + * - 节点预检查告警 + * - 应用必接事件告警 + * - DLQ 监控告警 + * - 慢接口告警 + * - 异常告警 + * + * @author wangli + * @since 2026-01-21 + */ +@Slf4j +@Component +public class RivenDingTalkHelper { + @Value("${spring.profiles.active}") + private String profile; + @Value(value = "${workflow.alter.mobiles:}") + private List alterMobiles; + + /** + * Riven 钉钉消息 Feign 客户端 + * 注意:需要在项目中引入 riven-api 依赖 + */ + @Resource + private DingDingMsgApi dingDingMsgApi; + + /** + * 钉钉消息场景标识(工作流小分队使用) + */ + private static final String DINGTALK_NOT_MASTER_SCENE = "WORKFLOW_ENGINE_BIZNODE_ALTER"; + /** + * 钉钉消息场景标识(工作流生产环境使用) + */ + private static final String DINGTALK_MASTER_SCENE = "WORKFLOW_ENGINE_MASTER_ALTER"; + + /** + * 环境 URL 映射(API) + */ + private static final Map ENV_URL_MAPPING = new HashMap<>(); + + /** + * 环境 URL 映射(Web) + */ + private static final Map WEB_URL_MAPPING = new HashMap<>(); + + static { + // API 地址映射 + ENV_URL_MAPPING.put("local", "https://dev-app.axzo.cn"); + ENV_URL_MAPPING.put("dev", "https://dev-app.axzo.cn"); + ENV_URL_MAPPING.put("test", "https://test-api.axzo.cn"); + ENV_URL_MAPPING.put("pre", "https://pre-api.axzo.cn"); + ENV_URL_MAPPING.put("live", "https://live-api.axzo.cn"); + ENV_URL_MAPPING.put("default", "https://api.axzo.cn"); + + // Web 地址映射 + WEB_URL_MAPPING.put("local", "https://dev-new-workflow-web.axzo.cn"); + WEB_URL_MAPPING.put("dev", "https://dev-new-workflow-web.axzo.cn"); + WEB_URL_MAPPING.put("test", "https://test-new-workflow-web.axzo.cn"); + WEB_URL_MAPPING.put("pre", "https://pre-new-workflow-web.axzo.cn"); + WEB_URL_MAPPING.put("live", "https://live-new-workflow-web.axzo.cn"); + WEB_URL_MAPPING.put("default", "https://new-workflow-web.axzo.cn"); + } + + /** + * 获取环境对应的 API 地址前缀 + * + * @param profile 环境标识(dev/test/pre/live/master 等) + * @return API 地址前缀 + */ + public static String getEnvUrl(String profile) { + String urlPrefix = ENV_URL_MAPPING.get(profile); + if (!StringUtils.hasText(urlPrefix)) { + urlPrefix = ENV_URL_MAPPING.get("default"); + } + return urlPrefix; + } + + /** + * 获取环境对应的 Web 地址前缀 + * + * @param profile 环境标识 + * @return Web 地址前缀 + */ + public static String getWebUrl(String profile) { + String urlPrefix = WEB_URL_MAPPING.get(profile); + if (!StringUtils.hasText(urlPrefix)) { + urlPrefix = WEB_URL_MAPPING.get("default"); + } + return urlPrefix; + } + + /** + * 格式化 @人员列表为字符串 + * + * @param atMobiles 手机号列表 + * @return @人员字符串,格式:@手机号1,@手机号2 + */ + public static String formatMobiles(List atMobiles) { + if (atMobiles == null || atMobiles.isEmpty()) { + return ""; + } + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < atMobiles.size(); i++) { + if (i != 0) { + sb.append(","); + } + sb.append("@").append(atMobiles.get(i)); + } + return sb.toString(); + } + + + /** + * 发送 Markdown 格式的钉钉消息(核心方法) + * + * @param title 消息标题 + * @param text 消息内容(Markdown 格式) + */ + public void sendMarkdownMessage(String title, String text, Boolean targetIsMaster, Boolean at) { + sendMarkdownMessage(title, text, targetIsMaster, at, alterMobiles); + } + + public void sendMarkdownMessage(String title, String text, Boolean targetIsMaster, Boolean at, List mobiles) { + DingDingSendRebootGroupMsgReq req = new DingDingSendRebootGroupMsgReq(); + if (Objects.equals(targetIsMaster, Boolean.TRUE) && Objects.equals(profile, "master")) { + req.setDingDingScene(DINGTALK_MASTER_SCENE); + } else { + req.setDingDingScene(DINGTALK_NOT_MASTER_SCENE); + } + + // 构建 Markdown 消息 + SampleMarkdown markdown = new SampleMarkdown(title, text); + JSONObject markdownJson = JSONObject.parseObject(markdown.toJson()); + if (Objects.equals(at, Boolean.TRUE)) { + if (CollectionUtils.isEmpty(mobiles)) { + mobiles = alterMobiles; + } + + // 添加 @人员信息 + if (mobiles != null && !mobiles.isEmpty()) { + JSONObject atMobilesJson = new JSONObject(); + atMobilesJson.put("atMobiles", alterMobiles); + markdownJson.put("at", atMobilesJson); + markdownJson.put("isAtAll", false); + markdown.setText(markdown.getText() + formatMobiles(alterMobiles)); + } + } + req.setDingDingJson(markdownJson.toJSONString()); + req.setMsgType(cn.axzo.riven.client.common.enums.DingTalkMsgTypeEnum.sampleMarkdown); + + // 调用 Riven API + dingDingMsgApi.sendRebootGroupMsg(req); + } + +} diff --git a/workflow-engine-server/src/main/java/cn/axzo/workflow/server/alter/DingTalkAlter.java b/workflow-engine-server/src/main/java/cn/axzo/workflow/server/alter/DingTalkAlter.java deleted file mode 100644 index 83b6c25ee..000000000 --- a/workflow-engine-server/src/main/java/cn/axzo/workflow/server/alter/DingTalkAlter.java +++ /dev/null @@ -1,141 +0,0 @@ -package cn.axzo.workflow.server.alter; - -import cn.axzo.framework.jackson.utility.JSON; -import cn.axzo.riven.client.common.enums.DingTalkMsgTypeEnum; -import cn.axzo.riven.client.feign.DingDingMsgApi; -import cn.axzo.riven.client.model.SampleMarkdown; -import cn.axzo.riven.client.req.DingDingSendRebootGroupMsgReq; -import cn.axzo.workflow.common.model.NextNodePreCheckAlterDTO; -import cn.axzo.workflow.common.model.dto.AlterDTO; -import cn.axzo.workflow.common.model.request.feature.DingTalkStarterAlterDTO; -import cn.axzo.workflow.core.conf.SupportRefreshProperties; -import cn.axzo.workflow.core.listener.Alter; -import cn.axzo.workflow.core.util.DingTalkUtils; -import cn.hutool.json.JSONUtil; -import com.alibaba.fastjson.JSONObject; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; -import java.util.Objects; - -import static cn.axzo.workflow.core.util.DingTalkUtils.getWebUrl; -import static cn.axzo.workflow.core.util.DingTalkUtils.mobiles; - -/** - * 钉钉告警实现 - * - * @author wangli - * @since 2024-09-13 11:40 - */ -@Slf4j -@Component -public class DingTalkAlter implements Alter { - - @Value("${spring.profiles.active}") - private String profile; - @Resource - private SupportRefreshProperties refreshProperties; - @Resource - private DingDingMsgApi dingDingMsgApi; - - @Override - public void invoke(Object obj) { - if (!Boolean.TRUE.equals(refreshProperties.getAlterSendDingTalk())) { - log.info("ignore send alter"); - return; - } - log.info("send biz node alter : {}", JSON.toJSONString(obj)); - if (obj instanceof AlterDTO) { - AlterDTO alterDTO = (AlterDTO) obj; - if (Objects.equals(profile, "master")) { - DingTalkUtils.sendDingTalkForBizNodeAlter(profile, alterDTO, refreshProperties.getAlterMobiles()); - } else { - rivenDingtalk(alterDTO); - } - } - if (obj instanceof NextNodePreCheckAlterDTO) { - NextNodePreCheckAlterDTO alterDTO = (NextNodePreCheckAlterDTO) obj; - if (Objects.equals(profile, "master")) { - DingTalkUtils.sendDingTalkForNodePreCheck(profile, alterDTO, refreshProperties.getAlterMobiles()); - } else { - rivenDingtalkForNodePreCheck(alterDTO); - } - } - - if (obj instanceof DingTalkStarterAlterDTO) { - DingTalkStarterAlterDTO starterAlterDTO = (DingTalkStarterAlterDTO) obj; - if (refreshProperties.getIgnoreMqAlterApplicationNames().contains(starterAlterDTO.getApplicationName())) { - // 忽略必接事件的应用 - return; - } - DingTalkUtils.sendDingTalkForStarter(starterAlterDTO, refreshProperties.getAlterMobiles()); - } - } - - private void rivenDingtalkForStarter(DingTalkStarterAlterDTO alterDTO) { - DingDingSendRebootGroupMsgReq req = new DingDingSendRebootGroupMsgReq(); - req.setDingDingScene("WORKFLOW_ENGINE_BIZNODE_ALTER"); - String title = "Notice 应用必接事件告警, Env: " + profile; - String text = "#### [" + profile + "]应用必接事件告警\n" + - "> 应用名称:" + alterDTO.getApplicationName() + "\n\n" + - "> 检测信息:" + alterDTO.getAlterContent() + "\n\n" + - mobiles(refreshProperties.getAlterMobiles()); - SampleMarkdown markdown = new SampleMarkdown(title, text); - JSONObject markdownJson = JSONObject.parseObject(markdown.toJson()); - JSONObject atMobiles = new JSONObject(); - atMobiles.put("atMobiles", refreshProperties.getAlterMobiles()); - markdownJson.put("at", atMobiles); - markdownJson.put("isAtAll", false); - req.setDingDingJson(markdownJson.toJSONString()); - req.setMsgType(DingTalkMsgTypeEnum.sampleMarkdown); - dingDingMsgApi.sendRebootGroupMsg(req); - } - - private void rivenDingtalkForNodePreCheck(NextNodePreCheckAlterDTO alterDTO) { - DingDingSendRebootGroupMsgReq req = new DingDingSendRebootGroupMsgReq(); - req.setDingDingScene("WORKFLOW_ENGINE_BIZNODE_ALTER"); - String processInstanceId = alterDTO.getProcessInstanceId(); - String title = "Notice 审批模板节点预检查告警, Env: " + profile; - String text = "#### [" + profile + "]审批模板节点预检查告警\n" + -// "> 相关信息: " + JSONUtil.toJsonStr(alterDTO) + "\n\n" + - "> 实例 ID:" + alterDTO.getProcessInstanceId() + "\n\n" + - "> 检测节点 ID:" + alterDTO.getActivityId() + "\n\n" + - "> ##### 错误信息:" + alterDTO.getErrorMsg() + "\n\n" + - mobiles(refreshProperties.getAlterMobiles()); - SampleMarkdown markdown = new SampleMarkdown(title, text); - - JSONObject markdownJson = JSONObject.parseObject(markdown.toJson()); - JSONObject atMobiles = new JSONObject(); - atMobiles.put("atMobiles", refreshProperties.getAlterMobiles()); - markdownJson.put("at", atMobiles); - markdownJson.put("isAtAll", false); - req.setDingDingJson(markdownJson.toJSONString()); - req.setMsgType(DingTalkMsgTypeEnum.sampleMarkdown); - dingDingMsgApi.sendRebootGroupMsg(req); - } - - private void rivenDingtalk(AlterDTO alterDTO) { - DingDingSendRebootGroupMsgReq req = new DingDingSendRebootGroupMsgReq(); - req.setDingDingScene("WORKFLOW_ENGINE_BIZNODE_ALTER"); - String processInstanceId = alterDTO.getProcessInstanceId(); - String title = "Notice 业务节点长时间停止告警, Env: " + profile; - String text = "#### [" + profile + "]业务节点长时间停止\n" + - "> 节点相关信息: " + JSONUtil.toJsonStr(alterDTO) + "\n\n" + - "> ##### [点击查看审批日志](" + getWebUrl(profile) + "/#/workflow/examples?processInstanceId=" + processInstanceId + ") \n\n" + - "> ##### 提示:如果以上地址提示未登录,请在对应环境 OMS 系统登录后并点击审批管理的功能后,再使用。或者复制实例 ID 到 OMS 中手动查询 \n\n " + - mobiles(refreshProperties.getAlterMobiles()); - SampleMarkdown markdown = new SampleMarkdown(title, text); - - JSONObject markdownJson = JSONObject.parseObject(markdown.toJson()); - JSONObject atMobiles = new JSONObject(); - atMobiles.put("atMobiles", refreshProperties.getAlterMobiles()); - markdownJson.put("at", atMobiles); - markdownJson.put("isAtAll", false); - req.setDingDingJson(markdownJson.toJSONString()); - req.setMsgType(DingTalkMsgTypeEnum.sampleMarkdown); - dingDingMsgApi.sendRebootGroupMsg(req); - } - -} diff --git a/workflow-engine-server/src/main/java/cn/axzo/workflow/server/common/annotation/ReporterType.java b/workflow-engine-server/src/main/java/cn/axzo/workflow/server/common/annotation/ReporterType.java index f7cb0d71f..b3f694e76 100644 --- a/workflow-engine-server/src/main/java/cn/axzo/workflow/server/common/annotation/ReporterType.java +++ b/workflow-engine-server/src/main/java/cn/axzo/workflow/server/common/annotation/ReporterType.java @@ -1,9 +1,19 @@ package cn.axzo.workflow.server.common.annotation; -import cn.axzo.workflow.core.util.DingTalkUtils; +import cn.axzo.workflow.core.util.RivenDingTalkHelper; +import cn.axzo.workflow.server.common.util.SpringUtils; +import cn.hutool.core.date.DateUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; import lombok.extern.slf4j.Slf4j; +import org.slf4j.MDC; +import org.springframework.util.StringUtils; +import java.util.Objects; + +import static cn.axzo.workflow.core.util.RivenDingTalkHelper.getEnvUrl; import static cn.axzo.workflow.server.common.aspectj.RepeatSubmitAspect.argsArrayToString; +import static cn.azxo.framework.common.constatns.Constants.CTX_LOG_ID_MDC; /** @@ -22,10 +32,9 @@ public enum ReporterType { @Override public void executeAction(String profile, String title, Boolean sendDingTalk, Object[] args, String shortString, String invokeServerName, Throwable e, Boolean downgrade) { if (sendDingTalk) { - DingTalkUtils.sendDingTalk(profile, title, argsArrayToString(args), invokeServerName, e); + sendRivenDingTalk(profile, title, args, invokeServerName, e); } } - }, /** * 仅打印日志 @@ -36,7 +45,6 @@ public enum ReporterType { if (downgrade) { log.warn("ER: {}", e.getMessage()); } else { -// LogUtil.error(LogUtil.ErrorType.ERROR_BUSINESS, shortString, e.getMessage(), e); logWarn(e, shortString); } } @@ -48,7 +56,7 @@ public enum ReporterType { @Override public void executeAction(String profile, String title, Boolean sendDingTalk, Object[] args, String shortString, String invokeServerName, Throwable e, Boolean downgrade) { if (sendDingTalk) { - DingTalkUtils.sendDingTalk(profile, title, argsArrayToString(args),invokeServerName, e); + sendRivenDingTalk(profile, title, args, invokeServerName, e); } if (downgrade) { log.warn("ER: {}", e.getMessage()); @@ -76,4 +84,35 @@ public enum ReporterType { // LogUtil.error(LogUtil.ErrorType.ERROR_BUSINESS, shortString, throwable.getMessage(), throwable); // } } + + public void sendRivenDingTalk(String profile, String title, Object[] args, String invokeServerName, Throwable e) { + RivenDingTalkHelper rivenDingTalkHelper = SpringUtils.getBean(RivenDingTalkHelper.class); + String mdTitle = "Notice " + title + ", Env: " + profile; + String mdContent = "#### [" + profile + "]" + title + "\n" + + "> 时间: " + DateUtil.now() + "\n" + + "> 入参: " + JSONUtil.toJsonStr(argsArrayToString(args)) + "\n\n" + + "> ###### 异常信息: " + JSONUtil.toJsonStr(Objects.isNull(e.getCause()) ? e.getMessage() : + e.getCause().getMessage()) + " \n\n" + + "> ##### traceId: " + MDC.get(CTX_LOG_ID_MDC) + " \n" + + "> ##### 调用方服务名称:" + invokeServerName + " \n"; + String deadLetterStacktrace = getDeadLetterStacktrace(profile, argsArrayToString(args)); + mdContent = mdContent + (StringUtils.hasText(deadLetterStacktrace) ? "> ##### [点击查看异常明细](" + deadLetterStacktrace + ") \n" : ""); + + rivenDingTalkHelper.sendMarkdownMessage(mdTitle, mdContent, false, false); + } + + private static String getDeadLetterStacktrace(String profile, Object req) { + try { + JSONObject entries = JSONUtil.parseObj(req); + String jobId = entries.getStr("id"); + if (!StringUtils.hasText(jobId)) { + return ""; + } + return getEnvUrl(profile) + "/workflow-engine/web/v1/api/process/job/dead-letter/exception/stacktrace/byId?jobId=" + jobId; + } catch (Exception e) { + log.warn("构造查询错误堆栈地址异常", e); + return ""; + } + } + } diff --git a/workflow-engine-server/src/main/java/cn/axzo/workflow/server/controller/delegate/AbstractBpmnTaskAssigneeSelector.java b/workflow-engine-server/src/main/java/cn/axzo/workflow/server/controller/delegate/AbstractBpmnTaskAssigneeSelector.java index 682da5d49..eaad192e0 100644 --- a/workflow-engine-server/src/main/java/cn/axzo/workflow/server/controller/delegate/AbstractBpmnTaskAssigneeSelector.java +++ b/workflow-engine-server/src/main/java/cn/axzo/workflow/server/controller/delegate/AbstractBpmnTaskAssigneeSelector.java @@ -11,12 +11,13 @@ import cn.axzo.workflow.common.exception.WorkflowApproverCalcException; import cn.axzo.workflow.common.exception.WorkflowEngineException; import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskDelegateAssigner; import cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper; +import cn.axzo.workflow.core.common.utils.SpringContextUtils; import cn.axzo.workflow.core.conf.SupportRefreshProperties; import cn.axzo.workflow.core.deletage.BpmnTaskAssigneeSelector; import cn.axzo.workflow.core.deletage.approverscope.ApproverScopeDTO; import cn.axzo.workflow.core.deletage.approverscope.ApproverScopeProcessor; import cn.axzo.workflow.core.engine.model.NoticeFlowElement; -import cn.axzo.workflow.core.util.DingTalkUtils; +import cn.axzo.workflow.core.util.RivenDingTalkHelper; import cn.hutool.core.lang.Assert; import cn.hutool.http.HttpStatus; import cn.hutool.json.JSONUtil; @@ -64,6 +65,8 @@ public abstract class AbstractBpmnTaskAssigneeSelector implements BpmnTaskAssign protected FlowSupportApi flowSupportApi; @Resource protected SupportRefreshProperties refreshProperties; + @Resource + private RivenDingTalkHelper rivenDingTalkHelper; private ApplicationContext applicationContext; @Override @@ -136,12 +139,12 @@ public abstract class AbstractBpmnTaskAssigneeSelector implements BpmnTaskAssign JSONUtil.toJsonStr(result)); try { if (stopWatch.getTotalTimeSeconds() > refreshProperties.getApiTimeout() && Boolean.TRUE.equals(refreshProperties.getSendDingTalk())) { - DingTalkUtils.sendDingTalkForSlowUrl(applicationContext.getEnvironment() - .getProperty("spring.profiles.active"), - stopWatch.getTotalTimeSeconds(), - extInfo, - param, - result); + String title = "Notice 请求二方接口慢 URL, Env: " + refreshProperties.getProfile(); + String content = "#### [" + refreshProperties.getProfile() + "]请求二方接口过慢\n" + + "> 接口地址: " + extInfo + ",经过了" + stopWatch.getTotalTimeSeconds() + "秒\n\n" + + "> 请求参数: " + JSONUtil.toJsonStr(param) + "\n\n" + + "> ###### 结果: " + JSONUtil.toJsonStr(result) + " \n"; + rivenDingTalkHelper.sendMarkdownMessage(title, content, true, false); } } catch (Exception e) { // ignore @@ -170,12 +173,13 @@ public abstract class AbstractBpmnTaskAssigneeSelector implements BpmnTaskAssign JSONUtil.toJsonStr(result)); try { if (stopWatch.getTotalTimeSeconds() > refreshProperties.getApiTimeout() && Boolean.TRUE.equals(refreshProperties.getSendDingTalk())) { - DingTalkUtils.sendDingTalkForSlowUrl(applicationContext.getEnvironment() - .getProperty("spring.profiles.active"), - stopWatch.getTotalTimeSeconds(), - extInfo, - param, - result); + String title = "Notice 请求二方接口慢 URL, Env: " + refreshProperties.getProfile(); + String content = "#### [" + refreshProperties.getProfile() + "]请求二方接口过慢\n" + + "> 接口地址: " + extInfo + ",经过了" + stopWatch.getTotalTimeSeconds() + "秒\n\n" + + "> 请求参数: " + JSONUtil.toJsonStr(param) + "\n\n" + + "> ###### 结果: " + JSONUtil.toJsonStr(result) + " \n"; + + rivenDingTalkHelper.sendMarkdownMessage(title, content, true, false); } } catch (Exception e) { // ignore @@ -207,12 +211,14 @@ public abstract class AbstractBpmnTaskAssigneeSelector implements BpmnTaskAssign JSONUtil.toJsonStr(result)); try { if (stopWatch.getTotalTimeSeconds() > refreshProperties.getApiTimeout() && refreshProperties.getSendDingTalk()) { - DingTalkUtils.sendDingTalkForSlowUrl(context.getEnvironment() - .getProperty("spring.profiles.active"), - stopWatch.getTotalTimeSeconds(), - extInfo, - param, - result); + RivenDingTalkHelper rivenDingTalkHelper = SpringContextUtils.getBean(RivenDingTalkHelper.class); + + String title = "Notice 请求二方接口慢 URL, Env: " + refreshProperties.getProfile(); + String content = "#### [" + refreshProperties.getProfile() + "]请求二方接口过慢\n" + + "> 接口地址: " + extInfo + ",经过了" + stopWatch.getTotalTimeSeconds() + "秒\n\n" + + "> 请求参数: " + JSONUtil.toJsonStr(param) + "\n\n" + + "> ###### 结果: " + JSONUtil.toJsonStr(result) + " \n"; + rivenDingTalkHelper.sendMarkdownMessage(title, content, true, false); } } catch (Exception e) { // ignore diff --git a/workflow-engine-server/src/main/java/cn/axzo/workflow/server/controller/delegate/TransferToAdminTaskAssigneeSelector.java b/workflow-engine-server/src/main/java/cn/axzo/workflow/server/controller/delegate/TransferToAdminTaskAssigneeSelector.java index bdaba5815..6d41f88fd 100644 --- a/workflow-engine-server/src/main/java/cn/axzo/workflow/server/controller/delegate/TransferToAdminTaskAssigneeSelector.java +++ b/workflow-engine-server/src/main/java/cn/axzo/workflow/server/controller/delegate/TransferToAdminTaskAssigneeSelector.java @@ -63,6 +63,7 @@ public class TransferToAdminTaskAssigneeSelector extends AbstractBpmnTaskAssigne protected List invokeService(FlowElement flowElement, DelegateExecution execution, ApproverScopeDTO scopeDto) { + log.info("transferToAdmin invokeService executing..."); if (Boolean.TRUE.equals(supportRefreshProperties.getUseNewToAdminApi())) { return invokeNewQuery(flowElement, execution, scopeDto); } else { @@ -72,6 +73,7 @@ public class TransferToAdminTaskAssigneeSelector extends AbstractBpmnTaskAssigne } private List invokeOldQuery(FlowElement flowElement, DelegateExecution execution, ApproverScopeDTO scopeDto) { + log.info("transferToAdmin invokeOldQuery executing..."); ListFlowTaskAssignerReq.ListFlowTaskAssignerReqBuilder builder = ListFlowTaskAssignerReq.builder(); if (!CollectionUtils.isEmpty(scopeDto.getOrgScopes())) { builder.orgScopes(ListUtils.emptyIfNull(scopeDto.getOrgScopes()).stream() @@ -106,6 +108,7 @@ public class TransferToAdminTaskAssigneeSelector extends AbstractBpmnTaskAssigne } private List invokeNewQuery(FlowElement flowElement, DelegateExecution execution, ApproverScopeDTO scopeDto) { + log.info("transferToAdmin invokeNewQuery executing..."); Optional approverScope = BpmnMetaParserHelper.getApproverScope((UserTask) flowElement); Optional optSpecify = BpmnMetaParserHelper.getApproverSpecify((UserTask) flowElement); // 如果是项目部,且审批人指定的配法不是岗位或角色,则默认直接返回空集合,走转交管理员后为空的最终兜底逻辑 diff --git a/workflow-engine-server/src/main/java/cn/axzo/workflow/server/controller/web/manage/FunctionController.java b/workflow-engine-server/src/main/java/cn/axzo/workflow/server/controller/web/manage/FunctionController.java index d6cb3a36a..609a008e4 100644 --- a/workflow-engine-server/src/main/java/cn/axzo/workflow/server/controller/web/manage/FunctionController.java +++ b/workflow-engine-server/src/main/java/cn/axzo/workflow/server/controller/web/manage/FunctionController.java @@ -1,10 +1,12 @@ package cn.axzo.workflow.server.controller.web.manage; +import cn.axzo.framework.jackson.utility.JSON; import cn.axzo.workflow.client.feign.manage.FunctionApi; import cn.axzo.workflow.common.enums.AdminDataSource; import cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum; +import cn.axzo.workflow.common.model.dto.CommonDingTalkDTO; import cn.axzo.workflow.common.model.request.feature.DingTalkStarterAlterDTO; -import cn.axzo.workflow.server.alter.DingTalkAlter; +import cn.axzo.workflow.core.util.RivenDingTalkHelper; import cn.axzo.workflow.server.common.annotation.ErrorReporter; import cn.azxo.framework.common.model.CommonResponse; import io.swagger.v3.oas.annotations.Operation; @@ -31,7 +33,7 @@ import javax.annotation.Resource; @Validated public class FunctionController implements FunctionApi { @Resource - private DingTalkAlter dingTalkAlter; + private RivenDingTalkHelper rivenDingTalkHelper; /** * 获取指定枚举类型的枚举值信息 @@ -57,7 +59,22 @@ public class FunctionController implements FunctionApi { @PostMapping("/dingtalk/alter") @Override public CommonResponse sendDingtalk(@Validated @RequestBody DingTalkStarterAlterDTO dto) { - dingTalkAlter.invoke(dto); + log.info("send dingtalk alter, request: {}", JSON.toJSONString(dto)); + String title = "Notice 应用必接广播 MQ 事件告警, Env: " + dto.getProfile(); + String content = "#### [" + dto.getProfile() + "]应用必接广播 MQ 事件告警\n" + + "> 应用名称:" + dto.getApplicationName() + "\n\n" + + "> 检测信息:" + dto.getAlterContent() + "\n\n"; + + rivenDingTalkHelper.sendMarkdownMessage(title, content, true, false); + return CommonResponse.success(true); + } + + @Operation(summary = "发送通用钉钉消息") + @PostMapping("/common/dingtalk/send") + @Override + public CommonResponse sendCommonDingtalk(@Validated @RequestBody CommonDingTalkDTO dto) { + log.info("send common dingtalk msg : {}", JSON.toJSONString(dto)); + rivenDingTalkHelper.sendMarkdownMessage(dto.getTitle(), dto.getContext(), true, dto.getAt(), dto.getMobiles()); return CommonResponse.success(true); } } diff --git a/workflow-engine-server/src/main/java/cn/axzo/workflow/server/xxljob/NodeAlterJobHandler.java b/workflow-engine-server/src/main/java/cn/axzo/workflow/server/xxljob/NodeAlterJobHandler.java index 8b30ea034..0f5dca8ce 100644 --- a/workflow-engine-server/src/main/java/cn/axzo/workflow/server/xxljob/NodeAlterJobHandler.java +++ b/workflow-engine-server/src/main/java/cn/axzo/workflow/server/xxljob/NodeAlterJobHandler.java @@ -3,7 +3,6 @@ package cn.axzo.workflow.server.xxljob; import cn.axzo.basics.common.util.NumberUtil; import cn.axzo.framework.jackson.utility.JSON; import cn.axzo.infra.xxl220to250.IJobHandler; -import cn.axzo.workflow.common.model.dto.AlterDTO; import cn.axzo.workflow.common.model.response.category.CategoryItemVO; import cn.axzo.workflow.core.common.utils.SpringContextUtils; import cn.axzo.workflow.core.conf.SupportRefreshProperties; @@ -11,7 +10,10 @@ import cn.axzo.workflow.core.listener.Alter; import cn.axzo.workflow.core.repository.entity.ExtAxNodeAlterJob; import cn.axzo.workflow.core.service.CategoryService; import cn.axzo.workflow.core.service.ExtAxNodeAlterJobService; +import cn.axzo.workflow.core.util.RivenDingTalkHelper; import cn.hutool.core.date.DateUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.context.XxlJobHelper; @@ -36,6 +38,7 @@ import java.util.Optional; import java.util.stream.Collectors; import static cn.axzo.workflow.common.constant.BpmnConstants.BPM_MODEL_CATEGORY; +import static cn.axzo.workflow.core.util.RivenDingTalkHelper.getWebUrl; /** * 调度业务节点告警定时任务 @@ -52,6 +55,7 @@ public class NodeAlterJobHandler extends IJobHandler { private final CategoryService categoryService; private final SpringProcessEngineConfiguration processEngineConfiguration; private final SupportRefreshProperties refreshProperties; + private final RivenDingTalkHelper rivenDingTalkHelper; @XxlJob("nodeAlterJobHandler") @Override @@ -109,17 +113,20 @@ public class NodeAlterJobHandler extends IJobHandler { private void sendAlter(ProcessInstance processInstance, Optional category, ExtAxNodeAlterJob job, Task task) { // 发送告警对象 Alter alter = SpringContextUtils.getBean(Alter.class); - AlterDTO alterDTO = new AlterDTO(); - alterDTO.setProcessDefinitionKey(processInstance.getProcessDefinitionKey()); - alterDTO.setProcessDefinitionName(category.orElse(new CategoryItemVO()).getLabel()); - alterDTO.setProcessInstanceId(job.getProcessInstanceId()); - alterDTO.setActivityId(job.getActivityId()); - alterDTO.setTaskId(task.getId()); - alterDTO.setStartTime(task.getCreateTime()); - alterDTO.setPrettyStartTime(DateUtil.formatDateTime(task.getCreateTime())); - if (Boolean.TRUE.equals(refreshProperties.getAlterSendDingTalk())) { - alter.invoke(alterDTO); - } + JSONObject jsonObject = new JSONObject(); + jsonObject.set("processInstanceId", job.getProcessInstanceId()); + jsonObject.set("activityId", job.getActivityId()); + jsonObject.set("taskId", task.getId()); + jsonObject.set("startTime", task.getCreateTime()); + jsonObject.set("prettyStartTime", DateUtil.formatDateTime(task.getCreateTime())); + String text = "Notice 业务节点长时间停止告警, Env: " + refreshProperties.getProfile(); + String content = "#### [" + refreshProperties.getProfile() + "]业务节点长时间停止\n" + + "> 审批业务: " + category.orElse(new CategoryItemVO()).getLabel() + "(" + processInstance.getProcessDefinitionKey() + ")" + "\n\n" + + "> 节点相关信息: " + JSONUtil.toJsonStr(jsonObject) + "\n\n" + + "> ##### [点击查看审批日志](" + getWebUrl(refreshProperties.getProfile()) + "/#/workflow/examples?processInstanceId=" + job.getProcessInstanceId() + ") \n\n" + + "> ##### 提示:如果以上地址提示未登录,请在对应环境 OMS 系统登录后并点击审批管理的功能后,再使用。或者复制实例 ID 到 OMS 中手动查询 \n\n"; + + rivenDingTalkHelper.sendMarkdownMessage(text, content, true, true); } private Boolean hasAssignee(String assignee) { diff --git a/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/WorkflowEngineStarterAutoConfiguration.java b/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/WorkflowEngineStarterAutoConfiguration.java index a6d51969b..a86878d89 100644 --- a/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/WorkflowEngineStarterAutoConfiguration.java +++ b/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/WorkflowEngineStarterAutoConfiguration.java @@ -163,8 +163,9 @@ public class WorkflowEngineStarterAutoConfiguration { ObjectProvider broadcastDLQProcessorObjectProvider, ObjectProvider rpcDLQProcessorObjectProvider, WorkflowEngineStarterProperties workflowEngineStarterProperties, + WorkflowCoreService workflowCoreService, Environment environment) { - return new WorkflowEngineStarterDefaultMQMonitor(mqAdminExtObjectProvider, broadcastDLQProcessorObjectProvider, rpcDLQProcessorObjectProvider, workflowEngineStarterProperties, environment); + return new WorkflowEngineStarterDefaultMQMonitor(mqAdminExtObjectProvider, broadcastDLQProcessorObjectProvider, rpcDLQProcessorObjectProvider, workflowEngineStarterProperties, workflowCoreService, environment); } @Bean diff --git a/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/api/WorkflowCoreService.java b/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/api/WorkflowCoreService.java index 5bba3119e..c69836d94 100644 --- a/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/api/WorkflowCoreService.java +++ b/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/api/WorkflowCoreService.java @@ -1,12 +1,16 @@ package cn.axzo.workflow.starter.api; import cn.axzo.workflow.common.annotation.InvokeMode; +import cn.axzo.workflow.common.model.dto.CommonDingTalkDTO; import cn.axzo.workflow.common.model.dto.SignFileDTO; import cn.axzo.workflow.common.model.dto.SimpleDocDTO; import cn.axzo.workflow.common.model.dto.print.PrintFieldDTO; import cn.axzo.workflow.common.model.request.bpmn.activity.BpmnActivityTimeoutCallbackDTO; import cn.axzo.workflow.common.model.request.bpmn.activity.BpmnActivityTimeoutTriggerDTO; +import cn.axzo.workflow.common.model.request.bpmn.model.doc.DocQueryDTO; +import cn.axzo.workflow.common.model.request.bpmn.print.PrintProcessLogPdfDTO; import cn.axzo.workflow.common.model.request.bpmn.print.PrintTemplateConfigUpsertDTO; +import cn.axzo.workflow.common.model.request.bpmn.print.QueryProcessLogPdfDTO; import cn.axzo.workflow.common.model.request.bpmn.process.BeforeProcessInstanceCreateDTO; import cn.axzo.workflow.common.model.request.bpmn.process.BpmnProcessInstanceAbortDTO; import cn.axzo.workflow.common.model.request.bpmn.process.BpmnProcessInstanceBatchQueryDTO; @@ -22,6 +26,7 @@ import cn.axzo.workflow.common.model.request.bpmn.process.doc.ChangeApproverRead import cn.axzo.workflow.common.model.request.bpmn.process.doc.ProcessDocQueryDTO; import cn.axzo.workflow.common.model.request.bpmn.task.BpmnActivitySetAssigneeDTO; import cn.axzo.workflow.common.model.request.bpmn.task.BpmnActivityTriggerDTO; +import cn.axzo.workflow.common.model.request.bpmn.task.BpmnNodeBackSystemOperateDTO; import cn.axzo.workflow.common.model.request.bpmn.task.BpmnOptionalNodeDTO; import cn.axzo.workflow.common.model.request.bpmn.task.BpmnRobotTaskCompleteDTO; import cn.axzo.workflow.common.model.request.bpmn.task.BpmnRobotTaskCreateDTO; @@ -35,12 +40,14 @@ import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskRemindDTO; import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskResetApproversDTO; import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskTransferDTO; import cn.axzo.workflow.common.model.request.feature.DingTalkStarterAlterDTO; +import cn.axzo.workflow.common.model.request.form.ConditionPermissionMetaInfo; import cn.axzo.workflow.common.model.request.form.definition.StartFormSearchDTO; import cn.axzo.workflow.common.model.request.form.instance.FormDetailDTO; import cn.axzo.workflow.common.model.request.form.instance.FormVariablesUpdateDTO; import cn.axzo.workflow.common.model.request.form.instance.FromDataSearchDTO; import cn.axzo.workflow.common.model.request.form.model.WpsFileConfigVariableDTO; import cn.axzo.workflow.common.model.response.bpmn.BatchOperationResultVO; +import cn.axzo.workflow.common.model.response.bpmn.model.doc.DocBaseVO; import cn.axzo.workflow.common.model.response.bpmn.process.BpmnProcessInstanceLogVO; import cn.axzo.workflow.common.model.response.bpmn.process.BpmnProcessInstanceVO; import cn.axzo.workflow.common.model.response.bpmn.process.NodesByModelVO; @@ -49,6 +56,7 @@ import cn.axzo.workflow.common.model.response.bpmn.task.BpmnTaskButtonVo; import cn.axzo.workflow.common.model.response.form.definition.FormDefinitionVO; import cn.axzo.workflow.common.model.response.form.instance.FormDataVO; import cn.axzo.workflow.common.model.response.form.instance.FormInstanceVO; +import cn.axzo.workflow.common.model.response.print.ProcessLogPdfResultDTO; import cn.axzo.workflow.common.util.ThreadUtil; import cn.axzo.workflow.starter.feign.ext.WorkflowEngineStarterFeignConfiguration; import io.swagger.v3.oas.annotations.Operation; @@ -99,6 +107,30 @@ public interface WorkflowCoreService { @InvokeMode(SYNC) Void printTemplateConfig(@Validated @RequestBody PrintTemplateConfigUpsertDTO dto); + /** + * 后端请求指定流程日志 PDF 文件生成, 实现是异步的。 + *

+ * 请使用 {@link PrintAdminApi#queryProcessLogPdfResult(QueryProcessLogPdfDTO)} 函数查询, + * 或者使用 {@link cn.axzo.nanopart.doc.api.conversion.DocConversionApi#queryConvertResultByBiz(cn.axzo.nanopart.doc.api.conversion.req.QueryConversionTaskRequestV2)} 函数查询,该接口入参默认情况下应该为:bizCode:固定为"workflow-process-log", bizKey:为实例 ID+":"+访问人 personId + * + * @return + */ + @Operation(summary = "后端请求指定流程日志 PDF 文件生成") + @PostMapping("/api/print/admin/process/log/pdf") + @InvokeMode(SYNC) + String createProcessLogPdf(@Validated @RequestBody PrintProcessLogPdfDTO dto); + + /** + * 后端查询指定审批日志 PDF 文件的生成结果 + * + * @param dto + * @return + */ + @Operation(summary = "后端查询指定审批日志 PDF 文件的生成结果") + @PostMapping("/api/print/admin/process/log/pdf/result") + @InvokeMode(SYNC) + ProcessLogPdfResultDTO queryProcessLogPdfResult(@Validated @RequestBody QueryProcessLogPdfDTO dto); + /** * 业务节点唤醒 * @@ -155,6 +187,11 @@ public interface WorkflowCoreService { @InvokeMode(SYNC) Boolean sendDingtalk(@Validated @RequestBody DingTalkStarterAlterDTO dto); + @Operation(summary = "发送通用钉钉消息") + @PostMapping("/api/function/common/dingtalk/send") + @InvokeMode(SYNC) + Boolean sendCommonDingtalk(@Validated @RequestBody CommonDingTalkDTO dto); + /** * 获取指定审批业务的流程表单设置, * @@ -401,6 +438,28 @@ public interface WorkflowCoreService { @InvokeMode(SYNC) List getProcessInstanceFinalDocs(@NotBlank(message = "流程实例 ID 不能为空") @RequestParam(required = false) String processInstanceId); + /** + * 获取流程实例的条件字段信息,仅用于同意抽屉展示 + * + * @param processInstanceId + * @return + */ + @Operation(summary = "获取流程实例的条件字段信息, 仅用于同意抽屉展示") + @GetMapping("/api/process/instance/conditions") + @InvokeMode(SYNC) + List getConditions(@NotBlank(message = "流程实例 ID 不能为空") @RequestParam String processInstanceId); + + /** + * 获取指定模板的原始文档列表 + * + * @param dto + * @return + */ + @Operation(summary = "根据业务 ID 获取模型文档列表,自动适配公共模板和代运营") + @PostMapping(value = "/api/process/model/doc/list") + @InvokeMode(SYNC) + List docList(@Validated @RequestBody DocQueryDTO dto); + /** * 同意 * @@ -461,6 +520,17 @@ public interface WorkflowCoreService { @InvokeMode(ASYNC) Boolean backTask(@Validated @RequestBody BpmnTaskBackAuditDTO dto); + /** + * 用于系统内部操作,跳转到指定节点 + * + * @param dto 请求参数 + * @return 是否成功 + */ + @Operation(summary = "系统操作回退任务到指定节点") + @PostMapping("/api/process/task/system/back") + @InvokeMode(ASYNC) + Boolean systemBackTask(@Validated @RequestBody BpmnNodeBackSystemOperateDTO dto); + /** * 驳回 * diff --git a/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/api/WorkflowManageService.java b/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/api/WorkflowManageService.java index fc13dd518..a45992542 100644 --- a/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/api/WorkflowManageService.java +++ b/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/api/WorkflowManageService.java @@ -18,12 +18,12 @@ import cn.axzo.workflow.common.model.request.bpmn.model.BpmnModelUpdateDTO; import cn.axzo.workflow.common.model.request.bpmn.model.doc.DocByIdDTO; import cn.axzo.workflow.common.model.request.bpmn.model.doc.DocCreateDTO; import cn.axzo.workflow.common.model.request.bpmn.model.doc.DocOrderDTO; -import cn.axzo.workflow.common.model.request.bpmn.model.doc.DocQueryDTO; import cn.axzo.workflow.common.model.request.bpmn.model.doc.DocResetDTO; import cn.axzo.workflow.common.model.request.bpmn.model.doc.DocSearchDTO; import cn.axzo.workflow.common.model.request.bpmn.model.doc.DocStatusDTO; import cn.axzo.workflow.common.model.request.bpmn.model.doc.DocTenantQueryDTO; import cn.axzo.workflow.common.model.request.bpmn.model.doc.DocUpdateDTO; +import cn.axzo.workflow.common.model.request.bpmn.print.Print4ProcessLogDTO; import cn.axzo.workflow.common.model.request.bpmn.print.PrintFieldQueryDTO; import cn.axzo.workflow.common.model.request.bpmn.print.PrintTemplateConfigQueryDTO; import cn.axzo.workflow.common.model.request.bpmn.print.RestPrintTemplateConfigDTO; @@ -31,7 +31,6 @@ import cn.axzo.workflow.common.model.request.bpmn.process.BpmnProcessDefinitionP import cn.axzo.workflow.common.model.request.bpmn.process.BpmnProcessInstanceAdminPageReqVO; import cn.axzo.workflow.common.model.request.bpmn.process.BpmnProcessInstanceMyPageReqVO; import cn.axzo.workflow.common.model.request.bpmn.process.SuperBpmnProcessInstanceCancelDTO; -import cn.axzo.workflow.common.model.request.bpmn.task.BpmnNodeBackSystemOperateDTO; import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskAttachmentDTO; import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskPageSearchDTO; import cn.axzo.workflow.common.model.request.category.CategoryConfigCreateDTO; @@ -52,6 +51,7 @@ import cn.axzo.workflow.common.model.response.bpmn.process.BpmnProcessDefinition import cn.axzo.workflow.common.model.response.bpmn.process.BpmnProcessInstanceAdminPageItemVO; import cn.axzo.workflow.common.model.response.bpmn.process.BpmnProcessInstancePageItemVO; import cn.axzo.workflow.common.model.response.bpmn.process.ExtProcessLogVO; +import cn.axzo.workflow.common.model.response.bpmn.process.PrintData4LogVO; import cn.axzo.workflow.common.model.response.bpmn.process.ProcessNodeDetailVO; import cn.axzo.workflow.common.model.response.bpmn.task.BpmnHistoricTaskInstanceGroupVO; import cn.axzo.workflow.common.model.response.bpmn.task.BpmnHistoricTaskInstanceVO; @@ -114,7 +114,7 @@ public interface WorkflowManageService { * 获取指定流程下用于替换打印的相关变量 * * @param processInstanceId - * @return + * @return 仅是 kv 集合, */ @Operation(summary = "获取指定流程下用于替换打印的相关变量") @GetMapping("/api/print/admin/field/variables") @@ -122,6 +122,18 @@ public interface WorkflowManageService { @InvokeMode(SYNC) Map getPrintFieldVariables(@NotBlank(message = "流程实例不能为空") @RequestParam String processInstanceId, @RequestParam(required = false, defaultValue = "true") Boolean throwException); + /** + * 获取用于打印审批日志公共模板的数据 + * + * @param dto + * @return + */ + @Operation(summary = "获取用于打印审批日志公共模板的数据") + @PostMapping("/api/print/admin/process/log/data/v2") + @Manageable + @InvokeMode(SYNC) + PrintData4LogVO getPrintDataForProcessLog(@Validated @RequestBody Print4ProcessLogDTO dto); + /** * 查询管理员 * @param dto 管理员数据 @@ -522,6 +534,7 @@ public interface WorkflowManageService { */ @Operation(summary = "流程模型列表") @GetMapping("/api/process/model/page") + @Manageable @InvokeMode(SYNC) BpmPageResult page(@Validated @RequestBody BpmnModelSearchDTO dto); @@ -531,6 +544,7 @@ public interface WorkflowManageService { */ @Operation(summary = "创建流程模型") @PostMapping("/api/process/model/create") + @Manageable @InvokeMode(SYNC) String create(@Validated @RequestBody BpmnModelCreateDTO dto); @@ -539,6 +553,7 @@ public interface WorkflowManageService { */ @Operation(summary = "通过模型ID查询指定流程模型") @GetMapping("/api/process/model/get") + @Manageable @InvokeMode(SYNC) BpmnModelDetailVO getById(@NotBlank(message = "流程模型 ID 不能为空") @RequestParam(required = false) String processModelId, @RequestParam(required = false) String tenantId); @@ -547,6 +562,7 @@ public interface WorkflowManageService { */ @Operation(summary = "通过模型KEY查询指定流程模型") @GetMapping("/api/process/model/getByKey") + @Manageable @InvokeMode(SYNC) BpmnModelDetailVO getByKey(@NotBlank(message = "流程模型 KEY 不能为空") @RequestParam(required = false) String processModelKey, @NotBlank(message = "租户不能为空") @RequestParam(required = false) String tenantId); @@ -559,6 +575,7 @@ public interface WorkflowManageService { */ @Operation(summary = "获取指定模型的扩展属性") @GetMapping("/api/process/model/ext") + @Manageable @InvokeMode(SYNC) BpmnModelExtVO getModelExt(@NotBlank(message = "模型 ID 不能为空") @RequestParam(required = false) String modelId); @@ -567,6 +584,7 @@ public interface WorkflowManageService { */ @Operation(summary = "更新流程模型") @PutMapping("/api/process/model/update") + @Manageable @InvokeMode(SYNC) String update(@RequestBody BpmnModelUpdateDTO dto); @@ -577,6 +595,7 @@ public interface WorkflowManageService { */ @Operation(summary = "通过模型 ID 部署流程模型") @PostMapping("/api/process/model/deploy") + @Manageable @InvokeMode(SYNC) String deployById(@NotBlank(message = "流程模型 ID 不能为空") @RequestParam(required = false) String processModelId, @RequestParam(required = false, defaultValue = "") String modelTenantId, @RequestParam(required = false) String operator); @@ -587,6 +606,7 @@ public interface WorkflowManageService { */ @Operation(summary = "通过模型 KEY 部署流程模型") @PostMapping("/api/process/model/deployByKey") + @Manageable @InvokeMode(SYNC) String deployByKey(@NotBlank(message = "流程模型 KEY 不能为空") @RequestParam(required = false) String processModelKey, @NotBlank(message = "租户不能为空") @RequestParam(required = false) String modelTenantId, @RequestParam(required = false) String operator); @@ -600,6 +620,7 @@ public interface WorkflowManageService { */ @Operation(summary = "通过模型 ID 取消部署流程模型") @PostMapping("/api/process/model/undeploy") + @Manageable @InvokeMode(SYNC) Void unDeployById(@NotBlank(message = "流程模型 ID 不能为空") @RequestParam(required = false) String processModelId, @RequestParam(required = false, defaultValue = "") String tenantId, @RequestParam(required = false) String operator); @@ -608,6 +629,7 @@ public interface WorkflowManageService { */ @Operation(summary = "删除指定模型 ID 的流程模型") @DeleteMapping("/api/process/model/delete") + @Manageable @InvokeMode(SYNC) Void deleteById(@NotBlank(message = "流程模型 ID 不能为空") @RequestParam String processModelId, @RequestParam(required = false, defaultValue = "") String tenantId); @@ -620,6 +642,7 @@ public interface WorkflowManageService { */ @Operation(summary = "删除指定模型 KEY 的流程模型") @DeleteMapping("/api/process/model/deleteByKey") + @Manageable @InvokeMode(SYNC) Void deleteByKey(@NotBlank(message = "流程模型 KEY 不能为空") @RequestParam String processModelKey, @RequestParam(required = false, defaultValue = "") String tenantId); @@ -633,6 +656,7 @@ public interface WorkflowManageService { */ @Operation(summary = "修改模型状态") @PostMapping("/api/process/model/changeStatus") + @Manageable @InvokeMode(SYNC) Boolean changeStatus(@NotBlank(message = "模型 ID 不能为空") @RequestParam String modelId, @NotNull(message = "状态不能为空") @RequestParam Integer status, @RequestParam(required = false) String operator); @@ -646,6 +670,7 @@ public interface WorkflowManageService { */ @Operation(summary = "修改模型打印开关状态") @PostMapping("/api/process/model/print/changeStatus") + @Manageable @InvokeMode(SYNC) Boolean changePrintStatus(@NotBlank(message = "模型 ID 不能为空") @RequestParam String modelId, @NotNull(message = "状态不能为空") @RequestParam Integer status, @RequestParam(required = false) String operator); @@ -656,6 +681,7 @@ public interface WorkflowManageService { */ @Operation(summary = "查询流程模型使用的分类列表") @GetMapping("/api/process/model/category/ids") + @Manageable @InvokeMode(SYNC) List getModelCategoryList(); @@ -666,6 +692,7 @@ public interface WorkflowManageService { */ @Operation(summary = "查询模型的租户集合") @GetMapping("/api/process/model/tenant/ids") + @Manageable @InvokeMode(SYNC) List getModelTenantIds(); @@ -677,6 +704,7 @@ public interface WorkflowManageService { */ @Operation(summary = "获取打印模板配置内容") @PostMapping("/api/process/model/print/template/config/query") + @Manageable @InvokeMode(SYNC) PrintModelDTO getPrintTemplateConfig(@Validated @RequestBody PrintTemplateConfigQueryDTO dto); @@ -688,6 +716,7 @@ public interface WorkflowManageService { */ @Operation(summary = "代运营重置打印模板") @PostMapping(value = "/api/process/model/print/template/config/reset") + @Manageable @InvokeMode(SYNC) Boolean resetPrintTemplateConfig(@Validated @RequestBody RestPrintTemplateConfigDTO dto); @@ -699,6 +728,7 @@ public interface WorkflowManageService { */ @Operation(summary = "搜索文档列表") @PostMapping(value = "/api/process/model/doc/page") + @Manageable @InvokeMode(SYNC) BpmPageResult docPage(@Validated @RequestBody DocSearchDTO dto); @@ -709,20 +739,10 @@ public interface WorkflowManageService { */ @Operation(summary = "获取指定 docIds 文档列表") @PostMapping(value = "/api/process/model/doc/ids") + @Manageable @InvokeMode(SYNC) List docByIds(@Validated @RequestBody DocByIdDTO dto); - /** - * 获取指定模板的原始文档列表 - * - * @param dto - * @return - */ - @Operation(summary = "根据业务 ID 获取模型文档列表,自动适配公共模板和代运营") - @PostMapping(value = "/api/process/model/doc/list") - @InvokeMode(SYNC) - List docList(@Validated @RequestBody DocQueryDTO dto); - /** * 获取关联 HiPrint 类型文档模板内容 * @@ -731,6 +751,7 @@ public interface WorkflowManageService { */ @Operation(summary = "获取关联 HiPrint 类型文档模板内容") @PostMapping(value = "/api/process/model/hi-print/content/get") + @Manageable @InvokeMode(SYNC) String getHiPrintContent(@RequestParam String fileRelationId); @@ -741,6 +762,7 @@ public interface WorkflowManageService { */ @Operation(summary = "添加关联文档") @PutMapping(value = "/api/process/model/doc/create") + @Manageable @InvokeMode(SYNC) Boolean createDoc(@Validated @RequestBody DocCreateDTO dto); @@ -751,6 +773,7 @@ public interface WorkflowManageService { */ @Operation(summary = "修改关联文档") @PostMapping(value = "/api/process/model/doc/update") + @Manageable @InvokeMode(SYNC) Boolean updateDoc(@Validated @RequestBody DocUpdateDTO dto); @@ -762,6 +785,7 @@ public interface WorkflowManageService { */ @Operation(summary = "克隆关联文档") @PostMapping(value = "/api/process/model/doc/clone") + @Manageable @InvokeMode(SYNC) Boolean cloneDoc(@RequestParam("id") Long docId); @@ -772,6 +796,7 @@ public interface WorkflowManageService { */ @Operation(summary = "删除指定文档") @DeleteMapping(value = "/api/process/model/doc/delete") + @Manageable @InvokeMode(SYNC) Boolean deleteDoc(@RequestParam("id") Long docId); @@ -783,6 +808,7 @@ public interface WorkflowManageService { */ @Operation(summary = "关联文档配置排序") @PostMapping(value = "/api/process/model/doc/order") + @Manageable @InvokeMode(SYNC) Boolean orderDoc(@Validated @RequestBody DocOrderDTO dto); @@ -794,6 +820,7 @@ public interface WorkflowManageService { */ @Operation(summary = "重置关联文档配置") @PostMapping(value = "/api/process/model/doc/reset") + @Manageable @InvokeMode(SYNC) Boolean resetDoc(@Validated @RequestBody DocResetDTO dto); @@ -805,6 +832,7 @@ public interface WorkflowManageService { */ @Operation(summary = "设置关联文档的停启用状态") @PostMapping(value = "/api/process/model/doc/status") + @Manageable @InvokeMode(SYNC) Boolean statusDoc(@Validated @RequestBody DocStatusDTO dto); @@ -815,6 +843,7 @@ public interface WorkflowManageService { */ @Operation(summary = "设置关联文档的必选状态") @PostMapping(value = "/api/process/model/doc/require") + @Manageable @InvokeMode(SYNC) Boolean requireDoc(@Validated @RequestBody DocStatusDTO dto); @@ -825,6 +854,7 @@ public interface WorkflowManageService { */ @Operation(summary = "特殊的查询设置过关联过文档的工作台 ID 集合") @PostMapping(value = "/api/process/model/has/docs/tenantId") + @Manageable @InvokeMode(SYNC) List hasFilesTenantIds(@Validated @RequestBody DocTenantQueryDTO dto); @@ -853,17 +883,6 @@ public interface WorkflowManageService { @InvokeMode(SYNC) Void deleteVariables(@PathVariable("executionId") String executionId, @RequestParam String variableNames, @RequestParam(value = "scope", required = false) String scope); - /** - * 用于系统内部操作,跳转到指定节点 - * - * @param dto 请求参数 - * @return 是否成功 - */ - @Operation(summary = "系统操作回退任务到指定节点") - @PostMapping("/api/process/task/system/back") - @Manageable - Boolean systemBackTask(@Validated @RequestBody BpmnNodeBackSystemOperateDTO dto); - /** * 添加附件 * diff --git a/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/mq/monitor/AlertBroadcastDLQReporter.java b/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/mq/monitor/AlertBroadcastDLQReporter.java index 97a7a24ae..ee1ebe42d 100644 --- a/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/mq/monitor/AlertBroadcastDLQReporter.java +++ b/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/mq/monitor/AlertBroadcastDLQReporter.java @@ -1,10 +1,8 @@ package cn.axzo.workflow.starter.mq.monitor; +import cn.axzo.workflow.common.model.dto.CommonDingTalkDTO; +import cn.axzo.workflow.starter.api.WorkflowCoreService; import cn.axzo.workflow.starter.handler.monitor.BroadcastDLQReporter; -import com.dingtalk.api.DefaultDingTalkClient; -import com.dingtalk.api.DingTalkClient; -import com.dingtalk.api.request.OapiRobotSendRequest; -import com.dingtalk.api.response.OapiRobotSendResponse; import lombok.SneakyThrows; import org.apache.rocketmq.common.admin.TopicOffset; import org.slf4j.Logger; @@ -20,13 +18,15 @@ import org.springframework.core.env.Environment; public class AlertBroadcastDLQReporter implements BroadcastDLQReporter { private static final Logger log = LoggerFactory.getLogger(AlertBroadcastDLQReporter.class); - private final String dingtalk_robot_webhook = "https://oapi.dingtalk.com/robot/send?access_token=341ee2907f3ebc15dc495fb7771a646230058710999fec7838066c109849878e"; + // private final String dingtalk_robot_webhook = "https://oapi.dingtalk.com/robot/send?access_token=341ee2907f3ebc15dc495fb7771a646230058710999fec7838066c109849878e"; private final String profile; private final String applicationName; + private final WorkflowCoreService workflowCoreService; - public AlertBroadcastDLQReporter(Environment environment) { + public AlertBroadcastDLQReporter(Environment environment, WorkflowCoreService workflowCoreService) { this.profile = environment.getProperty("spring.profiles.active"); this.applicationName = environment.getProperty("spring.application.name"); + this.workflowCoreService = workflowCoreService; } @Override @@ -40,22 +40,34 @@ public class AlertBroadcastDLQReporter implements BroadcastDLQReporter { @SneakyThrows public void sendDingTalk(Long count, String dlqName) { - DingTalkClient client = new DefaultDingTalkClient(dingtalk_robot_webhook); - OapiRobotSendRequest request = new OapiRobotSendRequest(); +// DingTalkClient client = new DefaultDingTalkClient(dingtalk_robot_webhook); +// OapiRobotSendRequest request = new OapiRobotSendRequest(); +// +// request.setMsgtype("markdown"); +// OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown(); +// markdown.setTitle("Notice Env: " + profile); +// markdown.setText("#### [" + profile + "]环境[" + applicationName + "]发现“DLQ”数据(Rpc)\n" + +// "> ###### 1. 如需查看详情,[请点击这里](" + findDomain() + "m) \n" + +// "> ###### 2. 如需调整 MQ DLQ 的监控状态: \n" + +// "> ###### 3. DLQ名称:" + dlqName + " \n" + +// "[关闭监控](" + findDomain() + "m/set?status=false) \n | " + +// "[开启监控](" + findDomain() + "m/set?status=true) \n" + +// "> 积累条数:" + count + " \n"); +// request.setMarkdown(markdown); +// log.warn(markdown.getText()); +// OapiRobotSendResponse response = client.execute(request); - request.setMsgtype("markdown"); - OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown(); - markdown.setTitle("Notice Env: " + profile); - markdown.setText("#### [" + profile + "]环境[" + applicationName + "]发现“DLQ”数据(Rpc)\n" + - "> ###### 1. 如需查看详情,[请点击这里](" + findDomain() + "m) \n" + - "> ###### 2. 如需调整 MQ DLQ 的监控状态: \n" + - "> ###### 3. DLQ名称:" + dlqName + " \n" + - "[关闭监控](" + findDomain() + "m/set?status=false) \n | " + - "[开启监控](" + findDomain() + "m/set?status=true) \n" + - "> 积累条数:" + count + " \n"); - request.setMarkdown(markdown); - log.warn(markdown.getText()); - OapiRobotSendResponse response = client.execute(request); + + workflowCoreService.sendCommonDingtalk(CommonDingTalkDTO.builder() + .title("Notice Env: " + profile) + .context("#### [" + profile + "]环境[" + applicationName + "]发现“DLQ”数据(Rpc)\n" + + "> ###### 1. 如需查看详情,[请点击这里](" + findDomain() + "m) \n" + + "> ###### 2. 如需调整 MQ DLQ 的监控状态: \n" + + "> ###### 3. DLQ名称:" + dlqName + " \n" + + "[关闭监控](" + findDomain() + "m/set?status=false) \n | " + + "[开启监控](" + findDomain() + "m/set?status=true) \n" + + "> 积累条数:" + count + " \n") + .build()); } private String findDomain() { diff --git a/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/mq/monitor/AlertRcpDLQReporter.java b/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/mq/monitor/AlertRcpDLQReporter.java index 3619f7f83..b52ca37cf 100644 --- a/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/mq/monitor/AlertRcpDLQReporter.java +++ b/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/mq/monitor/AlertRcpDLQReporter.java @@ -1,10 +1,8 @@ package cn.axzo.workflow.starter.mq.monitor; +import cn.axzo.workflow.common.model.dto.CommonDingTalkDTO; +import cn.axzo.workflow.starter.api.WorkflowCoreService; import cn.axzo.workflow.starter.handler.monitor.RpcDLQReporter; -import com.dingtalk.api.DefaultDingTalkClient; -import com.dingtalk.api.DingTalkClient; -import com.dingtalk.api.request.OapiRobotSendRequest; -import com.dingtalk.api.response.OapiRobotSendResponse; import lombok.SneakyThrows; import org.apache.rocketmq.common.admin.TopicOffset; import org.slf4j.Logger; @@ -20,13 +18,15 @@ import org.springframework.core.env.Environment; public class AlertRcpDLQReporter implements RpcDLQReporter { private static final Logger log = LoggerFactory.getLogger(AlertRcpDLQReporter.class); - private final String dingtalk_robot_webhook = "https://oapi.dingtalk.com/robot/send?access_token=341ee2907f3ebc15dc495fb7771a646230058710999fec7838066c109849878e"; + // private final String dingtalk_robot_webhook = "https://oapi.dingtalk.com/robot/send?access_token=341ee2907f3ebc15dc495fb7771a646230058710999fec7838066c109849878e"; private final String profile; private final String applicationName; + private final WorkflowCoreService workflowCoreService; - public AlertRcpDLQReporter(Environment environment) { + public AlertRcpDLQReporter(Environment environment, WorkflowCoreService workflowCoreService) { this.profile = environment.getProperty("spring.profiles.active"); this.applicationName = environment.getProperty("spring.application.name"); + this.workflowCoreService = workflowCoreService; } @Override @@ -40,22 +40,34 @@ public class AlertRcpDLQReporter implements RpcDLQReporter { @SneakyThrows public void sendDingTalk(Long count, String dlqName) { - DingTalkClient client = new DefaultDingTalkClient(dingtalk_robot_webhook); - OapiRobotSendRequest request = new OapiRobotSendRequest(); +// DingTalkClient client = new DefaultDingTalkClient(dingtalk_robot_webhook); +// OapiRobotSendRequest request = new OapiRobotSendRequest(); +// +// request.setMsgtype("markdown"); +// OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown(); +// markdown.setTitle("Notice Env: " + profile); +// markdown.setText("#### [" + profile + "]环境[" + applicationName + "]发现“DLQ”数据(Rpc)\n" + +// "> ###### 1. 如需查看详情,[请点击这里](" + findDomain() + "m) \n" + +// "> ###### 2. 如需调整 MQ DLQ 的监控状态: \n" + +// "> ###### 3. DLQ名称:" + dlqName + " \n" + +// "[关闭监控](" + findDomain() + "m/set?status=false) \n | " + +// "[开启监控](" + findDomain() + "m/set?status=true) \n" + +// "> 积累条数:" + count + " \n"); +// request.setMarkdown(markdown); +// log.warn(markdown.getText()); +// OapiRobotSendResponse response = client.execute(request); - request.setMsgtype("markdown"); - OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown(); - markdown.setTitle("Notice Env: " + profile); - markdown.setText("#### [" + profile + "]环境[" + applicationName + "]发现“DLQ”数据(Rpc)\n" + - "> ###### 1. 如需查看详情,[请点击这里](" + findDomain() + "m) \n" + - "> ###### 2. 如需调整 MQ DLQ 的监控状态: \n" + - "> ###### 3. DLQ名称:" + dlqName + " \n" + - "[关闭监控](" + findDomain() + "m/set?status=false) \n | " + - "[开启监控](" + findDomain() + "m/set?status=true) \n" + - "> 积累条数:" + count + " \n"); - request.setMarkdown(markdown); - log.warn(markdown.getText()); - OapiRobotSendResponse response = client.execute(request); + workflowCoreService.sendCommonDingtalk(CommonDingTalkDTO.builder() + .title("Notice Env: " + profile) + .context("#### [" + profile + "]环境[" + applicationName + "]发现“DLQ”数据(Rpc)\n" + + "> ###### 1. 如需查看详情,[请点击这里](" + findDomain() + "m) \n" + + "> ###### 2. 如需调整 MQ DLQ 的监控状态: \n" + + "> ###### 3. DLQ名称:" + dlqName + " \n" + + "[关闭监控](" + findDomain() + "m/set?status=false) \n | " + + "[开启监控](" + findDomain() + "m/set?status=true) \n" + + "> 积累条数:" + count + " \n") + .build() + ); } private String findDomain() { diff --git a/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/mq/monitor/WorkflowEngineStarterDefaultMQMonitor.java b/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/mq/monitor/WorkflowEngineStarterDefaultMQMonitor.java index e3d9d2c27..45b5fcb48 100644 --- a/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/mq/monitor/WorkflowEngineStarterDefaultMQMonitor.java +++ b/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/mq/monitor/WorkflowEngineStarterDefaultMQMonitor.java @@ -1,6 +1,7 @@ package cn.axzo.workflow.starter.mq.monitor; import cn.axzo.workflow.starter.WorkflowEngineStarterProperties; +import cn.axzo.workflow.starter.api.WorkflowCoreService; import cn.axzo.workflow.starter.handler.monitor.BroadcastDLQReporter; import cn.axzo.workflow.starter.handler.monitor.RpcDLQReporter; import lombok.SneakyThrows; @@ -50,12 +51,13 @@ public class WorkflowEngineStarterDefaultMQMonitor implements SmartLifecycle { ObjectProvider broadcastDLQProcessorObjectProvider, ObjectProvider rpcDLQProcessorObjectProvider, WorkflowEngineStarterProperties workflowEngineStarterProperties, + WorkflowCoreService workflowCoreService, Environment environment) { this.defaultMQAdminExt = mqAdminExtObjectProvider.getIfAvailable(); this.environment = environment; if (workflowEngineStarterProperties.getAlert()) { - this.broadcastDLQProcessor = new AlertBroadcastDLQReporter(environment); - this.rpcDLQProcessor = new AlertRcpDLQReporter(environment); + this.broadcastDLQProcessor = new AlertBroadcastDLQReporter(environment, workflowCoreService); + this.rpcDLQProcessor = new AlertRcpDLQReporter(environment, workflowCoreService); } else { this.broadcastDLQProcessor = broadcastDLQProcessorObjectProvider.getIfAvailable(() -> new BroadcastDLQReporter() { }); diff --git a/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/mq/monitor/console/WorkflowEngineStarterMQMonitorController.java b/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/mq/monitor/console/WorkflowEngineStarterMQMonitorController.java index eeb98074c..043d1489a 100644 --- a/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/mq/monitor/console/WorkflowEngineStarterMQMonitorController.java +++ b/workflow-engine-spring-boot-starter/src/main/java/cn/axzo/workflow/starter/mq/monitor/console/WorkflowEngineStarterMQMonitorController.java @@ -1,6 +1,7 @@ package cn.axzo.workflow.starter.mq.monitor.console; import cn.axzo.workflow.starter.WorkflowEngineStarterProperties; +import cn.axzo.workflow.starter.api.WorkflowCoreService; import cn.axzo.workflow.starter.handler.monitor.BroadcastDLQReporter; import cn.axzo.workflow.starter.handler.monitor.RpcDLQReporter; import cn.axzo.workflow.starter.mq.monitor.AlertBroadcastDLQReporter; @@ -59,6 +60,8 @@ public class WorkflowEngineStarterMQMonitorController { private String serviceVersion; public static String BROADCAST_CONSUMER_GROUP = "GID_%s_workflow_engine_%s_consumer"; public static String RPC_RETRY_CONSUMER_GROUP = "GID_%s_workflow_engine_starter_%s_consumer"; + @Resource + private WorkflowCoreService workflowCoreService; @GetMapping("/m") public CommonResponse> monitor() { @@ -137,8 +140,8 @@ public class WorkflowEngineStarterMQMonitorController { return CommonResponse.success("未开启·死信队列·的监控,如需,请设置 workflow.engine.starter.enableDlqMonitor = true 后再重试!"); } if (status) { - monitor.setBroadcastDLQProcessor(new AlertBroadcastDLQReporter(environment)); - monitor.setRpcDLQProcessor(new AlertRcpDLQReporter(environment)); + monitor.setBroadcastDLQProcessor(new AlertBroadcastDLQReporter(environment, workflowCoreService)); + monitor.setRpcDLQProcessor(new AlertRcpDLQReporter(environment, workflowCoreService)); return CommonResponse.success("开启 DLQ 钉钉通知"); } else { monitor.setBroadcastDLQProcessor(broadcastDLQProcessorObjectProvider.getIfAvailable(() -> new BroadcastDLQReporter() {