同步客商数据BUG修改

This commit is contained in:
秦鸿展
2026-06-11 11:12:05 +08:00
parent b5f5f27b84
commit cc37974239
@@ -0,0 +1,32 @@
package com.mhd.user.application.service;
import com.mhd.common.redis.service.RedisLock;
import com.mhd.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Component
@Slf4j
public class AsyncUserShipperMasterDataSyncService {
@Resource
private UserShipperMasterDataSyncService userShipperMasterDataSyncService;
@Resource
private RedisLock redisLock;
@Async
public void syncMasterDataAsync(LoginUser loginUser, String lockKey) {
Long organizationId = loginUser.getUserPo().getOrganizationId();
try {
userShipperMasterDataSyncService.executeSync(loginUser);
} catch (Exception e) {
log.error("异步同步主数据失败, organizationId={}", organizationId, e);
userShipperMasterDataSyncService.markSyncFailed(organizationId, e.getMessage());
} finally {
redisLock.unlock(lockKey);
}
}
}