fix: 优化注册逻辑

This commit is contained in:
tangwei 2026-08-04 11:33:57 +08:00
parent 2f32a220f4
commit b404aab8ad

View File

@ -306,6 +306,8 @@ public class SmsVerifyCodeController {
// 已通过电站权限处理过的电站编码 // 已通过电站权限处理过的电站编码
Set<String> processedStationCodes = new HashSet<>(); Set<String> processedStationCodes = new HashSet<>();
// 已通过电站分组处理过的流域编码用于后续差集判断
Set<String> processedBasinCodes = new HashSet<>();
if (!selectedStations.isEmpty()) { if (!selectedStations.isEmpty()) {
// 4. 按流域分组{rvcd -> Set<stcd>} // 4. 按流域分组{rvcd -> Set<stcd>}
@ -345,6 +347,7 @@ public class SmsVerifyCodeController {
} }
} }
processedStationCodes.addAll(selectedInThisBasin); processedStationCodes.addAll(selectedInThisBasin);
processedBasinCodes.add(basinCode);
} }
} }
@ -355,7 +358,17 @@ public class SmsVerifyCodeController {
} }
} }
// 7. 分配默认角色 // 7. 处理前端传了流域但该流域下未匹配到任何选中电站的情况直接保存流域权限
String rvcdCode = smsVerifyCodeRequest.getRvcdCode();
if (StringUtils.isNotEmpty(rvcdCode)) {
for (String basinCode : rvcdCode.split(",")) {
if (StringUtils.isNotEmpty(basinCode) && !processedBasinCodes.contains(basinCode)) {
addDataScope(userId, "RVCD", basinCode);
}
}
}
// 8. 分配默认角色
assignRoleToUser(userId); assignRoleToUser(userId);
return true; return true;
} }