diff --git a/services/delivery-platform-api/src/main/java/cn/craftlabs/platform/api/domain/TodoPriority.java b/services/delivery-platform-api/src/main/java/cn/craftlabs/platform/api/domain/TodoPriority.java new file mode 100644 index 0000000..26f4290 --- /dev/null +++ b/services/delivery-platform-api/src/main/java/cn/craftlabs/platform/api/domain/TodoPriority.java @@ -0,0 +1,5 @@ +package cn.craftlabs.platform.api.domain; + +public enum TodoPriority { + HIGH, MEDIUM, LOW +} diff --git a/services/delivery-platform-api/src/main/java/cn/craftlabs/platform/api/domain/TodoStatus.java b/services/delivery-platform-api/src/main/java/cn/craftlabs/platform/api/domain/TodoStatus.java new file mode 100644 index 0000000..2bd7ad8 --- /dev/null +++ b/services/delivery-platform-api/src/main/java/cn/craftlabs/platform/api/domain/TodoStatus.java @@ -0,0 +1,5 @@ +package cn.craftlabs.platform.api.domain; + +public enum TodoStatus { + PENDING, PROCESSED, IGNORED +} diff --git a/services/delivery-platform-api/src/main/java/cn/craftlabs/platform/api/persistence/todo/PlatformNotificationConfig.java b/services/delivery-platform-api/src/main/java/cn/craftlabs/platform/api/persistence/todo/PlatformNotificationConfig.java new file mode 100644 index 0000000..317a905 --- /dev/null +++ b/services/delivery-platform-api/src/main/java/cn/craftlabs/platform/api/persistence/todo/PlatformNotificationConfig.java @@ -0,0 +1,111 @@ +package cn.craftlabs.platform.api.persistence.todo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.time.OffsetDateTime; + +@TableName("platform_notification_config") +public class PlatformNotificationConfig { + + @TableId(type = IdType.AUTO) + private Long id; + + @TableField("role_code") + private String roleCode; + + @TableField("channel_email") + private Boolean channelEmail; + + @TableField("channel_wecom") + private Boolean channelWecom; + + @TableField("channel_in_app") + private Boolean channelInApp; + + @TableField("event_type") + private String eventType; + + @TableField("aggregation_rule") + private String aggregationRule; + + @TableField("created_at") + private OffsetDateTime createdAt; + + @TableField("updated_at") + private OffsetDateTime updatedAt; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getRoleCode() { + return roleCode; + } + + public void setRoleCode(String roleCode) { + this.roleCode = roleCode; + } + + public Boolean getChannelEmail() { + return channelEmail; + } + + public void setChannelEmail(Boolean channelEmail) { + this.channelEmail = channelEmail; + } + + public Boolean getChannelWecom() { + return channelWecom; + } + + public void setChannelWecom(Boolean channelWecom) { + this.channelWecom = channelWecom; + } + + public Boolean getChannelInApp() { + return channelInApp; + } + + public void setChannelInApp(Boolean channelInApp) { + this.channelInApp = channelInApp; + } + + public String getEventType() { + return eventType; + } + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + public String getAggregationRule() { + return aggregationRule; + } + + public void setAggregationRule(String aggregationRule) { + this.aggregationRule = aggregationRule; + } + + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } +} diff --git a/services/delivery-platform-api/src/main/java/cn/craftlabs/platform/api/persistence/todo/PlatformNotificationConfigMapper.java b/services/delivery-platform-api/src/main/java/cn/craftlabs/platform/api/persistence/todo/PlatformNotificationConfigMapper.java new file mode 100644 index 0000000..ad7ee90 --- /dev/null +++ b/services/delivery-platform-api/src/main/java/cn/craftlabs/platform/api/persistence/todo/PlatformNotificationConfigMapper.java @@ -0,0 +1,7 @@ +package cn.craftlabs.platform.api.persistence.todo; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface PlatformNotificationConfigMapper extends BaseMapper {} diff --git a/services/delivery-platform-api/src/main/java/cn/craftlabs/platform/api/persistence/todo/PlatformTodoItem.java b/services/delivery-platform-api/src/main/java/cn/craftlabs/platform/api/persistence/todo/PlatformTodoItem.java new file mode 100644 index 0000000..d85c8ac --- /dev/null +++ b/services/delivery-platform-api/src/main/java/cn/craftlabs/platform/api/persistence/todo/PlatformTodoItem.java @@ -0,0 +1,140 @@ +package cn.craftlabs.platform.api.persistence.todo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.time.OffsetDateTime; + +@TableName("platform_todo_item") +public class PlatformTodoItem { + + @TableId(type = IdType.AUTO) + private Long id; + + @TableField("todo_type") + private String todoType; + + private String title; + + @TableField("source_id") + private Long sourceId; + + @TableField("source_type") + private String sourceType; + + private String priority; + + private String status; + + @TableField("assigned_role") + private String assignedRole; + + @TableField("assigned_user_id") + private String assignedUserId; + + @TableField("created_at") + private OffsetDateTime createdAt; + + @TableField("processed_at") + private OffsetDateTime processedAt; + + private String remark; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTodoType() { + return todoType; + } + + public void setTodoType(String todoType) { + this.todoType = todoType; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Long getSourceId() { + return sourceId; + } + + public void setSourceId(Long sourceId) { + this.sourceId = sourceId; + } + + public String getSourceType() { + return sourceType; + } + + public void setSourceType(String sourceType) { + this.sourceType = sourceType; + } + + public String getPriority() { + return priority; + } + + public void setPriority(String priority) { + this.priority = priority; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getAssignedRole() { + return assignedRole; + } + + public void setAssignedRole(String assignedRole) { + this.assignedRole = assignedRole; + } + + public String getAssignedUserId() { + return assignedUserId; + } + + public void setAssignedUserId(String assignedUserId) { + this.assignedUserId = assignedUserId; + } + + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public OffsetDateTime getProcessedAt() { + return processedAt; + } + + public void setProcessedAt(OffsetDateTime processedAt) { + this.processedAt = processedAt; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } +} diff --git a/services/delivery-platform-api/src/main/java/cn/craftlabs/platform/api/persistence/todo/PlatformTodoItemMapper.java b/services/delivery-platform-api/src/main/java/cn/craftlabs/platform/api/persistence/todo/PlatformTodoItemMapper.java new file mode 100644 index 0000000..841d67d --- /dev/null +++ b/services/delivery-platform-api/src/main/java/cn/craftlabs/platform/api/persistence/todo/PlatformTodoItemMapper.java @@ -0,0 +1,7 @@ +package cn.craftlabs.platform.api.persistence.todo; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface PlatformTodoItemMapper extends BaseMapper {} diff --git a/services/delivery-platform-api/src/main/resources/db/migration/V8__notification_todo.sql b/services/delivery-platform-api/src/main/resources/db/migration/V8__notification_todo.sql new file mode 100644 index 0000000..acdd55f --- /dev/null +++ b/services/delivery-platform-api/src/main/resources/db/migration/V8__notification_todo.sql @@ -0,0 +1,36 @@ +-- V8__notification_todo.sql +-- M8:待办事项表 +CREATE TABLE platform_todo_item ( + id BIGSERIAL PRIMARY KEY, + todo_type VARCHAR(64) NOT NULL, + title VARCHAR(512) NOT NULL, + source_id BIGINT, + source_type VARCHAR(64), + priority VARCHAR(16) NOT NULL DEFAULT 'MEDIUM', + status VARCHAR(32) NOT NULL DEFAULT 'PENDING', + assigned_role VARCHAR(64), + assigned_user_id VARCHAR(256), + created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, + processed_at TIMESTAMP WITH TIME ZONE, + remark TEXT +); + +CREATE INDEX idx_todo_status ON platform_todo_item(status); +CREATE INDEX idx_todo_type ON platform_todo_item(todo_type); +CREATE INDEX idx_todo_role ON platform_todo_item(assigned_role); + +-- M8:通知配置表 +CREATE TABLE platform_notification_config ( + id BIGSERIAL PRIMARY KEY, + role_code VARCHAR(64), + channel_email BOOLEAN DEFAULT FALSE, + channel_wecom BOOLEAN DEFAULT FALSE, + channel_in_app BOOLEAN DEFAULT TRUE, + event_type VARCHAR(64) NOT NULL, + aggregation_rule VARCHAR(64) DEFAULT 'NONE', + created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +CREATE INDEX idx_notif_config_role ON platform_notification_config(role_code); +CREATE INDEX idx_notif_config_event ON platform_notification_config(event_type);