shikeying
2022-10-11 71d355f4db31807a13d78e6e257e9d26c4702c23
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
46
47
48
49
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){
        // 注意:如果要插入数据,不要设置设置主键(save),
        // 如果要设置自己主键,请使用方法: insert();
        // 2022-10-11
        this.save(videoBatchList);
        // 已经在外部保存了,这里就不需要了。
//        this.save(status);
        return videoBatchList.size();
    }
}