package com.xjrsoft.module.liteflow.node;

import cn.hutool.core.convert.Convert;
import com.xjrsoft.XjrSoftApplication;
import com.xjrsoft.module.hikvision.mapper.HikvisionDataMapper;
import com.xjrsoft.module.hikvision.util.FaceImportUtil;
import com.xjrsoft.module.personnel.entity.StundentFaceProcess;
import com.xjrsoft.module.personnel.service.IStundentFaceProcessService;
import com.xjrsoft.module.teacher.mapper.FaceImportMapper;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import static org.junit.jupiter.api.Assertions.*;

/**
 * @author dzx
 * @date 2024/6/11
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = XjrSoftApplication.class)
class ImportStudentFaceNodeTest {
    @Autowired
    private IStundentFaceProcessService stundentFaceProcessService;

    @Autowired
    private HikvisionDataMapper hikvisionDataMapper;

    @Autowired
    private FaceImportMapper faceImportMapper;
    @Test
    void test(){
        Long formId = 1799211798557667328L;
        if (formId != null) {
            String fileUrl = faceImportMapper.GetStudentHikvisionImgById(formId);
            // 数据处理
            StundentFaceProcess dataObj = stundentFaceProcessService.getById(formId);
            dataObj.setStatus(1);
            dataObj.setExamStatus(1);
            String result = FaceImportUtil.ImportStudentFace(hikvisionDataMapper.getStudentHikvisionId(dataObj.getUserId()), fileUrl);
            dataObj.setHikvisionResult(result);
            stundentFaceProcessService.updateById(dataObj);


        }
    }
}