|
|
@ -71,7 +71,8 @@ public class PermissionServiceImpl implements PermissionService { |
|
|
|
throw new Exception("地区为空!"); |
|
|
|
} |
|
|
|
if (admin.getMarket().contains("总部") && admin.getMarket().size() > 1) { |
|
|
|
throw new Exception("总部不可与其他地区共存");} |
|
|
|
throw new Exception("总部不可与其他地区共存"); |
|
|
|
} |
|
|
|
if (ObjectUtils.isEmpty(admin.getPostiton())) { |
|
|
|
throw new Exception("职位为空!"); |
|
|
|
} |
|
|
@ -142,14 +143,14 @@ public class PermissionServiceImpl implements PermissionService { |
|
|
|
if (ObjectUtils.isEmpty(adminVo.getMarket())) { |
|
|
|
throw new Exception("地区为空!"); |
|
|
|
} |
|
|
|
if (adminVo.getMarket().contains("总部") && adminVo.getMarket().size() > 1) { |
|
|
|
throw new Exception("总部不可与其他地区共存"); |
|
|
|
} |
|
|
|
// 校验职位是否为空(管理员职位为必填项) |
|
|
|
if (ObjectUtils.isEmpty(adminVo.getPostiton())) { |
|
|
|
throw new Exception("职位为空!"); |
|
|
|
} |
|
|
|
// 校验机器编号是否为空(机器编号为必填项) |
|
|
|
if (ObjectUtils.isEmpty(adminVo.getMachineId())) { |
|
|
|
throw new Exception("机器编号为空!"); |
|
|
|
} |
|
|
|
|
|
|
|
// 校验机器编号格式(不允许包含逗号,避免与后续拼接逻辑冲突 |
|
|
|
if (adminVo.getMachineId().contains(",")) { |
|
|
|
throw new Exception("机器编号格式错误"); |
|
|
@ -159,6 +160,9 @@ public class PermissionServiceImpl implements PermissionService { |
|
|
|
admin.setAdminName(adminVo.getAdminName()); |
|
|
|
admin.setMarket(adminVo.getMarket()); |
|
|
|
admin.setPostiton(adminVo.getPostiton()); |
|
|
|
// 将地区列表转换为逗号分隔的字符串 |
|
|
|
String markets = String.join(",", admin.getMarket()); |
|
|
|
admin.setMarket(Collections.singletonList(markets)); |
|
|
|
// 处理机器编号:若存在额外机器编号(machineIds),则与原编号拼接(用逗号分隔) |
|
|
|
if (adminVo.getMachineIds() == null) { |
|
|
|
admin.setMachineId(adminVo.getMachineId()); |
|
|
|