diff --git a/src/backend/commons/common-iam/src/main/java/com/tencent/bk/job/common/iam/aspect/IamAppTransferAspect.java b/src/backend/commons/common-iam/src/main/java/com/tencent/bk/job/common/iam/aspect/IamAppTransferAspect.java index c7e0371b41..a5be08ab2b 100644 --- a/src/backend/commons/common-iam/src/main/java/com/tencent/bk/job/common/iam/aspect/IamAppTransferAspect.java +++ b/src/backend/commons/common-iam/src/main/java/com/tencent/bk/job/common/iam/aspect/IamAppTransferAspect.java @@ -24,15 +24,18 @@ public IamAppTransferAspect(AppScopeMappingService appScopeMappingService) { this.appScopeMappingService = appScopeMappingService; } - @Pointcut("execution (* com.tencent.bk.job.common.iam.service.impl.BusinessAuthServiceImpl.auth*(..))") + @Pointcut("within(com.tencent.bk.job.common.iam.service.impl.BusinessAuthServiceImpl) " + + "&& execution (* com.tencent.bk.job.common.iam.service.impl.BusinessAuthServiceImpl.auth*(..))") public void processAuthBusinessAction() { } - @Pointcut("execution (* com.tencent.bk.job.*.auth..impl.*.auth*(..))") + @Pointcut("within(com.tencent.bk.job..*) " + + "&& execution (* com.tencent.bk.job.*.auth..impl.*.auth*(..))") public void processAuthResourceAction() { } - @Pointcut("execution (* com.tencent.bk.job.*.auth..impl.*.batchAuth*(..))") + @Pointcut("within(com.tencent.bk.job..*) " + + "&& execution (* com.tencent.bk.job.*.auth..impl.*.batchAuth*(..))") public void processBatchAuthResourceAction() { } diff --git a/src/backend/commons/common-iam/src/main/java/com/tencent/bk/job/common/iam/aspect/IamCallbackAspect.java b/src/backend/commons/common-iam/src/main/java/com/tencent/bk/job/common/iam/aspect/IamCallbackAspect.java index 1ed0279e5a..fef1c67f9f 100644 --- a/src/backend/commons/common-iam/src/main/java/com/tencent/bk/job/common/iam/aspect/IamCallbackAspect.java +++ b/src/backend/commons/common-iam/src/main/java/com/tencent/bk/job/common/iam/aspect/IamCallbackAspect.java @@ -15,7 +15,7 @@ public class IamCallbackAspect { public IamCallbackAspect() { } - @Pointcut("execution (* com.tencent.bk.job.*.api.iam.impl.*.callback(..))") + @Pointcut("within(com.tencent.bk.job..*) && execution (* com.tencent.bk.job.*.api.iam.impl.*.callback(..))") public void processCallbackRequest() { } diff --git a/src/backend/commons/common-iam/src/main/java/com/tencent/bk/job/common/iam/aspect/IamExceptionHandleAspect.java b/src/backend/commons/common-iam/src/main/java/com/tencent/bk/job/common/iam/aspect/IamExceptionHandleAspect.java index 758e50adac..2fce0bd86b 100644 --- a/src/backend/commons/common-iam/src/main/java/com/tencent/bk/job/common/iam/aspect/IamExceptionHandleAspect.java +++ b/src/backend/commons/common-iam/src/main/java/com/tencent/bk/job/common/iam/aspect/IamExceptionHandleAspect.java @@ -17,11 +17,13 @@ @Aspect public class IamExceptionHandleAspect { - @Pointcut("execution (* com.tencent.bk.sdk.iam.service.impl.PolicyServiceImpl.*(..))") + @Pointcut("within(com.tencent.bk.sdk.iam.service.impl.PolicyServiceImpl) " + + "&& execution (* com.tencent.bk.sdk.iam.service.impl.PolicyServiceImpl.*(..))") public void processPolicyServiceAction() { } - @Pointcut("execution (* com.tencent.bk.sdk.iam.helper.AuthHelper.isAllowed(..))") + @Pointcut("within(com.tencent.bk.sdk.iam.helper.AuthHelper) " + + "&& execution (* com.tencent.bk.sdk.iam.helper.AuthHelper.isAllowed(..))") public void processIsAllowedAction() { } diff --git a/src/backend/commons/common-mysql/src/main/java/com/tencent/bk/job/common/mysql/config/JobMySQLAutoConfiguration.java b/src/backend/commons/common-mysql/src/main/java/com/tencent/bk/job/common/mysql/JobTransactional.java similarity index 70% rename from src/backend/commons/common-mysql/src/main/java/com/tencent/bk/job/common/mysql/config/JobMySQLAutoConfiguration.java rename to src/backend/commons/common-mysql/src/main/java/com/tencent/bk/job/common/mysql/JobTransactional.java index 84ce6a243f..93a177417d 100644 --- a/src/backend/commons/common-mysql/src/main/java/com/tencent/bk/job/common/mysql/config/JobMySQLAutoConfiguration.java +++ b/src/backend/commons/common-mysql/src/main/java/com/tencent/bk/job/common/mysql/JobTransactional.java @@ -22,18 +22,23 @@ * IN THE SOFTWARE. */ -package com.tencent.bk.job.common.mysql.config; +package com.tencent.bk.job.common.mysql; -import org.jooq.DSLContext; -import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.context.annotation.Configuration; +import org.springframework.core.annotation.AliasFor; +import org.springframework.transaction.TransactionDefinition; +import org.springframework.transaction.annotation.Transactional; -import javax.sql.DataSource; +/** + * Job 自定义事务注解 + */ +@Transactional +public @interface JobTransactional { + @AliasFor(annotation = Transactional.class) + String transactionManager(); -@Configuration(proxyBeanMethods = false) -@ConditionalOnClass(DSLContext.class) -@ConditionalOnBean(DataSource.class) -public class JobMySQLAutoConfiguration { + @AliasFor(annotation = Transactional.class) + Class[] rollbackFor() default {Throwable.class}; + @AliasFor(annotation = Transactional.class) + int timeout() default TransactionDefinition.TIMEOUT_DEFAULT; } diff --git a/src/backend/commons/common-mysql/src/main/resources/META-INF/spring.factories b/src/backend/commons/common-mysql/src/main/resources/META-INF/spring.factories deleted file mode 100644 index a4c653a47a..0000000000 --- a/src/backend/commons/common-mysql/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,2 +0,0 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -com.tencent.bk.job.common.mysql.config.JobMySQLAutoConfiguration diff --git a/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/aspects/EsbAppResourceScopeReqAspect.java b/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/aspects/EsbAppResourceScopeReqAspect.java index 5348ed92af..bd40a0a1bb 100644 --- a/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/aspects/EsbAppResourceScopeReqAspect.java +++ b/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/aspects/EsbAppResourceScopeReqAspect.java @@ -43,7 +43,7 @@ public EsbAppResourceScopeReqAspect(AppScopeMappingService appScopeMappingServic this.appScopeMappingService = appScopeMappingService; } - @Before("execution(* com.tencent.bk.job.*.api.esb..*.*(..)))") + @Before("within(com.tencent.bk.job..*) && execution(* com.tencent.bk.job.*.api.esb..*.*(..)))") public void handleAppScopeReq(JoinPoint joinPoint) { Object[] args = joinPoint.getArgs(); for (Object arg : args) { diff --git a/src/backend/commons/esb-sdk/src/main/java/com/tencent/bk/job/common/esb/metrics/EsbApiTimedAspect.java b/src/backend/commons/esb-sdk/src/main/java/com/tencent/bk/job/common/esb/metrics/EsbApiTimedAspect.java index 156bd6b8ba..bbb3f8a96c 100644 --- a/src/backend/commons/esb-sdk/src/main/java/com/tencent/bk/job/common/esb/metrics/EsbApiTimedAspect.java +++ b/src/backend/commons/esb-sdk/src/main/java/com/tencent/bk/job/common/esb/metrics/EsbApiTimedAspect.java @@ -63,7 +63,7 @@ public static Tag exception(Throwable exception) { return EXCEPTION_NONE; } - @Around("execution (@com.tencent.bk.job.common.esb.metrics.EsbApiTimed * *.*(..))") + @Around("within(com.tencent.bk.job..*) && execution (@com.tencent.bk.job.common.esb.metrics.EsbApiTimed * *.*(..))") public Object timedMethod(ProceedingJoinPoint pjp) throws Throwable { RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); HttpServletRequest request = null; diff --git a/src/backend/job-crontab/service-job-crontab/build.gradle b/src/backend/job-crontab/service-job-crontab/build.gradle index d76a4fe324..edede030db 100644 --- a/src/backend/job-crontab/service-job-crontab/build.gradle +++ b/src/backend/job-crontab/service-job-crontab/build.gradle @@ -28,6 +28,7 @@ dependencies { api project(":commons:common-redis") api project(":commons:common-web") api project(':commons:common-security') + api project(':commons:common-mysql') api project(":job-execute:api-job-execute") api project(":job-manage:api-job-manage") api project(":job-crontab:api-job-crontab") diff --git a/src/backend/job-crontab/service-job-crontab/src/main/java/com/tencent/bk/job/crontab/api/inner/impl/ServiceCronJobResourceImpl.java b/src/backend/job-crontab/service-job-crontab/src/main/java/com/tencent/bk/job/crontab/api/inner/impl/ServiceCronJobResourceImpl.java index c25381fd65..635aa24855 100644 --- a/src/backend/job-crontab/service-job-crontab/src/main/java/com/tencent/bk/job/crontab/api/inner/impl/ServiceCronJobResourceImpl.java +++ b/src/backend/job-crontab/service-job-crontab/src/main/java/com/tencent/bk/job/crontab/api/inner/impl/ServiceCronJobResourceImpl.java @@ -28,6 +28,7 @@ import com.tencent.bk.job.common.exception.InvalidParamException; import com.tencent.bk.job.common.model.BaseSearchCondition; import com.tencent.bk.job.common.model.InternalResponse; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.common.util.JobContextUtil; import com.tencent.bk.job.common.util.date.DateUtils; import com.tencent.bk.job.common.util.json.JsonUtils; @@ -43,7 +44,6 @@ import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.RestController; import java.util.HashMap; @@ -116,7 +116,7 @@ public InternalResponse>> batchListCronJobByPlanIds(Lo } @Override - @Transactional(value = "jobCrontabTransactionManager", rollbackFor = {Throwable.class}) + @JobTransactional(transactionManager = "jobCrontabTransactionManager") public InternalResponse saveCronJobWithId(String username, Long appId, Long cronJobId, Long createTime, Long lastModifyTime, String lastModifyUser, CronJobCreateUpdateReq cronJobCreateUpdateReq) { diff --git a/src/backend/job-crontab/service-job-crontab/src/main/java/com/tencent/bk/job/crontab/service/impl/CronJobBatchLoadServiceImpl.java b/src/backend/job-crontab/service-job-crontab/src/main/java/com/tencent/bk/job/crontab/service/impl/CronJobBatchLoadServiceImpl.java index 56651c45e1..6b06290653 100644 --- a/src/backend/job-crontab/service-job-crontab/src/main/java/com/tencent/bk/job/crontab/service/impl/CronJobBatchLoadServiceImpl.java +++ b/src/backend/job-crontab/service-job-crontab/src/main/java/com/tencent/bk/job/crontab/service/impl/CronJobBatchLoadServiceImpl.java @@ -24,6 +24,7 @@ package com.tencent.bk.job.crontab.service.impl; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.crontab.model.dto.CronJobBasicInfoDTO; import com.tencent.bk.job.crontab.service.CronJobBatchLoadService; import com.tencent.bk.job.crontab.service.CronJobService; @@ -31,7 +32,6 @@ import org.slf4j.helpers.MessageFormatter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; @@ -48,7 +48,7 @@ public CronJobBatchLoadServiceImpl(CronJobService cronJobService) { } @Override - @Transactional(rollbackFor = {Exception.class, Error.class}, timeout = 30) + @JobTransactional(transactionManager = "jobCrontabTransactionManager", timeout = 30) public CronLoadResult batchLoadCronToQuartz(int start, int limit) { int successNum = 0; int failedNum = 0; diff --git a/src/backend/job-crontab/service-job-crontab/src/main/java/com/tencent/bk/job/crontab/service/impl/CronJobServiceImpl.java b/src/backend/job-crontab/service-job-crontab/src/main/java/com/tencent/bk/job/crontab/service/impl/CronJobServiceImpl.java index fbb5c3c680..f2a302b02c 100644 --- a/src/backend/job-crontab/service-job-crontab/src/main/java/com/tencent/bk/job/crontab/service/impl/CronJobServiceImpl.java +++ b/src/backend/job-crontab/service-job-crontab/src/main/java/com/tencent/bk/job/crontab/service/impl/CronJobServiceImpl.java @@ -42,6 +42,7 @@ import com.tencent.bk.job.common.model.PageData; import com.tencent.bk.job.common.model.dto.AppResourceScope; import com.tencent.bk.job.common.model.dto.HostDTO; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.common.util.JobContextUtil; import com.tencent.bk.job.common.util.date.DateUtils; import com.tencent.bk.job.common.util.json.JsonUtils; @@ -84,7 +85,6 @@ import org.slf4j.helpers.MessageFormatter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import java.sql.Date; import java.time.Instant; @@ -200,7 +200,7 @@ public boolean updateCronJobErrorById(CronJobInfoDTO cronJobErrorInfo) { } @Override - @Transactional(value = "jobCrontabTransactionManager", rollbackFor = {Exception.class, Error.class}) + @JobTransactional(transactionManager = "jobCrontabTransactionManager") @ActionAuditRecord( actionId = ActionId.CREATE_CRON, instance = @AuditInstanceRecord( @@ -227,7 +227,7 @@ public CronJobInfoDTO createCronJobInfo(String username, CronJobInfoDTO cronJobI } @Override - @Transactional(rollbackFor = {Exception.class, Error.class}) + @JobTransactional(transactionManager = "jobCrontabTransactionManager") @ActionAuditRecord( actionId = ActionId.MANAGE_CRON, instance = @AuditInstanceRecord( @@ -393,7 +393,7 @@ public Boolean deleteCronJobInfo(String username, Long appId, Long cronJobId) { } @Override - @Transactional(value = "jobCrontabTransactionManager", rollbackFor = {Exception.class, Error.class}) + @JobTransactional(transactionManager = "jobCrontabTransactionManager") @ActionAuditRecord( actionId = ActionId.MANAGE_CRON, instance = @AuditInstanceRecord( @@ -452,7 +452,7 @@ public Boolean changeCronJobEnableStatus(String username, Long appId, Long cronJ } @Override - @Transactional(value = "jobCrontabTransactionManager", rollbackFor = {Exception.class, Error.class}) + @JobTransactional(transactionManager = "jobCrontabTransactionManager") public Boolean disableExpiredCronJob(Long appId, Long cronJobId, String lastModifyUser, Long lastModifyTime) { CronJobInfoDTO cronJobInfo = new CronJobInfoDTO(); cronJobInfo.setAppId(appId); @@ -508,7 +508,7 @@ public Map> listCronJobByPlanIds(Long appId, List filePathList, diff --git a/src/backend/job-file-gateway/service-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/service/impl/FileSourceTaskUpdateServiceImpl.java b/src/backend/job-file-gateway/service-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/service/impl/FileSourceTaskUpdateServiceImpl.java index 0b0e315443..cd9d8de360 100644 --- a/src/backend/job-file-gateway/service-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/service/impl/FileSourceTaskUpdateServiceImpl.java +++ b/src/backend/job-file-gateway/service-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/service/impl/FileSourceTaskUpdateServiceImpl.java @@ -26,6 +26,7 @@ import com.tencent.bk.job.common.constant.ErrorCode; import com.tencent.bk.job.common.exception.NotFoundException; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.common.util.ArrayUtil; import com.tencent.bk.job.common.util.file.FileSizeUtil; import com.tencent.bk.job.common.util.file.PathUtil; @@ -53,7 +54,6 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Date; @@ -95,7 +95,7 @@ public void addFileTaskStatusChangeListener(FileTaskStatusChangeListener listene } @Override - @Transactional(value = "jobFileGatewayTransactionManager", rollbackFor = {Throwable.class}) + @JobTransactional(transactionManager = "jobFileGatewayTransactionManager") public String updateFileSourceTask(String batchTaskId, String fileSourceTaskId, Long fileTaskId, diff --git a/src/backend/job-file-gateway/service-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/service/impl/FileWorkerServiceImpl.java b/src/backend/job-file-gateway/service-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/service/impl/FileWorkerServiceImpl.java index 0dbb7c72c0..65955388a6 100644 --- a/src/backend/job-file-gateway/service-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/service/impl/FileWorkerServiceImpl.java +++ b/src/backend/job-file-gateway/service-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/service/impl/FileWorkerServiceImpl.java @@ -25,6 +25,7 @@ package com.tencent.bk.job.file_gateway.service.impl; import com.fasterxml.jackson.core.type.TypeReference; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.common.util.json.JsonUtils; import com.tencent.bk.job.file_gateway.config.FileGatewayConfig; import com.tencent.bk.job.file_gateway.consts.WorkerSelectScopeEnum; @@ -41,7 +42,6 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.HashMap; @@ -71,7 +71,7 @@ public FileWorkerServiceImpl(FileWorkerDAO fileWorkerDAO, } @Override - @Transactional(value = "jobFileGatewayTransactionManager", rollbackFor = Throwable.class) + @JobTransactional(transactionManager = "jobFileGatewayTransactionManager") public Long heartBeat(FileWorkerDTO fileWorkerDTO) { Long id; String configStr = fileWorkerDTO.getConfigStr(); diff --git a/src/backend/job-manage/service-job-manage/build.gradle b/src/backend/job-manage/service-job-manage/build.gradle index 7448558124..93ef049c91 100644 --- a/src/backend/job-manage/service-job-manage/build.gradle +++ b/src/backend/job-manage/service-job-manage/build.gradle @@ -39,6 +39,7 @@ dependencies { api project(":commons:esb-sdk") api project(":commons:gse-sdk") api project(":commons:cmdb-sdk") + api project(":commons:common-mysql") implementation "org.springframework.boot:spring-boot-starter-web" implementation "org.springframework.boot:spring-boot-starter-jdbc" implementation "org.springframework.boot:spring-boot-starter-jooq" diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/inner/impl/ServiceAccountResourceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/inner/impl/ServiceAccountResourceImpl.java index 9c679f7795..bc8fff5d0e 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/inner/impl/ServiceAccountResourceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/inner/impl/ServiceAccountResourceImpl.java @@ -33,6 +33,7 @@ import com.tencent.bk.job.common.model.InternalResponse; import com.tencent.bk.job.common.model.Response; import com.tencent.bk.job.common.model.dto.AppResourceScope; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.common.service.AppScopeMappingService; import com.tencent.bk.job.common.util.ArrayUtil; import com.tencent.bk.job.common.util.date.DateUtils; @@ -45,7 +46,6 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.RestController; import java.util.ArrayList; @@ -135,7 +135,7 @@ private ServiceAccountDTO toServiceAccountDTO(AccountDTO accountDTO) { } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = {Throwable.class}) + @JobTransactional(transactionManager = "jobManageTransactionManager") public InternalResponse saveOrGetAccount(String username, Long createTime, Long lastModifyTime, String lastModifyUser, Long appId, AccountCreateUpdateReq accountCreateUpdateReq) { diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/inner/impl/ServiceScriptResourceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/inner/impl/ServiceScriptResourceImpl.java index 3f4290c50c..d44e11b617 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/inner/impl/ServiceScriptResourceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/inner/impl/ServiceScriptResourceImpl.java @@ -29,6 +29,7 @@ import com.tencent.bk.job.common.exception.NotFoundException; import com.tencent.bk.job.common.i18n.service.MessageI18nService; import com.tencent.bk.job.common.model.InternalResponse; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.common.util.ArrayUtil; import com.tencent.bk.job.manage.api.common.ScriptDTOBuilder; import com.tencent.bk.job.manage.api.inner.ServiceScriptResource; @@ -41,7 +42,6 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.RestController; @RestController @@ -99,7 +99,7 @@ public InternalResponse getScriptByScriptVersionId(Long script } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = {Throwable.class}) + @JobTransactional(transactionManager = "jobManageTransactionManager") public InternalResponse> createScriptWithVersionId(String username, Long createTime, Long lastModifyTime, String lastModifyUser, Integer scriptStatus, Long appId, diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/inner/impl/ServiceTaskPlanResourceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/inner/impl/ServiceTaskPlanResourceImpl.java index 60368856bf..823b0fa420 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/inner/impl/ServiceTaskPlanResourceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/inner/impl/ServiceTaskPlanResourceImpl.java @@ -30,6 +30,7 @@ import com.tencent.bk.job.common.exception.InvalidParamException; import com.tencent.bk.job.common.exception.NotFoundException; import com.tencent.bk.job.common.model.InternalResponse; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.common.util.json.JsonUtils; import com.tencent.bk.job.manage.api.inner.ServiceTaskPlanResource; import com.tencent.bk.job.manage.common.consts.task.TaskFileTypeEnum; @@ -68,7 +69,6 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.RestController; import java.util.ArrayList; @@ -206,7 +206,7 @@ public InternalResponse getPlanById(Long appId, Long planId, } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = {Throwable.class}) + @JobTransactional(transactionManager = "jobManageTransactionManager") public InternalResponse createPlanWithIdForMigration( String username, Long appId, diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/inner/impl/ServiceTaskTemplateResourceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/inner/impl/ServiceTaskTemplateResourceImpl.java index 908487bc54..f52f7c89fb 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/inner/impl/ServiceTaskTemplateResourceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/inner/impl/ServiceTaskTemplateResourceImpl.java @@ -34,6 +34,7 @@ import com.tencent.bk.job.common.model.InternalResponse; import com.tencent.bk.job.common.model.PageData; import com.tencent.bk.job.common.model.dto.AppResourceScope; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.common.util.JobContextUtil; import com.tencent.bk.job.common.util.json.JsonUtils; import com.tencent.bk.job.manage.api.inner.ServiceTaskTemplateResource; @@ -59,7 +60,6 @@ import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.RestController; import java.util.ArrayList; @@ -132,7 +132,7 @@ public InternalResponse getTemplateNameById(Long templateId) { } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = {Throwable.class}) + @JobTransactional(transactionManager = "jobManageTransactionManager") public InternalResponse saveTemplateForMigration( String username, Long appId, diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebTaskTemplateResourceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebTaskTemplateResourceImpl.java index 00e99df1f6..0cd92dd8bb 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebTaskTemplateResourceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebTaskTemplateResourceImpl.java @@ -39,6 +39,7 @@ import com.tencent.bk.job.common.model.Response; import com.tencent.bk.job.common.model.ValidateResult; import com.tencent.bk.job.common.model.dto.AppResourceScope; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.manage.api.web.WebTaskTemplateResource; import com.tencent.bk.job.manage.auth.TemplateAuthService; import com.tencent.bk.job.manage.common.consts.TemplateTypeEnum; @@ -62,7 +63,6 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.RestController; import java.util.ArrayList; @@ -256,7 +256,7 @@ public Response createTemplate(String username, } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = {Exception.class, Error.class}) + @JobTransactional(transactionManager = "jobManageTransactionManager") @AuditEntry( actionId = ActionId.DELETE_JOB_TEMPLATE, subActionIds = {ActionId.DELETE_JOB_PLAN} diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/config/listener/NotifyInitListener.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/config/listener/NotifyInitListener.java index ebba6abbdb..b46c8e1c50 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/config/listener/NotifyInitListener.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/config/listener/NotifyInitListener.java @@ -24,6 +24,7 @@ package com.tencent.bk.job.manage.config.listener; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.common.paas.cmsi.CmsiApiClient; import com.tencent.bk.job.common.paas.model.EsbNotifyChannelDTO; import com.tencent.bk.job.common.util.StringUtil; @@ -48,7 +49,6 @@ import org.springframework.context.annotation.Profile; import org.springframework.lang.NonNull; import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; import java.util.ArrayList; @@ -134,7 +134,7 @@ private void initDefaultNotifyChannels() { saveDefaultNotifyChannelsToDb(esbNotifyChannelDTOList); } - @Transactional(value = "jobManageTransactionManager", rollbackFor = Throwable.class) + @JobTransactional(transactionManager = "jobManageTransactionManager") public void saveDefaultNotifyChannelsToDb(List esbNotifyChannelDTOList) { if (!globalSettingsService.isNotifyChannelConfiged()) { globalSettingsService.setNotifyChannelConfiged(); diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/dao/customsetting/UserCustomSettingDAO.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/dao/customsetting/UserCustomSettingDAO.java index 13ec8bc7fd..dcca7c9d6a 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/dao/customsetting/UserCustomSettingDAO.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/dao/customsetting/UserCustomSettingDAO.java @@ -24,6 +24,7 @@ package com.tencent.bk.job.manage.dao.customsetting; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.common.util.ListUtil; import com.tencent.bk.job.manage.model.dto.customsetting.UserCustomSettingDTO; import com.tencent.bk.job.manage.model.tables.UserCustomSetting; @@ -38,7 +39,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Arrays; @@ -60,7 +60,7 @@ public UserCustomSettingDAO(@Qualifier("job-manage-dsl-context") DSLContext dslC this.dslContext = dslContext; } - @Transactional(value = "jobManageTransactionManager") + @JobTransactional(transactionManager = "jobManageTransactionManager") public int batchSave(List customSettingList) { List keyList = extractKeyList(customSettingList); Set existKeys = new HashSet<>(listExistKeys(keyList)); diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/dao/globalsetting/impl/GlobalSettingDAOImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/dao/globalsetting/impl/GlobalSettingDAOImpl.java index 0884bb827a..e37a5a5e68 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/dao/globalsetting/impl/GlobalSettingDAOImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/dao/globalsetting/impl/GlobalSettingDAOImpl.java @@ -24,6 +24,7 @@ package com.tencent.bk.job.manage.dao.globalsetting.impl; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.manage.dao.globalsetting.GlobalSettingDAO; import com.tencent.bk.job.manage.model.dto.GlobalSettingDTO; import com.tencent.bk.job.manage.model.tables.GlobalSetting; @@ -34,7 +35,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; import java.util.concurrent.atomic.AtomicInteger; @@ -52,7 +52,7 @@ public GlobalSettingDAOImpl(@Qualifier("job-manage-dsl-context") DSLContext dslC } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = Throwable.class) + @JobTransactional(transactionManager = "jobManageTransactionManager") public int upsertGlobalSetting(GlobalSettingDTO globalSettingDTO) { AtomicInteger affectedNum = new AtomicInteger(0); deleteGlobalSetting(globalSettingDTO.getKey()); diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/dao/impl/ApplicationHostDAOImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/dao/impl/ApplicationHostDAOImpl.java index 3d18ed5d69..e5a87d1638 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/dao/impl/ApplicationHostDAOImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/dao/impl/ApplicationHostDAOImpl.java @@ -36,6 +36,7 @@ import com.tencent.bk.job.common.model.dto.HostSimpleDTO; import com.tencent.bk.job.common.model.dto.HostStatusNumStatisticsDTO; import com.tencent.bk.job.common.model.dto.ResourceScope; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.common.util.StringUtil; import com.tencent.bk.job.common.util.TagUtils; import com.tencent.bk.job.manage.common.TopologyHelper; @@ -71,7 +72,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Collection; @@ -998,7 +998,7 @@ public int batchUpdateHostsBeforeLastTime(List hostList) { return affectedNum; } - @Transactional(value = "jobManageTransactionManager") + @JobTransactional(transactionManager = "jobManageTransactionManager") @Override public int deleteHostBeforeOrEqualLastTime(Long bizId, Long hostId, Long lastTime) { int affectedNum; @@ -1019,7 +1019,7 @@ public int deleteHostBeforeOrEqualLastTime(Long bizId, Long hostId, Long lastTim return affectedNum; } - @Transactional(value = "jobManageTransactionManager") + @JobTransactional(transactionManager = "jobManageTransactionManager") @Override public int batchDeleteHostById(List hostIdList) { if (CollectionUtils.isEmpty(hostIdList)) { @@ -1036,7 +1036,7 @@ public int batchDeleteHostById(List hostIdList) { .execute(); } - @Transactional(value = "jobManageTransactionManager") + @JobTransactional(transactionManager = "jobManageTransactionManager") @Override public int batchDeleteBizHostInfoById(Long bizId, List hostIdList) { int affectedNum = 0; diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/dao/plan/impl/TaskPlanVariableDAOImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/dao/plan/impl/TaskPlanVariableDAOImpl.java index b8057fab7e..2fddf2b985 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/dao/plan/impl/TaskPlanVariableDAOImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/dao/plan/impl/TaskPlanVariableDAOImpl.java @@ -29,6 +29,7 @@ import com.tencent.bk.job.common.constant.TaskVariableTypeEnum; import com.tencent.bk.job.common.crypto.scenario.CipherVariableCryptoService; import com.tencent.bk.job.common.exception.InternalException; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.manage.dao.TaskVariableDAO; import com.tencent.bk.job.manage.model.dto.task.TaskVariableDTO; import com.tencent.bk.job.manage.model.tables.TaskPlanVariable; @@ -48,7 +49,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Collections; @@ -249,7 +249,7 @@ public boolean batchInsertVariableWithId(List variableList) { } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = {Exception.class, Error.class}) + @JobTransactional(transactionManager = "jobManageTransactionManager") public boolean updateVariableByName(TaskVariableDTO variable) { List conditions = new ArrayList<>(); conditions.add(TABLE.PLAN_ID.equal(ULong.valueOf(variable.getPlanId()))); diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/dao/whiteip/impl/WhiteIPRecordDAOImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/dao/whiteip/impl/WhiteIPRecordDAOImpl.java index 642a15a6a0..6a6df1e75b 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/dao/whiteip/impl/WhiteIPRecordDAOImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/dao/whiteip/impl/WhiteIPRecordDAOImpl.java @@ -29,6 +29,7 @@ import com.tencent.bk.job.common.model.BaseSearchCondition; import com.tencent.bk.job.common.model.dto.ApplicationDTO; import com.tencent.bk.job.common.model.dto.HostDTO; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.common.util.CustomCollectionUtils; import com.tencent.bk.job.manage.common.util.JooqDataTypeUtil; import com.tencent.bk.job.manage.dao.ApplicationDAO; @@ -71,7 +72,6 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.dao.DataRetrievalFailureException; import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Collection; @@ -142,7 +142,7 @@ private static OrderField buildOrderField(TableField field, Integer ord } @SuppressWarnings("all") - @Transactional(value = "jobManageTransactionManager") + @JobTransactional(transactionManager = "jobManageTransactionManager") @Override public Long insertWhiteIPRecord(WhiteIPRecordDTO whiteIPRecordDTO) { //插入Record表 @@ -194,7 +194,7 @@ public Long insertWhiteIPRecord(WhiteIPRecordDTO whiteIPRecordDTO) { return recordId; } - @Transactional(value = "jobManageTransactionManager") + @JobTransactional(transactionManager = "jobManageTransactionManager") @Override public int deleteWhiteIPRecordById(Long id) { //删关联表 @@ -435,7 +435,7 @@ private Long countWhiteIPRecordByConditions(List conditions) { return query.fetchOne(0, Long.class); } - @Transactional(value = "jobManageTransactionManager") + @JobTransactional(transactionManager = "jobManageTransactionManager") @Override public int updateWhiteIPRecordById(WhiteIPRecordDTO whiteIPRecordDTO) { //更新Record表 diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/migration/AddHostIdForTemplateAndPlanMigrationTask.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/migration/AddHostIdForTemplateAndPlanMigrationTask.java index 248e5da2c9..7bc5a736ac 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/migration/AddHostIdForTemplateAndPlanMigrationTask.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/migration/AddHostIdForTemplateAndPlanMigrationTask.java @@ -28,6 +28,7 @@ import com.tencent.bk.job.common.constant.TaskVariableTypeEnum; import com.tencent.bk.job.common.exception.InternalException; import com.tencent.bk.job.common.model.dto.ApplicationHostDTO; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.common.util.json.JsonUtils; import com.tencent.bk.job.manage.model.dto.task.TaskHostNodeDTO; import com.tencent.bk.job.manage.model.dto.task.TaskTargetDTO; @@ -58,7 +59,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StopWatch; import java.util.ArrayList; @@ -442,7 +442,7 @@ public List listTaskTargets(List appIdList, Long fromRec } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = {Throwable.class}) + @JobTransactional(transactionManager = "jobManageTransactionManager") public void updateTaskTargets(List records) { if (CollectionUtils.isEmpty(records)) { return; @@ -648,7 +648,7 @@ public List listTaskTargets(List appIdList, Long fromRec } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = {Throwable.class}) + @JobTransactional(transactionManager = "jobManageTransactionManager") public void updateTaskTargets(List records) { if (CollectionUtils.isEmpty(records)) { return; diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/migration/ResourceTagsMigrationTask.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/migration/ResourceTagsMigrationTask.java index 2baacc7062..7bcf6fddf5 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/migration/ResourceTagsMigrationTask.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/migration/ResourceTagsMigrationTask.java @@ -26,6 +26,7 @@ import com.tencent.bk.job.common.constant.JobResourceTypeEnum; import com.tencent.bk.job.common.model.Response; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.manage.dao.ResourceTagDAO; import com.tencent.bk.job.manage.dao.ScriptDAO; import com.tencent.bk.job.manage.dao.template.TaskTemplateDAO; @@ -36,7 +37,6 @@ import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; @@ -92,7 +92,7 @@ public Response> execute() { return Response.buildSuccessResp(resourceTags); } - @Transactional(value = "jobManageTransactionManager", rollbackFor = {Throwable.class}) + @JobTransactional(transactionManager = "jobManageTransactionManager") public void saveResourceTags(List resourceTags) { resourceTagDAO.batchSaveResourceTags(resourceTags); } diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/AbstractTaskStepService.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/AbstractTaskStepService.java index 6d53aa72e3..83445f7d5e 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/AbstractTaskStepService.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/AbstractTaskStepService.java @@ -29,6 +29,7 @@ import com.tencent.bk.job.common.exception.InternalException; import com.tencent.bk.job.common.exception.InvalidParamException; import com.tencent.bk.job.common.exception.ServiceException; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.common.util.json.JsonUtils; import com.tencent.bk.job.manage.common.consts.task.TaskFileTypeEnum; import com.tencent.bk.job.manage.common.consts.task.TaskScriptSourceEnum; @@ -49,7 +50,6 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.HashMap; @@ -160,7 +160,7 @@ private void fillRefScriptContent(Map scriptStepMap) { * @return 新增的步骤 ID * @throws ServiceException 新增步骤异常 */ - @Transactional(value = "jobManageTransactionManager", rollbackFor = ServiceException.class) + @JobTransactional(transactionManager = "jobManageTransactionManager") public long insertStep(TaskStepDTO taskStep) throws ServiceException { try { Long stepId = taskStepDAO.insertStep(taskStep); @@ -240,7 +240,7 @@ public long insertStep(TaskStepDTO taskStep) throws ServiceException { * @return 是否更新成功 * @throws ServiceException 更新异常 */ - @Transactional(value = "jobManageTransactionManager", rollbackFor = ServiceException.class) + @JobTransactional(transactionManager = "jobManageTransactionManager") public boolean updateStepById(TaskStepDTO taskStep) throws ServiceException { try { if (taskStepDAO.updateStepById(taskStep)) { @@ -328,7 +328,7 @@ public boolean updateStepById(TaskStepDTO taskStep) throws ServiceException { * @return 是否删除成功 * @throws ServiceException 删除异常 */ - @Transactional(value = "jobManageTransactionManager", rollbackFor = ServiceException.class) + @JobTransactional(transactionManager = "jobManageTransactionManager") public boolean deleteStepById(Long parentId, Long id) throws ServiceException { try { TaskStepDTO taskStep = taskStepDAO.getStepById(parentId, id); diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/host/impl/HostServiceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/host/impl/HostServiceImpl.java index a60a6a8df7..26bf640c37 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/host/impl/HostServiceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/host/impl/HostServiceImpl.java @@ -36,6 +36,7 @@ import com.tencent.bk.job.common.model.dto.HostDTO; import com.tencent.bk.job.common.model.dto.HostSimpleDTO; import com.tencent.bk.job.common.model.dto.ResourceScope; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.common.util.JobContextUtil; import com.tencent.bk.job.common.util.ip.IpUtils; import com.tencent.bk.job.manage.common.TopologyHelper; @@ -51,7 +52,6 @@ import org.apache.commons.lang3.tuple.Pair; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StopWatch; import java.util.ArrayList; @@ -183,7 +183,7 @@ public int updateHostsStatus(List simpleHostList) { return updateCount; } - @Transactional(value = "jobManageTransactionManager") + @JobTransactional(transactionManager = "jobManageTransactionManager") @Override public Pair createOrUpdateHostBeforeLastTime(ApplicationHostDTO hostInfoDTO) { boolean needToCreate = false; diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/DangerousRuleServiceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/DangerousRuleServiceImpl.java index 97453b3e1e..c28cc839a3 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/DangerousRuleServiceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/DangerousRuleServiceImpl.java @@ -29,6 +29,7 @@ import com.tencent.bk.job.common.constant.ErrorCode; import com.tencent.bk.job.common.exception.InternalException; import com.tencent.bk.job.common.iam.constant.ActionId; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.manage.common.consts.EnableStatusEnum; import com.tencent.bk.job.manage.dao.globalsetting.DangerousRuleDAO; import com.tencent.bk.job.manage.manager.cache.DangerousRuleCache; @@ -41,7 +42,6 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.stream.Collectors; @@ -113,7 +113,7 @@ public DangerousRuleDTO updateDangerousRule(String username, AddOrUpdateDangerou @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = Throwable.class) + @JobTransactional(transactionManager = "jobManageTransactionManager") @ActionAuditRecord( actionId = ActionId.HIGH_RISK_DETECT_RULE, content = EventContentConstants.EDIT_HIGH_RISK_DETECT_RULE @@ -173,7 +173,7 @@ public Integer moveDangerousRule(String username, MoveDangerousRuleReq req) { } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = Throwable.class) + @JobTransactional(transactionManager = "jobManageTransactionManager") @ActionAuditRecord( actionId = ActionId.HIGH_RISK_DETECT_RULE, content = EventContentConstants.DELETE_HIGH_RISK_DETECT_RULE diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/GlobalSettingsServiceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/GlobalSettingsServiceImpl.java index c0577cb9c2..fa5930cb80 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/GlobalSettingsServiceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/GlobalSettingsServiceImpl.java @@ -33,6 +33,7 @@ import com.tencent.bk.job.common.i18n.locale.LocaleUtils; import com.tencent.bk.job.common.i18n.service.MessageI18nService; import com.tencent.bk.job.common.iam.constant.ActionId; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.common.notice.config.BkNoticeProperties; import com.tencent.bk.job.common.util.JobContextUtil; import com.tencent.bk.job.common.util.StringUtil; @@ -95,7 +96,6 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.info.BuildProperties; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; import java.util.ArrayList; @@ -698,7 +698,7 @@ public Map getJobConfig(String username) { } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = {Throwable.class}) + @JobTransactional(transactionManager = "jobManageTransactionManager") @ActionAuditRecord( actionId = ActionId.GLOBAL_SETTINGS, content = EventContentConstants.EDIT_GLOBAL_SETTINGS diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/ScriptManagerImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/ScriptManagerImpl.java index 90085b7233..035d3e613f 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/ScriptManagerImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/ScriptManagerImpl.java @@ -37,6 +37,7 @@ import com.tencent.bk.job.common.iam.model.AuthResult; import com.tencent.bk.job.common.model.PageData; import com.tencent.bk.job.common.model.dto.AppResourceScope; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.common.util.JobUUID; import com.tencent.bk.job.common.util.date.DateUtils; import com.tencent.bk.job.common.util.json.JsonUtils; @@ -74,7 +75,6 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Collection; @@ -370,7 +370,7 @@ public ScriptDTO updateScriptVersion(ScriptDTO scriptVersion) { } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = Throwable.class) + @JobTransactional(transactionManager = "jobManageTransactionManager") public Pair createScriptWithVersionId( Long appId, ScriptDTO script, @@ -447,7 +447,7 @@ public void saveScriptVersionToDB(ScriptDTO script) { } @Override - @Transactional(rollbackFor = {Exception.class, Error.class}) + @JobTransactional(transactionManager = "jobManageTransactionManager") public void deleteScriptVersion(Long appId, Long scriptVersionId) { ScriptDTO existScript = scriptDAO.getScriptVersionById(scriptVersionId); checkDeleteScriptPermission(appId, existScript); @@ -469,7 +469,7 @@ private void checkScriptReferenced(ScriptDTO script) { } @Override - @Transactional(rollbackFor = {Exception.class, Error.class}) + @JobTransactional(transactionManager = "jobManageTransactionManager") public void deleteScript(Long appId, String scriptId) { ScriptDTO existScript = getScript(appId, scriptId); checkDeleteScriptPermission(appId, existScript); @@ -915,7 +915,7 @@ private void fillSyncResultDetail(Long syncScriptVersionId, List listPageTags(TagDTO tagQuery, BaseSearchCondition baseSe } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = Throwable.class) + @JobTransactional(transactionManager = "jobManageTransactionManager") @ActionAuditRecord( actionId = ActionId.MANAGE_TAG, instance = @AuditInstanceRecord( @@ -352,7 +352,7 @@ public boolean batchSaveResourceTags(List resourceTags) { } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = {Exception.class, Error.class}) + @JobTransactional(transactionManager = "jobManageTransactionManager") public void batchPatchResourceTags(List addResourceTags, List deleteResourceTags) { StopWatch watch = new StopWatch("batchPatchResourceTags"); diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/notify/NotifyServiceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/notify/NotifyServiceImpl.java index 0310a34e55..33a228d626 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/notify/NotifyServiceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/notify/NotifyServiceImpl.java @@ -31,6 +31,7 @@ import com.tencent.bk.job.common.iam.constant.ActionId; import com.tencent.bk.job.common.model.dto.UserRoleInfoDTO; import com.tencent.bk.job.common.model.vo.NotifyChannelVO; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.common.redis.util.LockUtils; import com.tencent.bk.job.common.util.Counter; import com.tencent.bk.job.common.util.I18nUtil; @@ -83,7 +84,6 @@ import org.slf4j.helpers.MessageFormatter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StopWatch; import java.time.LocalDateTime; @@ -264,7 +264,7 @@ private void saveTriggerPolicy(String operator, } @Override - @Transactional(value = "jobManageTransactionManager") + @JobTransactional(transactionManager = "jobManageTransactionManager") public Long saveAppDefaultNotifyPoliciesToLocal(String operator, Long appId, String triggerUser, NotifyPoliciesCreateUpdateReq createUpdateReq) { val policyList = createUpdateReq.getTriggerPoliciesList(); @@ -391,7 +391,7 @@ public List listAvailableNotifyChannel(String username) { } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = Throwable.class) + @JobTransactional(transactionManager = "jobManageTransactionManager") public Integer setAvailableNotifyChannel(String username, SetAvailableNotifyChannelReq req) { List channelCodeList = Arrays.asList(req.getChannelCodeStr().trim().split(NotifyConsts.SEPERATOR_COMMA)); diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/plan/impl/TaskPlanServiceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/plan/impl/TaskPlanServiceImpl.java index 242639f3b1..1d1e393b86 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/plan/impl/TaskPlanServiceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/plan/impl/TaskPlanServiceImpl.java @@ -40,6 +40,7 @@ import com.tencent.bk.job.common.model.BaseSearchCondition; import com.tencent.bk.job.common.model.PageData; import com.tencent.bk.job.common.model.dto.AppResourceScope; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.common.util.JobContextUtil; import com.tencent.bk.job.common.util.PageUtil; import com.tencent.bk.job.common.util.date.DateUtils; @@ -68,7 +69,6 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Collection; @@ -285,7 +285,7 @@ public TaskPlanInfoDTO getTaskPlan(String username, Long appId, Long planId) { } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = Throwable.class) + @JobTransactional(transactionManager = "jobManageTransactionManager") @ActionAuditRecord( actionId = ActionId.CREATE_JOB_PLAN, instance = @AuditInstanceRecord( @@ -360,7 +360,7 @@ private void checkDeletePlanPermission(String username, long appId, long templat } @Override - @Transactional(rollbackFor = Throwable.class) + @JobTransactional(transactionManager = "jobManageTransactionManager") @ActionAuditRecord( actionId = ActionId.EDIT_JOB_PLAN, instance = @AuditInstanceRecord( @@ -378,7 +378,7 @@ public TaskPlanInfoDTO updateTaskPlan(String username, TaskPlanInfoDTO taskPlanI } @Override - @Transactional(rollbackFor = Throwable.class) + @JobTransactional(transactionManager = "jobManageTransactionManager") public TaskPlanInfoDTO updateDebugTaskPlan(String username, TaskPlanInfoDTO taskPlanInfo) { // 调试作业模版会保存一份内置的执行方案;从用户角度来说仍然还是在处理跟模版相关的操作,所以使用模版查看鉴权 templateAuthService.authViewJobTemplate(username, @@ -461,7 +461,7 @@ public TaskPlanInfoDTO deleteTaskPlan(String username, Long appId, Long template } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = Throwable.class) + @JobTransactional(transactionManager = "jobManageTransactionManager") public TaskPlanInfoDTO getDebugTaskPlan(String username, Long appId, Long templateId) { TaskPlanInfoDTO taskPlan = taskPlanDAO.getDebugTaskPlan(appId, templateId); TaskTemplateInfoDTO taskTemplateInfo = taskTemplateService.getTaskTemplateBasicInfoById(appId, templateId); @@ -570,7 +570,7 @@ public Boolean checkPlanName(Long appId, Long templateId, Long planId, String na } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = {Exception.class, Error.class}) + @JobTransactional(transactionManager = "jobManageTransactionManager") @ActionAuditRecord( actionId = ActionId.SYNC_JOB_PLAN, instance = @AuditInstanceRecord( @@ -650,7 +650,7 @@ public Boolean sync(Long appId, Long templateId, Long planId, String templateVer } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = {Exception.class, Error.class}) + @JobTransactional(transactionManager = "jobManageTransactionManager") public void syncPlan(TaskPlanInfoDTO taskPlanInfo) { try { // process plan id @@ -802,7 +802,7 @@ public boolean checkPlanId(Long planId) { } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = {Exception.class, Error.class}) + @JobTransactional(transactionManager = "jobManageTransactionManager") public Long saveTaskPlanForBackup(TaskPlanInfoDTO taskPlanInfo) { try { TaskPlanInfoDTO taskPlanByName = taskPlanDAO.getTaskPlanByName(taskPlanInfo.getAppId(), @@ -911,7 +911,7 @@ public Set listLocalFiles() { } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = {Exception.class, Error.class}) + @JobTransactional(transactionManager = "jobManageTransactionManager") @ActionAuditRecord( actionId = ActionId.EDIT_JOB_PLAN, instance = @AuditInstanceRecord( diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/plan/impl/TaskPlanVariableServiceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/plan/impl/TaskPlanVariableServiceImpl.java index 2520015af3..70ba85776f 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/plan/impl/TaskPlanVariableServiceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/plan/impl/TaskPlanVariableServiceImpl.java @@ -24,6 +24,7 @@ package com.tencent.bk.job.manage.service.plan.impl; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.manage.dao.TaskVariableDAO; import com.tencent.bk.job.manage.model.dto.task.TaskVariableDTO; import com.tencent.bk.job.manage.service.AbstractTaskVariableService; @@ -32,7 +33,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import java.util.List; @@ -54,7 +54,7 @@ public TaskVariableDTO getVariableById(Long parentId, Long id) { } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = {Exception.class, Error.class}) + @JobTransactional(transactionManager = "jobManageTransactionManager") public boolean batchUpdateVariableByName(List variableList) { if (CollectionUtils.isEmpty(variableList)) { return false; diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/template/impl/TaskTemplateServiceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/template/impl/TaskTemplateServiceImpl.java index 9ba131eb76..611d1474fe 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/template/impl/TaskTemplateServiceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/template/impl/TaskTemplateServiceImpl.java @@ -42,6 +42,7 @@ import com.tencent.bk.job.common.model.BaseSearchCondition; import com.tencent.bk.job.common.model.PageData; import com.tencent.bk.job.common.model.dto.AppResourceScope; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.common.redis.util.LockUtils; import com.tencent.bk.job.common.util.JobContextUtil; import com.tencent.bk.job.common.util.PageUtil; @@ -80,7 +81,6 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Collections; @@ -351,7 +351,7 @@ private void authCreateTemplate(String username, long appId) { } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = ServiceException.class) + @JobTransactional(transactionManager = "jobManageTransactionManager") @ActionAuditRecord( actionId = ActionId.CREATE_JOB_TEMPLATE, instance = @AuditInstanceRecord( @@ -369,7 +369,7 @@ public TaskTemplateInfoDTO saveTaskTemplate(String username, TaskTemplateInfoDTO } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = Throwable.class) + @JobTransactional(transactionManager = "jobManageTransactionManager") @ActionAuditRecord( actionId = ActionId.EDIT_JOB_TEMPLATE, instance = @AuditInstanceRecord( @@ -574,7 +574,7 @@ public void createNewTagForTemplateIfNotExist(TaskTemplateInfoDTO taskTemplateIn } @Override - @Transactional(value = "jobManageTransactionManager") + @JobTransactional(transactionManager = "jobManageTransactionManager") @ActionAuditRecord( actionId = ActionId.DELETE_JOB_TEMPLATE, instance = @AuditInstanceRecord( @@ -737,7 +737,7 @@ public List getFavoredTemplateBasicInfo(Long appId, String } @Override - @Transactional(value = "jobManageTransactionManager", rollbackFor = Throwable.class) + @JobTransactional(transactionManager = "jobManageTransactionManager") public Long saveTaskTemplateForMigration( TaskTemplateInfoDTO taskTemplateInfo, Long createTime, diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/template/impl/TemplateStatusUpdateService.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/template/impl/TemplateStatusUpdateService.java index 6de08c2876..67368914f4 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/template/impl/TemplateStatusUpdateService.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/template/impl/TemplateStatusUpdateService.java @@ -26,6 +26,7 @@ import com.tencent.bk.job.common.constant.ErrorCode; import com.tencent.bk.job.common.exception.InvalidParamException; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.manage.common.consts.JobResourceStatusEnum; import com.tencent.bk.job.manage.dao.template.TaskTemplateDAO; import com.tencent.bk.job.manage.model.dto.ScriptStatusUpdateMessageDTO; @@ -47,7 +48,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.HashSet; @@ -150,7 +150,7 @@ void doUpdateStatus(String uuid, ScriptStatusUpdateMessageDTO scriptStatusUpdate } } - @Transactional(value = "jobManageTransactionManager", rollbackFor = {Exception.class, Error.class}) + @JobTransactional(transactionManager = "jobManageTransactionManager") public void processTemplateStatus(ULong templateId) { Result> records = context.select(STEP_SCRIPT_TABLE.ID, STEP_SCRIPT_TABLE.SCRIPT_VERSION_ID).from(STEP_SCRIPT_TABLE) @@ -226,7 +226,7 @@ private void processScriptStepStatus(Map templateScriptVersionMap, } } - @Transactional(value = "jobManageTransactionManager", rollbackFor = {Exception.class, Error.class}) + @JobTransactional(transactionManager = "jobManageTransactionManager") public void updateTemplateStatus(ULong templateId, int scriptStatus) { taskTemplateDAO.updateTemplateStatus(templateId, scriptStatus); } diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/task/EsbUserInfoUpdateTask.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/task/EsbUserInfoUpdateTask.java index 561e3017c2..6d3ec60685 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/task/EsbUserInfoUpdateTask.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/task/EsbUserInfoUpdateTask.java @@ -25,6 +25,7 @@ package com.tencent.bk.job.manage.task; import com.tencent.bk.job.common.model.dto.BkUserDTO; +import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.common.paas.user.UserMgrApiClient; import com.tencent.bk.job.common.redis.util.LockUtils; import com.tencent.bk.job.common.redis.util.RedisKeyHeartBeatThread; @@ -40,7 +41,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StopWatch; import java.util.ArrayList; @@ -154,7 +154,7 @@ public boolean execute() { return true; } - @Transactional(value = "jobManageTransactionManager", rollbackFor = Throwable.class) + @JobTransactional(transactionManager = "jobManageTransactionManager") public void saveEsbUserInfos(Set deleteSet, Set insertSet) { deleteSet.forEach(esbUserInfoDTO -> esbUserInfoDAO.deleteEsbUserInfoById( esbUserInfoDTO.getId()));