use of com.cdeledu.common.base.AjaxJson in project wechat by dllwh.
the class SysUserOperateController method singUp.
/**
* ----------------------------------------------------- Fields end
*/
/**
* @方法描述: 用户注册
* @param managerUser
* @param request
* @return
*/
@ResponseBody
@RequestMapping(value = "singUp")
public AjaxJson singUp(SysUser managerUser) {
AjaxJson resultMsg = new AjaxJson();
try {
if (manageruserService.getUserByName(managerUser.getUserName()) == null) {
manageruserService.insert(managerUser);
resultMsg.setMsg(MessageConstant.MSG_OPERATION_SUCCESS);
} else {
resultMsg.setSuccess(false);
resultMsg.setMsg(MessageConstant.EXISTED);
}
} catch (Exception e) {
resultMsg.setMsg(MessageConstant.MSG_OPERATION_FAILED);
resultMsg.setSuccess(false);
}
return resultMsg;
}
use of com.cdeledu.common.base.AjaxJson in project wechat by dllwh.
the class SysUserOperateController method unlockUser.
@ResponseBody
@RequestMapping(value = "unlockUser")
@SystemLog(desc = "解锁用户", opType = SysOpType.UPDATE, tableName = { "sys_user" })
public AjaxJson unlockUser(@RequestParam(name = "id", required = true) int userId) {
AjaxJson resultMsg = new AjaxJson();
SysUser user = new SysUser();
user.setId(userId);
try {
SysUser sysUser = manageruserService.findOneForJdbc(user);
if (sysUser != null && sysUser.getUserType() != -1 && WebUtilHelper.getCurrentUserId() != userId) {
sysUser.setIfLocked(1);
manageruserService.update(sysUser);
}
resultMsg.setMsg(MessageConstant.MSG_OPERATION_SUCCESS);
} catch (Exception e) {
e.printStackTrace();
resultMsg.setSuccess(false);
resultMsg.setMsg(MessageConstant.MSG_OPERATION_FAILED);
}
return resultMsg;
}
use of com.cdeledu.common.base.AjaxJson in project wechat by dllwh.
the class SysUserOperateController method forbidUserById.
/**
* @方法描述: 禁止登录
* @param status
* 1:有效,0:禁止登录
* @return
*/
@ResponseBody
@RequestMapping(value = "forbidUserById", method = RequestMethod.POST)
@SystemLog(desc = "禁止登录/允许登录", opType = SysOpType.UPDATE, tableName = { "sys_user" })
public AjaxJson forbidUserById(@RequestParam(name = "id", required = true) int userId, @RequestParam(name = "status", required = true, defaultValue = "1") int status) {
AjaxJson resultMsg = new AjaxJson();
SysUser user = new SysUser();
user.setId(userId);
try {
SysUser sysUser = manageruserService.findOneForJdbc(user);
if (sysUser != null && sysUser.getUserType() != -1 && WebUtilHelper.getCurrentUserId() != userId) {
sysUser.setLoginFlag(status);
manageruserService.update(sysUser);
}
resultMsg.setMsg(MessageConstant.MSG_OPERATION_SUCCESS);
} catch (Exception e) {
e.printStackTrace();
resultMsg.setSuccess(false);
resultMsg.setMsg(MessageConstant.MSG_OPERATION_FAILED);
}
return resultMsg;
}
use of com.cdeledu.common.base.AjaxJson in project wechat by dllwh.
the class SysUserOperateController method lockUser.
@ResponseBody
@RequestMapping(value = "lockUser", method = RequestMethod.POST)
@SystemLog(desc = "锁定用户", opType = SysOpType.UPDATE, tableName = { "sys_user" })
public AjaxJson lockUser(@RequestParam(name = "id", required = true) int userId) {
AjaxJson resultMsg = new AjaxJson();
SysUser user = new SysUser();
user.setId(userId);
try {
SysUser sysUser = manageruserService.findOneForJdbc(user);
if (sysUser != null && sysUser.getUserType() != -1 && WebUtilHelper.getCurrentUserId() != userId) {
sysUser.setIfLocked(0);
manageruserService.update(sysUser);
}
resultMsg.setMsg(MessageConstant.MSG_OPERATION_SUCCESS);
} catch (Exception e) {
e.printStackTrace();
resultMsg.setSuccess(false);
resultMsg.setMsg(MessageConstant.MSG_OPERATION_FAILED);
}
return resultMsg;
}
use of com.cdeledu.common.base.AjaxJson in project wechat by dllwh.
the class GlobalExceptionHandler method requestTypeMismatch.
/**
* 400 - Bad Request
*/
@ResponseBody
@ExceptionHandler(TypeMismatchException.class)
public AjaxJson requestTypeMismatch(TypeMismatchException ex) {
AjaxJson result = new AjaxJson();
if (logger.isDebugEnabled()) {
logger.error("TypeMismatchException", ex);
}
result.setSuccess(false);
result.setMsg(ex.getMessage());
result.setResultCode(400);
return result;
}
Aggregations