Преглед изворни кода

feat: 新增小程序招商经理角色

lixuesong пре 1 година
родитељ
комит
7c1fb86230

+ 43 - 0
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/controller/SysUserController.java

@@ -393,6 +393,9 @@ public class SysUserController {
 							if (sysRole.getRoleId() == 7) {
 								return R.failed("用户已存在平台管理员角色,不能同时为财务管理员");
 							}
+							if (sysRole.getRoleId() == 31) {
+								return R.failed("用户已存在平台管理员角色,不能同时为招商经理");
+							}
 						}
 					}
 				}
@@ -462,6 +465,17 @@ public class SysUserController {
 									}
 								}
 							}
+							if (sysRole.getRoleId() == 31) {
+								SysUserRole sysUserRole = new SysUserRole();
+								sysUserRole.setUserId(userVO.getUserId());
+								List<SysUserRole> sysUserRoleList = sysUserRoleMapper.selectById(sysUserRole);
+								for (int i = 0; i < sysUserRoleList.size(); i++) {
+									SysUser sysUser = userService.getById(sysUserRoleList.get(i).getUserId());
+									if (!sysUser.getDeptId().equals(userDto.getDeptId())) {
+										return R.failed("用户已存在招商经理角色,不能为其他机构CSO管理员");
+									}
+								}
+							}
 						}
 					}
 				}
@@ -572,7 +586,33 @@ public class SysUserController {
 				}
 			}
 
+		} else if (userDto.getRole().contains(31)) {
+			UserDTO userDTO = new UserDTO();
+			userDTO.setUsername(userDto.getUsername());
+			userDTO.setDelFlag("0");
+			List<UserVO> userDTOList = sysUserMapper.selectByPhone(userDTO);
+			if (CollUtil.isNotEmpty(userDTOList)) {
+				for (UserVO userVO : userDTOList) {
+					for (SysRole sysRole : userVO.getRoleList()) {
+						if (sysRole.getRoleId() == 2) {
+							return R.failed("用户已存在平台管理员,不能同时为招商经理");
+						}
+						if (sysRole.getRoleId() == 3) {
+							if (sysDept.getLevel() == 3 || sysDept.getLevel() == 4) {
+								return R.failed("用户已存在药企管理员,不能为CSO的招商经理");
+							}
+						}
+						if (sysRole.getRoleId() == 4) {
+							if (sysDept.getLevel() == 3 || sysDept.getLevel() == 4) {
+								return R.failed("用户已存在CSO管理员,不能为其他CSO的招商经理");
+							}
+						}
+
+					}
+				}
+			}
 		}
+
 		if (userDto.getRole().contains(3)) {
 			if (sysDept.getLevel() != 2) {
 				return R.failed("角色选为药企管理员时,组织架构必须为药企");
@@ -583,6 +623,9 @@ public class SysUserController {
 			if (userDto.getRole().contains(5) || userDto.getRole().contains(6)) {
 				return R.failed("不能跨机构维护学术推广员");
 			}
+			if (userDto.getRole().contains(31)) {
+				return R.failed("不能跨机构维护招商经理");
+			}
 		}
 		SysUser query = new SysUser();
 		query.setUsername(userDto.getUsername());

+ 5 - 1
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/impl/MobileServiceImpl.java

@@ -91,6 +91,7 @@ public class MobileServiceImpl implements MobileService {
 					boolean isLevel6 = false;
 					boolean isLevel10 = false;
 					boolean isLevel13 = false;
+					boolean isLevel31 = false;
 
 					for (SysRole sysRole : userVO.getRoleList()) {
 						if (sysRole.getRoleId() == 2) {
@@ -108,9 +109,12 @@ public class MobileServiceImpl implements MobileService {
 						} else if (sysRole.getRoleId() == 13) {
 							// 患者教育-HCP角色
 							isLevel13 = true;
+						} else if (sysRole.getRoleId() == 31) {
+							// 招商经理角色
+							isLevel31 = true;
 						}
 
-						if (isLevel5 || isLevel6 || isLevel10 || isLevel13) {
+						if (isLevel5 || isLevel6 || isLevel10 || isLevel13 || isLevel31) {
 							userList.add(userVO);
 						}
 					}