|
@@ -73,7 +73,7 @@ public class MatchVideoServiceImpl implements MatchVideoService {
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public String searchVideo(SearchVideoParam searchVideoParam) {
|
|
|
+ public JSONObject searchVideo(SearchVideoParam searchVideoParam) {
|
|
|
JSONObject res = new JSONObject();
|
|
|
if (StringUtils.isEmpty(searchVideoParam.getContent())
|
|
|
|| StringUtils.isEmpty(searchVideoParam.getArticleId())
|
|
@@ -83,7 +83,7 @@ public class MatchVideoServiceImpl implements MatchVideoService {
|
|
|
res.put("code", 1);
|
|
|
res.put("status", "fail");
|
|
|
res.put("info", "params check error");
|
|
|
- return res.toJSONString();
|
|
|
+ return res;
|
|
|
}
|
|
|
String traceId = String.format("search-%s-%s", UUID.randomUUID(), System.currentTimeMillis() / 1000);
|
|
|
LongArticlesMatchVideo longArticlesMatchVideo = new LongArticlesMatchVideo();
|
|
@@ -120,13 +120,20 @@ public class MatchVideoServiceImpl implements MatchVideoService {
|
|
|
res.put("code", 0);
|
|
|
res.put("status", "success input to article queue");
|
|
|
res.put("traceId", traceId);
|
|
|
- return res.toJSONString();
|
|
|
+ return res;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String chooseMinigram(ChooseMinigramParam chooseMinigramParam) {
|
|
|
- String ghId = chooseMinigramParam.getGhId();
|
|
|
+ public JSONObject chooseMinigram(ChooseMinigramParam chooseMinigramParam) {
|
|
|
JSONObject res = new JSONObject();
|
|
|
+ if (StringUtils.isEmpty(chooseMinigramParam.getTraceId())
|
|
|
+ || StringUtils.isEmpty(chooseMinigramParam.getBusinessType())
|
|
|
+ || StringUtils.isEmpty(chooseMinigramParam.getMiniCode())) {
|
|
|
+ res.put("status", "fail");
|
|
|
+ res.put("code", 1);
|
|
|
+ res.put("info", "params check error");
|
|
|
+ }
|
|
|
+ String ghId = chooseMinigramParam.getGhId();
|
|
|
if (ghId != null && EXPERIMENT_27_GH_ID_SET.contains(ghId)) {
|
|
|
res.put("programAvatar", MinigramEnum.XYMHFQDD_27.getAvatar());
|
|
|
res.put("programId", MinigramEnum.XYMHFQDD_27.getId());
|
|
@@ -143,19 +150,19 @@ public class MatchVideoServiceImpl implements MatchVideoService {
|
|
|
res.put("programName", MinigramEnum.VLOG0.getName());
|
|
|
res.put("trace_id", chooseMinigramParam.getTraceId());
|
|
|
}
|
|
|
- return res.toJSONString();
|
|
|
+ return res;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String getOffVideos(GetOffVideosParam getOffVideosParam) {
|
|
|
+ public JSONObject getOffVideos(GetOffVideosParam getOffVideosParam) {
|
|
|
JSONObject res = new JSONObject();
|
|
|
if (StringUtils.isEmpty(getOffVideosParam.getPushType()) || StringUtils.isEmpty(getOffVideosParam.getTraceId())) {
|
|
|
res.put("error", "params error");
|
|
|
- return res.toJSONString();
|
|
|
+ return res;
|
|
|
}
|
|
|
if (!getOffVideosParam.getTraceId().startsWith("search")) {
|
|
|
res.put("msg", "do not process trace id");
|
|
|
- return res.toJSONString();
|
|
|
+ return res;
|
|
|
}
|
|
|
String traceId = getOffVideosParam.getTraceId();
|
|
|
LongArticlesMatchVideo matchVideo = longArticlesMatchVideoRepository.getByTraceId(traceId);
|
|
@@ -165,7 +172,7 @@ public class MatchVideoServiceImpl implements MatchVideoService {
|
|
|
param.put("traceId", getOffVideosParam.getTraceId());
|
|
|
HttpResponseContent httpResponseContent = HttpClientUtils.postData(url, param.toJSONString(),
|
|
|
HttpClientUtils.contentTypeJson);
|
|
|
- return httpResponseContent.getBodyContent();
|
|
|
+ return JSONObject.parseObject(httpResponseContent.getBodyContent());
|
|
|
}
|
|
|
String ghId = matchVideo.getGhId();
|
|
|
String response = matchVideo.getResponse();
|
|
@@ -191,11 +198,11 @@ public class MatchVideoServiceImpl implements MatchVideoService {
|
|
|
|
|
|
res.put("status", "success");
|
|
|
res.put("traceId", traceId);
|
|
|
- return res.toJSONString();
|
|
|
+ return res;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String recallVideos(RecallVideosParam recallVideosParam) throws UnsupportedEncodingException {
|
|
|
+ public JSONObject recallVideos(RecallVideosParam recallVideosParam) throws UnsupportedEncodingException {
|
|
|
JSONObject res = new JSONObject();
|
|
|
String traceId = recallVideosParam.getTraceId();
|
|
|
Integer miniprogramUseType = recallVideosParam.getMiniprogramUseType();
|
|
@@ -207,7 +214,7 @@ public class MatchVideoServiceImpl implements MatchVideoService {
|
|
|
param.put("miniprogramUseType", miniprogramUseType);
|
|
|
HttpResponseContent httpResponseContent = HttpClientUtils.postData(url, param.toJSONString(),
|
|
|
HttpClientUtils.contentTypeJson);
|
|
|
- return httpResponseContent.getBodyContent();
|
|
|
+ return JSONObject.parseObject(httpResponseContent.getBodyContent());
|
|
|
}
|
|
|
LongArticlesMatchVideo longArticlesMatchVideo = longArticlesMatchVideoRepository.getByTraceId(traceId);
|
|
|
if (Objects.equals(longArticlesMatchVideo.getContentStatus(), ConstantStatusEnum.TASK_PUBLISHED_CODE.getCode())) {
|
|
@@ -219,11 +226,11 @@ public class MatchVideoServiceImpl implements MatchVideoService {
|
|
|
longArticlesMatchVideo.setResponse(cardData.getNewItemList().toJSONString());
|
|
|
longArticlesMatchVideo.setSuccessStatus(1);
|
|
|
longArticlesMatchVideoRepository.save(longArticlesMatchVideo);
|
|
|
- return res.toJSONString();
|
|
|
+ return res;
|
|
|
}
|
|
|
|
|
|
res.put("traceId", traceId);
|
|
|
res.put("code", longArticlesMatchVideo.getContentStatus());
|
|
|
- return res.toJSONString();
|
|
|
+ return res;
|
|
|
}
|
|
|
}
|