代码提交

This commit is contained in:
huangzj
2023-09-22 14:10:22 +08:00
parent bbde473929
commit 4f4df0f663
8 changed files with 129 additions and 45 deletions

View File

@@ -26,6 +26,12 @@ public class AppInfoSetParam {
@ApiModelProperty(value = "设备告警")
private Integer alarmInfo;
@ApiModelProperty("是否开启出厂调试0false 1true")
private Integer exFactoryBug;
@ApiModelProperty("是否开启功能调试0false 1true")
private Integer functionBug;
@Data
@EqualsAndHashCode(callSuper = true)
public static class AppInfoSetUpdateParam extends AppInfoSetParam {

View File

@@ -50,5 +50,11 @@ public class AppInfoSet {
@ApiModelProperty("设备告警")
private Integer alarmInfo;
@ApiModelProperty("是否开启出厂调试0false 1true")
private Integer exFactoryBug;
@ApiModelProperty("是否开启功能调试0false 1true")
private Integer functionBug;
}

View File

@@ -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()) {

View File

@@ -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 {