|
@@ -1,10 +1,11 @@
|
|
package com.fdkankan.tracking.controller;
|
|
package com.fdkankan.tracking.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
-import com.fdkankan.tracking.entit.TrackingBody;
|
|
|
|
-import com.fdkankan.tracking.entit.TrackingEntity;
|
|
|
|
|
|
+import com.fdkankan.tracking.entity.TrackingBody;
|
|
|
|
+import com.fdkankan.tracking.entity.TrackingEntity;
|
|
import com.fdkankan.tracking.service.TrackingService;
|
|
import com.fdkankan.tracking.service.TrackingService;
|
|
import com.fdkankan.tracking.utils.IpUtils;
|
|
import com.fdkankan.tracking.utils.IpUtils;
|
|
|
|
+import com.fdkankan.web.response.ResultData;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -27,10 +28,10 @@ public class TrackingController {
|
|
|
|
|
|
|
|
|
|
@RequestMapping("save")
|
|
@RequestMapping("save")
|
|
- public void saveLog(@RequestBody TrackingEntity entity, HttpServletRequest request){
|
|
|
|
|
|
+ public ResultData saveLog(@RequestBody TrackingEntity entity, HttpServletRequest request){
|
|
TrackingBody trackingBody = entity.getPayload();
|
|
TrackingBody trackingBody = entity.getPayload();
|
|
if(ObjectUtils.isEmpty(trackingBody)){
|
|
if(ObjectUtils.isEmpty(trackingBody)){
|
|
- return;
|
|
|
|
|
|
+ return ResultData.ok();
|
|
}
|
|
}
|
|
trackingBody.setUserAgent(request.getHeader("user-agent"));
|
|
trackingBody.setUserAgent(request.getHeader("user-agent"));
|
|
trackingBody.setUserIP(IpUtils.getIPAddress(request));
|
|
trackingBody.setUserIP(IpUtils.getIPAddress(request));
|
|
@@ -43,5 +44,8 @@ public class TrackingController {
|
|
}
|
|
}
|
|
log.info("收到打点请求:{}", JSONObject.toJSONString(entity));
|
|
log.info("收到打点请求:{}", JSONObject.toJSONString(entity));
|
|
trackingService.save(entity);
|
|
trackingService.save(entity);
|
|
|
|
+
|
|
|
|
+ return ResultData.ok();
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|