智慧保安后台管理-外网
src/main/java/org/springblade/modules/exam/service/impl/ExamScoreServiceImpl.java
@@ -249,19 +249,27 @@
         examScoreExcelList.forEach(examScoreExcel -> {
            if (null!=examScoreExcel.getLearnGrade() && null!=examScoreExcel.getIdCardNo() && examScoreExcel.getIdCardNo()!=""){
               //使用考试名称匹配考试信息
//               ExamPaper examPaper = examPaperService.getExamInfoByExamName(examScoreExcel.getExamName());
               List<ExamPaper> examPaperList = examPaperService.getExamInfoByExamName(examScoreExcel.getExamName());
               ExamPaper examPaper = examPaperList.get(0);
               //查询出成绩数据
//               ExamScore examScore = baseMapper.getExamScoreInfoByIdCardNo(examScoreExcel.getIdCardNo(),examPaper.getId());
               if (examPaperList.size()>0){
                  //取第一个
                  List<ExamScore> examScoreList = baseMapper.getExamScoreInfoByIdCardNo(examScoreExcel.getIdCardNo(),new SimpleDateFormat("yyyy-MM-dd").format(examPaper.getStartTime()));
                  if (examScoreList.size()==0){
               //根据身份证号查询用户
               User user0 = userService.getUserInfoByIdCardNo(examScoreExcel.getIdCardNo());
               if (null==user0){
                  throw new ServiceException("用户:["+examScoreExcel.getIdCardNo()+"]不存在");
                        throw new ServiceException("没有找到用户:["+examScoreExcel.getIdCardNo()+"]相关考试成绩信息,请检查身份证是否有误!");
//                        throw new ServiceException("用户:["+examScoreExcel.getIdCardNo()+"]不存在");
               }
               ExamScore examScore1 = new ExamScore();
               examScore1.setCandidateNo(examScoreExcel.getCandidateNo());
               examScore1.setUserId(user0.getId().toString());
               //根据准考证号和用户id查询考试成绩
               ExamScore examScore = this.getOne(Condition.getQueryWrapper(examScore1));
                  }
                  //遍历集合
                  examScoreList.forEach(examScore -> {
//                     ExamScore examScore1 = new ExamScore();
//                     examScore1.setCandidateNo(examScoreExcel.getCandidateNo());
//                     examScore1.setUserId(user0.getId().toString());
//                     //根据准考证号和用户id查询考试成绩
//                     ExamScore examScore = this.getOne(Condition.getQueryWrapper(examScore1));
               if (null!=examScore) {
                  //查询当前保安信息
                  UserVO user = userService.getUserAgeById(Long.parseLong(examScore.getUserId()));
@@ -293,22 +301,18 @@
//                        user.setPaperTime(new Date());
                        //修改为持证保安
                        user.setHold("1");
                              user.setUpdateTime(new Date());
                        //更新保安数据
                        userService.updateById(user);
                        String s1 =
                           "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);
                     }
                     //分配保安角色
//                        Role role = new Role();
//                        role.setRoleAlias("保安");
//                        Role oneRole = roleService.getOne(Condition.getQueryWrapper(role));
//                        user.setRoleId(oneRole.getId().toString());
//                     }
                  } else {
                     //不合格
                     examScore.setQualified(1);
@@ -343,6 +347,11 @@
                  errorList.add(examScoreExcel.getIdCardNo());
                  status.set(false);
               }
                  });
               }else {
                  throw new ServiceException("导入失败!考试名称:["+examScoreExcel.getExamName()+"]不存在!请核对!");
               }
            }
         });
         //如果所有数据导入有一个异常