|
@@ -52,18 +52,17 @@ import cn.com.qmth.examcloud.core.basic.service.bean.UserInfo;
|
|
|
import cn.com.qmth.examcloud.core.basic.service.impl.UserServiceImpl;
|
|
|
|
|
|
/**
|
|
|
- * 用户服务API
|
|
|
- * Created by songyue on 17/1/13.
|
|
|
+ * 用户服务API Created by songyue on 17/1/13.
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("${app.api.root}/user")
|
|
|
-public class UserController extends ControllerSupport{
|
|
|
+public class UserController extends ControllerSupport {
|
|
|
|
|
|
- @Autowired
|
|
|
- UserServiceImpl userService;
|
|
|
+ @Autowired
|
|
|
+ UserServiceImpl userService;
|
|
|
|
|
|
- @Autowired
|
|
|
- UserRepo userRepo;
|
|
|
+ @Autowired
|
|
|
+ UserRepo userRepo;
|
|
|
|
|
|
@ApiOperation(value = "查询所有用户", notes = "")
|
|
|
@GetMapping("/all/{curPage}/{pageSize}")
|
|
@@ -95,12 +94,12 @@ public class UserController extends ControllerSupport{
|
|
|
bean.setLoginName(next.getLoginName());
|
|
|
bean.setName(next.getName());
|
|
|
bean.setRootOrgId(next.getRootOrgId());
|
|
|
-
|
|
|
+
|
|
|
List<UserRole> userRoles = next.getUserRoles();
|
|
|
for (UserRole cur : userRoles) {
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
fullUserInfoList.add(bean);
|
|
|
}
|
|
|
|
|
@@ -109,51 +108,53 @@ public class UserController extends ControllerSupport{
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "按id查询用户", notes = "id查询")
|
|
|
- @GetMapping("/{id}")
|
|
|
- public ResponseEntity getUserById(@PathVariable long id) {
|
|
|
- return new ResponseEntity(userRepo.findOne(id), HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "按orgId查询用户", notes = "机构id查询机构用户")
|
|
|
- @GetMapping("/org/{orgId}")
|
|
|
- public ResponseEntity getUserByOrgId(@PathVariable long orgId) {
|
|
|
- List<UserEntity> userList = userRepo.findByOrgIdAndType(orgId, UserType.NOT_STUDENT.name());
|
|
|
- return new ResponseEntity(userList, HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "按rootOrgId查询用户", notes = "根机构id查询机构用户")
|
|
|
- @GetMapping("/rootOrg/{rootOrgId}")
|
|
|
- public ResponseEntity getUserByRootOrgId(@PathVariable long rootOrgId) {
|
|
|
- List<UserEntity> userList = userRepo.findByRootOrgIdAndType(rootOrgId, UserType.NOT_STUDENT.name());
|
|
|
- return new ResponseEntity(userList, HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "新增用户", notes = "新增")
|
|
|
- @PostMapping
|
|
|
- public ResponseEntity addUser(@RequestBody UserEntity user, HttpServletRequest request) {
|
|
|
- cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
|
- if (accessUser != null) {
|
|
|
- if (accessUser.getRootOrgId() != 0) {
|
|
|
- user.setRootOrgId(accessUser.getRootOrgId());
|
|
|
- } else {
|
|
|
- user.setRootOrgId(user.getOrgId());
|
|
|
- }
|
|
|
- } else {
|
|
|
- return new ResponseEntity(HttpStatus.NOT_FOUND);
|
|
|
- }
|
|
|
- try {
|
|
|
- return new ResponseEntity(userService.save(user), HttpStatus.CREATED);
|
|
|
- } catch (Exception e) {
|
|
|
- return new ResponseEntity(new ErrorMsg(e.getMessage()), HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
- }
|
|
|
- }
|
|
|
+ @ApiOperation(value = "按id查询用户", notes = "id查询")
|
|
|
+ @GetMapping("/{id}")
|
|
|
+ public ResponseEntity getUserById(@PathVariable long id) {
|
|
|
+ return new ResponseEntity(userRepo.findOne(id), HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "按orgId查询用户", notes = "机构id查询机构用户")
|
|
|
+ @GetMapping("/org/{orgId}")
|
|
|
+ public ResponseEntity getUserByOrgId(@PathVariable long orgId) {
|
|
|
+ List<UserEntity> userList = userRepo.findByOrgIdAndType(orgId, UserType.NOT_STUDENT.name());
|
|
|
+ return new ResponseEntity(userList, HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "按rootOrgId查询用户", notes = "根机构id查询机构用户")
|
|
|
+ @GetMapping("/rootOrg/{rootOrgId}")
|
|
|
+ public ResponseEntity getUserByRootOrgId(@PathVariable long rootOrgId) {
|
|
|
+ List<UserEntity> userList = userRepo.findByRootOrgIdAndType(rootOrgId,
|
|
|
+ UserType.NOT_STUDENT.name());
|
|
|
+ return new ResponseEntity(userList, HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "新增用户", notes = "新增")
|
|
|
+ @PostMapping
|
|
|
+ public ResponseEntity addUser(@RequestBody UserEntity user, HttpServletRequest request) {
|
|
|
+ cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
|
+ if (accessUser != null) {
|
|
|
+ if (accessUser.getRootOrgId() != 0) {
|
|
|
+ user.setRootOrgId(accessUser.getRootOrgId());
|
|
|
+ } else {
|
|
|
+ user.setRootOrgId(user.getOrgId());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return new ResponseEntity(HttpStatus.NOT_FOUND);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ return new ResponseEntity(userService.save(user), HttpStatus.CREATED);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return new ResponseEntity(new ErrorMsg(e.getMessage()),
|
|
|
+ HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
@ApiOperation(value = "更新用户", notes = "更新")
|
|
|
@PutMapping
|
|
|
public UserEntity updateUser(@RequestBody UserEntity user, HttpServletRequest request) {
|
|
|
cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
|
-
|
|
|
+
|
|
|
List<UserRole> userRoles = user.getUserRoles();
|
|
|
for (UserRole cur : userRoles) {
|
|
|
if (cur.getRoleCode().equals(RoleMeta.SUPER_ADMIN.getCode())) {
|
|
@@ -170,167 +171,171 @@ public class UserController extends ControllerSupport{
|
|
|
return userService.update(user.getId(), user);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "重置用户密码", notes = "重置密码")
|
|
|
- @PutMapping("/resetPass/{id}")
|
|
|
- public ResponseEntity resetPass(@PathVariable String id) {
|
|
|
- List<Long> ids = Stream.of(id.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
- .collect(Collectors.toList());
|
|
|
- for (Long userId : ids) {
|
|
|
- userService.initPassword(userId);
|
|
|
- }
|
|
|
- return new ResponseEntity(HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "启用用户", notes = "启用用户")
|
|
|
- @PutMapping("/enable/{ids}")
|
|
|
- public ResponseEntity enableUser(@PathVariable String ids) {
|
|
|
- List<Long> userIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
- .collect(Collectors.toList());
|
|
|
- for (Long userId : userIds) {
|
|
|
- UserEntity user = userRepo.findOne(userId);
|
|
|
- user.setEnable(true);
|
|
|
- user.setUpdateTime(new Date());
|
|
|
- userRepo.save(user);
|
|
|
- }
|
|
|
- return new ResponseEntity(HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "禁用用户", notes = "禁用用户")
|
|
|
- @PutMapping("/disable/{ids}")
|
|
|
- public ResponseEntity disableUser(@PathVariable String ids) {
|
|
|
- List<Long> userIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
- .collect(Collectors.toList());
|
|
|
- for (Long userId : userIds) {
|
|
|
- UserEntity user = userRepo.findOne(userId);
|
|
|
- user.setEnable(false);
|
|
|
- user.setUpdateTime(new Date());
|
|
|
- userRepo.save(user);
|
|
|
- }
|
|
|
- return new ResponseEntity(HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "修改用户密码", notes = "修改密码")
|
|
|
- @PutMapping("/password")
|
|
|
- public ResponseEntity updatePass(@RequestParam long userId, @RequestParam String password) {
|
|
|
- String realPassword = StringEscapeUtils.unescapeJavaScript(password);
|
|
|
- userRepo.updatePasswordById(userId, realPassword);
|
|
|
- return new ResponseEntity(HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "修改用户密码", notes = "修改密码")
|
|
|
- @PutMapping("/stu-password")
|
|
|
- @Uac(roles = {RoleMeta.STUDENT}, policy = UacPolicy.IN)
|
|
|
- public ResponseEntity stuPassword(@RequestParam("oldPassword") String oldPassword,
|
|
|
- @RequestParam("newPassword") String newPassword,
|
|
|
- HttpServletRequest request) {
|
|
|
- cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
|
- if (StringUtils.isEmpty(oldPassword) || StringUtils.isEmpty(newPassword)) {
|
|
|
- return new ResponseEntity(new ErrorMsg("原密码不正确"), HttpStatus.BAD_REQUEST);
|
|
|
- } else {
|
|
|
- Long userId = accessUser.getUserId();
|
|
|
- UserEntity user = userRepo.findOne(userId);
|
|
|
- if (!oldPassword.equals(user.getPassword())) {
|
|
|
- return new ResponseEntity(new ErrorMsg("原密码不正确"), HttpStatus.BAD_REQUEST);
|
|
|
- }
|
|
|
- userRepo.updatePasswordById(userId, newPassword);
|
|
|
- return new ResponseEntity(HttpStatus.OK);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "按id删除用户", notes = "删除")
|
|
|
- @DeleteMapping("/{ids}")
|
|
|
- @Uac(roles = {RoleMeta.SUPER_ADMIN}, policy = UacPolicy.IN)
|
|
|
- public ResponseEntity deleteUser(@PathVariable String ids) {
|
|
|
- List<Long> userIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
- .collect(Collectors.toList());
|
|
|
- for (Long userId : userIds) {
|
|
|
- userRepo.delete(userId);
|
|
|
- }
|
|
|
- return new ResponseEntity(HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "一般登录", notes = "登录")
|
|
|
- @PostMapping("/login")
|
|
|
- @Deprecated
|
|
|
- public ResponseEntity login(@RequestParam String loginName,
|
|
|
- @RequestParam String password) {
|
|
|
- try {
|
|
|
- UserInfo userInfo = userService.login(loginName, password);
|
|
|
- return new ResponseEntity(userInfo, HttpStatus.OK);
|
|
|
- } catch (Exception e) {
|
|
|
- return new ResponseEntity(new ErrorMsg(e.getMessage()), HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "二级登录", notes = "二级登录")
|
|
|
- @PostMapping("/login/{orgId}")
|
|
|
- @Deprecated
|
|
|
- public ResponseEntity login(@PathVariable long orgId,
|
|
|
- @RequestParam String loginName,
|
|
|
- @RequestParam String password) {
|
|
|
- try {
|
|
|
- UserInfo userInfo = userService.login(orgId, loginName, password);
|
|
|
- return new ResponseEntity(userInfo, HttpStatus.OK);
|
|
|
- } catch (Exception e) {
|
|
|
- return new ResponseEntity(new ErrorMsg(e.getMessage()), HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "第三方机构接入", notes = "第三方机构接入")
|
|
|
- @PostMapping("/thirdPartyAccess/{orgId}")
|
|
|
- @Deprecated
|
|
|
- public ResponseEntity thirdPartyAccess(@PathVariable long orgId,
|
|
|
- @RequestParam String userid,
|
|
|
- @RequestParam String appid,@RequestParam String timestamp,@RequestParam String token) {
|
|
|
- try {
|
|
|
- UserInfo userInfo = userService.thirdPartyAccess(orgId, userid, appid,timestamp,token);
|
|
|
- return new ResponseEntity(userInfo, HttpStatus.OK);
|
|
|
- } catch (Exception e) {
|
|
|
- return new ResponseEntity(new ErrorMsg(e.getMessage()), HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "登出", notes = "登出")
|
|
|
- @PostMapping("/logout")
|
|
|
- @Deprecated
|
|
|
- public ResponseEntity logout(HttpServletRequest request) {
|
|
|
- AccessUser accessUser=null;
|
|
|
- userService.logout(accessUser);
|
|
|
- return new ResponseEntity(HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "查询评卷员", notes = "查询")
|
|
|
- @GetMapping("/marker")
|
|
|
- public ResponseEntity getMarker(HttpServletRequest request) {
|
|
|
- cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
|
- return new ResponseEntity(userService.getMarker(accessUser.getRootOrgId()), HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "新增评卷员", notes = "新增")
|
|
|
- @PostMapping("/marker")
|
|
|
- public ResponseEntity saveMarker(@RequestParam String loginName,@RequestParam String name,HttpServletRequest request) {
|
|
|
- cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
|
- return new ResponseEntity(userService.saveMarker(accessUser.getRootOrgId(),loginName,name), HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value="查询评卷员带分页",notes="查询评卷员带分页")
|
|
|
- @GetMapping("/all/marker/{curPage}/{pageSize}")
|
|
|
- public ResponseEntity getAllMark(@ModelAttribute UserEntity user,
|
|
|
- @PathVariable Integer curPage,
|
|
|
- @PathVariable Integer pageSize,
|
|
|
- HttpServletRequest request){
|
|
|
- cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
|
- if(accessUser != null){
|
|
|
- user.setRootOrgId(accessUser.getRootOrgId());
|
|
|
- return new ResponseEntity(userService.getAllMaker(user,new PageRequest(curPage-1, pageSize)),HttpStatus.OK);
|
|
|
- }else{
|
|
|
- return new ResponseEntity(new PageImpl<UserEntity>(new ArrayList<UserEntity>()),HttpStatus.OK);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value="查询印刷项目经理",notes="查询印刷项目经理")
|
|
|
- @GetMapping("/allPrintPm")
|
|
|
- public ResponseEntity getAllPrintPm(){
|
|
|
- return new ResponseEntity(userRepo.findPrintPm(),HttpStatus.OK);
|
|
|
- }
|
|
|
+ @ApiOperation(value = "重置用户密码", notes = "重置密码")
|
|
|
+ @PutMapping("/resetPass/{id}")
|
|
|
+ public ResponseEntity resetPass(@PathVariable String id) {
|
|
|
+ List<Long> ids = Stream.of(id.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ for (Long userId : ids) {
|
|
|
+ userService.initPassword(userId);
|
|
|
+ }
|
|
|
+ return new ResponseEntity(HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "启用用户", notes = "启用用户")
|
|
|
+ @PutMapping("/enable/{ids}")
|
|
|
+ public ResponseEntity enableUser(@PathVariable String ids) {
|
|
|
+ List<Long> userIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ for (Long userId : userIds) {
|
|
|
+ UserEntity user = userRepo.findOne(userId);
|
|
|
+ user.setEnable(true);
|
|
|
+ user.setUpdateTime(new Date());
|
|
|
+ userRepo.save(user);
|
|
|
+ }
|
|
|
+ return new ResponseEntity(HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "禁用用户", notes = "禁用用户")
|
|
|
+ @PutMapping("/disable/{ids}")
|
|
|
+ public ResponseEntity disableUser(@PathVariable String ids) {
|
|
|
+ List<Long> userIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ for (Long userId : userIds) {
|
|
|
+ UserEntity user = userRepo.findOne(userId);
|
|
|
+ user.setEnable(false);
|
|
|
+ user.setUpdateTime(new Date());
|
|
|
+ userRepo.save(user);
|
|
|
+ }
|
|
|
+ return new ResponseEntity(HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "修改用户密码", notes = "修改密码")
|
|
|
+ @PutMapping("/password")
|
|
|
+ public ResponseEntity updatePass(@RequestParam long userId, @RequestParam String password) {
|
|
|
+ String realPassword = StringEscapeUtils.unescapeJavaScript(password);
|
|
|
+ userRepo.updatePasswordById(userId, realPassword);
|
|
|
+ return new ResponseEntity(HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "修改用户密码", notes = "修改密码")
|
|
|
+ @PutMapping("/stu-password")
|
|
|
+ @Uac(roles = {RoleMeta.STUDENT}, policy = UacPolicy.IN)
|
|
|
+ public ResponseEntity stuPassword(@RequestParam("oldPassword") String oldPassword,
|
|
|
+ @RequestParam("newPassword") String newPassword, HttpServletRequest request) {
|
|
|
+ cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
|
+ if (StringUtils.isEmpty(oldPassword) || StringUtils.isEmpty(newPassword)) {
|
|
|
+ return new ResponseEntity(new ErrorMsg("原密码不正确"), HttpStatus.BAD_REQUEST);
|
|
|
+ } else {
|
|
|
+ Long userId = accessUser.getUserId();
|
|
|
+ UserEntity user = userRepo.findOne(userId);
|
|
|
+ if (!oldPassword.equals(user.getPassword())) {
|
|
|
+ return new ResponseEntity(new ErrorMsg("原密码不正确"), HttpStatus.BAD_REQUEST);
|
|
|
+ }
|
|
|
+ userRepo.updatePasswordById(userId, newPassword);
|
|
|
+ return new ResponseEntity(HttpStatus.OK);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "按id删除用户", notes = "删除")
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
+ @Uac(roles = {RoleMeta.SUPER_ADMIN}, policy = UacPolicy.IN)
|
|
|
+ public ResponseEntity deleteUser(@PathVariable String ids) {
|
|
|
+ List<Long> userIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ for (Long userId : userIds) {
|
|
|
+ userRepo.delete(userId);
|
|
|
+ }
|
|
|
+ return new ResponseEntity(HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "一般登录", notes = "登录")
|
|
|
+ @PostMapping("/login")
|
|
|
+ @Deprecated
|
|
|
+ public ResponseEntity login(@RequestParam String loginName, @RequestParam String password) {
|
|
|
+ try {
|
|
|
+ UserInfo userInfo = userService.login(loginName, password);
|
|
|
+ return new ResponseEntity(userInfo, HttpStatus.OK);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return new ResponseEntity(new ErrorMsg(e.getMessage()),
|
|
|
+ HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "二级登录", notes = "二级登录")
|
|
|
+ @PostMapping("/login/{orgId}")
|
|
|
+ @Deprecated
|
|
|
+ public ResponseEntity login(@PathVariable long orgId, @RequestParam String loginName,
|
|
|
+ @RequestParam String password) {
|
|
|
+ try {
|
|
|
+ UserInfo userInfo = userService.login(orgId, loginName, password);
|
|
|
+ return new ResponseEntity(userInfo, HttpStatus.OK);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return new ResponseEntity(new ErrorMsg(e.getMessage()),
|
|
|
+ HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "第三方机构接入", notes = "第三方机构接入")
|
|
|
+ @PostMapping("/thirdPartyAccess/{orgId}")
|
|
|
+ @Deprecated
|
|
|
+ public ResponseEntity thirdPartyAccess(@PathVariable long orgId, @RequestParam String userid,
|
|
|
+ @RequestParam String appid, @RequestParam String timestamp,
|
|
|
+ @RequestParam String token) {
|
|
|
+ try {
|
|
|
+ UserInfo userInfo = userService.thirdPartyAccess(orgId, userid, appid, timestamp,
|
|
|
+ token);
|
|
|
+ return new ResponseEntity(userInfo, HttpStatus.OK);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return new ResponseEntity(new ErrorMsg(e.getMessage()),
|
|
|
+ HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "登出", notes = "登出")
|
|
|
+ @PostMapping("/logout")
|
|
|
+ @Deprecated
|
|
|
+ public ResponseEntity logout(HttpServletRequest request) {
|
|
|
+ AccessUser accessUser = null;
|
|
|
+ userService.logout(accessUser);
|
|
|
+ return new ResponseEntity(HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询评卷员", notes = "查询")
|
|
|
+ @GetMapping("/marker")
|
|
|
+ public ResponseEntity getMarker(HttpServletRequest request) {
|
|
|
+ cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
|
+ return new ResponseEntity(userService.getMarker(accessUser.getRootOrgId()), HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "新增评卷员", notes = "新增")
|
|
|
+ @PostMapping("/marker")
|
|
|
+ public ResponseEntity saveMarker(@RequestParam String loginName, @RequestParam String name,
|
|
|
+ HttpServletRequest request) {
|
|
|
+ cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
|
+ return new ResponseEntity(
|
|
|
+ userService.saveMarker(accessUser.getRootOrgId(), loginName, name), HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询评卷员带分页", notes = "查询评卷员带分页")
|
|
|
+ @GetMapping("/all/marker/{curPage}/{pageSize}")
|
|
|
+ public ResponseEntity getAllMark(@ModelAttribute UserEntity user, @PathVariable Integer curPage,
|
|
|
+ @PathVariable Integer pageSize, HttpServletRequest request) {
|
|
|
+ cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
|
+ if (accessUser != null) {
|
|
|
+ user.setRootOrgId(accessUser.getRootOrgId());
|
|
|
+ return new ResponseEntity(
|
|
|
+ userService.getAllMaker(user, new PageRequest(curPage - 1, pageSize)),
|
|
|
+ HttpStatus.OK);
|
|
|
+ } else {
|
|
|
+ return new ResponseEntity(new PageImpl<UserEntity>(new ArrayList<UserEntity>()),
|
|
|
+ HttpStatus.OK);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询印刷项目经理", notes = "查询印刷项目经理")
|
|
|
+ @GetMapping("/allPrintPm")
|
|
|
+ public ResponseEntity getAllPrintPm() {
|
|
|
+ return new ResponseEntity(userRepo.findPrintPm(), HttpStatus.OK);
|
|
|
+ }
|
|
|
}
|