package com.ruoyi.syzy.service.impl;

import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.voluntary.domain.BusiScoreLock;
import com.ruoyi.voluntary.service.IBusiScoreLockService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SyMockPlanService {

    @Autowired
    private IBusiScoreLockService scoreLockService;

    public Boolean getIsMockForPlan(){
        //从配置文件中取
        Boolean isMock = Boolean.FALSE;
        List<BusiScoreLock> busiScoreLockList = scoreLockService.selectBusiScoreLockList(new BusiScoreLock().setProvinceName(SecurityUtils.getLoginUser().getUser().getProvinceName()));
        if(CollectionUtils.isNotEmpty(busiScoreLockList)){
            BusiScoreLock userMock = busiScoreLockList.get(0);
            isMock= 1==userMock.getIsMock()?Boolean.TRUE:Boolean.FALSE;
        }else{
            isMock= Boolean.FALSE;
        }

        return isMock;
    }
}
