|
@@ -6,11 +6,17 @@ import java.util.List;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.mybatisflex.core.paginate.Page;
|
|
|
import com.mybatisflex.core.query.QueryWrapper;
|
|
|
+import com.taais.biz.domain.bo.VideoStableStartBo;
|
|
|
+import com.taais.common.core.core.domain.CommonResult;
|
|
|
import com.taais.common.core.utils.MapstructUtils;
|
|
|
import com.taais.common.orm.core.page.PageQuery;
|
|
|
import com.taais.common.core.core.page.PageResult;
|
|
|
import com.taais.common.orm.core.service.impl.BaseServiceImpl;
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
import jakarta.annotation.Resource;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.http.client.methods.HttpPost;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import com.taais.biz.mapper.VideoStableMapper;
|
|
@@ -19,6 +25,11 @@ import com.taais.biz.domain.bo.VideoStableBo;
|
|
|
import com.taais.biz.domain.vo.VideoStableVo;
|
|
|
import com.taais.biz.service.IVideoStableService;
|
|
|
|
|
|
+import org.apache.http.client.methods.CloseableHttpResponse;
|
|
|
+import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
+import org.apache.http.impl.client.HttpClients;
|
|
|
+import org.apache.http.util.EntityUtils;
|
|
|
+
|
|
|
import static com.taais.biz.domain.table.VideoStableTableDef.VIDEO_STABLE;
|
|
|
|
|
|
/**
|
|
@@ -28,7 +39,11 @@ import static com.taais.biz.domain.table.VideoStableTableDef.VIDEO_STABLE;
|
|
|
* 2024-08-30
|
|
|
*/
|
|
|
@Service
|
|
|
+@Slf4j
|
|
|
public class VideoStableServiceImpl extends BaseServiceImpl<VideoStableMapper, VideoStable> implements IVideoStableService {
|
|
|
+ @Value("${server.video_stable_url}")
|
|
|
+ private String video_stable_url;
|
|
|
+
|
|
|
@Resource
|
|
|
private VideoStableMapper videoStableMapper;
|
|
|
|
|
@@ -40,23 +55,23 @@ public class VideoStableServiceImpl extends BaseServiceImpl<VideoStableMapper, V
|
|
|
private QueryWrapper buildQueryWrapper(VideoStableBo videoStableBo) {
|
|
|
QueryWrapper queryWrapper = super.buildBaseQueryWrapper();
|
|
|
queryWrapper.and(VIDEO_STABLE.NAME.like
|
|
|
- (videoStableBo.getName()));
|
|
|
+ (videoStableBo.getName()));
|
|
|
queryWrapper.and(VIDEO_STABLE.STATUS.eq
|
|
|
- (videoStableBo.getStatus()));
|
|
|
+ (videoStableBo.getStatus()));
|
|
|
queryWrapper.and(VIDEO_STABLE.INPUT_PATH.eq
|
|
|
- (videoStableBo.getInputPath()));
|
|
|
+ (videoStableBo.getInputPath()));
|
|
|
queryWrapper.and(VIDEO_STABLE.OUT_PATH.eq
|
|
|
- (videoStableBo.getOutPath()));
|
|
|
+ (videoStableBo.getOutPath()));
|
|
|
queryWrapper.and(VIDEO_STABLE.START_TIME.eq
|
|
|
- (videoStableBo.getStartTime()));
|
|
|
+ (videoStableBo.getStartTime()));
|
|
|
queryWrapper.and(VIDEO_STABLE.END_TIME.eq
|
|
|
- (videoStableBo.getEndTime()));
|
|
|
+ (videoStableBo.getEndTime()));
|
|
|
queryWrapper.and(VIDEO_STABLE.COST_SECOND.eq
|
|
|
- (videoStableBo.getCostSecond()));
|
|
|
+ (videoStableBo.getCostSecond()));
|
|
|
queryWrapper.and(VIDEO_STABLE.LOG.eq
|
|
|
- (videoStableBo.getLog()));
|
|
|
+ (videoStableBo.getLog()));
|
|
|
queryWrapper.and(VIDEO_STABLE.REMARKS.eq
|
|
|
- (videoStableBo.getRemarks()));
|
|
|
+ (videoStableBo.getRemarks()));
|
|
|
|
|
|
return queryWrapper;
|
|
|
}
|
|
@@ -69,7 +84,7 @@ public class VideoStableServiceImpl extends BaseServiceImpl<VideoStableMapper, V
|
|
|
*/
|
|
|
@Override
|
|
|
public VideoStableVo selectById(Long id) {
|
|
|
- return this.getOneAs(query().where(VIDEO_STABLE.ID.eq(id)), VideoStableVo.class);
|
|
|
+ return this.getOneAs(query().where(VIDEO_STABLE.ID.eq(id)), VideoStableVo.class);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -82,7 +97,7 @@ public class VideoStableServiceImpl extends BaseServiceImpl<VideoStableMapper, V
|
|
|
@Override
|
|
|
public List<VideoStableVo> selectList(VideoStableBo videoStableBo) {
|
|
|
QueryWrapper queryWrapper = buildQueryWrapper(videoStableBo);
|
|
|
- return this.listAs(queryWrapper, VideoStableVo.class);
|
|
|
+ return this.listAs(queryWrapper, VideoStableVo.class);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -94,7 +109,7 @@ public class VideoStableServiceImpl extends BaseServiceImpl<VideoStableMapper, V
|
|
|
@Override
|
|
|
public PageResult<VideoStableVo> selectPage(VideoStableBo videoStableBo) {
|
|
|
QueryWrapper queryWrapper = buildQueryWrapper(videoStableBo);
|
|
|
- Page<VideoStableVo> page = this.pageAs(PageQuery.build(), queryWrapper, VideoStableVo.class);
|
|
|
+ Page<VideoStableVo> page = this.pageAs(PageQuery.build(), queryWrapper, VideoStableVo.class);
|
|
|
return PageResult.build(page);
|
|
|
}
|
|
|
|
|
@@ -106,9 +121,9 @@ public class VideoStableServiceImpl extends BaseServiceImpl<VideoStableMapper, V
|
|
|
*/
|
|
|
@Override
|
|
|
public boolean insert(VideoStableBo videoStableBo) {
|
|
|
- VideoStable videoStable =MapstructUtils.convert(videoStableBo, VideoStable. class);
|
|
|
+ VideoStable videoStable = MapstructUtils.convert(videoStableBo, VideoStable.class);
|
|
|
|
|
|
- return this.save(videoStable);//使用全局配置的雪花算法主键生成器生成ID值
|
|
|
+ return this.save(videoStable);// 使用全局配置的雪花算法主键生成器生成ID值
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -119,10 +134,10 @@ public class VideoStableServiceImpl extends BaseServiceImpl<VideoStableMapper, V
|
|
|
*/
|
|
|
@Override
|
|
|
public boolean update(VideoStableBo videoStableBo) {
|
|
|
- VideoStable videoStable =MapstructUtils.convert(videoStableBo, VideoStable. class);
|
|
|
- if (ObjectUtil.isNotNull(videoStable) && ObjectUtil.isNotNull(videoStable.getId())){
|
|
|
+ VideoStable videoStable = MapstructUtils.convert(videoStableBo, VideoStable.class);
|
|
|
+ if (ObjectUtil.isNotNull(videoStable) && ObjectUtil.isNotNull(videoStable.getId())) {
|
|
|
boolean updated = this.updateById(videoStable);
|
|
|
- return updated;
|
|
|
+ return updated;
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
@@ -139,4 +154,19 @@ public class VideoStableServiceImpl extends BaseServiceImpl<VideoStableMapper, V
|
|
|
return this.removeByIds(Arrays.asList(ids));
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public CommonResult start(VideoStableStartBo videoStableStartBo) {
|
|
|
+ log.info("start video_stable_url: {}", video_stable_url);
|
|
|
+ try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
|
|
|
+ HttpPost request = new HttpPost(video_stable_url);
|
|
|
+ try (CloseableHttpResponse response = httpClient.execute(request)) {
|
|
|
+ String responseBody = EntityUtils.toString(response.getEntity());
|
|
|
+ System.out.println(responseBody);
|
|
|
+ return CommonResult.success("start video_stable success");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return CommonResult.fail("start video_stable error -> " + e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|