76 门诊预约挂号

This commit is contained in:
ljj
2026-01-09 11:33:03 +08:00
parent 062c4a92b8
commit 8c74d45332
42 changed files with 8627 additions and 258 deletions

View File

@@ -11,9 +11,10 @@ import org.springframework.transaction.support.DefaultTransactionDefinition;
/**
* 事务处理
* 已注释:与 @Transactional 注解冲突,导致事务回滚错误
*/
@Aspect
@Component
//@Aspect
//@Component
public class TransactionAspect {
private final PlatformTransactionManager transactionManager;
@@ -23,19 +24,19 @@ public class TransactionAspect {
this.transactionManager = transactionManager;
}
@Before("@annotation(org.springframework.web.bind.annotation.PostMapping) || " +
"@annotation(org.springframework.web.bind.annotation.GetMapping) || " +
"@annotation(org.springframework.web.bind.annotation.PutMapping) || " +
"@annotation(org.springframework.web.bind.annotation.DeleteMapping)")
//@Before("@annotation(org.springframework.web.bind.annotation.PostMapping) || " +
// "@annotation(org.springframework.web.bind.annotation.GetMapping) || " +
// "@annotation(org.springframework.web.bind.annotation.PutMapping) || " +
// "@annotation(org.springframework.web.bind.annotation.DeleteMapping)")
public void beginTransaction() {
TransactionStatus status = transactionManager.getTransaction(new DefaultTransactionDefinition());
transactionStatus.set(status);
}
@AfterReturning("@annotation(org.springframework.web.bind.annotation.PostMapping) || " +
"@annotation(org.springframework.web.bind.annotation.GetMapping) || " +
"@annotation(org.springframework.web.bind.annotation.PutMapping) || " +
"@annotation(org.springframework.web.bind.annotation.DeleteMapping)")
//@AfterReturning("@annotation(org.springframework.web.bind.annotation.PostMapping) || " +
// "@annotation(org.springframework.web.bind.annotation.GetMapping) || " +
// "@annotation(org.springframework.web.bind.annotation.PutMapping) || " +
// "@annotation(org.springframework.web.bind.annotation.DeleteMapping)")
public void commitTransaction() {
TransactionStatus status = transactionStatus.get();
if (status != null && !status.isCompleted()) {
@@ -44,11 +45,11 @@ public class TransactionAspect {
}
}
@AfterThrowing(pointcut = "@annotation(org.springframework.web.bind.annotation.PostMapping) || " +
"@annotation(org.springframework.web.bind.annotation.GetMapping) || " +
"@annotation(org.springframework.web.bind.annotation.PutMapping) || " +
"@annotation(org.springframework.web.bind.annotation.DeleteMapping)",
throwing = "ex")
//@AfterThrowing(pointcut = "@annotation(org.springframework.web.bind.annotation.PostMapping) || " +
// "@annotation(org.springframework.web.bind.annotation.GetMapping) || " +
// "@annotation(org.springframework.web.bind.annotation.PutMapping) || " +
// "@annotation(org.springframework.web.bind.annotation.DeleteMapping)",
// throwing = "ex")
public void rollbackTransaction(Exception ex) {
TransactionStatus status = transactionStatus.get();
if (status != null && !status.isCompleted()) {