|
@@ -1,11 +1,15 @@
|
|
|
package cn.hnthyy.thmz.service.impl.thmz;
|
|
|
|
|
|
+import cn.hnthyy.thmz.Utils.Tools;
|
|
|
+import cn.hnthyy.thmz.entity.thmz.Config;
|
|
|
import cn.hnthyy.thmz.entity.thmz.Windows;
|
|
|
+import cn.hnthyy.thmz.mapper.thmz.ConfigMapper;
|
|
|
import cn.hnthyy.thmz.mapper.thmz.WindowsMapper;
|
|
|
import cn.hnthyy.thmz.service.thmz.WindowsService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.util.Date;
|
|
|
import java.util.Map;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
@@ -18,9 +22,13 @@ public class WindowsServiceImpl implements WindowsService {
|
|
|
@SuppressWarnings("all")
|
|
|
@Autowired
|
|
|
private WindowsMapper windowsMapper;
|
|
|
+ @Resource
|
|
|
+ private ConfigMapper configMapper;
|
|
|
@Override
|
|
|
public int saveWindows(Windows windows) {
|
|
|
map.remove(windows.getIpAddress());
|
|
|
+ Config config = configMapper.selectConfigByKey("thmz_group");
|
|
|
+ Tools.sendRefreshCacheService(config,"initWindowsCache");
|
|
|
if(windows.getId()==null){
|
|
|
return windowsMapper.insertUser(windows);
|
|
|
}
|
|
@@ -28,6 +36,12 @@ public class WindowsServiceImpl implements WindowsService {
|
|
|
return windowsMapper.updateWindows(windows);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void initWindowsCache() {
|
|
|
+ map.clear();
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Windows queryLastWindowsByUserIdCode(String userIdCode) {
|
|
|
return windowsMapper.selectLastWindowsByUserIdCode(userIdCode);
|