-- 新增数据字典
insert into sys_dict(description,label,sort,type,value)
VALUE('勘查任务状态','待分配',6,'TASKSTATUS',100);
insert into sys_dict(description,label,sort,type,value)
VALUE('勘查任务状态','未接受',7,'TASKSTATUS',101);
insert into sys_dict(description,label,sort,type,value)
VALUE('勘查任务状态','已接受',8,'TASKSTATUS',102);
insert into sys_dict(description,label,sort,type,value)
VALUE('勘查任务状态','已拒绝',9,'TASKSTATUS',103);
insert into sys_dict(description,label,sort,type,value)
VALUE('勘查任务状态','已完成',10,'TASKSTATUS',104);
insert into sys_dict(description,label,sort,type,value)
VALUE('勘查任务状态','结束',11,'TASKSTATUS',105);


-- 订单表新增延后支付凭证字段
ALTER TABLE `risk_orderform`
ADD COLUMN `delayPhoto`  varchar(255) NULL COMMENT '延后支付凭证' AFTER `ywzcId`;

ALTER TABLE `risk_orderform`
ADD COLUMN `refundAmount`  decimal(19,2) NULL COMMENT '退款金额' AFTER `supplyAmount`;

ALTER TABLE `risk_orderform`
ADD COLUMN `sourceAmount`  decimal(19,2) NULL COMMENT '原始金额' AFTER `refundAmount`;

ALTER TABLE `risk_orderform`
ADD COLUMN `sourceReportAmount`  decimal(19,2) NULL COMMENT '原始报告金额' AFTER `sourceAmount`;


