|
@@ -1,9 +1,15 @@
|
|
package cn.com.usky.iot.controller;
|
|
package cn.com.usky.iot.controller;
|
|
|
|
|
|
|
|
+import cn.com.usky.iot.auth.TokenAuthBO;
|
|
|
|
+import cn.com.usky.iot.auth.TokenAuthService;
|
|
|
|
+import cn.com.usky.iot.controller.login.Constants;
|
|
|
|
+import cn.com.usky.iot.entity.YtiotTAdmin;
|
|
import cn.com.usky.iot.entity.sys.SysLogDTO;
|
|
import cn.com.usky.iot.entity.sys.SysLogDTO;
|
|
import cn.com.usky.log.LogService;
|
|
import cn.com.usky.log.LogService;
|
|
|
|
+import cn.com.usky.utils.HttpServletRequestUtils;
|
|
import cn.com.usky.utils.Page;
|
|
import cn.com.usky.utils.Page;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import org.apache.tools.ant.taskdefs.condition.Http;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
@@ -11,6 +17,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @author laowo
|
|
* @author laowo
|
|
* @version v1.0
|
|
* @version v1.0
|
|
@@ -23,13 +32,28 @@ public class Log {
|
|
@Autowired
|
|
@Autowired
|
|
private LogService logService;
|
|
private LogService logService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private TokenAuthService tokenAuthService;
|
|
@RequestMapping("queryLogList")
|
|
@RequestMapping("queryLogList")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
public String queryLogList(
|
|
public String queryLogList(
|
|
|
|
+ HttpServletResponse response,
|
|
|
|
+ HttpServletRequest request,
|
|
@RequestParam(value = "pageSize", defaultValue = "20") Integer pageSize,
|
|
@RequestParam(value = "pageSize", defaultValue = "20") Integer pageSize,
|
|
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo
|
|
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo
|
|
) {
|
|
) {
|
|
- Page<SysLogDTO> sysLogDTOPage = logService.queryLogList(pageSize, pageNo);
|
|
|
|
|
|
+ TokenAuthBO tokenAuthBO = HttpServletRequestUtils.tokenAuthForYT(request, tokenAuthService);
|
|
|
|
+ boolean isAuth = tokenAuthBO.isAuthState();
|
|
|
|
+ if (!isAuth) {
|
|
|
|
+ com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
|
|
|
|
+ json.put("check", false);
|
|
|
|
+ json.put("errMsg", "权限错误,请重新登录");
|
|
|
|
+ return json.toJSONString();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ YtiotTAdmin o = (YtiotTAdmin) tokenAuthBO.getData().get(Constants.USER_INFO);
|
|
|
|
+ String vLoginname = o.getVLoginname();
|
|
|
|
+ Page<SysLogDTO> sysLogDTOPage = logService.queryLogList(pageSize, pageNo,vLoginname);
|
|
String s = JSONObject.toJSON(sysLogDTOPage).toString();
|
|
String s = JSONObject.toJSON(sysLogDTOPage).toString();
|
|
return s;
|
|
return s;
|
|
}
|
|
}
|