fix: 优化逻辑

This commit is contained in:
tangwei 2026-04-30 18:06:59 +08:00
parent 956aaccfb2
commit 294e34dbbf
4 changed files with 53 additions and 43 deletions

View File

@ -865,10 +865,17 @@ public class FishDraftDataController {
warnings.add("rstcd");
}
if (data.getBaseId() != null && !data.getBaseId().isEmpty()) {
String baseId = fishImportService.resolveBaseCode(data.getBaseId(), data.getBaseName());
// if (data.getBaseId() != null && !data.getBaseId().isEmpty()) {
// String baseId = fishImportService.resolveBaseCode(data.getBaseId(), data.getBaseName());
// if (baseId == null) {
// warnings.add("baseId");
// }
// }
if (data.getHbrvcd() != null && !data.getHbrvcd().isEmpty()) {
String baseId = fishImportService.resolveHbrvcdCode(data.getHbrvcd(), data.getHbrvnm());
if (baseId == null) {
warnings.add("baseId");
warnings.add("hbrvcd");
}
}
@ -879,16 +886,16 @@ public class FishDraftDataController {
}
}
if (data.getHbrvcd() != null && !data.getHbrvcd().isEmpty()) {
String hbrvcd = fishImportService.resolveHbrvcdCode(data.getRvcd(), data.getRvcd());
if (hbrvcd == null) {
warnings.add("hbrvcd");
}
}
// if (data.getHbrvcd() != null && !data.getHbrvcd().isEmpty()) {
// String hbrvcd = fishImportService.resolveHbrvcdCode(data.getHbrvcd(), data.getRvcd());
// if (hbrvcd == null) {
// warnings.add("hbrvcd");
// }
// }
if (data.getTm() == null) {
warnings.add("tm");
}
// if (data.getTm() == null) {
// warnings.add("tm");
// }
if (data.getFtp() == null || data.getFtp().isEmpty()) {
warnings.add("ftp");
@ -929,9 +936,9 @@ public class FishDraftDataController {
}
}
if (StringUtils.hasText(data.getBaseId()) && StringUtils.hasText(data.getRstcd())) {
if (!fishImportService.validateStationBelongsToBase(data.getRstcd(), data.getBaseId())) {
warnings.add("baseId");
if (StringUtils.hasText(data.getHbrvcd()) && StringUtils.hasText(data.getRstcd())) {
if (!fishImportService.validateStationBelongsToBase(data.getRstcd(), data.getHbrvcd())) {
warnings.add("hbrvcd");
warnings.add("rstcd");
}
}

View File

@ -439,10 +439,10 @@ public class FishImportServiceImpl implements IFishImportService {
private void validateStationFpssRelation(FishDraftData data, FishImportResult.FishImportRow importRow) {
loadStationAndBaseCache();
if (StringUtils.hasText(data.getBaseId()) && StringUtils.hasText(data.getRstcd())) {
if (!validateStationBelongsToBase(data.getRstcd(), data.getBaseId())) {
if (!importRow.getWarnings().contains("baseId")) {
importRow.getWarnings().add("baseId");
if (StringUtils.hasText(data.getHbrvcd()) && StringUtils.hasText(data.getRstcd())) {
if (!validateStationBelongsToBase(data.getRstcd(), data.getHbrvcd())) {
if (!importRow.getWarnings().contains("hbrvcd")) {
importRow.getWarnings().add("hbrvcd");
}
if (!importRow.getWarnings().contains("rstcd")) {
importRow.getWarnings().add("rstcd");
@ -454,8 +454,8 @@ public class FishImportServiceImpl implements IFishImportService {
}
if (StringUtils.hasText(data.getRstcd()) && StringUtils.hasText(data.getStcd())) {
if (!validateFpssBelongsToStation(data.getStcd(), data.getRstcd())) {
if (!importRow.getWarnings().contains("baseId")) {
importRow.getWarnings().add("baseId");
if (!importRow.getWarnings().contains("hbrvcd")) {
importRow.getWarnings().add("hbrvcd");
}
if (!importRow.getWarnings().contains("stcd")) {
importRow.getWarnings().add("stcd");
@ -479,7 +479,7 @@ public class FishImportServiceImpl implements IFishImportService {
STATION_CODE_TO_NAME_CACHE.put(station.getStcd().trim().toLowerCase(), station.getEnnm().trim().toLowerCase());
}
if (StringUtils.hasText(station.getBaseId())) {
STATION_TO_BASE_CACHE.put(station.getStcd().trim().toLowerCase(), station.getBaseId());
STATION_TO_BASE_CACHE.put(station.getStcd().trim().toLowerCase(), station.getHbrvcd());
}
}
}

View File

@ -204,7 +204,7 @@ public class SmsVerifyCodeController {
selectedBasinCodes.addAll(Arrays.asList(hbrvcdCode.split(",")));
}
Set<String> addedStationCodes = new HashSet<>();
// Set<String> addedStationCodes = new HashSet<>();
for (String basinCode : selectedBasinCodes) {
if (StringUtils.isEmpty(basinCode)) {
@ -241,7 +241,7 @@ public class SmsVerifyCodeController {
scope.setStatus(1);
scope.setPermissionType("READ");
sysUserDataScopeService.addDataScope(scope);
addedStationCodes.add(basinCode);
// addedStationCodes.add(basinCode);
} else {
Set<String> stationsInBasinAndSelected = allStationCodesInBasin.stream()
.filter(selectedStationCodes::contains)
@ -255,27 +255,27 @@ public class SmsVerifyCodeController {
scope.setStatus(1);
scope.setPermissionType("READ");
sysUserDataScopeService.addDataScope(scope);
addedStationCodes.add(stationCd);
// addedStationCodes.add(stationCd);
}
}
}
Set<String> standaloneStations = selectedStationCodes.stream()
.filter(code -> !addedStationCodes.contains(code))
.collect(Collectors.toSet());
for (String stationCd : standaloneStations) {
if (StringUtils.isEmpty(stationCd)) {
continue;
}
SysUserDataScope scope = new SysUserDataScope();
scope.setUserId(userId);
scope.setOrgType("STATION");
scope.setOrgId(stationCd);
scope.setStatus(1);
scope.setPermissionType("READ");
sysUserDataScopeService.addDataScope(scope);
}
// Set<String> standaloneStations = selectedStationCodes.stream()
// .filter(code -> !addedStationCodes.contains(code))
// .collect(Collectors.toSet());
//
// for (String stationCd : standaloneStations) {
// if (StringUtils.isEmpty(stationCd)) {
// continue;
// }
// SysUserDataScope scope = new SysUserDataScope();
// scope.setUserId(userId);
// scope.setOrgType("STATION");
// scope.setOrgId(stationCd);
// scope.setStatus(1);
// scope.setPermissionType("READ");
// sysUserDataScopeService.addDataScope(scope);
// }
SysUser user = new SysUser();
user.setId(userId);
userService.updateUserRoles( user,"c13481a486c9ee559cf305284df4d207");
@ -316,9 +316,12 @@ public class SmsVerifyCodeController {
} catch (Exception e) {
return ResponseResult.error("密码解密失败");
}
String encodePassword = existUser.getPassword();
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
String encryptedPassword = passwordEncoder.encode(password);
if (passwordEncoder.matches(password, encodePassword)) {
return ResponseResult.error("新密码不能与旧密码相同");
}
boolean success = userService.updatePasswordByPhone(phone, encryptedPassword);
if (success) {
return ResponseResult.success();

View File

@ -74,7 +74,7 @@
sys_user u
WHERE
1 = 1
AND ( ( u.REG_STATUS != 0 AND u.REG_STATUS != 2 ) OR u.REG_STATUS IS NULL )
AND ( ( u.REG_STATUS != 'PENDING' AND u.REG_STATUS != 'REJECTED' ) OR u.REG_STATUS IS NULL )
AND u.usertype != 0
<if test="orgid != null">
and u.orgid = #{orgid}