1. 删除Command类,Doris数据库改用TaskCommandInfo类作为实体类

2. 取消FailedState和GeneratingState的使用
3. 修改部分bug
This commit is contained in:
EnderByEndera
2024-01-15 20:40:55 +08:00
parent ee10a17aea
commit 6cfe4bf5d3
34 changed files with 482 additions and 247 deletions

View File

@@ -15,6 +15,8 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.method.annotation.HandlerMethodValidationException;
import java.sql.SQLException;
import java.sql.SQLIntegrityConstraintViolationException;
import java.util.stream.Collectors;
@RestControllerAdvice
@@ -36,7 +38,12 @@ public class GlobalExceptionHandler {
@Order(2)
@ExceptionHandler(value = {PersistenceException.class, DuplicateKeyException.class})
@ExceptionHandler(value = {
PersistenceException.class,
DuplicateKeyException.class,
SQLException.class,
SQLIntegrityConstraintViolationException.class
})
public ResponseResult handleSQLException(Exception e) {
log.info("遭遇数据库异常:" + e.getMessage());
return ResponseResult.invalid().setMessage(
@@ -89,7 +96,8 @@ public class GlobalExceptionHandler {
.setMessage("Doris数据库指令生成遭遇异常" + e.getMessage());
try {
stateChangeService.changeState(StateEnum.FAILED.getStateNum(), e.taskId);
// 内部修改状态,可以跳过一切状态检查
stateChangeService.changeState(StateEnum.FAILED.getStateNum(), e.taskId, true);
} catch (Exception another) {
responseResult.setAnother(ResponseResult.error().setMessage(e.getMessage()));
}