6 changed files with 54 additions and 9 deletions
@ -0,0 +1,35 @@ |
|||
package com.ccsens.carbasics.service; |
|||
|
|||
import com.ccsens.carbasics.bean.dto.ProjectDto; |
|||
import com.ccsens.util.bean.dto.QueryDto; |
|||
import com.ccsens.util.message.SwitchoverProjectUtil; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.scheduling.annotation.Async; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Propagation; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.HashSet; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: whj |
|||
* @time: 2021/9/9 15:37 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@Async |
|||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
|||
public class AsyncService implements IAsyncService { |
|||
@Override |
|||
public void switchProject(QueryDto<ProjectDto.SwitchProject> params) throws Exception { |
|||
log.info("开始接受切换项目"); |
|||
Thread.sleep(1000); |
|||
log.info("切换项目"); |
|||
Set<String> userIds = new HashSet<>(); |
|||
userIds.add(params.getUserId().toString()); |
|||
ProjectDto.SwitchProject param = params.getParam(); |
|||
SwitchoverProjectUtil.switchoverProject(userIds,param.getProjectId(), param.getUrl()); |
|||
} |
|||
} |
@ -0,0 +1,11 @@ |
|||
package com.ccsens.carbasics.service; |
|||
|
|||
import com.ccsens.carbasics.bean.dto.ProjectDto; |
|||
import com.ccsens.util.bean.dto.QueryDto; |
|||
|
|||
public interface IAsyncService { |
|||
/** |
|||
* 通知TALL切换项目 |
|||
* */ |
|||
void switchProject(QueryDto<ProjectDto.SwitchProject> params) throws Exception; |
|||
} |
@ -1,4 +1,4 @@ |
|||
spring: |
|||
profiles: |
|||
active: test |
|||
include: common, util-test |
|||
active: prod |
|||
include: common, util-prod |
|||
|
Loading…
Reference in new issue