| | |
| | | import com.lf.server.annotation.SysLog; |
| | | import com.lf.server.config.PropertiesConfig; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | 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; |
| | |
| | | SignService signService; |
| | | |
| | | @Autowired |
| | | private OperateService operateService; |
| | | |
| | | @Autowired |
| | | PropertiesConfig propertiesConfig; |
| | | |
| | | @Autowired |
| | | private ScheduleService scheduleService; |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "跳转首页") |
| | |
| | | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询是/否为管理员") |
| | | @GetMapping(value = "/selectForIsAdmin") |
| | | public ResponseMsg<Boolean> selectForIsAdmin(HttpServletRequest req) { |
| | | @ApiOperation(value = "插入操作日志") |
| | | @GetMapping("/insertOpLog") |
| | | public ResponseMsg<Object> insertOpLog(String m1, String m2, HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue == null) { |
| | | return fail("用户未登录", false); |
| | | if (StringHelper.isEmpty(m1)) { |
| | | return fail("一级模块必填", 0); |
| | | } |
| | | |
| | | Integer rows = userService.selectForIsAdmin(ue.getId()); |
| | | OperateEntity oe = new OperateEntity(); |
| | | oe.setIp(WebHelper.getIpAddress(req)); |
| | | oe.setModular1(m1); |
| | | oe.setModular2(m2); |
| | | oe.setType(0); |
| | | |
| | | return success("成功", rows > 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.getMessage(), false); |
| | | return fail(ex, 0); |
| | | } |
| | | } |
| | | } |