/*
 change.sql 说明
 1.数据库相关修改添加到对应的 change.sql 文件，无需调整其他 sql  文件
 2.sql 语句验证正确后再提交
*/
-- jjx 2022-4-13内部消息地址修改
UPDATE PORTAL_SYS_MSG_TPL SET PLAIN_ = '审批提醒，您有新的工作流需要审批：${taskSubject}。', HTML_ = '<p>审批提醒：<br/>您有新的工作流需要审批<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a></p>' WHERE ID_ = '13';

UPDATE  PORTAL_SYS_PROPERTIES SET VALUE = 'front' WHERE ID = '22';
UPDATE  PORTAL_SYS_PROPERTIES  SET VALUE = 'mobile' WHERE ID  = '23';

-- jjx 2022-4-14修改字段长度
alter table FORM_HISTORY_RECORD modify DIY_JS_ VARCHAR2(4000);
-- 2022-06-08 删除的消息模板：任务创建默认、任务完成默认、任务并行审批默认、撤销并行审批默认、撤销流转默认、任务驳回默认 update by ouyanggaolong
DELETE FROM portal_sys_msg_tpl where KEY_ in ('taskcreate-default', 'taskcomplete-default', 'bpmnTaskApproveLine-default', 'bpmnTaskApproveLineCancel-default', 'bpmtranscancel-default','taskback-default');

-- 2022-05-05 yijj 增加target_node_目标节点字段
alter table BPM_EXE_STACK_EXECUTOR
	add TARGET_NODE_ varchar2(64);
comment on column BPM_EXE_STACK_EXECUTOR.TARGET_NODE_ is '目标节点';


-- 2022-06-01 待办事项标题 存储字段长度不够，影响启动流程
alter table BPM_TASK modify SUBJECT_ VARCHAR2(256);
alter table BPM_PRO_INST modify SUBJECT_ VARCHAR2(256);


-- 2022-06-06 jjx 内部消息链接地址修改
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '任务创${instSubject}建通知', PLAIN_ = '任务创建：流程实例：${instSubject}，执行到${nodeName}', HTML_ = '<p>任务创建：流程实例<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${instSubject}</a>，执行到${nodeName}</p>' WHERE ID_ = '1';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '流程实例抄送', PLAIN_ = '流程实例抄送：流程${taskSubject}的${instId}实例，已经抄送给您。', HTML_ = '<p>流程实例抄送：流程<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?readId=${readId}&instId=${instId}&from=received&receivedStatus=COPYTO&isRead=0" target="_self">${taskSubject}</a>的${instId}实例，已经抄送给您。</p>' WHERE ID_ = '10';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '驳回提醒', PLAIN_ = '驳回提醒，您的：${taskSubject}，请求被驳回，请处理!', HTML_ = '<p>驳回提醒：<br/>您的<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a>请求被驳回，请处理!</p>'  WHERE ID_ = '14';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '流程人工终止结束通知', PLAIN_ = '流程实例人工终止结束通知：${instSubject}，意见:${cause}。', HTML_ = '<p>流程实例结束<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?instId=${instId}&type=request" target="_self">${taskSubject}</a>，意见:${cause}。</p>'  WHERE ID_ = '17';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '流程终止恢复通知', PLAIN_ = '流程实例终止恢复通知：${instSubject}，意见:${cause}。', HTML_ = '<p>流程实例已恢复运行中状态<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?instId=${instId}&type=request" target="_self">${instSubject}</a>，意见:${cause}。</p>'  WHERE ID_ = '20';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '设置任务执行人通知', PLAIN_ = '设置任务执行人：${taskSubject}，意见:${cause}。', HTML_ = '<p>设置任务执行人：<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a>，意见:${cause}。</p>'  WHERE ID_ = '21';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '任务转交通知', PLAIN_ = '任务转交：流程实例：${instSubject}的${nodeName}任务，已经转交给你办理。', HTML_ = '<p>任务转交：流程实例<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a>，需要你办理。</p>'  WHERE ID_ = '6';

-- 2022-06-08 liangjc删除 任务并行审批默认、撤销并行审批默认、任务驳回默认 配置
DELETE FROM	portal_sys_msg_tpl WHERE	ID_ IN (18,19,9);
-- 2022-06-08 删除的消息模板：任务创建默认、任务完成默认、任务并行审批默认、撤销并行审批默认、撤销流转默认、任务驳回默认  update by ouyanggaolong
DELETE FROM portal_sys_msg_tpl where KEY_ in ('taskcreate-default', 'taskcomplete-default', 'bpmnTaskApproveLine-default', 'bpmnTaskApproveLineCancel-default', 'bpmtranscancel-default','taskback-default');

