|
@@ -1,12 +1,9 @@
|
|
|
package cn.com.qmth.examcloud.core.basic.api.controller;
|
|
|
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.Iterator;
|
|
|
import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
@@ -44,12 +41,15 @@ import cn.com.qmth.examcloud.commons.web.security.enums.RoleMeta;
|
|
|
import cn.com.qmth.examcloud.commons.web.security.enums.UacPolicy;
|
|
|
import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.controller.bean.FullUserInfo;
|
|
|
+import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.UserRepo;
|
|
|
+import cn.com.qmth.examcloud.core.basic.dao.entity.Org;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.UserEntity;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.UserRole;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.enums.UserType;
|
|
|
import cn.com.qmth.examcloud.core.basic.service.bean.UserInfo;
|
|
|
import cn.com.qmth.examcloud.core.basic.service.impl.UserServiceImpl;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
/**
|
|
|
* 用户服务API Created by songyue on 17/1/13.
|
|
@@ -64,6 +64,9 @@ public class UserController extends ControllerSupport {
|
|
|
@Autowired
|
|
|
UserRepo userRepo;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ OrgRepo orgRepo;
|
|
|
+
|
|
|
@ApiOperation(value = "查询所有用户", notes = "")
|
|
|
@GetMapping("/all/{curPage}/{pageSize}")
|
|
|
public PageInfo<FullUserInfo> getAllUser(@PathVariable Integer curPage,
|
|
@@ -94,17 +97,23 @@ public class UserController extends ControllerSupport {
|
|
|
bean.setLoginName(next.getLoginName());
|
|
|
bean.setName(next.getName());
|
|
|
bean.setRootOrgId(next.getRootOrgId());
|
|
|
+ bean.setEnable(next.getEnable());
|
|
|
|
|
|
List<UserRole> userRoles = next.getUserRoles();
|
|
|
- for (UserRole cur : userRoles) {
|
|
|
+ List<String> roleNameList = userRoles.stream()
|
|
|
+ .map(userRole -> RoleMeta.valueOf(userRole.getRoleCode()).getName())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ bean.setRoleNamesStr(StringUtils.join(roleNameList, ","));
|
|
|
|
|
|
- }
|
|
|
+ Org org = orgRepo.findOne(Long.valueOf(bean.getRootOrgId()));
|
|
|
+ bean.setRootOrgName(org.getName());
|
|
|
|
|
|
fullUserInfoList.add(bean);
|
|
|
}
|
|
|
|
|
|
PageInfo<FullUserInfo> ret = new PageInfo<FullUserInfo>();
|
|
|
ret.setList(fullUserInfoList);
|
|
|
+ ret.setTotal(userList.getTotalElements());
|
|
|
return ret;
|
|
|
}
|
|
|
|