代码提交
This commit is contained in:
@@ -5,8 +5,12 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.redis.pojo.enums.RedisKeyEnum;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.user.enums.AppRoleEnum;
|
||||
import com.njcn.user.enums.UserResponseEnum;
|
||||
import com.njcn.user.pojo.po.Role;
|
||||
import com.njcn.user.pojo.po.UserRole;
|
||||
import com.njcn.user.pojo.po.app.AppInfoSet;
|
||||
import com.njcn.user.service.IAppInfoSetService;
|
||||
import com.njcn.user.service.IAppRoleService;
|
||||
import com.njcn.user.service.IRoleService;
|
||||
import com.njcn.user.service.IUserRoleService;
|
||||
@@ -33,7 +37,7 @@ public class AppRoleServiceImpl implements IAppRoleService {
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
private final IRoleService roleService;
|
||||
|
||||
private final IAppInfoSetService iAppInfoSetService;
|
||||
private final IUserRoleService userRoleService;
|
||||
|
||||
@Override
|
||||
@@ -47,10 +51,18 @@ public class AppRoleServiceImpl implements IAppRoleService {
|
||||
if (Objects.isNull(map.get(referralCode))){
|
||||
throw new BusinessException(UserResponseEnum.REFERRAL_CODE_ERROR);
|
||||
}
|
||||
Role roleByCode = roleService.getRoleByCode(map.get(referralCode));
|
||||
//修改用户和角色的关系
|
||||
LambdaUpdateWrapper<UserRole> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.eq(UserRole::getUserId,userId).set(UserRole::getRoleId,roleService.getRoleByCode(map.get(referralCode)).getId());
|
||||
lambdaUpdateWrapper.eq(UserRole::getUserId,userId).set(UserRole::getRoleId,roleByCode.getId());
|
||||
userRoleService.update(lambdaUpdateWrapper);
|
||||
if(Objects.equals(roleByCode.getCode(), AppRoleEnum.ENGINEERING_USER)){
|
||||
iAppInfoSetService.lambdaUpdate().
|
||||
eq(AppInfoSet::getUserId,userId).
|
||||
set(AppInfoSet::getExFactoryBug,1).
|
||||
set(AppInfoSet::getFunctionBug,1).
|
||||
update();
|
||||
}
|
||||
//重新生成新的推荐码
|
||||
// LinkedHashMap<String,String> roleMap = new LinkedHashMap<>();
|
||||
// for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
|
||||
@@ -142,6 +142,8 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, User> impleme
|
||||
appInfoSet.setEventInfo(1);
|
||||
appInfoSet.setRunInfo(1);
|
||||
appInfoSet.setAlarmInfo(1);
|
||||
appInfoSet.setFunctionBug(0);
|
||||
appInfoSet.setExFactoryBug(0);
|
||||
appInfoSetService.save(appInfoSet);
|
||||
//发送用户初始密码
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user