| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | |
| | | /** |
| | | * 注册controller 提供注册,登录,注销服务 |
| | | * 注册controller 提供注册,录,注销服务 |
| | | * |
| | | * @author 德虎 |
| | | * @history 2014-11-25 新建 夏德虎 |
| | | */ |
| | | @Api(tags="登入相关接口") |
| | | @Api(tags="入相关接口") |
| | | @Controller |
| | | @CrossOrigin(origins="*",maxAge=3600) |
| | | @EnableConfigurationProperties(SccConfig.class) |
| | |
| | | IWechatService wechatService; |
| | | |
| | | /** |
| | | * 微信登录 |
| | | * 微信录 |
| | | * |
| | | * @param uid |
| | | * @throws IOException |
| | | */ |
| | | |
| | | @PostMapping("/wxAccountsLogin") |
| | | @ApiOperation("微信公众号登录") |
| | | @ApiOperation("微信公众号录") |
| | | @ResponseBody |
| | | public Result wxAccountsLogin(String code) { |
| | | JSONObject gettoken = wechatService.gettoken(wxappId, wxsecret); |
| | |
| | | |
| | | |
| | | @PostMapping("/wxlogin") |
| | | @ApiOperation("微信小程序登录") |
| | | @ApiOperation("微信小程序录") |
| | | @ResponseBody |
| | | public Result wechatLogin(String code,String number) { |
| | | JSONObject sessionKeyOrOpenId = wechatService.getSessionKeyOrOpenId(code); |
| | |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "登入接口", notes = "") |
| | | @ApiOperation(value = "入接口", notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "account", value = "账号", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "password", value = "密码", required = true, paramType="query", dataType = "String"), |
| | |
| | | return new Result(true, "验证成功",CollectionUtils.newObjectMap("uuNumber",uuNumber,"uuReNumber",uuReNumber)); |
| | | } |
| | | |
| | | @ApiOperation(value = "登入接口", notes = "") |
| | | @ApiOperation(value = "入接口", notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "uuNumber", value = "uuNumber", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "uuReNumber", value = "uuReNumber", required = true, paramType="query", dataType = "String"), |
| | |
| | | return new Result(true, "验证成功"); |
| | | } |
| | | |
| | | @ApiOperation(value = "登入接口", notes = "") |
| | | @ApiOperation(value = "入接口", notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "uuNumber", value = "uuNumber", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "uuReNumber", value = "uuReNumber", required = true, paramType="query", dataType = "String"), |
| | |
| | | return new Result(true, "验证成功"); |
| | | } |
| | | |
| | | //退出登录 清除session |
| | | //退出录 清除session |
| | | @RequestMapping(value = "khdloginout", method = RequestMethod.POST) |
| | | @ResponseBody |
| | | public void khdloginout(HttpServletRequest request, HttpServletResponse response) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 学员端登录 |
| | | * 学员端录 |
| | | * |
| | | * @param account 账户 |
| | | * @param password 密码 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "登入接口", notes = "") |
| | | @ApiOperation(value = "入接口", notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "account", value = "账号", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "password", value = "密码", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "organizationId", value = "机构id", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "platForm", value = "登入平台(app,web,qLive,pc,weixin)", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "logType", value = "登入type(study学员,teacher教师,否则为后台)", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "platForm", value = "入平台(app,web,qLive,pc,weixin)", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "logType", value = "入type(study学员,teacher教师,否则为后台)", required = true, paramType="query", dataType = "String"), |
| | | }) |
| | | @RequestMapping(value = "studentLogin", method = RequestMethod.POST) |
| | | @ResponseBody |
| | |
| | | } |
| | | |
| | | /** |
| | | * 后台登录 |
| | | * 后台录 |
| | | * |
| | | * @param account 账户 |
| | | * @param password 密码 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "登入接口", notes = "") |
| | | @ApiOperation(value = "入接口", notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "account", value = "账号", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "password", value = "密码", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "organizationId", value = "机构id", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "platForm", value = "登入平台(app,web,qLive,pc,weixin)", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "logType", value = "登入type(study学员,teacher教师,否则为后台)", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "platForm", value = "入平台(app,web,qLive,pc,weixin)", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "logType", value = "入type(study学员,teacher教师,否则为后台)", required = true, paramType="query", dataType = "String"), |
| | | }) |
| | | @RequestMapping(value = "platformLogin", method = RequestMethod.POST) |
| | | @ResponseBody |
| | |
| | | User user = commonDAO.findUnique(hql,params, User.class); |
| | | |
| | | if(uuNumber!=null&&!"".equals(uuNumber)&&!"null".equals(uuNumber)){ |
| | | //登录成功存入user里,删除session里的uuNumber,下个人无法使用 |
| | | //录成功存入user里,删除session里的uuNumber,下个人无法使用 |
| | | user.setEmail(uuNumber); |
| | | // request.getSession().removeAttribute("uuNumber"); |
| | | } |
| | | // if(uuReNumber!=null&&!"".equals(uuReNumber)&&!"null".equals(uuReNumber)){ |
| | | // //登录成功存入user里,删除session里的uuReNumber,下个人无法使用 |
| | | // //录成功存入user里,删除session里的uuReNumber,下个人无法使用 |
| | | // user.setImei(uuReNumber); |
| | | // request.getSession().removeAttribute("uuReNumber"); |
| | | // } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 登入验证 |
| | | * 入验证 |
| | | * @param user |
| | | * @param type |
| | | * @param request |
| | |
| | | }*/ |
| | | |
| | | if (StringUtils.isEmpty(user.getOrganizationId())) { |
| | | return new Result(false, "该用户不属于任何机构,无法登入"); |
| | | return new Result(false, "该用户不属于任何机构,无法入"); |
| | | } |
| | | if (StringUtils.isNoneBlank(organizationId) && !user.getOrganizationId().equals(organizationId)) { |
| | | return new Result(false, "选择的机构错误,请确认"); |
| | | } |
| | | |
| | | //判断是否为学生,如果是学生,判断是否已冻结或移除,冻结或移除的学生不让登录 |
| | | //判断是否为学生,如果是学生,判断是否已冻结或移除,冻结或移除的学生不让录 |
| | | StuStudent stu = this.studentService.getStudentByUserId(user.getUserId()); |
| | | if(stu!=null && (stu.getDeleteFlag() || stu.getStatus().equalsIgnoreCase(StuStudent.STATUS_DEACTIVE))){ |
| | | return new Result(false, "用户账户已经被冻结或移除"); |
| | | } |
| | | |
| | | /*if(StringUtils.isEmpty(wrapper.getInfo(UserInfoWrapper.INF_CLASS_ID))) { |
| | | return new Result(false, "该用户未加入任何班级,无法登入"); |
| | | return new Result(false, "该用户未加入任何班级,无法入"); |
| | | }*/ |
| | | // 保存到session中 |
| | | return new Result(true, "success", |
| | |
| | | }else if("teacher".equals(logType)) { |
| | | String teacherId = teacherService.getTeacherIdByUserId(user.getUserId()); |
| | | if (StringUtils.isEmpty(teacherId)) { |
| | | return new Result(false, "该账户不是老师角色,无法登入"); |
| | | return new Result(false, "该账户不是老师角色,无法入"); |
| | | } |
| | | if (StringUtils.isEmpty(user.getOrganizationId())) { |
| | | return new Result(false, "该用户不属于任何机构,无法登入"); |
| | | return new Result(false, "该用户不属于任何机构,无法入"); |
| | | } |
| | | if (StringUtils.isNoneBlank(organizationId) && !user.getOrganizationId().equals(organizationId)) { |
| | | return new Result(false, "选择的机构错误,请确认"); |
| | | } |
| | | |
| | | //获取用户对应的sessionId是否与保存在redis中的一致,如果不一致则跳转到登录页面 |
| | | //获取用户对应的sessionId是否与保存在redis中的一致,如果不一致则跳转到录页面 |
| | | // stringRedisTemplate.opsForHash().put(UserInfoWrapper.REDIS_USER_ONLINE_MAP_KEY, user.getUserId(), request.getSession().getId()); |
| | | return new Result(true, "success", |
| | | CollectionUtils.newObjectMap("userId", user.getUserId(), "userName", user.getName(), "imgPath", |
| | |
| | | } |
| | | |
| | | /** |
| | | * 后台:退出登录,后台系统 |
| | | * 后台:退出录,后台系统 |
| | | * |
| | | * @param account 账户 |
| | | * @return |
| | |
| | | } |
| | | |
| | | /** |
| | | * 后台:退出登录,后台系统 |
| | | * 后台:退出录,后台系统 |
| | | * |
| | | * @return |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 插入登录日志 |
| | | * 插入录日志 |
| | | * |
| | | * @param request |
| | | * @param lstUser |