添加租户id相关逻辑(预留)
This commit is contained in:
parent
0f2782dacb
commit
eb722d84e3
@ -138,4 +138,5 @@ public class PipPipeline extends PipBaseElement {
|
||||
* 机器id
|
||||
* */
|
||||
private String machineId;
|
||||
private Long tenantId;
|
||||
}
|
||||
|
@ -109,7 +109,8 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
List<PipTask> pipTaskList = new ArrayList<>(0);
|
||||
|
||||
PipPipeline pipeline = pipelineConverter.reqToDO(pipelineReq);
|
||||
|
||||
Long tenantId = WebFrameworkUtils.getLoginUser().getTenantId();
|
||||
pipeline.setTenantId(tenantId);
|
||||
// 随机颜色
|
||||
int randomNumber = (int)(Math.random() * 5) + 1;
|
||||
pipeline.setColor(randomNumber);
|
||||
|
@ -40,6 +40,14 @@ public class WebFrameworkUtils {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public static LoginUser getLoginUser() {
|
||||
try {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
return (LoginUser) authentication.getPrincipal();
|
||||
} catch (Exception e){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public static String getLoginUserIdStr(){
|
||||
Long loginUserId = getLoginUserId();
|
||||
if (loginUserId!=null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user