-- 2022-06-10 jjx 内部消息链接地址和提示内容修改
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '流程实例抄送', PLAIN_ = '流程实例抄送：流程${taskSubject}的${instId}实例，已经抄送给您。', HTML_ = '<p>流程实例抄送：</p><p>流程<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?readId=${readId}&instId=${instId}&from=received&receivedStatus=COPYTO&isRead=0" target="_self">${taskSubject}</a>的${instId}实例，已经抄送给您</p>' WHERE ID_ = '10';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '流程结束通知', PLAIN_ = '流程实例结束：${instSubject}，意见:${cause}。', HTML_ = '<p>流程实例结束</p><p>${instSubject}，意见:${cause}</p>' WHERE ID_ = '11';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '审批提醒', PLAIN_ = '审批提醒，您有新的工作流需要审批：${taskSubject}。', HTML_ = '<p>审批提醒：<br/>您有新的工作流需要审批<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a></p>' WHERE ID_ = '13';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '驳回提醒', PLAIN_ = '驳回提醒，您的：${taskSubject}，请求被驳回，请处理!', HTML_ = '<p>驳回提醒：<br/>您的<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a>请求被驳回，请处理!</p>' WHERE ID_ = '14';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '撤销提醒', PLAIN_ = '撤销提醒，审批任务${taskSubject}被撤销，撤销原因${cause} 原因通过cmd获取。', HTML_ = '<p>撤销提醒：<br/>审批任务${taskSubject}被撤销，撤销原因${cause}</p>' WHERE ID_ = '15';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '代理任务审批', PLAIN_ = '代理任务审批，您有新的代理任务需要审批：${taskSubject}，委托人${delegate}.', HTML_ = '<p>代理任务审批：<br/>您有新的代理任务需要审批<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a>，委托人${delegate}</p>' WHERE ID_ = '16';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '流程人工终止结束通知', PLAIN_ = '流程实例人工终止结束通知：${instSubject}，意见:${cause}。', HTML_ = '<p>人工终止结束通知:</p><p>流程实例结束<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?instId=${instId}&type=request" target="_self">${taskSubject}</a>，意见:${cause}</p>' WHERE ID_ = '17';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '任务沟通', PLAIN_ = '任务沟通提醒，${receiver}您好,任务：${taskSubject}需要与您交流，请给出意见。', HTML_ = '<p>任务沟通提醒:</p><p>${receiver}您好,任务：${taskSubject}需要与您交流，请给出意见</p>' WHERE ID_ = '2';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '流程终止恢复通知', PLAIN_ = '流程实例终止恢复通知：${instSubject}，意见:${cause}。', HTML_ = '<p>流程终止恢复通知:</p><p>流程实例已恢复运行中状态<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?instId=${instId}&type=request" target="_self">${instSubject}</a>，意见:${cause}</p>' WHERE ID_ = '20';
UPDATE portal_sys_msg_tpl SET SUBJECT_ = '设置任务执行人通知', PLAIN_ = '设置任务执行人：${taskSubject}，意见:${cause}。', HTML_ = '<p>设置任务执行人通知:</p><p>设置任务执行人：<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a>，意见:${cause}</p>'WHERE ID_ = '21';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '通知被代理人', PLAIN_ = '代理通知，您的任务：${taskSubject}，代理给${agent}', HTML_ = '<p>代理通知：<br/>您的任务<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a>，代理给${agent}</p>' WHERE ID_ = '3';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '通知沟通人nn', PLAIN_ = '流程任务沟通 已经给出意见n', HTML_ = '<p>沟通反馈提醒:</p><p>实例${taskSubject}发起的沟通，已给出意见</p><p><br/></p><p><br/></p><p><br/></p>' WHERE ID_ = '4';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '任务流转默认', PLAIN_ = '${cause}', HTML_ = '<p>任务流转通知：</p><p><a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a>的${nodeName}任务，已经流转给您</p>' WHERE ID_ = '5';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '任务转交通知', PLAIN_ = '任务转交：流程实例：${instSubject}的${nodeName}任务，已经转交给你办理。', HTML_ = '<p>任务转交：</p><p>流程实例<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a>，需要您办理</p>' WHERE ID_ = '6';
UPDATE portal_sys_msg_tpl SET  SUBJECT_ = '加签通知', PLAIN_ = '加签通知，${sender}将任务：${taskSubject}转交给您', HTML_ = '<p>加签通知：<br/>${sender}邀请您参与会签任务<a href="${baseUrl}/${frontBaseUrl}/matter/approvalForm?taskId=${taskId}&instId=${instId}&isGetApprovalBtn=true" target="_self">${taskSubject}</a>,加签原因:${cause}</p>' WHERE ID_ = '7';


