同步客商数据BUG修改
This commit is contained in:
+32
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user