package com.qmth.distributed.print;

import com.qmth.teachcloud.common.bean.params.UserPushParam;
import com.qmth.teachcloud.common.enums.userPush.SpecialPrivilegeEnum;
import com.qmth.teachcloud.common.service.SysUserService;
import com.qmth.teachcloud.common.sync.CloudMarkingTaskUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;

/**
 * @Description: 推送云阅卷帮助类
 * @Author: CaoZixuan
 * @Date: 2021-10-27
 */
@SpringBootTest
@RunWith(SpringRunner.class)
public class SyncHelpTest {

    @Resource
    private CloudMarkingTaskUtils stmmsUtils;
    @Resource
    private SysUserService sysUserService;

    @Test
    public void testSyncUser() throws IllegalAccessException {
        int x = 0;
        while (x < 10){
            x ++;
            UserPushParam userPushParam = new UserPushParam();
            if (x < 7){
                userPushParam.setAccount(String.valueOf(x));
            }
            if (x % 2 == 1){
                userPushParam.setRole(SpecialPrivilegeEnum.MARKER);
            }else {
                userPushParam.setRole(SpecialPrivilegeEnum.SUBJECT_HEADER);
            }
            userPushParam.setSchoolId(2L);
            stmmsUtils.syncUser(userPushParam);
        }
    }

    @Test
    public void testAutoPushUserErrorData() throws IllegalAccessException {
        sysUserService.autoPushUserErrorData();
    }
}
