|
@@ -12,6 +12,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.applet.Applet;
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
@@ -49,12 +51,12 @@ public class IpSaveListener implements RocketMQListener<String> {
|
|
|
IpSavePo ipSavePo = new IpSavePo();
|
|
|
if (StringUtils.isNotBlank(param)) {
|
|
|
ipSavePo.setParams(param);
|
|
|
- if (param.contains("userId")) {
|
|
|
+ if (param.contains("userId")||param.contains("keyword")) {
|
|
|
String[] split = param.split("&");
|
|
|
for (String s : split) {
|
|
|
if (s.contains("userId") && s.contains("=")) {
|
|
|
String[] split1 = s.split("=");
|
|
|
- if (split1.length > 2) {
|
|
|
+ if (split1.length > 1) {
|
|
|
String value = split1[1];
|
|
|
String trim = value.trim();
|
|
|
if (StringUtils.isNotBlank(trim)) {
|
|
@@ -62,6 +64,18 @@ public class IpSaveListener implements RocketMQListener<String> {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if(s.contains("keyword") && s.contains("=")){
|
|
|
+ String[] split1 = s.split("=");
|
|
|
+ if(split1.length > 1){
|
|
|
+ String value = split1[1];
|
|
|
+ try {
|
|
|
+ String va = java.net.URLDecoder.decode(value, "UTF-8");
|
|
|
+ ipSavePo.setKeyWord(va);
|
|
|
+ } catch (UnsupportedEncodingException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -74,7 +88,9 @@ public class IpSaveListener implements RocketMQListener<String> {
|
|
|
if (StringUtils.isNotBlank(ip)) {
|
|
|
ipSavePo.setIp(ip);
|
|
|
}
|
|
|
- ipSavePo.setSaveTime(new Date());
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String nowDate = format.format(new Date());
|
|
|
+ ipSavePo.setSaveTime(nowDate);
|
|
|
ipSaveService.save(ipSavePo);
|
|
|
}
|
|
|
}
|