智慧保安后台管理-外网项目备份
钟日健
2026-06-01 62eb499b0c969f246d3245d1429a97da4de1ce28
src/main/java/org/springblade/modules/exam/service/impl/ExamScoreServiceImpl.java
@@ -229,6 +229,10 @@
         } else {
            examScore.setQualified(1);
         }
         // 这个值已经有了,不要重复赋值,前端赋值可能是错的
         if (null!=examScore.getExamTime()){
            examScore.setExamTime(null);
         }
         //修改成绩数据
         int i = baseMapper.updateById(examScore);
@@ -290,11 +294,17 @@
//                     ExamScore examScore = this.getOne(Condition.getQueryWrapper(examScore1));
                     if (null != examScore) {
                        //查询当前保安信息
                        UserVO user = userService.getUserAgeById(Long.parseLong(examScore.getUserId()));
                        UserVO user = userService.getUserAgeById(examScore.getUserId());
                        //设置实操成绩
                        examScore.setLearnGrade(examScoreExcel.getLearnGrade());
                        if (examScoreExcel.getLearnGrade().equals("合格")) {
                           examScore.setLearnGrade(0);
                        }
                        if (examScoreExcel.getLearnGrade().equals("不合格")) {
                           examScore.setLearnGrade(1);
                        }
                        if (null != examScore.getTheoryGrade()) {
                           if (examScore.getTheoryGrade() >= 60 && examScore.getLearnGrade() >= 60) {
                           //理论成绩大于60,实操成绩为合格
                           if (examScore.getTheoryGrade() >= 60 && examScore.getLearnGrade() == 0) {
                              //合格
                              examScore.setQualified(0);
                              //修改制证状态为未制证
@@ -307,10 +317,10 @@
                                 int count = userService.getSecurityPaperCount(pre);
                                 String result = null;
                                 if (count == 0) {
                                    result = pre + "00001";
                                    result = pre + "000001";
                                 } else {
                                    //格式化
                                    DecimalFormat decimalFormat = new DecimalFormat("00000");
                                    DecimalFormat decimalFormat = new DecimalFormat("000000");
                                    count++;
                                    result = pre + (decimalFormat.format(count));
                                 }
@@ -341,44 +351,15 @@
                                       ",user_type = " + "'" + user.getUserType() + "'" +
                                       " " + "where id = " + "'" + user.getId() + "'";
//                                 String s1 =
//                                    "insert into sys_security_paper(id,number,create_time,people_name,id_card_no,user_id,apply_id,exam_id) " +
//                                       "values(" + "'" + securityPaper.getId() + "'"
//                                       + "," + "'" + securityPaper.getNumber() +"'"
//                                       + "," + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(securityPaper.getCreateTime()) +"'"
//                                       + "," + "'" + securityPaper.getPeopleName() + "'"
//                                       + "," + "'" + securityPaper.getIdCardNo() + "'"
//                                       + "," + "'" + securityPaper.getUserId() + "'"
//                                       + "," + "'" + securityPaper.getApplyId() + "'"
//                                       + "," +"'" + securityPaper.getExamId() + "'" + ");" +
//                                    "update blade_user set hold = " + "'" + user.getHold() + "'" +
//                                       ",securitynumber = " + "'" + user.getSecuritynumber() + "'" +
//                                       ",update_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getUpdateTime()) + "'" +
//                                       ",user_type = " + "'" + user.getUserType() + "'" +
//                                       " " + "where id = " + "'" + user.getId() + "'";
                                 //FtpUtil.sqlFileUpload(s1);
                                 myAsyncService.dataSync(s1);
                              }
                           }else{
                              //其他情况全为不合格
                              examScore.setQualified(1);
                           }
                        } else {
                           //不合格
                           examScore.setQualified(1);
                        }
                        //总成绩
                        if (user.getAge() <= 50) {
                           if (null != examScore.getTheoryGrade()) {
                              examScore.setAllGrade(Math.round((examScore.getTheoryGrade() + examScoreExcel.getLearnGrade()) / 2));
                           } else {
                              examScore.setAllGrade(Math.round(examScoreExcel.getLearnGrade() / 2));
                           }
                        }
                        if (user.getAge() > 50) {
                           if (null != examScore.getTheoryGrade()) {
                              examScore.setAllGrade(Integer.parseInt(String.valueOf(Math.round(examScore.getTheoryGrade() * 0.5)))
                                 + Integer.parseInt(String.valueOf(Math.round(examScoreExcel.getLearnGrade() * 0.5))));
                           } else {
                              examScore.setAllGrade(Math.round(examScoreExcel.getLearnGrade() / 2));
                           }
                        }
                        //内网同步
@@ -623,7 +604,8 @@
    * @return
    */
   @Override
   public boolean refreshTrainExamInfo(UpdateParamVo updateParamVo) {
   public Object refreshTrainExamInfo(UpdateParamVo updateParamVo) {
      Map<String, Object> map = new HashMap<>();
      if (null != updateParamVo.getScoreId()) {
         ExamScore examScore = this.getById(updateParamVo.getScoreId());
         //获取成绩数据,准考证号,用户id,报名培训id,考试id
@@ -642,7 +624,7 @@
               //2.修改用户考试状态
               User user = new User();
               user.setIsTrain(1);
               user.setId(Long.parseLong(examScore.getUserId()));
               user.setId(examScore.getUserId());
               //修改
               userService.updateById(user);
@@ -663,6 +645,15 @@
            }
            //培训考试
            if (paper.getExamType() == 2) {
               // 判断是否在考试时间内,如果不是则无法重置
               long l = System.currentTimeMillis();
               long endTime = paper.getEndTime().getTime();
               if (l>endTime){
                  map.put("msg","已过考试时间,无法重置考试");
                  map.put("code",400);
                  // 已过考试时间
                  return map;
               }
               //1.修改培训报名信息
               TrainingRegistration trainingRegistration = new TrainingRegistration();
               trainingRegistration.setId(examScore.getApplyId());
@@ -673,7 +664,7 @@
               //2.修改用户考试状态
               User user = new User();
               user.setIsTrain(1);
               user.setId(Long.parseLong(examScore.getUserId()));
               user.setId(examScore.getUserId());
               //修改
               userService.updateById(user);
@@ -681,16 +672,18 @@
               this.removeById(updateParamVo.getScoreId());
               //4.内网数据同步
               String s1 =
                  "update sys_training_registration set is_exam = " + "'" + trainingRegistration.getIsExam() + "'" +
                     " " + "where id = " + "'" + trainingRegistration.getId() + "';" +
                     "update blade_user set is_train = " + "'" + user.getIsTrain() + "'" +
                     " " + "where id = " + "'" + user.getId() + "';" +
                     "delete from exam_score where id = " + "'" + updateParamVo.getScoreId() + "'";
               //FtpUtil.sqlFileUpload(s1);
               myAsyncService.dataSync(s1);
               return true;
//               String s1 =
//                  "update sys_training_registration set is_exam = " + "'" + trainingRegistration.getIsExam() + "'" +
//                     " " + "where id = " + "'" + trainingRegistration.getId() + "';" +
//                     "update blade_user set is_train = " + "'" + user.getIsTrain() + "'" +
//                     " " + "where id = " + "'" + user.getId() + "';" +
//                     "delete from exam_score where id = " + "'" + updateParamVo.getScoreId() + "'";
//               //FtpUtil.sqlFileUpload(s1);
//               myAsyncService.dataSync(s1);
               map.put("msg","重置成功");
               map.put("code",200);
               // 已过考试时间
               return map;
            }
         }
      }
@@ -760,7 +753,7 @@
               //修改培训考试状态
               User user = new User();
               user.setId(Long.parseLong(examScore.getUserId()));
               user.setId(examScore.getUserId());
               user.setIsTrain(3);
               userService.updateById(user);
               //修改人员考试状态
@@ -905,4 +898,9 @@
      //返回数据
      return objectList;
   }
   @Override
   public List<ExamScoreVO> getList(ExamScoreVO examScoreVO) {
      return baseMapper.getList(examScoreVO);
   }
}