智慧保安后台管理-外网项目备份
Administrator
2021-08-23 feba1c5df4ab7ac0313b91d9cb552a12997abfc6
src/main/java/org/springblade/modules/exam/service/impl/ExamScoreServiceImpl.java
@@ -6,6 +6,7 @@
import lombok.AllArgsConstructor;
import org.springblade.common.utils.arg;
import org.springblade.core.mp.support.Condition;
import org.springblade.modules.FTP.FtpUtil;
import org.springblade.modules.apply.entity.Apply;
import org.springblade.modules.apply.service.ApplyService;
import org.springblade.modules.exam.entity.ExamExaminationSubject;
@@ -31,6 +32,7 @@
import org.springframework.transaction.annotation.Transactional;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -155,6 +157,14 @@
            //修改为已考试
            apply1.setIsExam(2);
            applyService.updateById(apply1);
            //数据同步
            String s =
               "update sys_apply set is_exam = " + apply1.getIsExam() + " " +"where id = " + "'" + apply1.getId() + "';" +
                  "update blade_user set is_apply = " + user.getIsApply() + " " +"where id = " + "'" + user.getId() + "'";
            FtpUtil.sqlFileUpload(s);
         }
         //模拟考试
         if(paper.getExamType()==2){
@@ -170,6 +180,12 @@
            //修改为已考试
            trainingRegistration1.setIsExam(2);
            trainingRegistrationService.updateById(trainingRegistration1);
            //数据同步
            String s =
               "update sys_training_registration set is_exam = " + trainingRegistration1.getIsExam() + " " +"where id = " + "'" + trainingRegistration1.getId() + "';" +
                  "update blade_user set is_apply = " + user.getIsApply() + " " +"where id = " + "'" + user.getId() + "'";
            FtpUtil.sqlFileUpload(s);
         }
         //设置考试ID
@@ -191,7 +207,15 @@
         }
         //修改成绩数据
         int i = baseMapper.updateById(examScore);
         //修改考试状态
         String s1 =
            "update exam_score set exam_id = " + examScore.getExamId() +
               ",theory_grade = " + "'" + examScore.getTheoryGrade() + "'" +
               ",all_grade = " + "'" + examScore.getAllGrade() + "'" +
               ",exam_end_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:dd").format(examScore.getExamEndTime()) + "'" +
               ",qualified = " + "'" + examScore.getQualified() + "'" +
               " " +"where id = " + "'" + examScore.getId() + "'";
         FtpUtil.sqlFileUpload(s1);
         if (i>0){
            //返回结果
@@ -226,7 +250,6 @@
                     //正式考试通过生成保安证编号
                     if (examPaper.getExamType()==1) {
                        //去生成保安证编号
                        String pre = SecurityPaperUtil.getSecurityPaper();
                        //查询当前年份已有的保安证编号
                        int count = userService.getSecurityPaperCount(pre);
@@ -248,6 +271,13 @@
                        user.setRoleId(oneRole.getId().toString());
                        //更新保安数据
                        userService.updateById(user);
                        String s1 =
                           "update blade_user set role_id = " + "'" +  user.getRoleId() + "'" +
                              ",hold = " + "'" + user.getHold() + "'" +
                              ",securitynumber = " + "'" + user.getSecuritynumber() + "'" +
                              " " +"where id = " + "'" + user.getId() + "'";
                        FtpUtil.sqlFileUpload(s1);
                     }
                  } else {
                     //不合格
@@ -261,6 +291,14 @@
                     examScore.setAllGrade(Integer.parseInt(String.valueOf(Math.round(examScore.getTheoryGrade()*0.3)))
                        + Integer.parseInt(String.valueOf(Math.round(examScoreExcel.getLearnGrade()*0.7))));
                  }
                  //内网同步
                  String s1 =
                     "update exam_score set learn_grade = " + "'" + examScore.getLearnGrade() + "'" +
                        ",all_grade = " + "'" + examScore.getAllGrade() + "'" +
                        ",qualified = " + "'" + examScore.getQualified() + "'" +
                        " " +"where id = " + "'" + examScore.getId() + "'";
                  FtpUtil.sqlFileUpload(s1);
                  //更新成绩数据
                  baseMapper.updateById(examScore);
               }