feat:(REQ-3342) 用户添加角色时,personId为0时,增加告警
This commit is contained in:
parent
738eb72bbd
commit
ced714a9fa
@ -39,6 +39,7 @@ import cn.axzo.tyr.client.model.roleuser.req.RoleUserReq;
|
|||||||
import cn.axzo.tyr.client.model.roleuser.req.SuperAdminParam;
|
import cn.axzo.tyr.client.model.roleuser.req.SuperAdminParam;
|
||||||
import cn.axzo.tyr.client.model.roleuser.req.WorkerManagerRoleUserReq;
|
import cn.axzo.tyr.client.model.roleuser.req.WorkerManagerRoleUserReq;
|
||||||
import cn.axzo.tyr.client.model.vo.SaasRoleGroupVO;
|
import cn.axzo.tyr.client.model.vo.SaasRoleGroupVO;
|
||||||
|
import cn.axzo.tyr.server.common.util.DingTalkUtil;
|
||||||
import cn.axzo.tyr.server.config.MqProducer;
|
import cn.axzo.tyr.server.config.MqProducer;
|
||||||
import cn.axzo.tyr.server.event.payload.SaasRoleUserRelationUpsertPayload;
|
import cn.axzo.tyr.server.event.payload.SaasRoleUserRelationUpsertPayload;
|
||||||
import cn.axzo.tyr.server.model.RoleUserInfo;
|
import cn.axzo.tyr.server.model.RoleUserInfo;
|
||||||
@ -58,6 +59,7 @@ import cn.axzo.tyr.server.service.SaasRoleGroupService;
|
|||||||
import cn.axzo.tyr.server.service.SaasRoleUserRelationService;
|
import cn.axzo.tyr.server.service.SaasRoleUserRelationService;
|
||||||
import cn.axzo.tyr.server.service.SaasRoleUserService;
|
import cn.axzo.tyr.server.service.SaasRoleUserService;
|
||||||
import cn.axzo.tyr.server.utils.RpcExternalUtil;
|
import cn.axzo.tyr.server.utils.RpcExternalUtil;
|
||||||
|
import cn.azxo.framework.common.constatns.Constants;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
@ -69,6 +71,7 @@ import com.google.common.collect.Sets;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.BooleanUtils;
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
|
import org.slf4j.MDC;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -124,7 +127,12 @@ public class RoleUserService implements SaasRoleUserService {
|
|||||||
|
|
||||||
@Value("#{${axzo.role.superAdmin}}")
|
@Value("#{${axzo.role.superAdmin}}")
|
||||||
private Map<Integer, String> superAdminCodes;
|
private Map<Integer, String> superAdminCodes;
|
||||||
|
@Value("${spring.profiles.active}")
|
||||||
|
private String env;
|
||||||
|
|
||||||
|
// 更新角色时,personId = 0的情况,线上有很多这样的数据,要排查到原因
|
||||||
|
private static final String ACCESS_TOKEN = "11cdf26d77211ee887184844910bf249b94aa2675c7ce36d75a7aa87d619490f";
|
||||||
|
private static final String SECRET = "SEC3c1be9e4fe4cc09f16eb4b2eebf91659f21d5bdfb1d764b52f3e47825e6bed3f";
|
||||||
/**
|
/**
|
||||||
* 获取分包负责人等特殊角色
|
* 获取分包负责人等特殊角色
|
||||||
* @return
|
* @return
|
||||||
@ -305,6 +313,20 @@ public class RoleUserService implements SaasRoleUserService {
|
|||||||
.build())
|
.build())
|
||||||
.build();
|
.build();
|
||||||
mqProducer.send(event);
|
mqProducer.send(event);
|
||||||
|
|
||||||
|
// 历史有的记录personId = 0,故加上告警,排查问题
|
||||||
|
if (Objects.isNull(req.getPersonId()) || Objects.equals(req.getPersonId(), 0L)) {
|
||||||
|
String traceId = MDC.get(Constants.CTX_LOG_ID_MDC);
|
||||||
|
StringBuilder sb = new StringBuilder()
|
||||||
|
.append("环境:").append(env).append("\n")
|
||||||
|
.append("添加用户角色时,personId异常")
|
||||||
|
.append("personId:")
|
||||||
|
.append(req.getPersonId())
|
||||||
|
.append("\n")
|
||||||
|
.append("traceId:")
|
||||||
|
.append(traceId);
|
||||||
|
DingTalkUtil.sendMessage(sb.toString(), ACCESS_TOKEN, SECRET);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user