Commit ca88cc4c authored by 宋新宇's avatar 宋新宇

抖小更改及监测

parent b0a11e0f
...@@ -38,7 +38,7 @@ public class ParameterSetupDyVideoFlow extends NodeFlow<StoryNovelAction> { ...@@ -38,7 +38,7 @@ public class ParameterSetupDyVideoFlow extends NodeFlow<StoryNovelAction> {
//StoryLogin storyLogin = JSONObject.parseObject(s,StoryLogin.class); //StoryLogin storyLogin = JSONObject.parseObject(s,StoryLogin.class);
//匹配OpenId //匹配OpenId
//VideoUpload videoUpload = JSONObject.parseObject(s,VideoUpload.class); //VideoUpload videoUpload = JSONObject.parseObject(s,VideoUpload.class);
VideoUpload videoUpload = up.getOld(VideoUpload.class,assembleKey(openId)); VideoUpload videoUpload = up.get(VideoUpload.class,assembleKey(openId));
action.setVideoUpload(videoUpload); action.setVideoUpload(videoUpload);
//StoryNovelAction对像参数填充 //StoryNovelAction对像参数填充
......
...@@ -9,6 +9,8 @@ import com.lwby.marketing.po.VideoUpload; ...@@ -9,6 +9,8 @@ import com.lwby.marketing.po.VideoUpload;
import com.lwby.marketing.util.HttpUtil; import com.lwby.marketing.util.HttpUtil;
import com.lwby.marketing.util.ResultConstant; import com.lwby.marketing.util.ResultConstant;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
...@@ -17,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -17,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects;
/** /**
* @author songxinyu * @author songxinyu
...@@ -29,6 +32,10 @@ public class DyVideoController { ...@@ -29,6 +32,10 @@ public class DyVideoController {
public static final String ATTRIBUTE_URL = "https://analytics.oceanengine.com/api/v2/conversion"; public static final String ATTRIBUTE_URL = "https://analytics.oceanengine.com/api/v2/conversion";
private static final Logger DYVIDEO_SYS_LOG = LoggerFactory.getLogger("dyvideo.sys");
private static final Logger DYVIDEO_ERROR_LOG = LoggerFactory.getLogger("dyvideo.error");
@Resource @Resource
DyVideoUniversalProcess up; DyVideoUniversalProcess up;
...@@ -37,12 +44,14 @@ public class DyVideoController { ...@@ -37,12 +44,14 @@ public class DyVideoController {
Map map = new HashMap(); Map map = new HashMap();
String result = ""; String result = "";
VideoUpload videoUpload = up.get(VideoUpload.class,assembleKey(openId)); VideoUpload videoUpload = up.get(VideoUpload.class,assembleKey(openId));
if (Objects.nonNull(videoUpload)) {
Integer platformId = videoUpload.getPlatformId(); Integer platformId = videoUpload.getPlatformId();
String uploadKey = String.format("dv_%s_%d_%s", openId, platformId,videoUpload.getMedia()); String uploadKey = String.format("dv_%s_%d_%s", openId, platformId,videoUpload.getMedia());
if (up.exists(uploadKey)) { if (up.exists(uploadKey)) {
map.put("code", ResultConstant.CALL_BACK_UPED_FAIL); map.put("code", ResultConstant.CALL_BACK_UPED_FAIL);
map.put("message",ResultConstant.CALL_BACK_UPED_MESSAGE); map.put("message",ResultConstant.CALL_BACK_UPED_MESSAGE);
result = JSONObject.toJSONString(map); result = JSONObject.toJSONString(map);
DYVIDEO_SYS_LOG.error("DyVideoController uploadBehavoir uped,uploadKey={}",uploadKey);
return result; return result;
} }
...@@ -71,14 +80,24 @@ public class DyVideoController { ...@@ -71,14 +80,24 @@ public class DyVideoController {
map.put("code", ResultConstant.CALL_BACK_FAIL); map.put("code", ResultConstant.CALL_BACK_FAIL);
map.put("message",ResultConstant.CALL_BACK_FAIL_MESSAGE); map.put("message",ResultConstant.CALL_BACK_FAIL_MESSAGE);
result = JSONObject.toJSONString(map) ; result = JSONObject.toJSONString(map) ;
DYVIDEO_SYS_LOG.error("DyVideoController uploadBehavoir send back fail,uploadKey={},code={}",uploadKey,resultCode);
} }
return result;
} catch (Exception e) { } catch (Exception e) {
map.put("code", ResultConstant.CALL_BACK_FAIL); map.put("code", ResultConstant.CALL_BACK_FAIL);
map.put("message",ResultConstant.CALL_BACK_FAIL_MESSAGE); map.put("message",ResultConstant.CALL_BACK_FAIL_MESSAGE);
result = JSONObject.toJSONString(map) ; result = JSONObject.toJSONString(map) ;
DYVIDEO_ERROR_LOG.error("DyVideoController uploadBehavoir exception,uploadKey={}",uploadKey,e);
return result; return result;
} }
} else {
map.put("code", ResultConstant.CALL_BACK_NOCACHE_FAIL);
map.put("message",ResultConstant.CALL_BACK_NOCACHE_MESSAGE);
result = JSONObject.toJSONString(map) ;
DYVIDEO_SYS_LOG.error("DyVideoController uploadBehavoir no cache,videoUpload={}",JSONObject.toJSONString(videoUpload));
}
return result;
} }
public String assembleKey(String openId) { public String assembleKey(String openId) {
......
...@@ -48,7 +48,7 @@ public class DyVideoJRTTNotify extends DYNotify { ...@@ -48,7 +48,7 @@ public class DyVideoJRTTNotify extends DYNotify {
try { try {
String result = HttpUtil.post(ATTRIBUTE_URL, userJson); String result = HttpUtil.post(ATTRIBUTE_URL, userJson);
Integer resultCode = (Integer) JSON.parseObject(result).get("code"); Integer resultCode = (Integer) JSON.parseObject(result).get("code");
DYVIDEO_SYS_LOG.info("DyVideoJRTTNotify.video.{}.upload,userId={},channel={},platform={}",eventType,na.getUserId(),na.getChannelId(),na.getPlatformId()); DYVIDEO_SYS_LOG.info("DyVideoJRTTNotify.video.{}.upload,userId={},channel={},platform={},code={}",eventType,na.getUserId(),na.getChannelId(),na.getPlatformId(),resultCode);
return resultCode == 0; return resultCode == 0;
} catch (Exception e) { } catch (Exception e) {
return false; return false;
......
...@@ -5,10 +5,12 @@ public class ResultConstant { ...@@ -5,10 +5,12 @@ public class ResultConstant {
public final static Integer CALL_BACK_SUCCESS = 0; public final static Integer CALL_BACK_SUCCESS = 0;
public final static Integer CALL_BACK_FAIL = 1; public final static Integer CALL_BACK_FAIL = 1;
public final static Integer CALL_BACK_UPED_FAIL = 2; public final static Integer CALL_BACK_UPED_FAIL = 2;
public final static Integer CALL_BACK_NOCACHE_FAIL = 3;
public final static String CALL_BACK_SUCCESS_MESSAGE = "上报成功"; public final static String CALL_BACK_SUCCESS_MESSAGE = "上报成功";
public final static String CALL_BACK_FAIL_MESSAGE = "上报失败"; public final static String CALL_BACK_FAIL_MESSAGE = "上报失败";
public final static String CALL_BACK_UPED_MESSAGE = "已上报一次"; public final static String CALL_BACK_UPED_MESSAGE = "已上报一次";
public final static String CALL_BACK_NOCACHE_MESSAGE = "无点击缓存,用户超过7天";
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment