WANG 6 سال پیش
والد
کامیت
e3f94256a3

+ 32 - 2
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/UserCloudServiceProvider.java

@@ -52,7 +52,7 @@ import cn.com.qmth.examcloud.web.support.ControllerSupport;
 import io.swagger.annotations.ApiOperation;
 
 /**
- * 类注释
+ * {@link StatusException} 状态码范围:008XXX<br>
  *
  * @author WANGWEI
  * @date 2018年7月23日
@@ -295,7 +295,37 @@ public class UserCloudServiceProvider extends ControllerSupport implements UserC
 	@PostMapping("getUserListByIds")
 	@Override
 	public GetUserListByIdsResp getUserListByIds(@RequestBody GetUserListByIdsReq req) {
-		return null;
+		Long rootOrgId = req.getRootOrgId();
+		List<Long> userIdList = req.getUserIdList();
+		if (CollectionUtils.isEmpty(userIdList)) {
+			throw new StatusException("008001", "userIdList is empty");
+		}
+		if (100 < userIdList.size()) {
+			throw new StatusException("008002", "size of userIdList is too large");
+		}
+
+		List<UserEntity> userEntityList = userRepo.findByIdIn(userIdList);
+
+		List<UserBean> list = Lists.newArrayList();
+		for (UserEntity userEntity : userEntityList) {
+			UserBean userBean = new UserBean();
+			userBean.setUserId(userEntity.getId());
+			userBean.setName(userEntity.getName());
+			userBean.setLoginName(userEntity.getLoginName());
+			userBean.setDisplayName(userEntity.getLoginName() + " (" + userEntity.getName() + ")");
+			userBean.setOrgId(userEntity.getOrgId());
+			userBean.setRootOrgId(userEntity.getRootOrgId());
+
+			if (!userBean.getRootOrgId().equals(rootOrgId)) {
+				throw new StatusException("008003", "params error");
+			}
+			list.add(userBean);
+		}
+
+		GetUserListByIdsResp resp = new GetUserListByIdsResp();
+		resp.setUserBeanList(list);
+
+		return resp;
 	}
 
 }

+ 2 - 0
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/UserRepo.java

@@ -38,4 +38,6 @@ public interface UserRepo
 
 	int countByRootOrgId(Long rootOrgId);
 
+	List<UserEntity> findByIdIn(List<Long> userIdList);
+	
 }