|
@@ -3,20 +3,17 @@ package com.qmth.paper.library.api;
|
|
import com.qmth.boot.api.annotation.Aac;
|
|
import com.qmth.boot.api.annotation.Aac;
|
|
import com.qmth.boot.api.annotation.BOOL;
|
|
import com.qmth.boot.api.annotation.BOOL;
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
-import com.qmth.paper.library.business.service.PaperLibraryCommonService;
|
|
|
|
import com.qmth.paper.library.common.bean.params.UserSaveParams;
|
|
import com.qmth.paper.library.common.bean.params.UserSaveParams;
|
|
import com.qmth.paper.library.common.contant.SystemConstant;
|
|
import com.qmth.paper.library.common.contant.SystemConstant;
|
|
import com.qmth.paper.library.common.entity.SysUser;
|
|
import com.qmth.paper.library.common.entity.SysUser;
|
|
import com.qmth.paper.library.common.service.SysUserService;
|
|
import com.qmth.paper.library.common.service.SysUserService;
|
|
import com.qmth.paper.library.common.util.Result;
|
|
import com.qmth.paper.library.common.util.Result;
|
|
import com.qmth.paper.library.common.util.ResultUtil;
|
|
import com.qmth.paper.library.common.util.ResultUtil;
|
|
-import com.qmth.paper.library.common.util.ServletUtil;
|
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiParam;
|
|
import io.swagger.annotations.ApiParam;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.validation.BindingResult;
|
|
import org.springframework.validation.BindingResult;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -43,10 +40,8 @@ import java.security.NoSuchAlgorithmException;
|
|
public class SysUserController {
|
|
public class SysUserController {
|
|
private final static Logger log = LoggerFactory.getLogger(SysUserController.class);
|
|
private final static Logger log = LoggerFactory.getLogger(SysUserController.class);
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private SysUserService sysUserService;
|
|
|
|
@Resource
|
|
@Resource
|
|
- private PaperLibraryCommonService paperLibraryCommonService;
|
|
|
|
|
|
+ private SysUserService sysUserService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 用户列表查询
|
|
* 用户列表查询
|
|
@@ -57,113 +52,59 @@ public class SysUserController {
|
|
* @param enable
|
|
* @param enable
|
|
* @param pageNumber
|
|
* @param pageNumber
|
|
* @param pageSize
|
|
* @param pageSize
|
|
- * @return
|
|
|
|
*/
|
|
*/
|
|
@ApiOperation(value = "查询")
|
|
@ApiOperation(value = "查询")
|
|
- @RequestMapping(value = "/list", method = RequestMethod.POST)
|
|
|
|
|
|
+ @PostMapping("/list")
|
|
public Result list(@RequestParam(value = "userInfo", required = false) String userInfo,
|
|
public Result list(@RequestParam(value = "userInfo", required = false) String userInfo,
|
|
@RequestParam(value = "orgId", required = false) String orgId,
|
|
@RequestParam(value = "orgId", required = false) String orgId,
|
|
@RequestParam(value = "roleId", required = false) String roleId,
|
|
@RequestParam(value = "roleId", required = false) String roleId,
|
|
@RequestParam(value = "enable", required = false) Boolean enable,
|
|
@RequestParam(value = "enable", required = false) Boolean enable,
|
|
@RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
|
|
@RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
|
|
@RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
|
|
@RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
|
|
- return ResultUtil.ok();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 查询
|
|
|
|
- *
|
|
|
|
- * @param realName
|
|
|
|
- * @param enable
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- @ApiOperation(value = "查询")
|
|
|
|
- @RequestMapping(value = "/list_customer", method = RequestMethod.POST)
|
|
|
|
- public Result listCustomer(@RequestParam(value = "realName", required = false) String realName,
|
|
|
|
- @RequestParam(value = "enable", required = false) Boolean enable,
|
|
|
|
- @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
|
|
|
|
- @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
|
|
|
|
- return ResultUtil.ok();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 根据科目查询命题老师
|
|
|
|
- *
|
|
|
|
- * @param courseCode
|
|
|
|
- * @param param
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- @ApiOperation(value = "根据科目查询命题老师")
|
|
|
|
- @RequestMapping(value = "/user_list", method = RequestMethod.POST)
|
|
|
|
- public Result userQuery(@RequestParam(value = "courseCode", required = false) String courseCode,
|
|
|
|
- @RequestParam(value = "param", required = false) String param) {
|
|
|
|
- return ResultUtil.ok();
|
|
|
|
|
|
+ return ResultUtil.ok(sysUserService.listForPrintSystem(userInfo, SystemConstant.convertIdToLong(orgId), roleId, enable, pageNumber, pageSize));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 新增/修改
|
|
* 新增/修改
|
|
*
|
|
*
|
|
* @param userSaveParams
|
|
* @param userSaveParams
|
|
- * @return
|
|
|
|
*/
|
|
*/
|
|
@ApiOperation(value = "新增/修改")
|
|
@ApiOperation(value = "新增/修改")
|
|
- @RequestMapping(value = "/save", method = RequestMethod.POST)
|
|
|
|
|
|
+ @PostMapping("/save")
|
|
public Result save(@ApiParam(value = "用户信息", required = true) @Valid @RequestBody UserSaveParams userSaveParams, BindingResult bindingResult) throws IllegalAccessException {
|
|
public Result save(@ApiParam(value = "用户信息", required = true) @Valid @RequestBody UserSaveParams userSaveParams, BindingResult bindingResult) throws IllegalAccessException {
|
|
if (bindingResult.hasErrors()) {
|
|
if (bindingResult.hasErrors()) {
|
|
return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
}
|
|
}
|
|
- SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
|
- Long upUserId = sysUserService.saveUser(userSaveParams);
|
|
|
|
- return ResultUtil.ok();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 新增客服
|
|
|
|
- *
|
|
|
|
- * @param userSaveParams
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- @ApiOperation(value = "新增客服")
|
|
|
|
- @RequestMapping(value = "/save_customer", method = RequestMethod.POST)
|
|
|
|
- public Result saveCustomer(@ApiParam(value = "用户信息", required = true) @Valid @RequestBody UserSaveParams userSaveParams, BindingResult bindingResult) {
|
|
|
|
- if (bindingResult.hasErrors()) {
|
|
|
|
- return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
|
|
- }
|
|
|
|
- return ResultUtil.ok(sysUserService.saveCustomer(userSaveParams));
|
|
|
|
|
|
+ return ResultUtil.ok(sysUserService.saveUser(userSaveParams));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 启用/禁用
|
|
* 启用/禁用
|
|
*
|
|
*
|
|
* @param user
|
|
* @param user
|
|
- * @return
|
|
|
|
*/
|
|
*/
|
|
@ApiOperation(value = "启用/禁用")
|
|
@ApiOperation(value = "启用/禁用")
|
|
- @RequestMapping(value = "/enable", method = RequestMethod.POST)
|
|
|
|
|
|
+ @PostMapping("/enable")
|
|
public Result enable(@RequestBody SysUser user) throws NoSuchAlgorithmException, IllegalAccessException {
|
|
public Result enable(@RequestBody SysUser user) throws NoSuchAlgorithmException, IllegalAccessException {
|
|
- SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
|
- return ResultUtil.ok();
|
|
|
|
|
|
+ return ResultUtil.ok(sysUserService.enable(user));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 重置密码
|
|
* 重置密码
|
|
*
|
|
*
|
|
* @param user
|
|
* @param user
|
|
- * @return
|
|
|
|
*/
|
|
*/
|
|
@ApiOperation(value = "重置密码")
|
|
@ApiOperation(value = "重置密码")
|
|
- @RequestMapping(value = "/reset_password", method = RequestMethod.POST)
|
|
|
|
|
|
+ @PostMapping("/reset_password")
|
|
public Result resetPassword(@RequestBody SysUser user) throws NoSuchAlgorithmException {
|
|
public Result resetPassword(@RequestBody SysUser user) throws NoSuchAlgorithmException {
|
|
return ResultUtil.ok(sysUserService.resetPassword(user.getId()));
|
|
return ResultUtil.ok(sysUserService.resetPassword(user.getId()));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 修改密码
|
|
* 修改密码
|
|
- *
|
|
|
|
- * @return
|
|
|
|
*/
|
|
*/
|
|
@ApiOperation(value = "修改密码")
|
|
@ApiOperation(value = "修改密码")
|
|
- @RequestMapping(value = "/update_password", method = RequestMethod.POST)
|
|
|
|
|
|
+ @PostMapping("/update_password")
|
|
@Aac(strict = BOOL.FALSE, auth = BOOL.FALSE)
|
|
@Aac(strict = BOOL.FALSE, auth = BOOL.FALSE)
|
|
public Result updatePassword(@RequestBody SysUser user) throws NoSuchAlgorithmException {
|
|
public Result updatePassword(@RequestBody SysUser user) throws NoSuchAlgorithmException {
|
|
return ResultUtil.ok(sysUserService.updatePassword(user));
|
|
return ResultUtil.ok(sysUserService.updatePassword(user));
|
|
@@ -173,10 +114,9 @@ public class SysUserController {
|
|
* 绑定角色
|
|
* 绑定角色
|
|
*
|
|
*
|
|
* @param sysUser
|
|
* @param sysUser
|
|
- * @return
|
|
|
|
*/
|
|
*/
|
|
@ApiOperation(value = "绑定角色")
|
|
@ApiOperation(value = "绑定角色")
|
|
- @RequestMapping(value = "/bind_roles", method = RequestMethod.POST)
|
|
|
|
|
|
+ @PostMapping("/bind_roles")
|
|
public Result bindRoles(@RequestBody SysUser sysUser) {
|
|
public Result bindRoles(@RequestBody SysUser sysUser) {
|
|
return ResultUtil.ok(sysUserService.bindRoles(sysUser));
|
|
return ResultUtil.ok(sysUserService.bindRoles(sysUser));
|
|
}
|
|
}
|