mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-14 21:52:07 +08:00
1、新增组织管理员删除限制;2、组织管理分页全称查询失败恢复;3、组织手机号验证放宽到校验未删除的组织;
This commit is contained in:
+3
@@ -8,6 +8,8 @@ import com.cf.imes.framework.common.exception.ErrorCode;
|
|||||||
* system 系统,使用 1-002-000-000 段
|
* system 系统,使用 1-002-000-000 段
|
||||||
*/
|
*/
|
||||||
public class ErrorCodeConstants {
|
public class ErrorCodeConstants {
|
||||||
|
private ErrorCodeConstants() {
|
||||||
|
}
|
||||||
|
|
||||||
// ========== AUTH 模块 1-002-000-000 ==========
|
// ========== AUTH 模块 1-002-000-000 ==========
|
||||||
public static final ErrorCode AUTH_LOGIN_BAD_CREDENTIALS = new ErrorCode(1_002_000_000, "auth.login.bad_credentials");
|
public static final ErrorCode AUTH_LOGIN_BAD_CREDENTIALS = new ErrorCode(1_002_000_000, "auth.login.bad_credentials");
|
||||||
@@ -55,6 +57,7 @@ public class ErrorCodeConstants {
|
|||||||
public static final ErrorCode USERNAME_MULTIPLE_ERROR = new ErrorCode(1_002_003_011, "user.username.multiple_error");
|
public static final ErrorCode USERNAME_MULTIPLE_ERROR = new ErrorCode(1_002_003_011, "user.username.multiple_error");
|
||||||
public static final ErrorCode USER_OPERATE_SELF_STATUS_ERROR = new ErrorCode(1_002_003_012, "user.operate_self_status_error");
|
public static final ErrorCode USER_OPERATE_SELF_STATUS_ERROR = new ErrorCode(1_002_003_012, "user.operate_self_status_error");
|
||||||
public static final ErrorCode USER_MOBILE_UPDATE_NOT_ALLOW_ERROR = new ErrorCode(1_002_003_013, "user.mobile_update_not_allow");
|
public static final ErrorCode USER_MOBILE_UPDATE_NOT_ALLOW_ERROR = new ErrorCode(1_002_003_013, "user.mobile_update_not_allow");
|
||||||
|
public static final ErrorCode ORGAN_ADMIN_USER_DELETE_NOT_ALLOW = new ErrorCode(1_002_003_014, "user.organ_admin_user.delete_not_allow");
|
||||||
|
|
||||||
// ========== 部门模块 1-002-004-000 ==========
|
// ========== 部门模块 1-002-004-000 ==========
|
||||||
public static final ErrorCode DEPT_NAME_DUPLICATE = new ErrorCode(1_002_004_000, "dept.name.duplicate");
|
public static final ErrorCode DEPT_NAME_DUPLICATE = new ErrorCode(1_002_004_000, "dept.name.duplicate");
|
||||||
|
|||||||
+4
@@ -24,6 +24,10 @@ public class OrganPageReqVO extends PageParam {
|
|||||||
@Size(max = 30, message = "联系人长度不能超过30个字符")
|
@Size(max = 30, message = "联系人长度不能超过30个字符")
|
||||||
private String contactName;
|
private String contactName;
|
||||||
|
|
||||||
|
@Schema(description = "组织名", example = "晨丰")
|
||||||
|
@Size(max = 30, message = "组织名长度不能超过30个字符")
|
||||||
|
private String exactName;
|
||||||
|
|
||||||
@Schema(description = "联系手机", example = "15601691300")
|
@Schema(description = "联系手机", example = "15601691300")
|
||||||
@Mobile
|
@Mobile
|
||||||
@Size(max = 11, message = "联系手机长度不能超过11个字符")
|
@Size(max = 11, message = "联系手机长度不能超过11个字符")
|
||||||
|
|||||||
+1
@@ -42,6 +42,7 @@ public interface OrganMapper extends BaseMapperX<OrganizationDO> {
|
|||||||
.likeIfPresent(OrganizationDO::getContactName, reqVO.getContactName())
|
.likeIfPresent(OrganizationDO::getContactName, reqVO.getContactName())
|
||||||
.likeIfPresent(OrganizationDO::getContactMobile, reqVO.getContactMobile())
|
.likeIfPresent(OrganizationDO::getContactMobile, reqVO.getContactMobile())
|
||||||
.eqIfPresent(OrganizationDO::getStatus, reqVO.getStatus())
|
.eqIfPresent(OrganizationDO::getStatus, reqVO.getStatus())
|
||||||
|
.eqIfPresent(OrganizationDO::getName, reqVO.getExactName())
|
||||||
.eqIfPresent(OrganizationDO::getProvince, reqVO.getProvince())
|
.eqIfPresent(OrganizationDO::getProvince, reqVO.getProvince())
|
||||||
.eqIfPresent(OrganizationDO::getCity, reqVO.getCity())
|
.eqIfPresent(OrganizationDO::getCity, reqVO.getCity())
|
||||||
.eqIfPresent(OrganizationDO::getCounty, reqVO.getCounty())
|
.eqIfPresent(OrganizationDO::getCounty, reqVO.getCounty())
|
||||||
|
|||||||
+8
@@ -180,4 +180,12 @@ public interface OrganService {
|
|||||||
* @param contactName
|
* @param contactName
|
||||||
*/
|
*/
|
||||||
void syncUserToOrgAdmin(Long id, String contactMobile, String contactName);
|
void syncUserToOrgAdmin(Long id, String contactMobile, String contactName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取组织管理员用户id
|
||||||
|
*
|
||||||
|
* @param id 组织id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Long getOrganAdmin(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-7
@@ -305,9 +305,7 @@ public class OrganServiceImpl implements OrganService {
|
|||||||
// 同步更新 token 管理的 token
|
// 同步更新 token 管理的 token
|
||||||
List<TokenConfigDO> tokenConfigDOS = tokenConfigMapper.selectConfigByOrganId(organId);
|
List<TokenConfigDO> tokenConfigDOS = tokenConfigMapper.selectConfigByOrganId(organId);
|
||||||
if (CollUtil.isNotEmpty(tokenConfigDOS)) {
|
if (CollUtil.isNotEmpty(tokenConfigDOS)) {
|
||||||
tokenConfigDOS.forEach(f -> {
|
tokenConfigDOS.forEach(f -> f.setAppToken(generateBaseToken(organId, currentOrgAdminMobile, f.getAppType(), jwtProperties.getSecret())));
|
||||||
f.setAppToken(generateBaseToken(organId, currentOrgAdminMobile, f.getAppType(), jwtProperties.getSecret()));
|
|
||||||
});
|
|
||||||
tokenConfigMapper.updateBatch(tokenConfigDOS);
|
tokenConfigMapper.updateBatch(tokenConfigDOS);
|
||||||
}
|
}
|
||||||
mobileChange = currentOrgAdminMobile;
|
mobileChange = currentOrgAdminMobile;
|
||||||
@@ -544,8 +542,6 @@ public class OrganServiceImpl implements OrganService {
|
|||||||
OrganizationDO tenant = getOrgan(OrganContextHolder.getRequiredOrganId());
|
OrganizationDO tenant = getOrgan(OrganContextHolder.getRequiredOrganId());
|
||||||
Set<Long> menuIds;
|
Set<Long> menuIds;
|
||||||
|
|
||||||
//menuIds = tenantPackageService.getTenantPackage(tenant.getPackageId()).getMenuIds();
|
|
||||||
|
|
||||||
if (isSystemTenant(tenant) || (SecurityFrameworkUtils.isCfOrg() && SecurityFrameworkUtils.isManageEndPoint())) { // 系统组织,菜单是全量的
|
if (isSystemTenant(tenant) || (SecurityFrameworkUtils.isCfOrg() && SecurityFrameworkUtils.isManageEndPoint())) { // 系统组织,菜单是全量的
|
||||||
menuIds = CollectionUtils.convertSet(menuService.getMenuList(), MenuDO::getId);
|
menuIds = CollectionUtils.convertSet(menuService.getMenuList(), MenuDO::getId);
|
||||||
} else {
|
} else {
|
||||||
@@ -749,7 +745,7 @@ public class OrganServiceImpl implements OrganService {
|
|||||||
|
|
||||||
|
|
||||||
List<String> machineIds = processSchemeConfigs.stream().map(ProcessSchemeConfig::getAnalyzer).distinct().toList();
|
List<String> machineIds = processSchemeConfigs.stream().map(ProcessSchemeConfig::getAnalyzer).distinct().toList();
|
||||||
List<MachineDO> machineDOS = machineMapper.selectBatchIds(machineIds);
|
List<MachineDO> machineDOS = machineMapper.selectByIds(machineIds);
|
||||||
if(CollUtil.isNotEmpty(machineDOS)){
|
if(CollUtil.isNotEmpty(machineDOS)){
|
||||||
machineDOS.forEach(f->{
|
machineDOS.forEach(f->{
|
||||||
f.setId(null);
|
f.setId(null);
|
||||||
@@ -762,7 +758,7 @@ public class OrganServiceImpl implements OrganService {
|
|||||||
|
|
||||||
|
|
||||||
List<Long> labelIds = machineDOS.stream().map(MachineDO::getLabelId).distinct().toList();
|
List<Long> labelIds = machineDOS.stream().map(MachineDO::getLabelId).distinct().toList();
|
||||||
List<LabelDO> labelDOS = labelMapper.selectBatchIds(labelIds);
|
List<LabelDO> labelDOS = labelMapper.selectByIds(labelIds);
|
||||||
if(CollUtil.isNotEmpty(labelDOS)){
|
if(CollUtil.isNotEmpty(labelDOS)){
|
||||||
labelDOS.forEach(f->{
|
labelDOS.forEach(f->{
|
||||||
f.setId(null);
|
f.setId(null);
|
||||||
@@ -851,4 +847,10 @@ public class OrganServiceImpl implements OrganService {
|
|||||||
.eq(OrganizationDO::getId, id)
|
.eq(OrganizationDO::getId, id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getOrganAdmin(Long id) {
|
||||||
|
OrganizationDO organizationDO = validOrgan(id);
|
||||||
|
return organizationDO.getContactUserId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-3
@@ -389,7 +389,9 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
// 不允许自身操作
|
// 不允许自身操作
|
||||||
checkCurrentWhenOperate(id);
|
checkCurrentWhenOperate(id);
|
||||||
// 校验用户存在
|
// 校验用户存在
|
||||||
validateUserExists(id);
|
AdminUserDO adminUserDO = validateUserExists(id);
|
||||||
|
// 不允许删除组织管理员
|
||||||
|
validateOrgAdmin(id, adminUserDO.getOrganId());
|
||||||
// 物理删除用户
|
// 物理删除用户
|
||||||
int deleteNum = userMapper.physicalDeleteById(id);
|
int deleteNum = userMapper.physicalDeleteById(id);
|
||||||
if (deleteNum > 0) {
|
if (deleteNum > 0) {
|
||||||
@@ -496,7 +498,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
if (CollUtil.isEmpty(ids)) {
|
if (CollUtil.isEmpty(ids)) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
return userMapper.selectBatchIds(ids);
|
return userMapper.selectByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -505,7 +507,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 获得用户信息
|
// 获得用户信息
|
||||||
List<AdminUserDO> users = userMapper.selectBatchIds(ids);
|
List<AdminUserDO> users = userMapper.selectByIds(ids);
|
||||||
Map<Long, AdminUserDO> userMap = CollectionUtils.convertMap(users, AdminUserDO::getId);
|
Map<Long, AdminUserDO> userMap = CollectionUtils.convertMap(users, AdminUserDO::getId);
|
||||||
// 校验
|
// 校验
|
||||||
ids.forEach(id -> {
|
ids.forEach(id -> {
|
||||||
@@ -598,6 +600,18 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验不允许删除组织管理员
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
void validateOrgAdmin(Long id, Long userOrgId) {
|
||||||
|
Long organAdminId = organService.getOrganAdmin(userOrgId);
|
||||||
|
if (ObjectUtil.equals(id, organAdminId)) {
|
||||||
|
throw new ServiceException(ORGAN_ADMIN_USER_DELETE_NOT_ALLOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
private AdminUserDO validateUserNameExists(String userName) {
|
private AdminUserDO validateUserNameExists(String userName) {
|
||||||
AdminUserDO user = userMapper.selectByUsernameUnique(userName);
|
AdminUserDO user = userMapper.selectByUsernameUnique(userName);
|
||||||
|
|||||||
@@ -85,6 +85,7 @@
|
|||||||
<if test="organId !=null ">
|
<if test="organId !=null ">
|
||||||
and id != #{organId}
|
and id != #{organId}
|
||||||
</if>
|
</if>
|
||||||
|
and deleted = false
|
||||||
|
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user