-- 新增操作日志表
CREATE TABLE `risk_operate_log` (
  `oid` bigint(20) NOT NULL AUTO_INCREMENT,
  `userId` bigint(20) DEFAULT NULL COMMENT '用户id',
  `operateType` int(11) DEFAULT NULL COMMENT '操作类型',
  `operateTime` datetime DEFAULT NULL COMMENT '操作时间',
  `bizId` varchar(255) DEFAULT NULL COMMENT '业务id',
  `sourceId` varchar(255) DEFAULT NULL COMMENT '溯源id',
  `content` varchar(500) DEFAULT NULL COMMENT '内容',
  `ip` varchar(255) DEFAULT NULL COMMENT 'ip',
  `expand1` varchar(255) DEFAULT NULL COMMENT '扩展字段1',
  `expand2` varchar(255) DEFAULT NULL COMMENT '扩展字段2',
  `activityId` bigint(20) DEFAULT NULL COMMENT '活动id',
  `activityName` varchar(255) DEFAULT NULL COMMENT '活动名称',
  `createOn` datetime DEFAULT NULL,
  `updateOn` datetime DEFAULT NULL,
  PRIMARY KEY (`oid`),
  KEY `IDX_OPERATE_USER_ID` (`userId`),
  KEY `IDX_OPERATE_BIZ_ID` (`bizId`),
  KEY `IDX_OPERATE_OPERATE_TYPE` (`operateType`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='操作日志表';


-- 动态看板
CREATE TABLE `risk_dynamic_panel` (
  `oid` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `templateId` bigint(20) DEFAULT NULL,
  `dynamicType` varchar(255) DEFAULT NULL,
  `dynamicPermission` varchar(255) DEFAULT NULL COMMENT '数据权限：承办方/风评/所有',
  `activityId` int(11) DEFAULT NULL,
  `activityName` varchar(255) DEFAULT NULL,
  `templateData` text COMMENT '模板数据',
  `operateId` bigint(20) DEFAULT NULL COMMENT '操作人id',
  `operateName` varchar(255) DEFAULT NULL,
  `operateType` varchar(255) DEFAULT NULL COMMENT '操作人用户类型',
  `orgId` bigint(20) DEFAULT NULL COMMENT '风评机构id',
  `contractOrgId` bigint(20) DEFAULT NULL COMMENT '承办方机构id',
  `createOn` datetime DEFAULT NULL,
  `updateOn` datetime DEFAULT NULL,
  PRIMARY KEY (`oid`),
  KEY `IDK_DYN_ACTIVITYID` (`activityId`),
  KEY `IDK_DYN_ORGID` (`orgId`),
  KEY `IDK_DYN_CONTRACTID` (`contractOrgId`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='动态看板';

-- 动态看板模板
CREATE TABLE `risk_dynamic_panel_template` (
  `oid` bigint(20) NOT NULL COMMENT '主键',
  `dynamicType` varchar(50) DEFAULT NULL COMMENT '类型',
  `template` varchar(500) DEFAULT NULL COMMENT '模板内容',
  `remarks` varchar(255) DEFAULT NULL COMMENT '备注',
  `createOn` datetime DEFAULT NULL,
  `updateOn` datetime DEFAULT NULL,
  PRIMARY KEY (`oid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='动态看板模板';



-- ----------------------------
-- Records of risk_dynamic_panel_template
-- ----------------------------
INSERT INTO `risk_dynamic_panel_template` VALUES ('100001', '100', '生成订单【<font class=\"font_blue\">@activityName@</font>】', '生成订单', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('100002', '100', '订单【<font class=\"font_blue\">@activityName@</font>】已选机构：<font class=\"font_blue\">@orgNameList@</font>', '选择评估机构', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('100003', '100', '收到来自 <font class=\"font_blue\">@contractName@</font> 的订单【<font class=\"font_blue\">@activityName@</font>】，<font class=\"font_blue\">@reportUrgentName@</font>', '收到订单', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('100004', '100', '<font class=\"font_blue\">@operateName@</font> 已修改订单【<font class=\"font_blue\">@activityName@</font>】的金额，修改前：<font class=\"font_blue\">@sourceAmount@</font>元，修改后：<font class=\"font_blue\">@updateAfterAmount@</font>元', '修改金额', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('100005', '100', '订单【<font class=\"font_blue\">@activityName@</font>】已成功支付，支付方式：<font class=\"font_blue\">@paymentMethod@</font>，支付金额：<font class=\"font_blue\">@transactionAmount@</font>元', '支付金额', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('200001', '200', '<font class=\"font_blue\">@operateName@</font> 已提交订单【<font class=\"font_blue\">@activityName@</font>】的补充材料', '提交补充材料', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('200002', '200', '<font class=\"font_blue\">@contractName@</font> 已提交订单【<font class=\"font_blue\">@activityName@</font>】的补充材料', '提交补充材料', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('200003', '200', '<font class=\"font_blue\">@operateName@</font> 已提交订单【<font class=\"font_blue\">@activityName@</font>】的评估报告，提交版本为：<a href=\"javascript:void(0);\" onclick=\"preview(\'@reportUrl@\')\" target=\"_blank\"><font class=\"font_blue\">@reportVer@</font></a>', '提交报告', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('200004', '200', '<font class=\"font_blue\">@orgName@</font> 已提交订单【<font class=\"font_blue\">@activityName@</font>】的评估报告，<a href=\"javascript:void(0);\" onclick=\"preview(\'@reportUrl@\')\" target=\"_blank\"><font class=\"font_blue\">查看评估报告</font></a>', '评估报告', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('300001', '300', '<font class=\"font_blue\">@operateName@</font> 已分配撰写任务【<font class=\"font_blue\">@activityName@</font>】，相关人员：<font class=\"font_blue\">@zxUserList@</font>', '撰写任务分配', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('300002', '300', '<font class=\"font_blue\">@operateName@</font> 已重新分配撰写任务【<font class=\"font_blue\">@activityName@</font>】，相关人员：<font class=\"font_blue\">@zxUserList@</font>', '撰写任务重新分配', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('300003', '300', '<font class=\"font_blue\">@operateName@</font> 已完成【<font class=\"font_blue\">@activityName@</font>】的初稿编写任务，<a href=\"javascript:void(0);\" onclick=\"preview(\'@reportUrl@\')\"  target=\"_blank\"><font class=\"font_blue\">查看评估报告（编写完成）</font></a>', '初稿撰写', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('300004', '300', '<font class=\"font_blue\">@operateName@</font> 已完成【<font class=\"font_blue\">@activityName@</font>】的报告审核任务，<a href=\"javascript:void(0);\" onclick=\"preview(\'@reportUrl@\')\" target=\"_blank\"><font class=\"font_blue\">查看评估报告（审核完成）</font></a>', '报告审核', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('300005', '300', '<font class=\"font_blue\">@operateName@</font> 已完成【<font class=\"font_blue\">@activityName@</font>】的专家评估任务，<a href=\"javascript:void(0);\" onclick=\"preview(\'@reportUrl@\')\" target=\"_blank\"><font class=\"font_blue\">查看评估报告（专家审核完成）</font></a>', '专家撰写', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('300006', '300', '<font class=\"font_blue\">@operateName@</font> 已完成【<font class=\"font_blue\">@activityName@</font>】的组长复核任务，<a href=\"javascript:void(0);\" onclick=\"preview(\'@reportUrl@\')\" target=\"_blank\"><font class=\"font_blue\">查看评估报告（终稿）</font></a>', '组长复核', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('400001', '400', '<font class=\"font_blue\">@operateName@</font> 已分配勘查任务【<font class=\"font_blue\">@activityName@</font>】，勘查人员：<font class=\"font_blue\">@tkUserName@</font>，勘查专家：<font class=\"font_blue\">@tkzjUserList@</font>', '踏勘任务分配', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('400002', '400', '<font class=\"font_blue\">@operateName@</font> 已重新分配勘查任务【<font class=\"font_blue\">@activityName@</font>】，勘查人员：<font class=\"font_blue\">@tkUserName@</font>，勘查专家：<font class=\"font_blue\">@tkzjUserList@</font>', '踏勘任务重新分配', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('400003', '400', '<font class=\"font_blue\">@operateName@</font> 已接受勘查任务【<font class=\"font_blue\">@activityName@</font>】', '接受勘查任务', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('400004', '400', '<font class=\"font_blue\">@operateName@</font>  已拒绝勘查任务【<font class=\"font_blue\">@activityName@</font>】', '拒绝勘查任务', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('400005', '400', '<font class=\"font_blue\">@operateName@</font>  申请转交勘查任务【<font class=\"font_blue\">@activityName@</font>】', '勘查任务转交', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('400006', '400', '<font class=\"font_blue\">@operateName@</font>  申请专家协助处理勘查任务【<font class=\"font_blue\">@activityName@</font>】', '申请专家', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('400007', '400', '<font class=\"font_blue\">@tkUserName@</font> 关于勘查任务【<font class=\"font_blue\">@activityName@</font>】的任务转交申请被 <font class=\"font_blue\">@operateName@</font> 拒绝', '任务转交拒绝', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('400008', '400', '<font class=\"font_blue\">@tkUserName@</font> 关于勘查任务【<font class=\"font_blue\">@activityName@</font>】的专家申请被 <font class=\"font_blue\">@operateName@</font> 拒绝', '专家申请拒绝', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('400009', '400', '<font class=\"font_blue\">@operateName@</font> 已为勘查任务【<font class=\"font_blue\">@activityName@</font>】分配了勘查专家：<font class=\"font_blue\">@tkzjUserList@</font>', '专家申请同意', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('400010', '400', '<font class=\"font_blue\">@operateName@</font> 已为【<font class=\"font_blue\">@activityName@</font>】新增@step@计划，勘查时间：<font class=\"font_blue\">@tkTime@</font>，勘查地点：<font class=\"font_blue\">@tkVenue@</font>', '踏勘计划', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('400011', '400', '<font class=\"font_blue\">@operateName@</font> 已完成【<font class=\"font_blue\">@activityName@</font>】@step@任务，<a href=\"javascript:void(0);\" onclick=\"preview(\'@surveyReport@\')\" target=\"_blank\"><font class=\"font_blue\">查看@step@报告</font></a>', '踏勘报告', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('400012', '400', '<font class=\"font_blue\">@contractName@</font> 已反馈【<font class=\"font_blue\">@activityName@</font>】@step@的整改情况', '踏勘整改回复', null, null);
INSERT INTO `risk_dynamic_panel_template` VALUES ('400013', '400', '<font class=\"font_blue\">@operateName@</font> 已反馈【<font class=\"font_blue\">@activityName@</font>】@step@的整改情况', '踏勘整改回复', null, null);





