6-9 fix - 逻辑变更:清单只能下发一家公司改为可下发多家
parent
e63facc21f
commit
71bbd603f7
190
docs/init.sql
190
docs/init.sql
|
|
@ -2,152 +2,216 @@
|
|||
-- 任务清单表
|
||||
-- =============================================
|
||||
CREATE TABLE `safety_accountability_task_list` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`task_list_id` varchar(64) NOT NULL COMMENT '清单UUID(业务主键)',
|
||||
`task_list_name` varchar(255) NOT NULL COMMENT '清单名称',
|
||||
`task_level` tinyint(2) NOT NULL COMMENT '任务级别:1-企业级 2-部门级 3-班组级',
|
||||
`task_level` tinyint NOT NULL COMMENT '任务级别:1-企业级 2-部门级 3-班组级',
|
||||
`responsibility_post` varchar(255) NOT NULL COMMENT '责任岗位',
|
||||
`switch_flag` tinyint(1) NOT NULL DEFAULT '1' COMMENT '开启/关闭:0-关 1-开',
|
||||
`status` tinyint(2) NOT NULL DEFAULT '1' COMMENT '状态:1-进行中 2-已完成 3-已关闭',
|
||||
`period_start_time` datetime DEFAULT NULL COMMENT '执行周期开始时间',
|
||||
`period_end_time` datetime DEFAULT NULL COMMENT '执行周期结束时间',
|
||||
`rating_score` decimal(5,2) DEFAULT NULL COMMENT '评分数',
|
||||
`rating_user_id` bigint(20) DEFAULT NULL COMMENT '评分人ID',
|
||||
`rating_department_id` bigint(20) DEFAULT NULL COMMENT '评分部门ID',
|
||||
`create_corp_id` bigint(20) DEFAULT NULL COMMENT '创建公司ID',
|
||||
`create_department_id` bigint(20) DEFAULT NULL COMMENT '创建部门ID',
|
||||
`create_user_id` bigint(20) DEFAULT NULL COMMENT '创建人ID',
|
||||
`issue_status` tinyint(4) DEFAULT '0' COMMENT '下发状态:0-未下发 1-已下发',
|
||||
`issue_time` datetime DEFAULT NULL COMMENT '下发时间',
|
||||
`execute_corp_id` bigint(20) DEFAULT NULL COMMENT '执行公司ID',
|
||||
`execute_department_id` bigint(20) DEFAULT NULL COMMENT '执行部门ID',
|
||||
`execute_user_id` bigint(20) DEFAULT NULL COMMENT '执行人员ID',
|
||||
`close_time` datetime DEFAULT NULL COMMENT '关闭时间',
|
||||
`create_corp_id` bigint DEFAULT NULL COMMENT '创建公司ID',
|
||||
`create_department_id` bigint DEFAULT NULL COMMENT '创建部门ID',
|
||||
`create_user_id` bigint DEFAULT NULL COMMENT '创建人ID',
|
||||
`status` tinyint NOT NULL DEFAULT '1' COMMENT '状态:1-进行中 2-已完成 3-已关闭',
|
||||
`delete_enum` varchar(32) DEFAULT 'FALSE' COMMENT '删除标识:TRUE/FALSE',
|
||||
`remarks` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
`create_name` varchar(50) DEFAULT NULL COMMENT '创建人姓名',
|
||||
`update_name` varchar(50) DEFAULT NULL COMMENT '更新人姓名',
|
||||
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户ID',
|
||||
`org_id` bigint(20) DEFAULT NULL COMMENT '单位ID',
|
||||
`version` int(11) DEFAULT '0' COMMENT '版本',
|
||||
`tenant_id` bigint DEFAULT NULL COMMENT '租户ID',
|
||||
`org_id` bigint DEFAULT NULL COMMENT '单位ID',
|
||||
`version` int DEFAULT '0' COMMENT '版本',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`create_id` bigint(20) DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_id` bigint(20) DEFAULT NULL COMMENT '修改人ID',
|
||||
`create_id` bigint DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_id` bigint DEFAULT NULL COMMENT '修改人ID',
|
||||
`env` varchar(50) DEFAULT NULL COMMENT '环境标识',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_task_list_id` (`task_list_id`),
|
||||
KEY `idx_create_corp_id` (`create_corp_id`),
|
||||
KEY `idx_execute_corp_id` (`execute_corp_id`),
|
||||
KEY `idx_execute_user_id` (`execute_user_id`),
|
||||
KEY `idx_status_task_list_id` (`status`,`task_list_id`) USING BTREE,
|
||||
KEY `idx_period_time` (`period_start_time`, `period_end_time`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='任务清单表';
|
||||
KEY `idx_status_task_list_id` (`task_list_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='任务清单表';
|
||||
|
||||
-- =============================================
|
||||
-- 任务清单详细表
|
||||
-- =============================================
|
||||
CREATE TABLE `safety_accountability_task_detail` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`task_detail_id` varchar(64) NOT NULL COMMENT '任务详情UUID(业务主键)',
|
||||
`task_list_id` varchar(64) NOT NULL COMMENT '任务清单主键(关联任务清单表)',
|
||||
`execute_content` text COMMENT '执行内容',
|
||||
`feedback_cycle_type` tinyint(4) NOT NULL COMMENT '反馈周期类型:1-每月 2-季度 3-半年 4-年',
|
||||
`task_status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '任务状态:1-进行中 2-已完成 3-已关闭',
|
||||
`feedback_status` tinyint(4) DEFAULT '1' COMMENT '反馈状态:1-正常 2-异常',
|
||||
`feedback_cycle_type` tinyint NOT NULL COMMENT '反馈周期类型:1-每月 2-季度 3-半年 4-年',
|
||||
`task_score` decimal(5,2) DEFAULT NULL COMMENT '任务分值',
|
||||
`task_rating` decimal(5,2) DEFAULT NULL COMMENT '任务评分',
|
||||
`rating_time` datetime DEFAULT NULL COMMENT '评分时间',
|
||||
`rating_department_id` bigint(20) DEFAULT NULL COMMENT '评分部门ID',
|
||||
`rating_user_id` bigint(20) DEFAULT NULL COMMENT '评分人ID',
|
||||
`task_status` tinyint NOT NULL DEFAULT '1' COMMENT '任务状态:1-进行中 2-已完成 3-已关闭',
|
||||
`delete_enum` varchar(32) DEFAULT 'FALSE' COMMENT '删除标识:TRUE/FALSE',
|
||||
`remarks` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
`create_name` varchar(50) DEFAULT NULL COMMENT '创建人姓名',
|
||||
`update_name` varchar(50) DEFAULT NULL COMMENT '更新人姓名',
|
||||
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户ID',
|
||||
`org_id` bigint(20) DEFAULT NULL COMMENT '单位ID',
|
||||
`version` int(11) DEFAULT '0' COMMENT '版本',
|
||||
`tenant_id` bigint DEFAULT NULL COMMENT '租户ID',
|
||||
`org_id` bigint DEFAULT NULL COMMENT '单位ID',
|
||||
`version` int DEFAULT '0' COMMENT '版本',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`create_id` bigint(20) DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_id` bigint(20) DEFAULT NULL COMMENT '修改人ID',
|
||||
`create_id` bigint DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_id` bigint DEFAULT NULL COMMENT '修改人ID',
|
||||
`env` varchar(50) DEFAULT NULL COMMENT '环境标识',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_task_detail_id` (`task_detail_id`),
|
||||
KEY `idx_task_list_id` (`task_list_id`),
|
||||
KEY `idx_task_list_status` (`task_list_id`,`task_status`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='任务清单详细表';
|
||||
KEY `idx_task_list_status` (`task_list_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='任务清单详细表';
|
||||
|
||||
-- =============================================
|
||||
-- 任务下发记录表
|
||||
-- =============================================
|
||||
CREATE TABLE `safety_accountability_task_list_issue` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`task_issue_id` varchar(64) NOT NULL COMMENT '下发记录UUID(业务主键)',
|
||||
`task_list_id` varchar(64) NOT NULL COMMENT '清单UUID(关联清单模板表)',
|
||||
`execute_corp_id` bigint DEFAULT NULL COMMENT '执行公司ID',
|
||||
`execute_department_id` bigint DEFAULT NULL COMMENT '执行部门ID',
|
||||
`execute_user_id` bigint DEFAULT NULL COMMENT '执行人员ID',
|
||||
`issue_status` tinyint DEFAULT '0' COMMENT '下发状态:0-未下发 1-已下发',
|
||||
`issue_time` datetime DEFAULT NULL COMMENT '下发时间',
|
||||
`period_start_time` datetime DEFAULT NULL COMMENT '执行周期开始时间',
|
||||
`period_end_time` datetime DEFAULT NULL COMMENT '执行周期结束时间',
|
||||
`status` tinyint NOT NULL DEFAULT '1' COMMENT '状态:1-进行中 2-已完成 3-已关闭',
|
||||
`close_time` datetime DEFAULT NULL COMMENT '关闭时间',
|
||||
`rating_score` decimal(5,2) DEFAULT NULL COMMENT '评分数(汇总所有任务执行评分)',
|
||||
`rating_user_id` bigint DEFAULT NULL COMMENT '评分人ID',
|
||||
`rating_department_id` bigint DEFAULT NULL COMMENT '评分部门ID',
|
||||
`delete_enum` varchar(32) DEFAULT 'FALSE' COMMENT '删除标识:TRUE/FALSE',
|
||||
`remarks` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
`create_name` varchar(50) DEFAULT NULL COMMENT '创建人姓名',
|
||||
`update_name` varchar(50) DEFAULT NULL COMMENT '更新人姓名',
|
||||
`tenant_id` bigint DEFAULT NULL COMMENT '租户ID',
|
||||
`org_id` bigint DEFAULT NULL COMMENT '单位ID',
|
||||
`version` int DEFAULT '0' COMMENT '版本',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`create_id` bigint DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_id` bigint DEFAULT NULL COMMENT '修改人ID',
|
||||
`env` varchar(50) DEFAULT NULL COMMENT '环境标识',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_task_issue_id` (`task_issue_id`),
|
||||
KEY `idx_tenant_org_status` (`tenant_id`,`org_id`,`status`),
|
||||
KEY `idx_task_list_id` (`task_list_id`),
|
||||
KEY `idx_execute_corp_dept_user` (`execute_corp_id`, `execute_department_id`, `execute_user_id`),
|
||||
KEY `idx_period_start` (`period_start_time`),
|
||||
KEY `idx_issue_time` (`issue_time`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='清单下发记录表';
|
||||
|
||||
-- =============================================
|
||||
-- 任务执行表
|
||||
-- =============================================
|
||||
CREATE TABLE `safety_accountability_task_execution` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`task_execution_id` varchar(64) NOT NULL COMMENT '任务执行UUID(业务主键)',
|
||||
`task_issue_id` varchar(64) NOT NULL COMMENT '清单下发记录UUID(关联下发记录表)',
|
||||
`task_detail_id` varchar(64) NOT NULL COMMENT '任务模板UUID(关联任务详情模板表)',
|
||||
`task_list_id` varchar(64) NOT NULL COMMENT '清单UUID(冗余,便于查询)',
|
||||
`task_status` tinyint NOT NULL DEFAULT '1' COMMENT '任务状态:1-进行中 2-已完成 3-已关闭',
|
||||
`feedback_status` tinyint DEFAULT '1' COMMENT '反馈状态:1-正常 2-异常',
|
||||
`task_rating` decimal(5,2) DEFAULT NULL COMMENT '任务评分',
|
||||
`rating_time` datetime DEFAULT NULL COMMENT '评分时间',
|
||||
`rating_department_id` bigint DEFAULT NULL COMMENT '评分部门ID',
|
||||
`rating_user_id` bigint DEFAULT NULL COMMENT '评分人ID',
|
||||
`delete_enum` varchar(32) DEFAULT 'FALSE' COMMENT '删除标识:TRUE/FALSE',
|
||||
`remarks` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
`create_name` varchar(50) DEFAULT NULL COMMENT '创建人姓名',
|
||||
`update_name` varchar(50) DEFAULT NULL COMMENT '更新人姓名',
|
||||
`tenant_id` bigint DEFAULT NULL COMMENT '租户ID',
|
||||
`org_id` bigint DEFAULT NULL COMMENT '单位ID',
|
||||
`version` int DEFAULT '0' COMMENT '版本',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`create_id` bigint DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_id` bigint DEFAULT NULL COMMENT '修改人ID',
|
||||
`env` varchar(50) DEFAULT NULL COMMENT '环境标识',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_task_execution_id` (`task_execution_id`),
|
||||
KEY `idx_tenant_org_task` (`tenant_id`,`org_id`,`task_status`),
|
||||
KEY `idx_task_issue_id` (`task_issue_id`),
|
||||
KEY `idx_task_detail_id` (`task_detail_id`),
|
||||
KEY `idx_task_list_id` (`task_list_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='任务执行记录表';
|
||||
|
||||
-- =============================================
|
||||
-- 执行反馈表
|
||||
-- =============================================
|
||||
CREATE TABLE `safety_accountability_feedback` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`feedback_id` varchar(64) NOT NULL COMMENT '反馈UUID(业务主键)',
|
||||
`task_detail_id` varchar(64) NOT NULL COMMENT '任务详情UUID(关联任务清单详细表)',
|
||||
`task_execution_id` varchar(64) DEFAULT NULL COMMENT '任务执行UUID(关联任务执行表)',
|
||||
`task_list_id` varchar(64) NOT NULL COMMENT '任务清单UUID(冗余字段,便于查询)',
|
||||
`task_issue_id` varchar(64) DEFAULT NULL COMMENT '清单下发记录UUID(冗余)',
|
||||
`feedback_time` datetime NOT NULL COMMENT '反馈时间',
|
||||
`feedback_period_start_time` datetime NOT NULL COMMENT '反馈周期开始时间(用于回显)',
|
||||
`feedback_period_end_time` datetime NOT NULL COMMENT '反馈周期结束时间(用于回显)',
|
||||
`feedback_period_flag` varchar(20) NOT NULL COMMENT '反馈周期标识(格式:2026-05表示月,2026-Q1表示季度,2026-H1表示半年,2026表示年)',
|
||||
`feedback_content` text COMMENT '反馈内容',
|
||||
`feedback_corp_id` bigint(20) DEFAULT NULL COMMENT '反馈人公司ID',
|
||||
`feedback_department_id` bigint(20) DEFAULT NULL COMMENT '反馈人部门ID',
|
||||
`feedback_user_id` bigint(20) DEFAULT NULL COMMENT '反馈人ID',
|
||||
`feedback_corp_id` bigint DEFAULT NULL COMMENT '反馈人公司ID',
|
||||
`feedback_department_id` bigint DEFAULT NULL COMMENT '反馈人部门ID',
|
||||
`feedback_user_id` bigint DEFAULT NULL COMMENT '反馈人ID',
|
||||
`delete_enum` varchar(32) DEFAULT 'FALSE' COMMENT '删除标识:TRUE/FALSE',
|
||||
`remarks` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
`create_name` varchar(50) DEFAULT NULL COMMENT '创建人姓名',
|
||||
`update_name` varchar(50) DEFAULT NULL COMMENT '更新人姓名',
|
||||
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户ID',
|
||||
`org_id` bigint(20) DEFAULT NULL COMMENT '单位ID',
|
||||
`version` int(11) DEFAULT '0' COMMENT '版本',
|
||||
`tenant_id` bigint DEFAULT NULL COMMENT '租户ID',
|
||||
`org_id` bigint DEFAULT NULL COMMENT '单位ID',
|
||||
`version` int DEFAULT '0' COMMENT '版本',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`create_id` bigint(20) DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_id` bigint(20) DEFAULT NULL COMMENT '修改人ID',
|
||||
`create_id` bigint DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_id` bigint DEFAULT NULL COMMENT '修改人ID',
|
||||
`env` varchar(50) DEFAULT NULL COMMENT '环境标识',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_feedback_id` (`feedback_id`),
|
||||
KEY `idx_task_detail_id` (`task_detail_id`),
|
||||
KEY `idx_task_list_id` (`task_list_id`),
|
||||
KEY `idx_feedback_time` (`feedback_time`),
|
||||
KEY idx_taskdetail_period (task_detail_id, feedback_period_flag),
|
||||
KEY `idx_feedback_user_id` (`feedback_user_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='执行反馈表';
|
||||
KEY `idx_feedback_user_id` (`feedback_user_id`),
|
||||
KEY `idx_taskdetail_period` (`task_detail_id`,`feedback_period_flag`),
|
||||
KEY `idx_task_execution_id` (`task_execution_id`),
|
||||
KEY `idx_task_issue_id` (`task_issue_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='执行反馈表';
|
||||
|
||||
-- =============================================
|
||||
-- 反馈异常信息表
|
||||
-- =============================================
|
||||
CREATE TABLE `safety_accountability_feedback_exception` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`feedback_exception_id` varchar(64) NOT NULL COMMENT '反馈异常UUID(业务主键)',
|
||||
`task_detail_id` varchar(64) NOT NULL COMMENT '任务详情主键(关联任务清单详细表)',
|
||||
`task_execution_id` varchar(64) DEFAULT NULL COMMENT '任务执行UUID(关联任务执行表)',
|
||||
`task_list_id` varchar(64) DEFAULT NULL COMMENT '任务清单主键(冗余字段)',
|
||||
`task_issue_id` varchar(64) DEFAULT NULL COMMENT '清单下发记录UUID(冗余)',
|
||||
`exception_period_flag` varchar(20) NOT NULL COMMENT '异常周期标识',
|
||||
`exception_period_start_time` datetime DEFAULT NULL COMMENT '反馈周期开始时间(用于回显)',
|
||||
`exception_period_end_time` datetime DEFAULT NULL COMMENT '反馈周期结束时间(用于回显)',
|
||||
`exception_type` tinyint(4) DEFAULT 1 COMMENT '异常类型:1-未按时反馈 2-反馈内容异常 3-其他',
|
||||
`exception_type` tinyint DEFAULT '1' COMMENT '异常类型:1-未按时反馈 2-反馈内容异常 3-其他',
|
||||
`exception_content` text COMMENT '反馈异常信息',
|
||||
`exception_time` datetime DEFAULT NULL COMMENT '异常时间',
|
||||
`delete_enum` varchar(32) DEFAULT 'FALSE' COMMENT '删除标识:TRUE/FALSE',
|
||||
`remarks` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
`create_name` varchar(50) DEFAULT NULL COMMENT '创建人姓名',
|
||||
`update_name` varchar(50) DEFAULT NULL COMMENT '更新人姓名',
|
||||
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户ID',
|
||||
`org_id` bigint(20) DEFAULT NULL COMMENT '单位ID',
|
||||
`version` int(11) DEFAULT '0' COMMENT '版本',
|
||||
`tenant_id` bigint DEFAULT NULL COMMENT '租户ID',
|
||||
`org_id` bigint DEFAULT NULL COMMENT '单位ID',
|
||||
`version` int DEFAULT '0' COMMENT '版本',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`create_id` bigint(20) DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_id` bigint(20) DEFAULT NULL COMMENT '修改人ID',
|
||||
`create_id` bigint DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_id` bigint DEFAULT NULL COMMENT '修改人ID',
|
||||
`env` varchar(50) DEFAULT NULL COMMENT '环境标识',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_feedback_exception_id` (`feedback_exception_id`),
|
||||
KEY `idx_task_detail_id` (`task_detail_id`),
|
||||
KEY `idx_task_list_id` (`task_list_id`),
|
||||
KEY `idx_taskdetail_ex_period` (`task_detail_id`,`exception_period_flag`),
|
||||
KEY `idx_taskdetail_ex_type` (`task_detail_id`,`exception_type`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='反馈异常信息表';
|
||||
KEY `idx_taskdetail_ex_type` (`task_detail_id`,`exception_type`),
|
||||
KEY `idx_task_execution_id` (`task_execution_id`),
|
||||
KEY `idx_task_issue_id` (`task_issue_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='反馈异常信息表';
|
||||
|
||||
-- =============================================
|
||||
-- 公司信息视图
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,674 @@
|
|||
# 安全责任清单 - 多公司下发改动分析
|
||||
|
||||
## 一、需求变更说明
|
||||
|
||||
| 项目 | 原需求 | 新需求 |
|
||||
|------|--------|--------|
|
||||
| 下发对象 | 一张清单只能下发给一个公司/部门/人员 | 一张清单(含所有任务)作为整体,可下发给多个公司 |
|
||||
| 数据关系 | 清单与执行方是一对一关系 | 清单与执行方是一对多关系 |
|
||||
| 表职责 | 清单表和任务表混合了模板定义与执行数据 | 清单表/任务表纯粹作为模板定义,执行数据独立到下发表和任务执行表 |
|
||||
|
||||
## 二、当前数据模型分析
|
||||
|
||||
### 2.1 当前表结构
|
||||
|
||||
```
|
||||
safety_accountability_task_list(清单表 - 模板+执行混合)
|
||||
├── task_list_id → 清单UUID
|
||||
├── task_list_name → 清单名称
|
||||
├── task_level → 任务级别
|
||||
├── responsibility_post → 责任岗位
|
||||
├── switch_flag → 开关
|
||||
├── status → 状态(执行相关)
|
||||
├── period_start_time → 周期开始时间(执行相关)
|
||||
├── period_end_time → 周期结束时间(执行相关)
|
||||
├── execute_corp_id → 执行公司ID(执行相关)
|
||||
├── execute_department_id → 执行部门ID(执行相关)
|
||||
├── execute_user_id → 执行人员ID(执行相关)
|
||||
├── issue_status → 下发状态(执行相关)
|
||||
├── issue_time → 下发时间(执行相关)
|
||||
├── rating_score → 评分数(执行相关)
|
||||
├── rating_user_id → 评分人ID(执行相关)
|
||||
├── rating_department_id → 评分部门ID(执行相关)
|
||||
├── close_time → 关闭时间(执行相关)
|
||||
|
||||
safety_accountability_task_detail(任务详情表 - 模板+执行混合)
|
||||
├── task_detail_id → 任务UUID
|
||||
├── task_list_id → 关联清单UUID
|
||||
├── execute_content → 执行内容(模板)
|
||||
├── feedback_cycle_type → 反馈周期类型(模板)
|
||||
├── task_score → 任务分值(模板)
|
||||
├── task_status → 任务状态(执行相关)
|
||||
├── feedback_status → 反馈状态(执行相关)
|
||||
├── task_rating → 任务评分(执行相关)
|
||||
├── rating_time → 评分时间(执行相关)
|
||||
├── rating_department_id → 评分部门ID(执行相关)
|
||||
├── rating_user_id → 评分人ID(执行相关)
|
||||
|
||||
safety_accountability_feedback(反馈表)
|
||||
├── feedback_id → 反馈UUID
|
||||
├── task_detail_id → 关联任务详情UUID
|
||||
├── task_list_id → 关联清单UUID(冗余)
|
||||
└── ...
|
||||
|
||||
safety_accountability_feedback_exception(反馈异常表)
|
||||
├── feedback_exception_id → 反馈异常UUID
|
||||
├── task_detail_id → 关联任务详情UUID
|
||||
├── task_list_id → 关联清单UUID(冗余)
|
||||
└── ...
|
||||
```
|
||||
|
||||
### 2.2 当前模型的问题
|
||||
|
||||
1. **清单表混合了模板定义和执行数据**:`execute_corp_id`、`issue_status`、`status`、`period_*`、`rating_*` 等执行相关字段与模板定义字段混在一起
|
||||
2. **任务详情表混合了模板定义和执行数据**:`task_status`、`feedback_status`、`task_rating`、`rating_*` 等执行相关字段与模板定义字段混在一起
|
||||
3. **清单与执行方是一对一关系**:无法支持多公司下发
|
||||
4. **反馈和异常表直接关联任务模板**:应关联到具体的任务执行实例
|
||||
|
||||
## 三、新数据模型设计
|
||||
|
||||
### 3.1 核心思路:模板与实例分离
|
||||
|
||||
将现有模型拆分为**模板层**和**实例层**:
|
||||
|
||||
```
|
||||
模板层(定义"是什么") 实例层(定义"执行得怎样")
|
||||
┌──────────────┐ ┌──────────────────────┐
|
||||
│ task_list │ 1 ────── N │ task_list_issue │
|
||||
│ 清单模板 │ │ 清单下发记录 │
|
||||
└──────┬───────┘ └──────────┬───────────┘
|
||||
│ 1 │ 1
|
||||
│ │
|
||||
│ N │ N
|
||||
┌──────┴───────┐ ┌──────────┴───────────┐
|
||||
│ task_detail │ 1 ────── N │ task_execution │
|
||||
│ 任务模板 │ │ 任务执行记录 │
|
||||
└──────────────┘ └──────────┬───────────┘
|
||||
│ 1
|
||||
│
|
||||
│ N
|
||||
┌──────────┴───────────┐
|
||||
│ feedback │
|
||||
│ 执行反馈 │
|
||||
└──────────────────────┘
|
||||
│ 1
|
||||
│
|
||||
│ N
|
||||
┌──────────┴───────────┐
|
||||
│ feedback_exception │
|
||||
│ 反馈异常 │
|
||||
└──────────────────────┘
|
||||
```
|
||||
|
||||
**关键原则**:
|
||||
- **清单表(task_list)**:纯粹的清单模板定义,不含任何执行相关字段
|
||||
- **任务详情表(task_detail)**:纯粹的任务模板定义,不含任何执行相关字段
|
||||
- **清单下发记录表(task_list_issue)**:清单的一次下发实例,包含执行方、周期、状态、评分
|
||||
- **任务执行表(task_execution)**:任务的一次执行实例,包含执行状态、反馈状态、评分
|
||||
- **反馈表/异常表**:直接关联任务执行表,不再关联任务模板表
|
||||
|
||||
### 3.2 新增表:清单下发记录表
|
||||
|
||||
```sql
|
||||
CREATE TABLE `safety_accountability_task_list_issue` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`task_issue_id` varchar(64) NOT NULL COMMENT '下发记录UUID(业务主键)',
|
||||
`task_list_id` varchar(64) NOT NULL COMMENT '清单UUID(关联清单模板表)',
|
||||
`execute_corp_id` bigint DEFAULT NULL COMMENT '执行公司ID',
|
||||
`execute_department_id` bigint DEFAULT NULL COMMENT '执行部门ID',
|
||||
`execute_user_id` bigint DEFAULT NULL COMMENT '执行人员ID',
|
||||
`issue_status` tinyint DEFAULT '0' COMMENT '下发状态:0-未下发 1-已下发',
|
||||
`issue_time` datetime DEFAULT NULL COMMENT '下发时间',
|
||||
`period_start_time` datetime DEFAULT NULL COMMENT '执行周期开始时间',
|
||||
`period_end_time` datetime DEFAULT NULL COMMENT '执行周期结束时间',
|
||||
`status` tinyint NOT NULL DEFAULT '1' COMMENT '状态:1-进行中 2-已完成 3-已关闭',
|
||||
`close_time` datetime DEFAULT NULL COMMENT '关闭时间',
|
||||
`rating_score` decimal(5,2) DEFAULT NULL COMMENT '评分数(汇总所有任务执行评分)',
|
||||
`rating_user_id` bigint DEFAULT NULL COMMENT '评分人ID',
|
||||
`rating_department_id` bigint DEFAULT NULL COMMENT '评分部门ID',
|
||||
`delete_enum` varchar(32) DEFAULT 'FALSE' COMMENT '删除标识:TRUE/FALSE',
|
||||
`remarks` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
`create_name` varchar(50) DEFAULT NULL COMMENT '创建人姓名',
|
||||
`update_name` varchar(50) DEFAULT NULL COMMENT '更新人姓名',
|
||||
`tenant_id` bigint DEFAULT NULL COMMENT '租户ID',
|
||||
`org_id` bigint DEFAULT NULL COMMENT '单位ID',
|
||||
`version` int DEFAULT '0' COMMENT '版本',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`create_id` bigint DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_id` bigint DEFAULT NULL COMMENT '修改人ID',
|
||||
`env` varchar(50) DEFAULT NULL COMMENT '环境标识',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_task_issue_id` (`task_issue_id`),
|
||||
KEY `idx_task_list_id` (`task_list_id`),
|
||||
KEY `idx_execute_corp_id` (`execute_corp_id`),
|
||||
KEY `idx_execute_user_id` (`execute_user_id`),
|
||||
KEY `idx_status` (`status`),
|
||||
KEY `idx_period_time` (`period_start_time`, `period_end_time`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='清单下发记录表';
|
||||
```
|
||||
|
||||
### 3.3 新增表:任务执行表
|
||||
|
||||
```sql
|
||||
CREATE TABLE `safety_accountability_task_execution` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`task_execution_id` varchar(64) NOT NULL COMMENT '任务执行UUID(业务主键)',
|
||||
`task_issue_id` varchar(64) NOT NULL COMMENT '清单下发记录UUID(关联下发记录表)',
|
||||
`task_detail_id` varchar(64) NOT NULL COMMENT '任务模板UUID(关联任务详情模板表)',
|
||||
`task_list_id` varchar(64) NOT NULL COMMENT '清单UUID(冗余,便于查询)',
|
||||
`task_status` tinyint NOT NULL DEFAULT '1' COMMENT '任务状态:1-进行中 2-已完成 3-已关闭',
|
||||
`feedback_status` tinyint DEFAULT '1' COMMENT '反馈状态:1-正常 2-异常',
|
||||
`task_rating` decimal(5,2) DEFAULT NULL COMMENT '任务评分',
|
||||
`rating_time` datetime DEFAULT NULL COMMENT '评分时间',
|
||||
`rating_department_id` bigint DEFAULT NULL COMMENT '评分部门ID',
|
||||
`rating_user_id` bigint DEFAULT NULL COMMENT '评分人ID',
|
||||
`delete_enum` varchar(32) DEFAULT 'FALSE' COMMENT '删除标识:TRUE/FALSE',
|
||||
`remarks` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
`create_name` varchar(50) DEFAULT NULL COMMENT '创建人姓名',
|
||||
`update_name` varchar(50) DEFAULT NULL COMMENT '更新人姓名',
|
||||
`tenant_id` bigint DEFAULT NULL COMMENT '租户ID',
|
||||
`org_id` bigint DEFAULT NULL COMMENT '单位ID',
|
||||
`version` int DEFAULT '0' COMMENT '版本',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`create_id` bigint DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_id` bigint DEFAULT NULL COMMENT '修改人ID',
|
||||
`env` varchar(50) DEFAULT NULL COMMENT '环境标识',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_task_execution_id` (`task_execution_id`),
|
||||
KEY `idx_task_issue_id` (`task_issue_id`),
|
||||
KEY `idx_task_detail_id` (`task_detail_id`),
|
||||
KEY `idx_task_list_id` (`task_list_id`),
|
||||
KEY `idx_task_status` (`task_status`),
|
||||
KEY `idx_feedback_status` (`feedback_status`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='任务执行记录表';
|
||||
```
|
||||
|
||||
### 3.4 修改表:清单表(瘦身为纯模板)
|
||||
|
||||
```sql
|
||||
-- 从 safety_accountability_task_list 中移除执行相关字段:
|
||||
ALTER TABLE `safety_accountability_task_list`
|
||||
DROP COLUMN `execute_corp_id`,
|
||||
DROP COLUMN `execute_department_id`,
|
||||
DROP COLUMN `execute_user_id`,
|
||||
DROP COLUMN `issue_status`,
|
||||
DROP COLUMN `issue_time`,
|
||||
DROP COLUMN `period_start_time`,
|
||||
DROP COLUMN `period_end_time`,
|
||||
DROP COLUMN `rating_score`,
|
||||
DROP COLUMN `rating_user_id`,
|
||||
DROP COLUMN `rating_department_id`,
|
||||
DROP COLUMN `status`,
|
||||
DROP COLUMN `close_time`;
|
||||
```
|
||||
|
||||
瘦身后的清单表只保留:
|
||||
```
|
||||
safety_accountability_task_list(清单模板表)
|
||||
├── id
|
||||
├── task_list_id → 清单UUID
|
||||
├── task_list_name → 清单名称
|
||||
├── task_level → 任务级别:1-企业级 2-部门级 3-班组级
|
||||
├── responsibility_post → 责任岗位
|
||||
├── switch_flag → 开启/关闭:0-关 1-开
|
||||
├── create_corp_id → 创建公司ID
|
||||
├── create_department_id → 创建部门ID
|
||||
├── create_user_id → 创建人ID
|
||||
└── (基础审计字段)
|
||||
```
|
||||
|
||||
### 3.5 修改表:任务详情表(瘦身为纯模板)
|
||||
|
||||
```sql
|
||||
-- 从 safety_accountability_task_detail 中移除执行相关字段:
|
||||
ALTER TABLE `safety_accountability_task_detail`
|
||||
DROP COLUMN `task_status`,
|
||||
DROP COLUMN `feedback_status`,
|
||||
DROP COLUMN `task_rating`,
|
||||
DROP COLUMN `rating_time`,
|
||||
DROP COLUMN `rating_department_id`,
|
||||
DROP COLUMN `rating_user_id`;
|
||||
```
|
||||
|
||||
瘦身后的任务详情表只保留:
|
||||
```
|
||||
safety_accountability_task_detail(任务模板表)
|
||||
├── id
|
||||
├── task_detail_id → 任务UUID
|
||||
├── task_list_id → 关联清单UUID
|
||||
├── execute_content → 执行内容
|
||||
├── feedback_cycle_type → 反馈周期类型:1-每月 2-季度 3-半年 4-年
|
||||
├── task_score → 任务分值
|
||||
└── (基础审计字段)
|
||||
```
|
||||
|
||||
### 3.6 修改表:反馈表(关联任务执行表)
|
||||
|
||||
```sql
|
||||
-- 反馈表改为关联任务执行表
|
||||
ALTER TABLE `safety_accountability_feedback`
|
||||
ADD COLUMN `task_execution_id` varchar(64) DEFAULT NULL COMMENT '任务执行UUID(关联任务执行表)' AFTER `task_detail_id`,
|
||||
ADD COLUMN `task_issue_id` varchar(64) DEFAULT NULL COMMENT '清单下发记录UUID(冗余)' AFTER `task_list_id`,
|
||||
ADD KEY `idx_task_execution_id` (`task_execution_id`),
|
||||
ADD KEY `idx_task_issue_id` (`task_issue_id`);
|
||||
```
|
||||
|
||||
> `task_detail_id` 和 `task_list_id` 可保留作为冗余字段便于查询,也可后续移除。
|
||||
|
||||
### 3.7 修改表:反馈异常表(关联任务执行表)
|
||||
|
||||
```sql
|
||||
-- 反馈异常表改为关联任务执行表
|
||||
ALTER TABLE `safety_accountability_feedback_exception`
|
||||
ADD COLUMN `task_execution_id` varchar(64) DEFAULT NULL COMMENT '任务执行UUID(关联任务执行表)' AFTER `task_detail_id`,
|
||||
ADD COLUMN `task_issue_id` varchar(64) DEFAULT NULL COMMENT '清单下发记录UUID(冗余)' AFTER `task_list_id`,
|
||||
ADD KEY `idx_task_execution_id` (`task_execution_id`),
|
||||
ADD KEY `idx_task_issue_id` (`task_issue_id`);
|
||||
```
|
||||
|
||||
## 四、新数据模型总览
|
||||
|
||||
### 4.1 表结构变更总览
|
||||
|
||||
| 表名 | 变更类型 | 定位 | 说明 |
|
||||
|------|----------|------|------|
|
||||
| `safety_accountability_task_list` | **修改** | 模板层 | 移除执行方、下发、周期、状态、评分相关字段,仅保留清单定义 |
|
||||
| `safety_accountability_task_detail` | **修改** | 模板层 | 移除状态、反馈状态、评分相关字段,仅保留任务定义 |
|
||||
| `safety_accountability_task_list_issue` | **新增** | 实例层 | 清单下发记录,承载执行方/下发/周期/状态/评分 |
|
||||
| `safety_accountability_task_execution` | **新增** | 实例层 | 任务执行记录,承载任务执行状态/反馈状态/评分 |
|
||||
| `safety_accountability_feedback` | **修改** | 实例层 | 新增 `task_execution_id`、`task_issue_id` 字段 |
|
||||
| `safety_accountability_feedback_exception` | **修改** | 实例层 | 新增 `task_execution_id`、`task_issue_id` 字段 |
|
||||
|
||||
### 4.2 字段迁移对照
|
||||
|
||||
**清单表 → 下发记录表**
|
||||
|
||||
| 原位置(task_list) | 新位置(task_list_issue) | 说明 |
|
||||
|---------------------|--------------------------|------|
|
||||
| execute_corp_id | execute_corp_id | 执行公司ID |
|
||||
| execute_department_id | execute_department_id | 执行部门ID |
|
||||
| execute_user_id | execute_user_id | 执行人员ID |
|
||||
| issue_status | issue_status | 下发状态 |
|
||||
| issue_time | issue_time | 下发时间 |
|
||||
| period_start_time | period_start_time | 周期开始时间 |
|
||||
| period_end_time | period_end_time | 周期结束时间 |
|
||||
| status | status | 状态 |
|
||||
| close_time | close_time | 关闭时间 |
|
||||
| rating_score | rating_score | 评分数 |
|
||||
| rating_user_id | rating_user_id | 评分人ID |
|
||||
| rating_department_id | rating_department_id | 评分部门ID |
|
||||
|
||||
**任务详情表 → 任务执行表**
|
||||
|
||||
| 原位置(task_detail) | 新位置(task_execution) | 说明 |
|
||||
|-----------------------|-------------------------|------|
|
||||
| task_status | task_status | 任务状态 |
|
||||
| feedback_status | feedback_status | 反馈状态 |
|
||||
| task_rating | task_rating | 任务评分 |
|
||||
| rating_time | rating_time | 评分时间 |
|
||||
| rating_department_id | rating_department_id | 评分部门ID |
|
||||
| rating_user_id | rating_user_id | 评分人ID |
|
||||
|
||||
### 4.3 完整数据模型关系图
|
||||
|
||||
```
|
||||
┌─────────────────────────┐
|
||||
│ task_list(清单模板) │
|
||||
│ - task_list_id (UK) │
|
||||
│ - task_list_name │
|
||||
│ - task_level │
|
||||
│ - responsibility_post │
|
||||
│ - switch_flag │
|
||||
│ - create_corp_id │
|
||||
└────────┬────────────────┘
|
||||
│ 1:N
|
||||
│
|
||||
┌────────┴────────────────┐ ┌──────────────────────────────┐
|
||||
│ task_detail(任务模板) │ │ task_list_issue(下发记录) │
|
||||
│ - task_detail_id (UK) │ │ - task_issue_id (UK) │
|
||||
│ - task_list_id (FK) │ │ - task_list_id (FK→模板) │
|
||||
│ - execute_content │ │ - execute_corp_id │
|
||||
│ - feedback_cycle_type │ │ - execute_department_id │
|
||||
│ - task_score │ │ - execute_user_id │
|
||||
└──────────────────────────┘ │ - issue_status │
|
||||
│ - issue_time │
|
||||
│ 1:N │ - period_start_time │
|
||||
│ │ - period_end_time │
|
||||
│ │ - status │
|
||||
│ │ - close_time │
|
||||
│ │ - rating_score │
|
||||
│ │ - rating_user_id │
|
||||
│ │ - rating_department_id │
|
||||
│ └──────────┬───────────────────┘
|
||||
│ │ 1:N
|
||||
│ │
|
||||
│ ┌─────────────────────────┴───────────────────┐
|
||||
│ │ task_execution(任务执行记录) │
|
||||
│ │ - task_execution_id (UK) │
|
||||
├───────────│ - task_issue_id (FK→下发记录) │
|
||||
│ N:1 │ - task_detail_id (FK→任务模板) │
|
||||
│ │ - task_list_id (冗余FK→清单模板) │
|
||||
│ │ - task_status │
|
||||
│ │ - feedback_status │
|
||||
│ │ - task_rating │
|
||||
│ │ - rating_time │
|
||||
│ │ - rating_department_id │
|
||||
│ │ - rating_user_id │
|
||||
│ └──────────────────────┬──────────────────────┘
|
||||
│ │ 1:N
|
||||
│ │
|
||||
│ ┌──────────────┴──────────────┐
|
||||
│ │ │
|
||||
│ ┌───────┴────────┐ ┌────────┴──────────┐
|
||||
│ │ feedback │ │ feedback_ │
|
||||
│ │ (执行反馈) │ │ exception │
|
||||
│ │ - feedback_id │ │ (反馈异常) │
|
||||
│ │ - task_ │ │ - feedback_ │
|
||||
│ │ execution_id│ │ exception_id │
|
||||
│ │ - task_list_ │ │ - task_ │
|
||||
│ │ issue_id │ │ execution_id │
|
||||
│ │ - task_detail_│ │ - task_list_ │
|
||||
│ │ id (冗余) │ │ issue_id │
|
||||
│ │ - task_list_id│ │ - task_detail_id │
|
||||
│ │ (冗余) │ │ (冗余) │
|
||||
│ └────────────────┘ └───────────────────┘
|
||||
│
|
||||
(task_detail 与 task_execution 通过 task_detail_id 关联,
|
||||
同一任务模板可被多个下发记录实例化为多条执行记录)
|
||||
```
|
||||
|
||||
## 五、代码改动点
|
||||
|
||||
### 5.1 领域层(web-domain)
|
||||
|
||||
| 文件 | 改动类型 | 说明 |
|
||||
|------|----------|------|
|
||||
| `domain/model/tasklist/TaskListE.java` | 修改 | 移除执行方、下发、周期、状态、评分相关字段 |
|
||||
| `domain/model/tasklist/TaskDetailE.java` | 修改 | 移除状态、反馈状态、评分相关字段,仅保留模板字段 |
|
||||
| `domain/model/tasklist/TaskListIssueE.java` | **新增** | 清单下发记录领域模型 |
|
||||
| `domain/model/tasklist/TaskExecutionE.java` | **新增** | 任务执行记录领域模型 |
|
||||
| `domain/gateway/tasklist/TaskListIssueGateway.java` | **新增** | 清单下发记录网关接口 |
|
||||
| `domain/gateway/tasklist/TaskExecutionGateway.java` | **新增** | 任务执行记录网关接口 |
|
||||
| `domain/gateway/tasklist/TaskListGateway.java` | 修改 | 移除 `listExpiredInProgress`、`listIssuedWithPeriod` 等方法(迁移到 TaskListIssueGateway) |
|
||||
| `domain/gateway/tasklist/TaskDetailGateway.java` | 修改 | 移除 `listInProgress` 等方法(迁移到 TaskExecutionGateway) |
|
||||
| `domain/model/tasklist/FeedbackE.java` | 修改 | 新增 `taskExecutionId`、`taskListIssueId` 字段 |
|
||||
| `domain/model/tasklist/FeedbackExceptionE.java` | 修改 | 新增 `taskExecutionId`、`taskListIssueId` 字段 |
|
||||
|
||||
### 5.2 基础设施层(web-infrastructure)
|
||||
|
||||
| 文件 | 改动类型 | 说明 |
|
||||
|------|----------|------|
|
||||
| `persistence/dataobject/tasklist/TaskListDO.java` | 修改 | 移除执行方、下发、周期、状态、评分相关字段 |
|
||||
| `persistence/dataobject/tasklist/TaskDetailDO.java` | 修改 | 移除状态、反馈状态、评分相关字段 |
|
||||
| `persistence/dataobject/tasklist/TaskListIssueDO.java` | **新增** | 清单下发记录数据对象 |
|
||||
| `persistence/dataobject/tasklist/TaskExecutionDO.java` | **新增** | 任务执行记录数据对象 |
|
||||
| `persistence/dataobject/tasklist/FeedbackDO.java` | 修改 | 新增 `taskExecutionId`、`taskListIssueId` 字段 |
|
||||
| `persistence/dataobject/tasklist/FeedbackExceptionDO.java` | 修改 | 新增 `taskExecutionId`、`taskListIssueId` 字段 |
|
||||
| `persistence/mapper/tasklist/TaskListMapper.xml` | 修改 | 移除执行方相关联表查询和统计SQL |
|
||||
| `persistence/mapper/tasklist/TaskDetailMapper.xml` | 修改 | 移除执行状态相关查询 |
|
||||
| `persistence/mapper/tasklist/TaskListIssueMapper.java` | **新增** | 清单下发记录Mapper接口 |
|
||||
| `persistence/mapper/tasklist/TaskListIssueMapper.xml` | **新增** | 清单下发记录Mapper XML(含联表查询和统计SQL) |
|
||||
| `persistence/mapper/tasklist/TaskExecutionMapper.java` | **新增** | 任务执行记录Mapper接口 |
|
||||
| `persistence/mapper/tasklist/TaskExecutionMapper.xml` | **新增** | 任务执行记录Mapper XML |
|
||||
| `persistence/repository/tasklist/TaskListIssueRepository.java` | **新增** | 清单下发记录Repository |
|
||||
| `persistence/repository/tasklist/TaskExecutionRepository.java` | **新增** | 任务执行记录Repository |
|
||||
| `gatewayimpl/tasklist/TaskListIssueGatewayImpl.java` | **新增** | 清单下发记录网关实现 |
|
||||
| `gatewayimpl/tasklist/TaskExecutionGatewayImpl.java` | **新增** | 任务执行记录网关实现 |
|
||||
| `gatewayimpl/tasklist/TaskListGatewayImpl.java` | 修改 | 移除与执行方相关的方法实现 |
|
||||
| `gatewayimpl/tasklist/TaskDetailGatewayImpl.java` | 修改 | 移除与执行状态相关的方法实现 |
|
||||
|
||||
### 5.3 客户端层(web-client)
|
||||
|
||||
| 文件 | 改动类型 | 说明 |
|
||||
|------|----------|------|
|
||||
| `dto/clientobject/tasklist/TaskListCO.java` | 修改 | 移除执行方、下发、周期、状态、评分相关字段 |
|
||||
| `dto/clientobject/tasklist/TaskDetailCO.java` | 修改 | 移除状态、反馈状态、评分相关字段 |
|
||||
| `dto/clientobject/tasklist/TaskListIssueCO.java` | **新增** | 清单下发记录客户端对象 |
|
||||
| `dto/clientobject/tasklist/TaskExecutionCO.java` | **新增** | 任务执行记录客户端对象 |
|
||||
| `dto/tasklist/TaskListIssueCmd.java` | 修改 | 改为支持多公司下发(接收公司列表) |
|
||||
| `dto/tasklist/TaskListPageQry.java` | 修改 | 移除 executeCorpId、executeUserId 查询条件 |
|
||||
| `dto/tasklist/TaskListIssuePageQry.java` | **新增** | 下发记录分页查询参数 |
|
||||
| `dto/tasklist/TaskExecutionPageQry.java` | **新增** | 任务执行记录分页查询参数 |
|
||||
| `dto/tasklist/TaskDetailUpdateScoreCmd.java` | 修改 | 改为传 `taskExecutionId` 而非 `taskDetailId` |
|
||||
|
||||
### 5.4 应用层(web-app)
|
||||
|
||||
| 文件 | 改动类型 | 说明 |
|
||||
|------|----------|------|
|
||||
| `command/tasklist/TaskListIssueExe.java` | **重写** | 核心改动:下发时为每个公司创建一条下发记录,并为每条记录复制所有任务模板为任务执行记录 |
|
||||
| `command/tasklist/TaskListCloseExe.java` | 修改 | 关闭下发记录而非清单 |
|
||||
| `command/tasklist/TaskListStatusUpdateExe.java` | 修改 | 定时任务1:查询并更新过期的下发记录和任务执行记录 |
|
||||
| `command/tasklist/FeedbackExceptionCheckExe.java` | 修改 | 定时任务2:查询已下发的下发记录,检查任务执行记录的反馈 |
|
||||
| `command/tasklist/TaskDetailUpdateScoreExe.java` | 修改 | 评分操作的是任务执行记录,评分汇总同步到下发记录 |
|
||||
| `command/tasklist/TaskListAddExe.java` | 修改 | 新增清单时不再设置下发相关字段 |
|
||||
| `command/tasklist/TaskListUpdateExe.java` | 修改 | 修改清单时不再涉及执行方字段 |
|
||||
| `command/tasklist/TaskListSwitchExe.java` | 修改 | 关闭清单时需考虑是否影响所有下发记录 |
|
||||
| `command/tasklist/TaskListRemoveExe.java` | 修改 | 删除清单时需级联删除下发记录和任务执行记录 |
|
||||
| `command/tasklist/TaskDetailSaveExe.java` | 修改 | 保存任务模板,不再涉及执行状态 |
|
||||
| `command/tasklist/TaskDetailSaveBatchExe.java` | 修改 | 批量保存任务模板 |
|
||||
| `command/tasklist/TaskDetailEditExe.java` | 修改 | 编辑任务模板 |
|
||||
| `command/tasklist/TaskDetailCloseExe.java` | 修改 | 关闭任务执行记录而非任务模板 |
|
||||
| `command/tasklist/FeedbackAddExe.java` | 修改 | 反馈关联到任务执行记录 |
|
||||
| `command/tasklist/FeedbackDeleteExe.java` | 修改 | 删除反馈关联到任务执行记录 |
|
||||
| `command/tasklist/FeedbackEditExe.java` | 修改 | 编辑反馈关联到任务执行记录 |
|
||||
| `command/query/tasklist/TaskListQueryExe.java` | 修改 | 清单列表查询不再关联执行方信息 |
|
||||
| `command/query/tasklist/TaskDetailQueryExe.java` | 修改 | 任务查询拆分为模板查询和执行记录查询 |
|
||||
| `command/query/tasklist/TaskListIssueQueryExe.java` | **新增** | 下发记录查询执行器 |
|
||||
| `command/query/tasklist/TaskExecutionQueryExe.java` | **新增** | 任务执行记录查询执行器 |
|
||||
| `command/query/tasklist/StatisticsQueryExe.java` | 修改 | 统计SQL改为基于下发记录表 |
|
||||
| `command/query/tasklist/FeedbackQueryExe.java` | 修改 | 反馈查询关联到任务执行记录 |
|
||||
|
||||
### 5.5 适配层(web-adapter)
|
||||
|
||||
| 文件 | 改动类型 | 说明 |
|
||||
|------|----------|------|
|
||||
| `web/tasklist/TaskListController.java` | 修改 | 下发接口参数变更,清单CRUD仅操作模板 |
|
||||
| `web/tasklist/TaskListIssueController.java` | **新增** | 清单下发记录控制器(查询/关闭下发记录等) |
|
||||
| `web/tasklist/TaskDetailController.java` | 修改 | 任务模板CRUD + 评分/关闭改为操作任务执行记录 |
|
||||
| `web/tasklist/TaskExecutionController.java` | **新增** | 任务执行记录控制器(查询/关闭/评分等) |
|
||||
| `web/tasklist/FeedbackController.java` | 修改 | 反馈接口关联到任务执行记录 |
|
||||
|
||||
## 六、核心业务逻辑变更
|
||||
|
||||
### 6.1 下发流程(变更最大)
|
||||
|
||||
**原流程**:
|
||||
1. 选择清单 → 选择一个公司/部门/人员 → 设置周期 → 更新清单的执行方字段和下发状态
|
||||
|
||||
**新流程**:
|
||||
1. 选择清单 → 选择多个公司 → 设置周期
|
||||
2. 为每个公司创建一条 `task_list_issue` 记录(含执行方、周期、下发状态)
|
||||
3. 为每条下发记录,遍历清单下所有 `task_detail`(任务模板),创建对应的 `task_execution`(任务执行记录)
|
||||
4. 清单模板本身不变
|
||||
|
||||
### 6.2 反馈流程
|
||||
|
||||
**原流程**:反馈关联到 `task_detail_id`
|
||||
|
||||
**新流程**:反馈关联到 `task_execution_id`(任务执行记录),同时冗余 `task_issue_id` 和 `task_detail_id`
|
||||
|
||||
### 6.3 评分流程
|
||||
|
||||
**原流程**:对任务评分 → 汇总到清单的 `rating_score`
|
||||
|
||||
**新流程**:
|
||||
1. 对任务执行记录(`task_execution`)评分
|
||||
2. 检查该下发记录下所有任务执行记录是否都已评分
|
||||
3. 若全部已评分 → 汇总到下发记录(`task_list_issue`)的 `rating_score`
|
||||
|
||||
### 6.4 定时任务1(过期状态更新)
|
||||
|
||||
**原流程**:查询 `task_list` 中 `status=1` 且过期的清单 → 更新清单和任务状态
|
||||
|
||||
**新流程**:查询 `task_issue` 中 `status=1` 且过期的下发记录 → 更新下发记录状态和对应任务执行记录状态
|
||||
|
||||
### 6.5 定时任务2(反馈异常检测)
|
||||
|
||||
**原流程**:查询已下发的清单 → 检查任务反馈
|
||||
|
||||
**新流程**:查询已下发的下发记录 → 检查对应任务执行记录的反馈
|
||||
|
||||
### 6.6 统计查询
|
||||
|
||||
**原流程**:按 `task_list.execute_corp_id` 分组统计
|
||||
|
||||
**新流程**:按 `task_issue.execute_corp_id` 分组统计
|
||||
|
||||
### 6.7 清单修改对已下发记录的影响
|
||||
|
||||
修改清单模板(增删改任务)时,需要考虑是否影响已下发的记录:
|
||||
- **方案A(推荐)**:已下发的记录不受影响,修改模板只影响后续新下发
|
||||
- **方案B**:修改模板时同步更新所有进行中的下发记录(复杂度高)
|
||||
|
||||
## 七、接口变更
|
||||
|
||||
### 7.1 清单模板接口(简化)
|
||||
|
||||
| 接口 | 变更类型 | 说明 |
|
||||
|------|----------|------|
|
||||
| `POST /taskList/list` | 修改 | 返回数据移除执行方相关字段 |
|
||||
| `POST /taskList/save` | 修改 | 仅保存清单模板 |
|
||||
| `POST /taskList/edit` | 修改 | 仅修改清单模板 |
|
||||
| `POST /taskList/delete/{id}` | 修改 | 删除时级联检查下发记录 |
|
||||
| `POST /taskList/switchFlag` | 修改 | 开关仅影响模板 |
|
||||
| `POST /taskList/issue` | **重写** | 参数从单个公司改为公司列表 |
|
||||
|
||||
### 7.2 清单下发记录接口(新增)
|
||||
|
||||
| 接口 | 变更类型 | 说明 |
|
||||
|------|----------|------|
|
||||
| `POST /taskListIssue/list` | **新增** | 查询下发记录列表 |
|
||||
| `GET /taskListIssue/{issueId}` | **新增** | 获取下发记录详情 |
|
||||
| `POST /taskListIssue/close` | **新增** | 关闭某条下发记录 |
|
||||
|
||||
### 7.3 任务模板接口(简化)
|
||||
|
||||
| 接口 | 变更类型 | 说明 |
|
||||
|------|----------|------|
|
||||
| `POST /taskDetail/save` | 修改 | 仅保存任务模板 |
|
||||
| `POST /taskDetail/saveBatch` | 修改 | 仅批量保存任务模板 |
|
||||
| `GET /taskDetail/{detailId}` | 修改 | 获取任务模板详情 |
|
||||
|
||||
### 7.4 任务执行记录接口(新增)
|
||||
|
||||
| 接口 | 变更类型 | 说明 |
|
||||
|------|----------|------|
|
||||
| `POST /taskExecution/list` | **新增** | 查询任务执行记录列表 |
|
||||
| `GET /taskExecution/{executionId}` | **新增** | 获取任务执行记录详情 |
|
||||
| `POST /taskExecution/close` | **新增** | 关闭任务执行记录 |
|
||||
| `POST /taskExecution/updateScore` | **新增** | 对任务执行记录评分 |
|
||||
|
||||
### 7.5 反馈接口(修改)
|
||||
|
||||
| 接口 | 变更类型 | 说明 |
|
||||
|------|----------|------|
|
||||
| `POST /feedback/add` | 修改 | 关联到 `taskExecutionId` |
|
||||
| `POST /feedback/edit` | 修改 | 关联到 `taskExecutionId` |
|
||||
| `POST /feedback/list` | 修改 | 按 `taskExecutionId` 查询 |
|
||||
|
||||
### 7.6 统计接口(修改)
|
||||
|
||||
| 接口 | 变更类型 | 说明 |
|
||||
|------|----------|------|
|
||||
| 统计相关接口 | 修改 | 改为基于下发记录表统计 |
|
||||
|
||||
## 八、数据迁移方案
|
||||
|
||||
```sql
|
||||
-- =============================================
|
||||
-- 1. 创建新表
|
||||
-- =============================================
|
||||
|
||||
-- 1.1 创建清单下发记录表(见 3.2)
|
||||
-- 1.2 创建任务执行记录表(见 3.3)
|
||||
|
||||
-- =============================================
|
||||
-- 2. 迁移清单执行数据 → 下发记录表
|
||||
-- =============================================
|
||||
INSERT INTO safety_accountability_task_list_issue (
|
||||
task_issue_id, task_list_id,
|
||||
execute_corp_id, execute_department_id, execute_user_id,
|
||||
issue_status, issue_time, period_start_time, period_end_time,
|
||||
status, close_time, rating_score, rating_user_id, rating_department_id,
|
||||
delete_enum, remarks, create_name, update_name,
|
||||
tenant_id, org_id, version, create_time, update_time, create_id, update_id, env
|
||||
)
|
||||
SELECT
|
||||
task_list_id AS task_issue_id, -- 用原task_list_id作为下发记录ID,保持兼容
|
||||
task_list_id,
|
||||
execute_corp_id, execute_department_id, execute_user_id,
|
||||
issue_status, issue_time, period_start_time, period_end_time,
|
||||
status, close_time, rating_score, rating_user_id, rating_department_id,
|
||||
delete_enum, remarks, create_name, update_name,
|
||||
tenant_id, org_id, version, create_time, update_time, create_id, update_id, env
|
||||
FROM safety_accountability_task_list
|
||||
WHERE issue_status = 1 AND delete_enum = 'FALSE';
|
||||
|
||||
-- =============================================
|
||||
-- 3. 迁移任务执行数据 → 任务执行记录表
|
||||
-- =============================================
|
||||
INSERT INTO safety_accountability_task_execution (
|
||||
task_execution_id, task_issue_id, task_detail_id, task_list_id,
|
||||
task_status, feedback_status, task_rating, rating_time,
|
||||
rating_department_id, rating_user_id,
|
||||
delete_enum, remarks, create_name, update_name,
|
||||
tenant_id, org_id, version, create_time, update_time, create_id, update_id, env
|
||||
)
|
||||
SELECT
|
||||
td.task_detail_id AS task_execution_id, -- 用原task_detail_id作为执行记录ID
|
||||
td.task_list_id AS task_issue_id, -- 关联到下发记录
|
||||
td.task_detail_id, -- 关联到任务模板
|
||||
td.task_list_id,
|
||||
td.task_status, td.feedback_status, td.task_rating, td.rating_time,
|
||||
td.rating_department_id, td.rating_user_id,
|
||||
td.delete_enum, td.remarks, td.create_name, td.update_name,
|
||||
td.tenant_id, td.org_id, td.version, td.create_time, td.update_time, td.create_id, td.update_id, td.env
|
||||
FROM safety_accountability_task_detail td
|
||||
INNER JOIN safety_accountability_task_list tl ON td.task_list_id = tl.task_list_id
|
||||
WHERE tl.issue_status = 1 AND td.delete_enum = 'FALSE';
|
||||
|
||||
-- =============================================
|
||||
-- 4. 补充反馈表关联字段
|
||||
-- =============================================
|
||||
UPDATE safety_accountability_feedback fb
|
||||
INNER JOIN safety_accountability_task_execution te ON fb.task_detail_id = te.task_detail_id
|
||||
SET fb.task_execution_id = te.task_execution_id,
|
||||
fb.task_issue_id = te.task_issue_id
|
||||
WHERE fb.delete_enum = 'FALSE';
|
||||
|
||||
-- =============================================
|
||||
-- 5. 补充反馈异常表关联字段
|
||||
-- =============================================
|
||||
UPDATE safety_accountability_feedback_exception fe
|
||||
INNER JOIN safety_accountability_task_execution te ON fe.task_detail_id = te.task_detail_id
|
||||
SET fe.task_execution_id = te.task_execution_id,
|
||||
fe.task_issue_id = te.task_issue_id
|
||||
WHERE fe.delete_enum = 'FALSE';
|
||||
|
||||
-- =============================================
|
||||
-- 6. 迁移完成后,清理原表中的执行相关字段
|
||||
-- =============================================
|
||||
-- 见 3.4 和 3.5 的 ALTER TABLE 语句
|
||||
```
|
||||
|
||||
## 九、改动优先级与建议
|
||||
|
||||
### 高优先级(核心改动)
|
||||
1. 创建 `task_list_issue` 表和 `task_execution` 表及对应的领域模型、网关、Repository
|
||||
2. 重写 `TaskListIssueExe`(下发逻辑:创建下发记录 + 复制任务模板为执行记录)
|
||||
3. 新增 `TaskExecutionUpdateScoreExe`(评分操作任务执行记录,汇总同步到下发记录)
|
||||
4. 修改 `TaskListStatusUpdateExe`(定时任务1:操作下发记录和任务执行记录)
|
||||
5. 修改 `FeedbackExceptionCheckExe`(定时任务2:操作下发记录和任务执行记录)
|
||||
|
||||
### 中优先级(查询和统计)
|
||||
6. 修改所有 Mapper XML 中的联表查询和统计 SQL
|
||||
7. 修改查询执行器(TaskListQueryExe、TaskDetailQueryExe、StatisticsQueryExe)
|
||||
8. 新增下发记录和任务执行记录的查询接口
|
||||
9. 修改反馈相关查询(关联到任务执行记录)
|
||||
|
||||
### 低优先级(DTO和前端适配)
|
||||
10. 修改所有 DTO/CO 对象
|
||||
11. 修改 Controller 接口
|
||||
12. 前端页面适配
|
||||
|
|
@ -1,384 +0,0 @@
|
|||
# 安全责任清单后端开发文档
|
||||
|
||||
## 一、概述
|
||||
|
||||
### 1.1 项目结构
|
||||
|
||||
项目采用六边形架构(Hexagonal Architecture),遵循 CQRS 模式:
|
||||
|
||||
```
|
||||
zcloud_gbs_safety_accountability_list/
|
||||
├── start/ # 应用启动入口
|
||||
├── web-adapter/ # 控制器层(REST API)
|
||||
├── web-app/ # 应用服务层(Command/Query 执行器)
|
||||
├── web-domain/ # 领域模型层
|
||||
├── web-infrastructure/ # 基础设施层(持久化实现)
|
||||
└── web-client/ # 客户端层(DTO、CO、Cmd、Qry)
|
||||
```
|
||||
|
||||
### 1.2 模块职责
|
||||
|
||||
| 模块 | 职责 |
|
||||
|-----|------|
|
||||
| web-adapter | Controller 层,负责接收 HTTP 请求,调用 Service |
|
||||
| web-app | 应用层,包含 Command(写操作)和 Query(读操作)执行器 |
|
||||
| web-domain | 领域层,包含领域模型、枚举、Gateway 接口 |
|
||||
| web-infrastructure | 基础设施层,包含 DO、Repository、Mapper 实现 |
|
||||
| web-client | 客户端层,包含 DTO(Cmd、Qry)和 CO(Client Object) |
|
||||
|
||||
### 1.3 命名规范
|
||||
|
||||
| 类型 | 命名规范 | 示例 |
|
||||
|-----|---------|------|
|
||||
| Controller | `{Entity}Controller` | `TaskListController` |
|
||||
| Service 接口 | `{Entity}ServiceI` | `TaskListServiceI` |
|
||||
| Command | `{Entity}AddCmd`、`{Entity}UpdateCmd` | `TaskListAddCmd` |
|
||||
| Query | `{Entity}PageQry`、`{Entity}Qry` | `TaskListPageQry` |
|
||||
| Client Object | `{Entity}CO` | `TaskListCO` |
|
||||
| Data Object | `{Entity}DO` | `TaskListDO` |
|
||||
| Gateway | `{Entity}Gateway` | `TaskListGateway` |
|
||||
| Repository | `{Entity}Repository` | `TaskListRepository` |
|
||||
| Mapper | `{Entity}Mapper` | `TaskListMapper` |
|
||||
| AddExe | `{Entity}AddExe` | `TaskListAddExe` |
|
||||
| QueryExe | `{Entity}QueryExe` | `TaskListQueryExe` |
|
||||
| Convertor | `{Entity}CoConvertor` | `TaskListCoConvertor` |
|
||||
|
||||
---
|
||||
|
||||
## 二、数据库表结构
|
||||
|
||||
### 2.1 表清单
|
||||
|
||||
| 序号 | 表名 | 表中文名 |
|
||||
|-----|------|---------|
|
||||
| 1 | safety_accountability_task_list | 任务清单表 |
|
||||
| 2 | safety_accountability_task_detail | 任务清单详细表 |
|
||||
| 3 | safety_accountability_feedback | 执行反馈表 |
|
||||
| 4 | safety_accountability_feedback_exception | 反馈异常信息表 |
|
||||
|
||||
### 2.2 完整建表 SQL
|
||||
|
||||
```sql
|
||||
-- =============================================
|
||||
-- 任务清单表
|
||||
-- =============================================
|
||||
CREATE TABLE `safety_accountability_task_list` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`task_list_id` varchar(64) NOT NULL COMMENT '清单UUID(业务主键)',
|
||||
`task_list_name` varchar(255) NOT NULL COMMENT '清单名称',
|
||||
`task_level` tinyint(2) NOT NULL COMMENT '任务级别:1-企业级 2-部门级 3-班组级',
|
||||
`responsibility_post` varchar(255) DEFAULT NULL COMMENT '责任岗位',
|
||||
`switch_flag` tinyint(1) NOT NULL DEFAULT '1' COMMENT '开启/关闭:0-关 1-开',
|
||||
`status` tinyint(2) NOT NULL DEFAULT '1' COMMENT '状态:1-进行中 2-已完成 3-已关闭',
|
||||
`period_start_time` datetime NOT NULL COMMENT '执行周期开始时间',
|
||||
`period_end_time` datetime NOT NULL COMMENT '执行周期结束时间',
|
||||
`score` decimal(5,2) DEFAULT NULL COMMENT '评分数',
|
||||
`score_user_id` bigint(20) DEFAULT NULL COMMENT '评分人ID',
|
||||
`score_department_id` bigint(20) DEFAULT NULL COMMENT '评分部门ID',
|
||||
`create_corp_id` bigint(20) DEFAULT NULL COMMENT '创建公司ID',
|
||||
`create_department_id` bigint(20) DEFAULT NULL COMMENT '创建部门ID',
|
||||
`create_user_id` bigint(20) DEFAULT NULL COMMENT '创建人ID',
|
||||
`issue_status` tinyint(4) DEFAULT '0' COMMENT '下发状态:0-未下发 1-已下发',
|
||||
`issue_time` datetime DEFAULT NULL COMMENT '下发时间',
|
||||
`execute_corp_id` bigint(20) DEFAULT NULL COMMENT '执行公司ID',
|
||||
`execute_department_id` bigint(20) DEFAULT NULL COMMENT '执行部门ID',
|
||||
`execute_user_id` bigint(20) DEFAULT NULL COMMENT '执行人员ID',
|
||||
`close_time` datetime DEFAULT NULL COMMENT '关闭时间',
|
||||
`delete_enum` varchar(32) DEFAULT 'FALSE' COMMENT '删除标识:TRUE/FALSE',
|
||||
`remarks` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
`create_name` varchar(50) DEFAULT NULL COMMENT '创建人姓名',
|
||||
`update_name` varchar(50) DEFAULT NULL COMMENT '更新人姓名',
|
||||
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户ID',
|
||||
`org_id` bigint(20) DEFAULT NULL COMMENT '单位ID',
|
||||
`version` int(11) DEFAULT '0' COMMENT '版本',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`create_id` bigint(20) DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_id` bigint(20) DEFAULT NULL COMMENT '修改人ID',
|
||||
`env` varchar(50) DEFAULT NULL COMMENT '环境标识',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_task_list_id` (`task_list_id`),
|
||||
KEY `idx_create_corp_id` (`create_corp_id`),
|
||||
KEY `idx_execute_corp_id` (`execute_corp_id`),
|
||||
KEY `idx_execute_user_id` (`execute_user_id`),
|
||||
KEY `idx_status` (`status`),
|
||||
KEY `idx_period_time` (`period_start_time`, `period_end_time`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='任务清单表';
|
||||
|
||||
-- =============================================
|
||||
-- 任务清单详细表
|
||||
-- =============================================
|
||||
CREATE TABLE `safety_accountability_task_detail` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`task_detail_id` varchar(64) NOT NULL COMMENT '任务详情UUID(业务主键)',
|
||||
`task_list_id` varchar(64) NOT NULL COMMENT '任务清单主键(关联任务清单表)',
|
||||
`execute_content` text COMMENT '执行内容',
|
||||
`feedback_cycle` tinyint(4) NOT NULL COMMENT '反馈周期:1-每月 2-季度 3-半年 4-年',
|
||||
`task_status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '任务状态:1-进行中 2-已完成 3-已关闭',
|
||||
`feedback_status` tinyint(4) DEFAULT '1' COMMENT '反馈状态:1-正常 2-存在异常',
|
||||
`task_score` decimal(5,2) DEFAULT NULL COMMENT '任务分值',
|
||||
`task_rating` decimal(5,2) DEFAULT NULL COMMENT '任务评分',
|
||||
`score_time` datetime DEFAULT NULL COMMENT '评分时间',
|
||||
`score_department_id` bigint(20) DEFAULT NULL COMMENT '评分部门ID',
|
||||
`score_user_id` bigint(20) DEFAULT NULL COMMENT '评分人ID',
|
||||
`delete_enum` varchar(32) DEFAULT 'FALSE' COMMENT '删除标识:TRUE/FALSE',
|
||||
`remarks` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
`create_name` varchar(50) DEFAULT NULL COMMENT '创建人姓名',
|
||||
`update_name` varchar(50) DEFAULT NULL COMMENT '更新人姓名',
|
||||
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户ID',
|
||||
`org_id` bigint(20) DEFAULT NULL COMMENT '单位ID',
|
||||
`version` int(11) DEFAULT '0' COMMENT '版本',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`create_id` bigint(20) DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_id` bigint(20) DEFAULT NULL COMMENT '修改人ID',
|
||||
`env` varchar(50) DEFAULT NULL COMMENT '环境标识',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_task_detail_id` (`task_detail_id`),
|
||||
KEY `idx_task_list_id` (`task_list_id`),
|
||||
KEY `idx_task_status` (`task_status`),
|
||||
KEY `idx_feedback_status` (`feedback_status`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='任务清单详细表';
|
||||
|
||||
-- =============================================
|
||||
-- 执行反馈表
|
||||
-- =============================================
|
||||
CREATE TABLE `safety_accountability_feedback` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`feedback_id` varchar(64) NOT NULL COMMENT '反馈UUID(业务主键)',
|
||||
`task_detail_id` varchar(64) NOT NULL COMMENT '任务详情UUID(关联任务清单详细表)',
|
||||
`task_list_id` varchar(64) NOT NULL COMMENT '任务清单UUID(冗余字段,便于查询)',
|
||||
`feedback_time` datetime NOT NULL COMMENT '反馈时间',
|
||||
`feedback_period_start_time` datetime NOT NULL COMMENT '反馈周期开始时间(用于回显)',
|
||||
`feedback_period_end_time` datetime NOT NULL COMMENT '反馈周期结束时间(用于回显)',
|
||||
`feedback_period_flag` varchar(20) NOT NULL COMMENT '反馈周期标识(格式:2026-05表示月,2026-Q1表示季度,2026-H1表示半年,2026表示年)',
|
||||
`feedback_content` text COMMENT '反馈内容',
|
||||
`feedback_user_id` bigint(20) DEFAULT NULL COMMENT '反馈人ID',
|
||||
`feedback_corp_id` bigint(20) DEFAULT NULL COMMENT '反馈人公司ID',
|
||||
`feedback_department_id` bigint(20) DEFAULT NULL COMMENT '反馈人部门ID',
|
||||
`delete_enum` varchar(32) DEFAULT 'FALSE' COMMENT '删除标识:TRUE/FALSE',
|
||||
`remarks` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
`create_name` varchar(50) DEFAULT NULL COMMENT '创建人姓名',
|
||||
`update_name` varchar(50) DEFAULT NULL COMMENT '更新人姓名',
|
||||
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户ID',
|
||||
`org_id` bigint(20) DEFAULT NULL COMMENT '单位ID',
|
||||
`version` int(11) DEFAULT '0' COMMENT '版本',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`create_id` bigint(20) DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_id` bigint(20) DEFAULT NULL COMMENT '修改人ID',
|
||||
`env` varchar(50) DEFAULT NULL COMMENT '环境标识',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_feedback_id` (`feedback_id`),
|
||||
KEY `idx_task_detail_id` (`task_detail_id`),
|
||||
KEY `idx_task_list_id` (`task_list_id`),
|
||||
KEY `idx_feedback_time` (`feedback_time`),
|
||||
KEY `idx_feedback_period_flag` (`feedback_period_flag`),
|
||||
KEY `idx_feedback_user_id` (`feedback_user_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='执行反馈表';
|
||||
|
||||
-- =============================================
|
||||
-- 反馈异常信息表
|
||||
-- =============================================
|
||||
CREATE TABLE `safety_accountability_feedback_exception` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`feedback_exception_id` varchar(64) NOT NULL COMMENT '反馈异常UUID(业务主键)',
|
||||
`task_detail_id` varchar(64) NOT NULL COMMENT '任务详情主键(关联任务清单详细表)',
|
||||
`task_list_id` varchar(64) DEFAULT NULL COMMENT '任务清单主键(冗余字段)',
|
||||
`exception_period` varchar(20) DEFAULT NULL COMMENT '异常周期标识',
|
||||
`feedback_exception_period_time` varchar(20) DEFAULT NULL COMMENT '反馈周期(用于回显)',
|
||||
`exception_type` tinyint(4) DEFAULT 1 COMMENT '异常类型:1-未按时反馈 2-反馈内容异常 3-其他',
|
||||
`exception_content` text COMMENT '反馈异常信息',
|
||||
`exception_time` datetime DEFAULT NULL COMMENT '异常时间',
|
||||
`delete_enum` varchar(32) DEFAULT 'FALSE' COMMENT '删除标识:TRUE/FALSE',
|
||||
`remarks` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
`create_name` varchar(50) DEFAULT NULL COMMENT '创建人姓名',
|
||||
`update_name` varchar(50) DEFAULT NULL COMMENT '更新人姓名',
|
||||
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户ID',
|
||||
`org_id` bigint(20) DEFAULT NULL COMMENT '单位ID',
|
||||
`version` int(11) DEFAULT '0' COMMENT '版本',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`create_id` bigint(20) DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_id` bigint(20) DEFAULT NULL COMMENT '修改人ID',
|
||||
`env` varchar(50) DEFAULT NULL COMMENT '环境标识',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_feedback_exception_id` (`feedback_exception_id`),
|
||||
KEY `idx_task_detail_id` (`task_detail_id`),
|
||||
KEY `idx_task_list_id` (`task_list_id`),
|
||||
KEY `idx_exception_period` (`exception_period`),
|
||||
KEY `idx_exception_type` (`exception_type`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='反馈异常信息表';
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 三、枚举定义
|
||||
|
||||
### 3.1 任务级别枚举 (TaskLevelEnum)
|
||||
|
||||
```java
|
||||
package com.zcloud.safety.accountability.list.domain.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 任务级别枚举
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum TaskLevelEnum {
|
||||
|
||||
ENTERPRISE(1, "企业级"),
|
||||
DEPARTMENT(2, "部门级"),
|
||||
TEAM(3, "班组级");
|
||||
|
||||
private final Integer code;
|
||||
private final String desc;
|
||||
|
||||
public static TaskLevelEnum getByCode(Integer code) {
|
||||
for (TaskLevelEnum e : values()) {
|
||||
if (e.getCode().equals(code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 3.2 任务状态枚举 (TaskStatusEnum)
|
||||
|
||||
```java
|
||||
package com.zcloud.safety.accountability.list.domain.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 任务状态枚举
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum TaskStatusEnum {
|
||||
|
||||
IN_PROGRESS(1, "进行中"),
|
||||
COMPLETED(2, "已完成"),
|
||||
CLOSED(3, "已关闭");
|
||||
|
||||
private final Integer code;
|
||||
private final String desc;
|
||||
|
||||
public static TaskStatusEnum getByCode(Integer code) {
|
||||
for (TaskStatusEnum e : values()) {
|
||||
if (e.getCode().equals(code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 3.3 反馈周期枚举 (FeedbackCycleEnum)
|
||||
|
||||
```java
|
||||
package com.zcloud.safety.accountability.list.domain.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 反馈周期枚举
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum FeedbackCycleEnum {
|
||||
|
||||
MONTHLY(1, "每月"),
|
||||
QUARTERLY(2, "每季度"),
|
||||
HALF_YEARLY(3, "半年"),
|
||||
YEARLY(4, "年");
|
||||
|
||||
private final Integer code;
|
||||
private final String desc;
|
||||
|
||||
public static FeedbackCycleEnum getByCode(Integer code) {
|
||||
for (FeedbackCycleEnum e : values()) {
|
||||
if (e.getCode().equals(code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 3.4 反馈周期时间工具类
|
||||
比如 传入2026-05 获取到开始时间:2026-05-01 00:00:00,结束时间:2026-05-31 23:59:59
|
||||
传入2026-Q1 获取到开始时间:2026-01-01 00:00:00,结束时间:2026-03-31 23:59:59
|
||||
传入2026-H1 获取到开始时间:2026-01-01 00:00:00,结束时间:2026-06-30 23:59:59
|
||||
传入2026-Y 获取到开始时间:2026-01-01 00:00:00,结束时间:2026-12-31 23:59:59
|
||||
|
||||
## 四、接口描述
|
||||
1.获取任务清单列表
|
||||
可传参:公司id
|
||||
筛选条件:清单名称,任务级别,反馈状态,是否开启(开启或禁用 0关1开)
|
||||
列表展示:清单名称,任务级别,责任岗位,状态(是否启用),执行部门,执行人员,任务数,执行周期,任务状态,反馈状态(由任务状态推导,有任务的反馈状态为异常时则为异常其他为正常),评分人员部门,评分人员,清单分数
|
||||
|
||||
2.新增任务清单:
|
||||
传参:清单名称,任务级别,责任岗位,是否启用
|
||||
|
||||
3.获取任务列表
|
||||
传参:清单表主键id,筛选条件(执行内容,任务周期开始时间,任务周期结束时间,反馈周期,反馈状态,任务状态)
|
||||
列表展示:执行内容,反馈周期,任务分值,当前得分,任务状态,反馈次数,反馈状态,当前节点是否反馈(按反馈周期划分时间筛选反馈表),异常列表(反馈周期,异常类型)
|
||||
|
||||
4.新增任务
|
||||
传参:清单表主键id,执行内容,反馈周期,任务分值(实现代码时这一部分要判断当前清单总分不饿能高于100)
|
||||
|
||||
5.获取任务详情
|
||||
传参:任务表主键id
|
||||
响应:清单表主键id,清单名称,任务级别,责任岗位,反馈周期,任务分值
|
||||
|
||||
6.股份端:获取企业统计
|
||||
筛选:企业名称
|
||||
响应:公司名称,执行情况(已完成+已关闭任务数/年度执行任务总数)
|
||||
|
||||
7.获取反馈周期分组列表
|
||||
传参:任务id
|
||||
筛选:反馈时间:开始时间-结束时间
|
||||
列表展示:反馈周期(反馈周期开始时间-反馈周期结束时间),反馈次数(以周期标识为维度统计一个标识有多少记录),反馈人,周期标识
|
||||
|
||||
8.获取反馈列表
|
||||
传参:任务id,周期标识
|
||||
列表展示:反馈时间,反馈内容,反馈人
|
||||
|
||||
9.获取反馈详情
|
||||
传参:反馈表id
|
||||
响应:任务信息(执行内容,反馈周期),反馈信息(反馈内容,反馈时间)
|
||||
|
||||
10.获取企业评价列表
|
||||
筛选:企业名称
|
||||
传参:评分状态(0未评分,1已评分)
|
||||
响应:企业名称,待评分清单数量(清单表分数为0或空的),已评分清单数量(清单表分数部位0或不是空的)
|
||||
|
||||
11.更新任务评分
|
||||
传参:任务id,分数
|
||||
|
||||
12.提交反馈
|
||||
传参:任务id,反馈内容
|
||||
|
||||
13.获取企业任务下发统计数
|
||||
筛选:企业名称
|
||||
列表展示:公司名称,任务清单下发数(以清单表中的执行公司id为维度统计计数)
|
||||
|
||||
14.关闭任务
|
||||
传参:任务id
|
||||
|
||||
15.关闭清单
|
||||
传参:清单id
|
||||
|
||||
16.任务下发
|
||||
传参:清单id(开启状态的列表),执行公司id,执行人员id,执行周期开始日期,执行周期结束日期
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,997 +0,0 @@
|
|||
# 安全责任清单 - 前端联调接口文档
|
||||
|
||||
> 基础路径:`/{gateway}` (gateway 配置值为 `safetyDutyList`,即实际前缀为 `/safetyDutyList`)
|
||||
>
|
||||
> 通用响应结构(COLA框架):
|
||||
> - `PageResponse<T>`:分页响应,包含 `data`(列表)、`totalCount`(总数)、`pageSize`、`pageIndex`
|
||||
> - `SingleResponse<T>`:单对象响应,包含 `data`
|
||||
> - `MultiResponse<T>`:列表响应,包含 `data`
|
||||
> - `Response`:无数据响应,仅包含 `success`、`errCode`、`errMessage`
|
||||
|
||||
---
|
||||
|
||||
## 一、安全责任清单(TaskListController)
|
||||
|
||||
### 1.1 获取任务清单列表
|
||||
|
||||
- **URL**:`POST /safetyDutyList/taskList/list`
|
||||
- **Content-Type**:`application/json`
|
||||
|
||||
**请求参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| pageIndex | Integer | 否 | 页码(默认1) |
|
||||
| pageSize | Integer | 否 | 每页条数(默认10) |
|
||||
| createCorpId | Long | 否 | 创建公司ID |
|
||||
| executeCorpId | Long | 否 | 执行公司ID |
|
||||
| executeUserId | Long | 否 | 执行人员ID |
|
||||
| taskListName | String | 否 | 清单名称(模糊查询) |
|
||||
| taskLevel | Integer | 否 | 任务级别:1-企业级 2-部门级 3-班组级 |
|
||||
| feedbackStatus | Integer | 否 | 反馈状态:1-正常 2-异常 |
|
||||
| switchFlag | Integer | 否 | 开启/关闭:0-关 1-开 |
|
||||
| menuPath | String | 否 | 菜单路径 |
|
||||
|
||||
**请求示例**:
|
||||
```json
|
||||
{
|
||||
"pageIndex": 1,
|
||||
"pageSize": 10,
|
||||
"taskListName": "安全",
|
||||
"taskLevel": 1
|
||||
}
|
||||
```
|
||||
|
||||
**响应数据**:`PageResponse<TaskListCO>`
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| id | Long | 主键 |
|
||||
| taskListId | String | 清单UUID(业务主键) |
|
||||
| taskListName | String | 清单名称 |
|
||||
| taskLevel | Integer | 任务级别:1-企业级 2-部门级 3-班组级 |
|
||||
| responsibilityPost | String | 责任岗位 |
|
||||
| switchFlag | Integer | 开启/关闭:0-关 1-开 |
|
||||
| status | Integer | 状态:1-进行中 2-已完成 3-已关闭 |
|
||||
| periodStartTime | String | 执行周期开始时间(yyyy-MM-dd HH:mm:ss) |
|
||||
| periodEndTime | String | 执行周期结束时间(yyyy-MM-dd HH:mm:ss) |
|
||||
| ratingScore | BigDecimal | 清单分数 |
|
||||
| ratingUserId | Long | 评分人ID |
|
||||
| ratingUserName | String | 评分人姓名 |
|
||||
| ratingDepartmentId | Long | 评分部门ID |
|
||||
| ratingDepartmentName | String | 评分部门名称 |
|
||||
| issueStatus | Integer | 下发状态:0-未下发 1-已下发 |
|
||||
| issueTime | String | 下发时间(yyyy-MM-dd HH:mm:ss) |
|
||||
| executeCorpId | Long | 执行公司ID |
|
||||
| executeCorpName | String | 执行公司名称 |
|
||||
| executeDepartmentId | Long | 执行部门ID |
|
||||
| executeDepartmentName | String | 执行部门名称 |
|
||||
| executeUserId | Long | 执行人员ID |
|
||||
| executeUserName | String | 执行人员名称 |
|
||||
| taskCount | Integer | 任务数 |
|
||||
| feedbackStatus | Integer | 反馈状态:1-正常 2-异常 |
|
||||
|
||||
---
|
||||
|
||||
### 1.2 新增任务清单
|
||||
|
||||
- **URL**:`POST /safetyDutyList/taskList/save`
|
||||
- **Content-Type**:`application/json`
|
||||
|
||||
**请求参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| taskListName | String | **是** | 清单名称 |
|
||||
| taskLevel | Integer | **是** | 任务级别:1-企业级 2-部门级 3-班组级 |
|
||||
| responsibilityPost | String | **是** | 责任岗位 |
|
||||
| switchFlag | Integer | **是** | 是否启用:1-启用 0-不启用 |
|
||||
|
||||
**请求示例**:
|
||||
```json
|
||||
{
|
||||
"taskListName": "2025年安全责任清单",
|
||||
"taskLevel": 1,
|
||||
"responsibilityPost": "安全管理岗",
|
||||
"switchFlag": 1
|
||||
}
|
||||
```
|
||||
|
||||
**响应数据**:`SingleResponse<TaskListCO>`
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| id | Long | 主键 |
|
||||
| taskListId | String | 清单UUID(业务主键) |
|
||||
| taskListName | String | 清单名称 |
|
||||
| taskLevel | Integer | 任务级别:1-企业级 2-部门级 3-班组级 |
|
||||
| responsibilityPost | String | 责任岗位 |
|
||||
| switchFlag | Integer | 开启/关闭:0-关 1-开 |
|
||||
| status | Integer | 状态:1-进行中 2-已完成 3-已关闭 |
|
||||
| periodStartTime | String | 执行周期开始时间 |
|
||||
| periodEndTime | String | 执行周期结束时间 |
|
||||
| ratingScore | BigDecimal | 清单分数 |
|
||||
| ratingUserId | Long | 评分人ID |
|
||||
| ratingUserName | String | 评分人姓名 |
|
||||
| ratingDepartmentId | Long | 评分部门ID |
|
||||
| ratingDepartmentName | String | 评分部门名称 |
|
||||
| issueStatus | Integer | 下发状态:0-未下发 1-已下发 |
|
||||
| issueTime | String | 下发时间 |
|
||||
| executeCorpId | Long | 执行公司ID |
|
||||
| executeCorpName | String | 执行公司名称 |
|
||||
| executeDepartmentId | Long | 执行部门ID |
|
||||
| executeDepartmentName | String | 执行部门名称 |
|
||||
| executeUserId | Long | 执行人员ID |
|
||||
| executeUserName | String | 执行人员名称 |
|
||||
| taskCount | Integer | 任务数 |
|
||||
| feedbackStatus | Integer | 反馈状态:1-正常 2-异常 |
|
||||
|
||||
---
|
||||
|
||||
### 1.3 修改任务清单
|
||||
|
||||
- **URL**:`POST /safetyDutyList/taskList/edit`
|
||||
- **Content-Type**:`application/json`
|
||||
|
||||
**请求参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| taskListId | String | **是** | 清单UUID(业务主键) |
|
||||
| taskListName | String | **是** | 清单名称 |
|
||||
| taskLevel | Integer | **是** | 任务级别:1-企业级 2-部门级 3-班组级 |
|
||||
| responsibilityPost | String | **是** | 责任岗位 |
|
||||
| switchFlag | Integer | **是** | 是否启用:1-启用 0-不启用 |
|
||||
|
||||
**请求示例**:
|
||||
```json
|
||||
{
|
||||
"taskListId": "uuid-xxx",
|
||||
"taskListName": "2025年安全责任清单(修改)",
|
||||
"taskLevel": 1,
|
||||
"responsibilityPost": "安全管理岗",
|
||||
"switchFlag": 1
|
||||
}
|
||||
```
|
||||
|
||||
**响应数据**:`SingleResponse`
|
||||
|
||||
---
|
||||
|
||||
### 1.4 删除任务清单
|
||||
|
||||
- **URL**:`POST /safetyDutyList/taskList/delete/{id}`
|
||||
|
||||
**路径参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| id | Long | **是** | 清单主键ID |
|
||||
|
||||
**请求示例**:
|
||||
```
|
||||
POST /safetyDutyList/taskList/delete/1
|
||||
```
|
||||
|
||||
**响应数据**:`Response`
|
||||
|
||||
---
|
||||
|
||||
### 1.5 开启/关闭任务清单
|
||||
|
||||
- **URL**:`POST /safetyDutyList/taskList/switchFlag`
|
||||
- **Content-Type**:`application/json`
|
||||
|
||||
> 注意:调用此接口即表示要关闭任务清单
|
||||
|
||||
**请求参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| taskListId | String | **是** | 清单UUID |
|
||||
| switchFlag | Integer | **是** | 开启/关闭:0-关 1-开 |
|
||||
|
||||
**请求示例**:
|
||||
```json
|
||||
{
|
||||
"taskListId": "uuid-xxx",
|
||||
"switchFlag": 0
|
||||
}
|
||||
```
|
||||
|
||||
**响应数据**:`SingleResponse`
|
||||
|
||||
---
|
||||
|
||||
### 1.6 关闭清单
|
||||
|
||||
- **URL**:`POST /safetyDutyList/taskList/close`
|
||||
- **Content-Type**:`application/json`
|
||||
|
||||
**请求参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| taskListId | String | **是** | 清单UUID |
|
||||
|
||||
**请求示例**:
|
||||
```json
|
||||
{
|
||||
"taskListId": "uuid-xxx"
|
||||
}
|
||||
```
|
||||
|
||||
**响应数据**:`SingleResponse`
|
||||
|
||||
---
|
||||
|
||||
### 1.7 任务下发
|
||||
|
||||
- **URL**:`POST /safetyDutyList/taskList/issue`
|
||||
- **Content-Type**:`application/json`
|
||||
|
||||
**请求参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| taskListId | String | **是** | 清单UUID |
|
||||
| executeCorpId | Long | **是** | 执行公司ID |
|
||||
| executeDepartmentId | Long | **是** | 执行部门ID |
|
||||
| executeUserId | Long | **是** | 执行人员ID |
|
||||
| periodStartTime | String | **是** | 执行周期开始时间(yyyy-MM-dd HH:mm:ss) |
|
||||
| periodEndTime | String | **是** | 执行周期结束时间(yyyy-MM-dd HH:mm:ss) |
|
||||
|
||||
**请求示例**:
|
||||
```json
|
||||
{
|
||||
"taskListId": "uuid-xxx",
|
||||
"executeCorpId": 100,
|
||||
"executeDepartmentId": 200,
|
||||
"executeUserId": 300,
|
||||
"periodStartTime": "2025-01-01 00:00:00",
|
||||
"periodEndTime": "2025-12-31 23:59:59"
|
||||
}
|
||||
```
|
||||
|
||||
**响应数据**:`SingleResponse`
|
||||
|
||||
---
|
||||
|
||||
## 二、任务详情(TaskDetailController)
|
||||
|
||||
### 2.1 获取任务列表
|
||||
|
||||
- **URL**:`POST /safetyDutyList/taskDetail/list`
|
||||
- **Content-Type**:`application/json`
|
||||
|
||||
**请求参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| pageIndex | Integer | 否 | 页码(默认1) |
|
||||
| pageSize | Integer | 否 | 每页条数(默认10) |
|
||||
| taskListId | String | 否 | 清单表主键ID |
|
||||
| taskContent | String | 否 | 执行内容 |
|
||||
| taskPeriodStart | String | 否 | 任务周期开始时间 |
|
||||
| taskPeriodEnd | String | 否 | 任务周期结束时间 |
|
||||
| feedbackCycleType | Integer | 否 | 反馈周期类型:1-每月 2-季度 3-半年 4-年 |
|
||||
| feedbackStatus | Integer | 否 | 反馈状态:1-正常 2-异常 |
|
||||
| taskStatus | Integer | 否 | 任务状态:1-进行中 2-已完成 3-已关闭 |
|
||||
|
||||
**请求示例**:
|
||||
```json
|
||||
{
|
||||
"pageIndex": 1,
|
||||
"pageSize": 10,
|
||||
"taskListId": "uuid-xxx",
|
||||
"taskStatus": 1
|
||||
}
|
||||
```
|
||||
|
||||
**响应数据**:`PageResponse<TaskDetailFullCO>`
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| id | Long | 主键ID |
|
||||
| taskDetailId | String | 任务详情UUID |
|
||||
| taskListId | String | 任务清单UUID |
|
||||
| executeContent | String | 执行内容 |
|
||||
| feedbackCycleType | Integer | 反馈周期类型:1-每月 2-季度 3-半年 4-年 |
|
||||
| taskScore | BigDecimal | 任务分值 |
|
||||
| taskRating | BigDecimal | 当前得分(任务评分) |
|
||||
| taskStatus | Integer | 任务状态:1-进行中 2-已完成 3-已关闭 |
|
||||
| feedbackCount | Integer | 反馈次数 |
|
||||
| feedbackStatus | Integer | 反馈状态:1-正常 2-异常 |
|
||||
| currentPeriodFeedback | Boolean | 当前节点是否反馈 |
|
||||
| exceptionList | Array | 异常列表(见FeedbackExceptionCO) |
|
||||
|
||||
**exceptionList 子对象(FeedbackExceptionCO)**:
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| id | Long | 主键 |
|
||||
| feedbackExceptionId | String | 反馈异常UUID |
|
||||
| taskDetailId | String | 任务详情UUID |
|
||||
| taskListId | String | 任务清单UUID |
|
||||
| exceptionPeriodFlag | String | 异常周期标识 |
|
||||
| exceptionPeriodStartTime | String | 异常周期开始时间 |
|
||||
| exceptionPeriodEndTime | String | 异常周期结束时间 |
|
||||
| exceptionType | Integer | 异常类型:1-未按时反馈 2-反馈内容异常 3-其他 |
|
||||
| exceptionContent | String | 反馈异常信息 |
|
||||
| exceptionTime | String | 异常时间 |
|
||||
| createTime | String | 创建时间 |
|
||||
| taskListName | String | 清单名称 |
|
||||
| executeContent | String | 执行内容 |
|
||||
|
||||
---
|
||||
|
||||
### 2.2 新增任务
|
||||
|
||||
- **URL**:`POST /safetyDutyList/taskDetail/save`
|
||||
- **Content-Type**:`application/json`
|
||||
|
||||
**请求参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| taskListId | String | **是** | 清单表主键ID |
|
||||
| executeContent | String | 否 | 执行内容 |
|
||||
| feedbackCycleType | Integer | **是** | 反馈周期类型:1-每月 2-季度 3-半年 4-年 |
|
||||
| taskScore | BigDecimal | 否 | 任务分值 |
|
||||
|
||||
**请求示例**:
|
||||
```json
|
||||
{
|
||||
"taskListId": "uuid-xxx",
|
||||
"executeContent": "每月检查消防设施",
|
||||
"feedbackCycleType": 1,
|
||||
"taskScore": 10.0
|
||||
}
|
||||
```
|
||||
|
||||
**响应数据**:`SingleResponse<TaskDetailCO>`
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| id | Long | 主键 |
|
||||
| taskDetailId | String | 明细UUID(业务主键) |
|
||||
| taskListId | String | 任务清单ID |
|
||||
| executeContent | String | 执行内容 |
|
||||
| feedbackCycleType | Integer | 反馈周期类型:1-每月 2-季度 3-半年 4-年 |
|
||||
| feedbackCycleName | String | 反馈周期名称 |
|
||||
| taskStatus | Integer | 任务状态:1-进行中 2-已完成 3-已关闭 |
|
||||
| feedbackStatus | Integer | 反馈状态:1-正常 2-存在异常 |
|
||||
| taskScore | BigDecimal | 任务分值 |
|
||||
| taskRating | BigDecimal | 任务评分 |
|
||||
| ratingTime | String | 评分时间(yyyy-MM-dd HH:mm:ss) |
|
||||
| ratingDepartmentId | Long | 评分部门ID |
|
||||
| ratingUserId | Long | 评分人ID |
|
||||
|
||||
---
|
||||
|
||||
### 2.3 批量保存任务
|
||||
|
||||
- **URL**:`POST /safetyDutyList/taskDetail/saveBatch`
|
||||
- **Content-Type**:`application/json`
|
||||
|
||||
> 保存逻辑:以传参列表为准,id为空时新增,id非空时更新,数据库中有但传参中没有的则删除。
|
||||
> 校验规则:保存后该清单下所有任务分值之和不能超过100
|
||||
|
||||
**请求参数**:`List<TaskDetailSaveBatchCmd>`(JSON数组)
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| id | Long | 否 | 主键ID(为空时新增,非空时更新) |
|
||||
| taskListId | String | **是** | 清单表主键ID |
|
||||
| executeContent | String | 否 | 执行内容 |
|
||||
| feedbackCycleType | Integer | **是** | 反馈周期类型:1-每月 2-季度 3-半年 4-年 |
|
||||
| taskScore | BigDecimal | 否 | 任务分值 |
|
||||
|
||||
**请求示例**:
|
||||
```json
|
||||
[
|
||||
{
|
||||
"id": null,
|
||||
"taskListId": "uuid-xxx",
|
||||
"executeContent": "新增任务内容",
|
||||
"feedbackCycleType": 1,
|
||||
"taskScore": 20.0
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"taskListId": "uuid-xxx",
|
||||
"executeContent": "更新任务内容",
|
||||
"feedbackCycleType": 2,
|
||||
"taskScore": 30.0
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
**响应数据**:`MultiResponse<TaskDetailCO>`
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| id | Long | 主键 |
|
||||
| taskDetailId | String | 明细UUID(业务主键) |
|
||||
| taskListId | String | 任务清单ID |
|
||||
| executeContent | String | 执行内容 |
|
||||
| feedbackCycleType | Integer | 反馈周期类型:1-每月 2-季度 3-半年 4-年 |
|
||||
| feedbackCycleName | String | 反馈周期名称 |
|
||||
| taskStatus | Integer | 任务状态:1-进行中 2-已完成 3-已关闭 |
|
||||
| feedbackStatus | Integer | 反馈状态:1-正常 2-存在异常 |
|
||||
| taskScore | BigDecimal | 任务分值 |
|
||||
| taskRating | BigDecimal | 任务评分 |
|
||||
| ratingTime | String | 评分时间(yyyy-MM-dd HH:mm:ss) |
|
||||
| ratingDepartmentId | Long | 评分部门ID |
|
||||
| ratingUserId | Long | 评分人ID |
|
||||
|
||||
---
|
||||
|
||||
### 2.4 编辑任务
|
||||
|
||||
- **URL**:`POST /safetyDutyList/taskDetail/edit`
|
||||
- **Content-Type**:`application/json`
|
||||
|
||||
> 校验规则:编辑后该清单下所有任务分值之和不能超过100
|
||||
|
||||
**请求参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| taskDetailId | String | **是** | 任务详情UUID |
|
||||
| taskListId | String | **是** | 清单表主键ID |
|
||||
| executeContent | String | 否 | 执行内容 |
|
||||
| feedbackCycleType | Integer | **是** | 反馈周期类型:1-每月 2-季度 3-半年 4-年 |
|
||||
| taskScore | BigDecimal | 否 | 任务分值 |
|
||||
|
||||
**请求示例**:
|
||||
```json
|
||||
{
|
||||
"taskDetailId": "uuid-detail-xxx",
|
||||
"taskListId": "uuid-xxx",
|
||||
"executeContent": "每月检查消防设施(修改)",
|
||||
"feedbackCycleType": 1,
|
||||
"taskScore": 15.0
|
||||
}
|
||||
```
|
||||
|
||||
**响应数据**:`SingleResponse<TaskDetailCO>`
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| id | Long | 主键 |
|
||||
| taskDetailId | String | 明细UUID(业务主键) |
|
||||
| taskListId | String | 任务清单ID |
|
||||
| executeContent | String | 执行内容 |
|
||||
| feedbackCycleType | Integer | 反馈周期类型:1-每月 2-季度 3-半年 4-年 |
|
||||
| feedbackCycleName | String | 反馈周期名称 |
|
||||
| taskStatus | Integer | 任务状态:1-进行中 2-已完成 3-已关闭 |
|
||||
| feedbackStatus | Integer | 反馈状态:1-正常 2-存在异常 |
|
||||
| taskScore | BigDecimal | 任务分值 |
|
||||
| taskRating | BigDecimal | 任务评分 |
|
||||
| ratingTime | String | 评分时间(yyyy-MM-dd HH:mm:ss) |
|
||||
| ratingDepartmentId | Long | 评分部门ID |
|
||||
| ratingUserId | Long | 评分人ID |
|
||||
|
||||
---
|
||||
|
||||
### 2.5 获取任务详情
|
||||
|
||||
- **URL**:`GET /safetyDutyList/taskDetail/{detailId}`
|
||||
|
||||
**路径参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| detailId | String | **是** | 任务详情UUID |
|
||||
|
||||
**请求示例**:
|
||||
```
|
||||
GET /safetyDutyList/taskDetail/uuid-detail-xxx
|
||||
```
|
||||
|
||||
**响应数据**:`SingleResponse<TaskDetailInfoCO>`
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| id | Long | 主键ID |
|
||||
| taskDetailId | String | 任务详情UUID |
|
||||
| taskListId | String | 清单表主键ID |
|
||||
| taskListName | String | 清单名称 |
|
||||
| taskLevel | Integer | 任务级别 |
|
||||
| responsibilityPost | String | 责任岗位 |
|
||||
| feedbackCycleType | Integer | 反馈周期类型 |
|
||||
| taskScore | BigDecimal | 任务分值 |
|
||||
| executeContent | String | 执行内容 |
|
||||
|
||||
---
|
||||
|
||||
### 2.6 关闭任务
|
||||
|
||||
- **URL**:`POST /safetyDutyList/taskDetail/close`
|
||||
- **Content-Type**:`application/json`
|
||||
|
||||
**请求参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| taskDetailId | String | **是** | 任务UUID |
|
||||
|
||||
**请求示例**:
|
||||
```json
|
||||
{
|
||||
"taskDetailId": "uuid-detail-xxx"
|
||||
}
|
||||
```
|
||||
|
||||
**响应数据**:`Response`
|
||||
|
||||
---
|
||||
|
||||
### 2.7 更新任务评分
|
||||
|
||||
- **URL**:`POST /safetyDutyList/taskDetail/updateScore`
|
||||
- **Content-Type**:`application/json`
|
||||
|
||||
**请求参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| taskDetailId | String | **是** | 任务UUID |
|
||||
| taskRating | BigDecimal | **是** | 分数(不能超过任务分值) |
|
||||
| ratingDeptId | Long | **是** | 评分部门ID |
|
||||
| ratingUserId | Long | **是** | 评分人员ID |
|
||||
|
||||
**请求示例**:
|
||||
```json
|
||||
{
|
||||
"taskDetailId": "uuid-detail-xxx",
|
||||
"taskRating": 8.5,
|
||||
"ratingDeptId": 200,
|
||||
"ratingUserId": 300
|
||||
}
|
||||
```
|
||||
|
||||
**响应数据**:`Response`
|
||||
|
||||
---
|
||||
|
||||
## 三、执行反馈(FeedbackController)
|
||||
|
||||
### 3.1 提交反馈
|
||||
|
||||
- **URL**:`POST /safetyDutyList/feedback/save`
|
||||
- **Content-Type**:`application/json`
|
||||
|
||||
**请求参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| taskListId | String | **是** | 任务清单ID |
|
||||
| taskDetailId | String | **是** | 清单明细ID |
|
||||
| feedbackContent | String | **是** | 反馈内容 |
|
||||
| feedbackCorpId | Long | 否 | 反馈人公司ID |
|
||||
| feedbackDepartmentId | Long | 否 | 反馈人部门ID |
|
||||
| feedbackUserId | Long | 否 | 反馈人ID |
|
||||
|
||||
**请求示例**:
|
||||
```json
|
||||
{
|
||||
"taskListId": "uuid-xxx",
|
||||
"taskDetailId": "uuid-detail-xxx",
|
||||
"feedbackContent": "本月已按计划完成消防设施检查",
|
||||
"feedbackUserId": 300
|
||||
}
|
||||
```
|
||||
|
||||
**响应数据**:`SingleResponse<FeedbackCO>`
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| id | Long | 主键 |
|
||||
| feedbackId | String | 反馈UUID(业务主键) |
|
||||
| taskDetailId | String | 任务详情UUID |
|
||||
| taskListId | String | 任务清单UUID |
|
||||
| feedbackTime | String | 反馈时间(yyyy-MM-dd HH:mm:ss) |
|
||||
| feedbackPeriodFlag | String | 反馈周期标识 |
|
||||
| feedbackPeriodStartTime | String | 反馈周期开始时间(yyyy-MM-dd HH:mm:ss) |
|
||||
| feedbackPeriodEndTime | String | 反馈周期结束时间(yyyy-MM-dd HH:mm:ss) |
|
||||
| feedbackContent | String | 反馈内容 |
|
||||
| feedbackUserId | Long | 反馈人ID |
|
||||
| feedbackUserName | String | 反馈人姓名 |
|
||||
| feedbackCorpId | Long | 反馈人公司ID |
|
||||
| feedbackCorpName | String | 反馈人公司名称 |
|
||||
| feedbackDepartmentId | Long | 反馈人部门ID |
|
||||
| feedbackDepartmentName | String | 反馈人部门名称 |
|
||||
| executeContent | String | 执行内容 |
|
||||
| taskListName | String | 清单名称 |
|
||||
| createTime | String | 创建时间(yyyy-MM-dd HH:mm:ss) |
|
||||
|
||||
---
|
||||
|
||||
### 3.2 删除反馈
|
||||
|
||||
- **URL**:`POST /safetyDutyList/feedback/delete/{id}`
|
||||
|
||||
**路径参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| id | Long | **是** | 反馈记录主键ID |
|
||||
|
||||
**请求示例**:
|
||||
```
|
||||
POST /safetyDutyList/feedback/delete/1
|
||||
```
|
||||
|
||||
**响应数据**:`Response`
|
||||
|
||||
---
|
||||
|
||||
### 3.3 编辑反馈
|
||||
|
||||
- **URL**:`POST /safetyDutyList/feedback/edit`
|
||||
- **Content-Type**:`application/json`
|
||||
|
||||
**请求参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| feedbackId | String | **是** | 反馈UUID |
|
||||
| feedbackContent | String | **是** | 反馈内容 |
|
||||
|
||||
**请求示例**:
|
||||
```json
|
||||
{
|
||||
"feedbackId": "uuid-feedback-xxx",
|
||||
"feedbackContent": "修改后的反馈内容"
|
||||
}
|
||||
```
|
||||
|
||||
**响应数据**:`SingleResponse<FeedbackCO>`
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| id | Long | 主键 |
|
||||
| feedbackId | String | 反馈UUID(业务主键) |
|
||||
| taskDetailId | String | 任务详情UUID |
|
||||
| taskListId | String | 任务清单UUID |
|
||||
| feedbackTime | String | 反馈时间(yyyy-MM-dd HH:mm:ss) |
|
||||
| feedbackPeriodFlag | String | 反馈周期标识 |
|
||||
| feedbackPeriodStartTime | String | 反馈周期开始时间(yyyy-MM-dd HH:mm:ss) |
|
||||
| feedbackPeriodEndTime | String | 反馈周期结束时间(yyyy-MM-dd HH:mm:ss) |
|
||||
| feedbackContent | String | 反馈内容 |
|
||||
| feedbackUserId | Long | 反馈人ID |
|
||||
| feedbackUserName | String | 反馈人姓名 |
|
||||
| feedbackCorpId | Long | 反馈人公司ID |
|
||||
| feedbackCorpName | String | 反馈人公司名称 |
|
||||
| feedbackDepartmentId | Long | 反馈人部门ID |
|
||||
| feedbackDepartmentName | String | 反馈人部门名称 |
|
||||
| executeContent | String | 执行内容 |
|
||||
| taskListName | String | 清单名称 |
|
||||
| createTime | String | 创建时间(yyyy-MM-dd HH:mm:ss) |
|
||||
|
||||
---
|
||||
|
||||
### 3.4 获取反馈周期分组列表
|
||||
|
||||
- **URL**:`POST /safetyDutyList/feedback/periodGroupList`
|
||||
- **Content-Type**:`application/json`
|
||||
|
||||
**请求参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| taskDetailId | String | **是** | 任务ID |
|
||||
| feedbackTimeStart | String | 否 | 反馈时间开始(格式:yyyy-MM-dd) |
|
||||
| feedbackTimeEnd | String | 否 | 反馈时间结束(格式:yyyy-MM-dd) |
|
||||
|
||||
**请求示例**:
|
||||
```json
|
||||
{
|
||||
"taskDetailId": "uuid-detail-xxx",
|
||||
"feedbackTimeStart": "2025-01-01",
|
||||
"feedbackTimeEnd": "2025-06-30"
|
||||
}
|
||||
```
|
||||
|
||||
**响应数据**:`MultiResponse<FeedbackPeriodGroupCO>`
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| taskDetailId | String | 任务ID |
|
||||
| feedbackPeriodStartTime | String | 反馈周期开始时间(yyyy-MM-dd HH:mm:ss) |
|
||||
| feedbackPeriodEndTime | String | 反馈周期结束时间(yyyy-MM-dd HH:mm:ss) |
|
||||
| feedbackCount | Integer | 反馈次数 |
|
||||
| feedbackUserName | String | 反馈人姓名 |
|
||||
| feedbackPeriodFlag | String | 周期标识 |
|
||||
|
||||
---
|
||||
|
||||
### 3.5 获取反馈列表
|
||||
|
||||
- **URL**:`POST /safetyDutyList/feedback/list`
|
||||
- **Content-Type**:`application/json`
|
||||
|
||||
**请求参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| pageIndex | Integer | 否 | 页码(默认1) |
|
||||
| pageSize | Integer | 否 | 每页条数(默认10) |
|
||||
| taskDetailId | String | 否 | 任务详情ID |
|
||||
| taskListId | String | 否 | 任务清单ID |
|
||||
| feedbackPeriodFlag | String | 否 | 周期标识 |
|
||||
| feedbackCorpId | Long | 否 | 反馈人公司ID |
|
||||
|
||||
**请求示例**:
|
||||
```json
|
||||
{
|
||||
"pageIndex": 1,
|
||||
"pageSize": 10,
|
||||
"taskDetailId": "uuid-detail-xxx",
|
||||
"feedbackPeriodFlag": "2025-Q1"
|
||||
}
|
||||
```
|
||||
|
||||
**响应数据**:`PageResponse<FeedbackCO>`
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| id | Long | 主键 |
|
||||
| feedbackId | String | 反馈UUID |
|
||||
| taskDetailId | String | 任务详情UUID |
|
||||
| taskListId | String | 任务清单UUID |
|
||||
| feedbackTime | String | 反馈时间(yyyy-MM-dd HH:mm:ss) |
|
||||
| feedbackPeriodStartTime | String | 反馈周期开始时间 |
|
||||
| feedbackPeriodEndTime | String | 反馈周期结束时间 |
|
||||
| feedbackPeriodFlag | String | 反馈周期标识 |
|
||||
| feedbackContent | String | 反馈内容 |
|
||||
| feedbackUserId | Long | 反馈人ID |
|
||||
| feedbackUserName | String | 反馈人姓名 |
|
||||
| feedbackCorpId | Long | 反馈人公司ID |
|
||||
| feedbackCorpName | String | 反馈人公司名称 |
|
||||
| feedbackDepartmentId | Long | 反馈人部门ID |
|
||||
| feedbackDepartmentName | String | 反馈人部门名称 |
|
||||
| executeContent | String | 执行内容 |
|
||||
| taskListName | String | 清单名称 |
|
||||
| createTime | String | 创建时间 |
|
||||
|
||||
---
|
||||
|
||||
### 3.6 获取反馈详情
|
||||
|
||||
- **URL**:`GET /safetyDutyList/feedback/{feedbackId}`
|
||||
|
||||
**路径参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| feedbackId | String | **是** | 反馈UUID |
|
||||
|
||||
**请求示例**:
|
||||
```
|
||||
GET /safetyDutyList/feedback/uuid-feedback-xxx
|
||||
```
|
||||
|
||||
**响应数据**:`SingleResponse<FeedbackInfoCO>`
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| id | Long | 主键ID |
|
||||
| feedbackId | String | 反馈UUID |
|
||||
| taskDetailId | String | 任务详情ID |
|
||||
| executeContent | String | 执行内容 |
|
||||
| feedbackCycleType | Integer | 反馈周期类型 |
|
||||
| feedbackContent | String | 反馈内容 |
|
||||
| feedbackTime | String | 反馈时间(yyyy-MM-dd HH:mm:ss) |
|
||||
| feedbackPeriodStartTime | String | 反馈周期开始时间 |
|
||||
| feedbackPeriodEndTime | String | 反馈周期结束时间 |
|
||||
|
||||
---
|
||||
|
||||
### 3.7 获取异常记录列表
|
||||
|
||||
- **URL**:`POST /safetyDutyList/feedback/exception/list`
|
||||
- **Content-Type**:`application/json`
|
||||
|
||||
> 注意:此接口暂未开放
|
||||
|
||||
**请求参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| pageIndex | Integer | 否 | 页码(默认1) |
|
||||
| pageSize | Integer | 否 | 每页条数(默认10) |
|
||||
| taskListId | String | 否 | 任务清单ID |
|
||||
| exceptionType | Integer | 否 | 异常类型:1-未按时反馈 2-反馈内容异常 3-其他 |
|
||||
| exceptionPeriodFlag | String | 否 | 异常周期标识 |
|
||||
|
||||
**请求示例**:
|
||||
```json
|
||||
{
|
||||
"pageIndex": 1,
|
||||
"pageSize": 10,
|
||||
"taskListId": "uuid-xxx",
|
||||
"exceptionType": 1
|
||||
}
|
||||
```
|
||||
|
||||
**响应数据**:`PageResponse<FeedbackExceptionCO>`
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| id | Long | 主键 |
|
||||
| feedbackExceptionId | String | 反馈异常UUID |
|
||||
| taskDetailId | String | 任务详情UUID |
|
||||
| taskListId | String | 任务清单UUID |
|
||||
| exceptionPeriodFlag | String | 异常周期标识 |
|
||||
| exceptionPeriodStartTime | String | 异常周期开始时间 |
|
||||
| exceptionPeriodEndTime | String | 异常周期结束时间 |
|
||||
| exceptionType | Integer | 异常类型:1-未按时反馈 2-反馈内容异常 3-其他 |
|
||||
| exceptionContent | String | 反馈异常信息 |
|
||||
| exceptionTime | String | 异常时间 |
|
||||
| createTime | String | 创建时间 |
|
||||
| taskListName | String | 清单名称 |
|
||||
| executeContent | String | 执行内容 |
|
||||
|
||||
---
|
||||
|
||||
## 四、统计分析(StatisticsController)
|
||||
|
||||
### 4.1 获取企业统计(股份端)
|
||||
|
||||
- **URL**:`POST /safetyDutyList/statistics/corpStatistics`
|
||||
- **Content-Type**:`application/json`
|
||||
|
||||
**请求参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| pageIndex | Integer | 否 | 页码(默认1) |
|
||||
| pageSize | Integer | 否 | 每页条数(默认10) |
|
||||
| corpName | String | 否 | 企业名称(模糊查询) |
|
||||
|
||||
**请求示例**:
|
||||
```json
|
||||
{
|
||||
"pageIndex": 1,
|
||||
"pageSize": 10,
|
||||
"corpName": "XX公司"
|
||||
}
|
||||
```
|
||||
|
||||
**响应数据**:`PageResponse<CorpStatisticsCO>`
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| corpId | Long | 公司ID |
|
||||
| corpName | String | 公司名称 |
|
||||
| completedTaskCount | Integer | 已完成任务数 |
|
||||
| closedTaskCount | Integer | 已关闭任务数 |
|
||||
| totalTaskCount | Integer | 年度执行任务总数 |
|
||||
|
||||
---
|
||||
|
||||
### 4.2 获取企业评价列表
|
||||
|
||||
- **URL**:`POST /safetyDutyList/statistics/evaluationList`
|
||||
- **Content-Type**:`application/json`
|
||||
|
||||
**请求参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| pageIndex | Integer | 否 | 页码(默认1) |
|
||||
| pageSize | Integer | 否 | 每页条数(默认10) |
|
||||
| corpName | String | 否 | 企业名称(模糊查询) |
|
||||
| scoreStatus | Integer | 否 | 评分状态:0-未评分 1-已评分 |
|
||||
|
||||
**请求示例**:
|
||||
```json
|
||||
{
|
||||
"pageIndex": 1,
|
||||
"pageSize": 10,
|
||||
"corpName": "XX公司",
|
||||
"scoreStatus": 0
|
||||
}
|
||||
```
|
||||
|
||||
**响应数据**:`PageResponse<EvaluationListCO>`
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| corpId | Long | 公司ID |
|
||||
| corpName | String | 公司名称 |
|
||||
| listCount | Integer | 清单数量 |
|
||||
|
||||
---
|
||||
|
||||
### 4.3 获取企业任务下发统计数
|
||||
|
||||
- **URL**:`POST /safetyDutyList/statistics/issueStatistics`
|
||||
- **Content-Type**:`application/json`
|
||||
|
||||
**请求参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| pageIndex | Integer | 否 | 页码(默认1) |
|
||||
| pageSize | Integer | 否 | 每页条数(默认10) |
|
||||
| corpName | String | 否 | 企业名称(模糊查询) |
|
||||
|
||||
**请求示例**:
|
||||
```json
|
||||
{
|
||||
"pageIndex": 1,
|
||||
"pageSize": 10,
|
||||
"corpName": "XX公司"
|
||||
}
|
||||
```
|
||||
|
||||
**响应数据**:`PageResponse<IssueStatisticsCO>`
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| corpId | Long | 公司ID |
|
||||
| corpName | String | 公司名称 |
|
||||
| issueCount | Integer | 任务清单下发数 |
|
||||
|
||||
---
|
||||
|
||||
## 附录:枚举值速查
|
||||
|
||||
| 枚举 | 值 | 说明 |
|
||||
|------|------|------|
|
||||
| 任务级别(taskLevel) | 1 | 企业级 |
|
||||
| | 2 | 部门级 |
|
||||
| | 3 | 班组级 |
|
||||
| 开关标识(switchFlag) | 0 | 关闭 |
|
||||
| | 1 | 开启 |
|
||||
| 清单状态(status) | 1 | 进行中 |
|
||||
| | 2 | 已完成 |
|
||||
| | 3 | 已关闭 |
|
||||
| 下发状态(issueStatus) | 0 | 未下发 |
|
||||
| | 1 | 已下发 |
|
||||
| 反馈周期类型(feedbackCycleType) | 1 | 每月 |
|
||||
| | 2 | 每季度 |
|
||||
| | 3 | 每半年 |
|
||||
| | 4 | 每年 |
|
||||
| 反馈状态(feedbackStatus) | 1 | 正常 |
|
||||
| | 2 | 异常 |
|
||||
| 异常类型(exceptionType) | 1 | 未按时反馈 |
|
||||
| | 2 | 反馈内容异常 |
|
||||
| | 3 | 其他 |
|
||||
| 评分状态(scoreStatus) | 0 | 未评分 |
|
||||
| | 1 | 已评分 |
|
||||
|
||||
**周期标识格式说明**:
|
||||
|
||||
| 反馈周期类型 | 格式 | 示例 |
|
||||
|------|------|------|
|
||||
| 1-每月 | yyyy-MM | 2026-05 |
|
||||
| 2-每季度 | yyyy-Qn | 2026-Q1 |
|
||||
| 3-每半年 | yyyy-Hn | 2026-H1 |
|
||||
| 4-每年 | yyyy-Y | 2026-Y |
|
||||
|
||||
**反馈异常检测定时任务说明**:
|
||||
|
||||
定时任务于每月1日00:00:00执行,检测逻辑如下:
|
||||
|
||||
1. 查询所有已下发且周期时间完整的清单(issue_status=1,period_start_time和period_end_time不为空,且period_end_time不超过当前时间1个月)
|
||||
2. 遍历每个清单下的所有任务,以清单的周期起始时间判断是否仍处于首个反馈周期内
|
||||
3. 若仍处于首周期(首周期尚未结束),跳过检测,不判定异常
|
||||
4. 若已过首周期,检查上一阶段是否有反馈记录,无反馈则判定为异常
|
||||
|
||||
**首周期判断规则**:将清单的periodStartTime和当前时间分别生成周期标识,若相同则仍在首周期内。
|
||||
|
||||
| 清单起始时间 | 当前时间 | 周期类型 | 首周期标识 | 当前周期标识 | 是否跳过 |
|
||||
|------|------|------|------|------|------|
|
||||
| 2026-07-01 | 2026-07-12 | 1-每月 | 2026-07 | 2026-07 | 跳过 |
|
||||
| 2026-07-01 | 2026-08-01 | 1-每月 | 2026-07 | 2026-08 | 检查2026-07 |
|
||||
| 2026-07-01 | 2026-07-12 | 2-每季度 | 2026-Q3 | 2026-Q3 | 跳过 |
|
||||
| 2026-07-01 | 2026-10-01 | 2-每季度 | 2026-Q3 | 2026-Q4 | 检查2026-Q3 |
|
||||
| 2026-07-01 | 2026-07-12 | 3-每半年 | 2026-H2 | 2026-H2 | 跳过 |
|
||||
| 2026-07-01 | 2027-01-01 | 3-每半年 | 2026-H2 | 2027-H1 | 检查2026-H2 |
|
||||
| 2026-07-01 | 2026-07-12 | 4-每年 | 2026-Y | 2026-Y | 跳过 |
|
||||
| 2026-07-01 | 2027-01-01 | 4-每年 | 2026-Y | 2027-Y | 检查2026-Y |
|
||||
|
|
@ -1,566 +0,0 @@
|
|||
# 安全责任清单表结构设计
|
||||
|
||||
## 一、需求概述
|
||||
|
||||
### 1.1 业务流程
|
||||
|
||||
1. **股份端创建任务清单** → 填写(名称,级别,责任岗位,开关,创建公司,创建部门,创建人)
|
||||
2. **根据任务清单ID进入任务列表** → 新建、查看
|
||||
3. **下发** → 给某公司的执行人
|
||||
4. **执行人按反馈周期按时提交反馈**
|
||||
5. **清单已完成或已关闭后可评分**
|
||||
|
||||
### 1.2 反馈周期规则
|
||||
|
||||
| 周期类型 | 规则说明 |
|
||||
|---------|---------|
|
||||
| 每月 | 每个月必须要有反馈,否则判定为有异常并记录 |
|
||||
| 每季度 | 按自然季度划分(3个月为一个季度),每个季度必须有一次反馈,否则判定为异常 |
|
||||
| 半年 | 按自然年划分(6个月为半年),每半年必须有一次反馈,否则判定为异常 |
|
||||
| 年 | 按自然年划分,每年必须有一次反馈,否则判定为异常 |
|
||||
|
||||
> **备注**:周期内可多次提交反馈
|
||||
|
||||
### 1.3 状态说明
|
||||
|
||||
- **已完成**:清单的周期时间结束
|
||||
- **已关闭**:手动关闭
|
||||
|
||||
---
|
||||
|
||||
## 二、表结构设计
|
||||
|
||||
### 2.1 ER关系图
|
||||
|
||||
```
|
||||
safety_accountability_task_list (任务清单表)
|
||||
│
|
||||
├── 1:N ──→ safety_accountability_task_detail (任务清单详细表)
|
||||
│ │
|
||||
│ ├── 1:N ──→ safety_accountability_feedback (执行反馈表)
|
||||
│ │
|
||||
│ └── 1:N ──→ safety_accountability_feedback_exception (反馈异常信息表)
|
||||
│
|
||||
└── 关联 ──→ 执行人信息(user表)
|
||||
```
|
||||
|
||||
### 2.2 表清单
|
||||
|
||||
| 序号 | 表名 | 表中文名 | 说明 |
|
||||
|-----|------|---------|------|
|
||||
| 1 | safety_accountability_task_list | 任务清单表 | 存储任务清单主信息 |
|
||||
| 2 | safety_accountability_task_detail | 任务清单详细表 | 存储任务详情及执行内容 |
|
||||
| 3 | safety_accountability_feedback | 执行反馈表 | 存储执行人提交的反馈 |
|
||||
| 4 | safety_accountability_feedback_exception | 反馈异常信息表 | 记录反馈异常信息 |
|
||||
|
||||
---
|
||||
|
||||
## 三、详细表结构
|
||||
|
||||
### 3.1 任务清单表 (safety_accountability_task_list)
|
||||
|
||||
**功能说明**:存储任务清单主信息,包括创建、下发、执行、评分等完整生命周期。
|
||||
|
||||
| 字段名 | 类型 | 是否必填 | 默认值 | 说明 |
|
||||
|-------|------|---------|-------|------|
|
||||
| id | bigint(20) | 是 | 自增 | 主键 |
|
||||
| task_list_id | varchar(64) | 是 | - | 清单UUID(业务主键) |
|
||||
| task_list_name | varchar(255) | 是 | - | 清单名称 |
|
||||
| task_level | tinyint(4) | 是 | - | 任务级别:1-企业级 2-部门级 3-班组级 |
|
||||
| responsibility_post | varchar(255) | 否 | NULL | 责任岗位 |
|
||||
| switch_flag | tinyint(4) | 是 | 1 | 开启/关闭:0-关 1-开 |
|
||||
| status | tinyint(4) | 是 | 1 | 状态:1-进行中 2-已完成 3-已关闭 |
|
||||
| period_start_time | datetime | 是 | - | 执行周期开始时间 |
|
||||
| period_end_time | datetime | 是 | - | 执行周期结束时间 |
|
||||
| feedback_status | tinyint(4) | 否 | 1 | 反馈状态:1-正常 2-存在异常 |
|
||||
| score | decimal(5,2) | 否 | NULL | 评分数 |
|
||||
| score_time | datetime | 否 | NULL | 评分时间 |
|
||||
| score_user_id | bigint(20) | 否 | NULL | 评分人ID |
|
||||
| score_user_name | varchar(50) | 否 | NULL | 评分人姓名 |
|
||||
| score_department_id | bigint(20) | 否 | NULL | 评分部门ID |
|
||||
| score_department_name | varchar(100) | 否 | NULL | 评分部门名称 |
|
||||
| create_corp_id | bigint(20) | 否 | NULL | 创建公司ID |
|
||||
| create_corp_name | varchar(100) | 否 | NULL | 创建公司名称 |
|
||||
| create_department_id | bigint(20) | 否 | NULL | 创建部门ID |
|
||||
| create_department_name | varchar(100) | 否 | NULL | 创建部门名称 |
|
||||
| create_user_id | bigint(20) | 否 | NULL | 创建人ID |
|
||||
| create_user_name | varchar(50) | 否 | NULL | 创建人姓名 |
|
||||
| issue_status | tinyint(4) | 否 | 0 | 下发状态:0-未下发 1-已下发 |
|
||||
| issue_time | datetime | 否 | NULL | 下发时间 |
|
||||
| issue_user_id | bigint(20) | 否 | NULL | 下发人ID |
|
||||
| issue_user_name | varchar(50) | 否 | NULL | 下发人姓名 |
|
||||
| execute_corp_id | bigint(20) | 否 | NULL | 执行公司ID |
|
||||
| execute_corp_name | varchar(100) | 否 | NULL | 执行公司名称 |
|
||||
| execute_department_id | bigint(20) | 否 | NULL | 执行部门ID |
|
||||
| execute_department_name | varchar(100) | 否 | NULL | 执行部门名称 |
|
||||
| execute_user_id | bigint(20) | 否 | NULL | 执行人员ID |
|
||||
| execute_user_name | varchar(50) | 否 | NULL | 执行人员姓名 |
|
||||
| close_time | datetime | 否 | NULL | 关闭时间 |
|
||||
| close_user_id | bigint(20) | 否 | NULL | 关闭人ID |
|
||||
| close_user_name | varchar(50) | 否 | NULL | 关闭人姓名 |
|
||||
| close_reason | varchar(500) | 否 | NULL | 关闭原因 |
|
||||
|
||||
**索引设计**:
|
||||
|
||||
| 索引名 | 索引类型 | 字段 |
|
||||
|-------|---------|------|
|
||||
| PRIMARY | 主键 | id |
|
||||
| uk_task_list_id | 唯一索引 | task_list_id |
|
||||
| idx_create_corp_id | 普通索引 | create_corp_id |
|
||||
| idx_execute_corp_id | 普通索引 | execute_corp_id |
|
||||
| idx_execute_user_id | 普通索引 | execute_user_id |
|
||||
| idx_status | 普通索引 | status |
|
||||
| idx_period_time | 普通索引 | period_start_time, period_end_time |
|
||||
|
||||
---
|
||||
|
||||
### 3.2 任务清单详细表 (safety_accountability_task_detail)
|
||||
|
||||
**功能说明**:存储任务详情,关联任务清单表,包含执行内容、反馈周期、评分等信息。
|
||||
|
||||
| 字段名 | 类型 | 是否必填 | 默认值 | 说明 |
|
||||
|-------|------|---------|-------|------|
|
||||
| id | bigint(20) | 是 | 自增 | 主键 |
|
||||
| task_detail_id | varchar(64) | 是 | - | 任务详情UUID(业务主键) |
|
||||
| task_list_id | varchar(64) | 是 | - | 任务清单主键(关联任务清单表) |
|
||||
| execute_content | text | 否 | NULL | 执行内容 |
|
||||
| feedback_cycle | tinyint(4) | 是 | - | 反馈周期:1-每月 2-季度 3-半年 4-年 |
|
||||
| task_status | tinyint(4) | 是 | 1 | 任务状态:1-进行中 2-已完成 3-已关闭 |
|
||||
| feedback_status | tinyint(4) | 否 | 1 | 反馈状态:1-正常 2-存在异常 |
|
||||
| task_score | decimal(5,2) | 否 | NULL | 任务分值 |
|
||||
| task_rating | decimal(5,2) | 否 | NULL | 任务评分 |
|
||||
| score_time | datetime | 否 | NULL | 评分时间 |
|
||||
| score_department_id | bigint(20) | 否 | NULL | 评分部门ID |
|
||||
| score_department_name | varchar(100) | 否 | NULL | 评分部门名称 |
|
||||
| score_user_id | bigint(20) | 否 | NULL | 评分人ID |
|
||||
| score_user_name | varchar(50) | 否 | NULL | 评分人姓名 |
|
||||
| current_period | varchar(20) | 否 | NULL | 当前周期标识 |
|
||||
| last_feedback_time | datetime | 否 | NULL | 上次反馈时间 |
|
||||
| last_feedback_period | varchar(20) | 否 | NULL | 上次反馈周期标识 |
|
||||
| abnormal_count | int(11) | 否 | 0 | 异常次数(未按时反馈累计次数) |
|
||||
|
||||
**索引设计**:
|
||||
|
||||
| 索引名 | 索引类型 | 字段 |
|
||||
|-------|---------|------|
|
||||
| PRIMARY | 主键 | id |
|
||||
| uk_task_detail_id | 唯一索引 | task_detail_id |
|
||||
| idx_task_list_id | 普通索引 | task_list_id |
|
||||
| idx_task_status | 普通索引 | task_status |
|
||||
| idx_feedback_status | 普通索引 | feedback_status |
|
||||
| idx_current_period | 普通索引 | current_period |
|
||||
|
||||
---
|
||||
|
||||
### 3.3 执行反馈表 (safety_accountability_feedback)
|
||||
|
||||
**功能说明**:存储执行人提交的反馈信息,支持周期内多次反馈。
|
||||
|
||||
| 字段名 | 类型 | 是否必填 | 默认值 | 说明 |
|
||||
|-------|------|---------|-------|------|
|
||||
| id | bigint(20) | 是 | 自增 | 主键 |
|
||||
| feedback_id | varchar(64) | 是 | - | 反馈UUID(业务主键) |
|
||||
| task_detail_id | varchar(64) | 是 | - | 任务详情UUID(关联任务清单详细表) |
|
||||
| task_list_id | varchar(64) | 是 | - | 任务清单UUID(冗余字段,便于查询) |
|
||||
| feedback_period | varchar(20) | 是 | - | 反馈周期标识 |
|
||||
| feedback_cycle | tinyint(4) | 是 | - | 反馈周期类型:1-每月 2-季度 3-半年 4-年 |
|
||||
| feedback_content | text | 否 | NULL | 反馈内容 |
|
||||
| feedback_time | datetime | 是 | - | 反馈时间 |
|
||||
| feedback_user_id | bigint(20) | 否 | NULL | 反馈人ID |
|
||||
| feedback_user_name | varchar(50) | 否 | NULL | 反馈人姓名 |
|
||||
| feedback_corp_id | bigint(20) | 否 | NULL | 反馈人公司ID |
|
||||
| feedback_corp_name | varchar(100) | 否 | NULL | 反馈人公司名称 |
|
||||
| feedback_department_id | bigint(20) | 否 | NULL | 反馈人部门ID |
|
||||
| feedback_department_name | varchar(100) | 否 | NULL | 反馈人部门名称 |
|
||||
| is_ontime | tinyint(4) | 否 | 1 | 是否按时反馈:1-是 0-否 |
|
||||
|
||||
**索引设计**:
|
||||
|
||||
| 索引名 | 索引类型 | 字段 |
|
||||
|-------|---------|------|
|
||||
| PRIMARY | 主键 | id |
|
||||
| uk_feedback_id | 唯一索引 | feedback_id |
|
||||
| idx_task_detail_id | 普通索引 | task_detail_id |
|
||||
| idx_task_list_id | 普通索引 | task_list_id |
|
||||
| idx_feedback_period | 普通索引 | feedback_period |
|
||||
| idx_feedback_user_id | 普通索引 | feedback_user_id |
|
||||
| idx_feedback_time | 普通索引 | feedback_time |
|
||||
|
||||
---
|
||||
|
||||
### 3.4 反馈异常信息表 (safety_accountability_feedback_exception)
|
||||
|
||||
**功能说明**:记录反馈异常信息,包括未按时反馈等情况。
|
||||
|
||||
| 字段名 | 类型 | 是否必填 | 默认值 | 说明 |
|
||||
|-------|------|---------|-------|------|
|
||||
| id | bigint(20) | 是 | 自增 | 主键 |
|
||||
| exception_id | varchar(64) | 是 | - | 反馈异常UUID(业务主键) |
|
||||
| task_detail_id | varchar(64) | 是 | - | 任务详情主键(关联任务清单详细表) |
|
||||
| task_list_id | varchar(64) | 否 | NULL | 任务清单主键(冗余字段) |
|
||||
| feedback_id | varchar(64) | 否 | NULL | 关联的反馈ID(如果是反馈触发的异常) |
|
||||
| exception_period | varchar(20) | 否 | NULL | 异常周期标识 |
|
||||
| exception_type | tinyint(4) | 是 | - | 异常类型:1-未按时反馈 2-反馈内容异常 3-其他 |
|
||||
| exception_info | text | 否 | NULL | 反馈异常信息 |
|
||||
| exception_time | datetime | 否 | CURRENT_TIMESTAMP | 异常时间 |
|
||||
| handle_status | tinyint(4) | 否 | 0 | 处理状态:0-未处理 1-已处理 |
|
||||
| handle_time | datetime | 否 | NULL | 处理时间 |
|
||||
| handle_user_id | bigint(20) | 否 | NULL | 处理人ID |
|
||||
| handle_user_name | varchar(50) | 否 | NULL | 处理人姓名 |
|
||||
| handle_remark | varchar(500) | 否 | NULL | 处理备注 |
|
||||
|
||||
**索引设计**:
|
||||
|
||||
| 索引名 | 索引类型 | 字段 |
|
||||
|-------|---------|------|
|
||||
| PRIMARY | 主键 | id |
|
||||
| uk_exception_id | 唯一索引 | exception_id |
|
||||
| idx_task_detail_id | 普通索引 | task_detail_id |
|
||||
| idx_task_list_id | 普通索引 | task_list_id |
|
||||
| idx_exception_type | 普通索引 | exception_type |
|
||||
| idx_exception_period | 普通索引 | exception_period |
|
||||
| idx_handle_status | 普通索引 | handle_status |
|
||||
|
||||
---
|
||||
|
||||
## 四、通用字段说明
|
||||
|
||||
所有表均包含以下通用字段:
|
||||
|
||||
| 字段名 | 类型 | 默认值 | 说明 |
|
||||
|-------|------|-------|------|
|
||||
| delete_enum | varchar(32) | 'FALSE' | 删除标识:TRUE/FALSE |
|
||||
| remarks | varchar(500) | NULL | 备注 |
|
||||
| create_name | varchar(50) | NULL | 创建人姓名 |
|
||||
| update_name | varchar(50) | NULL | 更新人姓名 |
|
||||
| tenant_id | bigint(20) | NULL | 租户ID |
|
||||
| org_id | bigint(20) | NULL | 单位ID |
|
||||
| version | int(11) | 0 | 版本 |
|
||||
| create_time | datetime | CURRENT_TIMESTAMP | 创建时间 |
|
||||
| update_time | datetime | CURRENT_TIMESTAMP ON UPDATE | 修改时间 |
|
||||
| create_id | bigint(20) | NULL | 创建人ID |
|
||||
| update_id | bigint(20) | NULL | 修改人ID |
|
||||
| env | varchar(50) | NULL | 环境标识 |
|
||||
|
||||
---
|
||||
|
||||
## 五、周期标识格式说明
|
||||
|
||||
### 5.1 周期标识格式定义
|
||||
|
||||
| 周期类型 | 周期标识格式 | 示例 | 说明 |
|
||||
|---------|-------------|------|------|
|
||||
| 每月 | `yyyy-MM` | `2026-05` | 表示2026年5月 |
|
||||
| 每季度 | `yyyy-Qn` | `2026-Q1`、`2026-Q2`、`2026-Q3`、`2026-Q4` | Q1-Q4分别表示四个季度 |
|
||||
| 半年 | `yyyy-Hn` | `2026-H1`、`2026-H2` | H1表示上半年,H2表示下半年 |
|
||||
| 年 | `yyyy` | `2026` | 表示2026年整年 |
|
||||
|
||||
### 5.2 季度划分规则
|
||||
|
||||
| 季度 | 包含月份 | 周期标识示例 |
|
||||
|-----|---------|-------------|
|
||||
| Q1(第一季度) | 1月、2月、3月 | 2026-Q1 |
|
||||
| Q2(第二季度) | 4月、5月、6月 | 2026-Q2 |
|
||||
| Q3(第三季度) | 7月、8月、9月 | 2026-Q3 |
|
||||
| Q4(第四季度) | 10月、11月、12月 | 2026-Q4 |
|
||||
|
||||
### 5.3 半年划分规则
|
||||
|
||||
| 半年 | 包含月份 | 周期标识示例 |
|
||||
|-----|---------|-------------|
|
||||
| H1(上半年) | 1月-6月 | 2026-H1 |
|
||||
| H2(下半年) | 7月-12月 | 2026-H2 |
|
||||
|
||||
---
|
||||
|
||||
## 六、设计优化说明
|
||||
|
||||
### 6.1 任务清单表优化
|
||||
|
||||
| 优化项 | 原设计 | 优化后 | 优化原因 |
|
||||
|-------|-------|-------|---------|
|
||||
| 下发相关字段 | 无 | 新增下发状态、下发时间、下发人 | 支持下发流程跟踪 |
|
||||
| 关闭相关字段 | 无 | 新增关闭时间、关闭人、关闭原因 | 支持手动关闭记录 |
|
||||
| 评分相关字段 | 评分数 | 新增评分时间、评分人、评分部门 | 完善评分信息 |
|
||||
| 名称字段 | 无 | 新增创建公司名称、创建部门名称、执行公司名称等 | 减少关联查询,提升查询效率 |
|
||||
|
||||
### 6.2 任务详情表优化
|
||||
|
||||
| 优化项 | 原设计 | 优化后 | 优化原因 |
|
||||
|-------|-------|-------|---------|
|
||||
| 当前周期标识 | 无 | current_period | 快速判断当前应反馈的周期 |
|
||||
| 上次反馈信息 | 无 | last_feedback_time, last_feedback_period | 追踪反馈历史 |
|
||||
| 异常次数统计 | 无 | abnormal_count | 便于统计和展示异常情况 |
|
||||
|
||||
### 6.3 反馈表优化
|
||||
|
||||
| 优化项 | 原设计 | 优化后 | 优化原因 |
|
||||
|-------|-------|-------|---------|
|
||||
| 周期标识 | 反馈周期 | feedback_period(具体周期标识) | 精确判断是否按时反馈 |
|
||||
| 是否按时 | 无 | is_ontime | 便于统计按时/逾期反馈 |
|
||||
| 冗余字段 | 无 | task_list_id | 减少关联查询,提升查询效率 |
|
||||
| 反馈人详细信息 | 反馈人 | 新增反馈人公司、部门信息 | 完整记录反馈人信息 |
|
||||
|
||||
### 6.4 异常表优化
|
||||
|
||||
| 优化项 | 原设计 | 优化后 | 优化原因 |
|
||||
|-------|-------|-------|---------|
|
||||
| 异常类型 | 无 | exception_type | 区分不同类型的异常 |
|
||||
| 处理相关字段 | 无 | 新增处理状态、处理时间、处理人、处理备注 | 支持异常处理流程 |
|
||||
| 关联反馈 | 无 | feedback_id | 关联触发异常的反馈记录 |
|
||||
|
||||
---
|
||||
|
||||
## 七、完整建表SQL
|
||||
|
||||
```sql
|
||||
-- =============================================
|
||||
-- 任务清单表
|
||||
-- =============================================
|
||||
CREATE TABLE `safety_accountability_task_list` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`task_list_id` varchar(64) NOT NULL COMMENT '清单UUID(业务主键)',
|
||||
`task_list_name` varchar(255) NOT NULL COMMENT '清单名称',
|
||||
`task_level` tinyint(4) NOT NULL COMMENT '任务级别:1-企业级 2-部门级 3-班组级',
|
||||
`responsibility_post` varchar(255) DEFAULT NULL COMMENT '责任岗位',
|
||||
`switch_flag` tinyint(4) NOT NULL DEFAULT '1' COMMENT '开启/关闭:0-关 1-开',
|
||||
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态:1-进行中 2-已完成 3-已关闭',
|
||||
`period_start_time` datetime NOT NULL COMMENT '执行周期开始时间',
|
||||
`period_end_time` datetime NOT NULL COMMENT '执行周期结束时间',
|
||||
`feedback_status` tinyint(4) DEFAULT '1' COMMENT '反馈状态:1-正常 2-存在异常',
|
||||
`score` decimal(5,2) DEFAULT NULL COMMENT '评分数',
|
||||
`score_time` datetime DEFAULT NULL COMMENT '评分时间',
|
||||
`score_user_id` bigint(20) DEFAULT NULL COMMENT '评分人ID',
|
||||
`score_user_name` varchar(50) DEFAULT NULL COMMENT '评分人姓名',
|
||||
`score_department_id` bigint(20) DEFAULT NULL COMMENT '评分部门ID',
|
||||
`score_department_name` varchar(100) DEFAULT NULL COMMENT '评分部门名称',
|
||||
`create_corp_id` bigint(20) DEFAULT NULL COMMENT '创建公司ID',
|
||||
`create_corp_name` varchar(100) DEFAULT NULL COMMENT '创建公司名称',
|
||||
`create_department_id` bigint(20) DEFAULT NULL COMMENT '创建部门ID',
|
||||
`create_department_name` varchar(100) DEFAULT NULL COMMENT '创建部门名称',
|
||||
`create_user_id` bigint(20) DEFAULT NULL COMMENT '创建人ID',
|
||||
`create_user_name` varchar(50) DEFAULT NULL COMMENT '创建人姓名',
|
||||
`issue_status` tinyint(4) DEFAULT '0' COMMENT '下发状态:0-未下发 1-已下发',
|
||||
`issue_time` datetime DEFAULT NULL COMMENT '下发时间',
|
||||
`issue_user_id` bigint(20) DEFAULT NULL COMMENT '下发人ID',
|
||||
`issue_user_name` varchar(50) DEFAULT NULL COMMENT '下发人姓名',
|
||||
`execute_corp_id` bigint(20) DEFAULT NULL COMMENT '执行公司ID',
|
||||
`execute_corp_name` varchar(100) DEFAULT NULL COMMENT '执行公司名称',
|
||||
`execute_department_id` bigint(20) DEFAULT NULL COMMENT '执行部门ID',
|
||||
`execute_department_name` varchar(100) DEFAULT NULL COMMENT '执行部门名称',
|
||||
`execute_user_id` bigint(20) DEFAULT NULL COMMENT '执行人员ID',
|
||||
`execute_user_name` varchar(50) DEFAULT NULL COMMENT '执行人员姓名',
|
||||
`close_time` datetime DEFAULT NULL COMMENT '关闭时间',
|
||||
`close_user_id` bigint(20) DEFAULT NULL COMMENT '关闭人ID',
|
||||
`close_user_name` varchar(50) DEFAULT NULL COMMENT '关闭人姓名',
|
||||
`close_reason` varchar(500) DEFAULT NULL COMMENT '关闭原因',
|
||||
`delete_enum` varchar(32) DEFAULT 'FALSE' COMMENT '删除标识:TRUE/FALSE',
|
||||
`remarks` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
`create_name` varchar(50) DEFAULT NULL COMMENT '创建人姓名',
|
||||
`update_name` varchar(50) DEFAULT NULL COMMENT '更新人姓名',
|
||||
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户ID',
|
||||
`org_id` bigint(20) DEFAULT NULL COMMENT '单位ID',
|
||||
`version` int(11) DEFAULT '0' COMMENT '版本',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`create_id` bigint(20) DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_id` bigint(20) DEFAULT NULL COMMENT '修改人ID',
|
||||
`env` varchar(50) DEFAULT NULL COMMENT '环境标识',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_task_list_id` (`task_list_id`),
|
||||
KEY `idx_create_corp_id` (`create_corp_id`),
|
||||
KEY `idx_execute_corp_id` (`execute_corp_id`),
|
||||
KEY `idx_execute_user_id` (`execute_user_id`),
|
||||
KEY `idx_status` (`status`),
|
||||
KEY `idx_period_time` (`period_start_time`, `period_end_time`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='任务清单表';
|
||||
|
||||
-- =============================================
|
||||
-- 任务清单详细表
|
||||
-- =============================================
|
||||
CREATE TABLE `safety_accountability_task_detail` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`task_detail_id` varchar(64) NOT NULL COMMENT '任务详情UUID(业务主键)',
|
||||
`task_list_id` varchar(64) NOT NULL COMMENT '任务清单主键(关联任务清单表)',
|
||||
`execute_content` text COMMENT '执行内容',
|
||||
`feedback_cycle` tinyint(4) NOT NULL COMMENT '反馈周期:1-每月 2-季度 3-半年 4-年',
|
||||
`task_status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '任务状态:1-进行中 2-已完成 3-已关闭',
|
||||
`feedback_status` tinyint(4) DEFAULT '1' COMMENT '反馈状态:1-正常 2-存在异常',
|
||||
`task_score` decimal(5,2) DEFAULT NULL COMMENT '任务分值',
|
||||
`task_rating` decimal(5,2) DEFAULT NULL COMMENT '任务评分',
|
||||
`score_time` datetime DEFAULT NULL COMMENT '评分时间',
|
||||
`score_department_id` bigint(20) DEFAULT NULL COMMENT '评分部门ID',
|
||||
`score_department_name` varchar(100) DEFAULT NULL COMMENT '评分部门名称',
|
||||
`score_user_id` bigint(20) DEFAULT NULL COMMENT '评分人ID',
|
||||
`score_user_name` varchar(50) DEFAULT NULL COMMENT '评分人姓名',
|
||||
`current_period` varchar(20) DEFAULT NULL COMMENT '当前周期标识(格式:2026-05表示月,2026-Q1表示季度,2026-H1表示半年,2026表示年)',
|
||||
`last_feedback_time` datetime DEFAULT NULL COMMENT '上次反馈时间',
|
||||
`last_feedback_period` varchar(20) DEFAULT NULL COMMENT '上次反馈周期标识',
|
||||
`abnormal_count` int(11) DEFAULT '0' COMMENT '异常次数(未按时反馈累计次数)',
|
||||
`delete_enum` varchar(32) DEFAULT 'FALSE' COMMENT '删除标识:TRUE/FALSE',
|
||||
`remarks` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
`create_name` varchar(50) DEFAULT NULL COMMENT '创建人姓名',
|
||||
`update_name` varchar(50) DEFAULT NULL COMMENT '更新人姓名',
|
||||
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户ID',
|
||||
`org_id` bigint(20) DEFAULT NULL COMMENT '单位ID',
|
||||
`version` int(11) DEFAULT '0' COMMENT '版本',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`create_id` bigint(20) DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_id` bigint(20) DEFAULT NULL COMMENT '修改人ID',
|
||||
`env` varchar(50) DEFAULT NULL COMMENT '环境标识',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_task_detail_id` (`task_detail_id`),
|
||||
KEY `idx_task_list_id` (`task_list_id`),
|
||||
KEY `idx_task_status` (`task_status`),
|
||||
KEY `idx_feedback_status` (`feedback_status`),
|
||||
KEY `idx_current_period` (`current_period`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='任务清单详细表';
|
||||
|
||||
-- =============================================
|
||||
-- 执行反馈表
|
||||
-- =============================================
|
||||
CREATE TABLE `safety_accountability_feedback` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`feedback_id` varchar(64) NOT NULL COMMENT '反馈UUID(业务主键)',
|
||||
`task_detail_id` varchar(64) NOT NULL COMMENT '任务详情UUID(关联任务清单详细表)',
|
||||
`task_list_id` varchar(64) NOT NULL COMMENT '任务清单UUID(冗余字段,便于查询)',
|
||||
`feedback_period` varchar(20) NOT NULL COMMENT '反馈周期标识(格式:2026-05表示月,2026-Q1表示季度,2026-H1表示半年,2026表示年)',
|
||||
`feedback_cycle` tinyint(4) NOT NULL COMMENT '反馈周期类型:1-每月 2-季度 3-半年 4-年',
|
||||
`feedback_content` text COMMENT '反馈内容',
|
||||
`feedback_time` datetime NOT NULL COMMENT '反馈时间',
|
||||
`feedback_user_id` bigint(20) DEFAULT NULL COMMENT '反馈人ID',
|
||||
`feedback_user_name` varchar(50) DEFAULT NULL COMMENT '反馈人姓名',
|
||||
`feedback_corp_id` bigint(20) DEFAULT NULL COMMENT '反馈人公司ID',
|
||||
`feedback_corp_name` varchar(100) DEFAULT NULL COMMENT '反馈人公司名称',
|
||||
`feedback_department_id` bigint(20) DEFAULT NULL COMMENT '反馈人部门ID',
|
||||
`feedback_department_name` varchar(100) DEFAULT NULL COMMENT '反馈人部门名称',
|
||||
`is_ontime` tinyint(4) DEFAULT '1' COMMENT '是否按时反馈:1-是 0-否',
|
||||
`delete_enum` varchar(32) DEFAULT 'FALSE' COMMENT '删除标识:TRUE/FALSE',
|
||||
`remarks` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
`create_name` varchar(50) DEFAULT NULL COMMENT '创建人姓名',
|
||||
`update_name` varchar(50) DEFAULT NULL COMMENT '更新人姓名',
|
||||
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户ID',
|
||||
`org_id` bigint(20) DEFAULT NULL COMMENT '单位ID',
|
||||
`version` int(11) DEFAULT '0' COMMENT '版本',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`create_id` bigint(20) DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_id` bigint(20) DEFAULT NULL COMMENT '修改人ID',
|
||||
`env` varchar(50) DEFAULT NULL COMMENT '环境标识',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_feedback_id` (`feedback_id`),
|
||||
KEY `idx_task_detail_id` (`task_detail_id`),
|
||||
KEY `idx_task_list_id` (`task_list_id`),
|
||||
KEY `idx_feedback_period` (`feedback_period`),
|
||||
KEY `idx_feedback_user_id` (`feedback_user_id`),
|
||||
KEY `idx_feedback_time` (`feedback_time`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='执行反馈表';
|
||||
|
||||
-- =============================================
|
||||
-- 反馈异常信息表
|
||||
-- =============================================
|
||||
CREATE TABLE `safety_accountability_feedback_exception` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`exception_id` varchar(64) NOT NULL COMMENT '反馈异常UUID(业务主键)',
|
||||
`task_detail_id` varchar(64) NOT NULL COMMENT '任务详情主键(关联任务清单详细表)',
|
||||
`task_list_id` varchar(64) DEFAULT NULL COMMENT '任务清单主键(冗余字段)',
|
||||
`feedback_id` varchar(64) DEFAULT NULL COMMENT '关联的反馈ID(如果是反馈触发的异常)',
|
||||
`exception_period` varchar(20) DEFAULT NULL COMMENT '异常周期标识',
|
||||
`exception_type` tinyint(4) NOT NULL COMMENT '异常类型:1-未按时反馈 2-反馈内容异常 3-其他',
|
||||
`exception_info` text COMMENT '反馈异常信息',
|
||||
`exception_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '异常时间',
|
||||
`handle_status` tinyint(4) DEFAULT '0' COMMENT '处理状态:0-未处理 1-已处理',
|
||||
`handle_time` datetime DEFAULT NULL COMMENT '处理时间',
|
||||
`handle_user_id` bigint(20) DEFAULT NULL COMMENT '处理人ID',
|
||||
`handle_user_name` varchar(50) DEFAULT NULL COMMENT '处理人姓名',
|
||||
`handle_remark` varchar(500) DEFAULT NULL COMMENT '处理备注',
|
||||
`delete_enum` varchar(32) DEFAULT 'FALSE' COMMENT '删除标识:TRUE/FALSE',
|
||||
`remarks` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
`create_name` varchar(50) DEFAULT NULL COMMENT '创建人姓名',
|
||||
`update_name` varchar(50) DEFAULT NULL COMMENT '更新人姓名',
|
||||
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户ID',
|
||||
`org_id` bigint(20) DEFAULT NULL COMMENT '单位ID',
|
||||
`version` int(11) DEFAULT '0' COMMENT '版本',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`create_id` bigint(20) DEFAULT NULL COMMENT '创建人ID',
|
||||
`update_id` bigint(20) DEFAULT NULL COMMENT '修改人ID',
|
||||
`env` varchar(50) DEFAULT NULL COMMENT '环境标识',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_exception_id` (`exception_id`),
|
||||
KEY `idx_task_detail_id` (`task_detail_id`),
|
||||
KEY `idx_task_list_id` (`task_list_id`),
|
||||
KEY `idx_exception_type` (`exception_type`),
|
||||
KEY `idx_exception_period` (`exception_period`),
|
||||
KEY `idx_handle_status` (`handle_status`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='反馈异常信息表';
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 八、业务流程数据流转示例
|
||||
|
||||
### 8.1 创建任务清单流程
|
||||
|
||||
```
|
||||
1. 股份端用户创建任务清单
|
||||
↓
|
||||
INSERT INTO safety_accountability_task_list
|
||||
(task_list_id, task_list_name, task_level, ..., status=1, issue_status=0)
|
||||
|
||||
2. 添加任务详情
|
||||
↓
|
||||
INSERT INTO safety_accountability_task_detail
|
||||
(task_detail_id, task_list_id, execute_content, feedback_cycle, ...)
|
||||
```
|
||||
|
||||
### 8.2 下发任务流程
|
||||
|
||||
```
|
||||
1. 选择执行人,下发任务
|
||||
↓
|
||||
UPDATE safety_accountability_task_list
|
||||
SET issue_status=1, issue_time=NOW(),
|
||||
execute_corp_id=xxx, execute_user_id=xxx, ...
|
||||
WHERE task_list_id=xxx
|
||||
```
|
||||
|
||||
### 8.3 提交反馈流程
|
||||
|
||||
```
|
||||
1. 执行人提交反馈
|
||||
↓
|
||||
INSERT INTO safety_accountability_feedback
|
||||
(feedback_id, task_detail_id, feedback_period, feedback_content, ...)
|
||||
|
||||
2. 更新任务详情
|
||||
↓
|
||||
UPDATE safety_accountability_task_detail
|
||||
SET last_feedback_time=NOW(), last_feedback_period='2026-Q1', ...
|
||||
WHERE task_detail_id=xxx
|
||||
```
|
||||
|
||||
### 8.4 异常记录流程
|
||||
|
||||
```
|
||||
1. 定时任务检测未按时反馈
|
||||
↓
|
||||
INSERT INTO safety_accountability_feedback_exception
|
||||
(exception_id, task_detail_id, exception_type=1, exception_period='2026-Q1', ...)
|
||||
|
||||
2. 更新异常次数
|
||||
↓
|
||||
UPDATE safety_accountability_task_detail
|
||||
SET abnormal_count=abnormal_count+1, feedback_status=2
|
||||
WHERE task_detail_id=xxx
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 九、注意事项
|
||||
|
||||
1. **周期判断逻辑**:需要在应用层或定时任务中实现周期判断逻辑,自动检测是否按时反馈
|
||||
2. **索引优化**:根据实际查询场景,可能需要调整或添加复合索引
|
||||
3. **数据量预估**:反馈表数据量可能较大,建议定期归档历史数据
|
||||
4. **并发控制**:使用 `version` 字段实现乐观锁,防止并发更新冲突
|
||||
|
|
@ -58,7 +58,7 @@ public class FeedbackController {
|
|||
|
||||
@ApiOperation("获取反馈详情")
|
||||
@GetMapping("/{feedbackId}")
|
||||
public SingleResponse<FeedbackInfoCO> getByFeedbackId(@PathVariable String feedbackId) {
|
||||
public SingleResponse<FeedbackCO> getByFeedbackId(@PathVariable String feedbackId) {
|
||||
return taskListService.getByFeedbackId(feedbackId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ import com.alibaba.cola.dto.Response;
|
|||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safetyDutyList.api.tasklist.TaskListServiceI;
|
||||
import com.zcloud.safetyDutyList.dto.clientobject.tasklist.TaskDetailCO;
|
||||
import com.zcloud.safetyDutyList.dto.clientobject.tasklist.TaskDetailFullCO;
|
||||
import com.zcloud.safetyDutyList.dto.clientobject.tasklist.TaskDetailInfoCO;
|
||||
import com.zcloud.safetyDutyList.dto.clientobject.tasklist.TaskExecutionCO;
|
||||
import com.zcloud.safetyDutyList.dto.tasklist.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
@ -31,17 +31,18 @@ public class TaskDetailController {
|
|||
/** 安全责任清单服务接口(任务详情相关操作统一通过该接口处理) */
|
||||
private final TaskListServiceI taskListService;
|
||||
|
||||
@ApiOperation("获取任务列表")
|
||||
@ApiOperation("获取任务列表(模板)")
|
||||
@PostMapping("/list")
|
||||
public PageResponse<TaskDetailFullCO> listPage(@Validated @RequestBody TaskDetailPageQry qry) {
|
||||
return taskListService.listPage(qry);
|
||||
public PageResponse<TaskDetailCO> listPage(@Validated @RequestBody TaskDetailPageQry qry) {
|
||||
return taskListService.listTaskDetailPage(qry);
|
||||
}
|
||||
|
||||
@ApiOperation("新增任务")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<TaskDetailCO> add(@Validated @RequestBody TaskDetailSaveCmd cmd) {
|
||||
return taskListService.addTaskDetail(cmd);
|
||||
}
|
||||
// 批量插入 - 此接口废弃
|
||||
// @ApiOperation("新增任务")
|
||||
// @PostMapping("/save")
|
||||
// public SingleResponse<TaskDetailCO> add(@Validated @RequestBody TaskDetailSaveCmd cmd) {
|
||||
// return taskListService.addTaskDetail(cmd);
|
||||
// }
|
||||
|
||||
@ApiOperation("批量保存任务")
|
||||
@PostMapping("/saveBatch")
|
||||
|
|
@ -66,10 +67,4 @@ public class TaskDetailController {
|
|||
public Response close(@Validated @RequestBody TaskDetailCloseCmd cmd) {
|
||||
return taskListService.closeTaskDetail(cmd);
|
||||
}
|
||||
|
||||
@ApiOperation("更新任务评分")
|
||||
@PostMapping("/updateScore")
|
||||
public Response updateScore(@Validated @RequestBody TaskDetailUpdateScoreCmd cmd) {
|
||||
return taskListService.updateTaskDetailScore(cmd);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
package com.zcloud.safetyDutyList.web.tasklist;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.Response;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safetyDutyList.api.tasklist.TaskListServiceI;
|
||||
import com.zcloud.safetyDutyList.dto.clientobject.tasklist.TaskExecutionCO;
|
||||
import com.zcloud.safetyDutyList.dto.tasklist.TaskDetailUpdateScoreCmd;
|
||||
import com.zcloud.safetyDutyList.dto.tasklist.TaskExecutionPageQry;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 任务执行记录控制器
|
||||
* <p>
|
||||
* 提供任务执行记录的查询接口,
|
||||
* 委托TaskListServiceI处理业务逻辑。
|
||||
*/
|
||||
@Api(tags = "任务执行记录")
|
||||
@RequestMapping("/${application.gateway}/taskExecution")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class TaskExecutionController {
|
||||
private final TaskListServiceI taskListService;
|
||||
|
||||
@ApiOperation("获取任务执行记录列表")
|
||||
@PostMapping("/list")
|
||||
public PageResponse<TaskExecutionCO> listPage(@Validated @RequestBody TaskExecutionPageQry qry) {
|
||||
return taskListService.listExecutionPage(qry);
|
||||
}
|
||||
|
||||
@ApiOperation("获取任务执行记录详情")
|
||||
@GetMapping("/{taskExecutionId}")
|
||||
public SingleResponse<TaskExecutionCO> getByTaskExecutionId(@PathVariable String taskExecutionId) {
|
||||
return taskListService.getExecutionByTaskExecutionId(taskExecutionId);
|
||||
}
|
||||
|
||||
@ApiOperation("更新任务评分")
|
||||
@PostMapping("/updateScore")
|
||||
public Response updateScore(@Validated @RequestBody TaskDetailUpdateScoreCmd cmd) {
|
||||
return taskListService.updateTaskDetailScore(cmd);
|
||||
}
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import com.alibaba.cola.dto.Response;
|
|||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safetyDutyList.api.tasklist.TaskListServiceI;
|
||||
import com.zcloud.safetyDutyList.dto.clientobject.tasklist.TaskListCO;
|
||||
import com.zcloud.safetyDutyList.dto.clientobject.tasklist.TaskListIssueCO;
|
||||
import com.zcloud.safetyDutyList.dto.tasklist.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
package com.zcloud.safetyDutyList.web.tasklist;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safetyDutyList.api.tasklist.TaskListServiceI;
|
||||
import com.zcloud.safetyDutyList.dto.clientobject.tasklist.TaskListIssueCO;
|
||||
import com.zcloud.safetyDutyList.dto.tasklist.TaskListIssuePageQry;
|
||||
import com.zcloud.safetyDutyList.dto.tasklist.TaskListPageQry;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 清单下发记录控制器
|
||||
* <p>
|
||||
* 提供清单下发记录的查询接口,
|
||||
* 委托TaskListServiceI处理业务逻辑。
|
||||
*/
|
||||
@Api(tags = "清单下发记录")
|
||||
@RequestMapping("/${application.gateway}/taskListIssue")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class TaskListIssueController {
|
||||
private final TaskListServiceI taskListService;
|
||||
|
||||
@ApiOperation("获取清单下发记录列表")
|
||||
@PostMapping("/list")
|
||||
public PageResponse<TaskListIssueCO> listPage(@Validated @RequestBody TaskListIssuePageQry qry) {
|
||||
return taskListService.listIssuePage(qry);
|
||||
}
|
||||
|
||||
@ApiOperation("获取清单下发记录详情")
|
||||
@GetMapping("/{taskIssueId}")
|
||||
public SingleResponse<TaskListIssueCO> getByTaskIssueId(@PathVariable String taskIssueId) {
|
||||
return taskListService.getIssueByTaskIssueId(taskIssueId);
|
||||
}
|
||||
}
|
||||
|
|
@ -28,11 +28,25 @@ public class FeedbackQueryExe {
|
|||
private final TaskDetailRepository taskDetailRepository;
|
||||
|
||||
public MultiResponse<FeedbackPeriodGroupCO> periodGroupList(FeedbackPeriodGroupQry qry) {
|
||||
List<FeedbackDO> feedbackList = feedbackRepository.listByTaskDetailId(qry.getTaskDetailId());
|
||||
List<FeedbackDO> feedbackList = feedbackRepository.listByTaskExecutionId(qry.getTaskExecutionId());
|
||||
if (feedbackList == null || feedbackList.isEmpty()) {
|
||||
return MultiResponse.of(new ArrayList<>());
|
||||
}
|
||||
|
||||
// Filter by time range if provided
|
||||
if (qry.getFeedbackTimeStart() != null || qry.getFeedbackTimeEnd() != null) {
|
||||
feedbackList = feedbackList.stream().filter(f -> {
|
||||
boolean match = true;
|
||||
if (qry.getFeedbackTimeStart() != null && !qry.getFeedbackTimeStart().isEmpty() && f.getFeedbackTime() != null) {
|
||||
match = f.getFeedbackTime().isAfter(java.time.LocalDate.parse(qry.getFeedbackTimeStart()).atStartOfDay());
|
||||
}
|
||||
if (qry.getFeedbackTimeEnd() != null && !qry.getFeedbackTimeEnd().isEmpty() && f.getFeedbackTime() != null) {
|
||||
match = match && f.getFeedbackTime().isBefore(java.time.LocalDate.parse(qry.getFeedbackTimeEnd()).plusDays(1).atStartOfDay());
|
||||
}
|
||||
return match;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
Map<String, List<FeedbackDO>> groupedByPeriod = feedbackList.stream()
|
||||
.filter(f -> f.getFeedbackPeriodFlag() != null)
|
||||
.collect(Collectors.groupingBy(FeedbackDO::getFeedbackPeriodFlag));
|
||||
|
|
@ -40,7 +54,7 @@ public class FeedbackQueryExe {
|
|||
List<FeedbackPeriodGroupCO> result = new ArrayList<>();
|
||||
groupedByPeriod.forEach((periodFlag, feedbacks) -> {
|
||||
FeedbackPeriodGroupCO co = new FeedbackPeriodGroupCO();
|
||||
co.setTaskDetailId(qry.getTaskDetailId());
|
||||
co.setTaskExecutionId(qry.getTaskExecutionId());
|
||||
co.setFeedbackPeriodFlag(periodFlag);
|
||||
co.setFeedbackCount(feedbacks.size());
|
||||
if (!feedbacks.isEmpty()) {
|
||||
|
|
@ -69,12 +83,12 @@ public class FeedbackQueryExe {
|
|||
return PageResponse.of(coList, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||
}
|
||||
|
||||
public SingleResponse<FeedbackInfoCO> getByFeedbackId(String feedbackId) {
|
||||
public SingleResponse<FeedbackCO> getByFeedbackId(String feedbackId) {
|
||||
FeedbackDO feedbackDO = feedbackRepository.getByFeedbackId(feedbackId);
|
||||
if (feedbackDO == null) {
|
||||
throw new BizException("反馈记录不存在");
|
||||
}
|
||||
FeedbackInfoCO co = new FeedbackInfoCO();
|
||||
FeedbackCO co = new FeedbackCO();
|
||||
BeanUtils.copyProperties(feedbackDO, co);
|
||||
|
||||
TaskDetailDO detailDO = taskDetailRepository.getByTaskDetailId(feedbackDO.getTaskDetailId());
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import com.alibaba.cola.dto.SingleResponse;
|
|||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
import com.zcloud.safetyDutyList.command.convertor.tasklist.TaskListCoConvertor;
|
||||
import com.zcloud.safetyDutyList.domain.enums.*;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.FeedbackExceptionGateway;
|
||||
import com.zcloud.safetyDutyList.dto.clientobject.tasklist.*;
|
||||
import com.zcloud.safetyDutyList.dto.tasklist.TaskDetailPageQry;
|
||||
|
|
@ -26,7 +25,7 @@ import java.util.stream.Collectors;
|
|||
* 任务详情查询执行器
|
||||
* <p>
|
||||
* 处理任务详情相关的查询业务:
|
||||
* - 任务详情分页列表查询(通过Mapper联表一次性查出所有字段,异常列表仍需单独查询)
|
||||
* - 任务详情分页列表查询
|
||||
* - 任务详情详情查询(含所属清单信息)
|
||||
*/
|
||||
@Component
|
||||
|
|
@ -36,16 +35,17 @@ public class TaskDetailQueryExe {
|
|||
private final FeedbackExceptionRepository feedbackExceptionRepository;
|
||||
private final TaskListCoConvertor taskListCoConvertor;
|
||||
|
||||
/**
|
||||
* 分页查询任务详情列表
|
||||
* <p>
|
||||
* 通过Mapper层联表查询一次性获取:
|
||||
* - LEFT JOIN task_list 获取清单名称、任务级别、责任岗位
|
||||
* - LEFT JOIN department/user 获取评分部门名称、评分人姓名
|
||||
* - LEFT JOIN (子查询聚合feedback) 获取反馈次数、当前周期是否已反馈
|
||||
* <p>
|
||||
* 异常列表仍需按taskListId单独查询后按taskDetailId分组匹配
|
||||
*/
|
||||
public PageResponse<TaskDetailCO> listTaskDetailPage(TaskDetailPageQry qry) {
|
||||
Map<String, Object> params = PageQueryHelper.toHashMap(qry);
|
||||
PageResponse<TaskDetailDO> pageResponse = taskDetailRepository.listPage(params);
|
||||
List<TaskDetailCO> coList = pageResponse.getData().stream().map(d -> {
|
||||
TaskDetailCO co = new TaskDetailCO();
|
||||
BeanUtils.copyProperties(d, co);
|
||||
return co;
|
||||
}).collect(Collectors.toList());
|
||||
return PageResponse.of(coList, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||
}
|
||||
|
||||
public PageResponse<TaskDetailFullCO> listPage(TaskDetailPageQry qry) {
|
||||
Map<String, Object> params = PageQueryHelper.toHashMap(qry);
|
||||
PageResponse<TaskDetailDO> pageResponse = taskDetailRepository.listPage(params);
|
||||
|
|
@ -66,7 +66,6 @@ public class TaskDetailQueryExe {
|
|||
List<TaskDetailFullCO> coList = detailDOList.stream().map(d -> {
|
||||
TaskDetailFullCO co = new TaskDetailFullCO();
|
||||
BeanUtils.copyProperties(d, co);
|
||||
co.setCurrentPeriodFeedback(d.getCurrentPeriodFeedback() != null && d.getCurrentPeriodFeedback() == 1);
|
||||
|
||||
List<FeedbackExceptionDO> exList = finalExceptionMap.getOrDefault(d.getTaskDetailId(), new ArrayList<>());
|
||||
List<FeedbackExceptionCO> exCOList = exList.stream().map(e -> {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
package com.zcloud.safetyDutyList.command.query.tasklist;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
import com.zcloud.safetyDutyList.dto.clientobject.tasklist.TaskExecutionCO;
|
||||
import com.zcloud.safetyDutyList.dto.tasklist.TaskExecutionPageQry;
|
||||
import com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskExecutionDO;
|
||||
import com.zcloud.safetyDutyList.persistence.repository.tasklist.TaskExecutionRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 任务执行记录查询执行器
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class TaskExecutionQueryExe {
|
||||
private final TaskExecutionRepository taskExecutionRepository;
|
||||
|
||||
public PageResponse<TaskExecutionCO> listPage(TaskExecutionPageQry qry) {
|
||||
Map<String, Object> params = PageQueryHelper.toHashMap(qry);
|
||||
PageResponse<TaskExecutionDO> pageResponse = taskExecutionRepository.listPage(params);
|
||||
List<TaskExecutionCO> coList = pageResponse.getData().stream().map(d -> {
|
||||
TaskExecutionCO co = new TaskExecutionCO();
|
||||
BeanUtils.copyProperties(d, co);
|
||||
return co;
|
||||
}).collect(Collectors.toList());
|
||||
return PageResponse.of(coList, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||
}
|
||||
|
||||
public SingleResponse<TaskExecutionCO> getByTaskExecutionId(String taskExecutionId) {
|
||||
TaskExecutionDO executionDO = taskExecutionRepository.getByTaskExecutionId(taskExecutionId);
|
||||
if (executionDO == null) {
|
||||
throw new BizException("任务执行记录不存在");
|
||||
}
|
||||
TaskExecutionCO co = new TaskExecutionCO();
|
||||
BeanUtils.copyProperties(executionDO, co);
|
||||
return SingleResponse.of(co);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.zcloud.safetyDutyList.command.query.tasklist;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
import com.zcloud.safetyDutyList.dto.clientobject.tasklist.TaskListIssueCO;
|
||||
import com.zcloud.safetyDutyList.dto.tasklist.TaskListIssuePageQry;
|
||||
import com.zcloud.safetyDutyList.dto.tasklist.TaskListPageQry;
|
||||
import com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskListIssueDO;
|
||||
import com.zcloud.safetyDutyList.persistence.repository.tasklist.TaskListIssueRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 清单下发记录查询执行器
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class TaskListIssueQueryExe {
|
||||
private final TaskListIssueRepository taskListIssueRepository;
|
||||
|
||||
public PageResponse<TaskListIssueCO> listPage(TaskListIssuePageQry qry) {
|
||||
Map<String, Object> params = PageQueryHelper.toHashMap(qry);
|
||||
String menuPath = qry.getMenuPath();
|
||||
PageResponse<TaskListIssueDO> pageResponse = taskListIssueRepository.listPage(params, menuPath);
|
||||
List<TaskListIssueCO> coList = pageResponse.getData().stream().map(d -> {
|
||||
TaskListIssueCO co = new TaskListIssueCO();
|
||||
BeanUtils.copyProperties(d, co);
|
||||
return co;
|
||||
}).collect(Collectors.toList());
|
||||
return PageResponse.of(coList, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||
}
|
||||
|
||||
public SingleResponse<TaskListIssueCO> getByTaskIssueId(String taskIssueId) {
|
||||
TaskListIssueDO issueDO = taskListIssueRepository.getByTaskIssueId(taskIssueId);
|
||||
if (issueDO == null) {
|
||||
throw new BizException("下发记录不存在");
|
||||
}
|
||||
TaskListIssueCO co = new TaskListIssueCO();
|
||||
BeanUtils.copyProperties(issueDO, co);
|
||||
return SingleResponse.of(co);
|
||||
}
|
||||
}
|
||||
|
|
@ -4,12 +4,8 @@ import cn.hutool.core.collection.CollUtil;
|
|||
import com.alibaba.cola.dto.MultiResponse;
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
import com.zcloud.safetyDutyList.command.convertor.tasklist.TaskListCoConvertor;
|
||||
import com.zcloud.safetyDutyList.domain.enums.*;
|
||||
import com.zcloud.safetyDutyList.dto.clientobject.tasklist.*;
|
||||
import com.zcloud.safetyDutyList.dto.tasklist.*;
|
||||
import com.zcloud.safetyDutyList.persistence.dataobject.tasklist.*;
|
||||
|
|
@ -28,10 +24,10 @@ import java.util.stream.Collectors;
|
|||
* 清单查询执行器
|
||||
* <p>
|
||||
* 处理安全责任清单相关的查询业务:
|
||||
* - 清单分页列表查询(通过Mapper联表一次性查出所有字段)
|
||||
* - 清单分页列表查询
|
||||
* - 清单详情查询
|
||||
* - 反馈异常分页查询
|
||||
* - 清单统计(按企业分组统计清单数量和状态分布)
|
||||
* - 清单统计
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
|
|
@ -41,17 +37,7 @@ public class TaskListQueryExe {
|
|||
private final FeedbackExceptionRepository feedbackExceptionRepository;
|
||||
private final TaskListCoConvertor taskListCoConvertor;
|
||||
|
||||
/**
|
||||
* 分页查询清单列表
|
||||
* <p>
|
||||
* 通过Mapper层联表查询一次性获取所有数据:
|
||||
* - LEFT JOIN department/user 获取执行部门名称、执行人员名称、评分部门名称、评分人员名称
|
||||
* - LEFT JOIN (子查询聚合task_detail) 获取任务数和反馈状态
|
||||
* <p>
|
||||
* 反馈状态推导规则:若该清单下任一任务的feedback_status=2(异常),则清单反馈状态为异常(2);否则为正常(1)
|
||||
*/
|
||||
public PageResponse<TaskListCO> listPage(TaskListPageQry qry) {
|
||||
|
||||
Map<String, Object> params = PageQueryHelper.toHashMap(qry);
|
||||
PageResponse<TaskListDO> pageResponse = taskListRepository.listPage(params);
|
||||
List<TaskListCO> coList = taskListCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||
|
|
@ -97,9 +83,6 @@ public class TaskListQueryExe {
|
|||
TaskListStatisticsCO co = new TaskListStatisticsCO();
|
||||
co.setCreateCorpId(corpId);
|
||||
co.setTaskListCount(taskLists.size());
|
||||
co.setInProgressCount((int) taskLists.stream().filter(t -> TaskStatusEnum.IN_PROGRESS.getCode().equals(t.getStatus())).count());
|
||||
co.setCompletedCount((int) taskLists.stream().filter(t -> TaskStatusEnum.COMPLETED.getCode().equals(t.getStatus())).count());
|
||||
co.setClosedCount((int) taskLists.stream().filter(t -> TaskStatusEnum.CLOSED.getCode().equals(t.getStatus())).count());
|
||||
result.add(co);
|
||||
});
|
||||
return MultiResponse.of(result);
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ import com.jjb.saas.framework.auth.model.SSOUser;
|
|||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.FeedbackGateway;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskDetailGateway;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListGateway;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskExecutionGateway;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.FeedbackE;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskDetailE;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskListE;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskExecutionE;
|
||||
import com.zcloud.safetyDutyList.domain.util.FeedbackCycleUtil;
|
||||
import com.zcloud.safetyDutyList.dto.clientobject.tasklist.FeedbackCO;
|
||||
import com.zcloud.safetyDutyList.dto.tasklist.FeedbackAddCmd;
|
||||
|
|
@ -23,7 +23,7 @@ import java.time.LocalDateTime;
|
|||
* 反馈新增执行器
|
||||
* <p>
|
||||
* 处理提交执行反馈的业务逻辑:
|
||||
* 1. 校验任务和清单是否存在且已下发
|
||||
* 1. 校验任务执行记录和任务模板是否存在
|
||||
* 2. 创建反馈实体并初始化,自动生成周期标识
|
||||
* 3. 保存反馈记录
|
||||
* 4. 返回新增后的反馈信息
|
||||
|
|
@ -32,8 +32,8 @@ import java.time.LocalDateTime;
|
|||
@AllArgsConstructor
|
||||
public class FeedbackAddExe {
|
||||
private final FeedbackGateway feedbackGateway;
|
||||
private final TaskListGateway taskListGateway;
|
||||
private final TaskDetailGateway taskDetailGateway;
|
||||
private final TaskExecutionGateway taskExecutionGateway;
|
||||
|
||||
public FeedbackCO execute(FeedbackAddCmd cmd) {
|
||||
|
||||
|
|
@ -42,25 +42,22 @@ public class FeedbackAddExe {
|
|||
throw new BizException("用户未登录");
|
||||
}
|
||||
|
||||
TaskDetailE detailE = taskDetailGateway.getByTaskDetailId(cmd.getTaskDetailId());
|
||||
TaskExecutionE executionE = taskExecutionGateway.getByTaskExecutionId(cmd.getTaskExecutionId());
|
||||
if (executionE == null) {
|
||||
throw new BizException("任务执行记录不存在");
|
||||
}
|
||||
TaskDetailE detailE = taskDetailGateway.getByTaskDetailId(executionE.getTaskDetailId());
|
||||
if (detailE == null) {
|
||||
throw new BizException("任务不存在");
|
||||
}
|
||||
TaskListE taskListE = taskListGateway.getByTaskListId(detailE.getTaskListId());
|
||||
if (taskListE == null) {
|
||||
throw new BizException("任务清单不存在");
|
||||
}
|
||||
if (taskListE.getIssueStatus() != 1 || taskListE.getExecuteUserId() == null) {
|
||||
throw new BizException("任务清单未下发");
|
||||
throw new BizException("任务模板不存在");
|
||||
}
|
||||
|
||||
FeedbackE feedbackE = new FeedbackE();
|
||||
BeanUtils.copyProperties(cmd, feedbackE);
|
||||
if (!StringUtil.isEmpty(cmd.getFeedbackId())) {
|
||||
feedbackE.setTaskDetailId(cmd.getTaskDetailId());
|
||||
} else {
|
||||
feedbackE.init();
|
||||
}
|
||||
feedbackE.init();
|
||||
feedbackE.setTaskDetailId(executionE.getTaskDetailId());
|
||||
feedbackE.setTaskExecutionId(executionE.getTaskExecutionId());
|
||||
feedbackE.setTaskListId(executionE.getTaskListId());
|
||||
feedbackE.setTaskIssueId(executionE.getTaskIssueId());
|
||||
feedbackE.setFeedbackContent(cmd.getFeedbackContent());
|
||||
|
||||
feedbackE.setFeedbackCorpId(ssoUser.getTenantId());
|
||||
feedbackE.setFeedbackDepartmentId(ssoUser.getOrgId());
|
||||
|
|
|
|||
|
|
@ -1,217 +1,119 @@
|
|||
package com.zcloud.safetyDutyList.command.tasklist;
|
||||
|
||||
import com.zcloud.safetyDutyList.domain.enums.ExceptionTypeEnum;
|
||||
import com.zcloud.safetyDutyList.domain.enums.TaskStatusEnum;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.FeedbackExceptionGateway;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.FeedbackGateway;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskDetailGateway;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListGateway;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskExecutionGateway;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListIssueGateway;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.FeedbackE;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.FeedbackExceptionE;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskDetailE;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskListE;
|
||||
import com.zcloud.safetyDutyList.domain.util.FeedbackCycleUtil;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskExecutionE;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskListIssueE;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.time.temporal.TemporalAdjusters;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 反馈异常检测执行器
|
||||
* 定时任务2:反馈异常检测
|
||||
* <p>
|
||||
* 处理定时任务2的业务逻辑:检测已下发清单下所有任务的反馈异常情况。
|
||||
* <p>
|
||||
* 处理流程:
|
||||
* 1. 查询所有已下发且周期时间完整的清单(issue_status=1, period_start_time/end_time不为空)
|
||||
* 2. 遍历每个清单,获取其下所有任务
|
||||
* 3. 对每个任务,以清单的周期起始时间判断是否仍处于首个反馈周期内
|
||||
* 4. 若仍处于首周期,跳过(首周期尚未结束,不应判定异常)
|
||||
* 5. 若已过首周期,计算上一阶段周期标识,检查是否有反馈记录
|
||||
* 6. 若上一阶段无反馈且无异常记录,则创建反馈异常记录
|
||||
* <p>
|
||||
* 首周期判断逻辑(以清单periodStartTime为准):
|
||||
* 将periodStartTime和当前时间分别生成周期标识,若相同则仍在首周期内。
|
||||
* 例如:清单起始时间2026年7月,当前2026年7月12日:
|
||||
* 每月→首周期=2026-07=当前周期→跳过
|
||||
* 每季度→首周期=2026-Q3=当前周期→跳过
|
||||
* 每半年→首周期=2026-H2=当前周期→跳过
|
||||
* 每年→首周期=2026-Y=当前周期→跳过
|
||||
* <p>
|
||||
* 事务控制:整个检测过程在同一事务中执行,确保异常记录写入的原子性
|
||||
* 定时扫描已下发且有周期的下发记录下的任务执行记录,
|
||||
* 检查当前周期是否已反馈,未反馈则标记为异常并创建异常记录。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class FeedbackExceptionCheckExe {
|
||||
|
||||
private final TaskListGateway taskListGateway;
|
||||
|
||||
private final TaskListIssueGateway taskListIssueGateway;
|
||||
private final TaskExecutionGateway taskExecutionGateway;
|
||||
private final TaskDetailGateway taskDetailGateway;
|
||||
|
||||
private final FeedbackGateway feedbackGateway;
|
||||
|
||||
private final FeedbackExceptionGateway feedbackExceptionGateway;
|
||||
|
||||
/**
|
||||
* 执行反馈异常检测
|
||||
* <p>
|
||||
* 遍历所有已下发且周期时间完整的清单,对每个清单下的任务进行反馈异常检测。
|
||||
*/
|
||||
@Scheduled(cron = "0 10 1 * * ?")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute() {
|
||||
|
||||
// 查询所有已下发且周期时间完整的清单
|
||||
List<TaskListE> issuedList = taskListGateway.listIssuedWithPeriod();
|
||||
log.info("【定时任务2】开始反馈异常检测...");
|
||||
List<TaskListIssueE> issuedList = taskListIssueGateway.listIssuedWithPeriod();
|
||||
if (issuedList == null || issuedList.isEmpty()) {
|
||||
log.info("【定时任务-安全责任清单-检测反馈异常】没有已下发且周期时间完整的清单需要检测");
|
||||
log.info("【定时任务2】无需要检测的下发记录");
|
||||
return;
|
||||
}
|
||||
|
||||
log.info("【定时任务-安全责任清单-检测反馈异常】查询到{}条已下发清单需要检测反馈异常", issuedList.size());
|
||||
LocalDate today = LocalDate.now();
|
||||
String currentPeriodFlag = today.format(DateTimeFormatter.ofPattern("yyyy-MM"));
|
||||
|
||||
// 遍历每个清单
|
||||
for (TaskListE taskList : issuedList) {
|
||||
for (TaskListIssueE issueE : issuedList) {
|
||||
List<TaskExecutionE> executionList = taskExecutionGateway.listByTaskIssueId(issueE.getTaskIssueId());
|
||||
if (executionList == null) continue;
|
||||
|
||||
// 获取清单下的任务
|
||||
List<TaskDetailE> taskDetails = taskDetailGateway.listByTaskListId(taskList.getTaskListId());
|
||||
if (taskDetails == null || taskDetails.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
for (TaskExecutionE executionE : executionList) {
|
||||
if (!TaskStatusEnum.IN_PROGRESS.getCode().equals(executionE.getTaskStatus())) continue;
|
||||
|
||||
// 遍历每个任务
|
||||
for (TaskDetailE taskDetail : taskDetails) {
|
||||
boolean hasException = checkTaskFeedback(taskList, taskDetail);
|
||||
if (hasException) {
|
||||
// 存在异常
|
||||
taskDetail.setFeedbackStatus(2);
|
||||
taskDetailGateway.update(taskDetail);
|
||||
TaskDetailE detailE = taskDetailGateway.getByTaskDetailId(executionE.getTaskDetailId());
|
||||
if (detailE == null) continue;
|
||||
|
||||
if (!shouldCheckThisPeriod(detailE.getFeedbackCycleType(), today)) continue;
|
||||
|
||||
// 检查当前周期是否已反馈
|
||||
List<FeedbackE> feedbackList = feedbackGateway.listByTaskExecutionIdAndPeriodFlag(
|
||||
executionE.getTaskExecutionId(), currentPeriodFlag);
|
||||
if (feedbackList == null || feedbackList.isEmpty()) {
|
||||
// 标记任务执行记录为异常
|
||||
executionE.setFeedbackStatus(2);
|
||||
taskExecutionGateway.update(executionE);
|
||||
|
||||
// 创建异常记录
|
||||
createExceptionRecord(executionE, detailE, issueE, currentPeriodFlag, today);
|
||||
log.info("【定时任务2】任务执行[{}]周期[{}]未反馈,已标记异常",
|
||||
executionE.getTaskExecutionId(), currentPeriodFlag);
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("【定时任务2】反馈异常检测完成");
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测单个任务的反馈异常
|
||||
*
|
||||
* @param taskList 所属清单(用于获取周期起始时间)
|
||||
* @param taskDetail 任务详情
|
||||
*/
|
||||
private Boolean checkTaskFeedback(TaskListE taskList, TaskDetailE taskDetail) {
|
||||
Integer feedbackCycleType = taskDetail.getFeedbackCycleType();
|
||||
if (feedbackCycleType == null) {
|
||||
log.warn("【定时任务-安全责任清单-检测反馈异常】任务[{}]反馈周期类型为空,跳过检测", taskDetail.getTaskDetailId());
|
||||
return false;
|
||||
}
|
||||
|
||||
// 当前时间处于首周期,跳过
|
||||
if (FeedbackCycleUtil.isFirstCycle(feedbackCycleType, taskList.getPeriodStartTime())) {
|
||||
log.info("【定时任务-安全责任清单-检测反馈异常】清单[{}]任务[{}]周期类型为{},仍处于首周期内,跳过检测",
|
||||
taskList.getTaskListId(), taskDetail.getTaskDetailId(), feedbackCycleType);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 上一阶段周期标识
|
||||
String previousPeriodFlag = FeedbackCycleUtil.generatePreviousPeriodFlag(feedbackCycleType);
|
||||
if (previousPeriodFlag == null) {
|
||||
log.warn("【定时任务-安全责任清单-检测反馈异常】任务[{}]无法生成上一阶段周期标识,feedbackCycleType={}",
|
||||
taskDetail.getTaskDetailId(), feedbackCycleType);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 异常记录是否存在
|
||||
boolean alreadyHasException = checkExistingException(taskDetail.getTaskDetailId(), previousPeriodFlag);
|
||||
if (alreadyHasException) {
|
||||
log.info("【定时任务-安全责任清单-检测反馈异常】任务[{}]在周期[{}]已存在异常记录,跳过",
|
||||
taskDetail.getTaskDetailId(), previousPeriodFlag);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 上一阶段周期标识对应的反馈记录是否存在
|
||||
boolean hasFeedback = checkPreviousPeriodFeedback(taskDetail.getTaskDetailId(), previousPeriodFlag);
|
||||
|
||||
if (!hasFeedback) {
|
||||
createFeedbackException(taskDetail, previousPeriodFlag);
|
||||
log.info("【定时任务-安全责任清单-检测反馈异常】任务[{}]在周期[{}]未反馈,已添加异常记录",
|
||||
taskDetail.getTaskDetailId(), previousPeriodFlag);
|
||||
return true;
|
||||
} else {
|
||||
log.info("【定时任务-安全责任清单-检测反馈异常】任务[{}]在周期[{}]已正常反馈",
|
||||
taskDetail.getTaskDetailId(), previousPeriodFlag);
|
||||
return false;
|
||||
private boolean shouldCheckThisPeriod(Integer feedbackCycleType, LocalDate today) {
|
||||
if (feedbackCycleType == null) return false;
|
||||
// 1-每月 2-季度 3-半年 4-年
|
||||
switch (feedbackCycleType) {
|
||||
case 1: // 每月
|
||||
return today.getDayOfMonth() > 1;
|
||||
case 2: // 季度
|
||||
int month = today.getMonthValue();
|
||||
int quarterEndMonth = ((month - 1) / 3 + 1) * 3;
|
||||
return month == quarterEndMonth && today.getDayOfMonth() > 1;
|
||||
case 3: // 半年
|
||||
return (today.getMonthValue() == 6 || today.getMonthValue() == 12) && today.getDayOfMonth() > 1;
|
||||
case 4: // 年
|
||||
return today.getMonthValue() == 12 && today.getDayOfMonth() > 1;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查上一阶段是否已有异常记录
|
||||
*
|
||||
* @param taskDetailId 任务详情ID
|
||||
* @param previousPeriodFlag 上一阶段的周期标识
|
||||
* @return true-已存在异常记录,false-不存在异常记录
|
||||
*/
|
||||
private boolean checkExistingException(String taskDetailId, String previousPeriodFlag) {
|
||||
List<FeedbackExceptionE> exceptionList = feedbackExceptionGateway.listByTaskDetailId(taskDetailId);
|
||||
if (exceptionList == null || exceptionList.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
return exceptionList.stream()
|
||||
.anyMatch(e -> previousPeriodFlag.equals(e.getExceptionPeriodFlag()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查上一阶段是否有反馈记录
|
||||
*
|
||||
* @param taskDetailId 任务详情ID
|
||||
* @param previousPeriodFlag 上一阶段的周期标识
|
||||
* @return true-存在反馈记录,false-不存在反馈记录
|
||||
*/
|
||||
private boolean checkPreviousPeriodFeedback(String taskDetailId, String previousPeriodFlag) {
|
||||
List<FeedbackE> feedbackList = feedbackGateway.listByTaskDetailId(taskDetailId);
|
||||
if (feedbackList == null || feedbackList.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
return feedbackList.stream()
|
||||
.anyMatch(f -> previousPeriodFlag.equals(f.getFeedbackPeriodFlag()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建反馈异常记录
|
||||
*
|
||||
* @param taskDetail 未按时反馈的任务详情
|
||||
* @param previousPeriodFlag 上一阶段的周期标识
|
||||
*/
|
||||
private void createFeedbackException(TaskDetailE taskDetail, String previousPeriodFlag) {
|
||||
private void createExceptionRecord(TaskExecutionE executionE, TaskDetailE detailE,
|
||||
TaskListIssueE issueE, String periodFlag, LocalDate today) {
|
||||
FeedbackExceptionE exceptionE = new FeedbackExceptionE();
|
||||
exceptionE.init();
|
||||
|
||||
exceptionE.setTaskDetailId(taskDetail.getTaskDetailId());
|
||||
exceptionE.setTaskListId(taskDetail.getTaskListId());
|
||||
exceptionE.setExceptionPeriodFlag(previousPeriodFlag);
|
||||
|
||||
LocalDateTime[] periodTime = FeedbackCycleUtil.getPeriodTime(previousPeriodFlag);
|
||||
if (periodTime != null && periodTime.length == 2) {
|
||||
exceptionE.setExceptionPeriodStartTime(periodTime[0]);
|
||||
exceptionE.setExceptionPeriodEndTime(periodTime[1]);
|
||||
|
||||
// 异常内容
|
||||
exceptionE.setExceptionContent(getExceptionContent(periodTime));
|
||||
}
|
||||
|
||||
exceptionE.setExceptionType(ExceptionTypeEnum.NOT_FEEDBACK.getCode());
|
||||
exceptionE.setExceptionTime(LocalDateTime.now());
|
||||
|
||||
exceptionE.setTaskDetailId(executionE.getTaskDetailId());
|
||||
exceptionE.setTaskExecutionId(executionE.getTaskExecutionId());
|
||||
exceptionE.setTaskListId(executionE.getTaskListId());
|
||||
exceptionE.setTaskIssueId(executionE.getTaskIssueId());
|
||||
exceptionE.setExceptionPeriodFlag(periodFlag);
|
||||
exceptionE.setExceptionPeriodStartTime(today.withDayOfMonth(1).atStartOfDay());
|
||||
exceptionE.setExceptionPeriodEndTime(today.with(TemporalAdjusters.lastDayOfMonth()).atTime(LocalTime.MAX));
|
||||
exceptionE.setExceptionType(1);
|
||||
feedbackExceptionGateway.add(exceptionE);
|
||||
}
|
||||
|
||||
private String getExceptionContent(LocalDateTime[] periodTime) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日");
|
||||
String startTimeStr = periodTime[0].format(formatter);
|
||||
String endTimeStr = periodTime[1].format(formatter);
|
||||
sb.append("反馈周期:").append(startTimeStr).append("-").append(endTimeStr).append(" 异常行为: 未反馈");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,24 +3,33 @@ package com.zcloud.safetyDutyList.command.tasklist;
|
|||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safetyDutyList.domain.enums.TaskStatusEnum;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskDetailGateway;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskExecutionGateway;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskDetailE;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskExecutionE;
|
||||
import com.zcloud.safetyDutyList.dto.tasklist.TaskDetailCloseCmd;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 任务详情关闭执行器
|
||||
* 任务关闭执行器
|
||||
* <p>
|
||||
* 处理关闭任务详情的业务逻辑:
|
||||
* 1. 校验任务是否存在
|
||||
* 2. 将任务状态更新为已关闭
|
||||
* 处理关闭任务模板的业务逻辑:
|
||||
* 1. 校验任务模板是否存在
|
||||
* 2. 将任务模板状态更新为已关闭
|
||||
* 3. 同时关闭关联的所有进行中的任务执行记录
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class TaskDetailCloseExe {
|
||||
private final TaskDetailGateway taskDetailGateway;
|
||||
private final TaskExecutionGateway taskExecutionGateway;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute(TaskDetailCloseCmd cmd) {
|
||||
// 1. 关闭任务模板
|
||||
TaskDetailE detailE = taskDetailGateway.getByTaskDetailId(cmd.getTaskDetailId());
|
||||
if (detailE == null) {
|
||||
throw new BizException("任务不存在");
|
||||
|
|
@ -28,7 +37,18 @@ public class TaskDetailCloseExe {
|
|||
detailE.setTaskStatus(TaskStatusEnum.CLOSED.getCode());
|
||||
boolean res = taskDetailGateway.update(detailE);
|
||||
if (!res) {
|
||||
throw new BizException("关闭失败");
|
||||
throw new BizException("关闭任务失败");
|
||||
}
|
||||
|
||||
// 2. 关闭关联的所有进行中的任务执行记录
|
||||
List<TaskExecutionE> executionList = taskExecutionGateway.listByTaskDetailId(cmd.getTaskDetailId());
|
||||
if (executionList != null) {
|
||||
for (TaskExecutionE executionE : executionList) {
|
||||
if (TaskStatusEnum.IN_PROGRESS.getCode().equals(executionE.getTaskStatus())) {
|
||||
executionE.setTaskStatus(TaskStatusEnum.CLOSED.getCode());
|
||||
taskExecutionGateway.update(executionE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
package com.zcloud.safetyDutyList.command.tasklist;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safetyDutyList.domain.enums.TaskStatusEnum;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskDetailGateway;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskDetailE;
|
||||
import com.zcloud.safetyDutyList.dto.clientobject.tasklist.TaskDetailCO;
|
||||
import com.zcloud.safetyDutyList.dto.tasklist.TaskDetailSaveBatchCmd;
|
||||
import com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskDetailDO;
|
||||
import com.zcloud.safetyDutyList.persistence.repository.tasklist.TaskDetailRepository;
|
||||
import jodd.util.StringUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
|
@ -24,6 +25,7 @@ import java.util.stream.Collectors;
|
|||
@AllArgsConstructor
|
||||
public class TaskDetailSaveBatchExe {
|
||||
private final TaskDetailGateway taskDetailGateway;
|
||||
private final TaskDetailRepository taskDetailRepository;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<TaskDetailCO> execute(List<TaskDetailSaveBatchCmd> cmds) {
|
||||
|
|
@ -61,8 +63,6 @@ public class TaskDetailSaveBatchExe {
|
|||
} else {
|
||||
detailE.setTaskDetailId(cmd.getTaskDetailId());
|
||||
}
|
||||
detailE.setTaskStatus(TaskStatusEnum.IN_PROGRESS.getCode());
|
||||
detailE.setFeedbackStatus(1);
|
||||
toAdd.add(detailE);
|
||||
} else {
|
||||
TaskDetailE existDetail = existDetailMap.get(cmd.getId());
|
||||
|
|
@ -102,7 +102,7 @@ public class TaskDetailSaveBatchExe {
|
|||
taskDetailGateway.update(detailE);
|
||||
}
|
||||
|
||||
List<TaskDetailE> latestDetails = taskDetailGateway.listByTaskListId(taskListId);
|
||||
List<TaskDetailDO> latestDetails = taskDetailRepository.listByTaskListId(taskListId);
|
||||
return latestDetails.stream().map(detailE -> {
|
||||
TaskDetailCO co = new TaskDetailCO();
|
||||
BeanUtils.copyProperties(detailE, co);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.zcloud.safetyDutyList.command.tasklist;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safetyDutyList.domain.enums.TaskStatusEnum;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskDetailGateway;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListGateway;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskDetailE;
|
||||
|
|
@ -48,8 +47,6 @@ public class TaskDetailSaveExe {
|
|||
TaskDetailE detailE = new TaskDetailE();
|
||||
BeanUtils.copyProperties(cmd, detailE);
|
||||
detailE.init();
|
||||
detailE.setTaskStatus(TaskStatusEnum.IN_PROGRESS.getCode());
|
||||
detailE.setFeedbackStatus(1);
|
||||
boolean res = taskDetailGateway.add(detailE);
|
||||
if (!res) {
|
||||
throw new BizException("保存失败");
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@ import com.alibaba.cola.exception.BizException;
|
|||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskDetailGateway;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListGateway;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskExecutionGateway;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListIssueGateway;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskDetailE;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskListE;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskExecutionE;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskListIssueE;
|
||||
import com.zcloud.safetyDutyList.dto.tasklist.TaskDetailUpdateScoreCmd;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -20,8 +22,9 @@ import java.util.List;
|
|||
@Component
|
||||
@AllArgsConstructor
|
||||
public class TaskDetailUpdateScoreExe {
|
||||
private final TaskExecutionGateway taskExecutionGateway;
|
||||
private final TaskDetailGateway taskDetailGateway;
|
||||
private final TaskListGateway taskListGateway;
|
||||
private final TaskListIssueGateway taskListIssueGateway;
|
||||
|
||||
public void execute(TaskDetailUpdateScoreCmd cmd) {
|
||||
|
||||
|
|
@ -29,60 +32,70 @@ public class TaskDetailUpdateScoreExe {
|
|||
if (ssoUser == null) {
|
||||
throw new BizException("用户未登录");
|
||||
}
|
||||
TaskDetailE detailE = taskDetailGateway.getByTaskDetailId(cmd.getTaskDetailId());
|
||||
if (detailE == null) {
|
||||
throw new BizException("任务不存在");
|
||||
|
||||
// 1. 查询任务执行记录
|
||||
TaskExecutionE executionE = taskExecutionGateway.getByTaskExecutionId(cmd.getTaskExecutionId());
|
||||
if (executionE == null) {
|
||||
throw new BizException("任务执行记录不存在");
|
||||
}
|
||||
if (detailE.getTaskStatus() == 1) {
|
||||
throw new BizException("任务正在进行, 不能评分");
|
||||
if (executionE.getTaskStatus() == 1) {
|
||||
throw new BizException("任务正在进行,不能评分");
|
||||
}
|
||||
if (detailE.getTaskScore() != null && cmd.getTaskRating().compareTo(detailE.getTaskScore()) > 0) {
|
||||
|
||||
// 2. 查询任务模板获取分值上限
|
||||
TaskDetailE detailE = taskDetailGateway.getByTaskDetailId(executionE.getTaskDetailId());
|
||||
if (detailE != null && detailE.getTaskScore() != null
|
||||
&& cmd.getTaskRating().compareTo(detailE.getTaskScore()) > 0) {
|
||||
throw new BizException("评分不能超过任务分值");
|
||||
}
|
||||
if (detailE.getTaskRating() != null) {
|
||||
if (executionE.getTaskRating() != null) {
|
||||
throw new BizException("已经评分禁止再次评分");
|
||||
}
|
||||
detailE.setTaskRating(cmd.getTaskRating());
|
||||
detailE.setRatingTime(LocalDateTime.now());
|
||||
|
||||
detailE.setRatingDepartmentId(ssoUser.getOrgId());
|
||||
detailE.setRatingUserId(ssoUser.getUserId());
|
||||
|
||||
boolean res = taskDetailGateway.update(detailE);
|
||||
// 3. 更新任务执行记录评分
|
||||
executionE.setTaskRating(cmd.getTaskRating());
|
||||
executionE.setRatingTime(LocalDateTime.now());
|
||||
executionE.setRatingDepartmentId(ssoUser.getOrgId());
|
||||
executionE.setRatingUserId(ssoUser.getUserId());
|
||||
boolean res = taskExecutionGateway.update(executionE);
|
||||
if (!res) {
|
||||
throw new BizException("评分失败");
|
||||
}
|
||||
|
||||
syncTaskListScore(detailE.getTaskListId(), ssoUser);
|
||||
// 4. 同步更新下发记录分数
|
||||
syncIssueScore(executionE.getTaskIssueId(), ssoUser);
|
||||
}
|
||||
|
||||
private void syncTaskListScore(String taskListId, SSOUser ssoUser) {
|
||||
List<TaskDetailE> allDetails = taskDetailGateway.listByTaskListId(taskListId);
|
||||
if (allDetails == null || allDetails.isEmpty()) {
|
||||
/**
|
||||
* 同步下发记录分数:当该下发记录下所有任务执行都已评分时,汇总更新下发记录分数
|
||||
*/
|
||||
private void syncIssueScore(String taskIssueId, SSOUser ssoUser) {
|
||||
List<TaskExecutionE> allExecutions = taskExecutionGateway.listByTaskIssueId(taskIssueId);
|
||||
if (allExecutions == null || allExecutions.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
boolean allScored = allDetails.stream().allMatch(d -> d.getTaskRating() != null);
|
||||
boolean allScored = allExecutions.stream().allMatch(e -> e.getTaskRating() != null);
|
||||
if (!allScored) {
|
||||
log.info("【清单评分同步】清单[{}]下仍有未评分任务,暂不更新清单分数", taskListId);
|
||||
log.info("【下发记录评分同步】下发记录[{}]下仍有未评分任务,暂不更新分数", taskIssueId);
|
||||
return;
|
||||
}
|
||||
BigDecimal totalRating = allDetails.stream()
|
||||
.map(TaskDetailE::getTaskRating)
|
||||
BigDecimal totalRating = allExecutions.stream()
|
||||
.map(TaskExecutionE::getTaskRating)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
TaskListE taskListE = taskListGateway.getInfoByTaskListId(taskListId);
|
||||
if (taskListE == null) {
|
||||
log.warn("【清单评分同步】清单[{}]不存在,跳过同步", taskListId);
|
||||
TaskListIssueE issueE = taskListIssueGateway.getByTaskIssueId(taskIssueId);
|
||||
if (issueE == null) {
|
||||
log.warn("【下发记录评分同步】下发记录[{}]不存在,跳过同步", taskIssueId);
|
||||
return;
|
||||
}
|
||||
taskListE.setRatingScore(totalRating);
|
||||
taskListE.setRatingUserId(ssoUser.getUserId());
|
||||
taskListE.setRatingDepartmentId(ssoUser.getOrgId());
|
||||
boolean updateRes = taskListGateway.update(taskListE);
|
||||
issueE.setRatingScore(totalRating);
|
||||
issueE.setRatingUserId(ssoUser.getUserId());
|
||||
issueE.setRatingDepartmentId(ssoUser.getOrgId());
|
||||
boolean updateRes = taskListIssueGateway.update(issueE);
|
||||
if (updateRes) {
|
||||
log.info("【清单评分同步】清单[{}]分数已更新为{},评分人:{}", taskListId, totalRating, ssoUser.getUserId());
|
||||
log.info("【下发记录评分同步】下发记录[{}]分数已更新为{},评分人:{}", taskIssueId, totalRating, ssoUser.getUserId());
|
||||
} else {
|
||||
log.warn("【清单评分同步】清单[{}]分数更新失败", taskListId);
|
||||
log.warn("【下发记录评分同步】下发记录[{}]分数更新失败", taskIssueId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package com.zcloud.safetyDutyList.command.tasklist;
|
|||
import com.alibaba.cola.exception.BizException;
|
||||
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||
import com.zcloud.safetyDutyList.domain.enums.TaskStatusEnum;
|
||||
import com.zcloud.safetyDutyList.domain.enums.SwitchFlagEnum;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListGateway;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskListE;
|
||||
import com.zcloud.safetyDutyList.dto.clientobject.tasklist.TaskListCO;
|
||||
|
|
@ -17,7 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
* 清单新增执行器
|
||||
* <p>
|
||||
* 处理新增安全责任清单的业务逻辑:
|
||||
* 1. 创建清单实体,初始化状态为进行中、开关为开启、下发状态为未下发
|
||||
* 1. 创建清单实体,初始化开关为开启
|
||||
* 2. 保存清单到数据库
|
||||
* 3. 返回新增后的清单信息
|
||||
*/
|
||||
|
|
@ -43,8 +43,7 @@ public class TaskListAddExe {
|
|||
taskListE.setCreateDepartmentId(ssoUser.getOrgId());
|
||||
taskListE.setCreateUserId(ssoUser.getUserId());
|
||||
|
||||
taskListE.setStatus(TaskStatusEnum.IN_PROGRESS.getCode());
|
||||
taskListE.setIssueStatus(0);
|
||||
taskListE.setSwitchFlag(SwitchFlagEnum.ON.getCode());
|
||||
boolean res = taskListGateway.add(taskListE);
|
||||
if (!res) {
|
||||
throw new BizException("保存失败");
|
||||
|
|
|
|||
|
|
@ -2,10 +2,12 @@ package com.zcloud.safetyDutyList.command.tasklist;
|
|||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safetyDutyList.domain.enums.TaskStatusEnum;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskDetailGateway;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskExecutionGateway;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListGateway;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskDetailE;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListIssueGateway;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskExecutionE;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskListE;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskListIssueE;
|
||||
import com.zcloud.safetyDutyList.dto.tasklist.TaskListCloseCmd;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -17,33 +19,53 @@ import java.util.List;
|
|||
/**
|
||||
* 清单关闭执行器
|
||||
* <p>
|
||||
* 处理关闭安全责任清单的业务逻辑:
|
||||
* 处理关闭清单模板的业务逻辑:
|
||||
* 1. 校验清单是否存在
|
||||
* 2. 将清单状态更新为已关闭,记录关闭时间
|
||||
* 3. 同时关闭该清单下所有任务详情
|
||||
* 2. 将清单模板状态更新为已关闭
|
||||
* 3. 同时关闭该清单下所有进行中的下发记录
|
||||
* 4. 同时关闭所有下发记录下进行中的任务执行记录
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class TaskListCloseExe {
|
||||
private final TaskListGateway taskListGateway;
|
||||
private final TaskDetailGateway taskDetailGateway;
|
||||
private final TaskListIssueGateway taskListIssueGateway;
|
||||
private final TaskExecutionGateway taskExecutionGateway;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute(TaskListCloseCmd cmd) {
|
||||
TaskListE taskListE = taskListGateway.getInfoByTaskListId(cmd.getTaskListId());
|
||||
if (taskListE == null) {
|
||||
throw new BizException("任务清单不存在");
|
||||
// 1. 关闭清单模板
|
||||
TaskListE listE = taskListGateway.getByTaskListId(cmd.getTaskListId());
|
||||
if (listE == null) {
|
||||
throw new BizException("清单不存在");
|
||||
}
|
||||
taskListE.setStatus(TaskStatusEnum.CLOSED.getCode());
|
||||
taskListE.setCloseTime(LocalDateTime.now());
|
||||
boolean res = taskListGateway.update(taskListE);
|
||||
listE.setStatus(TaskStatusEnum.CLOSED.getCode());
|
||||
boolean res = taskListGateway.update(listE);
|
||||
if (!res) {
|
||||
throw new BizException("关闭失败");
|
||||
throw new BizException("关闭清单失败");
|
||||
}
|
||||
|
||||
// 2. 关闭该清单下所有进行中的下发记录
|
||||
List<TaskListIssueE> issueList = taskListIssueGateway.listByTaskListId(cmd.getTaskListId());
|
||||
if (issueList != null) {
|
||||
for (TaskListIssueE issueE : issueList) {
|
||||
if (TaskStatusEnum.IN_PROGRESS.getCode().equals(issueE.getStatus())) {
|
||||
issueE.setStatus(TaskStatusEnum.CLOSED.getCode());
|
||||
issueE.setCloseTime(LocalDateTime.now());
|
||||
taskListIssueGateway.update(issueE);
|
||||
}
|
||||
|
||||
// 3. 关闭该下发记录下所有进行中的任务执行记录
|
||||
List<TaskExecutionE> executionList = taskExecutionGateway.listByTaskIssueId(issueE.getTaskIssueId());
|
||||
if (executionList != null) {
|
||||
for (TaskExecutionE executionE : executionList) {
|
||||
if (TaskStatusEnum.IN_PROGRESS.getCode().equals(executionE.getTaskStatus())) {
|
||||
executionE.setTaskStatus(TaskStatusEnum.CLOSED.getCode());
|
||||
taskExecutionGateway.update(executionE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// List<TaskDetailE> detailList = taskDetailGateway.listByTaskListId(cmd.getTaskListId());
|
||||
// for (TaskDetailE detail : detailList) {
|
||||
// detail.setTaskStatus(TaskStatusEnum.CLOSED.getCode());
|
||||
// taskDetailGateway.update(detail);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,28 +2,42 @@ package com.zcloud.safetyDutyList.command.tasklist;
|
|||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safetyDutyList.domain.enums.SwitchFlagEnum;
|
||||
import com.zcloud.safetyDutyList.domain.enums.TaskStatusEnum;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskDetailGateway;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskExecutionGateway;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListGateway;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListIssueGateway;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskDetailE;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskExecutionE;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskListE;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskListIssueE;
|
||||
import com.zcloud.safetyDutyList.dto.tasklist.TaskListIssueCmd;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 清单下发执行器
|
||||
* <p>
|
||||
* 处理安全责任清单下发的业务逻辑:
|
||||
* 1. 校验清单是否存在
|
||||
* 2. 校验清单开关是否为开启状态(仅开启状态的清单可下发)
|
||||
* 3. 设置下发状态、下发时间、执行企业、执行人、周期起止时间
|
||||
* 1. 校验清单是否存在且开关为开启状态
|
||||
* 2. 创建清单下发记录(TaskListIssueE)
|
||||
* 3. 根据清单下的任务模板,为每个任务创建任务执行记录(TaskExecutionE)
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class TaskListIssueExe {
|
||||
private final TaskListGateway taskListGateway;
|
||||
private final TaskListIssueGateway taskListIssueGateway;
|
||||
private final TaskDetailGateway taskDetailGateway;
|
||||
private final TaskExecutionGateway taskExecutionGateway;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute(TaskListIssueCmd cmd) {
|
||||
TaskListE taskListE = taskListGateway.getInfoByTaskListId(cmd.getTaskListId());
|
||||
if (taskListE == null) {
|
||||
|
|
@ -32,27 +46,52 @@ public class TaskListIssueExe {
|
|||
if (!SwitchFlagEnum.ON.getCode().equals(taskListE.getSwitchFlag())) {
|
||||
throw new BizException("仅可下发开启状态的任务清单");
|
||||
}
|
||||
taskListE.setIssueStatus(1);
|
||||
taskListE.setIssueTime(LocalDateTime.now());
|
||||
taskListE.setExecuteCorpId(cmd.getExecuteCorpId());
|
||||
taskListE.setExecuteDepartmentId(cmd.getExecuteDepartmentId());
|
||||
taskListE.setExecuteUserId(cmd.getExecuteUserId());
|
||||
|
||||
// 1. 处理开始时间:当月1日 00:00:00
|
||||
List<TaskDetailE> taskDetailList = taskDetailGateway.listByTaskListId(taskListE.getTaskListId());
|
||||
if (taskDetailList == null || taskDetailList.isEmpty()) {
|
||||
throw new BizException("任务清单下无任务可执行");
|
||||
}
|
||||
|
||||
// 1. 处理周期时间
|
||||
LocalDateTime startTime = cmd.getPeriodStartTime()
|
||||
.withDayOfMonth(1) // 日 -> 1号
|
||||
.with(LocalTime.MIN); // 时分秒 -> 00:00:00
|
||||
|
||||
// 2. 处理结束时间:当月最后一天 23:59:59
|
||||
.withDayOfMonth(1)
|
||||
.with(LocalTime.MIN);
|
||||
LocalDateTime endTime = cmd.getPeriodEndTime()
|
||||
.withDayOfMonth(cmd.getPeriodEndTime().toLocalDate().lengthOfMonth())
|
||||
.with(LocalTime.of(23, 59, 59));
|
||||
|
||||
taskListE.setPeriodStartTime(startTime);
|
||||
taskListE.setPeriodEndTime(endTime);
|
||||
boolean res = taskListGateway.update(taskListE);
|
||||
if (!res) {
|
||||
// 2. 创建清单下发记录
|
||||
TaskListIssueE issueE = new TaskListIssueE();
|
||||
issueE.init();
|
||||
issueE.setTaskListId(cmd.getTaskListId());
|
||||
issueE.setExecuteCorpId(cmd.getExecuteCorpId());
|
||||
issueE.setExecuteDepartmentId(cmd.getExecuteDepartmentId());
|
||||
issueE.setExecuteUserId(cmd.getExecuteUserId());
|
||||
issueE.setIssueStatus(1);
|
||||
issueE.setIssueTime(LocalDateTime.now());
|
||||
issueE.setPeriodStartTime(startTime);
|
||||
issueE.setPeriodEndTime(endTime);
|
||||
issueE.setStatus(TaskStatusEnum.IN_PROGRESS.getCode());
|
||||
boolean issueRes = taskListIssueGateway.add(issueE);
|
||||
if (!issueRes) {
|
||||
throw new BizException("下发失败");
|
||||
}
|
||||
|
||||
// 3. 查询清单下所有任务模板,创建任务执行记录
|
||||
List<TaskDetailE> detailList = taskDetailGateway.listByTaskListId(cmd.getTaskListId());
|
||||
if (detailList != null && !detailList.isEmpty()) {
|
||||
List<TaskExecutionE> executionList = new ArrayList<>();
|
||||
for (TaskDetailE detailE : detailList) {
|
||||
TaskExecutionE executionE = new TaskExecutionE();
|
||||
executionE.init();
|
||||
executionE.setTaskIssueId(issueE.getTaskIssueId());
|
||||
executionE.setTaskDetailId(detailE.getTaskDetailId());
|
||||
executionE.setTaskListId(cmd.getTaskListId());
|
||||
executionE.setTaskStatus(TaskStatusEnum.IN_PROGRESS.getCode());
|
||||
executionE.setFeedbackStatus(1);
|
||||
executionList.add(executionE);
|
||||
}
|
||||
taskExecutionGateway.batchAdd(executionList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,14 @@ package com.zcloud.safetyDutyList.command.tasklist;
|
|||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListGateway;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListIssueGateway;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskListE;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskListIssueE;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 清单删除执行器
|
||||
* <p>
|
||||
|
|
@ -15,7 +20,20 @@ import org.springframework.stereotype.Component;
|
|||
public class TaskListRemoveExe {
|
||||
private final TaskListGateway taskListGateway;
|
||||
|
||||
private final TaskListIssueGateway taskListIssueGateway;
|
||||
|
||||
public void execute(Long id) {
|
||||
|
||||
TaskListE taskListE = taskListGateway.getById(id);
|
||||
if (taskListE == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
List <TaskListIssueE> taskListIssueEList = taskListIssueGateway.listByTaskListId(taskListE.getTaskListId());
|
||||
if (taskListIssueEList != null && !taskListIssueEList.isEmpty()) {
|
||||
throw new BizException("该清单已下发,请先取消下发再删除");
|
||||
}
|
||||
|
||||
boolean res = taskListGateway.deleteById(id);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
|
|
|
|||
|
|
@ -1,76 +1,58 @@
|
|||
package com.zcloud.safetyDutyList.command.tasklist;
|
||||
|
||||
import com.zcloud.safetyDutyList.domain.enums.TaskStatusEnum;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskDetailGateway;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListGateway;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskDetailE;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskListE;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskExecutionGateway;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListIssueGateway;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskExecutionE;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskListIssueE;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 清单状态更新执行器
|
||||
* 定时任务1:清单下发记录状态更新
|
||||
* <p>
|
||||
* 处理定时任务1的业务逻辑:更新过期清单和任务状态。
|
||||
* <p>
|
||||
* 处理流程:
|
||||
* 1. 查询所有状态为进行中(status=1)且周期结束时间(period_end_time)小于当前时间的清单
|
||||
* 2. 将这些清单的状态从进行中(1)更新为已完成(2)
|
||||
* 3. 遍历每个已过期的清单,查询其下所有任务详情
|
||||
* 4. 将任务状态为进行中(task_status=1)的任务更新为已完成(task_status=2)
|
||||
* <p>
|
||||
* 事务控制:整个更新过程在同一事务中执行,确保清单状态和任务状态的一致性
|
||||
* 定时扫描已下发且周期已结束的下发记录,将其状态更新为已完成,
|
||||
* 同时将其下所有进行中的任务执行记录也更新为已完成。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class TaskListStatusUpdateExe {
|
||||
private final TaskListIssueGateway taskListIssueGateway;
|
||||
private final TaskExecutionGateway taskExecutionGateway;
|
||||
|
||||
/** 清单网关,用于查询和更新清单数据 */
|
||||
private final TaskListGateway taskListGateway;
|
||||
|
||||
/** 任务详情网关,用于查询和更新任务数据 */
|
||||
private final TaskDetailGateway taskDetailGateway;
|
||||
|
||||
/**
|
||||
* 执行过期清单状态更新
|
||||
* <p>
|
||||
* 查询所有已过期且仍在进行中的清单,将其状态更新为已完成,
|
||||
* 同时将该清单下所有进行中的任务也标记为已完成。
|
||||
*/
|
||||
@Scheduled(cron = "0 0 1 * * ?")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute() {
|
||||
// 步骤1:查询所有状态为进行中(status=1)且周期结束时间(period_end_time)小于当前时间的清单
|
||||
List<TaskListE> expiredList = taskListGateway.listExpiredInProgress();
|
||||
log.info("【定时任务1】开始扫描过期下发记录...");
|
||||
List<TaskListIssueE> expiredList = taskListIssueGateway.listExpiredInProgress();
|
||||
if (expiredList == null || expiredList.isEmpty()) {
|
||||
log.info("【定时任务-安全责任清单-检测任务完成】没有需要更新的过期清单");
|
||||
log.info("【定时任务1】无过期下发记录");
|
||||
return;
|
||||
}
|
||||
for (TaskListIssueE issueE : expiredList) {
|
||||
log.info("【定时任务1】下发记录[{}]周期已结束,更新为已完成", issueE.getTaskIssueId());
|
||||
issueE.setStatus(TaskStatusEnum.COMPLETED.getCode());
|
||||
issueE.setCloseTime(LocalDateTime.now());
|
||||
taskListIssueGateway.update(issueE);
|
||||
|
||||
log.info("【定时任务-安全责任清单-检测任务完成】查询到{}条过期清单需要更新状态", expiredList.size());
|
||||
|
||||
for (TaskListE taskListE : expiredList) {
|
||||
// 步骤2:将清单状态从进行中(1)更新为已完成(2)
|
||||
taskListE.setStatus(TaskStatusEnum.COMPLETED.getCode());
|
||||
taskListGateway.update(taskListE);
|
||||
log.info("【定时任务-安全责任清单-检测任务完成】清单[{}]状态已更新为已完成", taskListE.getTaskListId());
|
||||
|
||||
// 步骤3:查询该清单下所有任务详情,将进行中的任务更新为已完成
|
||||
List<TaskDetailE> detailList = taskDetailGateway.listByTaskListId(taskListE.getTaskListId());
|
||||
if (detailList != null) {
|
||||
for (TaskDetailE detailE : detailList) {
|
||||
// 仅更新状态为进行中(task_status=1)的任务
|
||||
if (TaskStatusEnum.IN_PROGRESS.getCode().equals(detailE.getTaskStatus())) {
|
||||
detailE.setTaskStatus(TaskStatusEnum.COMPLETED.getCode());
|
||||
taskDetailGateway.update(detailE);
|
||||
log.info("【定时任务-安全责任清单-检测任务完成】任务[{}]状态已更新为已完成", detailE.getTaskDetailId());
|
||||
// 同时关闭该下发记录下所有进行中的任务执行记录
|
||||
List<TaskExecutionE> executionList = taskExecutionGateway.listByTaskIssueId(issueE.getTaskIssueId());
|
||||
if (executionList != null) {
|
||||
for (TaskExecutionE executionE : executionList) {
|
||||
if (TaskStatusEnum.IN_PROGRESS.getCode().equals(executionE.getTaskStatus())) {
|
||||
executionE.setTaskStatus(TaskStatusEnum.COMPLETED.getCode());
|
||||
taskExecutionGateway.update(executionE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("【定时任务1】过期下发记录扫描完成,共处理{}条", expiredList.size());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,9 @@ import com.zcloud.safetyDutyList.domain.enums.TaskStatusEnum;
|
|||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListGateway;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskListE;
|
||||
import com.zcloud.safetyDutyList.dto.tasklist.TaskListSwitchCmd;
|
||||
import com.zcloud.safetyDutyList.persistence.repository.tasklist.TaskListRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 清单开关切换执行器
|
||||
* <p>
|
||||
|
|
@ -21,16 +18,14 @@ import java.time.LocalDateTime;
|
|||
@AllArgsConstructor
|
||||
public class TaskListSwitchExe {
|
||||
private final TaskListGateway taskListGateway;
|
||||
private final TaskListRepository taskListRepository;
|
||||
|
||||
public void execute(TaskListSwitchCmd cmd) {
|
||||
|
||||
TaskListE taskListE = taskListGateway.getInfoByTaskListId(cmd.getTaskListId());
|
||||
if (taskListE == null) {
|
||||
throw new BizException("任务清单不存在");
|
||||
}
|
||||
// taskListE.setSwitchFlag(cmd.getSwitchFlag());
|
||||
taskListE.setSwitchFlag(SwitchFlagEnum.OFF.getCode());
|
||||
taskListE.setStatus(TaskStatusEnum.CLOSED.getCode());
|
||||
boolean res = taskListGateway.update(taskListE);
|
||||
if (!res) {
|
||||
throw new BizException("操作失败");
|
||||
|
|
|
|||
|
|
@ -63,6 +63,10 @@ public class TaskListServiceImpl implements TaskListServiceI {
|
|||
private final FeedbackQueryExe feedbackQueryExe;
|
||||
/** 统计查询执行器 */
|
||||
private final StatisticsQueryExe statisticsQueryExe;
|
||||
/** 清单下发记录查询执行器 */
|
||||
private final TaskListIssueQueryExe taskListIssueQueryExe;
|
||||
/** 任务执行记录查询执行器 */
|
||||
private final TaskExecutionQueryExe taskExecutionQueryExe;
|
||||
/** 清单状态更新执行器(定时任务1) */
|
||||
private final TaskListStatusUpdateExe taskListStatusUpdateExe;
|
||||
/** 反馈异常检测执行器(定时任务2) */
|
||||
|
|
@ -73,6 +77,11 @@ public class TaskListServiceImpl implements TaskListServiceI {
|
|||
return taskListQueryExe.listPage(qry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResponse<TaskDetailCO> listTaskDetailPage(TaskDetailPageQry qry) {
|
||||
return taskDetailQueryExe.listTaskDetailPage(qry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<TaskListCO> add(TaskListAddCmd cmd) {
|
||||
TaskListCO co = taskListAddExe.execute(cmd);
|
||||
|
|
@ -184,7 +193,7 @@ public class TaskListServiceImpl implements TaskListServiceI {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<FeedbackInfoCO> getByFeedbackId(String feedbackId) {
|
||||
public SingleResponse<FeedbackCO> getByFeedbackId(String feedbackId) {
|
||||
return feedbackQueryExe.getByFeedbackId(feedbackId);
|
||||
}
|
||||
|
||||
|
|
@ -213,6 +222,26 @@ public class TaskListServiceImpl implements TaskListServiceI {
|
|||
return statisticsQueryExe.issueStatistics(qry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResponse<TaskListIssueCO> listIssuePage(TaskListIssuePageQry qry) {
|
||||
return taskListIssueQueryExe.listPage(qry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<TaskListIssueCO> getIssueByTaskIssueId(String taskIssueId) {
|
||||
return taskListIssueQueryExe.getByTaskIssueId(taskIssueId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResponse<TaskExecutionCO> listExecutionPage(TaskExecutionPageQry qry) {
|
||||
return taskExecutionQueryExe.listPage(qry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<TaskExecutionCO> getExecutionByTaskExecutionId(String taskExecutionId) {
|
||||
return taskExecutionQueryExe.getByTaskExecutionId(taskExecutionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时任务1:更新过期清单和任务状态
|
||||
* <p>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,15 @@ import java.util.List;
|
|||
public interface TaskListServiceI {
|
||||
|
||||
/**
|
||||
* 分页查询任务清单列表
|
||||
* 分页查询任务模板列表(以task_detail为主表)
|
||||
*
|
||||
* @param qry 分页查询参数(支持taskListId、执行内容、反馈周期等筛选)
|
||||
* @return 任务模板分页结果
|
||||
*/
|
||||
PageResponse<TaskDetailCO> listTaskDetailPage(TaskDetailPageQry qry);
|
||||
|
||||
/**
|
||||
* 分页查询任务清单列表(以task_list为主表)
|
||||
*
|
||||
* @param qry 分页查询参数(支持清单名称、等级、状态等筛选)
|
||||
* @return 清单分页结果
|
||||
|
|
@ -185,7 +193,7 @@ public interface TaskListServiceI {
|
|||
* @param feedbackId 反馈业务ID
|
||||
* @return 反馈详情
|
||||
*/
|
||||
SingleResponse<FeedbackInfoCO> getByFeedbackId(String feedbackId);
|
||||
SingleResponse<FeedbackCO> getByFeedbackId(String feedbackId);
|
||||
|
||||
/**
|
||||
* 分页查询反馈异常记录
|
||||
|
|
@ -227,6 +235,38 @@ public interface TaskListServiceI {
|
|||
*/
|
||||
PageResponse<IssueStatisticsCO> issueStatistics(IssueStatisticsQry qry);
|
||||
|
||||
/**
|
||||
* 分页查询任务清单列表(以task_list_issue为主表联表查询)
|
||||
*
|
||||
* @param qry 分页查询参数(支持执行公司ID、清单名称、等级、反馈状态、开关标识等筛选)
|
||||
* @return 清单下发记录分页结果
|
||||
*/
|
||||
PageResponse<TaskListIssueCO> listIssuePage(TaskListIssuePageQry qry);
|
||||
|
||||
/**
|
||||
* 根据下发记录ID获取下发记录详情
|
||||
*
|
||||
* @param taskIssueId 下发记录业务ID
|
||||
* @return 下发记录详情
|
||||
*/
|
||||
SingleResponse<TaskListIssueCO> getIssueByTaskIssueId(String taskIssueId);
|
||||
|
||||
/**
|
||||
* 分页查询任务执行记录(以task_execution为主表联表查询)
|
||||
*
|
||||
* @param qry 分页查询参数(支持taskIssueId、执行内容、反馈周期、反馈状态、任务状态等筛选)
|
||||
* @return 任务执行记录分页结果
|
||||
*/
|
||||
PageResponse<TaskExecutionCO> listExecutionPage(TaskExecutionPageQry qry);
|
||||
|
||||
/**
|
||||
* 根据任务执行ID获取任务执行记录详情
|
||||
*
|
||||
* @param taskExecutionId 任务执行业务ID
|
||||
* @return 任务执行记录详情
|
||||
*/
|
||||
SingleResponse<TaskExecutionCO> getExecutionByTaskExecutionId(String taskExecutionId);
|
||||
|
||||
/**
|
||||
* 定时任务1:更新过期清单和任务状态
|
||||
* <p>
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 考核清单客户端对象
|
||||
* 企业评价列表客户端对象
|
||||
* <p>
|
||||
* 用于按企业分组统计清单数量,供考核清单查询接口使用,
|
||||
* 包含公司ID、公司名称、清单数量等字段。
|
||||
* 用于按企业分组统计待评分/已评分清单数量,供企业评价列表接口使用,
|
||||
* 包含公司ID、公司名称、待评分清单数量、已评分清单数量等字段。
|
||||
*/
|
||||
@Data
|
||||
public class EvaluationListCO extends ClientObject {
|
||||
|
|
@ -16,6 +16,8 @@ public class EvaluationListCO extends ClientObject {
|
|||
private Long corpId;
|
||||
@ApiModelProperty(value = "公司名称")
|
||||
private String corpName;
|
||||
@ApiModelProperty(value = "清单数量")
|
||||
private Integer listCount;
|
||||
@ApiModelProperty(value = "待评分清单数量(清单分数为0或空的)")
|
||||
private Integer pendingScoreCount;
|
||||
@ApiModelProperty(value = "已评分清单数量(清单分数不为0且不为空的)")
|
||||
private Integer scoredCount;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,12 @@ public class FeedbackCO extends ClientObject {
|
|||
private String feedbackId;
|
||||
@ApiModelProperty(value = "任务详情UUID")
|
||||
private String taskDetailId;
|
||||
@ApiModelProperty(value = "任务执行UUID")
|
||||
private String taskExecutionId;
|
||||
@ApiModelProperty(value = "任务清单UUID")
|
||||
private String taskListId;
|
||||
@ApiModelProperty(value = "清单下发记录UUID")
|
||||
private String taskIssueId;
|
||||
@ApiModelProperty(value = "反馈时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime feedbackTime;
|
||||
|
|
@ -35,6 +39,8 @@ public class FeedbackCO extends ClientObject {
|
|||
private LocalDateTime feedbackPeriodEndTime;
|
||||
@ApiModelProperty(value = "反馈周期标识")
|
||||
private String feedbackPeriodFlag;
|
||||
@ApiModelProperty(value = "反馈周期类型")
|
||||
private Integer feedbackCycleType;
|
||||
@ApiModelProperty(value = "反馈内容")
|
||||
private String feedbackContent;
|
||||
@ApiModelProperty(value = "反馈人ID")
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ import java.time.LocalDateTime;
|
|||
*/
|
||||
@Data
|
||||
public class FeedbackPeriodGroupCO extends ClientObject {
|
||||
@ApiModelProperty(value = "任务ID")
|
||||
private String taskDetailId;
|
||||
@ApiModelProperty(value = "下发记录业务ID")
|
||||
private String taskExecutionId;
|
||||
@ApiModelProperty(value = "反馈周期开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime feedbackPeriodStartTime;
|
||||
|
|
|
|||
|
|
@ -1,18 +1,16 @@
|
|||
package com.zcloud.safetyDutyList.dto.clientobject.tasklist;
|
||||
|
||||
import com.alibaba.cola.dto.ClientObject;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 任务详情客户端对象
|
||||
* 任务详情客户端对象(纯模板定义)
|
||||
* <p>
|
||||
* 用于向前端返回任务详情数据,
|
||||
* 包含执行内容、反馈周期、状态、评分等字段。
|
||||
* 用于向前端返回任务模板数据,
|
||||
* 仅包含任务模板定义字段,执行相关字段已迁移至TaskExecutionCO。
|
||||
*/
|
||||
@Data
|
||||
public class TaskDetailCO extends ClientObject {
|
||||
|
|
@ -28,19 +26,15 @@ public class TaskDetailCO extends ClientObject {
|
|||
private Integer feedbackCycleType;
|
||||
@ApiModelProperty(value = "反馈周期名称")
|
||||
private String feedbackCycleName;
|
||||
@ApiModelProperty(value = "任务状态:1-进行中 2-已完成 3-已关闭")
|
||||
private Integer taskStatus;
|
||||
@ApiModelProperty(value = "反馈状态:1-正常 2-存在异常")
|
||||
private Integer feedbackStatus;
|
||||
@ApiModelProperty(value = "任务分值")
|
||||
private BigDecimal taskScore;
|
||||
@ApiModelProperty(value = "任务评分")
|
||||
private BigDecimal taskRating;
|
||||
@ApiModelProperty(value = "评分时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime ratingTime;
|
||||
@ApiModelProperty(value = "评分部门ID")
|
||||
private Long ratingDepartmentId;
|
||||
@ApiModelProperty(value = "评分人ID")
|
||||
private Long ratingUserId;
|
||||
@ApiModelProperty(value = "任务状态:1-进行中 2-已完成 3-已关闭")
|
||||
private Integer taskStatus;
|
||||
|
||||
@ApiModelProperty(value = "清单名称")
|
||||
private String taskListName;
|
||||
@ApiModelProperty(value = "任务级别")
|
||||
private Integer taskLevel;
|
||||
@ApiModelProperty(value = "责任岗位")
|
||||
private String responsibilityPost;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,63 @@
|
|||
package com.zcloud.safetyDutyList.dto.clientobject.tasklist;
|
||||
|
||||
import com.alibaba.cola.dto.ClientObject;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 任务执行记录客户端对象
|
||||
* <p>
|
||||
* 用于向前端返回任务执行记录数据,
|
||||
* 包含任务状态、反馈状态、评分等字段,
|
||||
* 以及通过联表查询获取的名称、反馈次数等聚合字段。
|
||||
*/
|
||||
@Data
|
||||
public class TaskExecutionCO extends ClientObject {
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Long id;
|
||||
@ApiModelProperty(value = "任务执行UUID(业务主键)")
|
||||
private String taskExecutionId;
|
||||
@ApiModelProperty(value = "清单下发记录UUID")
|
||||
private String taskIssueId;
|
||||
@ApiModelProperty(value = "任务模板UUID")
|
||||
private String taskDetailId;
|
||||
@ApiModelProperty(value = "清单UUID")
|
||||
private String taskListId;
|
||||
@ApiModelProperty(value = "任务状态:1-进行中 2-已完成 3-已关闭")
|
||||
private Integer taskStatus;
|
||||
@ApiModelProperty(value = "反馈状态:1-正常 2-异常")
|
||||
private Integer feedbackStatus;
|
||||
@ApiModelProperty(value = "任务评分")
|
||||
private BigDecimal taskRating;
|
||||
@ApiModelProperty(value = "评分时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime ratingTime;
|
||||
@ApiModelProperty(value = "评分部门ID")
|
||||
private Long ratingDepartmentId;
|
||||
@ApiModelProperty(value = "评分部门名称")
|
||||
private String ratingDepartmentName;
|
||||
@ApiModelProperty(value = "评分人ID")
|
||||
private Long ratingUserId;
|
||||
@ApiModelProperty(value = "评分人姓名")
|
||||
private String ratingUserName;
|
||||
@ApiModelProperty(value = "执行内容")
|
||||
private String executeContent;
|
||||
@ApiModelProperty(value = "反馈周期类型")
|
||||
private Integer feedbackCycleType;
|
||||
@ApiModelProperty(value = "任务分值")
|
||||
private BigDecimal taskScore;
|
||||
@ApiModelProperty(value = "清单名称")
|
||||
private String taskListName;
|
||||
@ApiModelProperty(value = "任务级别")
|
||||
private Integer taskLevel;
|
||||
@ApiModelProperty(value = "责任岗位")
|
||||
private String responsibilityPost;
|
||||
@ApiModelProperty(value = "反馈次数")
|
||||
private Integer feedbackCount;
|
||||
@ApiModelProperty(value = "当前周期是否已反馈:0-否 1-是")
|
||||
private Integer currentPeriodFeedback;
|
||||
}
|
||||
|
|
@ -1,19 +1,14 @@
|
|||
package com.zcloud.safetyDutyList.dto.clientobject.tasklist;
|
||||
|
||||
import com.alibaba.cola.dto.ClientObject;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 安全责任清单客户端对象
|
||||
* 安全责任清单客户端对象(纯模板定义)
|
||||
* <p>
|
||||
* 用于向前端返回清单列表和详情数据,
|
||||
* 包含清单的基本信息、状态、周期、下发信息等字段,
|
||||
* 以及通过联表查询获取的部门名称、人员名称、任务数、反馈状态等聚合字段。
|
||||
* 用于向前端返回清单模板数据,
|
||||
* 仅包含清单模板定义字段,执行相关字段已迁移至TaskListIssueCO。
|
||||
*/
|
||||
@Data
|
||||
public class TaskListCO extends ClientObject {
|
||||
|
|
@ -31,41 +26,10 @@ public class TaskListCO extends ClientObject {
|
|||
private Integer switchFlag;
|
||||
@ApiModelProperty(value = "状态:1-进行中 2-已完成 3-已关闭")
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "执行周期开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime periodStartTime;
|
||||
@ApiModelProperty(value = "执行周期结束时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime periodEndTime;
|
||||
@ApiModelProperty(value = "清单分数")
|
||||
private BigDecimal ratingScore;
|
||||
@ApiModelProperty(value = "评分人ID")
|
||||
private Long ratingUserId;
|
||||
@ApiModelProperty(value = "评分人姓名")
|
||||
private String ratingUserName;
|
||||
@ApiModelProperty(value = "评分部门ID")
|
||||
private Long ratingDepartmentId;
|
||||
@ApiModelProperty(value = "评分部门名称")
|
||||
private String ratingDepartmentName;
|
||||
@ApiModelProperty(value = "下发状态:0-未下发 1-已下发")
|
||||
private Integer issueStatus;
|
||||
@ApiModelProperty(value = "下发时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime issueTime;
|
||||
@ApiModelProperty(value = "执行公司ID")
|
||||
private Long executeCorpId;
|
||||
@ApiModelProperty(value = "执行公司名称")
|
||||
private String executeCorpName;
|
||||
@ApiModelProperty(value = "执行部门ID")
|
||||
private Long executeDepartmentId;
|
||||
@ApiModelProperty(value = "执行部门名称")
|
||||
private String executeDepartmentName;
|
||||
@ApiModelProperty(value = "执行人员ID")
|
||||
private Long executeUserId;
|
||||
@ApiModelProperty(value = "执行人员名称")
|
||||
private String executeUserName;
|
||||
@ApiModelProperty(value = "任务数")
|
||||
private Integer taskCount;
|
||||
@ApiModelProperty(value = "反馈状态:1-正常 2-异常")
|
||||
private Integer feedbackStatus;
|
||||
@ApiModelProperty(value = "创建公司ID")
|
||||
private Long createCorpId;
|
||||
@ApiModelProperty(value = "创建部门ID")
|
||||
private Long createDepartmentId;
|
||||
@ApiModelProperty(value = "创建人ID")
|
||||
private Long createUserId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,76 @@
|
|||
package com.zcloud.safetyDutyList.dto.clientobject.tasklist;
|
||||
|
||||
import com.alibaba.cola.dto.ClientObject;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 清单下发记录客户端对象
|
||||
* <p>
|
||||
* 用于向前端返回清单下发记录数据,
|
||||
* 包含执行公司、周期、状态、评分等字段,
|
||||
* 以及通过联表查询获取的名称、任务数、反馈状态等聚合字段。
|
||||
*/
|
||||
@Data
|
||||
public class TaskListIssueCO extends ClientObject {
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Long id;
|
||||
@ApiModelProperty(value = "下发记录UUID(业务主键)")
|
||||
private String taskIssueId;
|
||||
@ApiModelProperty(value = "清单UUID")
|
||||
private String taskListId;
|
||||
@ApiModelProperty(value = "清单名称")
|
||||
private String taskListName;
|
||||
@ApiModelProperty(value = "任务级别")
|
||||
private Integer taskLevel;
|
||||
@ApiModelProperty(value = "责任岗位")
|
||||
private String responsibilityPost;
|
||||
@ApiModelProperty(value = "执行公司ID")
|
||||
private Long executeCorpId;
|
||||
@ApiModelProperty(value = "执行公司名称")
|
||||
private String executeCorpName;
|
||||
@ApiModelProperty(value = "执行部门ID")
|
||||
private Long executeDepartmentId;
|
||||
@ApiModelProperty(value = "执行部门名称")
|
||||
private String executeDepartmentName;
|
||||
@ApiModelProperty(value = "执行人员ID")
|
||||
private Long executeUserId;
|
||||
@ApiModelProperty(value = "执行人员名称")
|
||||
private String executeUserName;
|
||||
@ApiModelProperty(value = "下发状态:0-未下发 1-已下发")
|
||||
private Integer issueStatus;
|
||||
@ApiModelProperty(value = "下发时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime issueTime;
|
||||
@ApiModelProperty(value = "执行周期开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime periodStartTime;
|
||||
@ApiModelProperty(value = "执行周期结束时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime periodEndTime;
|
||||
@ApiModelProperty(value = "状态:1-进行中 2-已完成 3-已关闭")
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "关闭时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime closeTime;
|
||||
@ApiModelProperty(value = "评分数")
|
||||
private BigDecimal ratingScore;
|
||||
@ApiModelProperty(value = "评分人ID")
|
||||
private Long ratingUserId;
|
||||
@ApiModelProperty(value = "评分人姓名")
|
||||
private String ratingUserName;
|
||||
@ApiModelProperty(value = "评分部门ID")
|
||||
private Long ratingDepartmentId;
|
||||
@ApiModelProperty(value = "评分部门名称")
|
||||
private String ratingDepartmentName;
|
||||
@ApiModelProperty(value = "任务数")
|
||||
private Integer taskCount;
|
||||
@ApiModelProperty(value = "反馈状态:1-正常 2-异常")
|
||||
private Integer feedbackStatus;
|
||||
@ApiModelProperty(value = "是否启用:0-关 1-开")
|
||||
private Integer switchFlag;
|
||||
}
|
||||
|
|
@ -14,23 +14,16 @@ import java.time.LocalDateTime;
|
|||
/**
|
||||
* 执行反馈新增命令
|
||||
* <p>
|
||||
* 用于提交执行反馈,包含任务清单ID、任务详情ID、反馈内容、
|
||||
* 反馈周期起止时间、反馈周期标识、反馈人信息等字段
|
||||
* 用于提交执行反馈,只需传入任务执行ID和反馈内容,
|
||||
* 其他关联信息(清单ID、任务详情ID、下发记录ID等)从任务执行记录中自动获取
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FeedbackAddCmd implements Serializable {
|
||||
@ApiModelProperty(value = "任务清单ID", required = true)
|
||||
@NotEmpty(message = "任务清单ID不能为空")
|
||||
private String taskListId;
|
||||
|
||||
@ApiModelProperty(value = "清单明细ID", required = true)
|
||||
@NotEmpty(message = "清单明细ID不能为空")
|
||||
private String taskDetailId;
|
||||
|
||||
@ApiModelProperty(value = "反馈ID", required = true)
|
||||
private String feedbackId;
|
||||
@ApiModelProperty(value = "任务执行ID", required = true)
|
||||
@NotEmpty(message = "任务执行ID不能为空")
|
||||
private String taskExecutionId;
|
||||
|
||||
@ApiModelProperty(value = "反馈内容", required = true)
|
||||
@NotEmpty(message = "反馈内容不能为空")
|
||||
|
|
|
|||
|
|
@ -9,16 +9,14 @@ import javax.validation.constraints.NotEmpty;
|
|||
/**
|
||||
* 反馈列表查询参数
|
||||
* <p>
|
||||
* 用于查询指定任务在指定周期标识下的反馈列表
|
||||
* 用于查询指定下发记录在指定周期标识下的反馈列表
|
||||
*/
|
||||
@Data
|
||||
public class FeedbackListQry extends PageQuery {
|
||||
@ApiModelProperty(value = "任务详情ID")
|
||||
private String taskDetailId;
|
||||
@ApiModelProperty(value = "任务清单ID")
|
||||
private String taskListId;
|
||||
@ApiModelProperty(value = "周期标识")
|
||||
@ApiModelProperty(value = "任务执行业务ID", required = true)
|
||||
@NotEmpty(message = "任务执行ID不能为空")
|
||||
private String taskExecutionId;
|
||||
@ApiModelProperty(value = "周期标识", required = true)
|
||||
@NotEmpty(message = "周期标识不能为空")
|
||||
private String feedbackPeriodFlag;
|
||||
@ApiModelProperty(value = "反馈人公司ID")
|
||||
private Long feedbackCorpId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ import lombok.Data;
|
|||
/**
|
||||
* 反馈周期分组查询参数
|
||||
* <p>
|
||||
* 用于查询指定任务的反馈周期分组列表,支持按反馈时间范围筛选
|
||||
* 用于查询指定下发记录的反馈周期分组列表,支持按反馈时间范围筛选
|
||||
*/
|
||||
@Data
|
||||
public class FeedbackPeriodGroupQry {
|
||||
@ApiModelProperty(value = "任务ID", required = true)
|
||||
private String taskDetailId;
|
||||
@ApiModelProperty(value = "任务执行业务ID", required = true)
|
||||
private String taskExecutionId;
|
||||
@ApiModelProperty(value = "反馈时间开始(格式:yyyy-MM-dd)")
|
||||
private String feedbackTimeStart;
|
||||
@ApiModelProperty(value = "反馈时间结束(格式:yyyy-MM-dd)")
|
||||
|
|
|
|||
|
|
@ -9,15 +9,15 @@ import javax.validation.constraints.NotEmpty;
|
|||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 任务详情关闭命令
|
||||
* 任务关闭命令
|
||||
* <p>
|
||||
* 用于关闭单个任务详情,仅需任务详情业务ID
|
||||
* 用于关闭任务模板(同时关闭关联的所有任务执行记录),仅需任务业务ID
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TaskDetailCloseCmd implements Serializable {
|
||||
@ApiModelProperty(value = "任务UUID", required = true)
|
||||
@NotEmpty(message = "任务ID不能为空")
|
||||
@ApiModelProperty(value = "任务业务ID", required = true)
|
||||
@NotEmpty(message = "任务业务ID不能为空")
|
||||
private String taskDetailId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ import lombok.Data;
|
|||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* 任务详情分页查询参数
|
||||
* 任务列表分页查询参数
|
||||
* <p>
|
||||
* 支持按清单业务ID筛选任务详情列表
|
||||
* 支持按清单业务ID筛选任务模板列表
|
||||
*/
|
||||
@Data
|
||||
public class TaskDetailPageQry extends PageQuery {
|
||||
|
|
@ -19,14 +19,6 @@ public class TaskDetailPageQry extends PageQuery {
|
|||
|
||||
@ApiModelProperty(value = "执行内容")
|
||||
private String taskContent;
|
||||
@ApiModelProperty(value = "任务周期开始时间")
|
||||
private String taskPeriodStart;
|
||||
@ApiModelProperty(value = "任务周期结束时间")
|
||||
private String taskPeriodEnd;
|
||||
@ApiModelProperty(value = "反馈周期类型")
|
||||
private Integer feedbackCycleType;
|
||||
@ApiModelProperty(value = "反馈状态 1-正常 2-异常")
|
||||
private Integer feedbackStatus;
|
||||
@ApiModelProperty(value = "任务状态")
|
||||
private Integer taskStatus;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@ public class TaskDetailSaveBatchCmd implements Serializable {
|
|||
@ApiModelProperty(value = "主键ID", required = true)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "任务表ID", required = true)
|
||||
private String taskDetailId;
|
||||
|
||||
@ApiModelProperty(value = "清单表主键ID", required = true)
|
||||
@NotEmpty(message = "清单ID不能为空")
|
||||
private String taskListId;
|
||||
|
||||
@ApiModelProperty(value = "任务表ID", required = true)
|
||||
private String taskDetailId;
|
||||
|
||||
@ApiModelProperty(value = "执行内容")
|
||||
private String executeContent;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,15 +13,15 @@ import java.math.BigDecimal;
|
|||
/**
|
||||
* 任务评分更新命令
|
||||
* <p>
|
||||
* 用于更新任务详情的评分,评分不能超过任务分值
|
||||
* 用于更新任务执行记录的评分,评分不能超过任务分值
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TaskDetailUpdateScoreCmd implements Serializable {
|
||||
@ApiModelProperty(value = "任务UUID", required = true)
|
||||
@NotEmpty(message = "任务ID不能为空")
|
||||
private String taskDetailId;
|
||||
@ApiModelProperty(value = "任务执行UUID", required = true)
|
||||
@NotEmpty(message = "任务执行ID不能为空")
|
||||
private String taskExecutionId;
|
||||
|
||||
@ApiModelProperty(value = "分数(不能超过任务分值)", required = true)
|
||||
@NotNull(message = "分数不能为空")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
package com.zcloud.safetyDutyList.dto.tasklist;
|
||||
|
||||
import com.alibaba.cola.dto.PageQuery;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 任务执行记录分页查询参数
|
||||
*/
|
||||
@Data
|
||||
public class TaskExecutionPageQry extends PageQuery {
|
||||
@ApiModelProperty(value = "清单下发记录UUID")
|
||||
private String taskIssueId;
|
||||
@ApiModelProperty(value = "清单UUID")
|
||||
private String taskListId;
|
||||
@ApiModelProperty(value = "执行内容(模糊查询)")
|
||||
private String taskContent;
|
||||
@ApiModelProperty(value = "反馈周期类型:1-每月 2-季度 3-半年 4-年")
|
||||
private String feedbackCycleType;
|
||||
@ApiModelProperty(value = "反馈状态:1-正常 2-异常")
|
||||
private String feedbackStatus;
|
||||
@ApiModelProperty(value = "任务状态:1-进行中 2-已完成 3-已关闭")
|
||||
private String taskStatus;
|
||||
}
|
||||
|
|
@ -9,15 +9,15 @@ import javax.validation.constraints.NotEmpty;
|
|||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 安全责任清单关闭命令
|
||||
* 清单关闭命令
|
||||
* <p>
|
||||
* 用于关闭清单(同时关闭关联的所有任务详情),仅需清单业务ID
|
||||
* 用于关闭清单模板(同时关闭关联的所有下发记录和任务执行记录),仅需清单业务ID
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TaskListCloseCmd implements Serializable {
|
||||
@ApiModelProperty(value = "清单UUID(业务主键)", required = true)
|
||||
@NotEmpty(message = "清单ID不能为空")
|
||||
@ApiModelProperty(value = "清单业务ID", required = true)
|
||||
@NotEmpty(message = "清单业务ID不能为空")
|
||||
private String taskListId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
package com.zcloud.safetyDutyList.dto.tasklist;
|
||||
|
||||
import com.alibaba.cola.dto.PageQuery;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 清单下发记录分页查询参数
|
||||
*/
|
||||
@Data
|
||||
public class TaskListIssuePageQry extends PageQuery {
|
||||
@ApiModelProperty(value = "清单UUID")
|
||||
private String taskListId;
|
||||
@ApiModelProperty(value = "执行公司ID")
|
||||
private Long executeCorpId;
|
||||
@ApiModelProperty(value = "执行人ID")
|
||||
private Long executeUserId;
|
||||
@ApiModelProperty(value = "清单名称(模糊查询)")
|
||||
private String taskListName;
|
||||
@ApiModelProperty(value = "任务级别:1-企业级 2-部门级 3-班组级")
|
||||
private Integer taskLevel;
|
||||
@ApiModelProperty(value = "下发状态:0-未下发 1-已下发")
|
||||
private Integer issueStatus;
|
||||
@ApiModelProperty(value = "状态:1-进行中 2-已完成 3-已关闭")
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "反馈状态:1-正常 2-异常")
|
||||
private Integer feedbackStatus;
|
||||
@ApiModelProperty(value = "0-未评分 1-已评分")
|
||||
private Integer scoreStatus;
|
||||
|
||||
private String menuPath;
|
||||
}
|
||||
|
|
@ -11,20 +11,10 @@ import lombok.Data;
|
|||
*/
|
||||
@Data
|
||||
public class TaskListPageQry extends PageQuery {
|
||||
@ApiModelProperty(value = "创建公司ID")
|
||||
private Long createCorpId;
|
||||
@ApiModelProperty(value = "执行公司ID")
|
||||
private Long executeCorpId;
|
||||
@ApiModelProperty(value = "执行人ID")
|
||||
private Long executeUserId;
|
||||
@ApiModelProperty(value = "清单名称(模糊查询)")
|
||||
private String taskListName;
|
||||
@ApiModelProperty(value = "任务级别:1-企业级 2-部门级 3-班组级")
|
||||
private Integer taskLevel;
|
||||
@ApiModelProperty(value = "反馈状态:1-正常 2-异常")
|
||||
private Integer feedbackStatus;
|
||||
@ApiModelProperty(value = "开启/关闭:0-关 1-开")
|
||||
private Integer switchFlag;
|
||||
|
||||
private String menuPath;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,26 +41,4 @@ public class TaskListUpdateCmd implements Serializable {
|
|||
@ApiModelProperty(value = "是否启用:1-启用 0-不启用", required = true)
|
||||
@NotNull(message = "是否启用不能为空")
|
||||
private Integer switchFlag;
|
||||
|
||||
// @ApiModelProperty(value = "执行周期开始时间", required = true)
|
||||
// @NotNull(message = "执行周期开始时间不能为空")
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
// private LocalDateTime periodStartTime;
|
||||
//
|
||||
// @ApiModelProperty(value = "执行周期结束时间", required = true)
|
||||
// @NotNull(message = "执行周期结束时间不能为空")
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
// private LocalDateTime periodEndTime;
|
||||
//
|
||||
// @ApiModelProperty(value = "执行公司ID")
|
||||
// private Long executeCorpId;
|
||||
//
|
||||
// @ApiModelProperty(value = "执行部门ID")
|
||||
// private Long executeDepartmentId;
|
||||
//
|
||||
// @ApiModelProperty(value = "执行人员ID")
|
||||
// private Long executeUserId;
|
||||
//
|
||||
// @ApiModelProperty(value = "清单明细列表")
|
||||
// private List<TaskDetailAddCmd> taskDetailList;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,4 +61,15 @@ public interface FeedbackGateway {
|
|||
* @return 反馈记录列表
|
||||
*/
|
||||
List<FeedbackE> listByTaskDetailId(String taskDetailId);
|
||||
|
||||
/**
|
||||
* 根据任务执行ID和周期标识查询反馈记录
|
||||
* <p>
|
||||
* 用于定时任务2反馈异常检测
|
||||
*
|
||||
* @param taskExecutionId 任务执行ID
|
||||
* @param feedbackPeriodFlag 反馈周期标识(如yyyy-MM)
|
||||
* @return 反馈记录列表
|
||||
*/
|
||||
List<FeedbackE> listByTaskExecutionIdAndPeriodFlag(String taskExecutionId, String feedbackPeriodFlag);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
package com.zcloud.safetyDutyList.domain.gateway.tasklist;
|
||||
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskExecutionE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 任务执行记录网关接口
|
||||
*/
|
||||
public interface TaskExecutionGateway {
|
||||
|
||||
Boolean add(TaskExecutionE taskExecutionE);
|
||||
|
||||
Boolean batchAdd(List<TaskExecutionE> taskExecutionEList);
|
||||
|
||||
Boolean update(TaskExecutionE taskExecutionE);
|
||||
|
||||
Boolean deleteById(Long id);
|
||||
|
||||
TaskExecutionE getByTaskExecutionId(String taskExecutionId);
|
||||
|
||||
List<TaskExecutionE> listByTaskIssueId(String taskIssueId);
|
||||
|
||||
List<TaskExecutionE> listByTaskListId(String taskListId);
|
||||
|
||||
List<TaskExecutionE> listByTaskDetailId(String taskDetailId);
|
||||
}
|
||||
|
|
@ -2,8 +2,6 @@ package com.zcloud.safetyDutyList.domain.gateway.tasklist;
|
|||
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskListE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 清单网关接口
|
||||
* <p>
|
||||
|
|
@ -58,25 +56,4 @@ public interface TaskListGateway {
|
|||
* @return 清单领域模型
|
||||
*/
|
||||
TaskListE getInfoByTaskListId(String taskListId);
|
||||
|
||||
/**
|
||||
* 查询所有已过期且仍在进行中的清单
|
||||
* <p>
|
||||
* 查询条件:status=1(进行中)且 period_end_time < 当前时间
|
||||
* 用于定时任务1:更新清单状态和任务状态
|
||||
*
|
||||
* @return 已过期的进行中清单列表
|
||||
*/
|
||||
List<TaskListE> listExpiredInProgress();
|
||||
|
||||
/**
|
||||
* 查询所有已下发且周期时间完整的清单
|
||||
* <p>
|
||||
* 查询条件:issue_status=1(已下发)且 period_start_time IS NOT NULL 且 period_end_time IS NOT NULL
|
||||
* 且 period_end_time不超过当前时间1个月(超过1个月不再检测异常)
|
||||
* 用于定时任务2:反馈异常检测,以清单周期起始时间判断是否跳过检测
|
||||
*
|
||||
* @return 已下发且周期时间完整的清单列表
|
||||
*/
|
||||
List<TaskListE> listIssuedWithPeriod();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
package com.zcloud.safetyDutyList.domain.gateway.tasklist;
|
||||
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskListIssueE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 清单下发记录网关接口
|
||||
*/
|
||||
public interface TaskListIssueGateway {
|
||||
|
||||
Boolean add(TaskListIssueE taskListIssueE);
|
||||
|
||||
Boolean update(TaskListIssueE taskListIssueE);
|
||||
|
||||
Boolean deleteById(Long id);
|
||||
|
||||
TaskListIssueE getByTaskIssueId(String taskIssueId);
|
||||
|
||||
List<TaskListIssueE> listByTaskListId(String taskListId);
|
||||
|
||||
List<TaskListIssueE> listExpiredInProgress();
|
||||
|
||||
List<TaskListIssueE> listIssuedWithPeriod();
|
||||
}
|
||||
|
|
@ -18,7 +18,9 @@ public class FeedbackE extends BaseE {
|
|||
private Long id;
|
||||
private String feedbackId;
|
||||
private String taskDetailId;
|
||||
private String taskExecutionId;
|
||||
private String taskListId;
|
||||
private String taskIssueId;
|
||||
private LocalDateTime feedbackTime;
|
||||
private LocalDateTime feedbackPeriodStartTime;
|
||||
private LocalDateTime feedbackPeriodEndTime;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,9 @@ public class FeedbackExceptionE extends BaseE {
|
|||
private Long id;
|
||||
private String feedbackExceptionId;
|
||||
private String taskDetailId;
|
||||
private String taskExecutionId;
|
||||
private String taskListId;
|
||||
private String taskIssueId;
|
||||
private String exceptionPeriodFlag;
|
||||
private LocalDateTime exceptionPeriodStartTime;
|
||||
private LocalDateTime exceptionPeriodEndTime;
|
||||
|
|
|
|||
|
|
@ -2,16 +2,16 @@ package com.zcloud.safetyDutyList.domain.model.tasklist;
|
|||
|
||||
import com.jjb.saas.framework.domain.model.BaseE;
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import com.zcloud.gbscommon.utils.UuidUtil;
|
||||
import lombok.Data;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 任务详情领域模型
|
||||
* 任务详情领域模型(纯模板定义)
|
||||
* <p>
|
||||
* 对应数据库表safety_accountability_task_detail,
|
||||
* 包含任务的执行内容、反馈周期、状态、评分等字段。
|
||||
* 仅包含任务模板定义字段,执行相关字段已迁移至TaskExecutionE。
|
||||
*/
|
||||
@Data
|
||||
public class TaskDetailE extends BaseE {
|
||||
|
|
@ -20,17 +20,12 @@ public class TaskDetailE extends BaseE {
|
|||
private String taskListId;
|
||||
private String executeContent;
|
||||
private Integer feedbackCycleType;
|
||||
private Integer taskStatus;
|
||||
private Integer feedbackStatus;
|
||||
private BigDecimal taskScore;
|
||||
private BigDecimal taskRating;
|
||||
private LocalDateTime ratingTime;
|
||||
private Long ratingDepartmentId;
|
||||
private Long ratingUserId;
|
||||
private Integer taskStatus;
|
||||
|
||||
public void init() {
|
||||
if (ObjectUtils.isEmpty(this.taskDetailId)) {
|
||||
setTaskDetailId(Tools.get32UUID());
|
||||
setTaskDetailId(UuidUtil.get32UUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
package com.zcloud.safetyDutyList.domain.model.tasklist;
|
||||
|
||||
import com.jjb.saas.framework.domain.model.BaseE;
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import com.zcloud.gbscommon.utils.UuidUtil;
|
||||
import lombok.Data;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 任务执行记录领域模型
|
||||
* <p>
|
||||
* 对应数据库表safety_accountability_task_execution,
|
||||
* 包含任务执行状态、反馈状态、评分等执行相关字段。
|
||||
*/
|
||||
@Data
|
||||
public class TaskExecutionE extends BaseE {
|
||||
private Long id;
|
||||
private String taskExecutionId;
|
||||
private String taskIssueId;
|
||||
private String taskDetailId;
|
||||
private String taskListId;
|
||||
private Integer taskStatus;
|
||||
private Integer feedbackStatus;
|
||||
private BigDecimal taskRating;
|
||||
private LocalDateTime ratingTime;
|
||||
private Long ratingDepartmentId;
|
||||
private Long ratingUserId;
|
||||
|
||||
public void init() {
|
||||
if (ObjectUtils.isEmpty(this.taskExecutionId)) {
|
||||
setTaskExecutionId(UuidUtil.get32UUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,14 +5,11 @@ import com.zcloud.gbscommon.utils.Tools;
|
|||
import lombok.Data;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 安全责任清单领域模型
|
||||
* 安全责任清单领域模型(纯模板定义)
|
||||
* <p>
|
||||
* 对应数据库表safety_accountability_task_list,
|
||||
* 包含清单的基本信息、状态、周期、下发信息等字段。
|
||||
* 仅包含清单模板定义字段,执行相关字段已迁移至TaskListIssueE。
|
||||
*/
|
||||
@Data
|
||||
public class TaskListE extends BaseE {
|
||||
|
|
@ -23,20 +20,9 @@ public class TaskListE extends BaseE {
|
|||
private String responsibilityPost;
|
||||
private Integer switchFlag;
|
||||
private Integer status;
|
||||
private LocalDateTime periodStartTime;
|
||||
private LocalDateTime periodEndTime;
|
||||
private BigDecimal ratingScore;
|
||||
private Long ratingUserId;
|
||||
private Long ratingDepartmentId;
|
||||
private Long createCorpId;
|
||||
private Long createDepartmentId;
|
||||
private Long createUserId;
|
||||
private Integer issueStatus;
|
||||
private LocalDateTime issueTime;
|
||||
private Long executeCorpId;
|
||||
private Long executeDepartmentId;
|
||||
private Long executeUserId;
|
||||
private LocalDateTime closeTime;
|
||||
|
||||
public void init() {
|
||||
if (ObjectUtils.isEmpty(this.taskListId)) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
package com.zcloud.safetyDutyList.domain.model.tasklist;
|
||||
|
||||
import com.jjb.saas.framework.domain.model.BaseE;
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import com.zcloud.gbscommon.utils.UuidUtil;
|
||||
import lombok.Data;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 清单下发记录领域模型
|
||||
* <p>
|
||||
* 对应数据库表safety_accountability_task_list_issue,
|
||||
* 包含下发对象、周期、状态、评分等执行相关字段。
|
||||
*/
|
||||
@Data
|
||||
public class TaskListIssueE extends BaseE {
|
||||
private Long id;
|
||||
private String taskIssueId;
|
||||
private String taskListId;
|
||||
private Long executeCorpId;
|
||||
private Long executeDepartmentId;
|
||||
private Long executeUserId;
|
||||
private Integer issueStatus;
|
||||
private LocalDateTime issueTime;
|
||||
private LocalDateTime periodStartTime;
|
||||
private LocalDateTime periodEndTime;
|
||||
private Integer status;
|
||||
private LocalDateTime closeTime;
|
||||
private BigDecimal ratingScore;
|
||||
private Long ratingUserId;
|
||||
private Long ratingDepartmentId;
|
||||
|
||||
public void init() {
|
||||
if (ObjectUtils.isEmpty(this.taskIssueId)) {
|
||||
setTaskIssueId(UuidUtil.get32UUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -85,4 +85,18 @@ public class FeedbackGatewayImpl implements FeedbackGateway {
|
|||
}
|
||||
return eList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FeedbackE> listByTaskExecutionIdAndPeriodFlag(String taskExecutionId, String feedbackPeriodFlag) {
|
||||
List<FeedbackDO> doList = feedbackRepository.listByTaskExecutionIdAndPeriodFlag(taskExecutionId, feedbackPeriodFlag);
|
||||
List<FeedbackE> eList = new ArrayList<>();
|
||||
if (doList != null) {
|
||||
for (FeedbackDO d : doList) {
|
||||
FeedbackE e = new FeedbackE();
|
||||
BeanUtils.copyProperties(d, e);
|
||||
eList.add(e);
|
||||
}
|
||||
}
|
||||
return eList;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,106 @@
|
|||
package com.zcloud.safetyDutyList.gatewayimpl.tasklist;
|
||||
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskExecutionGateway;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskExecutionE;
|
||||
import com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskExecutionDO;
|
||||
import com.zcloud.safetyDutyList.persistence.repository.tasklist.TaskExecutionRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class TaskExecutionGatewayImpl implements TaskExecutionGateway {
|
||||
|
||||
private final TaskExecutionRepository taskExecutionRepository;
|
||||
|
||||
@Override
|
||||
public Boolean add(TaskExecutionE taskExecutionE) {
|
||||
if (StringUtils.isEmpty(taskExecutionE.getTaskExecutionId())) {
|
||||
taskExecutionE.setTaskExecutionId(Tools.get32UUID());
|
||||
}
|
||||
TaskExecutionDO d = new TaskExecutionDO();
|
||||
BeanUtils.copyProperties(taskExecutionE, d);
|
||||
taskExecutionRepository.save(d);
|
||||
taskExecutionE.setId(d.getId());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean batchAdd(List<TaskExecutionE> taskExecutionEList) {
|
||||
if (taskExecutionEList == null || taskExecutionEList.isEmpty()) return true;
|
||||
for (TaskExecutionE e : taskExecutionEList) {
|
||||
add(e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean update(TaskExecutionE taskExecutionE) {
|
||||
TaskExecutionDO d = new TaskExecutionDO();
|
||||
BeanUtils.copyProperties(taskExecutionE, d);
|
||||
taskExecutionRepository.updateById(d);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteById(Long id) {
|
||||
return taskExecutionRepository.removeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskExecutionE getByTaskExecutionId(String taskExecutionId) {
|
||||
TaskExecutionDO d = taskExecutionRepository.getByTaskExecutionId(taskExecutionId);
|
||||
if (d == null) return null;
|
||||
TaskExecutionE e = new TaskExecutionE();
|
||||
BeanUtils.copyProperties(d, e);
|
||||
return e;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskExecutionE> listByTaskIssueId(String taskIssueId) {
|
||||
List<TaskExecutionDO> doList = taskExecutionRepository.listByTaskIssueId(taskIssueId);
|
||||
List<TaskExecutionE> eList = new ArrayList<>();
|
||||
if (doList != null) {
|
||||
for (TaskExecutionDO d : doList) {
|
||||
TaskExecutionE e = new TaskExecutionE();
|
||||
BeanUtils.copyProperties(d, e);
|
||||
eList.add(e);
|
||||
}
|
||||
}
|
||||
return eList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskExecutionE> listByTaskListId(String taskListId) {
|
||||
List<TaskExecutionDO> doList = taskExecutionRepository.listByTaskListId(taskListId);
|
||||
List<TaskExecutionE> eList = new ArrayList<>();
|
||||
if (doList != null) {
|
||||
for (TaskExecutionDO d : doList) {
|
||||
TaskExecutionE e = new TaskExecutionE();
|
||||
BeanUtils.copyProperties(d, e);
|
||||
eList.add(e);
|
||||
}
|
||||
}
|
||||
return eList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskExecutionE> listByTaskDetailId(String taskDetailId) {
|
||||
List<TaskExecutionDO> doList = taskExecutionRepository.listByTaskDetailId(taskDetailId);
|
||||
List<TaskExecutionE> eList = new ArrayList<>();
|
||||
if (doList != null) {
|
||||
for (TaskExecutionDO d : doList) {
|
||||
TaskExecutionE e = new TaskExecutionE();
|
||||
BeanUtils.copyProperties(d, e);
|
||||
eList.add(e);
|
||||
}
|
||||
}
|
||||
return eList;
|
||||
}
|
||||
}
|
||||
|
|
@ -11,9 +11,6 @@ import org.apache.commons.lang.StringUtils;
|
|||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 清单网关实现类
|
||||
* <p>
|
||||
|
|
@ -122,40 +119,4 @@ public class TaskListGatewayImpl implements TaskListGateway {
|
|||
BeanUtils.copyProperties(d, e);
|
||||
return e;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有已过期且仍在进行中的清单
|
||||
* <p>
|
||||
* 查询条件:status=1(进行中)且 period_end_time < 当前时间
|
||||
* 将数据对象列表转换为领域模型列表返回
|
||||
*
|
||||
* @return 已过期的进行中清单列表
|
||||
*/
|
||||
@Override
|
||||
public List<TaskListE> listExpiredInProgress() {
|
||||
List<TaskListDO> doList = taskListRepository.listExpiredInProgress();
|
||||
List<TaskListE> eList = new ArrayList<>();
|
||||
if (doList != null) {
|
||||
for (TaskListDO d : doList) {
|
||||
TaskListE e = new TaskListE();
|
||||
BeanUtils.copyProperties(d, e);
|
||||
eList.add(e);
|
||||
}
|
||||
}
|
||||
return eList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskListE> listIssuedWithPeriod() {
|
||||
List<TaskListDO> doList = taskListRepository.listIssuedWithPeriod();
|
||||
List<TaskListE> eList = new ArrayList<>();
|
||||
if (doList != null) {
|
||||
for (TaskListDO d : doList) {
|
||||
TaskListE e = new TaskListE();
|
||||
BeanUtils.copyProperties(d, e);
|
||||
eList.add(e);
|
||||
}
|
||||
}
|
||||
return eList;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,97 @@
|
|||
package com.zcloud.safetyDutyList.gatewayimpl.tasklist;
|
||||
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import com.zcloud.safetyDutyList.domain.gateway.tasklist.TaskListIssueGateway;
|
||||
import com.zcloud.safetyDutyList.domain.model.tasklist.TaskListIssueE;
|
||||
import com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskListIssueDO;
|
||||
import com.zcloud.safetyDutyList.persistence.repository.tasklist.TaskListIssueRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class TaskListIssueGatewayImpl implements TaskListIssueGateway {
|
||||
|
||||
private final TaskListIssueRepository taskListIssueRepository;
|
||||
|
||||
@Override
|
||||
public Boolean add(TaskListIssueE taskListIssueE) {
|
||||
if (StringUtils.isEmpty(taskListIssueE.getTaskIssueId())) {
|
||||
taskListIssueE.setTaskIssueId(Tools.get32UUID());
|
||||
}
|
||||
TaskListIssueDO d = new TaskListIssueDO();
|
||||
BeanUtils.copyProperties(taskListIssueE, d);
|
||||
taskListIssueRepository.save(d);
|
||||
taskListIssueE.setId(d.getId());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean update(TaskListIssueE taskListIssueE) {
|
||||
TaskListIssueDO d = new TaskListIssueDO();
|
||||
BeanUtils.copyProperties(taskListIssueE, d);
|
||||
taskListIssueRepository.updateById(d);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteById(Long id) {
|
||||
return taskListIssueRepository.removeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskListIssueE getByTaskIssueId(String taskIssueId) {
|
||||
TaskListIssueDO d = taskListIssueRepository.getByTaskIssueId(taskIssueId);
|
||||
if (d == null) return null;
|
||||
TaskListIssueE e = new TaskListIssueE();
|
||||
BeanUtils.copyProperties(d, e);
|
||||
return e;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskListIssueE> listByTaskListId(String taskListId) {
|
||||
List<TaskListIssueDO> doList = taskListIssueRepository.listByTaskListId(taskListId);
|
||||
List<TaskListIssueE> eList = new ArrayList<>();
|
||||
if (doList != null) {
|
||||
for (TaskListIssueDO d : doList) {
|
||||
TaskListIssueE e = new TaskListIssueE();
|
||||
BeanUtils.copyProperties(d, e);
|
||||
eList.add(e);
|
||||
}
|
||||
}
|
||||
return eList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskListIssueE> listExpiredInProgress() {
|
||||
List<TaskListIssueDO> doList = taskListIssueRepository.listExpiredInProgress();
|
||||
List<TaskListIssueE> eList = new ArrayList<>();
|
||||
if (doList != null) {
|
||||
for (TaskListIssueDO d : doList) {
|
||||
TaskListIssueE e = new TaskListIssueE();
|
||||
BeanUtils.copyProperties(d, e);
|
||||
eList.add(e);
|
||||
}
|
||||
}
|
||||
return eList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskListIssueE> listIssuedWithPeriod() {
|
||||
List<TaskListIssueDO> doList = taskListIssueRepository.listIssuedWithPeriod();
|
||||
List<TaskListIssueE> eList = new ArrayList<>();
|
||||
if (doList != null) {
|
||||
for (TaskListIssueDO d : doList) {
|
||||
TaskListIssueE e = new TaskListIssueE();
|
||||
BeanUtils.copyProperties(d, e);
|
||||
eList.add(e);
|
||||
}
|
||||
}
|
||||
return eList;
|
||||
}
|
||||
}
|
||||
|
|
@ -6,9 +6,9 @@ import lombok.Data;
|
|||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 考核清单统计数据对象
|
||||
* 企业评价列表统计数据对象
|
||||
* <p>
|
||||
* 用于按企业分组统计清单数量,
|
||||
* 用于按企业分组统计待评分/已评分清单数量,
|
||||
* 由TaskListMapper.xml中的evaluationList SQL聚合查询填充。
|
||||
*/
|
||||
@Data
|
||||
|
|
@ -17,6 +17,8 @@ public class EvaluationListDO implements Serializable {
|
|||
private Long corpId;
|
||||
@ApiModelProperty(value = "公司名称")
|
||||
private String corpName;
|
||||
@ApiModelProperty(value = "清单数量")
|
||||
private Integer listCount;
|
||||
@ApiModelProperty(value = "待评分清单数量")
|
||||
private Integer pendingScoreCount;
|
||||
@ApiModelProperty(value = "已评分清单数量")
|
||||
private Integer scoredCount;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,8 +26,12 @@ public class FeedbackDO extends BaseDO {
|
|||
private String feedbackId;
|
||||
@ApiModelProperty(value = "任务详情UUID")
|
||||
private String taskDetailId;
|
||||
@ApiModelProperty(value = "任务执行UUID")
|
||||
private String taskExecutionId;
|
||||
@ApiModelProperty(value = "任务清单UUID")
|
||||
private String taskListId;
|
||||
@ApiModelProperty(value = "清单下发记录UUID")
|
||||
private String taskIssueId;
|
||||
@ApiModelProperty(value = "反馈时间")
|
||||
private LocalDateTime feedbackTime;
|
||||
@ApiModelProperty(value = "反馈周期开始时间")
|
||||
|
|
|
|||
|
|
@ -26,8 +26,12 @@ public class FeedbackExceptionDO extends BaseDO {
|
|||
private String feedbackExceptionId;
|
||||
@ApiModelProperty(value = "任务详情UUID")
|
||||
private String taskDetailId;
|
||||
@ApiModelProperty(value = "任务执行UUID")
|
||||
private String taskExecutionId;
|
||||
@ApiModelProperty(value = "任务清单UUID")
|
||||
private String taskListId;
|
||||
@ApiModelProperty(value = "清单下发记录UUID")
|
||||
private String taskIssueId;
|
||||
@ApiModelProperty(value = "异常周期标识")
|
||||
private String exceptionPeriodFlag;
|
||||
@ApiModelProperty(value = "异常周期开始时间")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.zcloud.safetyDutyList.persistence.dataobject.tasklist;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.jjb.saas.framework.repository.basedo.BaseDO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
|
@ -9,20 +8,20 @@ import lombok.EqualsAndHashCode;
|
|||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 任务详情数据对象
|
||||
* 任务详情数据对象(纯模板定义)
|
||||
* <p>
|
||||
* 对应数据库表safety_accountability_task_detail,
|
||||
* 用于MyBatis-Plus操作任务详情数据的持久化对象。
|
||||
* 联表查询时通过@TableField(exist=false)映射关联表的虚拟字段。
|
||||
* 仅包含任务模板定义字段,执行相关字段已迁移至TaskExecutionDO。
|
||||
*/
|
||||
@Data
|
||||
@TableName("safety_accountability_task_detail")
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TaskDetailDO extends BaseDO {
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
@ApiModelProperty(value = "明细UUID(业务主键)")
|
||||
private String taskDetailId;
|
||||
@ApiModelProperty(value = "任务清单ID")
|
||||
|
|
@ -31,40 +30,15 @@ public class TaskDetailDO extends BaseDO {
|
|||
private String executeContent;
|
||||
@ApiModelProperty(value = "反馈周期类型:1-每月 2-季度 3-半年 4-年")
|
||||
private Integer feedbackCycleType;
|
||||
@ApiModelProperty(value = "任务状态:1-进行中 2-已完成 3-已关闭")
|
||||
private Integer taskStatus;
|
||||
@ApiModelProperty(value = "反馈状态:1-正常 2-存在异常")
|
||||
private Integer feedbackStatus;
|
||||
@ApiModelProperty(value = "任务分值")
|
||||
private BigDecimal taskScore;
|
||||
@ApiModelProperty(value = "任务评分")
|
||||
private BigDecimal taskRating;
|
||||
@ApiModelProperty(value = "评分时间")
|
||||
private LocalDateTime ratingTime;
|
||||
@ApiModelProperty(value = "评分部门ID")
|
||||
private Long ratingDepartmentId;
|
||||
@ApiModelProperty(value = "评分人ID")
|
||||
private Long ratingUserId;
|
||||
@ApiModelProperty(value = "任务状态:1-进行中 2-已完成 3-已关闭")
|
||||
private Integer taskStatus;
|
||||
|
||||
@ApiModelProperty(value = "反馈次数")
|
||||
@TableField(exist = false)
|
||||
private Integer feedbackCount;
|
||||
@ApiModelProperty(value = "当前周期是否已反馈:0-否 1-是")
|
||||
@TableField(exist = false)
|
||||
private Integer currentPeriodFeedback;
|
||||
@ApiModelProperty(value = "清单名称")
|
||||
@TableField(exist = false)
|
||||
private String taskListName;
|
||||
@ApiModelProperty(value = "任务级别")
|
||||
@TableField(exist = false)
|
||||
private Integer taskLevel;
|
||||
@ApiModelProperty(value = "责任岗位")
|
||||
@TableField(exist = false)
|
||||
private String responsibilityPost;
|
||||
@ApiModelProperty(value = "评分部门名称")
|
||||
@TableField(exist = false)
|
||||
private String ratingDepartmentName;
|
||||
@ApiModelProperty(value = "评分人姓名")
|
||||
@TableField(exist = false)
|
||||
private String ratingUserName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,73 @@
|
|||
package com.zcloud.safetyDutyList.persistence.dataobject.tasklist;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.jjb.saas.framework.repository.basedo.BaseDO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 任务执行记录数据对象
|
||||
*/
|
||||
@Data
|
||||
@TableName("safety_accountability_task_execution")
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TaskExecutionDO extends BaseDO {
|
||||
@ApiModelProperty(value = "任务执行UUID(业务主键)")
|
||||
private String taskExecutionId;
|
||||
@ApiModelProperty(value = "清单下发记录UUID(关联下发记录表)")
|
||||
private String taskIssueId;
|
||||
@ApiModelProperty(value = "任务模板UUID(关联任务详情模板表)")
|
||||
private String taskDetailId;
|
||||
@ApiModelProperty(value = "清单UUID(冗余)")
|
||||
private String taskListId;
|
||||
@ApiModelProperty(value = "任务状态:1-进行中 2-已完成 3-已关闭")
|
||||
private Integer taskStatus;
|
||||
@ApiModelProperty(value = "反馈状态:1-正常 2-异常")
|
||||
private Integer feedbackStatus;
|
||||
@ApiModelProperty(value = "任务评分")
|
||||
private BigDecimal taskRating;
|
||||
@ApiModelProperty(value = "评分时间")
|
||||
private LocalDateTime ratingTime;
|
||||
@ApiModelProperty(value = "评分部门ID")
|
||||
private Long ratingDepartmentId;
|
||||
@ApiModelProperty(value = "评分人ID")
|
||||
private Long ratingUserId;
|
||||
|
||||
@ApiModelProperty(value = "执行内容")
|
||||
@TableField(exist = false)
|
||||
private String executeContent;
|
||||
@ApiModelProperty(value = "反馈周期类型")
|
||||
@TableField(exist = false)
|
||||
private Integer feedbackCycleType;
|
||||
@ApiModelProperty(value = "任务分值")
|
||||
@TableField(exist = false)
|
||||
private BigDecimal taskScore;
|
||||
@ApiModelProperty(value = "清单名称")
|
||||
@TableField(exist = false)
|
||||
private String taskListName;
|
||||
@ApiModelProperty(value = "任务级别")
|
||||
@TableField(exist = false)
|
||||
private Integer taskLevel;
|
||||
@ApiModelProperty(value = "责任岗位")
|
||||
@TableField(exist = false)
|
||||
private String responsibilityPost;
|
||||
@ApiModelProperty(value = "评分部门名称")
|
||||
@TableField(exist = false)
|
||||
private String ratingDepartmentName;
|
||||
@ApiModelProperty(value = "评分人姓名")
|
||||
@TableField(exist = false)
|
||||
private String ratingUserName;
|
||||
@ApiModelProperty(value = "反馈次数")
|
||||
@TableField(exist = false)
|
||||
private Integer feedbackCount;
|
||||
@ApiModelProperty(value = "当前周期是否已反馈:0-否 1-是")
|
||||
@TableField(exist = false)
|
||||
private Integer currentPeriodFeedback;
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
package com.zcloud.safetyDutyList.persistence.dataobject.tasklist;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.jjb.saas.framework.repository.basedo.BaseDO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
|
@ -8,15 +7,11 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 安全责任清单数据对象
|
||||
* 安全责任清单数据对象(纯模板定义)
|
||||
* <p>
|
||||
* 对应数据库表safety_accountability_task_list,
|
||||
* 用于MyBatis-Plus操作清单数据的持久化对象。
|
||||
* 联表查询时通过@TableField(exist=false)映射关联表的虚拟字段。
|
||||
* 仅包含清单模板定义字段,执行相关字段已迁移至TaskListIssueDO。
|
||||
*/
|
||||
@Data
|
||||
@TableName("safety_accountability_task_list")
|
||||
|
|
@ -35,54 +30,10 @@ public class TaskListDO extends BaseDO {
|
|||
private Integer switchFlag;
|
||||
@ApiModelProperty(value = "状态:1-进行中 2-已完成 3-已关闭")
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "执行周期开始时间")
|
||||
private LocalDateTime periodStartTime;
|
||||
@ApiModelProperty(value = "执行周期结束时间")
|
||||
private LocalDateTime periodEndTime;
|
||||
@ApiModelProperty(value = "评分数")
|
||||
private BigDecimal ratingScore;
|
||||
@ApiModelProperty(value = "评分人ID")
|
||||
private Long ratingUserId;
|
||||
@ApiModelProperty(value = "评分部门ID")
|
||||
private Long ratingDepartmentId;
|
||||
@ApiModelProperty(value = "创建公司ID")
|
||||
private Long createCorpId;
|
||||
@ApiModelProperty(value = "创建部门ID")
|
||||
private Long createDepartmentId;
|
||||
@ApiModelProperty(value = "创建人ID")
|
||||
private Long createUserId;
|
||||
@ApiModelProperty(value = "下发状态:0-未下发 1-已下发")
|
||||
private Integer issueStatus;
|
||||
@ApiModelProperty(value = "下发时间")
|
||||
private LocalDateTime issueTime;
|
||||
@ApiModelProperty(value = "执行公司ID")
|
||||
private Long executeCorpId;
|
||||
@ApiModelProperty(value = "执行部门ID")
|
||||
private Long executeDepartmentId;
|
||||
@ApiModelProperty(value = "执行人员ID")
|
||||
private Long executeUserId;
|
||||
@ApiModelProperty(value = "关闭时间")
|
||||
private LocalDateTime closeTime;
|
||||
|
||||
@ApiModelProperty(value = "执行公司名称")
|
||||
@TableField(exist = false)
|
||||
private String executeCorpName;
|
||||
@ApiModelProperty(value = "执行部门名称")
|
||||
@TableField(exist = false)
|
||||
private String executeDepartmentName;
|
||||
@ApiModelProperty(value = "执行人员名称")
|
||||
@TableField(exist = false)
|
||||
private String executeUserName;
|
||||
@ApiModelProperty(value = "评分人姓名")
|
||||
@TableField(exist = false)
|
||||
private String ratingUserName;
|
||||
@ApiModelProperty(value = "评分部门名称")
|
||||
@TableField(exist = false)
|
||||
private String ratingDepartmentName;
|
||||
@ApiModelProperty(value = "任务数")
|
||||
@TableField(exist = false)
|
||||
private Integer taskCount;
|
||||
@ApiModelProperty(value = "反馈状态:1-正常 2-异常")
|
||||
@TableField(exist = false)
|
||||
private Integer feedbackStatus;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,84 @@
|
|||
package com.zcloud.safetyDutyList.persistence.dataobject.tasklist;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.jjb.saas.framework.repository.basedo.BaseDO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 清单下发记录数据对象
|
||||
*/
|
||||
@Data
|
||||
@TableName("safety_accountability_task_list_issue")
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TaskListIssueDO extends BaseDO {
|
||||
@ApiModelProperty(value = "下发记录UUID(业务主键)")
|
||||
private String taskIssueId;
|
||||
@ApiModelProperty(value = "清单UUID(关联清单模板表)")
|
||||
private String taskListId;
|
||||
@ApiModelProperty(value = "执行公司ID")
|
||||
private Long executeCorpId;
|
||||
@ApiModelProperty(value = "执行部门ID")
|
||||
private Long executeDepartmentId;
|
||||
@ApiModelProperty(value = "执行人员ID")
|
||||
private Long executeUserId;
|
||||
@ApiModelProperty(value = "下发状态:0-未下发 1-已下发")
|
||||
private Integer issueStatus;
|
||||
@ApiModelProperty(value = "下发时间")
|
||||
private LocalDateTime issueTime;
|
||||
@ApiModelProperty(value = "执行周期开始时间")
|
||||
private LocalDateTime periodStartTime;
|
||||
@ApiModelProperty(value = "执行周期结束时间")
|
||||
private LocalDateTime periodEndTime;
|
||||
@ApiModelProperty(value = "状态:1-进行中 2-已完成 3-已关闭")
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "关闭时间")
|
||||
private LocalDateTime closeTime;
|
||||
@ApiModelProperty(value = "评分数")
|
||||
private BigDecimal ratingScore;
|
||||
@ApiModelProperty(value = "评分人ID")
|
||||
private Long ratingUserId;
|
||||
@ApiModelProperty(value = "评分部门ID")
|
||||
private Long ratingDepartmentId;
|
||||
|
||||
@ApiModelProperty(value = "执行公司名称")
|
||||
@TableField(exist = false)
|
||||
private String executeCorpName;
|
||||
@ApiModelProperty(value = "执行部门名称")
|
||||
@TableField(exist = false)
|
||||
private String executeDepartmentName;
|
||||
@ApiModelProperty(value = "执行人员名称")
|
||||
@TableField(exist = false)
|
||||
private String executeUserName;
|
||||
@ApiModelProperty(value = "评分人姓名")
|
||||
@TableField(exist = false)
|
||||
private String ratingUserName;
|
||||
@ApiModelProperty(value = "评分部门名称")
|
||||
@TableField(exist = false)
|
||||
private String ratingDepartmentName;
|
||||
@ApiModelProperty(value = "清单名称")
|
||||
@TableField(exist = false)
|
||||
private String taskListName;
|
||||
@ApiModelProperty(value = "任务级别")
|
||||
@TableField(exist = false)
|
||||
private Integer taskLevel;
|
||||
@ApiModelProperty(value = "责任岗位")
|
||||
@TableField(exist = false)
|
||||
private String responsibilityPost;
|
||||
@ApiModelProperty(value = "任务数")
|
||||
@TableField(exist = false)
|
||||
private Integer taskCount;
|
||||
@ApiModelProperty(value = "反馈状态:1-正常 2-异常")
|
||||
@TableField(exist = false)
|
||||
private Integer feedbackStatus;
|
||||
@ApiModelProperty(value = "是否启用:0-关 1-开")
|
||||
@TableField(exist = false)
|
||||
private Integer switchFlag;
|
||||
}
|
||||
|
|
@ -22,5 +22,11 @@ public interface FeedbackMapper extends BaseMapper<FeedbackDO> {
|
|||
|
||||
List<FeedbackDO> listByTaskDetailId(String taskDetailId);
|
||||
|
||||
List<FeedbackDO> listByTaskExecutionId(String taskExecutionId);
|
||||
|
||||
List<FeedbackDO> listByTaskIssueId(String taskIssueId);
|
||||
|
||||
List<FeedbackDO> listByTaskExecutionIdAndPeriodFlag(String taskExecutionId, String feedbackPeriodFlag);
|
||||
|
||||
FeedbackDO getByFeedbackId(String feedbackId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
package com.zcloud.safetyDutyList.persistence.mapper.tasklist;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskExecutionDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface TaskExecutionMapper extends BaseMapper<TaskExecutionDO> {
|
||||
|
||||
IPage<TaskExecutionDO> listPage(IPage<TaskExecutionDO> iPage, Map<String, Object> params);
|
||||
|
||||
TaskExecutionDO getByTaskExecutionId(String taskExecutionId);
|
||||
|
||||
List<TaskExecutionDO> listByTaskIssueId(String taskIssueId);
|
||||
|
||||
List<TaskExecutionDO> listByTaskListId(String taskListId);
|
||||
|
||||
List<TaskExecutionDO> listByTaskDetailId(String taskDetailId);
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.zcloud.safetyDutyList.persistence.mapper.tasklist;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskListIssueDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface TaskListIssueMapper extends BaseMapper<TaskListIssueDO> {
|
||||
|
||||
IPage<TaskListIssueDO> listPage(IPage<TaskListIssueDO> iPage, Map<String, Object> params, String menuPath);
|
||||
|
||||
IPage<TaskListIssueDO> listPageByTaskListQry(IPage<TaskListIssueDO> iPage, Map<String, Object> params);
|
||||
|
||||
TaskListIssueDO getByTaskIssueId(String taskIssueId);
|
||||
|
||||
List<TaskListIssueDO> listByTaskListId(String taskListId);
|
||||
|
||||
List<TaskListIssueDO> listExpiredInProgress();
|
||||
|
||||
List<TaskListIssueDO> listIssuedWithPeriod();
|
||||
}
|
||||
|
|
@ -30,10 +30,6 @@ public interface TaskListMapper extends BaseMapper<TaskListDO> {
|
|||
|
||||
List<TaskListDO> list(Map<String, Object> params);
|
||||
|
||||
List<TaskListDO> listExpiredInProgress();
|
||||
|
||||
List<TaskListDO> listIssuedWithPeriod();
|
||||
|
||||
IPage<CorpStatisticsDO> corpStatistics(IPage<CorpStatisticsDO> iPage, Map<String, Object> params);
|
||||
|
||||
IPage<EvaluationListDO> evaluationList(IPage<EvaluationListDO> iPage, Map<String, Object> params);
|
||||
|
|
|
|||
|
|
@ -36,6 +36,21 @@ public class FeedbackRepositoryImpl extends BaseRepositoryImpl<FeedbackMapper, F
|
|||
return feedbackMapper.listByTaskDetailId(taskDetailId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FeedbackDO> listByTaskExecutionId(String taskExecutionId) {
|
||||
return feedbackMapper.listByTaskExecutionId(taskExecutionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FeedbackDO> listByTaskIssueId(String taskIssueId) {
|
||||
return feedbackMapper.listByTaskIssueId(taskIssueId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FeedbackDO> listByTaskExecutionIdAndPeriodFlag(String taskExecutionId, String feedbackPeriodFlag) {
|
||||
return feedbackMapper.listByTaskExecutionIdAndPeriodFlag(taskExecutionId, feedbackPeriodFlag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeedbackDO getByFeedbackId(String feedbackId) {
|
||||
return feedbackMapper.getByFeedbackId(feedbackId);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
package com.zcloud.safetyDutyList.persistence.repository.impl.tasklist;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jjb.saas.framework.repository.common.PageHelper;
|
||||
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
|
||||
import com.zcloud.gbscommon.utils.Query;
|
||||
import com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskExecutionDO;
|
||||
import com.zcloud.safetyDutyList.persistence.mapper.tasklist.TaskExecutionMapper;
|
||||
import com.zcloud.safetyDutyList.persistence.repository.tasklist.TaskExecutionRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TaskExecutionRepositoryImpl extends BaseRepositoryImpl<TaskExecutionMapper, TaskExecutionDO> implements TaskExecutionRepository {
|
||||
|
||||
private final TaskExecutionMapper taskExecutionMapper;
|
||||
|
||||
@Override
|
||||
public PageResponse<TaskExecutionDO> listPage(Map<String, Object> params) {
|
||||
IPage<TaskExecutionDO> iPage = new Query<TaskExecutionDO>().getPage(params);
|
||||
IPage<TaskExecutionDO> result = taskExecutionMapper.listPage(iPage, params);
|
||||
return PageHelper.pageToResponse(result, result.getRecords());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskExecutionDO getByTaskExecutionId(String taskExecutionId) {
|
||||
return taskExecutionMapper.getByTaskExecutionId(taskExecutionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskExecutionDO> listByTaskIssueId(String taskIssueId) {
|
||||
return taskExecutionMapper.listByTaskIssueId(taskIssueId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskExecutionDO> listByTaskListId(String taskListId) {
|
||||
return taskExecutionMapper.listByTaskListId(taskListId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskExecutionDO> listByTaskDetailId(String taskDetailId) {
|
||||
return taskExecutionMapper.listByTaskDetailId(taskDetailId);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package com.zcloud.safetyDutyList.persistence.repository.impl.tasklist;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jjb.saas.framework.repository.common.PageHelper;
|
||||
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
|
||||
import com.zcloud.gbscommon.utils.Query;
|
||||
import com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskListIssueDO;
|
||||
import com.zcloud.safetyDutyList.persistence.mapper.tasklist.TaskListIssueMapper;
|
||||
import com.zcloud.safetyDutyList.persistence.repository.tasklist.TaskListIssueRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TaskListIssueRepositoryImpl extends BaseRepositoryImpl<TaskListIssueMapper, TaskListIssueDO> implements TaskListIssueRepository {
|
||||
|
||||
private final TaskListIssueMapper taskListIssueMapper;
|
||||
|
||||
@Override
|
||||
public PageResponse<TaskListIssueDO> listPage(Map<String, Object> params, String menuPath) {
|
||||
IPage<TaskListIssueDO> iPage = new Query<TaskListIssueDO>().getPage(params);
|
||||
IPage<TaskListIssueDO> result = taskListIssueMapper.listPage(iPage, params, menuPath);
|
||||
return PageHelper.pageToResponse(result, result.getRecords());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResponse<TaskListIssueDO> listPage(Map<String, Object> params) {
|
||||
IPage<TaskListIssueDO> iPage = new Query<TaskListIssueDO>().getPage(params);
|
||||
IPage<TaskListIssueDO> result = taskListIssueMapper.listPage(iPage, params, "");
|
||||
return PageHelper.pageToResponse(result, result.getRecords());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskListIssueDO getByTaskIssueId(String taskIssueId) {
|
||||
return taskListIssueMapper.getByTaskIssueId(taskIssueId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskListIssueDO> listByTaskListId(String taskListId) {
|
||||
return taskListIssueMapper.listByTaskListId(taskListId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskListIssueDO> listExpiredInProgress() {
|
||||
return taskListIssueMapper.listExpiredInProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskListIssueDO> listIssuedWithPeriod() {
|
||||
return taskListIssueMapper.listIssuedWithPeriod();
|
||||
}
|
||||
}
|
||||
|
|
@ -69,16 +69,6 @@ public class TaskListRepositoryImpl extends BaseRepositoryImpl<TaskListMapper, T
|
|||
return taskListMapper.list(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskListDO> listExpiredInProgress() {
|
||||
return taskListMapper.listExpiredInProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskListDO> listIssuedWithPeriod() {
|
||||
return taskListMapper.listIssuedWithPeriod();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResponse<CorpStatisticsDO> corpStatistics(Map<String, Object> params) {
|
||||
IPage<CorpStatisticsDO> iPage = new Query<CorpStatisticsDO>().getPage(params);
|
||||
|
|
|
|||
|
|
@ -20,5 +20,11 @@ public interface FeedbackRepository extends BaseRepository<FeedbackDO> {
|
|||
|
||||
List<FeedbackDO> listByTaskDetailId(String taskDetailId);
|
||||
|
||||
List<FeedbackDO> listByTaskExecutionId(String taskExecutionId);
|
||||
|
||||
List<FeedbackDO> listByTaskIssueId(String taskIssueId);
|
||||
|
||||
List<FeedbackDO> listByTaskExecutionIdAndPeriodFlag(String taskExecutionId, String feedbackPeriodFlag);
|
||||
|
||||
FeedbackDO getByFeedbackId(String feedbackId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.zcloud.safetyDutyList.persistence.repository.tasklist;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.jjb.saas.framework.repository.repo.BaseRepository;
|
||||
import com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskExecutionDO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface TaskExecutionRepository extends BaseRepository<TaskExecutionDO> {
|
||||
|
||||
PageResponse<TaskExecutionDO> listPage(Map<String, Object> params);
|
||||
|
||||
TaskExecutionDO getByTaskExecutionId(String taskExecutionId);
|
||||
|
||||
List<TaskExecutionDO> listByTaskIssueId(String taskIssueId);
|
||||
|
||||
List<TaskExecutionDO> listByTaskListId(String taskListId);
|
||||
|
||||
List<TaskExecutionDO> listByTaskDetailId(String taskDetailId);
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.zcloud.safetyDutyList.persistence.repository.tasklist;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.jjb.saas.framework.repository.repo.BaseRepository;
|
||||
import com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskListIssueDO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface TaskListIssueRepository extends BaseRepository<TaskListIssueDO> {
|
||||
|
||||
PageResponse<TaskListIssueDO> listPage(Map<String, Object> params, String menuPath);
|
||||
|
||||
PageResponse<TaskListIssueDO> listPage(Map<String, Object> params);
|
||||
|
||||
TaskListIssueDO getByTaskIssueId(String taskIssueId);
|
||||
|
||||
List<TaskListIssueDO> listByTaskListId(String taskListId);
|
||||
|
||||
List<TaskListIssueDO> listExpiredInProgress();
|
||||
|
||||
List<TaskListIssueDO> listIssuedWithPeriod();
|
||||
}
|
||||
|
|
@ -30,10 +30,6 @@ public interface TaskListRepository extends BaseRepository<TaskListDO> {
|
|||
|
||||
List<TaskListDO> list(Map<String, Object> params);
|
||||
|
||||
List<TaskListDO> listExpiredInProgress();
|
||||
|
||||
List<TaskListDO> listIssuedWithPeriod();
|
||||
|
||||
PageResponse<CorpStatisticsDO> corpStatistics(Map<String, Object> params);
|
||||
|
||||
PageResponse<EvaluationListDO> evaluationList(Map<String, Object> params);
|
||||
|
|
|
|||
|
|
@ -19,14 +19,8 @@
|
|||
LEFT JOIN corp_info fb_corp ON f.feedback_corp_id = fb_corp.id
|
||||
<where>
|
||||
f.delete_enum = 'FALSE'
|
||||
<if test="params.feedbackCorpId != null">
|
||||
AND f.feedback_corp_id = #{params.feedbackCorpId}
|
||||
</if>
|
||||
<if test="params.taskListId != null and params.taskListId != ''">
|
||||
AND f.task_list_id = #{params.taskListId}
|
||||
</if>
|
||||
<if test="params.taskDetailId != null and params.taskDetailId != ''">
|
||||
AND f.task_detail_id = #{params.taskDetailId}
|
||||
<if test="params.taskExecutionId != null and params.taskExecutionId != ''">
|
||||
AND f.task_execution_id = #{params.taskExecutionId}
|
||||
</if>
|
||||
<if test="params.feedbackPeriodFlag != null and params.feedbackPeriodFlag != ''">
|
||||
AND f.feedback_period_flag = #{params.feedbackPeriodFlag}
|
||||
|
|
@ -58,6 +52,48 @@
|
|||
ORDER BY f.feedback_time DESC
|
||||
</select>
|
||||
|
||||
<select id="listByTaskIssueId" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.FeedbackDO">
|
||||
SELECT f.*,
|
||||
td.execute_content AS executeContent,
|
||||
tl.task_list_name AS taskListName,
|
||||
fb_user.name AS feedbackUserName,
|
||||
fb_dept.name AS feedbackDepartmentName,
|
||||
fb_corp.corp_name AS feedbackCorpName
|
||||
FROM safety_accountability_feedback f
|
||||
LEFT JOIN safety_accountability_task_detail td ON f.task_detail_id = td.task_detail_id AND td.delete_enum = 'FALSE'
|
||||
LEFT JOIN safety_accountability_task_list tl ON f.task_list_id = tl.task_list_id AND tl.delete_enum = 'FALSE'
|
||||
LEFT JOIN user fb_user ON f.feedback_user_id = fb_user.id
|
||||
LEFT JOIN department fb_dept ON f.feedback_department_id = fb_dept.id
|
||||
LEFT JOIN corp_info fb_corp ON f.feedback_corp_id = fb_corp.id
|
||||
WHERE f.task_issue_id = #{taskIssueId} AND f.delete_enum = 'FALSE'
|
||||
ORDER BY f.feedback_time DESC
|
||||
</select>
|
||||
|
||||
<select id="listByTaskExecutionId" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.FeedbackDO">
|
||||
SELECT f.*,
|
||||
td.execute_content AS executeContent,
|
||||
tl.task_list_name AS taskListName,
|
||||
fb_user.name AS feedbackUserName,
|
||||
fb_dept.name AS feedbackDepartmentName,
|
||||
fb_corp.corp_name AS feedbackCorpName
|
||||
FROM safety_accountability_feedback f
|
||||
LEFT JOIN safety_accountability_task_detail td ON f.task_detail_id = td.task_detail_id AND td.delete_enum = 'FALSE'
|
||||
LEFT JOIN safety_accountability_task_list tl ON f.task_list_id = tl.task_list_id AND tl.delete_enum = 'FALSE'
|
||||
LEFT JOIN user fb_user ON f.feedback_user_id = fb_user.id
|
||||
LEFT JOIN department fb_dept ON f.feedback_department_id = fb_dept.id
|
||||
LEFT JOIN corp_info fb_corp ON f.feedback_corp_id = fb_corp.id
|
||||
WHERE f.task_execution_id = #{taskExecutionId} AND f.delete_enum = 'FALSE'
|
||||
ORDER BY f.feedback_time DESC
|
||||
</select>
|
||||
|
||||
<select id="listByTaskExecutionIdAndPeriodFlag" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.FeedbackDO">
|
||||
SELECT * FROM safety_accountability_feedback
|
||||
WHERE task_execution_id = #{taskExecutionId}
|
||||
AND feedback_period_flag = #{feedbackPeriodFlag}
|
||||
AND delete_enum = 'FALSE'
|
||||
ORDER BY feedback_time DESC
|
||||
</select>
|
||||
|
||||
<select id="getByFeedbackId" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.FeedbackDO">
|
||||
SELECT f.*,
|
||||
td.execute_content AS executeContent,
|
||||
|
|
|
|||
|
|
@ -8,23 +8,9 @@
|
|||
SELECT td.*,
|
||||
tl.task_list_name AS taskListName,
|
||||
tl.task_level AS taskLevel,
|
||||
tl.responsibility_post AS responsibilityPost,
|
||||
rating_dept.name AS ratingDepartmentName,
|
||||
rating_user.name AS ratingUserName,
|
||||
IFNULL(fb_agg.feedback_count, 0) AS feedbackCount,
|
||||
fb_agg.current_period_feedback AS currentPeriodFeedback
|
||||
tl.responsibility_post AS responsibilityPost
|
||||
FROM safety_accountability_task_detail td
|
||||
LEFT JOIN safety_accountability_task_list tl ON td.task_list_id = tl.task_list_id AND tl.delete_enum = 'FALSE'
|
||||
LEFT JOIN department rating_dept ON td.rating_department_id = rating_dept.id
|
||||
LEFT JOIN user rating_user ON td.rating_user_id = rating_user.id
|
||||
LEFT JOIN (
|
||||
SELECT task_detail_id,
|
||||
COUNT(*) AS feedback_count,
|
||||
MAX(CASE WHEN feedback_period_flag = DATE_FORMAT(NOW(), '%Y-%m') THEN 1 ELSE 0 END) AS current_period_feedback
|
||||
FROM safety_accountability_feedback
|
||||
WHERE delete_enum = 'FALSE'
|
||||
GROUP BY task_detail_id
|
||||
) fb_agg ON td.task_detail_id = fb_agg.task_detail_id
|
||||
<where>
|
||||
td.delete_enum = 'FALSE'
|
||||
<if test="params.taskListId != null and params.taskListId != ''">
|
||||
|
|
@ -33,19 +19,9 @@
|
|||
<if test="params.taskContent != null and params.taskContent != ''">
|
||||
AND td.execute_content LIKE CONCAT('%', #{params.taskContent}, '%')
|
||||
</if>
|
||||
<if test="params.feedbackCycleType != null and params.feedbackCycleType != ''">
|
||||
<if test="params.feedbackCycleType != null">
|
||||
AND td.feedback_cycle_type = #{params.feedbackCycleType}
|
||||
</if>
|
||||
<if test="params.feedbackStatus != null and params.feedbackStatus != ''">
|
||||
AND td.feedback_status >= #{params.feedbackStatus}
|
||||
</if>
|
||||
<if test="params.taskStatus != null and params.taskStatus != ''">
|
||||
AND td.task_status = #{params.taskStatus}
|
||||
</if>
|
||||
<if test="params.taskPeriodStart != null and params.taskPeriodStart != '' and params.taskPeriodEnd != null and params.taskPeriodEnd != ''">
|
||||
AND tl.period_start_time <= #{params.taskPeriodEnd}
|
||||
AND tl.period_end_time >= #{params.taskPeriodStart}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY td.id ASC
|
||||
</select>
|
||||
|
|
@ -60,13 +36,9 @@
|
|||
SELECT td.*,
|
||||
tl.task_list_name AS taskListName,
|
||||
tl.task_level AS taskLevel,
|
||||
tl.responsibility_post AS responsibilityPost,
|
||||
rating_dept.name AS ratingDepartmentName,
|
||||
rating_user.name AS ratingUserName
|
||||
tl.responsibility_post AS responsibilityPost
|
||||
FROM safety_accountability_task_detail td
|
||||
LEFT JOIN safety_accountability_task_list tl ON td.task_list_id = tl.task_list_id AND tl.delete_enum = 'FALSE'
|
||||
LEFT JOIN department rating_dept ON td.rating_department_id = rating_dept.id
|
||||
LEFT JOIN user rating_user ON td.rating_user_id = rating_user.id
|
||||
WHERE td.task_detail_id = #{taskDetailId} AND td.delete_enum = 'FALSE'
|
||||
</select>
|
||||
|
||||
|
|
@ -74,9 +46,4 @@
|
|||
DELETE FROM safety_accountability_task_detail WHERE task_list_id = #{taskListId}
|
||||
</delete>
|
||||
|
||||
<select id="listInProgress" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskDetailDO">
|
||||
SELECT * FROM safety_accountability_task_detail
|
||||
WHERE task_status = 1 AND delete_enum = 'FALSE'
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,107 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.zcloud.safetyDutyList.persistence.mapper.tasklist.TaskExecutionMapper">
|
||||
|
||||
<select id="listPage" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskExecutionDO">
|
||||
SELECT te.*,
|
||||
td.execute_content AS executeContent,
|
||||
td.feedback_cycle_type AS feedbackCycleType,
|
||||
td.task_score AS taskScore,
|
||||
tl.task_list_name AS taskListName,
|
||||
tl.task_level AS taskLevel,
|
||||
tl.responsibility_post AS responsibilityPost,
|
||||
rating_dept.name AS ratingDepartmentName,
|
||||
rating_user.name AS ratingUserName,
|
||||
IFNULL(fb_agg.feedback_count, 0) AS feedbackCount,
|
||||
IFNULL(fb_agg.current_period_feedback, 0) AS currentPeriodFeedback
|
||||
FROM safety_accountability_task_execution te
|
||||
LEFT JOIN safety_accountability_task_detail td ON te.task_detail_id = td.task_detail_id AND td.delete_enum = 'FALSE'
|
||||
LEFT JOIN safety_accountability_task_list tl ON te.task_list_id = tl.task_list_id AND tl.delete_enum = 'FALSE'
|
||||
LEFT JOIN department rating_dept ON te.rating_department_id = rating_dept.id
|
||||
LEFT JOIN user rating_user ON te.rating_user_id = rating_user.id
|
||||
LEFT JOIN (
|
||||
SELECT task_execution_id,
|
||||
COUNT(*) AS feedback_count,
|
||||
MAX(CASE WHEN feedback_period_flag = DATE_FORMAT(NOW(), '%Y-%m') THEN 1 ELSE 0 END) AS current_period_feedback
|
||||
FROM safety_accountability_feedback
|
||||
WHERE delete_enum = 'FALSE'
|
||||
GROUP BY task_execution_id
|
||||
) fb_agg ON te.task_execution_id = fb_agg.task_execution_id
|
||||
<where>
|
||||
te.delete_enum = 'FALSE'
|
||||
<if test="params.taskIssueId != null and params.taskIssueId != ''">
|
||||
AND te.task_issue_id = #{params.taskIssueId}
|
||||
</if>
|
||||
<if test="params.taskListId != null and params.taskListId != ''">
|
||||
AND te.task_list_id = #{params.taskListId}
|
||||
</if>
|
||||
<if test="params.taskContent != null and params.taskContent != ''">
|
||||
AND td.execute_content LIKE CONCAT('%', #{params.taskContent}, '%')
|
||||
</if>
|
||||
<if test="params.feedbackCycleType != null and params.feedbackCycleType != ''">
|
||||
AND td.feedback_cycle_type = #{params.feedbackCycleType}
|
||||
</if>
|
||||
<if test="params.feedbackStatus != null and params.feedbackStatus != ''">
|
||||
AND te.feedback_status = #{params.feedbackStatus}
|
||||
</if>
|
||||
<if test="params.taskStatus != null and params.taskStatus != ''">
|
||||
AND te.task_status = #{params.taskStatus}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY te.id ASC
|
||||
</select>
|
||||
|
||||
<select id="getByTaskExecutionId" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskExecutionDO">
|
||||
SELECT te.*,
|
||||
td.execute_content AS executeContent,
|
||||
td.feedback_cycle_type AS feedbackCycleType,
|
||||
td.task_score AS taskScore,
|
||||
tl.task_list_name AS taskListName,
|
||||
tl.task_level AS taskLevel,
|
||||
tl.responsibility_post AS responsibilityPost,
|
||||
rating_dept.name AS ratingDepartmentName,
|
||||
rating_user.name AS ratingUserName,
|
||||
IFNULL(fb_agg.feedback_count, 0) AS feedbackCount,
|
||||
IFNULL(fb_agg.current_period_feedback, 0) AS currentPeriodFeedback
|
||||
FROM safety_accountability_task_execution te
|
||||
LEFT JOIN safety_accountability_task_detail td ON te.task_detail_id = td.task_detail_id AND td.delete_enum = 'FALSE'
|
||||
LEFT JOIN safety_accountability_task_list tl ON te.task_list_id = tl.task_list_id AND tl.delete_enum = 'FALSE'
|
||||
LEFT JOIN department rating_dept ON te.rating_department_id = rating_dept.id
|
||||
LEFT JOIN user rating_user ON te.rating_user_id = rating_user.id
|
||||
LEFT JOIN (
|
||||
SELECT task_execution_id,
|
||||
COUNT(*) AS feedback_count,
|
||||
MAX(CASE WHEN feedback_period_flag = DATE_FORMAT(NOW(), '%Y-%m') THEN 1 ELSE 0 END) AS current_period_feedback
|
||||
FROM safety_accountability_feedback
|
||||
WHERE delete_enum = 'FALSE'
|
||||
GROUP BY task_execution_id
|
||||
) fb_agg ON te.task_execution_id = fb_agg.task_execution_id
|
||||
WHERE te.task_execution_id = #{taskExecutionId} AND te.delete_enum = 'FALSE'
|
||||
</select>
|
||||
|
||||
<select id="listByTaskIssueId" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskExecutionDO">
|
||||
SELECT te.*,
|
||||
td.execute_content AS executeContent,
|
||||
td.feedback_cycle_type AS feedbackCycleType,
|
||||
td.task_score AS taskScore
|
||||
FROM safety_accountability_task_execution te
|
||||
LEFT JOIN safety_accountability_task_detail td ON te.task_detail_id = td.task_detail_id AND td.delete_enum = 'FALSE'
|
||||
WHERE te.task_issue_id = #{taskIssueId} AND te.delete_enum = 'FALSE'
|
||||
ORDER BY te.id ASC
|
||||
</select>
|
||||
|
||||
<select id="listByTaskListId" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskExecutionDO">
|
||||
SELECT * FROM safety_accountability_task_execution
|
||||
WHERE task_list_id = #{taskListId} AND delete_enum = 'FALSE'
|
||||
ORDER BY id ASC
|
||||
</select>
|
||||
|
||||
<select id="listByTaskDetailId" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskExecutionDO">
|
||||
SELECT * FROM safety_accountability_task_execution
|
||||
WHERE task_detail_id = #{taskDetailId} AND delete_enum = 'FALSE'
|
||||
ORDER BY id ASC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,179 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.zcloud.safetyDutyList.persistence.mapper.tasklist.TaskListIssueMapper">
|
||||
|
||||
<select id="listPage" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskListIssueDO">
|
||||
SELECT tli.*,
|
||||
tl.task_list_name AS taskListName,
|
||||
tl.task_level AS taskLevel,
|
||||
tl.responsibility_post AS responsibilityPost,
|
||||
exec_corp.corp_name AS executeCorpName,
|
||||
exec_dept.name AS executeDepartmentName,
|
||||
exec_user.name AS executeUserName,
|
||||
rating_dept.name AS ratingDepartmentName,
|
||||
rating_user.name AS ratingUserName,
|
||||
IFNULL(te_agg.task_count, 0) AS taskCount,
|
||||
CASE WHEN te_agg.has_abnormal > 0 THEN 2 ELSE 1 END AS feedbackStatus,
|
||||
tl.switch_flag AS switchFlag
|
||||
FROM safety_accountability_task_list_issue tli
|
||||
LEFT JOIN safety_accountability_task_list tl ON tli.task_list_id = tl.task_list_id AND tl.delete_enum = 'FALSE'
|
||||
LEFT JOIN corp_info exec_corp ON tli.execute_corp_id = exec_corp.id
|
||||
LEFT JOIN department exec_dept ON tli.execute_department_id = exec_dept.id
|
||||
LEFT JOIN user exec_user ON tli.execute_user_id = exec_user.id
|
||||
LEFT JOIN department rating_dept ON tli.rating_department_id = rating_dept.id
|
||||
LEFT JOIN user rating_user ON tli.rating_user_id = rating_user.id
|
||||
LEFT JOIN (
|
||||
SELECT task_issue_id,
|
||||
COUNT(*) AS task_count,
|
||||
SUM(CASE WHEN feedback_status = 2 THEN 1 ELSE 0 END) AS has_abnormal
|
||||
FROM safety_accountability_task_execution
|
||||
WHERE delete_enum = 'FALSE'
|
||||
GROUP BY task_issue_id
|
||||
) te_agg ON tli.task_issue_id = te_agg.task_issue_id
|
||||
<where>
|
||||
tli.delete_enum = 'FALSE'
|
||||
<if test="params.taskListId != null and params.taskListId != ''">
|
||||
AND tli.task_list_id = #{params.taskListId}
|
||||
</if>
|
||||
<if test="params.executeCorpId != null">
|
||||
AND tli.execute_corp_id = #{params.executeCorpId}
|
||||
</if>
|
||||
<if test="params.executeUserId != null">
|
||||
AND tli.execute_user_id = #{params.executeUserId}
|
||||
</if>
|
||||
<if test="params.taskListName != null and params.taskListName != ''">
|
||||
AND tl.task_list_name LIKE CONCAT('%', #{params.taskListName}, '%')
|
||||
</if>
|
||||
<if test="params.taskLevel != null">
|
||||
AND tl.task_level = #{params.taskLevel}
|
||||
</if>
|
||||
<if test="params.issueStatus != null">
|
||||
AND tli.issue_status = #{params.issueStatus}
|
||||
</if>
|
||||
<if test="params.status != null">
|
||||
AND tli.status = #{params.status}
|
||||
</if>
|
||||
<if test="params.scoreStatus != null">
|
||||
<!-- 状态必须是 2 已完成 或 3 已关闭 -->
|
||||
AND tli.status IN (2, 3)
|
||||
<!-- scoreStatus = 0:分数为空 -->
|
||||
<if test="params.scoreStatus == 0">
|
||||
AND tli.rating_score IS NULL
|
||||
</if>
|
||||
<!-- scoreStatus = 1:分数不为空 -->
|
||||
<if test="params.scoreStatus == 1">
|
||||
AND tli.rating_score IS NOT NULL
|
||||
</if>
|
||||
</if>
|
||||
<if test="params.feedbackStatus != null and params.feedbackStatus == 2">
|
||||
AND te_agg.has_abnormal > 0
|
||||
</if>
|
||||
<if test="params.feedbackStatus != null and params.feedbackStatus == 1">
|
||||
AND (te_agg.has_abnormal = 0 OR te_agg.has_abnormal IS NULL)
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY tli.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="listPageByTaskListQry" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskListIssueDO">
|
||||
SELECT tli.*,
|
||||
tl.task_list_name AS taskListName,
|
||||
tl.task_level AS taskLevel,
|
||||
tl.responsibility_post AS responsibilityPost,
|
||||
tl.switch_flag AS switchFlag,
|
||||
exec_dept.name AS executeDepartmentName,
|
||||
exec_user.name AS executeUserName,
|
||||
rating_dept.name AS ratingDepartmentName,
|
||||
rating_user.name AS ratingUserName,
|
||||
IFNULL(te_agg.task_count, 0) AS taskCount,
|
||||
CASE WHEN te_agg.has_abnormal > 0 THEN 2 ELSE 1 END AS feedbackStatus,
|
||||
tl.switch_flag AS switchFlag
|
||||
FROM safety_accountability_task_list_issue tli
|
||||
LEFT JOIN safety_accountability_task_list tl ON tli.task_list_id = tl.task_list_id AND tl.delete_enum = 'FALSE'
|
||||
LEFT JOIN department exec_dept ON tli.execute_department_id = exec_dept.id
|
||||
LEFT JOIN user exec_user ON tli.execute_user_id = exec_user.id
|
||||
LEFT JOIN department rating_dept ON tli.rating_department_id = rating_dept.id
|
||||
LEFT JOIN user rating_user ON tli.rating_user_id = rating_user.id
|
||||
LEFT JOIN (
|
||||
SELECT task_issue_id,
|
||||
COUNT(*) AS task_count,
|
||||
SUM(CASE WHEN feedback_status = 2 THEN 1 ELSE 0 END) AS has_abnormal
|
||||
FROM safety_accountability_task_execution
|
||||
WHERE delete_enum = 'FALSE'
|
||||
GROUP BY task_issue_id
|
||||
) te_agg ON tli.task_issue_id = te_agg.task_issue_id
|
||||
<where>
|
||||
tli.issue_status = 1 AND tli.delete_enum = 'FALSE'
|
||||
<if test="params.executeCorpId != null">
|
||||
AND tli.execute_corp_id = #{params.executeCorpId}
|
||||
</if>
|
||||
<if test="params.taskListName != null and params.taskListName != ''">
|
||||
AND tl.task_list_name LIKE CONCAT('%', #{params.taskListName}, '%')
|
||||
</if>
|
||||
<if test="params.taskLevel != null">
|
||||
AND tl.task_level = #{params.taskLevel}
|
||||
</if>
|
||||
<if test="params.switchFlag != null">
|
||||
AND tl.switch_flag = #{params.switchFlag}
|
||||
</if>
|
||||
<if test="params.feedbackStatus != null and params.feedbackStatus == 2">
|
||||
AND te_agg.has_abnormal > 0
|
||||
</if>
|
||||
<if test="params.feedbackStatus != null and params.feedbackStatus == 1">
|
||||
AND (te_agg.has_abnormal = 0 OR te_agg.has_abnormal IS NULL)
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY tli.issue_time DESC
|
||||
</select>
|
||||
|
||||
<select id="getByTaskIssueId" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskListIssueDO">
|
||||
SELECT tli.*,
|
||||
tl.task_list_name AS taskListName,
|
||||
tl.task_level AS taskLevel,
|
||||
tl.responsibility_post AS responsibilityPost,
|
||||
exec_corp.corp_name AS executeCorpName,
|
||||
exec_dept.name AS executeDepartmentName,
|
||||
exec_user.name AS executeUserName,
|
||||
rating_dept.name AS ratingDepartmentName,
|
||||
rating_user.name AS ratingUserName,
|
||||
IFNULL(te_agg.task_count, 0) AS taskCount,
|
||||
CASE WHEN te_agg.has_abnormal > 0 THEN 2 ELSE 1 END AS feedbackStatus,
|
||||
tl.switch_flag AS switchFlag
|
||||
FROM safety_accountability_task_list_issue tli
|
||||
LEFT JOIN safety_accountability_task_list tl ON tli.task_list_id = tl.task_list_id AND tl.delete_enum = 'FALSE'
|
||||
LEFT JOIN corp_info exec_corp ON tli.execute_corp_id = exec_corp.id
|
||||
LEFT JOIN department exec_dept ON tli.execute_department_id = exec_dept.id
|
||||
LEFT JOIN user exec_user ON tli.execute_user_id = exec_user.id
|
||||
LEFT JOIN department rating_dept ON tli.rating_department_id = rating_dept.id
|
||||
LEFT JOIN user rating_user ON tli.rating_user_id = rating_user.id
|
||||
LEFT JOIN (
|
||||
SELECT task_issue_id,
|
||||
COUNT(*) AS task_count,
|
||||
SUM(CASE WHEN feedback_status = 2 THEN 1 ELSE 0 END) AS has_abnormal
|
||||
FROM safety_accountability_task_execution
|
||||
WHERE delete_enum = 'FALSE'
|
||||
GROUP BY task_issue_id
|
||||
) te_agg ON tli.task_issue_id = te_agg.task_issue_id
|
||||
WHERE tli.task_issue_id = #{taskIssueId} AND tli.delete_enum = 'FALSE'
|
||||
</select>
|
||||
|
||||
<select id="listByTaskListId" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskListIssueDO">
|
||||
SELECT * FROM safety_accountability_task_list_issue
|
||||
WHERE task_list_id = #{taskListId} AND delete_enum = 'FALSE'
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="listExpiredInProgress" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskListIssueDO">
|
||||
SELECT * FROM safety_accountability_task_list_issue
|
||||
WHERE status = 1 AND issue_status = 1 AND (period_end_time IS NOT NULL AND period_end_time < NOW()) AND delete_enum = 'FALSE'
|
||||
</select>
|
||||
|
||||
<select id="listIssuedWithPeriod" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskListIssueDO">
|
||||
SELECT * FROM safety_accountability_task_list_issue
|
||||
WHERE issue_status = 1 AND period_start_time IS NOT NULL AND period_end_time IS NOT NULL
|
||||
AND period_end_time > DATE_SUB(NOW(), INTERVAL 1 MONTH) AND delete_enum = 'FALSE'
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -5,39 +5,13 @@
|
|||
<mapper namespace="com.zcloud.safetyDutyList.persistence.mapper.tasklist.TaskListMapper">
|
||||
|
||||
<select id="listPage" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskListDO">
|
||||
SELECT tl.*,
|
||||
exec_corp.corp_name AS executeCorpName,
|
||||
exec_dept.name AS executeDepartmentName,
|
||||
exec_user.name AS executeUserName,
|
||||
rating_dept.name AS ratingDepartmentName,
|
||||
rating_user.name AS ratingUserName,
|
||||
IFNULL(td_agg.task_count, 0) AS taskCount,
|
||||
CASE WHEN td_agg.has_abnormal > 0 THEN 2 ELSE 1 END AS feedbackStatus
|
||||
SELECT tl.*
|
||||
FROM safety_accountability_task_list tl
|
||||
LEFT JOIN corp_info exec_corp ON tl.execute_corp_id = exec_corp.id
|
||||
LEFT JOIN department exec_dept ON tl.execute_department_id = exec_dept.id
|
||||
LEFT JOIN user exec_user ON tl.execute_user_id = exec_user.id
|
||||
LEFT JOIN department rating_dept ON tl.rating_department_id = rating_dept.id
|
||||
LEFT JOIN user rating_user ON tl.rating_user_id = rating_user.id
|
||||
LEFT JOIN (
|
||||
SELECT task_list_id,
|
||||
COUNT(*) AS task_count,
|
||||
SUM(CASE WHEN feedback_status = 2 THEN 1 ELSE 0 END) AS has_abnormal
|
||||
FROM safety_accountability_task_detail
|
||||
WHERE delete_enum = 'FALSE'
|
||||
GROUP BY task_list_id
|
||||
) td_agg ON tl.task_list_id = td_agg.task_list_id
|
||||
<where>
|
||||
tl.delete_enum = 'FALSE'
|
||||
<if test="params.createCorpId != null">
|
||||
AND tl.create_corp_id = #{params.createCorpId}
|
||||
</if>
|
||||
<if test="params.executeCorpId != null">
|
||||
AND tl.execute_corp_id = #{params.executeCorpId}
|
||||
</if>
|
||||
<if test="params.executeUserId != null">
|
||||
AND tl.execute_user_id = #{params.executeUserId}
|
||||
</if>
|
||||
<if test="params.taskListName != null and params.taskListName != ''">
|
||||
AND tl.task_list_name LIKE CONCAT('%', #{params.taskListName}, '%')
|
||||
</if>
|
||||
|
|
@ -47,91 +21,28 @@
|
|||
<if test="params.switchFlag != null">
|
||||
AND tl.switch_flag = #{params.switchFlag}
|
||||
</if>
|
||||
<if test="params.feedbackStatus != null and params.feedbackStatus == 2">
|
||||
AND td_agg.has_abnormal > 0
|
||||
</if>
|
||||
<if test="params.feedbackStatus != null and params.feedbackStatus == 1">
|
||||
AND (td_agg.has_abnormal = 0 OR td_agg.has_abnormal IS NULL)
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY tl.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="getInfoById" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskListDO">
|
||||
SELECT tl.*,
|
||||
exec_dept.name AS executeDepartmentName,
|
||||
exec_user.name AS executeUserName,
|
||||
rating_dept.name AS ratingDepartmentName,
|
||||
rating_user.name AS ratingUserName,
|
||||
td_agg.task_count AS taskCount,
|
||||
CASE WHEN td_agg.has_abnormal > 0 THEN 2 ELSE 1 END AS feedbackStatus
|
||||
FROM safety_accountability_task_list tl
|
||||
LEFT JOIN department exec_dept ON tl.execute_department_id = exec_dept.id
|
||||
LEFT JOIN user exec_user ON tl.execute_user_id = exec_user.id
|
||||
LEFT JOIN department rating_dept ON tl.rating_department_id = rating_dept.id
|
||||
LEFT JOIN user rating_user ON tl.rating_user_id = rating_user.id
|
||||
LEFT JOIN (
|
||||
SELECT task_list_id,
|
||||
COUNT(*) AS task_count,
|
||||
SUM(CASE WHEN feedback_status = 2 THEN 1 ELSE 0 END) AS has_abnormal
|
||||
FROM safety_accountability_task_detail
|
||||
WHERE delete_enum = 'FALSE'
|
||||
GROUP BY task_list_id
|
||||
) td_agg ON tl.task_list_id = td_agg.task_list_id
|
||||
WHERE tl.id = #{id} and tl.delete_enum = 'FALSE'
|
||||
SELECT * FROM safety_accountability_task_list
|
||||
WHERE id = #{id} AND delete_enum = 'FALSE'
|
||||
</select>
|
||||
|
||||
<select id="getByTaskListId" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskListDO">
|
||||
SELECT tl.*,
|
||||
exec_dept.name AS executeDepartmentName,
|
||||
exec_user.name AS executeUserName,
|
||||
rating_dept.name AS ratingDepartmentName,
|
||||
rating_user.name AS ratingUserName,
|
||||
td_agg.task_count AS taskCount,
|
||||
CASE WHEN td_agg.has_abnormal > 0 THEN 2 ELSE 1 END AS feedbackStatus
|
||||
FROM safety_accountability_task_list tl
|
||||
LEFT JOIN department exec_dept ON tl.execute_department_id = exec_dept.id
|
||||
LEFT JOIN user exec_user ON tl.execute_user_id = exec_user.id
|
||||
LEFT JOIN department rating_dept ON tl.rating_department_id = rating_dept.id
|
||||
LEFT JOIN user rating_user ON tl.rating_user_id = rating_user.id
|
||||
LEFT JOIN (
|
||||
SELECT task_list_id,
|
||||
COUNT(*) AS task_count,
|
||||
SUM(CASE WHEN feedback_status = 2 THEN 1 ELSE 0 END) AS has_abnormal
|
||||
FROM safety_accountability_task_detail
|
||||
WHERE delete_enum = 'FALSE'
|
||||
GROUP BY task_list_id
|
||||
) td_agg ON tl.task_list_id = td_agg.task_list_id
|
||||
WHERE tl.task_list_id = #{taskListId} and tl.delete_enum = 'FALSE'
|
||||
SELECT * FROM safety_accountability_task_list
|
||||
WHERE task_list_id = #{taskListId} AND delete_enum = 'FALSE'
|
||||
</select>
|
||||
|
||||
<select id="getInfoByTaskListId" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskListDO">
|
||||
SELECT *
|
||||
FROM safety_accountability_task_list
|
||||
WHERE task_list_id = #{taskListId} and delete_enum = 'FALSE'
|
||||
SELECT * FROM safety_accountability_task_list
|
||||
WHERE task_list_id = #{taskListId} AND delete_enum = 'FALSE'
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskListDO">
|
||||
SELECT tl.*,
|
||||
exec_dept.name AS executeDepartmentName,
|
||||
exec_user.name AS executeUserName,
|
||||
rating_dept.name AS ratingDepartmentName,
|
||||
rating_user.name AS ratingUserName,
|
||||
td_agg.task_count AS taskCount,
|
||||
CASE WHEN td_agg.has_abnormal > 0 THEN 2 ELSE 1 END AS feedbackStatus
|
||||
SELECT tl.*
|
||||
FROM safety_accountability_task_list tl
|
||||
LEFT JOIN department exec_dept ON tl.execute_department_id = exec_dept.id
|
||||
LEFT JOIN user exec_user ON tl.execute_user_id = exec_user.id
|
||||
LEFT JOIN department rating_dept ON tl.rating_department_id = rating_dept.id
|
||||
LEFT JOIN user rating_user ON tl.rating_user_id = rating_user.id
|
||||
LEFT JOIN (
|
||||
SELECT task_list_id,
|
||||
COUNT(*) AS task_count,
|
||||
SUM(CASE WHEN feedback_status = 2 THEN 1 ELSE 0 END) AS has_abnormal
|
||||
FROM safety_accountability_task_detail
|
||||
WHERE delete_enum = 'FALSE'
|
||||
GROUP BY task_list_id
|
||||
) td_agg ON tl.task_list_id = td_agg.task_list_id
|
||||
<where>
|
||||
tl.delete_enum = 'FALSE'
|
||||
<if test="params.createCorpId != null">
|
||||
|
|
@ -150,66 +61,56 @@
|
|||
ORDER BY tl.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="listExpiredInProgress" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskListDO">
|
||||
SELECT * FROM safety_accountability_task_list
|
||||
WHERE status = 1 AND issue_status = 1 AND (period_end_time IS NOT NULL AND period_end_time < NOW()) AND delete_enum = 'FALSE'
|
||||
</select>
|
||||
|
||||
<select id="listIssuedWithPeriod" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskListDO">
|
||||
SELECT * FROM safety_accountability_task_list
|
||||
WHERE issue_status = 1 AND period_start_time IS NOT NULL AND period_end_time IS NOT NULL
|
||||
AND period_end_time > DATE_SUB(NOW(), INTERVAL 1 MONTH) AND delete_enum = 'FALSE'
|
||||
</select>
|
||||
|
||||
<select id="corpStatistics" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.CorpStatisticsDO">
|
||||
SELECT tl.execute_corp_id AS corpId,
|
||||
SELECT tli.execute_corp_id AS corpId,
|
||||
ci.corp_name AS corpName,
|
||||
COUNT(DISTINCT td.task_detail_id) AS totalTaskCount,
|
||||
SUM(CASE WHEN td.task_status = 2 THEN 1 ELSE 0 END) AS completedTaskCount,
|
||||
SUM(CASE WHEN td.task_status = 3 THEN 1 ELSE 0 END) AS closedTaskCount
|
||||
FROM safety_accountability_task_list tl
|
||||
LEFT JOIN safety_accountability_task_detail td ON tl.task_list_id = td.task_list_id AND td.delete_enum = 'FALSE'
|
||||
LEFT JOIN corp_info ci ON tl.execute_corp_id = ci.id
|
||||
WHERE tl.issue_status = 1 AND tl.delete_enum = 'FALSE'
|
||||
COUNT(DISTINCT te.task_execution_id) AS totalTaskCount,
|
||||
SUM(CASE WHEN te.task_status = 2 THEN 1 ELSE 0 END) AS completedTaskCount,
|
||||
SUM(CASE WHEN te.task_status = 3 THEN 1 ELSE 0 END) AS closedTaskCount
|
||||
FROM safety_accountability_task_list_issue tli
|
||||
LEFT JOIN safety_accountability_task_execution te ON tli.task_issue_id = te.task_issue_id AND te.delete_enum = 'FALSE'
|
||||
LEFT JOIN corp_info ci ON tli.execute_corp_id = ci.id
|
||||
WHERE tli.issue_status = 1 AND tli.delete_enum = 'FALSE'
|
||||
<if test="params.corpName != null and params.corpName != ''">
|
||||
AND ci.corp_name LIKE CONCAT('%', #{params.corpName}, '%')
|
||||
</if>
|
||||
GROUP BY tl.execute_corp_id, ci.corp_name
|
||||
ORDER BY tl.create_corp_id
|
||||
GROUP BY tli.execute_corp_id, ci.corp_name
|
||||
ORDER BY tli.execute_corp_id
|
||||
</select>
|
||||
|
||||
<select id="evaluationList" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.EvaluationListDO">
|
||||
SELECT tl.execute_corp_id AS corpId,
|
||||
SELECT tli.execute_corp_id AS corpId,
|
||||
ci.corp_name AS corpName,
|
||||
COUNT(*) AS listCount
|
||||
FROM safety_accountability_task_list tl
|
||||
LEFT JOIN corp_info ci ON tl.execute_corp_id = ci.id
|
||||
WHERE tl.issue_status = 1 AND tl.delete_enum = 'FALSE' AND tl.status IN (2,3)
|
||||
SUM(CASE WHEN tli.rating_score IS NULL THEN 1 ELSE 0 END) AS pendingScoreCount,
|
||||
SUM(CASE WHEN tli.rating_score IS NOT NULL THEN 1 ELSE 0 END) AS scoredCount
|
||||
FROM safety_accountability_task_list_issue tli
|
||||
LEFT JOIN corp_info ci ON tli.execute_corp_id = ci.id
|
||||
WHERE tli.status IN (2,3) AND tli.delete_enum = 'FALSE'
|
||||
<if test="params.corpName != null and params.corpName != ''">
|
||||
AND ci.corp_name LIKE CONCAT('%', #{params.corpName}, '%')
|
||||
</if>
|
||||
GROUP BY tli.execute_corp_id, ci.corp_name
|
||||
<if test="params.scoreStatus != null and params.scoreStatus == 0">
|
||||
AND tl.rating_score IS NULL
|
||||
HAVING pendingScoreCount > 0
|
||||
</if>
|
||||
<if test="params.scoreStatus != null and params.scoreStatus == 1">
|
||||
AND tl.rating_score IS NOT NULL
|
||||
HAVING scoredCount > 0
|
||||
</if>
|
||||
GROUP BY tl.execute_corp_id, ci.corp_name
|
||||
ORDER BY tl.execute_corp_id
|
||||
ORDER BY tli.execute_corp_id
|
||||
</select>
|
||||
|
||||
<select id="issueStatistics" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.IssueStatisticsDO">
|
||||
SELECT tl.execute_corp_id AS corpId,
|
||||
SELECT tli.execute_corp_id AS corpId,
|
||||
ci.corp_name AS corpName,
|
||||
COUNT(*) AS issueCount
|
||||
FROM safety_accountability_task_list tl
|
||||
LEFT JOIN corp_info ci ON tl.execute_corp_id = ci.id
|
||||
WHERE tl.issue_status = 1 AND tl.delete_enum = 'FALSE'
|
||||
FROM safety_accountability_task_list_issue tli
|
||||
LEFT JOIN corp_info ci ON tli.execute_corp_id = ci.id
|
||||
WHERE tli.issue_status = 1 AND tli.delete_enum = 'FALSE'
|
||||
<if test="params.corpName != null and params.corpName != ''">
|
||||
AND ci.corp_name LIKE CONCAT('%', #{params.corpName}, '%')
|
||||
</if>
|
||||
GROUP BY tl.execute_corp_id, ci.corp_name
|
||||
ORDER BY tl.execute_corp_id
|
||||
GROUP BY tli.execute_corp_id, ci.corp_name
|
||||
ORDER BY tli.execute_corp_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue