管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2024-08-16 6dbd4c0d84e62235141c6ecb5b29eaac9ee1275e
src/main/java/com/lf/server/controller/all/SignController.java
@@ -3,12 +3,16 @@
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;
@@ -45,7 +49,13 @@
    SignService signService;
    @Autowired
    private OperateService operateService;
    @Autowired
    PropertiesConfig propertiesConfig;
    @Autowired
    private ScheduleService scheduleService;
    @SysLog()
    @ApiOperation(value = "跳转首页")
@@ -145,11 +155,15 @@
                return fail("创建令牌失败", null);
            }
            te.setAutoLogOut(SettingData.AUTO_LOGOUT);
            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);
        }
    }
@@ -167,7 +181,7 @@
            return success(flag ? "登出成功" : "登出失败", flag);
        } catch (Exception ex) {
            return fail(ex.getMessage(), false);
            return fail(ex, false);
        }
    }
@@ -186,7 +200,7 @@
            return success(flag ? "用户已登录" : "用户未登录", flag);
        } catch (Exception ex) {
            return fail(ex.getMessage(), false);
            return fail(ex, false);
        }
    }
@@ -202,7 +216,7 @@
            return success(ue);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -215,7 +229,34 @@
            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);
        }
    }
}