客户修改和删除BUG修改
This commit is contained in:
+28
-16
@@ -539,17 +539,17 @@ public class UserWlhyDomainService {
|
||||
roleDo.setOrganizationId(userEntity.getOrganizationId());
|
||||
RoleEntity roleEntity = roleDomainService.selectByOrganizationIdAndRoleCode(roleDo);
|
||||
if (roleEntity != null) {
|
||||
UserRoleDo userRoleDo = new UserRoleDo();
|
||||
userRoleDo.setUserId(userEntity.getUserId());
|
||||
userRoleDo.setRoleId(roleEntity.getRoleId());
|
||||
userRoleIds.add(String.valueOf(roleEntity.getRoleId()));
|
||||
userRoleNames.add(userEntity.getRoleName());
|
||||
userRoleCodes.add(userEntity.getRoleCode());
|
||||
userRoleNames.add(roleEntity.getRoleName());
|
||||
userRoleCodes.add(roleEntity.getRoleCode());
|
||||
}
|
||||
}
|
||||
platformUserDTO.setRoleIds(userRoleIds);
|
||||
platformUserDTO.setRoleNames(userRoleNames);
|
||||
platformUserDTO.setRoleCodes(userRoleCodes);
|
||||
// 本组织无 must 角色时勿用空列表覆盖 addPlatformUser 已设置的角色,否则网货侧 selectOne 会命中全表
|
||||
if (!userRoleIds.isEmpty()) {
|
||||
platformUserDTO.setRoleIds(userRoleIds);
|
||||
platformUserDTO.setRoleNames(userRoleNames);
|
||||
platformUserDTO.setRoleCodes(userRoleCodes);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -609,17 +609,29 @@ public class UserWlhyDomainService {
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean deleteBatchPlatformUser(List<Long> szwlUserIds){
|
||||
// 检查ids是否为空
|
||||
if (szwlUserIds == null || szwlUserIds.isEmpty()) {
|
||||
return true; // 如果列表为空,直接返回成功,避免SQL语法错误
|
||||
}
|
||||
//检查是否开启网货
|
||||
boolean flag = checkSwitch();
|
||||
if(!flag){
|
||||
//如果配置网货产品,返回跳过
|
||||
return true;
|
||||
}
|
||||
R<Boolean> result = wlhyServiceFeign.deleteBatchPlatformUser(szwlUserIds);
|
||||
boolean flag = checkSwitch();
|
||||
if (!flag) {
|
||||
return true;
|
||||
}
|
||||
// 仅删除网货中已存在的用户,避免远程生成 WHERE id IN () 导致语法错误
|
||||
List<Long> existInWlhyIds = new ArrayList<>();
|
||||
for (Long szwlUserId : szwlUserIds) {
|
||||
R<Long> wlhyUser = wlhyServiceFeign.getUserInfoBySzwlUserId(szwlUserId);
|
||||
if (R.FAIL == wlhyUser.getCode()) {
|
||||
log.warn("查询网货用户失败,跳过同步删除 szwlUserId={}: {}", szwlUserId, wlhyUser.getMsg());
|
||||
continue;
|
||||
}
|
||||
if (wlhyUser.getData() != null) {
|
||||
existInWlhyIds.add(szwlUserId);
|
||||
}
|
||||
}
|
||||
if (existInWlhyIds.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
R<Boolean> result = wlhyServiceFeign.deleteBatchPlatformUser(existInWlhyIds);
|
||||
if (R.FAIL == result.getCode()) {
|
||||
throw new ServiceException(result.getMsg());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user