智慧保安后台管理-外网
Administrator
2021-12-10 b9e7b481df7a89346a564d5c10d534745903d156
src/main/java/org/springblade/modules/exam/service/impl/ExamPaperServiceImpl.java
@@ -18,6 +18,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.common.utils.TimeSwitchUtil;
import org.springblade.core.mp.support.Condition;
import org.springblade.modules.apply.entity.Apply;
import org.springblade.modules.exam.entity.*;
@@ -32,6 +33,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@@ -81,6 +83,21 @@
         if (examPaperVO1.getExamType()==2) {
            examPaperVO1.setNum(baseMapper.getTrainNumber(examPaperVO1));
            examPaperVO1.setExamNum(baseMapper.getExamNumber(examPaperVO1));
            //计算截止时间
            long nowTime = System.currentTimeMillis();
            long examStartTime = examPaperVO1.getStartTime().getTime();
            long examEndTime = examPaperVO1.getEndTime().getTime();
            //判断时间
            if (nowTime-examEndTime>0){
               //剩余时间大于1天
               examPaperVO1.setDeadline("考试已结束");
            }else if(nowTime-examStartTime>=0 && nowTime-examEndTime<=0){
               //已到考试时间
               examPaperVO1.setDeadline("已到考试时间");
            }else {
               long time = examStartTime - nowTime;
               examPaperVO1.setDeadline(TimeSwitchUtil.secondToTime(time));
            }
         }
      });
      return examPaperVOIPage;