cy
2022-10-11 59d2a63f363b5c4e1ac25af2457896ac2468d8c6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.iplatform.recvideo.service;
 
import com.iplatform.model.po.Rc_task_status;
import com.iplatform.model.po.Rc_video_batch;
import com.iplatform.reccommon.TaskType;
import com.walker.jdbc.service.BaseServiceImpl;
import org.springframework.stereotype.Service;
 
import java.util.List;
import java.util.Map;
 
@Service
public class VideoLoaderServiceImpl extends BaseServiceImpl {
 
    private static final String SQL_NEXT_BATCH = "select max(last_value) next_batch_id from rc_task_status where task_type=? and (status='0' or status='1')";
 
    /**
     * 查找当前记录中已有的最大批次值。
     * @return
     * @date 2022-09-26
     */
    public long queryNextBatchValue(){
        Map<String, Object> nextBatchMap = this.get(SQL_NEXT_BATCH, new Object[]{TaskType.INDEX_VIDEO_LOAD});
        if(nextBatchMap == null){
            return 0;
        }
        if(nextBatchMap.get("next_batch_id") == null){
            return 0;
        }
        return Long.parseLong(nextBatchMap.get("next_batch_id").toString());
    }
 
    /**
     * 保存批次视频记录,并添加新的(相似度检索)状态。
     * @param videoBatchList
     * @param status
     * @return
     * @date 2022-09-26
     */
    public int execSaveBatchAndStatus(List<Rc_video_batch> videoBatchList, Rc_task_status status){
        this.save(videoBatchList);
//        this.save(status);
        return videoBatchList.size();
    }
}