feat: initialize Spring Boot infrastructure project
This commit is contained in:
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
target/
|
||||
.idea/
|
||||
.classpath
|
||||
.project
|
||||
.settings/
|
||||
*.log
|
||||
data/
|
||||
80
pom.xml
Normal file
80
pom.xml
Normal file
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.2.6</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
<groupId>com.music</groupId>
|
||||
<artifactId>music-metadata-system</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<name>music-metadata-system</name>
|
||||
<description>Music metadata normalization and archiving infrastructure</description>
|
||||
|
||||
<properties>
|
||||
<java.version>21</java.version>
|
||||
<mybatis-plus.version>3.5.7</mybatis-plus.version>
|
||||
<graalvm.native.buildtools.version>0.10.2</graalvm.native.buildtools.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
||||
<version>${mybatis-plus.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>2.2.224</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.graalvm.buildtools</groupId>
|
||||
<artifactId>native-maven-plugin</artifactId>
|
||||
<version>${graalvm.native.buildtools.version}</version>
|
||||
<extensions>true</extensions>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>build-native</id>
|
||||
<goals>
|
||||
<goal>compile-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.music.metadata;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication(proxyBeanMethods = false)
|
||||
@MapperScan("com.music.metadata.infrastructure.mapper")
|
||||
public class MusicMetadataSystemApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MusicMetadataSystemApplication.class, args);
|
||||
}
|
||||
}
|
||||
59
src/main/java/com/music/metadata/common/api/ApiResponse.java
Normal file
59
src/main/java/com/music/metadata/common/api/ApiResponse.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package com.music.metadata.common.api;
|
||||
|
||||
public class ApiResponse<T> {
|
||||
|
||||
private Integer code;
|
||||
private String message;
|
||||
private T data;
|
||||
private Long timestamp;
|
||||
|
||||
public ApiResponse() {
|
||||
}
|
||||
|
||||
public ApiResponse(Integer code, String message, T data, Long timestamp) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
this.data = data;
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public static <T> ApiResponse<T> success(T data) {
|
||||
return new ApiResponse<>(200, "操作成功", data, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public static <T> ApiResponse<T> fail(Integer code, String message) {
|
||||
return new ApiResponse<>(code, message, null, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(T data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public Long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public void setTimestamp(Long timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.music.metadata.common.exception;
|
||||
|
||||
public class BusinessException extends RuntimeException {
|
||||
|
||||
private final Integer code;
|
||||
|
||||
public BusinessException(String message) {
|
||||
super(message);
|
||||
this.code = 400;
|
||||
}
|
||||
|
||||
public BusinessException(Integer code, String message) {
|
||||
super(message);
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.music.metadata.common.handler;
|
||||
|
||||
import com.music.metadata.common.api.ApiResponse;
|
||||
import com.music.metadata.common.exception.BusinessException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
@RestControllerAdvice
|
||||
public class GlobalExceptionHandler {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(GlobalExceptionHandler.class);
|
||||
|
||||
@ExceptionHandler(BusinessException.class)
|
||||
public ApiResponse<Void> handleBusinessException(BusinessException ex) {
|
||||
return ApiResponse.fail(ex.getCode(), ex.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public ApiResponse<Void> handleException(Exception ex) {
|
||||
LOGGER.error("System exception", ex);
|
||||
return ApiResponse.fail(500, "系统异常,请稍后重试");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.music.metadata.infrastructure.entity;
|
||||
|
||||
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.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@TableName("t_fail_file")
|
||||
public class FailFileEntity implements Serializable {
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@TableField("file_process_id")
|
||||
private Long fileProcessId;
|
||||
|
||||
@TableField("file_hash")
|
||||
private String fileHash;
|
||||
|
||||
@TableField("source_file_path")
|
||||
private String sourceFilePath;
|
||||
|
||||
@TableField("file_name")
|
||||
private String fileName;
|
||||
|
||||
@TableField("fail_type")
|
||||
private String failType;
|
||||
|
||||
@TableField("fail_detail")
|
||||
private String failDetail;
|
||||
|
||||
@TableField("raw_metadata")
|
||||
private String rawMetadata;
|
||||
|
||||
@TableField("edit_metadata")
|
||||
private String editMetadata;
|
||||
|
||||
@TableField("status")
|
||||
private String status;
|
||||
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
@TableField("resolved_at")
|
||||
private LocalDateTime resolvedAt;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getFileProcessId() {
|
||||
return fileProcessId;
|
||||
}
|
||||
|
||||
public void setFileProcessId(Long fileProcessId) {
|
||||
this.fileProcessId = fileProcessId;
|
||||
}
|
||||
|
||||
public String getFileHash() {
|
||||
return fileHash;
|
||||
}
|
||||
|
||||
public void setFileHash(String fileHash) {
|
||||
this.fileHash = fileHash;
|
||||
}
|
||||
|
||||
public String getSourceFilePath() {
|
||||
return sourceFilePath;
|
||||
}
|
||||
|
||||
public void setSourceFilePath(String sourceFilePath) {
|
||||
this.sourceFilePath = sourceFilePath;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public String getFailType() {
|
||||
return failType;
|
||||
}
|
||||
|
||||
public void setFailType(String failType) {
|
||||
this.failType = failType;
|
||||
}
|
||||
|
||||
public String getFailDetail() {
|
||||
return failDetail;
|
||||
}
|
||||
|
||||
public void setFailDetail(String failDetail) {
|
||||
this.failDetail = failDetail;
|
||||
}
|
||||
|
||||
public String getRawMetadata() {
|
||||
return rawMetadata;
|
||||
}
|
||||
|
||||
public void setRawMetadata(String rawMetadata) {
|
||||
this.rawMetadata = rawMetadata;
|
||||
}
|
||||
|
||||
public String getEditMetadata() {
|
||||
return editMetadata;
|
||||
}
|
||||
|
||||
public void setEditMetadata(String editMetadata) {
|
||||
this.editMetadata = editMetadata;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(LocalDateTime createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public LocalDateTime getUpdatedAt() {
|
||||
return updatedAt;
|
||||
}
|
||||
|
||||
public void setUpdatedAt(LocalDateTime updatedAt) {
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
|
||||
public LocalDateTime getResolvedAt() {
|
||||
return resolvedAt;
|
||||
}
|
||||
|
||||
public void setResolvedAt(LocalDateTime resolvedAt) {
|
||||
this.resolvedAt = resolvedAt;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
package com.music.metadata.infrastructure.entity;
|
||||
|
||||
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.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@TableName("t_file_process")
|
||||
public class FileProcessEntity implements Serializable {
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@TableField("file_hash")
|
||||
private String fileHash;
|
||||
|
||||
@TableField("source_file_path")
|
||||
private String sourceFilePath;
|
||||
|
||||
@TableField("source_file_name")
|
||||
private String sourceFileName;
|
||||
|
||||
@TableField("file_extension")
|
||||
private String fileExtension;
|
||||
|
||||
@TableField("file_size")
|
||||
private Long fileSize;
|
||||
|
||||
@TableField("audio_duration")
|
||||
private Integer audioDuration;
|
||||
|
||||
@TableField("raw_metadata")
|
||||
private String rawMetadata;
|
||||
|
||||
@TableField("process_status")
|
||||
private String processStatus;
|
||||
|
||||
@TableField("fail_reason")
|
||||
private String failReason;
|
||||
|
||||
@TableField("target_file_path")
|
||||
private String targetFilePath;
|
||||
|
||||
@TableField("task_id")
|
||||
private Long taskId;
|
||||
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getFileHash() {
|
||||
return fileHash;
|
||||
}
|
||||
|
||||
public void setFileHash(String fileHash) {
|
||||
this.fileHash = fileHash;
|
||||
}
|
||||
|
||||
public String getSourceFilePath() {
|
||||
return sourceFilePath;
|
||||
}
|
||||
|
||||
public void setSourceFilePath(String sourceFilePath) {
|
||||
this.sourceFilePath = sourceFilePath;
|
||||
}
|
||||
|
||||
public String getSourceFileName() {
|
||||
return sourceFileName;
|
||||
}
|
||||
|
||||
public void setSourceFileName(String sourceFileName) {
|
||||
this.sourceFileName = sourceFileName;
|
||||
}
|
||||
|
||||
public String getFileExtension() {
|
||||
return fileExtension;
|
||||
}
|
||||
|
||||
public void setFileExtension(String fileExtension) {
|
||||
this.fileExtension = fileExtension;
|
||||
}
|
||||
|
||||
public Long getFileSize() {
|
||||
return fileSize;
|
||||
}
|
||||
|
||||
public void setFileSize(Long fileSize) {
|
||||
this.fileSize = fileSize;
|
||||
}
|
||||
|
||||
public Integer getAudioDuration() {
|
||||
return audioDuration;
|
||||
}
|
||||
|
||||
public void setAudioDuration(Integer audioDuration) {
|
||||
this.audioDuration = audioDuration;
|
||||
}
|
||||
|
||||
public String getRawMetadata() {
|
||||
return rawMetadata;
|
||||
}
|
||||
|
||||
public void setRawMetadata(String rawMetadata) {
|
||||
this.rawMetadata = rawMetadata;
|
||||
}
|
||||
|
||||
public String getProcessStatus() {
|
||||
return processStatus;
|
||||
}
|
||||
|
||||
public void setProcessStatus(String processStatus) {
|
||||
this.processStatus = processStatus;
|
||||
}
|
||||
|
||||
public String getFailReason() {
|
||||
return failReason;
|
||||
}
|
||||
|
||||
public void setFailReason(String failReason) {
|
||||
this.failReason = failReason;
|
||||
}
|
||||
|
||||
public String getTargetFilePath() {
|
||||
return targetFilePath;
|
||||
}
|
||||
|
||||
public void setTargetFilePath(String targetFilePath) {
|
||||
this.targetFilePath = targetFilePath;
|
||||
}
|
||||
|
||||
public Long getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTaskId(Long taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(LocalDateTime createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public LocalDateTime getUpdatedAt() {
|
||||
return updatedAt;
|
||||
}
|
||||
|
||||
public void setUpdatedAt(LocalDateTime updatedAt) {
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
package com.music.metadata.infrastructure.entity;
|
||||
|
||||
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.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@TableName("t_process_task")
|
||||
public class ProcessTaskEntity implements Serializable {
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@TableField("task_name")
|
||||
private String taskName;
|
||||
|
||||
@TableField("task_type")
|
||||
private String taskType;
|
||||
|
||||
@TableField("source_path")
|
||||
private String sourcePath;
|
||||
|
||||
@TableField("total_file_count")
|
||||
private Integer totalFileCount;
|
||||
|
||||
@TableField("processed_count")
|
||||
private Integer processedCount;
|
||||
|
||||
@TableField("success_count")
|
||||
private Integer successCount;
|
||||
|
||||
@TableField("fail_count")
|
||||
private Integer failCount;
|
||||
|
||||
@TableField("duplicate_count")
|
||||
private Integer duplicateCount;
|
||||
|
||||
@TableField("task_status")
|
||||
private String taskStatus;
|
||||
|
||||
@TableField("start_time")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
@TableField("end_time")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
@TableField("created_by")
|
||||
private String createdBy;
|
||||
|
||||
@TableField("remark")
|
||||
private String remark;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTaskName() {
|
||||
return taskName;
|
||||
}
|
||||
|
||||
public void setTaskName(String taskName) {
|
||||
this.taskName = taskName;
|
||||
}
|
||||
|
||||
public String getTaskType() {
|
||||
return taskType;
|
||||
}
|
||||
|
||||
public void setTaskType(String taskType) {
|
||||
this.taskType = taskType;
|
||||
}
|
||||
|
||||
public String getSourcePath() {
|
||||
return sourcePath;
|
||||
}
|
||||
|
||||
public void setSourcePath(String sourcePath) {
|
||||
this.sourcePath = sourcePath;
|
||||
}
|
||||
|
||||
public Integer getTotalFileCount() {
|
||||
return totalFileCount;
|
||||
}
|
||||
|
||||
public void setTotalFileCount(Integer totalFileCount) {
|
||||
this.totalFileCount = totalFileCount;
|
||||
}
|
||||
|
||||
public Integer getProcessedCount() {
|
||||
return processedCount;
|
||||
}
|
||||
|
||||
public void setProcessedCount(Integer processedCount) {
|
||||
this.processedCount = processedCount;
|
||||
}
|
||||
|
||||
public Integer getSuccessCount() {
|
||||
return successCount;
|
||||
}
|
||||
|
||||
public void setSuccessCount(Integer successCount) {
|
||||
this.successCount = successCount;
|
||||
}
|
||||
|
||||
public Integer getFailCount() {
|
||||
return failCount;
|
||||
}
|
||||
|
||||
public void setFailCount(Integer failCount) {
|
||||
this.failCount = failCount;
|
||||
}
|
||||
|
||||
public Integer getDuplicateCount() {
|
||||
return duplicateCount;
|
||||
}
|
||||
|
||||
public void setDuplicateCount(Integer duplicateCount) {
|
||||
this.duplicateCount = duplicateCount;
|
||||
}
|
||||
|
||||
public String getTaskStatus() {
|
||||
return taskStatus;
|
||||
}
|
||||
|
||||
public void setTaskStatus(String taskStatus) {
|
||||
this.taskStatus = taskStatus;
|
||||
}
|
||||
|
||||
public LocalDateTime getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(LocalDateTime startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public LocalDateTime getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(LocalDateTime endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.music.metadata.infrastructure.entity;
|
||||
|
||||
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.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@TableName("t_system_config")
|
||||
public class SystemConfigEntity implements Serializable {
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@TableField("config_key")
|
||||
private String configKey;
|
||||
|
||||
@TableField("config_value")
|
||||
private String configValue;
|
||||
|
||||
@TableField("config_name")
|
||||
private String configName;
|
||||
|
||||
@TableField("config_desc")
|
||||
private String configDesc;
|
||||
|
||||
@TableField("is_editable")
|
||||
private Integer isEditable;
|
||||
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getConfigKey() {
|
||||
return configKey;
|
||||
}
|
||||
|
||||
public void setConfigKey(String configKey) {
|
||||
this.configKey = configKey;
|
||||
}
|
||||
|
||||
public String getConfigValue() {
|
||||
return configValue;
|
||||
}
|
||||
|
||||
public void setConfigValue(String configValue) {
|
||||
this.configValue = configValue;
|
||||
}
|
||||
|
||||
public String getConfigName() {
|
||||
return configName;
|
||||
}
|
||||
|
||||
public void setConfigName(String configName) {
|
||||
this.configName = configName;
|
||||
}
|
||||
|
||||
public String getConfigDesc() {
|
||||
return configDesc;
|
||||
}
|
||||
|
||||
public void setConfigDesc(String configDesc) {
|
||||
this.configDesc = configDesc;
|
||||
}
|
||||
|
||||
public Integer getIsEditable() {
|
||||
return isEditable;
|
||||
}
|
||||
|
||||
public void setIsEditable(Integer isEditable) {
|
||||
this.isEditable = isEditable;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(LocalDateTime createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public LocalDateTime getUpdatedAt() {
|
||||
return updatedAt;
|
||||
}
|
||||
|
||||
public void setUpdatedAt(LocalDateTime updatedAt) {
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.music.metadata.infrastructure.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.music.metadata.infrastructure.entity.FailFileEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface FailFileMapper extends BaseMapper<FailFileEntity> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.music.metadata.infrastructure.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.music.metadata.infrastructure.entity.FileProcessEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface FileProcessMapper extends BaseMapper<FileProcessEntity> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.music.metadata.infrastructure.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.music.metadata.infrastructure.entity.ProcessTaskEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ProcessTaskMapper extends BaseMapper<ProcessTaskEntity> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.music.metadata.infrastructure.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.music.metadata.infrastructure.entity.SystemConfigEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SystemConfigMapper extends BaseMapper<SystemConfigEntity> {
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.music.metadata.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.music.metadata.infrastructure.entity.FailFileEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface FailFileService extends IService<FailFileEntity> {
|
||||
|
||||
boolean create(FailFileEntity entity);
|
||||
|
||||
boolean update(FailFileEntity entity);
|
||||
|
||||
boolean deleteById(Long id);
|
||||
|
||||
FailFileEntity findById(Long id);
|
||||
|
||||
List<FailFileEntity> findAll();
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.music.metadata.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.music.metadata.infrastructure.entity.FileProcessEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface FileProcessService extends IService<FileProcessEntity> {
|
||||
|
||||
boolean create(FileProcessEntity entity);
|
||||
|
||||
boolean update(FileProcessEntity entity);
|
||||
|
||||
boolean deleteById(Long id);
|
||||
|
||||
FileProcessEntity findById(Long id);
|
||||
|
||||
List<FileProcessEntity> findAll();
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.music.metadata.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.music.metadata.infrastructure.entity.ProcessTaskEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ProcessTaskService extends IService<ProcessTaskEntity> {
|
||||
|
||||
boolean create(ProcessTaskEntity entity);
|
||||
|
||||
boolean update(ProcessTaskEntity entity);
|
||||
|
||||
boolean deleteById(Long id);
|
||||
|
||||
ProcessTaskEntity findById(Long id);
|
||||
|
||||
List<ProcessTaskEntity> findAll();
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.music.metadata.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.music.metadata.infrastructure.entity.SystemConfigEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SystemConfigService extends IService<SystemConfigEntity> {
|
||||
|
||||
boolean create(SystemConfigEntity entity);
|
||||
|
||||
boolean update(SystemConfigEntity entity);
|
||||
|
||||
boolean deleteById(Long id);
|
||||
|
||||
SystemConfigEntity findById(Long id);
|
||||
|
||||
List<SystemConfigEntity> findAll();
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.music.metadata.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.music.metadata.infrastructure.entity.FailFileEntity;
|
||||
import com.music.metadata.infrastructure.mapper.FailFileMapper;
|
||||
import com.music.metadata.service.FailFileService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class FailFileServiceImpl extends ServiceImpl<FailFileMapper, FailFileEntity> implements FailFileService {
|
||||
|
||||
@Override
|
||||
public boolean create(FailFileEntity entity) {
|
||||
return this.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(FailFileEntity entity) {
|
||||
return this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteById(Long id) {
|
||||
return this.removeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FailFileEntity findById(Long id) {
|
||||
return this.getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FailFileEntity> findAll() {
|
||||
return this.list();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.music.metadata.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.music.metadata.infrastructure.entity.FileProcessEntity;
|
||||
import com.music.metadata.infrastructure.mapper.FileProcessMapper;
|
||||
import com.music.metadata.service.FileProcessService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class FileProcessServiceImpl extends ServiceImpl<FileProcessMapper, FileProcessEntity> implements FileProcessService {
|
||||
|
||||
@Override
|
||||
public boolean create(FileProcessEntity entity) {
|
||||
return this.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(FileProcessEntity entity) {
|
||||
return this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteById(Long id) {
|
||||
return this.removeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileProcessEntity findById(Long id) {
|
||||
return this.getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FileProcessEntity> findAll() {
|
||||
return this.list();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.music.metadata.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.music.metadata.infrastructure.entity.ProcessTaskEntity;
|
||||
import com.music.metadata.infrastructure.mapper.ProcessTaskMapper;
|
||||
import com.music.metadata.service.ProcessTaskService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ProcessTaskServiceImpl extends ServiceImpl<ProcessTaskMapper, ProcessTaskEntity> implements ProcessTaskService {
|
||||
|
||||
@Override
|
||||
public boolean create(ProcessTaskEntity entity) {
|
||||
return this.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(ProcessTaskEntity entity) {
|
||||
return this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteById(Long id) {
|
||||
return this.removeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcessTaskEntity findById(Long id) {
|
||||
return this.getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProcessTaskEntity> findAll() {
|
||||
return this.list();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.music.metadata.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.music.metadata.infrastructure.entity.SystemConfigEntity;
|
||||
import com.music.metadata.infrastructure.mapper.SystemConfigMapper;
|
||||
import com.music.metadata.service.SystemConfigService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigMapper, SystemConfigEntity> implements SystemConfigService {
|
||||
|
||||
@Override
|
||||
public boolean create(SystemConfigEntity entity) {
|
||||
return this.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(SystemConfigEntity entity) {
|
||||
return this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteById(Long id) {
|
||||
return this.removeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SystemConfigEntity findById(Long id) {
|
||||
return this.getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SystemConfigEntity> findAll() {
|
||||
return this.list();
|
||||
}
|
||||
}
|
||||
34
src/main/resources/application.yml
Normal file
34
src/main/resources/application.yml
Normal file
@@ -0,0 +1,34 @@
|
||||
server:
|
||||
port: 8080
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: music-metadata-system
|
||||
datasource:
|
||||
driver-class-name: org.h2.Driver
|
||||
url: jdbc:h2:file:./data/music_metadata_db;MODE=MYSQL;AUTO_SERVER=TRUE;DATABASE_TO_LOWER=TRUE
|
||||
username: sa
|
||||
password:
|
||||
h2:
|
||||
console:
|
||||
enabled: true
|
||||
path: /h2-console
|
||||
sql:
|
||||
init:
|
||||
mode: always
|
||||
schema-locations: classpath:schema.sql
|
||||
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
global-config:
|
||||
db-config:
|
||||
id-type: auto
|
||||
|
||||
logging:
|
||||
level:
|
||||
root: INFO
|
||||
com.music.metadata: DEBUG
|
||||
com.baomidou.mybatisplus: INFO
|
||||
org.springframework.jdbc.datasource.init: INFO
|
||||
65
src/main/resources/schema.sql
Normal file
65
src/main/resources/schema.sql
Normal file
@@ -0,0 +1,65 @@
|
||||
CREATE TABLE IF NOT EXISTS t_process_task (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
task_name VARCHAR(100) NOT NULL,
|
||||
task_type VARCHAR(20) NOT NULL,
|
||||
source_path VARCHAR(1000),
|
||||
total_file_count INT NOT NULL,
|
||||
processed_count INT NOT NULL,
|
||||
success_count INT NOT NULL,
|
||||
fail_count INT NOT NULL,
|
||||
duplicate_count INT NOT NULL,
|
||||
task_status VARCHAR(20) NOT NULL,
|
||||
start_time DATETIME NOT NULL,
|
||||
end_time DATETIME,
|
||||
created_by VARCHAR(50) NOT NULL,
|
||||
remark VARCHAR(500)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS t_file_process (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
file_hash VARCHAR(64) NOT NULL,
|
||||
source_file_path VARCHAR(1000) NOT NULL,
|
||||
source_file_name VARCHAR(200) NOT NULL,
|
||||
file_extension VARCHAR(10) NOT NULL,
|
||||
file_size BIGINT NOT NULL,
|
||||
audio_duration INT,
|
||||
raw_metadata TEXT NOT NULL,
|
||||
process_status VARCHAR(20) NOT NULL,
|
||||
fail_reason TEXT,
|
||||
target_file_path VARCHAR(1000),
|
||||
task_id BIGINT NOT NULL,
|
||||
created_at DATETIME NOT NULL,
|
||||
updated_at DATETIME NOT NULL,
|
||||
CONSTRAINT uk_t_file_process_file_hash UNIQUE (file_hash),
|
||||
CONSTRAINT fk_t_file_process_task_id FOREIGN KEY (task_id) REFERENCES t_process_task (id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS t_fail_file (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
file_process_id BIGINT NOT NULL,
|
||||
file_hash VARCHAR(64) NOT NULL,
|
||||
source_file_path VARCHAR(1000) NOT NULL,
|
||||
file_name VARCHAR(200) NOT NULL,
|
||||
fail_type VARCHAR(50) NOT NULL,
|
||||
fail_detail TEXT NOT NULL,
|
||||
raw_metadata TEXT NOT NULL,
|
||||
edit_metadata TEXT,
|
||||
status VARCHAR(20) NOT NULL,
|
||||
created_at DATETIME NOT NULL,
|
||||
updated_at DATETIME NOT NULL,
|
||||
resolved_at DATETIME,
|
||||
CONSTRAINT uk_t_fail_file_file_hash UNIQUE (file_hash),
|
||||
CONSTRAINT fk_t_fail_file_file_process_id FOREIGN KEY (file_process_id) REFERENCES t_file_process (id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS t_system_config (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
config_key VARCHAR(100) NOT NULL,
|
||||
config_value TEXT,
|
||||
config_name VARCHAR(100) NOT NULL,
|
||||
config_desc VARCHAR(500),
|
||||
is_editable TINYINT NOT NULL,
|
||||
created_at DATETIME NOT NULL,
|
||||
updated_at DATETIME NOT NULL,
|
||||
CONSTRAINT uk_t_system_config_config_key UNIQUE (config_key)
|
||||
);
|
||||
Reference in New Issue
Block a user