package com.iplatform.recvideo.service; import com.iplatform.model.po.Rc_video_t1; import com.iplatform.model.po.Rc_video_t2; import com.walker.jdbc.service.BaseServiceImpl; import org.springframework.stereotype.Service; import java.util.List; import java.util.Map; @Service public class VideoExecutorServiceImpl extends BaseServiceImpl { private static final String SQL_CHECK_VIDEO_STATUS = "select * from milvus_video_status where id=?"; private static final String SQL_CLEAR_VIDEO_T1 = "delete from rc_video_t1 where src_img=?"; private static final String SQL_CLEAR_VIDEO_T2 = "delete from rc_video_t2 where src_video_id=?"; /** * 写入视频相似度第一级临时数据,每个图像包含多个相似视频记录。 * @param list * @param srcImageId 原始图像ID */ public void execBatchInsertVideoT1(List list, String srcImageId){ // 写入新数据之前,先清除老视频数据,后续分析避免数据重复(每个视频) this.execute(SQL_CLEAR_VIDEO_T1, new Object[]{srcImageId}); this.insert(list); } /** * 写入视频相似度第二临时数据,每个原始视频对应多个相似视频,已排序存储。 * @param list * @param srcVideoId */ public void execBatchInsertVideoT2(List list, String srcVideoId){ this.execute(SQL_CLEAR_VIDEO_T2, new Object[]{srcVideoId}); this.insert(list); } /** * 根据原始视频ID返回相似记录集合。 * @param srcVideoId * @return */ public List queryVideoT_1List(String srcVideoId){ return this.select(new Rc_video_t1(), "where src_video_id=?", new Object[]{srcVideoId}); } /** * 查询视频加载状态表,是否已经完成加载(第一步),如果记录不存在说明还没有开始加载。 * @param videoStatusId * @return */ public boolean queryLoadVideoDone(String videoStatusId){ Map map = this.get(SQL_CHECK_VIDEO_STATUS, new Object[]{videoStatusId}); if(map == null){ return false; } int status = Integer.parseInt(map.get("status").toString()); if(status == 1){ return true; } return false; } }