| | |
| | | import com.lf.server.entity.all.SettingData; |
| | | import com.lf.server.entity.all.StaticData; |
| | | import com.lf.server.entity.sys.LoginEntity; |
| | | import com.lf.server.entity.sys.OperateEntity; |
| | | import com.lf.server.entity.sys.TokenEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.*; |
| | | import com.lf.server.service.all.ScheduleService; |
| | | import com.lf.server.service.sys.LoginService; |
| | | import com.lf.server.service.sys.OperateService; |
| | | import com.lf.server.service.sys.TokenService; |
| | | import com.lf.server.service.sys.UserService; |
| | | import com.lf.server.service.all.SignService; |
| | |
| | | |
| | | @Autowired |
| | | SignService signService; |
| | | |
| | | @Autowired |
| | | private OperateService operateService; |
| | | |
| | | @Autowired |
| | | PropertiesConfig propertiesConfig; |
| | |
| | | return fail("密码不正确", null); |
| | | } |
| | | |
| | | int onlineUser = scheduleService.countOnlineUsers(); |
| | | if (onlineUser >= SettingData.MAX_USER_LOGIN) { |
| | | return fail("达到用户访问量上限,拒绝登录", null); |
| | | } |
| | | |
| | | LoginEntity le = loginService.getNewLogin(ue.getId(), 1, 1, 1, req); |
| | | Integer rows = loginService.insertLogin(le); |
| | | if (rows == 0) { |
| | |
| | | |
| | | tokenService.saveToken(ue, te, req, res); |
| | | |
| | | return success(te); |
| | | int onlineUser = scheduleService.countOnlineUsers(); |
| | | String msg = onlineUser >= SettingData.MAX_USER_LOGIN ? "警告:系统已经到达用户访问量的上限!" : ""; |
| | | |
| | | return success(msg, te); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(flag ? "登出成功" : "登出失败", flag); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), false); |
| | | return fail(ex, false); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(flag ? "用户已登录" : "用户未登录", flag); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), false); |
| | | return fail(ex, false); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(ue); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(key); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "插入操作日志") |
| | | @GetMapping("/insertOpLog") |
| | | public ResponseMsg<Object> insertOpLog(String m1, String m2, HttpServletRequest req) { |
| | | try { |
| | | if (StringHelper.isEmpty(m1)) { |
| | | return fail("一级模块必填", 0); |
| | | } |
| | | |
| | | OperateEntity oe = new OperateEntity(); |
| | | oe.setIp(WebHelper.getIpAddress(req)); |
| | | oe.setModular1(m1); |
| | | oe.setModular2(m2); |
| | | oe.setType(0); |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue != null) { |
| | | oe.setUserid(ue.getId()); |
| | | } |
| | | |
| | | int rows = operateService.insertOperate(oe); |
| | | |
| | | return success(rows); |
| | | } catch (Exception ex) { |
| | | return fail(ex, 0); |
| | | } |
| | | } |
| | | } |