|
|
@@ -1,5 +1,6 @@
|
|
|
package cn.hnthyy.thmz.controller.mz;
|
|
|
|
|
|
+import cn.hnthyy.thmz.Utils.HttpUtil;
|
|
|
import cn.hnthyy.thmz.Utils.JsonUtil;
|
|
|
import cn.hnthyy.thmz.Utils.MacAddressUtil;
|
|
|
import cn.hnthyy.thmz.Utils.TokenUtil;
|
|
|
@@ -65,11 +66,11 @@ public class WindowsController {
|
|
|
DecodedJWT decodedJWT=TokenUtil.parseJWT(token);
|
|
|
User tokenUser=(User)JsonUtil.jsontoObject(decodedJWT.getSubject(),User.class);
|
|
|
try {
|
|
|
-// String ipAddress=MacAddressUtil.getIpAddr(httpServletRequest);
|
|
|
-// windows.setIpAddress(ipAddress);
|
|
|
+ String ipAddress=HttpUtil.getIPAddress(httpServletRequest);
|
|
|
+ windows.setIpAddress(ipAddress);
|
|
|
windows.setUserIdCode(tokenUser.getUserIdCode());
|
|
|
windows.setCreateDate(new Date());
|
|
|
- Windows windowsDb=windowsService.queryLastWindowsByUserIdCode(tokenUser.getUserIdCode(),null);
|
|
|
+ Windows windowsDb=windowsService.queryLastWindowsByUserIdCode(tokenUser.getUserIdCode(),ipAddress);
|
|
|
if(windowsDb!=null){
|
|
|
windows.setId(windowsDb.getId());
|
|
|
}
|
|
|
@@ -121,11 +122,11 @@ public class WindowsController {
|
|
|
DecodedJWT decodedJWT=TokenUtil.parseJWT(token);
|
|
|
User tokenUser=(User)JsonUtil.jsontoObject(decodedJWT.getSubject(),User.class);
|
|
|
try {
|
|
|
-// String ipAddress=MacAddressUtil.getIpAddr(httpServletRequest);
|
|
|
-// windows.setIpAddress(ipAddress);
|
|
|
+ String ipAddress=HttpUtil.getIPAddress(httpServletRequest);
|
|
|
+ windows.setIpAddress(ipAddress);
|
|
|
windows.setUserIdCode(tokenUser.getUserIdCode());
|
|
|
windows.setCreateDate(new Date());
|
|
|
- Windows windowsDb=windowsService.queryLastWindowsByUserIdCode(tokenUser.getUserIdCode(),null);
|
|
|
+ Windows windowsDb=windowsService.queryLastWindowsByUserIdCode(tokenUser.getUserIdCode(),ipAddress);
|
|
|
if(windowsDb!=null){
|
|
|
windows.setId(windowsDb.getId());
|
|
|
}
|
|
|
@@ -267,7 +268,7 @@ public class WindowsController {
|
|
|
return resultMap;
|
|
|
}
|
|
|
try {
|
|
|
- String ipAddress=MacAddressUtil.getIpAddr(httpServletRequest);
|
|
|
+ String ipAddress=HttpUtil.getIPAddress(httpServletRequest);
|
|
|
DecodedJWT decodedJWT=TokenUtil.parseJWT(token);
|
|
|
User tokenUser=(User)JsonUtil.jsontoObject(decodedJWT.getSubject(),User.class);
|
|
|
Windows windows=windowsService.queryLastWindowsByUserIdCode(tokenUser.getUserIdCode(),ipAddress);
|