VideoUnderstandServiceImpl.java 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. package com.tzld.piaoquan.featurestools.service.impl;
  2. import com.alibaba.fastjson.JSON;
  3. import com.alibaba.fastjson.JSONObject;
  4. import com.tzld.piaoquan.featurestools.model.vo.VideoUnderstandParam;
  5. import com.tzld.piaoquan.featurestools.model.vo.VideoUnderstandResult;
  6. import com.tzld.piaoquan.featurestools.service.VideoUnderstandService;
  7. import com.tzld.piaoquan.featurestools.util.HttpClientUtil;
  8. import com.tzld.piaoquan.featurestools.util.HttpPoolClientUtil;
  9. import lombok.extern.slf4j.Slf4j;
  10. import org.springframework.stereotype.Service;
  11. @Slf4j
  12. @Service
  13. public class VideoUnderstandServiceImpl implements VideoUnderstandService {
  14. private static final HttpPoolClientUtil httpPoolClientUtil = HttpClientUtil.create(5000, 200000, 10, 20, 3, 3000);
  15. @Override
  16. public VideoUnderstandResult getVideoUnderstandResult(VideoUnderstandParam videoUnderstandParam) {
  17. try {
  18. String url = "http://47.84.45.73:5005/understander/video";
  19. String post = httpPoolClientUtil.post(url, JSONObject.toJSONString(videoUnderstandParam));
  20. JSONObject jsonObject = JSON.parseObject(post);
  21. return jsonObject.toJavaObject(VideoUnderstandResult.class);
  22. } catch (Exception e) {
  23. log.error("getVideoUnderstandResult error", e);
  24. }
  25. return null;
  26. }
  27. }