-- 2022-06-17 jjx 待办列表字段显示配置 创建人改为发起人，创建时间改为发起时间
update portal_sys_properties set value='bHfSv3x1fi+lJABUhmU8OeY08mPnTHxMWR1WRuHJKS+YRaSDGCyf8BgNKnk/fKbQ6GB5pHWcTo+Pv7lHddu4nR0yd0ZumquJU67O2r7qQsRL1iat2BjwCcvWIvV9R9fD7wB1PAmt1cZJVyEcqqR9MNjH1+rLhv0r/XXVUTo8DLRgFO3zWkBGqJVpKU2LKa6RKdIxeR7A5MkP3NcLLIjxF8Q4FgCrt+ocxpIvkSv9vGUagCMJdv+DO/5w3IHLiGBuOx9OzWcXxklfhuxxfPLRFBqnbSBjHl43GzCH4AAWNgoXvGWkdvJSqkb2sgme/tKrP6YXNuVGj5hluovbLbMRT8e4Ta8uqn9OB51DypxPdukgSkLw3QBa12S3TSQVXrx9GeM8skAX42N32OKxLj7R7TAcvC+iMPwVq8TFkhb3SQhI8iSTmm78T/LmjcDT0H4hF7xlpHbyUqpG9rIJnv7Sqxl20VdLRQ8aM8QwNIdsOhKhgsYfdoBs+eD/Fk0xqjSabUpuU1ePW3KNbmprxbg1wC+kD+SwF+UcjNcjIj6/7nVMRp5f3d8yyR0pQRSz5l3SkTgstjiLwzfngj73eizXn6WRZuGdSbqdMLHsVKVViJRClggscn8OTNdmwbVFdsEFlOpXb2v/2yaBGiWdmSfM282c37fPM7mFxGFz7nHh990gSkLw3QBa12S3TSQVXrx9DJnpKUGaQZHEzYWjEXVBLkdRpTqcFOPjRAEJjpVi3clSiAkfCZcGKRp6Ugwf6/Bn1ngz9wERdjLlLlf56GNFhUM3DSSxmT1rpmA0JJwNkBaCImFPIWpwhftQbzuJ0xNmpZFm4Z1Jup0wsexUpVWIlKjQ4qbESycD7fe2p7W9blmGsYCOcJXtxHQzowIk4pxiNCX5GkrEOAa+Tyj/kRXYDPqFUiCjPAPYRKlflrVnZBC6xqRt6kt/5nduMKOipOenaaInvNpSjKYprFQPmwD1dZ7pCX+Qx6B2UO5yxznscSQuIyXjjKyf713dIpwHlagM8wfY2NHpTB+WIn1nG0fuvimBx5v4jbcpQrzV6KRls9SC95tjl931qXom3ADdeFuCuNxYc1rJR0S8gwngwSZ1FI75hKGF0dIn7F2DZltLlTXdbMBihFzRPf/3k++JlsfcGFRrhMFE91P5tMnxeMg/OjQl+RpKxDgGvk8o/5EV2AyKNGycHsftMAoUaAP02Lzv' where alias = 'taskListFiledConf';

-- 2022-06-17 jjx 修改领导秘书配置保存流程信息的字段长度
alter table BPM_SECRETARY_MANAGE modify SHARE_KEY_ VARCHAR2(4000);

-- 2022-07-01 wanghb 新增表单标签的初始化sql
INSERT INTO PORTAL_SYS_TYPE(ID_, TYPE_GROUP_KEY_, NAME_, TYPE_KEY_, STRU_TYPE_, PARENT_ID_, DEPTH_, PATH_, IS_LEAF_, OWNER_ID_, SN_, CREATE_BY_, CREATE_TIME_, CREATE_ORG_ID_, UPDATE_BY_, UPDATE_TIME_, ICON_, TENANT_ID_) 
VALUES ('1448213586020302848', 'TAG', '流程标签', 'flow', '1', '11', 1, '11.1448213586020302848.', 'Y', '0', 0, '1', null, '', NULL, NULL, '{}', '-1');


-- 2022-06-23 heyf 修改关联查询、对话框、外部系统调用日志表中header的长度为2000
alter table FORM_CUSTOM_QUERY modify HEADER_ VARCHAR2(2000);
ALTER TABLE FORM_CUSTOM_DIALOG modify  HEADER_ VARCHAR2(2000);
ALTER TABLE BPM_CALL_LOG modify  HEADER_ VARCHAR2(2000);

--2022-07-13 yijj 修改消息模版标题长度
alter table PORTAL_SYS_MSG_TPL modify SUBJECT_ VARCHAR2(250);

--2022-7-13  定时计划配置参数修改
UPDATE QRTZ_JOB_DETAILS SET JOB_DATA = HEXTORAW('ACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787000737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F40000000000010770800000010000000007800') WHERE SCHED_NAME = 'quartzScheduler' AND JOB_NAME = '任务催办定时计划' AND JOB_GROUP = '-1';
UPDATE QRTZ_JOB_DETAILS SET JOB_DATA = HEXTORAW('ACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787000737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F40000000000010770800000010000000007800') WHERE SCHED_NAME = 'quartzScheduler' AND JOB_NAME = '流程定时启动任务类' AND JOB_GROUP = '-1';